Separation of responsibilities. Enforce the 'window manipulation doesn't affect layout definition' mantra

This commit is contained in:
Joshua Fuhs 2012-06-23 21:20:12 -04:00
parent 4bf1aef3e6
commit bce40f67e8
2 changed files with 31 additions and 20 deletions

View file

@ -329,26 +329,7 @@ Manager_manage(wndId) {
Loop, % Config_viewCount
If (Manager_#%wndId%_tags & 1 << A_Index - 1) {
l := View_#%m%_#%A_Index%_layout_#1
If (Config_layoutFunction_#%l% = "tile") And ((Config_newWndPosition = "masterBottom") Or (Config_newWndPosition = "stackTop")) {
n := View_getTiledWndIds(m, A_Index, wndIds)
If (n > 1) {
StringSplit, wndId, wndIds, `;
If (wndId0 < View_#%m%_#%A_Index%_layoutMSplit)
View_#%m%_#%A_Index%_layoutMSplit := wndId0
i := View_#%m%_#%A_Index%_layoutMSplit
search := wndId%i% ";"
replace := search wndId ";"
StringReplace, View_#%m%_#%A_Index%_wndIds, View_#%m%_#%A_Index%_wndIds, %search%, %replace%
} Else
View_#%m%_#%A_Index%_wndIds .= wndId ";"
If (Config_newWndPosition = "masterBottom") And (n > 0)
View_#%m%_#%A_Index%_layoutMSplit += 1
} Else If (Config_newWndPosition = "bottom")
View_#%m%_#%A_Index%_wndIds .= wndId ";"
Else
View_#%m%_#%A_Index%_wndIds := wndId ";" View_#%m%_#%A_Index%_wndIds
Bar_updateView(m, A_Index)
View_addWnd(m, A_Index, wndId)
}
If Not Config_showBorder

View file

@ -69,6 +69,36 @@ View_updateLayout(m, v) {
View_updateLayout_%fn%(m, v)
}
View_addWnd(m, v, wndId) {
Local l, msplit, i, wndIds, n
l := View_#%m%_#%v%_layout_#1
If (Config_layoutFunction_#%l% = "tile") And ((Config_newWndPosition = "masterBottom") Or (Config_newWndPosition = "stackTop")) {
n := View_getTiledWndIds(m, v, wndIds)
msplit := View_#%m%_#%v%_layoutMSplit
If ( msplit = 1 And Config_newWndPosition="masterBottom" ) {
View_#%m%_#%v%_wndIds := wndId ";" . View_#%m%_#%v%_wndIds
}
Else If ( (Config_newWndPosition="masterBottom" And n < msplit) Or (Config_newWndPosition="stackTop" And n <= msplit) ) {
View_#%m%_#%v%_wndIds .= wndId ";"
}
Else {
If (Config_newWndPosition="masterBottom")
i := msplit - 1
Else
i := msplit
StringSplit, wndId, wndIds, `;
search := wndId%i% ";"
replace := search wndId ";"
StringReplace, View_#%m%_#%v%_wndIds, View_#%m%_#%v%_wndIds, %search%, %replace%
}
}
Else If (Config_newWndPosition = "bottom")
View_#%m%_#%v%_wndIds .= wndId ";"
Else
View_#%m%_#%v%_wndIds := wndId ";" View_#%m%_#%v%_wndIds
}
View_arrange(m, v) {
Local fn, l, wndIds