From f9cfc8e5f5d6421fe9ba2b74520ed7fe4ac0326b Mon Sep 17 00:00:00 2001 From: joten Date: Tue, 27 Jan 2015 22:33:13 +0100 Subject: [PATCH] Implemented setting the log level ... ... to an absolute value --- doc/CHANGES.md | 13 +++++++++---- doc/Default_hotkeys.md | 10 ++++++---- src/Config.ahk | 4 ++-- src/Debug.ahk | 10 +++++----- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 74bc8b1..c20f910 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -11,6 +11,7 @@ 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_setGapWidth`, `View_setMFactor`, `View_setMX`, `View_setMY` and `View_rotateLayoutAxis` +4. `~` Re-implemented the following functions to allow setting absolute and relative values: `Debug_setLogLevel`, `View_setLayout`, `View_setMFactor` | # | Configuration variables | Hotkeys | | --:| ----------------------- | --------------------------------------------------------- | @@ -38,10 +39,14 @@ | | | `+` `#^Right::View_setLayoutProperty("MX", 0, +1)` | | | | `-` `#^Left::View_setMX(-1)` | | | | `+` `#^Left::View_setLayoutProperty("MX", 0, -1)` | -| | | `-` `View_setGapWidth(-2)` | -| | | `+` `View_setLayoutProperty("GapWidth", 0, -2)` | -| | | `-` `View_setGapWidth(+2)` | -| | | `+` `View_setLayoutProperty("GapWidth", 0, +2)` | +| | | `-` `#+Left::View_setGapWidth(-2)` | +| | | `+` `#+Left::View_setLayoutProperty("GapWidth", 0, -2)` | +| | | `-` `#+Right::View_setGapWidth(+2)` | +| | | `+` `#+Right::View_setLayoutProperty("GapWidth", 0, +2)` | +| 4. | | `-` `#^d::Debug_setLogLevel(-1)` | +| | | `+` `#^d::Debug_setLogLevel(0, -1)` | +| | | `-` `#^+d::Debug_setLogLevel(+1)` | +| | | `+` `#^+d::Debug_setLogLevel(0, +1)` | ### 8.4.0 diff --git a/doc/Default_hotkeys.md b/doc/Default_hotkeys.md index 1dd0ba0..3aed996 100644 --- a/doc/Default_hotkeys.md +++ b/doc/Default_hotkeys.md @@ -96,11 +96,13 @@ and tiled windows of all views) to the log. two log messages (`Manager_logViewWindowList` and `Manager_logManagedWindowList`) to the log. -`#^d::Debug_setLogLevel(-1)` -> Decrement the debug log level. Show fewer debug messages. +`#^d::Debug_setLogLevel(0, -1)` +> Decrement the debug log level. Show fewer debug messages. You may also set +the debug log level to an absolute value by using the first parameter. -`#^+d::Debug_setLogLevel(+1)` -> Increment the debug log level. Show more debug messages. +`#^+d::Debug_setLogLevel(0, +1)` +> Increment the debug log level. Show more debug messages. You may also set +the debug log level to an absolute value by using the first parameter. ### Layout management diff --git a/src/Config.ahk b/src/Config.ahk index 295143c..3643fce 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -415,8 +415,8 @@ Config_UI_saveSession() { #^i::Debug_logViewWindowList() #+^i::Debug_logManagedWindowList() #^h::Debug_logHelp() -#^d::Debug_setLogLevel(-1) -#^+d::Debug_setLogLevel(+1) +#^d::Debug_setLogLevel(0, -1) +#^+d::Debug_setLogLevel(0, +1) ;; Layout management #Tab::View_setLayout(-1) diff --git a/src/Debug.ahk b/src/Debug.ahk index 03ef4cc..665583f 100644 --- a/src/Debug.ahk +++ b/src/Debug.ahk @@ -146,13 +146,13 @@ Debug_logWindowInfo(wndId) Debug_logMessage(text , 0, False) } -Debug_setLogLevel(d) -{ +Debug_setLogLevel(i, d) { Global Debug_logLevel - i := Debug_logLevel + d - If (i >= 0) - { + If (i = 0) + i := Debug_logLevel + i += d + If (i >= 0) And (i != Debug_logLevel) { Debug_logLevel := i If (i = 0) Debug_logMessage("Logging disabled.", 0)