Unified functions for setting layout properties
... to View_setLayoutProperty
This commit is contained in:
parent
4ec9578507
commit
6db371a134
6 changed files with 98 additions and 86 deletions
|
@ -10,13 +10,34 @@
|
|||
|
||||
1. `~` Renamed the function `Manager_toggleDecor` to `Window_toggleDecor`
|
||||
2. `~` Renamed the function `View_toggleFloating` to `View_toggleFloatingWindow`
|
||||
3. `~` Migrated the following functions to `View_setLayoutProperty`: `View_setMFactor`, `View_setMX`, `View_setMY` and `View_rotateLayoutAxis`
|
||||
|
||||
| # | Configuration variables | Hotkeys |
|
||||
| --:| ----------------------- | -------------------------------------- |
|
||||
| 1. | | `-` `#+d::Manager_toggleDecor()` |
|
||||
| | | `+` `#+d::Window_toggleDecor()` |
|
||||
| 2. | | `-` `#+f::View_toggleFloating()` |
|
||||
| | | `+` `#+f::View_toggleFloatingWindow()` |
|
||||
| # | Configuration variables | Hotkeys |
|
||||
| --:| ----------------------- | --------------------------------------------------------- |
|
||||
| 1. | | `-` `#+d::Manager_toggleDecor()` |
|
||||
| | | `+` `#+d::Window_toggleDecor()` |
|
||||
| 2. | | `-` `#+f::View_toggleFloating()` |
|
||||
| | | `+` `#+f::View_toggleFloatingWindow()` |
|
||||
| 3. | | `-` `#Left::View_setMFactor(-0.05)` |
|
||||
| | | `+` `#Left::View_setLayoutProperty("MFactor", 0, -0.05)` |
|
||||
| | | `-` `#Right::View_setMFactor(+0.05)` |
|
||||
| | | `+` `#Right::View_setLayoutProperty("MFactor", 0, +0.05)` |
|
||||
| | | `-` `#^t::View_rotateLayoutAxis(1, +1)` |
|
||||
| | | `+` `#^t::View_setLayoutProperty("Axis", 0, +1, 1)` |
|
||||
| | | `-` `#^Enter::View_rotateLayoutAxis(1, +2)` |
|
||||
| | | `+` `#^Enter::View_setLayoutProperty("Axis", 0, +2, 1)` |
|
||||
| | | `-` `#^Tab::View_rotateLayoutAxis(2, +1)` |
|
||||
| | | `+` `#^Tab::View_setLayoutProperty("Axis", 0, +1, 2)` |
|
||||
| | | `-` `#^+Tab::View_rotateLayoutAxis(3, +1)` |
|
||||
| | | `+` `#^+Tab::View_setLayoutProperty("Axis", 0, +1, 3)` |
|
||||
| | | `-` `#^Up::View_setMY(+1)` |
|
||||
| | | `+` `#^Up::View_setLayoutProperty("MY", 0, +1)` |
|
||||
| | | `-` `#^Down::View_setMY(-1)` |
|
||||
| | | `+` `#^Down::View_setLayoutProperty("MY", 0, -1)` |
|
||||
| | | `-` `#^Right::View_setMX(+1)` |
|
||||
| | | `+` `#^Right::View_setLayoutProperty("MX", 0, +1)` |
|
||||
| | | `-` `#^Left::View_setMX(-1)` |
|
||||
| | | `+` `#^Left::View_setLayoutProperty("MX", 0, -1)` |
|
||||
|
||||
### 8.4.0
|
||||
|
||||
|
|
|
@ -202,9 +202,9 @@ Windows version uses " (Keine Rückmeldung)".
|
|||
|
||||
`Config_mFactCallInterval=700`
|
||||
> The time in milliseconds, in which two consecutive calls to
|
||||
`View_setMFactor(<d>, <dFact>)` have to be made, to accelerate the increasing
|
||||
or decreasing of `mfact`. See also `View_setMFactor(<d>, <dFact>)` in the
|
||||
listing of hotkeys.
|
||||
`View_setLayoutProperty("MFactor", 0, <d>, <dFact>)` have to be made, to
|
||||
accelerate the increasing or decreasing of `mfact`. See also
|
||||
`View_setLayoutProperty("MFactor", 0, <d>, <dFact>)` in the listing of hotkeys.
|
||||
|
||||
`Config_mouseFollowsFocus=1`
|
||||
> If true (`=1`), the mouse pointer is set over the focused window, if a window
|
||||
|
|
|
@ -120,49 +120,49 @@ the default configuration).
|
|||
> Set the 1<sup><small>st</small></sup> defined layout (i. e. tile layout in
|
||||
the default configuration).
|
||||
|
||||
`#Left::View_setMFactor(-0.05)`
|
||||
`#Left::View_setLayoutProperty("MFactor", 0, -0.05)`
|
||||
> Reduce the size of the master area in the active view (only for the "tile"
|
||||
layout). You may also set a second parameter for accelerating the first one.
|
||||
E. g. with `#Left::View_setMFactor(-0.05, 2)` the first step, by which the
|
||||
master area is reduced, is -0.0016% and will be doubled with consecutive calls
|
||||
until it reaches -0.05%.
|
||||
E. g. with `#Left::View_setLayoutProperty("MFactor", 0, -0.05, 2)` the first
|
||||
step, by which the master area is reduced, is -0.0016% and will be doubled with
|
||||
consecutive calls until it reaches -0.05%.
|
||||
|
||||
`#Right::View_setMFactor(+0.05)`
|
||||
`#Right::View_setLayoutProperty("MFactor", 0, +0.05)`
|
||||
> Enlarge the size of the master area in the active view (only for the "tile"
|
||||
layout). You may also set a second parameter for accelerating the first one.
|
||||
E. g. with `#Right::View_setMFactor(0.05, 0.5)` the first step, by which the
|
||||
master area is reduced, is 0.05%, but with consecutive calls it will be halved
|
||||
until it reaches 0.0016%.
|
||||
E. g. with `#Right::View_setLayoutProperty("MFactor", 0, +0.05, 0.5)` the first
|
||||
step, by which the master area is reduced, is 0.05%, but with consecutive calls
|
||||
it will be halved until it reaches 0.0016%.
|
||||
|
||||
`#^t::View_rotateLayoutAxis(1, +1)`
|
||||
`#^t::View_setLayoutProperty("Axis", 0, +1, 1)`
|
||||
> Rotate the layout axis (i. e. 2 -> 1 = vertical layout, 1 -> 2 = horizontal
|
||||
layout, only for the "tile" layout).
|
||||
|
||||
`#^Enter::View_rotateLayoutAxis(1, +2)`
|
||||
`#^Enter::View_setLayoutProperty("Axis", 0, +2, 1)`
|
||||
> Mirror the layout axis (i. e. -1 -> 1 / 1 -> -1 = master on the left / right
|
||||
side, -2 -> 2 / 2 -> -2 = master at top / bottom, only for the "tile" layout).
|
||||
|
||||
`#^Tab::View_rotateLayoutAxis(2, +1)`
|
||||
`#^Tab::View_setLayoutProperty("Axis", 0, +1, 2)`
|
||||
> Rotate the master axis (i. e. 3 -> 1 = x-axis = horizontal stack, 1 -> 2 =
|
||||
y-axis = vertical stack, 2 -> 3 = z-axis = monocle, only for the "tile" layout).
|
||||
|
||||
`#^+Tab::View_rotateLayoutAxis(3, +1)`
|
||||
`#^+Tab::View_setLayoutProperty("Axis", 0, +1, 3)`
|
||||
> Rotate the stack axis (i. e. 3 -> 1 = x-axis = horizontal stack, 1 -> 2 =
|
||||
y-axis = vertical stack, 2 -> 3 = z-axis = monocle, only for the "tile" layout).
|
||||
|
||||
`#^Up::View_setMY(+1)`
|
||||
`#^Up::View_setLayoutProperty("MY", 0, +1)`
|
||||
> Increase the master Y dimension by 1, i.e. increase the number of windows in
|
||||
the master area by X. Maximum of 9 (only for the "tile" layout).
|
||||
|
||||
`#^Down::View_setMY(-1)`
|
||||
`#^Down::View_setLayoutProperty("MY", 0, -1)`
|
||||
> Decrease the master Y dimension by 1, i.e. decrease the number of windows in
|
||||
the master area by X. Minimum of 1 (only for the "tile" layout).
|
||||
|
||||
`#^Right::View_setMX(+1)`
|
||||
`#^Right::View_setLayoutProperty("MX", 0, +1)`
|
||||
> Increase the master X dimension by 1, i. e. increase the number of windows in
|
||||
the master area by Y. Maximum of 9 (only for the "tile" layout).
|
||||
|
||||
`#^Left::View_setMX(-1)`
|
||||
`#^Left::View_setLayoutProperty("MX", 0, +1)`
|
||||
> Decrease the master X dimension by 1, i. e. decrease the number of windows in
|
||||
the master area by Y. Minimum of 1 (only for the "tile" layout).
|
||||
|
||||
|
|
|
@ -423,16 +423,16 @@ Config_UI_saveSession() {
|
|||
#f::View_setLayout(3)
|
||||
#m::View_setLayout(2)
|
||||
#t::View_setLayout(1)
|
||||
#Left::View_setMFactor(-0.05)
|
||||
#Right::View_setMFactor(+0.05)
|
||||
#^t::View_rotateLayoutAxis(1, +1)
|
||||
#^Enter::View_rotateLayoutAxis(1, +2)
|
||||
#^Tab::View_rotateLayoutAxis(2, +1)
|
||||
#^+Tab::View_rotateLayoutAxis(3, +1)
|
||||
#^Up::View_setMY(+1)
|
||||
#^Down::View_setMY(-1)
|
||||
#^Right::View_setMX(+1)
|
||||
#^Left::View_setMX(-1)
|
||||
#Left::View_setLayoutProperty("MFactor", 0, -0.05)
|
||||
#Right::View_setLayoutProperty("MFactor", 0, +0.05)
|
||||
#^t::View_setLayoutProperty("Axis", 0, +1, 1)
|
||||
#^Enter::View_setLayoutProperty("Axis", 0, +2, 1)
|
||||
#^Tab::View_setLayoutProperty("Axis", 0, +1, 2)
|
||||
#^+Tab::View_setLayoutProperty("Axis", 0, +1, 3)
|
||||
#^Up::View_setLayoutProperty("MY", 0, +1)
|
||||
#^Down::View_setLayoutProperty("MY", 0, -1)
|
||||
#^Right::View_setLayoutProperty("MX", 0, +1)
|
||||
#^Left::View_setLayoutProperty("MX", 0, -1)
|
||||
#+Left::View_setGapWidth(-2)
|
||||
#+Right::View_setGapWidth(+2)
|
||||
|
||||
|
|
|
@ -188,28 +188,32 @@ Tiler_layoutTiles(m, v, x, y, w, h, type = "") {
|
|||
}
|
||||
}
|
||||
|
||||
Tiler_rotateAxis(m, v, i, d) {
|
||||
Tiler_setAxis(m, v, id, d) {
|
||||
Local f, n, tmp
|
||||
|
||||
If (i = 1) {
|
||||
If (d = +2)
|
||||
View_#%m%_#%v%_layoutAxis_#%i% *= -1
|
||||
Else {
|
||||
f := View_#%m%_#%v%_layoutAxis_#%i% / Abs(View_#%m%_#%v%_layoutAxis_#%i%)
|
||||
View_#%m%_#%v%_layoutAxis_#%i% := f * Manager_loop(Abs(View_#%m%_#%v%_layoutAxis_#%i%), d, 1, 2)
|
||||
If (id = 1 Or id = 2 Or id = 3) {
|
||||
If (id = 1) {
|
||||
If (d = +2)
|
||||
View_#%m%_#%v%_layoutAxis_#%id% *= -1
|
||||
Else {
|
||||
f := View_#%m%_#%v%_layoutAxis_#%id% / Abs(View_#%m%_#%v%_layoutAxis_#%id%)
|
||||
View_#%m%_#%v%_layoutAxis_#%id% := f * Manager_loop(Abs(View_#%m%_#%v%_layoutAxis_#%id%), d, 1, 2)
|
||||
}
|
||||
} Else {
|
||||
n := Manager_loop(View_#%m%_#%v%_layoutAxis_#%id%, d, 1, 3)
|
||||
;; When we rotate the axis, we may need to swap the X and Y dimensions.
|
||||
;; We only need to check this when the master axis changes (id = 2)
|
||||
;; If the original axis was 1 (X) or the new axis is 1 (X) (Y and Z are defined to be the same)
|
||||
If (id = 2) And Not (n = View_#%m%_#%v%_layoutAxis_#%id%) And (n = 1 Or View_#%m%_#%v%_layoutAxis_#%id% = 1) {
|
||||
tmp := View_#%m%_#%v%_layoutMX
|
||||
View_#%m%_#%v%_layoutMX := View_#%m%_#%v%_layoutMY
|
||||
View_#%m%_#%v%_layoutMY := tmp
|
||||
}
|
||||
View_#%m%_#%v%_layoutAxis_#%id% := n
|
||||
}
|
||||
} Else {
|
||||
n := Manager_loop(View_#%m%_#%v%_layoutAxis_#%i%, d, 1, 3)
|
||||
;; When we rotate the axis, we may need to swap the X and Y dimensions.
|
||||
;; We only need to check this when the master axis changes (i = 2)
|
||||
;; If the original axis was 1 (X) or the new axis is 1 (X) (Y and Z are defined to be the same)
|
||||
If (i = 2) And Not (n = View_#%m%_#%v%_layoutAxis_#%i%) And (n = 1 Or View_#%m%_#%v%_layoutAxis_#%i% = 1) {
|
||||
tmp := View_#%m%_#%v%_layoutMX
|
||||
View_#%m%_#%v%_layoutMX := View_#%m%_#%v%_layoutMY
|
||||
View_#%m%_#%v%_layoutMY := tmp
|
||||
}
|
||||
View_#%m%_#%v%_layoutAxis_#%i% := n
|
||||
}
|
||||
Return, 1
|
||||
} Else
|
||||
Return, 0
|
||||
}
|
||||
|
||||
Tiler_setMFactor(m, v, d, dFact) {
|
||||
|
|
51
src/View.ahk
51
src/View.ahk
|
@ -204,16 +204,6 @@ View_moveWindow(i=0, d=0) {
|
|||
}
|
||||
}
|
||||
|
||||
View_rotateLayoutAxis(i, d) {
|
||||
Local v
|
||||
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
If Tiler_isActive(Manager_aMonitor, v) And (i = 1 Or i = 2 Or i = 3) {
|
||||
Tiler_rotateAxis(Manager_aMonitor, v, i, d)
|
||||
View_arrange(Manager_aMonitor, v)
|
||||
}
|
||||
}
|
||||
|
||||
View_setGapWidth(d)
|
||||
{
|
||||
Local l, v, w
|
||||
|
@ -255,31 +245,28 @@ View_setLayout(l)
|
|||
}
|
||||
}
|
||||
|
||||
View_setMFactor(d, dFact = 1) {
|
||||
Local v
|
||||
View_setLayoutProperty(name, i, d, opt = -1) {
|
||||
Local a, v
|
||||
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
If Tiler_isActive(Manager_aMonitor, v)
|
||||
If Tiler_setMFactor(Manager_aMonitor, v, d, dFact)
|
||||
View_arrange(Manager_aMonitor, v)
|
||||
}
|
||||
|
||||
View_setMX(d) {
|
||||
Local v
|
||||
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
If Tiler_isActive(Manager_aMonitor, v)
|
||||
If Tiler_setMX(Manager_aMonitor, v, d)
|
||||
View_arrange(Manager_aMonitor, v)
|
||||
}
|
||||
|
||||
View_setMY(d) {
|
||||
Local v
|
||||
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
If Tiler_isActive(Manager_aMonitor, v)
|
||||
If Tiler_setMY(Manager_aMonitor, v, d)
|
||||
If Tiler_isActive(Manager_aMonitor, v) {
|
||||
If (name = "MFactor") {
|
||||
If (opt = -1)
|
||||
opt := 1
|
||||
a := Tiler_setMFactor(Manager_aMonitor, v, d, opt)
|
||||
} Else If (name = "MX")
|
||||
a := Tiler_setMX(Manager_aMonitor, v, d)
|
||||
Else If (name = "MY")
|
||||
a := Tiler_setMY(Manager_aMonitor, v, d)
|
||||
Else If (name = "Axis") {
|
||||
If (opt = -1)
|
||||
opt := 0
|
||||
a := Tiler_setAxis(Manager_aMonitor, v, opt, d)
|
||||
}
|
||||
|
||||
If a
|
||||
View_arrange(Manager_aMonitor, v)
|
||||
}
|
||||
}
|
||||
|
||||
View_shuffleWindow(d)
|
||||
|
|
Loading…
Reference in a new issue