Cleanup/optimization of view update code
This commit is contained in:
parent
a82d486a35
commit
60267c3338
1 changed files with 23 additions and 17 deletions
24
src/Bar.ahk
24
src/Bar.ahk
|
@ -697,28 +697,34 @@ Bar_updateTitle(debugMsg = "") {
|
||||||
Bar_aWndId := aWndId
|
Bar_aWndId := aWndId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; Update the view portion of the status bar.
|
||||||
Bar_updateView(m, v) {
|
Bar_updateView(m, v) {
|
||||||
Local managedWndId0, wndId0, wndIds
|
Local IdsLen, ViewIdsLen
|
||||||
|
|
||||||
StringTrimRight, wndIds, Manager_managedWndIds, 1
|
|
||||||
StringSplit, managedWndId, wndIds, `;
|
|
||||||
GuiN := (m - 1) + 1
|
GuiN := (m - 1) + 1
|
||||||
Gui, %GuiN%: Default
|
Gui, %GuiN%: Default
|
||||||
Loop, %Config_viewCount% {
|
|
||||||
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
|
IdsLen := StrLen(Manager_managedWndIds)
|
||||||
StringSplit, wndId, wndIds, `;
|
|
||||||
If (A_Index = v)
|
|
||||||
If (v = Monitor_#%m%_aView_#1) {
|
If (v = Monitor_#%m%_aView_#1) {
|
||||||
|
; Set foreground/background colors if the view is the current view.
|
||||||
GuiControl, +Background%Config_selBgColor1% +c%Config_selFgColor2%, Bar_#%m%_#%v%_tagged
|
GuiControl, +Background%Config_selBgColor1% +c%Config_selFgColor2%, Bar_#%m%_#%v%_tagged
|
||||||
GuiControl, +c%Config_selFgColor1%, Bar_#%m%_#%v%
|
GuiControl, +c%Config_selFgColor1%, Bar_#%m%_#%v%
|
||||||
} Else If wndId0 {
|
} Else If StrLen(View_#%m%_#%v%_wndIds) > 0 {
|
||||||
|
; Set foreground/background colors if the view contains windows.
|
||||||
GuiControl, +Background%Config_normBgColor5% +c%Config_normFgColor8%, Bar_#%m%_#%v%_tagged
|
GuiControl, +Background%Config_normBgColor5% +c%Config_normFgColor8%, Bar_#%m%_#%v%_tagged
|
||||||
GuiControl, +c%Config_normFgColor7%, Bar_#%m%_#%v%
|
GuiControl, +c%Config_normFgColor7%, Bar_#%m%_#%v%
|
||||||
} Else {
|
} Else {
|
||||||
|
; Set foreground/background colors if the view is empty.
|
||||||
GuiControl, +Background%Config_normBgColor1% +c%Config_normFgColor8%, Bar_#%m%_#%v%_tagged
|
GuiControl, +Background%Config_normBgColor1% +c%Config_normFgColor8%, Bar_#%m%_#%v%_tagged
|
||||||
GuiControl, +c%Config_normFgColor1%, Bar_#%m%_#%v%
|
GuiControl, +c%Config_normFgColor1%, Bar_#%m%_#%v%
|
||||||
}
|
}
|
||||||
GuiControl, , Bar_#%m%_#%A_Index%_tagged, % wndId0 / managedWndId0 * 100
|
|
||||||
|
Loop, %Config_viewCount% {
|
||||||
|
ViewIdsLen := StrLen( View_#%m%_#%A_Index%_wndIds )
|
||||||
|
; Update the percentage fill for the view.
|
||||||
|
GuiControl, , Bar_#%m%_#%A_Index%_tagged, % ViewIdsLen / IdsLen * 100
|
||||||
|
; Refresh the number on the bar.
|
||||||
GuiControl, , Bar_#%m%_#%A_Index%, %A_Index%
|
GuiControl, , Bar_#%m%_#%A_Index%, %A_Index%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue