Update the layout of the current view if it is re-activated.

This commit is contained in:
Joshua Fuhs 2012-06-21 18:54:00 -04:00
parent 5276471f49
commit 8e5e42a653

View file

@ -40,56 +40,64 @@ Monitor_activateView(v) {
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, +1, 1, Config_viewCount)
Else If (v = "<")
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, -1, 1, Config_viewCount)
If (v > 0) And (v <= Config_viewCount) And Not Manager_hideShow And Not (v = Monitor_#%Manager_aMonitor%_aView_#1) {
aView := Monitor_#%Manager_aMonitor%_aView_#1
WinGet, aWndId, ID, A
If WinExist("ahk_id" aWndId) And InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, aWndId ";") {
WinGetClass, aWndClass, ahk_id %aWndId%
WinGetTitle, aWndTitle, ahk_id %aWndId%
If Not (aWndClass = "Progman") And Not (aWndClass = "AutoHotkeyGui" And SubStr(aWndTitle, 1, 10) = "bug.n_BAR_") And Not (aWndClass = "DesktopBackgroundClass")
View_#%Manager_aMonitor%_#%aView%_aWndId := aWndId
}
n := Config_syncMonitorViews
If (n = 1)
n := Manager_monitorCount
Else If (n < 1)
n := 1
Loop, % n {
If (n = 1)
m := Manager_aMonitor
Else
m := A_Index
Monitor_#%m%_aView_#2 := aView
Monitor_#%m%_aView_#1 := v
Manager_hideShow := True
StringTrimRight, wndIds, View_#%m%_#%aView%_wndIds, 1
Loop, PARSE, wndIds, `;
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
WinHide, ahk_id %A_LoopField%
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
Loop, PARSE, wndIds, `;
WinShow, ahk_id %A_LoopField%
Manager_hideShow := False
Bar_updateView(m, aView)
Bar_updateView(m, v)
View_arrange(m, v)
}
wndId := View_#%Manager_aMonitor%_#%v%_aWndId
If Not (wndId And WinExist("ahk_id" wndId)) {
If View_#%Manager_aMonitor%_#%v%_wndIds {
wndId := SubStr(View_#%Manager_aMonitor%_#%v%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%v%_wndIds, ";")-1)
View_#%Manager_aMonitor%_#%v%_aWndId := wndId
} Else
wndId := 0
}
Manager_winActivate(wndId)
;Log_msg("Monitor_activateView(" . v . ") wndIds: " . View_#%m%_#%aView%_wndIds)
If (v <= 0) Or (v > Config_viewCount) Or Manager_hideShow
Return
; Re-arrange the windows on the view.
If (v = Monitor_#%Manager_aMonitor%_aView_#1) {
View_arrange(Manager_aMonitor, v)
Return
}
aView := Monitor_#%Manager_aMonitor%_aView_#1
WinGet, aWndId, ID, A
If WinExist("ahk_id" aWndId) And InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, aWndId ";") {
WinGetClass, aWndClass, ahk_id %aWndId%
WinGetTitle, aWndTitle, ahk_id %aWndId%
If Not (aWndClass = "Progman") And Not (aWndClass = "AutoHotkeyGui" And SubStr(aWndTitle, 1, 10) = "bug.n_BAR_") And Not (aWndClass = "DesktopBackgroundClass")
View_#%Manager_aMonitor%_#%aView%_aWndId := aWndId
}
n := 1
If (Config_syncMonitorViews > 0)
n := Manager_monitorCount
Loop, % n {
If (n = 1)
m := Manager_aMonitor
Else
m := A_Index
Monitor_#%m%_aView_#2 := aView
Monitor_#%m%_aView_#1 := v
Manager_hideShow := True
StringTrimRight, wndIds, View_#%m%_#%aView%_wndIds, 1
Loop, PARSE, wndIds, `;
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
WinHide, ahk_id %A_LoopField%
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
DetectHiddenWindows, On
View_arrange(m, v)
DetectHiddenWindows, Off
Loop, PARSE, wndIds, `;
WinShow, ahk_id %A_LoopField%
Manager_hideShow := False
Bar_updateView(m, aView)
Bar_updateView(m, v)
}
wndId := View_#%Manager_aMonitor%_#%v%_aWndId
If Not (wndId And WinExist("ahk_id" wndId)) {
If View_#%Manager_aMonitor%_#%v%_wndIds {
wndId := SubStr(View_#%Manager_aMonitor%_#%v%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%v%_wndIds, ";")-1)
View_#%Manager_aMonitor%_#%v%_aWndId := wndId
} Else
wndId := 0
}
Manager_winActivate(wndId)
}
Monitor_get(x, y) {