Revert "added log and lib (part)"

This reverts commit 70d79b7987.
This commit is contained in:
joten 2016-03-09 19:24:12 +01:00
parent f655a74ee7
commit d8aafadcc7
4 changed files with 1 additions and 87 deletions

View file

@ -1,28 +0,0 @@
/*
:title: bug.n -- Tiling Window Management
:copyright: (c) 2016 by Joshua Fuhs & joten <https://github.com/fuhsjr00/bug.n>
:license: GNU General Public License version 3;
LICENSE.md or at <http://www.gnu.org/licenses/>
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)
}

View file

@ -1,53 +0,0 @@
/*
:title: bug.n -- Tiling Window Management
:copyright: (c) 2016 by Joshua Fuhs & joten <https://github.com/fuhsjr00/bug.n>
:license: GNU General Public License version 3;
LICENSE.md or at <http://www.gnu.org/licenses/>
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)
}
}

View file

@ -26,14 +26,12 @@ SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;; Pseudo main function ;; Pseudo main function
Main_appDir := "" Main_appDir := ""
Log_level := ""
If 0 = 1 If 0 = 1
Main_appDir = %1% Main_appDir = %1%
Main_setup() Main_setup()
Debug_initLog(Main_logFile, 0, False) Debug_initLog(Main_logFile, 0, False)
Log_init()
Debug_logMessage("====== Initializing ======", 0) Debug_logMessage("====== Initializing ======", 0)
Config_filePath := Main_appDir "\Config.ini" Config_filePath := Main_appDir "\Config.ini"
@ -167,7 +165,6 @@ Main_setup() {
If (Main_appDir = "") If (Main_appDir = "")
Main_appDir := winAppDir . "\bug.n" Main_appDir := winAppDir . "\bug.n"
Main_logFile := Main_appDir . "\log.txt" Main_logFile := Main_appDir . "\log.txt"
Log_file := Main_appDir . "\log.md"
Main_dataDir := Main_appDir . "\data" Main_dataDir := Main_appDir . "\data"
Main_autoLayout := Main_dataDir . "\_Layout.ini" Main_autoLayout := Main_dataDir . "\_Layout.ini"
Main_autoWindowState := Main_dataDir . "\_WindowState.ini" Main_autoWindowState := Main_dataDir . "\_WindowState.ini"
@ -183,8 +180,6 @@ Return
#Include Bar.ahk #Include Bar.ahk
#Include Config.ahk #Include Config.ahk
#Include Debug.ahk #Include Debug.ahk
#Include Lib.ahk
#Include Log.ahk
#Include Manager.ahk #Include Manager.ahk
#Include Monitor.ahk #Include Monitor.ahk
#Include ResourceMonitor.ahk #Include ResourceMonitor.ahk

View file

@ -240,7 +240,7 @@ Window_move(wndId, x, y, width, height) {
Local wndMinMax, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE Local wndMinMax, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE
Local wndH, wndW, wndX, wndY 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 Return, 0
If Window_isHung(wndId) { If Window_isHung(wndId) {