diff --git a/settings.go b/settings.go index 788dc97..96f7ffe 100644 --- a/settings.go +++ b/settings.go @@ -75,6 +75,14 @@ const ( idShowGM = 217 idGroup = 218 idAutoHide = 219 + + idBarColor = 220 + idLogoStyle = 221 + idClockSize = 222 + idClockBold = 223 + idShowBattery = 224 + idShowVolume = 225 + idShowWifi = 226 ) var ( @@ -87,6 +95,8 @@ var ( ctlZip, ctlZipStatus uintptr ctlShowWeather, ctlShowNews, ctlShowSys, ctlShowGM, ctlPanelFade uintptr ctlGroup, ctlAutoHide uintptr + ctlBarColor, ctlLogoStyle, ctlClockSize, ctlClockBold uintptr + ctlShowBattery, ctlShowVolume, ctlShowWifi uintptr zipSyncing bool // true while the program itself is filling in the ZIP box ) @@ -138,7 +148,7 @@ func openSettings() { settingsFont = makeFont(px(13), 400) } - r := rect{0, 0, px(400), px(572)} + r := rect{0, 0, px(800), px(572)} pAdjustWindowRectEx.Call(uintptr(unsafe.Pointer(&r)), wsWindowFrame, 0, 0) ow, oh := r.Right-r.Left, r.Bottom-r.Top sw, sh := screenSize() @@ -196,6 +206,34 @@ func openSettings() { ctlGroup = makeControl(hw, inst, "BUTTON", "Combine windows of the same program into one icon", bsAutoCheckBox|wsTabStop, 16, 458, 368, 22, idGroup) ctlAutoHide = makeControl(hw, inst, "BUTTON", "Hide the bar until the mouse touches the screen edge", bsAutoCheckBox|wsTabStop, 16, 486, 368, 22, idAutoHide) + // The right-hand column: how the bar looks, and what is on it. + combo2 := func(y int, id uintptr) uintptr { + return makeControl(hw, inst, "COMBOBOX", "", cbsDropDownList|wsVScroll|wsTabStop, 560, y, 224, 200, id) + } + label2 := func(text string, y int) { + makeControl(hw, inst, "STATIC", text, 0, 416, y+4, 140, 20, 0) + } + label2("Bar color", 16) + ctlBarColor = combo2(16, idBarColor) + label2("Windows logo shape", 52) + ctlLogoStyle = combo2(52, idLogoStyle) + label2("Clock text size", 88) + ctlClockSize = combo2(88, idClockSize) + ctlClockBold = makeControl(hw, inst, "BUTTON", "Bold clock text", bsAutoCheckBox|wsTabStop, 416, 124, 368, 22, idClockBold) + makeControl(hw, inst, "STATIC", "Show on the bar:", 0, 416, 172, 368, 20, 0) + ctlShowBattery = makeControl(hw, inst, "BUTTON", "Battery", bsAutoCheckBox|wsTabStop, 416, 198, 368, 22, idShowBattery) + ctlShowVolume = makeControl(hw, inst, "BUTTON", "Volume", bsAutoCheckBox|wsTabStop, 416, 226, 368, 22, idShowVolume) + ctlShowWifi = makeControl(hw, inst, "BUTTON", "Wifi", bsAutoCheckBox|wsTabStop, 416, 254, 368, 22, idShowWifi) + for _, b := range barPalette { + pSendMessage.Call(ctlBarColor, cbAddString, 0, uintptr(unsafe.Pointer(u16(b.name)))) + } + for _, n := range logoStyleNames { + pSendMessage.Call(ctlLogoStyle, cbAddString, 0, uintptr(unsafe.Pointer(u16(n)))) + } + for _, c := range clockSizes { + pSendMessage.Call(ctlClockSize, cbAddString, 0, uintptr(unsafe.Pointer(u16(c.name)))) + } + makeControl(hw, inst, "BUTTON", "Reset position", bsPushButton|wsTabStop, 16, 526, 116, 28, idResetPos) makeControl(hw, inst, "BUTTON", "Reset bar width", bsPushButton|wsTabStop, 140, 526, 116, 28, idResetWidth) makeControl(hw, inst, "BUTTON", "Close", bsDefPushButton|wsTabStop, 292, 526, 92, 28, idClose) @@ -226,6 +264,13 @@ func settingsSync() { pSendMessage.Call(ctlAutostart, bmSetCheck, boolWP(autostartEnabled()), 0) pSendMessage.Call(ctlGroup, bmSetCheck, boolWP(groupWins), 0) pSendMessage.Call(ctlAutoHide, bmSetCheck, boolWP(autoHide), 0) + pSendMessage.Call(ctlBarColor, cbSetCurSel, uintptr(barIdx), 0) + pSendMessage.Call(ctlLogoStyle, cbSetCurSel, uintptr(logoStyle), 0) + pSendMessage.Call(ctlClockSize, cbSetCurSel, uintptr(clockSizeIx), 0) + pSendMessage.Call(ctlClockBold, bmSetCheck, boolWP(clockBold), 0) + pSendMessage.Call(ctlShowBattery, bmSetCheck, boolWP(showBattery), 0) + pSendMessage.Call(ctlShowVolume, bmSetCheck, boolWP(showVolume), 0) + pSendMessage.Call(ctlShowWifi, bmSetCheck, boolWP(showWifi), 0) // Leave the ZIP box alone while the person is typing in it. if f, _, _ := pGetFocus.Call(); f != ctlZip && zipText() != wxZip { @@ -336,6 +381,26 @@ func settingsCommand(id, note uintptr) { setGroupWins(checked(ctlGroup)) case idAutoHide: setAutoHide(checked(ctlAutoHide)) + case idBarColor, idLogoStyle, idClockSize: + if note != cbnSelChange { + return + } + switch id { + case idBarColor: + setBarColor(comboChoice(ctlBarColor)) + case idLogoStyle: + setLogoStyle(comboChoice(ctlLogoStyle)) + case idClockSize: + setClockSize(comboChoice(ctlClockSize)) + } + case idClockBold: + setClockBold(checked(ctlClockBold)) + case idShowBattery: + setShowBattery(checked(ctlShowBattery)) + case idShowVolume: + setShowVolume(checked(ctlShowVolume)) + case idShowWifi: + setShowWifi(checked(ctlShowWifi)) case idAutostart: setAutostart(checked(ctlAutostart)) settingsSync()