From d8aafadcc7ed5ea341edeedb3a51c9bf0954bca5 Mon Sep 17 00:00:00 2001 From: joten Date: Wed, 9 Mar 2016 19:24:12 +0100 Subject: [PATCH] Revert "added log and lib (part)" This reverts commit 70d79b7987014fde26f2ff60c3e3b3c24e1ead67. --- src/Lib.ahk | 28 -------------------------- src/Log.ahk | 53 -------------------------------------------------- src/Main.ahk | 5 ----- src/Window.ahk | 2 +- 4 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 src/Lib.ahk delete mode 100644 src/Log.ahk diff --git a/src/Lib.ahk b/src/Lib.ahk deleted file mode 100644 index 8a90915..0000000 --- a/src/Lib.ahk +++ /dev/null @@ -1,28 +0,0 @@ -/* -:title: bug.n -- Tiling Window Management -:copyright: (c) 2016 by Joshua Fuhs & joten -:license: GNU General Public License version 3; - LICENSE.md or at - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. -*/ - -Int_min(a, b) { - Return, a < b ? a : b -} - -Int_max(a, b) { - Return, a > b ? a : b -} - -Str_pad(s, chars, count) { - str := "" - Loop, % Abs(count) - str .= chars - If (count < 0) - Return SubStr(str . s, count + 1) - Else - Return SubStr(s . str, 1, count) -} diff --git a/src/Log.ahk b/src/Log.ahk deleted file mode 100644 index 612b0c7..0000000 --- a/src/Log.ahk +++ /dev/null @@ -1,53 +0,0 @@ -/* -:title: bug.n -- Tiling Window Management -:copyright: (c) 2016 by Joshua Fuhs & joten -:license: GNU General Public License version 3; - LICENSE.md or at - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. -*/ - -Log_init(truncate = True) { - Global Log_file, Log_level - Global Log_level_#0, Log_level_#1, Log_level_#2, Log_level_#3, Log_level_#4, Log_level_#5, Log_level_#6, Log_level_#7 - - If Not Log_level - Log_level := 2 - - l := ";CRITICAL;ERROR;WARNING;INFO;DEBUG;SUPER" - StringSplit, Log_level_#, l, `; - - If truncate And FileExist(Log_file) - FileDelete, %Log_file% - FormatTime, t, , yyyy-MM-dd - FileAppend, % "`r`n# " . t . "`r`n", %Log_file% - Log_msg("Log started", 4) -} - -Log_msg(text, l, t = True) { ;; level = 0: log in any case - Global Log_file, Log_level - Global Log_level_#1, Log_level_#2, Log_level_#3, Log_level_#4, Log_level_#5, Log_level_#6, Log_level_#7 - - If (Log_level >= l) { - If t - FormatTime, t, , yyyy-MM-dd HH:mm:ss - i := l + 1 - text := Str_pad(t, " ", 19) . "> " . Str_pad(Log_level_#%i%, ".", 8) . ": " . text . "`r`n" - FileAppend, %text%, %Log_file% - } -} - -Log_setLevel(d, l = 0) { - Global Log_level - Global Log_level_#1, Log_level_#2, Log_level_#3, Log_level_#4, Log_level_#5, Log_level_#6, Log_level_#7 - - l := l ? l : Log_level - l := Int_min(Int_max(l + d, 1), 6) - If (l != Log_level) { - Log_level := l - i := l + 1 - Log_msg("Log level set to " . Log_level_#%i%, 0) - } -} diff --git a/src/Main.ahk b/src/Main.ahk index f53c53e..0e6b702 100644 --- a/src/Main.ahk +++ b/src/Main.ahk @@ -26,14 +26,12 @@ SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;; Pseudo main function Main_appDir := "" - Log_level := "" If 0 = 1 Main_appDir = %1% Main_setup() Debug_initLog(Main_logFile, 0, False) - Log_init() Debug_logMessage("====== Initializing ======", 0) Config_filePath := Main_appDir "\Config.ini" @@ -167,7 +165,6 @@ Main_setup() { If (Main_appDir = "") Main_appDir := winAppDir . "\bug.n" Main_logFile := Main_appDir . "\log.txt" - Log_file := Main_appDir . "\log.md" Main_dataDir := Main_appDir . "\data" Main_autoLayout := Main_dataDir . "\_Layout.ini" Main_autoWindowState := Main_dataDir . "\_WindowState.ini" @@ -183,8 +180,6 @@ Return #Include Bar.ahk #Include Config.ahk #Include Debug.ahk -#Include Lib.ahk -#Include Log.ahk #Include Manager.ahk #Include Monitor.ahk #Include ResourceMonitor.ahk diff --git a/src/Window.ahk b/src/Window.ahk index dd18336..20bf541 100644 --- a/src/Window.ahk +++ b/src/Window.ahk @@ -240,7 +240,7 @@ Window_move(wndId, x, y, width, height) { Local wndMinMax, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE Local wndH, wndW, wndX, wndY - If Not wndId Or Window_getPosEx(wndId, wndX, wndY, wndW, wndH) And (Abs(wndX - x) < 2 And Abs(wndY - y) < 2 And Abs(wndW - width) < 2 And Abs(wndH - height) < 2) + If Not wndId Window_getPosEx(wndId, wndX, wndY, wndW, wndH) And (Abs(wndX - x) < 2 And Abs(wndY - y) < 2 And Abs(wndW - width) < 2 And Abs(wndH - height) < 2) Return, 0 If Window_isHung(wndId) {