Debug logging changes. Allow for multiple logging levels
This commit is contained in:
parent
de84ea6ac7
commit
e28b5862a7
4 changed files with 44 additions and 25 deletions
|
@ -389,7 +389,8 @@ Config_saveSession() {
|
|||
#i::Manager_getWindowInfo() ; Get information for the active window (id, title, class, process name, style, geometry, tags and floating state).
|
||||
#+i::Manager_getWindowList() ; Get a window list for the active view (id, title and class).
|
||||
#^i::Manager_logWindowList()
|
||||
#^d::Log_toggleDebugEnabled()
|
||||
#^d::Log_decDebugLevel()
|
||||
#^e::Log_incDebugLevel()
|
||||
|
||||
#Tab::View_setLayout(-1) ; Set the previously set layout. You may also use View_setLayout(">") for setting the next layout in the layout array.
|
||||
#\::View_setLayout(3) ; Set the 3rd defined layout (i. e. floating layout in the default configuration).
|
||||
|
@ -446,7 +447,7 @@ Config_saveSession() {
|
|||
#+Space::Monitor_toggleBar() ; Hide / Show the bar (bug.n status bar) on the active monitor.
|
||||
#Space::Monitor_toggleTaskBar() ; Hide / Show the task bar.
|
||||
#y::Bar_toggleCommandGui() ; Open the command GUI for executing programmes or bug.n functions.
|
||||
#^e::Run, edit %Config_filePath% ; Open the configuration file in the standard text editor.
|
||||
;#^e::Run, edit %Config_filePath% ; Open the configuration file in the standard text editor.
|
||||
#^s::Config_saveSession() ; Save the current state of monitors, views, layouts to the configuration file.
|
||||
#^r::Main_reload() ; Reload bug.n (i. e. the configuration and its dependent settings) without deleting the window lists of bug.n and restoring windows.
|
||||
; It does not reset internal configuration variables, the tray icon or menu, hotkeys (unless set explicitly in Config.ini), individual window settings like Config_showBorder (since windows might be hidden) or hiding the title bar, the monitor count or views.
|
||||
|
|
39
src/Log.ahk
39
src/Log.ahk
|
@ -31,28 +31,37 @@ Log_bare( message ) {
|
|||
FileAppend, %padded_message% , bugn_log.txt
|
||||
}
|
||||
|
||||
Log_debug_enabled := 0
|
||||
Log_debug_level := 0
|
||||
|
||||
Log_toggleDebugEnabled() {
|
||||
Log_incDebugLevel() {
|
||||
Global
|
||||
If (Log_debug_enabled = 1)
|
||||
Log_debug_enabled := 0
|
||||
If ( Log_debug_level < 9 )
|
||||
{
|
||||
Log_debug_level += 1
|
||||
Log_msg("Debug logging level incremented to " . Log_debug_level )
|
||||
}
|
||||
}
|
||||
|
||||
Log_decDebugLevel() {
|
||||
Global
|
||||
If ( Log_debug_level > 0 ) {
|
||||
Log_debug_level -= 1
|
||||
If ( Log_debug_level = 0 )
|
||||
Log_msg("Debug logging is disabled")
|
||||
Else
|
||||
Log_debug_enabled := 1
|
||||
If (Log_debug_enabled = 1)
|
||||
Log_msg("Debug log enabled (" . Log_debug_enabled . ")")
|
||||
Else
|
||||
Log_msg("Debug log disabled (" . Log_debug_enabled . ")")
|
||||
Log_msg("Debug logging level decremented to " . Log_debug_level)
|
||||
}
|
||||
}
|
||||
|
||||
Log_dbg_msg( message ) {
|
||||
|
||||
Log_dbg_msg( level, message ) {
|
||||
Global
|
||||
If (Log_debug_enabled = 1)
|
||||
Log_msg( "DEBUG: " . message )
|
||||
If (level > 0 And Log_debug_level >= level)
|
||||
Log_msg( "DBG " . level . ": " . message )
|
||||
}
|
||||
|
||||
Log_dbg_bare( message ) {
|
||||
Log_dbg_bare( level, message ) {
|
||||
Global
|
||||
If (Log_debug_enabled = 1)
|
||||
Log_bare( "DEBUG: " . message )
|
||||
If (level > 0 And Log_debug_level >= level)
|
||||
Log_bare( "DBG " . level . ": " . message )
|
||||
}
|
|
@ -403,9 +403,19 @@ Manager_moveWindow() {
|
|||
SendMessage, WM_SYSCOMMAND, SC_MOVE, , , ahk_id %aWndId%
|
||||
}
|
||||
|
||||
HSHELL_WINDOWCREATED := 1
|
||||
; Seems to get sent every time
|
||||
HSHELL_WINDOWDESTROYED := 2
|
||||
HSHELL_WINDOWACTIVATED := 4
|
||||
HSHELL_REDRAW := 6
|
||||
; Full-screen app activated?
|
||||
HSHELL_RUDEAPPACTIVATED := 32772
|
||||
|
||||
Manager_onShellMessage(wParam, lParam) {
|
||||
Local a, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, flag, m, t, wndClass, wndId, wndIds, wndPName, wndTitle, x, y
|
||||
|
||||
Log_dbg_msg(1, "Manager_onShellMessage(wParam: " . wParam . ", lParam: " . lParam)
|
||||
|
||||
SetFormat, Integer, hex
|
||||
lParam := lParam+0
|
||||
SetFormat, Integer, d
|
||||
|
@ -578,7 +588,6 @@ Manager_sync(ByRef wndIds = "") {
|
|||
shownWndIds .= View_#%A_Index%_#%v%_wndIds
|
||||
}
|
||||
; check all visible windows against the known windows
|
||||
; DetectHiddenWindows, On
|
||||
WinGet, wndId, List, , ,
|
||||
Loop, % wndId {
|
||||
If Not InStr(shownWndIds, wndId%A_Index% ";") {
|
||||
|
|
12
src/View.ahk
12
src/View.ahk
|
@ -36,23 +36,23 @@ View_init(m, v) {
|
|||
|
||||
View_activateWindow(d) {
|
||||
Local aWndId, i, j, v, wndId, wndId0, wndIds
|
||||
Log_dbg_msg("View_activateWindow(" . d . ")")
|
||||
Log_dbg_msg(1, "View_activateWindow(" . d . ")")
|
||||
WinGet, aWndId, ID, A
|
||||
Log_dbg_bare("Active Windows ID: " . aWndId)
|
||||
Log_dbg_bare(2, "Active Windows ID: " . aWndId)
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
Log_dbg_bare("View (" . v . ") wndIds: " . View_#%Manager_aMonitor%_#%v%_wndIds)
|
||||
Log_dbg_bare(2, "View (" . v . ") wndIds: " . View_#%Manager_aMonitor%_#%v%_wndIds)
|
||||
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
|
||||
StringSplit, wndId, wndIds, `;
|
||||
Log_dbg_bare("wndId count: " . wndId0)
|
||||
Log_dbg_bare(2, "wndId count: " . wndId0)
|
||||
If (wndId0 > 1) {
|
||||
Loop, % wndId0
|
||||
If (wndId%A_Index% = aWndId) {
|
||||
i := A_Index
|
||||
Break
|
||||
}
|
||||
Log_dbg_bare("Current wndId index: " . i)
|
||||
Log_dbg_bare(2, "Current wndId index: " . i)
|
||||
j := Manager_loop(i, d, 1, wndId0)
|
||||
Log_dbg_bare("Next wndId index: " . j)
|
||||
Log_dbg_bare(2, "Next wndId index: " . j)
|
||||
wndId := wndId%j%
|
||||
WinSet, AlwaysOnTop, On, ahk_id %wndId%
|
||||
WinSet, AlwaysOnTop, Off, ahk_id %wndId%
|
||||
|
|
Loading…
Reference in a new issue