Revised "View_setGapWidth"

... aka "View_setLayoutProperty('GapWidth', " to allow setting absolute
and relative values.
This commit is contained in:
joten 2015-01-28 22:20:15 +01:00
parent f7d712d61c
commit 2d18960bf6
4 changed files with 33 additions and 33 deletions

View file

@ -14,7 +14,7 @@
`View_setMY` and `View_rotateLayoutAxis`
4. `~` Revised the following functions to allow setting absolute and relative values: `Debug_setLogLevel`,
`Manager_activateMonitor`, `Manager_setViewMonitor`, `Manager_setWindowMonitor`, `Monitor_activateView`, `Monitor_setWindowTag`,
`View_setLayout`, `View_setMFactor`, `View_shuffleWindow`
`View_setGapWidth`, `View_setLayout`, `View_setMFactor`, `View_shuffleWindow`
5. `~` Revised the interface, i. e. the parameters, of the following functions for setting absolute and relative values -- but did
not implement the functionality: `Monitor_toggleWindowTag`, `View_activateWindow`

View file

@ -128,20 +128,20 @@ the default configuration).
`#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 an additional parameter for accelerating the third
one. E. g. with `#Left::View_setLayoutProperty("MFactor", 0, -0.05, 2)` the
one. 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%.
With the second parameter you may set an absolute value, e. g.
'View_setLayoutProperty("MFactor", 0.5, 0)' splits the view in half.
'View_setLayoutProperty(MFactor, 0.5, 0)' splits the view in half.
`#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 additional parameter for accelerating the third
one. E. g. with `#Right::View_setLayoutProperty("MFactor", 0, +0.05, 0.5)` the
one. 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%.
With the second parameter you may set an absolute value, e. g.
'View_setLayoutProperty("MFactor", 0.67, 0)' makes the master area two thirds
'View_setLayoutProperty(MFactor, 0.67, 0)' makes the master area two thirds
and the stacking area one third the size of the view.
`#^t::View_setLayoutProperty("Axis", 0, +1, 1)`
@ -177,7 +177,10 @@ the master area by Y. Maximum of 9 (only for the "tile" layout).
the master area by Y. Minimum of 1 (only for the "tile" layout).
`#+Left::View_setLayoutProperty("GapWidth", 0, -2)`
> Decrease the gap between windows in "monocle" and "tile" layout.
> Decrease the gap between windows in "monocle" and "tile" layout. You may also
set an absolute value for the gap width by using the first parameter, e. g.
`View_setLayoutProperty(GapWidth, 0, 0)` will eliminate the gap and
`View_setLayoutProperty(GapWidth, 20, 0)` will set it to 20px.
`#+Right::View_setLayoutProperty("GapWidth", 0, +2)`
> Increase the gap between windows in "monocle" and "tile" layout.

View file

@ -101,14 +101,16 @@ Main_evalCommand(command)
{
functionName := SubStr(command, 1, i - 1)
functionArguments := SubStr(command, i + 1, j - (i + 1))
StringReplace, functionArguments, functionArguments, %A_SPACE%, , All
StringSplit, functionArgument, functionArguments, `,
If (functionArgument0 < 2)
%functionName%(functionArguments)
Else If (functionArgument0 = 2)
{
StringTrimLeft, functionArgument2, functionArgument2, 1
%functionName%(functionArgument1, functionArgument2)
}
Else If (functionArgument0 = 3)
%functionName%(functionArgument1, functionArgument2, functionArgument3)
Else If (functionArgument0 = 4)
%functionName%(functionArgument1, functionArgument2, functionArgument3, functionArgument4)
}
}
}

View file

@ -197,25 +197,19 @@ View_moveWindow(i=0, d=0) {
}
}
View_setGapWidth(d)
{
Local l, v, w
View_setGapWidth(i, d = 0) {
Local v
v := Monitor_#%Manager_aMonitor%_aView_#1
l := View_#%Manager_aMonitor%_#%v%_layout_#1
If Tiler_isActive(Manager_aMonitor, v) Or (Config_layoutFunction_#%l% = "monocle")
{
If (d < 0)
d := Floor(d / 2) * 2
Else
d := Ceil(d / 2) * 2
w := View_#%Manager_aMonitor%_#%v%_layoutGapWidth + d
If (w < Monitor_#%Manager_aMonitor%_height And w < Monitor_#%Manager_aMonitor%_width)
{
View_#%Manager_aMonitor%_#%v%_layoutGapWidth := w
View_arrange(Manager_aMonitor, v)
}
}
If (i = 0) And (d != 0)
i := View_#%Manager_aMonitor%_#%v%_layoutGapWidth
i += d
If (i >= 0 And i < Monitor_#%Manager_aMonitor%_height And i < Monitor_#%Manager_aMonitor%_width) {
i := Ceil(i / 2) * 2
View_#%Manager_aMonitor%_#%v%_layoutGapWidth := i
Return, 1
} Else
Return, 0
}
View_setLayout(i, d = 0) {
@ -237,9 +231,10 @@ View_setLayout(i, d = 0) {
}
View_setLayoutProperty(name, i, d, opt = 0) {
Local a, v
Local a, l, v
v := Monitor_#%Manager_aMonitor%_aView_#1
l := View_#%Manager_aMonitor%_#%v%_layout_#1
If Tiler_isActive(Manager_aMonitor, v) {
If (name = "Axis")
a := Tiler_setAxis(Manager_aMonitor, v, opt, d)
@ -247,16 +242,16 @@ View_setLayoutProperty(name, i, d, opt = 0) {
If (opt = 0)
opt := 1
a := Tiler_setMFactor(Manager_aMonitor, v, i, d, opt)
} Else If (name = "GapWidth")
View_setGapWidth(d)
Else If (name = "MX")
} Else If (name = "MX")
a := Tiler_setMX(Manager_aMonitor, v, d)
Else If (name = "MY")
a := Tiler_setMY(Manager_aMonitor, v, d)
If a
View_arrange(Manager_aMonitor, v)
}
If (name = "GapWidth") And (Tiler_isActive(Manager_aMonitor, v) Or (Config_layoutFunction_#%l% = "monocle"))
a := View_setGapWidth(i, d)
If a
View_arrange(Manager_aMonitor, v)
}
View_shuffleWindow(i, d = 0) {