backlog, dos2unix pass

This commit is contained in:
Cynthia Foxwell 2023-08-31 22:13:42 -06:00
parent 1ab9e0a01a
commit a850e695be
10 changed files with 4301 additions and 4194 deletions

View File

@ -1,4 +1,4 @@
/*
/*
bug.n -- tiling window management
Copyright (c) 2010-2019 Joshua Fuhs, joten
@ -55,10 +55,10 @@ Bar_init(m) {
x1 += w + Config_barItemSpacing
}
;; Layout
w := Bar_getTextWidth("??????")
Bar_addElement(m, "layout", "??????", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
titleWidth -= w
x1 += w + Config_barItemSpacing
;w := Bar_getTextWidth("??????")
;Bar_addElement(m, "layout", "??????", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
;titleWidth -= w
;x1 += w + Config_barItemSpacing
;; The x-position and width of the sub-windows right of the window title are set from the right.
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
@ -168,9 +168,8 @@ Bar_init(m) {
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass)
; FIXME: find a specific ReBarWindow32 named a certain thing instead of first one
ControlGet, ToolbarRoot, Hwnd, , ReBarWindow321, ahk_id %trayWndId%
ControlGet, Toolbar, Hwnd, , ToolbarWindow321, ahk_id %ToolbarRoot%
ControlGet, Toolbar, Hwnd, , ToolbarWindow321, ahk_id %ToolbarRoot%, bug.n-bar
DllCall("SetParent", "UInt", wndId, "UInt", Toolbar)
If (Config_barTaskbarBlend) {
Gui, Color, 000000, %wndTitle%
@ -181,8 +180,18 @@ Bar_init(m) {
WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME
WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK
WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
WinSet, ExStyle, -0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE
Sleep 100
WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
Sleep 100
WinSet, ExStyle, -0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
Sleep 100
WinSet, Style, +0x800000, ahk_id %ToolbarRoot%
Sleep 100
WinSet, Style, -0x800000, ahk_id %ToolbarRoot%
}
} Else {
appBarMsg := DllCall("RegisterWindowMessage", Str, "AppBarMsg")
@ -307,6 +316,8 @@ Bar_getHeight()
Bar_height := buttonH
Else
Bar_height := barH
Bar_height := Bar_height - 2
Bar_ctrlHeight := Bar_height
If Not Config_singleRowBar
Bar_ctrlHeight := Bar_height / 2
@ -391,8 +402,8 @@ Bar_GuiClick:
} Else {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
If (SubStr(A_GuiControl, -12) = "_layout_event")
View_setLayout(-1)
;If (SubStr(A_GuiControl, -12) = "_layout_event")
; View_setLayout(-1)
Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event")
Monitor_activateView(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1))
}
@ -402,11 +413,12 @@ Return
Bar_GuiContextMenu:
Manager_winActivate(Bar_aWndId)
If (A_GuiEvent = "RightClick") {
If (SubStr(A_GuiControl, -12) = "_layout_event") {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
View_setLayout(0, +1)
} Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") {
;If (SubStr(A_GuiControl, -12) = "_layout_event") {
; If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
; Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
; View_setLayout(0, +1)
;} Else
If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_setWindowMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
Monitor_setWindowTag(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1))
@ -740,7 +752,7 @@ Bar_updateStatus() {
WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME
WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK
WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
;WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE
}
}

View File

@ -651,7 +651,7 @@ Manager_onShellMessage(wParam, lParam) {
If (Manager_monitorCount > 1) And (Config_verticalBarPos = "tray") {
Loop, % (Manager_monitorCount - 1) {
i := A_Index + 1
Bar_updateLayout(i)
;Bar_updateLayout(i)
Bar_updateStatic(i)
Loop, % Config_viewCount
Bar_updateView(i, A_Index)
@ -1250,3 +1250,31 @@ Manager_activateViewByMouse(d) {
Monitor_activateView(0, d)
}
}
Manager_toggleManage(wndId = 0) {
Local v, m, hideTitle, tags, isDecorated, isFloating
If (wndId = 0)
WinGet, wndId, ID, A
m := Manager_aMonitor
v := Monitor_#%Manager_aMonitor%_aView_#1
if (InStr(Manager_managedWndIds, wndId . ";")) {
hideTitle := InStr(Bar_hideTitleWndIds, wndId ";")
tags := Window_#%wndId%_tags
isDecorated := Window_#%wndId%_isDecorated
isFloating := Window_#%wndId%_isFloating
Manager_unmanage(wndId)
Manager__setWinProperties(wndId, false, m, tags, isDecorated, isFloating, hideTitle)
} else {
Manager_unmanage(wndId)
Manager_managedWndIds .= wndId ";"
Window_#%wndId%_monitor := m
Window_#%wndId%_tags := v
Manager_manage(m, v, wndId)
View_addWindow(m, v, wndId)
}
View_arrange(m, v)
}

View File

@ -114,7 +114,7 @@ Tiler_isActive(m, v) {
Tiler_layoutTiles(m, v, x, y, w, h, type = "") {
Local axis1, axis2, axis3, gapW, hasStackArea, mFact, mSplit, mXSet, mYSet, mYActual, n
Local h1, h2, mWndCount, stackLen, subAreaCount, subAreaWndCount, subH1, subW1, subX1, subY1, w1, w2, x1, x2, y1, y2
Local h1, h2, mWndCount, indexMod, leftArray, leftArrayCount, rightArray, rightArrayCount, stackLen, subAreaCount, subAreaWndCount, subH1, subW1, subX1, subY1, w1, w2, x1, x2, y1, y2
axis1 := Abs(View_#%m%_#%v%_layoutAxis_#1)
axis2 := View_#%m%_#%v%_layoutAxis_#2
@ -140,53 +140,89 @@ Tiler_layoutTiles(m, v, x, y, w, h, type = "") {
mSplit := View_tiledWndId0
}
;; Areas (master and stack)
x1 := x
y1 := y
w1 := w
h1 := h
If hasStackArea {
leftArray := []
leftArrayCount := 0
rightArray := []
rightArrayCount := 0
if hasStackArea {
;; split in half
If (View_#%m%_#%v%_layoutAxis_#1 < 0)
Tiler_splitArea(axis1 - 1, 1 - mFact, x1, y1, w1, h1, gapW, x2, y2, w2, h2, x1, y1, w1, h1)
Else
Tiler_splitArea(axis1 - 1, mFact, x1, y1, w1, h1, gapW, x1, y1, w1, h1, x2, y2, w2, h2)
indexMod := false
Loop % View_tiledWndId0 {
if indexMod {
leftArrayCount += 1
leftArray[leftArrayCount] := View_tiledWndId%A_Index%
indexMod := false
} else {
rightArrayCount += 1
rightArray[rightArrayCount] := View_tiledWndId%A_Index%
indexMod := true
}
}
Tiler_stackArrayTiles(m, v, rightArray, rightArrayCount, +1, 2, x2, y2, w2, h2, gapW, type)
Tiler_stackArrayTiles(m, v, leftArray, leftArrayCount, +1, 2, x1, y1, w1, h1, gapW, type)
} else {
Tiler_stackTiles(m, v, 1, 1, +1, axis2, x1, y1, w1, h1, 0, type)
}
; Areas (master and stack)
;x1 := x
;y1 := y
;w1 := w
;h1 := h
;If hasStackArea {
; If (View_#%m%_#%v%_layoutAxis_#1 < 0)
; Tiler_splitArea(axis1 - 1, 1 - mFact, x1, y1, w1, h1, gapW, x2, y2, w2, h2, x1, y1, w1, h1)
; Else
; Tiler_splitArea(axis1 - 1, mFact, x1, y1, w1, h1, gapW, x1, y1, w1, h1, x2, y2, w2, h2)
;}
;; Master
If (axis2 = 3)
Tiler_stackTiles(m, v, 1, mSplit, +1, 3, x1, y1, w1, h1, 0, type)
Else {
mYActual := (type = "blank") ? mYSet : Ceil(mSplit / mXSet)
subAreaCount := mYActual
mWndCount := mSplit
Loop, % mYActual {
Tiler_splitArea(Not (axis2 - 1), 1 / subAreaCount, x1, y1, w1, h1, gapW, subX1, subY1, subW1, subH1, x1, y1, w1, h1)
subAreaWndCount := mXSet
If (mWndCount < subAreaWndCount)
subAreaWndCount := mWndCount
Debug_logMessage("DEBUG[2] Tiler_layoutTiles: Master subArea #" A_Index, 2)
Tiler_stackTiles(m, v, mSplit - mWndCount + 1, subAreaWndCount, +1, axis2, subX1, subY1, subW1, subH1, gapW, type)
mWndCount -= subAreaWndCount
subAreaCount -= 1
}
}
;; Stack
If hasStackArea {
If (type = "blank") {
Debug_logMessage("DEBUG[2] Tiler_layoutTiles: Stack subArea #" A_Index, 2)
Tiler_stackTiles(m, v, mSplit + 1, 1, +1, 3, x2, y2, w2, h2, 0, type)
} Else {
stackLen := View_tiledWndId0 - mSplit
;; 161 is the minimal width of an Windows-Explorer window, below which it cannot be resized.
;; The minimal height is 243, but this seems too high for being a limit here;
;; therefor '2 * Bar_height' is used for the minimal height of a window.
If (axis3 = 3 Or (axis3 = 1 And (w2 - (stackLen - 1) * gapW) / stackLen < 161) Or (axis3 = 2 And (h2 - (stackLen - 1) * gapW) / stackLen < 2 * Bar_height))
Tiler_stackTiles(m, v, mSplit + 1, stackLen, +1, 3, x2, y2, w2, h2, 0, type)
Else
Tiler_stackTiles(m, v, mSplit + 1, stackLen, +1, axis3, x2, y2, w2, h2, gapW, type)
}
}
;If (axis2 = 3)
; Tiler_stackTiles(m, v, 1, mSplit, +1, 3, x1, y1, w1, h1, 0, type)
;Else {
; mYActual := (type = "blank") ? mYSet : Ceil(mSplit / mXSet)
; subAreaCount := mYActual
; mWndCount := mSplit
; Loop, % mYActual {
; Tiler_splitArea(Not (axis2 - 1), 1 / subAreaCount, x1, y1, w1, h1, gapW, subX1, subY1, subW1, subH1, x1, y1, w1, h1)
; subAreaWndCount := mXSet
; If (mWndCount < subAreaWndCount)
; subAreaWndCount := mWndCount
; Debug_logMessage("DEBUG[2] Tiler_layoutTiles: Master subArea #" A_Index, 2)
; Tiler_stackTiles(m, v, mSplit - mWndCount + 1, subAreaWndCount, +1, axis2, subX1, subY1, subW1, subH1, gapW, type)
; mWndCount -= subAreaWndCount
; subAreaCount -= 1
; }
;}
;
;;; Stack
;If hasStackArea {
; If (type = "blank") {
; Debug_logMessage("DEBUG[2] Tiler_layoutTiles: Stack subArea #" A_Index, 2)
; Tiler_stackTiles(m, v, mSplit + 1, 1, +1, 3, x2, y2, w2, h2, 0, type)
; } Else {
; stackLen := View_tiledWndId0 - mSplit
; ;; 161 is the minimal width of an Windows-Explorer window, below which it cannot be resized.
; ;; The minimal height is 243, but this seems too high for being a limit here;
; ;; therefor '2 * Bar_height' is used for the minimal height of a window.
; If (axis3 = 3 Or (axis3 = 1 And (w2 - (stackLen - 1) * gapW) / stackLen < 161) Or (axis3 = 2 And (h2 - (stackLen - 1) * gapW) / stackLen < 2 * Bar_height))
; Tiler_stackTiles(m, v, mSplit + 1, stackLen, +1, 3, x2, y2, w2, h2, 0, type)
; Else
; Tiler_stackTiles(m, v, mSplit + 1, stackLen, +1, axis3, x2, y2, w2, h2, gapW, type)
; }
;}
}
Tiler_setAxis(m, v, id, d) {
@ -332,6 +368,39 @@ Tiler_stackTiles(m, v, i, len, d, axis, x, y, w, h, padding, type = "") {
}
}
Tiler_stackArrayTiles(m, v, arr, len, d, axis, x, y, w, h, padding, type = "") {
Local i, dx, dy, tileH, tileW, tileX, tileY
tileX := x
tileY := y
tileW := w
tileH := h
dx := 0
dy := 0
dw := (w - (len - 1) * padding) / len
dh := (h - (len - 1) * padding) / len
If (axis = 1) {
tileW := (w - (len - 1) * padding) / len
dx := tileW + padding
} Else If (axis = 2) {
tileH := (h - (len - 1) * padding) / len
dy := tileH + padding
}
;; Else (axis = 3) and nothing to do
Debug_logMessage("DEBUG[2] Tiler_stackArrayTiles: start = " i ", length = " len, 2)
i := 1
Loop, % len {
If (type = "blank")
Tiler_addSubArea(m, v, i, tileX, tileY, tileW, tileH)
Else
Window_move(arr[i], tileX, tileY, tileW, tileH)
i += d
tileX += dx
tileY += dy
}
}
Tiler_toggleStackArea(m ,v) {
Global

View File

@ -13,8 +13,7 @@
@version 9.1.0
*/
View_init(m, v)
{
View_init(m, v) {
Global
View_#%m%_#%v%_area_#0 := 0
@ -149,7 +148,7 @@ View_arrange(m, v, setLayout = False) {
Else ;; floating layout (no 'View_arrange_', following is 'View_getLayoutSymbol_')'
View_#%m%_#%v%_layoutSymbol := Config_layoutSymbol_#%l%
Bar_updateLayout(m)
;Bar_updateLayout(m)
}
View_getActiveWindow(m, v) {
@ -402,7 +401,6 @@ View_toggleMargins()
{
Local v
If Not (Config_viewMargins = "0;0;0;0")
{
v := Monitor_#%Manager_aMonitor%_aView_#1