MirrorBar+ panels follow the bar transparency, part 2

This commit is contained in:
2026-11-08 03:53:07 +00:00
parent 572d64c280
commit f5d9389284
3 changed files with 194 additions and 8 deletions
+14 -7
View File
@@ -71,6 +71,7 @@ const (
idShowWeather = 213
idShowNews = 214
idShowSys = 215
idPanelFade = 216
)
var (
@@ -81,7 +82,7 @@ var (
ctlAlpha, ctlAlphaValue, ctlLogo, ctlClock, ctlTrayIcons, ctlStyle uintptr
ctlVertical, ctlAutostart uintptr
ctlZip, ctlZipStatus uintptr
ctlShowWeather, ctlShowNews, ctlShowSys uintptr
ctlShowWeather, ctlShowNews, ctlShowSys, ctlPanelFade uintptr
zipSyncing bool // true while the program itself is filling in the ZIP box
)
@@ -133,7 +134,7 @@ func openSettings() {
settingsFont = makeFont(px(13), 400)
}
r := rect{0, 0, px(400), px(460)}
r := rect{0, 0, px(400), px(488)}
pAdjustWindowRectEx.Call(uintptr(unsafe.Pointer(&r)), wsWindowFrame, 0, 0)
ow, oh := r.Right-r.Left, r.Bottom-r.Top
sw, sh := screenSize()
@@ -183,12 +184,13 @@ func openSettings() {
ctlShowWeather = makeControl(hw, inst, "BUTTON", "Show weather on the bar", bsAutoCheckBox|wsTabStop, 16, 262, 368, 22, idShowWeather)
ctlShowNews = makeControl(hw, inst, "BUTTON", "Show local news on the bar", bsAutoCheckBox|wsTabStop, 16, 290, 368, 22, idShowNews)
ctlShowSys = makeControl(hw, inst, "BUTTON", "Show system stats on the bar", bsAutoCheckBox|wsTabStop, 16, 318, 368, 22, idShowSys)
ctlVertical = makeControl(hw, inst, "BUTTON", "Stand the bar up at the right edge (vertical)", bsAutoCheckBox|wsTabStop, 16, 346, 368, 22, idVertical)
ctlAutostart = makeControl(hw, inst, "BUTTON", "Start MirrorBar when I sign in", bsAutoCheckBox|wsTabStop, 16, 374, 368, 22, idAutostart)
ctlPanelFade = makeControl(hw, inst, "BUTTON", "Panels match the bar's transparency", bsAutoCheckBox|wsTabStop, 16, 346, 368, 22, idPanelFade)
ctlVertical = makeControl(hw, inst, "BUTTON", "Stand the bar up at the right edge (vertical)", bsAutoCheckBox|wsTabStop, 16, 374, 368, 22, idVertical)
ctlAutostart = makeControl(hw, inst, "BUTTON", "Start MirrorBar when I sign in", bsAutoCheckBox|wsTabStop, 16, 402, 368, 22, idAutostart)
makeControl(hw, inst, "BUTTON", "Reset position", bsPushButton|wsTabStop, 16, 414, 116, 28, idResetPos)
makeControl(hw, inst, "BUTTON", "Reset bar width", bsPushButton|wsTabStop, 140, 414, 116, 28, idResetWidth)
makeControl(hw, inst, "BUTTON", "Close", bsDefPushButton|wsTabStop, 292, 414, 92, 28, idClose)
makeControl(hw, inst, "BUTTON", "Reset position", bsPushButton|wsTabStop, 16, 442, 116, 28, idResetPos)
makeControl(hw, inst, "BUTTON", "Reset bar width", bsPushButton|wsTabStop, 140, 442, 116, 28, idResetWidth)
makeControl(hw, inst, "BUTTON", "Close", bsDefPushButton|wsTabStop, 292, 442, 92, 28, idClose)
hwndSettings = hw
settingsSync()
@@ -210,6 +212,7 @@ func settingsSync() {
pSendMessage.Call(ctlShowWeather, bmSetCheck, boolWP(showWeather), 0)
pSendMessage.Call(ctlShowNews, bmSetCheck, boolWP(showNews), 0)
pSendMessage.Call(ctlShowSys, bmSetCheck, boolWP(showSys), 0)
pSendMessage.Call(ctlPanelFade, bmSetCheck, boolWP(flyMatchBar), 0)
pSendMessage.Call(ctlVertical, bmSetCheck, boolWP(vertical), 0)
pSendMessage.Call(ctlAutostart, bmSetCheck, boolWP(autostartEnabled()), 0)
@@ -289,6 +292,7 @@ func settingsCommand(id, note uintptr) {
}
saveColors()
redraw(hwndMain)
flyRefreshAll()
case idStyle:
if note != cbnSelChange {
return
@@ -309,6 +313,8 @@ func settingsCommand(id, note uintptr) {
setShowNews(checked(ctlShowNews))
case idShowSys:
setShowSys(checked(ctlShowSys))
case idPanelFade:
setFlyMatchBar(checked(ctlPanelFade))
case idVertical:
vertical = checked(ctlVertical)
saveOrient()
@@ -343,6 +349,7 @@ func settingsProc(hwnd, m, wparam, lparam uintptr) (result uintptr) {
bgAlpha = n
pSetWindowText.Call(ctlAlphaValue, uintptr(unsafe.Pointer(u16(strconv.Itoa(bgAlpha*100/255)+"%"))))
redraw(hwndMain)
flyRefreshAll()
}
if wparam&0xFFFF == tbEndTrack {
saveAlpha()