|
|
|
@@ -9,6 +9,7 @@ import (
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"regexp"
|
|
|
|
"regexp"
|
|
|
|
|
|
|
|
"runtime"
|
|
|
|
"runtime/debug"
|
|
|
|
"runtime/debug"
|
|
|
|
"sort"
|
|
|
|
"sort"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
@@ -27,6 +28,7 @@ const (
|
|
|
|
wsVisible = 0x10000000
|
|
|
|
wsVisible = 0x10000000
|
|
|
|
wsChild = 0x40000000
|
|
|
|
wsChild = 0x40000000
|
|
|
|
wsPopup = 0x80000000
|
|
|
|
wsPopup = 0x80000000
|
|
|
|
|
|
|
|
wsSizeBox = 0x00040000
|
|
|
|
wsClipChildren = 0x02000000
|
|
|
|
wsClipChildren = 0x02000000
|
|
|
|
wsClipSiblings = 0x04000000
|
|
|
|
wsClipSiblings = 0x04000000
|
|
|
|
wsBorder = 0x00800000
|
|
|
|
wsBorder = 0x00800000
|
|
|
|
@@ -41,6 +43,7 @@ const (
|
|
|
|
wmPaint = 0x000F
|
|
|
|
wmPaint = 0x000F
|
|
|
|
wmEraseBkgnd = 0x0014
|
|
|
|
wmEraseBkgnd = 0x0014
|
|
|
|
wmSize = 0x0005
|
|
|
|
wmSize = 0x0005
|
|
|
|
|
|
|
|
wmGetMinMaxInfo = 0x0024
|
|
|
|
wmVScroll = 0x0115
|
|
|
|
wmVScroll = 0x0115
|
|
|
|
wmMouseWheel = 0x020A
|
|
|
|
wmMouseWheel = 0x020A
|
|
|
|
wmCloseGUI = 0x0010
|
|
|
|
wmCloseGUI = 0x0010
|
|
|
|
@@ -57,6 +60,14 @@ const (
|
|
|
|
enKillFocus = 0x0200
|
|
|
|
enKillFocus = 0x0200
|
|
|
|
bnClicked = 0x0000
|
|
|
|
bnClicked = 0x0000
|
|
|
|
htCaption = 2
|
|
|
|
htCaption = 2
|
|
|
|
|
|
|
|
htLeft = 10
|
|
|
|
|
|
|
|
htRight = 11
|
|
|
|
|
|
|
|
htTop = 12
|
|
|
|
|
|
|
|
htTopLeft = 13
|
|
|
|
|
|
|
|
htTopRight = 14
|
|
|
|
|
|
|
|
htBottom = 15
|
|
|
|
|
|
|
|
htBottomLeft = 16
|
|
|
|
|
|
|
|
htBottomRight = 17
|
|
|
|
tbButtonStructSize = 0x041E
|
|
|
|
tbButtonStructSize = 0x041E
|
|
|
|
tbAddButtons = 0x0414
|
|
|
|
tbAddButtons = 0x0414
|
|
|
|
tbAddStringW = 0x044D
|
|
|
|
tbAddStringW = 0x044D
|
|
|
|
@@ -97,11 +108,14 @@ const (
|
|
|
|
contentTop = headerHeight + navBarHeight
|
|
|
|
contentTop = headerHeight + navBarHeight
|
|
|
|
bottomBarHeight = 48
|
|
|
|
bottomBarHeight = 48
|
|
|
|
windowWidth = 760
|
|
|
|
windowWidth = 760
|
|
|
|
|
|
|
|
minWindowWidth = 760
|
|
|
|
|
|
|
|
minWindowHeight = contentTop + leftPaneHeight + bottomBarHeight
|
|
|
|
|
|
|
|
resizeGripSize = 8
|
|
|
|
leftPaneWidth = 445
|
|
|
|
leftPaneWidth = 445
|
|
|
|
leftPaneHeight = 560
|
|
|
|
leftPaneHeight = 560
|
|
|
|
rightPaneWidth = windowWidth - leftPaneWidth
|
|
|
|
rightPaneWidth = windowWidth - leftPaneWidth
|
|
|
|
settingsPaneWidth = rightPaneWidth
|
|
|
|
settingsPaneWidth = rightPaneWidth
|
|
|
|
settingsPaneHeight = leftPaneHeight
|
|
|
|
settingsPaneHeight = 700
|
|
|
|
clrMainBg = 0x00311c0b
|
|
|
|
clrMainBg = 0x00311c0b
|
|
|
|
clrHeaderBg = 0x004d2c08
|
|
|
|
clrHeaderBg = 0x004d2c08
|
|
|
|
clrNavBg = 0x0024150b
|
|
|
|
clrNavBg = 0x0024150b
|
|
|
|
@@ -120,6 +134,12 @@ const (
|
|
|
|
|
|
|
|
|
|
|
|
const translateTabEnabled = false
|
|
|
|
const translateTabEnabled = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
defaultGUIFontSize = 14
|
|
|
|
|
|
|
|
minGUIFontSize = 8
|
|
|
|
|
|
|
|
maxGUIFontSize = 30
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var joinLeaveLinePattern = regexp.MustCompile(`^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]\s+\[(join|leave)\]\s+(.+?)\s+\((\d+)\)$`)
|
|
|
|
var joinLeaveLinePattern = regexp.MustCompile(`^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]\s+\[(join|leave)\]\s+(.+?)\s+\((\d+)\)$`)
|
|
|
|
var runtimeTimePattern = regexp.MustCompile(`^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]`)
|
|
|
|
var runtimeTimePattern = regexp.MustCompile(`^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]`)
|
|
|
|
var worldIdPattern = regexp.MustCompile(`worldId=(wrld_[0-9a-fA-F-]+)`)
|
|
|
|
var worldIdPattern = regexp.MustCompile(`worldId=(wrld_[0-9a-fA-F-]+)`)
|
|
|
|
@@ -139,6 +159,7 @@ var hwndNoZOrder uintptr = 0x0004
|
|
|
|
var hwndNoSize uintptr = 0x0001
|
|
|
|
var hwndNoSize uintptr = 0x0001
|
|
|
|
var hwndNoActivate uintptr = 0x0010
|
|
|
|
var hwndNoActivate uintptr = 0x0010
|
|
|
|
var hwndShowWindow uintptr = 0x0040
|
|
|
|
var hwndShowWindow uintptr = 0x0040
|
|
|
|
|
|
|
|
var swMinimize uintptr = 6
|
|
|
|
var swRestore uintptr = 9
|
|
|
|
var swRestore uintptr = 9
|
|
|
|
var swHideControl uintptr = 0
|
|
|
|
var swHideControl uintptr = 0
|
|
|
|
var swShowControl uintptr = 5
|
|
|
|
var swShowControl uintptr = 5
|
|
|
|
@@ -220,8 +241,6 @@ type guiApp struct {
|
|
|
|
tabSettings uintptr
|
|
|
|
tabSettings uintptr
|
|
|
|
btnTopMost uintptr
|
|
|
|
btnTopMost uintptr
|
|
|
|
btnAutoUnmute uintptr
|
|
|
|
btnAutoUnmute uintptr
|
|
|
|
btnFontDown uintptr
|
|
|
|
|
|
|
|
btnFontUp uintptr
|
|
|
|
|
|
|
|
activeTab string
|
|
|
|
activeTab string
|
|
|
|
topMost bool
|
|
|
|
topMost bool
|
|
|
|
autoUnmuteOnLeave bool
|
|
|
|
autoUnmuteOnLeave bool
|
|
|
|
@@ -328,6 +347,9 @@ func guiLog(text string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func runNativeGUI(initialTab string) error {
|
|
|
|
func runNativeGUI(initialTab string) error {
|
|
|
|
|
|
|
|
runtime.LockOSThread()
|
|
|
|
|
|
|
|
defer runtime.UnlockOSThread()
|
|
|
|
|
|
|
|
|
|
|
|
user32 := syscall.NewLazyDLL("user32.dll")
|
|
|
|
user32 := syscall.NewLazyDLL("user32.dll")
|
|
|
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
|
|
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
|
|
|
gdi32 := syscall.NewLazyDLL("gdi32.dll")
|
|
|
|
gdi32 := syscall.NewLazyDLL("gdi32.dll")
|
|
|
|
@@ -445,7 +467,7 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
if guiCfg.FontSize > 0 {
|
|
|
|
if guiCfg.FontSize > 0 {
|
|
|
|
app.fontSize = guiCfg.FontSize
|
|
|
|
app.fontSize = guiCfg.FontSize
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
app.fontSize = 18
|
|
|
|
app.fontSize = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.refreshIntervalValue = guiCfg.RefreshIntervalValue
|
|
|
|
app.refreshIntervalValue = guiCfg.RefreshIntervalValue
|
|
|
|
if app.refreshIntervalValue <= 0 {
|
|
|
|
if app.refreshIntervalValue <= 0 {
|
|
|
|
@@ -567,6 +589,15 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
return paintMainWindow(hwnd, &app)
|
|
|
|
return paintMainWindow(hwnd, &app)
|
|
|
|
case wmEraseBkgnd:
|
|
|
|
case wmEraseBkgnd:
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
|
|
|
|
case wmGetMinMaxInfo:
|
|
|
|
|
|
|
|
applyMinMaxInfo(lParam)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
case wmSize:
|
|
|
|
|
|
|
|
layoutMainWindow(&app)
|
|
|
|
|
|
|
|
if invalidateRectProc != nil {
|
|
|
|
|
|
|
|
invalidateRectProc.Call(hwnd, 0, 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
case wmCreateGUI:
|
|
|
|
case wmCreateGUI:
|
|
|
|
app.hwnd = hwnd
|
|
|
|
app.hwnd = hwnd
|
|
|
|
buttonClass, _ := syscall.UTF16PtrFromString("BUTTON")
|
|
|
|
buttonClass, _ := syscall.UTF16PtrFromString("BUTTON")
|
|
|
|
@@ -575,8 +606,6 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
rightTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
rightTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
topMostTitle, _ := syscall.UTF16PtrFromString("Top most")
|
|
|
|
topMostTitle, _ := syscall.UTF16PtrFromString("Top most")
|
|
|
|
autoUnmuteTitle, _ := syscall.UTF16PtrFromString("Leave unmute")
|
|
|
|
autoUnmuteTitle, _ := syscall.UTF16PtrFromString("Leave unmute")
|
|
|
|
fontDownTitle, _ := syscall.UTF16PtrFromString("A-")
|
|
|
|
|
|
|
|
fontUpTitle, _ := syscall.UTF16PtrFromString("A+")
|
|
|
|
|
|
|
|
browseTitle, _ := syscall.UTF16PtrFromString("参照")
|
|
|
|
browseTitle, _ := syscall.UTF16PtrFromString("参照")
|
|
|
|
saveTitle, _ := syscall.UTF16PtrFromString("保存")
|
|
|
|
saveTitle, _ := syscall.UTF16PtrFromString("保存")
|
|
|
|
toolbarTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
toolbarTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
@@ -624,41 +653,43 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
app.settingsPaneHwnd, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(paneClassName)), uintptr(unsafe.Pointer(settingsPaneTitle)), paneStyle, 0, contentTop, windowWidth, settingsPaneHeight, hwnd, idLog+1, hInstance, 0)
|
|
|
|
app.settingsPaneHwnd, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(paneClassName)), uintptr(unsafe.Pointer(settingsPaneTitle)), paneStyle, 0, contentTop, windowWidth, settingsPaneHeight, hwnd, idLog+1, hInstance, 0)
|
|
|
|
app.btnTopMost, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(topMostTitle)), buttonStyle, leftPaneWidth+32, contentTop+86, 140, 30, hwnd, 3005, hInstance, 0)
|
|
|
|
app.btnTopMost, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(topMostTitle)), buttonStyle, leftPaneWidth+32, contentTop+86, 140, 30, hwnd, 3005, hInstance, 0)
|
|
|
|
app.btnAutoUnmute, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(autoUnmuteTitle)), buttonStyle, leftPaneWidth+32, contentTop+132, 180, 30, hwnd, 3008, hInstance, 0)
|
|
|
|
app.btnAutoUnmute, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(autoUnmuteTitle)), buttonStyle, leftPaneWidth+32, contentTop+132, 180, 30, hwnd, 3008, hInstance, 0)
|
|
|
|
app.btnFontDown, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(fontDownTitle)), buttonStyle, leftPaneWidth+32, contentTop+178, 52, 30, hwnd, 3006, hInstance, 0)
|
|
|
|
|
|
|
|
app.btnFontUp, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(buttonClass)), uintptr(unsafe.Pointer(fontUpTitle)), buttonStyle, leftPaneWidth+92, contentTop+178, 52, 30, hwnd, 3007, hInstance, 0)
|
|
|
|
|
|
|
|
exportDirTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
exportDirTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
|
|
|
|
exportDirRect := settingsHistoryExportDirRect()
|
|
|
|
app.settingsExportDirEdit, _, _ = createWindowEx.Call(
|
|
|
|
app.settingsExportDirEdit, _, _ = createWindowEx.Call(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
uintptr(unsafe.Pointer(editClassTitle)),
|
|
|
|
uintptr(unsafe.Pointer(editClassTitle)),
|
|
|
|
uintptr(unsafe.Pointer(exportDirTitle)),
|
|
|
|
uintptr(unsafe.Pointer(exportDirTitle)),
|
|
|
|
uintptr(wsChild|wsVisible|wsBorder|wsTabstop|esAutohscroll),
|
|
|
|
uintptr(wsChild|wsVisible|wsBorder|wsTabstop|esAutohscroll),
|
|
|
|
116, 410, 520, 24,
|
|
|
|
uintptr(exportDirRect.Left), uintptr(exportDirRect.Top), uintptr(exportDirRect.Right-exportDirRect.Left), uintptr(exportDirRect.Bottom-exportDirRect.Top),
|
|
|
|
app.settingsPaneHwnd, idHistoryExportDir, hInstance, 0,
|
|
|
|
app.settingsPaneHwnd, idHistoryExportDir, hInstance, 0,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
browseStyle := uintptr(wsChild | wsTabstop)
|
|
|
|
browseStyle := uintptr(wsChild | wsTabstop)
|
|
|
|
|
|
|
|
browseRect := settingsHistoryExportBrowseRect()
|
|
|
|
app.settingsExportBrowseBtn, _, _ = createWindowEx.Call(
|
|
|
|
app.settingsExportBrowseBtn, _, _ = createWindowEx.Call(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
uintptr(unsafe.Pointer(buttonClass)),
|
|
|
|
uintptr(unsafe.Pointer(buttonClass)),
|
|
|
|
uintptr(unsafe.Pointer(browseTitle)),
|
|
|
|
uintptr(unsafe.Pointer(browseTitle)),
|
|
|
|
browseStyle,
|
|
|
|
browseStyle,
|
|
|
|
644, 410, 92, 24,
|
|
|
|
uintptr(browseRect.Left), uintptr(browseRect.Top), uintptr(browseRect.Right-browseRect.Left), uintptr(browseRect.Bottom-browseRect.Top),
|
|
|
|
app.settingsPaneHwnd, idHistoryExportBrowse, hInstance, 0,
|
|
|
|
app.settingsPaneHwnd, idHistoryExportBrowse, hInstance, 0,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
exportCustomTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
exportCustomTitle, _ := syscall.UTF16PtrFromString("")
|
|
|
|
|
|
|
|
customRect := settingsHistoryExportCustomRect()
|
|
|
|
app.settingsExportCustomEdit, _, _ = createWindowEx.Call(
|
|
|
|
app.settingsExportCustomEdit, _, _ = createWindowEx.Call(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
uintptr(unsafe.Pointer(editClassTitle)),
|
|
|
|
uintptr(unsafe.Pointer(editClassTitle)),
|
|
|
|
uintptr(unsafe.Pointer(exportCustomTitle)),
|
|
|
|
uintptr(unsafe.Pointer(exportCustomTitle)),
|
|
|
|
uintptr(wsChild|wsVisible|wsBorder|wsTabstop|esAutohscroll),
|
|
|
|
uintptr(wsChild|wsVisible|wsBorder|wsTabstop|esAutohscroll),
|
|
|
|
116, 520, 520, 24,
|
|
|
|
uintptr(customRect.Left), uintptr(customRect.Top), uintptr(customRect.Right-customRect.Left), uintptr(customRect.Bottom-customRect.Top),
|
|
|
|
app.settingsPaneHwnd, idHistoryExportCustom, hInstance, 0,
|
|
|
|
app.settingsPaneHwnd, idHistoryExportCustom, hInstance, 0,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
saveRect := settingsHistoryExportCustomSaveRect()
|
|
|
|
app.settingsExportCustomSaveBtn, _, _ = createWindowEx.Call(
|
|
|
|
app.settingsExportCustomSaveBtn, _, _ = createWindowEx.Call(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
uintptr(unsafe.Pointer(buttonClass)),
|
|
|
|
uintptr(unsafe.Pointer(buttonClass)),
|
|
|
|
uintptr(unsafe.Pointer(saveTitle)),
|
|
|
|
uintptr(unsafe.Pointer(saveTitle)),
|
|
|
|
browseStyle,
|
|
|
|
browseStyle,
|
|
|
|
644, 520, 92, 24,
|
|
|
|
uintptr(saveRect.Left), uintptr(saveRect.Top), uintptr(saveRect.Right-saveRect.Left), uintptr(saveRect.Bottom-saveRect.Top),
|
|
|
|
app.settingsPaneHwnd, idHistoryExportSave, hInstance, 0,
|
|
|
|
app.settingsPaneHwnd, idHistoryExportSave, hInstance, 0,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
applyRefreshTimer(hwnd, &app)
|
|
|
|
applyRefreshTimer(hwnd, &app)
|
|
|
|
@@ -744,8 +775,11 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
if !allowRapidSettingsAction(&app) {
|
|
|
|
if !allowRapidSettingsAction(&app) {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if app.fontSize > 10 {
|
|
|
|
if app.fontSize > minGUIFontSize {
|
|
|
|
app.fontSize -= 2
|
|
|
|
app.fontSize -= 2
|
|
|
|
|
|
|
|
if app.fontSize < minGUIFontSize {
|
|
|
|
|
|
|
|
app.fontSize = minGUIFontSize
|
|
|
|
|
|
|
|
}
|
|
|
|
oldFont := app.hFont
|
|
|
|
oldFont := app.hFont
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
applyFont(&app)
|
|
|
|
applyFont(&app)
|
|
|
|
@@ -759,8 +793,11 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
if !allowRapidSettingsAction(&app) {
|
|
|
|
if !allowRapidSettingsAction(&app) {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if app.fontSize < 30 {
|
|
|
|
if app.fontSize < maxGUIFontSize {
|
|
|
|
app.fontSize += 2
|
|
|
|
app.fontSize += 2
|
|
|
|
|
|
|
|
if app.fontSize > maxGUIFontSize {
|
|
|
|
|
|
|
|
app.fontSize = maxGUIFontSize
|
|
|
|
|
|
|
|
}
|
|
|
|
oldFont := app.hFont
|
|
|
|
oldFont := app.hFont
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
applyFont(&app)
|
|
|
|
applyFont(&app)
|
|
|
|
@@ -781,8 +818,16 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
case wmLButtonDown:
|
|
|
|
case wmLButtonDown:
|
|
|
|
x := int32(lParam & 0xffff)
|
|
|
|
x := int32(lParam & 0xffff)
|
|
|
|
y := int32((lParam >> 16) & 0xffff)
|
|
|
|
y := int32((lParam >> 16) & 0xffff)
|
|
|
|
if y >= 0 && y < headerHeight {
|
|
|
|
|
|
|
|
var rc winRect
|
|
|
|
var rc winRect
|
|
|
|
|
|
|
|
if getClientRectProc != nil {
|
|
|
|
|
|
|
|
getClientRectProc.Call(hwnd, uintptr(unsafe.Pointer(&rc)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ht := resizeHitTest(x, y, rc); ht != 0 {
|
|
|
|
|
|
|
|
releaseCapture.Call()
|
|
|
|
|
|
|
|
sendMessageProc.Call(hwnd, wmNCLButtonDown, uintptr(ht), 0)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if y >= 0 && y < headerHeight {
|
|
|
|
width := int32(windowWidth)
|
|
|
|
width := int32(windowWidth)
|
|
|
|
if getClientRectProc != nil {
|
|
|
|
if getClientRectProc != nil {
|
|
|
|
getClientRectProc.Call(hwnd, uintptr(unsafe.Pointer(&rc)))
|
|
|
|
getClientRectProc.Call(hwnd, uintptr(unsafe.Pointer(&rc)))
|
|
|
|
@@ -790,8 +835,25 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
width = rc.Right
|
|
|
|
width = rc.Right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if x >= width-42 && x <= width-22 && y >= 12 && y <= 32 {
|
|
|
|
switch {
|
|
|
|
guiLog("close button ignored to keep GUI visible")
|
|
|
|
case pointInHeaderDot(x, y, width-92, 22):
|
|
|
|
|
|
|
|
guiLog("window control minimize")
|
|
|
|
|
|
|
|
if showWindowProc != nil {
|
|
|
|
|
|
|
|
showWindowProc.Call(hwnd, swMinimize)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
case pointInHeaderDot(x, y, width-62, 22):
|
|
|
|
|
|
|
|
guiLog("window control topmost toggle")
|
|
|
|
|
|
|
|
app.topMost = !app.topMost
|
|
|
|
|
|
|
|
saveGUISettings(&app)
|
|
|
|
|
|
|
|
applyTopMost(hwnd, &app)
|
|
|
|
|
|
|
|
if invalidateRectProc != nil {
|
|
|
|
|
|
|
|
invalidateRectProc.Call(hwnd, 0, 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
case pointInHeaderDot(x, y, width-32, 22):
|
|
|
|
|
|
|
|
guiLog("window control close")
|
|
|
|
|
|
|
|
postQuitMessage.Call(0)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
releaseCapture.Call()
|
|
|
|
releaseCapture.Call()
|
|
|
|
@@ -894,7 +956,8 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
postQuitMessage.Call(0)
|
|
|
|
postQuitMessage.Call(0)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
case wmCloseGUI:
|
|
|
|
case wmCloseGUI:
|
|
|
|
guiLog("wmClose ignored to keep GUI visible")
|
|
|
|
guiLog("wmClose received")
|
|
|
|
|
|
|
|
postQuitMessage.Call(0)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret, _, _ := defWindowProc.Call(hwnd, uintptr(message), wParam, lParam)
|
|
|
|
ret, _, _ := defWindowProc.Call(hwnd, uintptr(message), wParam, lParam)
|
|
|
|
@@ -917,7 +980,7 @@ func runNativeGUI(initialTab string) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
guiLog("stage=create window")
|
|
|
|
guiLog("stage=create window")
|
|
|
|
app.hwnd, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(title)), wsPopup|wsVisible|wsClipChildren, 200, 120, windowWidth, contentTop+leftPaneHeight+bottomBarHeight, 0, 0, hInstance, 0)
|
|
|
|
app.hwnd, _, _ = createWindowEx.Call(0, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(title)), wsPopup|wsSizeBox|wsVisible|wsClipChildren, 200, 120, windowWidth, contentTop+leftPaneHeight+bottomBarHeight, 0, 0, hInstance, 0)
|
|
|
|
if app.hwnd == 0 {
|
|
|
|
if app.hwnd == 0 {
|
|
|
|
guiLog("stage=create window failed")
|
|
|
|
guiLog("stage=create window failed")
|
|
|
|
return fmt.Errorf("create window failed")
|
|
|
|
return fmt.Errorf("create window failed")
|
|
|
|
@@ -990,6 +1053,10 @@ func refreshGUI(setWindowText *syscall.LazyProc, app *guiApp, reloadData bool) {
|
|
|
|
if app == nil {
|
|
|
|
if app == nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if app.activeTab == "history" && !reloadData {
|
|
|
|
|
|
|
|
syncPaneVisibility(app)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
start := time.Now()
|
|
|
|
start := time.Now()
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
if d := time.Since(start); d > 100*time.Millisecond {
|
|
|
|
if d := time.Since(start); d > 100*time.Millisecond {
|
|
|
|
@@ -1173,7 +1240,7 @@ func refreshGUI(setWindowText *syscall.LazyProc, app *guiApp, reloadData bool) {
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
showWindowProc.Call(app.settingsPaneHwnd, swHideControl)
|
|
|
|
showWindowProc.Call(app.settingsPaneHwnd, swHideControl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute, app.btnFontDown, app.btnFontUp} {
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute} {
|
|
|
|
if hwnd != 0 {
|
|
|
|
if hwnd != 0 {
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1214,7 +1281,7 @@ func refreshSettingsControls(showWindowProc, setWindowPosProc *syscall.LazyProc,
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.lastSettingsVisible = true
|
|
|
|
app.lastSettingsVisible = true
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute, app.btnFontDown, app.btnFontUp} {
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute} {
|
|
|
|
if hwnd != 0 {
|
|
|
|
if hwnd != 0 {
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1238,7 +1305,7 @@ func refreshSettingsControls(showWindowProc, setWindowPosProc *syscall.LazyProc,
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
showWindowProc.Call(app.settingsPaneHwnd, swHideControl)
|
|
|
|
showWindowProc.Call(app.settingsPaneHwnd, swHideControl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute, app.btnFontDown, app.btnFontUp, app.settingsExportDirEdit, app.settingsExportCustomEdit, app.settingsExportBrowseBtn, app.settingsExportCustomSaveBtn} {
|
|
|
|
for _, hwnd := range []uintptr{app.btnTopMost, app.btnAutoUnmute, app.settingsExportDirEdit, app.settingsExportCustomEdit, app.settingsExportBrowseBtn, app.settingsExportCustomSaveBtn} {
|
|
|
|
if hwnd != 0 {
|
|
|
|
if hwnd != 0 {
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
showWindowProc.Call(hwnd, swHideControl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1406,7 +1473,7 @@ func applyJoinLogFont(app *guiApp, presentCount int) {
|
|
|
|
size = app.fontSize
|
|
|
|
size = app.fontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if size <= 0 {
|
|
|
|
if size <= 0 {
|
|
|
|
size = 18
|
|
|
|
size = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if app.joinHFont != 0 && app.joinBoldHFont != 0 && app.joinHeadlineHFont != 0 &&
|
|
|
|
if app.joinHFont != 0 && app.joinBoldHFont != 0 && app.joinHeadlineHFont != 0 &&
|
|
|
|
app.joinFontSize == size && app.joinBoldFontSize == size && app.joinHeadlineSize == size+2 {
|
|
|
|
app.joinFontSize == size && app.joinBoldFontSize == size && app.joinHeadlineSize == size+2 {
|
|
|
|
@@ -1481,7 +1548,7 @@ func applyJoinLogFontSize(app *guiApp, size int) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if size <= 0 {
|
|
|
|
if size <= 0 {
|
|
|
|
size = 18
|
|
|
|
size = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if app.joinHFont != 0 && app.joinBoldHFont != 0 && app.joinFontSize == size && app.joinBoldFontSize == size {
|
|
|
|
if app.joinHFont != 0 && app.joinBoldHFont != 0 && app.joinFontSize == size && app.joinBoldFontSize == size {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
@@ -1511,7 +1578,7 @@ func applyJoinLogFontSize(app *guiApp, size int) {
|
|
|
|
func fitJoinLogFontSize(baseSize, lineCount, availableHeight int) int {
|
|
|
|
func fitJoinLogFontSize(baseSize, lineCount, availableHeight int) int {
|
|
|
|
size := baseSize
|
|
|
|
size := baseSize
|
|
|
|
if size <= 0 {
|
|
|
|
if size <= 0 {
|
|
|
|
size = 18
|
|
|
|
size = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if lineCount <= 0 {
|
|
|
|
if lineCount <= 0 {
|
|
|
|
lineCount = 1
|
|
|
|
lineCount = 1
|
|
|
|
@@ -1519,14 +1586,14 @@ func fitJoinLogFontSize(baseSize, lineCount, availableHeight int) int {
|
|
|
|
if availableHeight <= 0 {
|
|
|
|
if availableHeight <= 0 {
|
|
|
|
availableHeight = 300
|
|
|
|
availableHeight = 300
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for size > 8 {
|
|
|
|
for size > minGUIFontSize {
|
|
|
|
if joinPaneContentHeight(size, lineCount) <= availableHeight {
|
|
|
|
if joinPaneContentHeight(size, lineCount) <= availableHeight {
|
|
|
|
break
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
size -= 2
|
|
|
|
size -= 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if size < 8 {
|
|
|
|
if size < minGUIFontSize {
|
|
|
|
size = 8
|
|
|
|
size = minGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return size
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1574,33 +1641,43 @@ func resizeGUIForJoinContent(app *guiApp, contentHeight int) {
|
|
|
|
if contentHeight < leftPaneHeight {
|
|
|
|
if contentHeight < leftPaneHeight {
|
|
|
|
contentHeight = leftPaneHeight
|
|
|
|
contentHeight = leftPaneHeight
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if w, h, ok := clientSize(app.hwnd); ok {
|
|
|
|
|
|
|
|
if h > contentTop+contentHeight+bottomBarHeight {
|
|
|
|
|
|
|
|
contentHeight = h - contentTop - bottomBarHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if w < minWindowWidth {
|
|
|
|
|
|
|
|
w = minWindowWidth
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resizeFlags := hwndNoMove | hwndNoZOrder | hwndNoActivate
|
|
|
|
|
|
|
|
windowHeight := contentTop + contentHeight + bottomBarHeight
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.hwnd, 0, 0, 0, uintptr(w), uintptr(windowHeight), resizeFlags)
|
|
|
|
|
|
|
|
layoutMainWindow(app)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
resizeFlags := hwndNoMove | hwndNoZOrder | hwndNoActivate
|
|
|
|
resizeFlags := hwndNoMove | hwndNoZOrder | hwndNoActivate
|
|
|
|
windowHeight := contentTop + contentHeight + bottomBarHeight
|
|
|
|
windowHeight := contentTop + contentHeight + bottomBarHeight
|
|
|
|
setWindowPosProc.Call(app.hwnd, 0, 0, 0, windowWidth, uintptr(windowHeight), resizeFlags)
|
|
|
|
setWindowPosProc.Call(app.hwnd, 0, 0, 0, windowWidth, uintptr(windowHeight), resizeFlags)
|
|
|
|
for _, item := range []struct {
|
|
|
|
layoutMainWindow(app)
|
|
|
|
hwnd uintptr
|
|
|
|
|
|
|
|
width int
|
|
|
|
|
|
|
|
}{
|
|
|
|
|
|
|
|
{app.leftHwnd, leftPaneWidth},
|
|
|
|
|
|
|
|
{app.rightHwnd, rightPaneWidth},
|
|
|
|
|
|
|
|
{app.settingsPaneHwnd, settingsPaneWidth},
|
|
|
|
|
|
|
|
} {
|
|
|
|
|
|
|
|
if item.hwnd != 0 {
|
|
|
|
|
|
|
|
setWindowPosProc.Call(item.hwnd, 0, 0, 0, uintptr(item.width), uintptr(contentHeight), resizeFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func resizeGUIForSettings(app *guiApp) {
|
|
|
|
func resizeGUIForSettings(app *guiApp) {
|
|
|
|
if app == nil || setWindowPosProc == nil || app.hwnd == 0 {
|
|
|
|
if app == nil || setWindowPosProc == nil || app.hwnd == 0 {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resizeFlags := hwndNoMove | hwndNoZOrder | hwndNoActivate
|
|
|
|
contentHeight := settingsPaneHeight
|
|
|
|
windowHeight := contentTop + leftPaneHeight + bottomBarHeight
|
|
|
|
width := windowWidth
|
|
|
|
setWindowPosProc.Call(app.hwnd, 0, 0, 0, windowWidth, uintptr(windowHeight), resizeFlags)
|
|
|
|
if w, h, ok := clientSize(app.hwnd); ok {
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
if w > width {
|
|
|
|
setWindowPosProc.Call(app.settingsPaneHwnd, 0, 0, uintptr(contentTop), windowWidth, uintptr(leftPaneHeight), resizeFlags)
|
|
|
|
width = w
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if h > contentTop+contentHeight+bottomBarHeight {
|
|
|
|
|
|
|
|
contentHeight = h - contentTop - bottomBarHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resizeFlags := hwndNoMove | hwndNoZOrder | hwndNoActivate
|
|
|
|
|
|
|
|
windowHeight := contentTop + contentHeight + bottomBarHeight
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.hwnd, 0, 0, 0, uintptr(width), uintptr(windowHeight), resizeFlags)
|
|
|
|
|
|
|
|
layoutMainWindow(app)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type winRect struct {
|
|
|
|
type winRect struct {
|
|
|
|
@@ -1610,6 +1687,110 @@ type winRect struct {
|
|
|
|
Bottom int32
|
|
|
|
Bottom int32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type winPoint struct {
|
|
|
|
|
|
|
|
X int32
|
|
|
|
|
|
|
|
Y int32
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type minMaxInfo struct {
|
|
|
|
|
|
|
|
Reserved winPoint
|
|
|
|
|
|
|
|
MaxSize winPoint
|
|
|
|
|
|
|
|
MaxPosition winPoint
|
|
|
|
|
|
|
|
MinTrackSize winPoint
|
|
|
|
|
|
|
|
MaxTrackSize winPoint
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func applyMinMaxInfo(lParam uintptr) {
|
|
|
|
|
|
|
|
if lParam == 0 {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
info := (*minMaxInfo)(unsafe.Pointer(lParam))
|
|
|
|
|
|
|
|
info.MinTrackSize.X = minWindowWidth
|
|
|
|
|
|
|
|
info.MinTrackSize.Y = minWindowHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func clientSize(hwnd uintptr) (int, int, bool) {
|
|
|
|
|
|
|
|
if hwnd == 0 || getClientRectProc == nil {
|
|
|
|
|
|
|
|
return 0, 0, false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var rc winRect
|
|
|
|
|
|
|
|
getClientRectProc.Call(hwnd, uintptr(unsafe.Pointer(&rc)))
|
|
|
|
|
|
|
|
w := int(rc.Right - rc.Left)
|
|
|
|
|
|
|
|
h := int(rc.Bottom - rc.Top)
|
|
|
|
|
|
|
|
if w <= 0 || h <= 0 {
|
|
|
|
|
|
|
|
return 0, 0, false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return w, h, true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func resizeHitTest(x, y int32, rc winRect) int32 {
|
|
|
|
|
|
|
|
if rc.Right <= 0 || rc.Bottom <= 0 {
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
onLeft := x >= 0 && x < resizeGripSize
|
|
|
|
|
|
|
|
onRight := x <= rc.Right && x > rc.Right-resizeGripSize
|
|
|
|
|
|
|
|
onTop := y >= 0 && y < resizeGripSize
|
|
|
|
|
|
|
|
onBottom := y <= rc.Bottom && y > rc.Bottom-resizeGripSize
|
|
|
|
|
|
|
|
switch {
|
|
|
|
|
|
|
|
case onTop && onLeft:
|
|
|
|
|
|
|
|
return htTopLeft
|
|
|
|
|
|
|
|
case onTop && onRight:
|
|
|
|
|
|
|
|
return htTopRight
|
|
|
|
|
|
|
|
case onBottom && onLeft:
|
|
|
|
|
|
|
|
return htBottomLeft
|
|
|
|
|
|
|
|
case onBottom && onRight:
|
|
|
|
|
|
|
|
return htBottomRight
|
|
|
|
|
|
|
|
case onLeft:
|
|
|
|
|
|
|
|
return htLeft
|
|
|
|
|
|
|
|
case onRight:
|
|
|
|
|
|
|
|
return htRight
|
|
|
|
|
|
|
|
case onTop:
|
|
|
|
|
|
|
|
return htTop
|
|
|
|
|
|
|
|
case onBottom:
|
|
|
|
|
|
|
|
return htBottom
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func layoutMainWindow(app *guiApp) {
|
|
|
|
|
|
|
|
if app == nil || app.hwnd == 0 || setWindowPosProc == nil {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
clientW, clientH, ok := clientSize(app.hwnd)
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
contentH := clientH - contentTop - bottomBarHeight
|
|
|
|
|
|
|
|
if contentH < 1 {
|
|
|
|
|
|
|
|
contentH = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
leftW := leftPaneWidth
|
|
|
|
|
|
|
|
if clientW < leftW+160 {
|
|
|
|
|
|
|
|
leftW = clientW / 2
|
|
|
|
|
|
|
|
if leftW < 240 {
|
|
|
|
|
|
|
|
leftW = 240
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rightW := clientW - leftW
|
|
|
|
|
|
|
|
if rightW < 1 {
|
|
|
|
|
|
|
|
rightW = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resizeFlags := hwndNoZOrder | hwndNoActivate
|
|
|
|
|
|
|
|
if app.navBarHwnd != 0 {
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.navBarHwnd, 0, 0, uintptr(headerHeight), uintptr(clientW), uintptr(navBarHeight), resizeFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if app.leftHwnd != 0 {
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.leftHwnd, 0, 0, uintptr(contentTop), uintptr(leftW), uintptr(contentH), resizeFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if app.rightHwnd != 0 {
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.rightHwnd, 0, uintptr(leftW), uintptr(contentTop), uintptr(rightW), uintptr(contentH), resizeFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if app.settingsPaneHwnd != 0 {
|
|
|
|
|
|
|
|
setWindowPosProc.Call(app.settingsPaneHwnd, 0, 0, uintptr(contentTop), uintptr(clientW), uintptr(contentH), resizeFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type paintStruct struct {
|
|
|
|
type paintStruct struct {
|
|
|
|
Hdc uintptr
|
|
|
|
Hdc uintptr
|
|
|
|
FErase int32
|
|
|
|
FErase int32
|
|
|
|
@@ -1724,6 +1905,10 @@ func paintMainWindow(hwnd uintptr, app *guiApp) uintptr {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func pointInHeaderDot(x, y, cx, cy int32) bool {
|
|
|
|
|
|
|
|
return x >= cx-11 && x <= cx+11 && y >= cy-11 && y <= cy+11
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func paintFooter(hdc uintptr, rc winRect, app *guiApp) {
|
|
|
|
func paintFooter(hdc uintptr, rc winRect, app *guiApp) {
|
|
|
|
if app == nil {
|
|
|
|
if app == nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
@@ -1826,22 +2011,17 @@ func paintSettingsPane(hwnd uintptr, app *guiApp) uintptr {
|
|
|
|
drawPaneText(hdc, 24, 68, "表示", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 68, "表示", app.hFont, clrMutedText)
|
|
|
|
drawSettingsWideButton(hdc, settingsTopMostRect(), "Top most", onOffBool(app.topMost), app.hFont, app.topMost)
|
|
|
|
drawSettingsWideButton(hdc, settingsTopMostRect(), "Top most", onOffBool(app.topMost), app.hFont, app.topMost)
|
|
|
|
drawSettingsWideButton(hdc, settingsAutoUnmuteRect(), "Leave unmute", onOffBool(app.autoUnmuteOnLeave), app.hFont, app.autoUnmuteOnLeave)
|
|
|
|
drawSettingsWideButton(hdc, settingsAutoUnmuteRect(), "Leave unmute", onOffBool(app.autoUnmuteOnLeave), app.hFont, app.autoUnmuteOnLeave)
|
|
|
|
drawPaneText(hdc, 24, 190, "文字サイズ", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 190, "更新間隔", app.hFont, clrMutedText)
|
|
|
|
drawSettingsRefreshControl(hdc, app)
|
|
|
|
drawSettingsRefreshControl(hdc, app)
|
|
|
|
|
|
|
|
drawPaneText(hdc, 24, 314, "文字サイズ", app.hFont, clrMutedText)
|
|
|
|
drawSettingsFontControl(hdc, app)
|
|
|
|
drawSettingsFontControl(hdc, app)
|
|
|
|
drawPaneText(hdc, 24, 390, "履歴 Export", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 400, "履歴 Export", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 414, "出力先フォルダ", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 430, "出力先フォルダ", app.hFont, clrMutedText)
|
|
|
|
drawSettingsBox(hdc, settingsHistoryExportDirRect(), 0x0038281a, clrPaneBorder)
|
|
|
|
|
|
|
|
drawPaneText(hdc, 120, 414, exportDirDisplayText(app.historyExportDir), app.hFont, clrText)
|
|
|
|
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportBrowseRect(), "参照", "", app.hFont, true)
|
|
|
|
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportTimeRect(), "Time", onOffBool(app.historyExportIncludeTime), app.hFont, app.historyExportIncludeTime)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportTimeRect(), "Time", onOffBool(app.historyExportIncludeTime), app.hFont, app.historyExportIncludeTime)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportWorldRect(), "World", onOffBool(app.historyExportIncludeWorld), app.hFont, app.historyExportIncludeWorld)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportWorldRect(), "World", onOffBool(app.historyExportIncludeWorld), app.hFont, app.historyExportIncludeWorld)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportJoinLeaveRect(), "Join/Leave", onOffBool(app.historyExportIncludeJoinLeave), app.hFont, app.historyExportIncludeJoinLeave)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportJoinLeaveRect(), "Join/Leave", onOffBool(app.historyExportIncludeJoinLeave), app.hFont, app.historyExportIncludeJoinLeave)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportCustomToggleRect(), "Custom", onOffBool(app.historyExportCustomEnabled), app.hFont, app.historyExportCustomEnabled)
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportCustomToggleRect(), "Custom", onOffBool(app.historyExportCustomEnabled), app.hFont, app.historyExportCustomEnabled)
|
|
|
|
drawPaneText(hdc, 24, 522, "Custom 条件", app.hFont, clrMutedText)
|
|
|
|
drawPaneText(hdc, 24, 618, "Custom 条件", app.hFont, clrMutedText)
|
|
|
|
drawSettingsBox(hdc, settingsHistoryExportCustomRect(), 0x0038281a, clrPaneBorder)
|
|
|
|
|
|
|
|
drawPaneText(hdc, 120, 522, previewLine(app.historyExportCustom, 60), app.hFont, clrText)
|
|
|
|
|
|
|
|
drawSettingsWideButton(hdc, settingsHistoryExportCustomSaveRect(), "保存", "", app.hFont, true)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1882,35 +2062,35 @@ func settingsFontUpRect() winRect {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportDirRect() winRect {
|
|
|
|
func settingsHistoryExportDirRect() winRect {
|
|
|
|
return winRect{Left: 116, Top: 410, Right: 636, Bottom: 434}
|
|
|
|
return winRect{Left: 24, Top: 458, Right: 636, Bottom: 490}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportBrowseRect() winRect {
|
|
|
|
func settingsHistoryExportBrowseRect() winRect {
|
|
|
|
return winRect{Left: 644, Top: 410, Right: 736, Bottom: 434}
|
|
|
|
return winRect{Left: 644, Top: 458, Right: 736, Bottom: 490}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportTimeRect() winRect {
|
|
|
|
func settingsHistoryExportTimeRect() winRect {
|
|
|
|
return winRect{Left: 24, Top: 442, Right: 360, Bottom: 476}
|
|
|
|
return winRect{Left: 24, Top: 510, Right: 360, Bottom: 546}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportWorldRect() winRect {
|
|
|
|
func settingsHistoryExportWorldRect() winRect {
|
|
|
|
return winRect{Left: 376, Top: 442, Right: 736, Bottom: 476}
|
|
|
|
return winRect{Left: 376, Top: 510, Right: 736, Bottom: 546}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportJoinLeaveRect() winRect {
|
|
|
|
func settingsHistoryExportJoinLeaveRect() winRect {
|
|
|
|
return winRect{Left: 24, Top: 480, Right: 360, Bottom: 514}
|
|
|
|
return winRect{Left: 24, Top: 558, Right: 360, Bottom: 594}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportCustomToggleRect() winRect {
|
|
|
|
func settingsHistoryExportCustomToggleRect() winRect {
|
|
|
|
return winRect{Left: 376, Top: 480, Right: 736, Bottom: 514}
|
|
|
|
return winRect{Left: 376, Top: 558, Right: 736, Bottom: 594}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportCustomRect() winRect {
|
|
|
|
func settingsHistoryExportCustomRect() winRect {
|
|
|
|
return winRect{Left: 116, Top: 520, Right: 636, Bottom: 544}
|
|
|
|
return winRect{Left: 24, Top: 646, Right: 636, Bottom: 678}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func settingsHistoryExportCustomSaveRect() winRect {
|
|
|
|
func settingsHistoryExportCustomSaveRect() winRect {
|
|
|
|
return winRect{Left: 644, Top: 520, Right: 736, Bottom: 544}
|
|
|
|
return winRect{Left: 644, Top: 646, Right: 736, Bottom: 678}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func handleSettingsPaneClick(app *guiApp, x, y int32, getWindowText, setWindowText *syscall.LazyProc) bool {
|
|
|
|
func handleSettingsPaneClick(app *guiApp, x, y int32, getWindowText, setWindowText *syscall.LazyProc) bool {
|
|
|
|
@@ -1941,15 +2121,21 @@ func handleSettingsPaneClick(app *guiApp, x, y int32, getWindowText, setWindowTe
|
|
|
|
applyRefreshTimer(app.hwnd, app)
|
|
|
|
applyRefreshTimer(app.hwnd, app)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case pointInRect(x, y, settingsFontDownRect()):
|
|
|
|
case pointInRect(x, y, settingsFontDownRect()):
|
|
|
|
if app.fontSize > 10 {
|
|
|
|
if app.fontSize > minGUIFontSize {
|
|
|
|
app.fontSize -= 2
|
|
|
|
app.fontSize -= 2
|
|
|
|
|
|
|
|
if app.fontSize < minGUIFontSize {
|
|
|
|
|
|
|
|
app.fontSize = minGUIFontSize
|
|
|
|
|
|
|
|
}
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
applyFont(app)
|
|
|
|
applyFont(app)
|
|
|
|
saveGUISettings(app)
|
|
|
|
saveGUISettings(app)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case pointInRect(x, y, settingsFontUpRect()):
|
|
|
|
case pointInRect(x, y, settingsFontUpRect()):
|
|
|
|
if app.fontSize < 30 {
|
|
|
|
if app.fontSize < maxGUIFontSize {
|
|
|
|
app.fontSize += 2
|
|
|
|
app.fontSize += 2
|
|
|
|
|
|
|
|
if app.fontSize > maxGUIFontSize {
|
|
|
|
|
|
|
|
app.fontSize = maxGUIFontSize
|
|
|
|
|
|
|
|
}
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
app.hFont = createAppFont(app.fontSize)
|
|
|
|
applyFont(app)
|
|
|
|
applyFont(app)
|
|
|
|
saveGUISettings(app)
|
|
|
|
saveGUISettings(app)
|
|
|
|
@@ -1994,9 +2180,9 @@ func drawSettingsRefreshControl(hdc uintptr, app *guiApp) {
|
|
|
|
drawSettingsBox(hdc, settingsRefreshValueRect(), uint32(0x0038281a), border)
|
|
|
|
drawSettingsBox(hdc, settingsRefreshValueRect(), uint32(0x0038281a), border)
|
|
|
|
drawSettingsBox(hdc, settingsRefreshUpRect(), fill, border)
|
|
|
|
drawSettingsBox(hdc, settingsRefreshUpRect(), fill, border)
|
|
|
|
drawSettingsWideButton(hdc, settingsRefreshUnitRect(), "\u5358\u4f4d", refreshIntervalUnitLabel(app.refreshIntervalUnit), font, true)
|
|
|
|
drawSettingsWideButton(hdc, settingsRefreshUnitRect(), "\u5358\u4f4d", refreshIntervalUnitLabel(app.refreshIntervalUnit), font, true)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshDownRect(), "A-", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshDownRect(), "-", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshValueRect(), refreshIntervalValueLabel(app.refreshIntervalValue, app.refreshIntervalUnit), font, clrMutedText)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshValueRect(), refreshIntervalValueLabel(app.refreshIntervalValue, app.refreshIntervalUnit), font, clrMutedText)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshUpRect(), "A+", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsRefreshUpRect(), "+", font, clrText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func refreshIntervalValueLabel(value int, unit string) string {
|
|
|
|
func refreshIntervalValueLabel(value int, unit string) string {
|
|
|
|
@@ -2621,7 +2807,7 @@ func drawSettingsFontControl(hdc uintptr, app *guiApp) {
|
|
|
|
drawSettingsBox(hdc, settingsFontValueRect(), uint32(0x0038281a), border)
|
|
|
|
drawSettingsBox(hdc, settingsFontValueRect(), uint32(0x0038281a), border)
|
|
|
|
drawSettingsBox(hdc, settingsFontUpRect(), fill, border)
|
|
|
|
drawSettingsBox(hdc, settingsFontUpRect(), fill, border)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontDownRect(), "A-", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontDownRect(), "A-", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontValueRect(), strconv.Itoa(app.fontSize), font, clrMutedText)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontValueRect(), strconv.Itoa(app.fontSize)+" pt", font, clrMutedText)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontUpRect(), "A+", font, clrText)
|
|
|
|
drawCenteredPaneText(hdc, settingsFontUpRect(), "A+", font, clrText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2904,7 +3090,7 @@ func eventRows(users []userState) []guiEventRow {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func joinLeaveRowsForCurrentWorld(app *guiApp) []guiEventRow {
|
|
|
|
func joinLeaveRowsForCurrentWorld(app *guiApp) []guiEventRow {
|
|
|
|
events := historyEventsFromSnapshot()
|
|
|
|
events := historyEventsWithFallback()
|
|
|
|
if len(events) == 0 {
|
|
|
|
if len(events) == 0 {
|
|
|
|
users, _ := currentUsersFromJoinLeave()
|
|
|
|
users, _ := currentUsersFromJoinLeave()
|
|
|
|
return eventRows(users)
|
|
|
|
return eventRows(users)
|
|
|
|
@@ -3279,7 +3465,7 @@ func formatDurationShort(d time.Duration) string {
|
|
|
|
func joinLogFontSize(baseSize, presentCount int) int {
|
|
|
|
func joinLogFontSize(baseSize, presentCount int) int {
|
|
|
|
size := baseSize
|
|
|
|
size := baseSize
|
|
|
|
if size <= 0 {
|
|
|
|
if size <= 0 {
|
|
|
|
size = 18
|
|
|
|
size = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if presentCount <= 32 {
|
|
|
|
if presentCount <= 32 {
|
|
|
|
return size
|
|
|
|
return size
|
|
|
|
@@ -3292,8 +3478,8 @@ func joinLogFontSize(baseSize, presentCount int) int {
|
|
|
|
case presentCount >= 33:
|
|
|
|
case presentCount >= 33:
|
|
|
|
size -= 2
|
|
|
|
size -= 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if size < 8 {
|
|
|
|
if size < minGUIFontSize {
|
|
|
|
size = 8
|
|
|
|
size = minGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return size
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -3748,7 +3934,7 @@ func loadGUISettings() config.GUIConfig {
|
|
|
|
if err != nil || cfg == nil {
|
|
|
|
if err != nil || cfg == nil {
|
|
|
|
return config.GUIConfig{
|
|
|
|
return config.GUIConfig{
|
|
|
|
TopMost: false,
|
|
|
|
TopMost: false,
|
|
|
|
FontSize: 18,
|
|
|
|
FontSize: defaultGUIFontSize,
|
|
|
|
RefreshIntervalValue: 2,
|
|
|
|
RefreshIntervalValue: 2,
|
|
|
|
RefreshIntervalUnit: "sec",
|
|
|
|
RefreshIntervalUnit: "sec",
|
|
|
|
HistoryExportIncludeTime: true,
|
|
|
|
HistoryExportIncludeTime: true,
|
|
|
|
@@ -3757,7 +3943,7 @@ func loadGUISettings() config.GUIConfig {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if cfg.GUI.FontSize <= 0 {
|
|
|
|
if cfg.GUI.FontSize <= 0 {
|
|
|
|
cfg.GUI.FontSize = 18
|
|
|
|
cfg.GUI.FontSize = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cfg.GUI.RefreshIntervalValue, cfg.GUI.RefreshIntervalUnit = normalizeRefreshIntervalSettings(cfg.GUI.RefreshIntervalValue, cfg.GUI.RefreshIntervalUnit)
|
|
|
|
cfg.GUI.RefreshIntervalValue, cfg.GUI.RefreshIntervalUnit = normalizeRefreshIntervalSettings(cfg.GUI.RefreshIntervalValue, cfg.GUI.RefreshIntervalUnit)
|
|
|
|
cfg.GUI.HistoryRegex = strings.TrimSpace(cfg.GUI.HistoryRegex)
|
|
|
|
cfg.GUI.HistoryRegex = strings.TrimSpace(cfg.GUI.HistoryRegex)
|
|
|
|
@@ -4108,7 +4294,7 @@ func formatRightPane(tab string, state map[string]any, worldLabel string, curren
|
|
|
|
b.WriteString("\r\nFont size: ")
|
|
|
|
b.WriteString("\r\nFont size: ")
|
|
|
|
fontSize, _ := state["font_size"].(int)
|
|
|
|
fontSize, _ := state["font_size"].(int)
|
|
|
|
if fontSize == 0 {
|
|
|
|
if fontSize == 0 {
|
|
|
|
fontSize = 18
|
|
|
|
fontSize = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b.WriteString(strconv.Itoa(fontSize))
|
|
|
|
b.WriteString(strconv.Itoa(fontSize))
|
|
|
|
b.WriteString("\r\nLeave unmute: ")
|
|
|
|
b.WriteString("\r\nLeave unmute: ")
|
|
|
|
@@ -4146,7 +4332,7 @@ func formatSettingsPane(state map[string]any) string {
|
|
|
|
b.WriteString("\r\nFont size: ")
|
|
|
|
b.WriteString("\r\nFont size: ")
|
|
|
|
fontSize, _ := state["font_size"].(int)
|
|
|
|
fontSize, _ := state["font_size"].(int)
|
|
|
|
if fontSize == 0 {
|
|
|
|
if fontSize == 0 {
|
|
|
|
fontSize = 18
|
|
|
|
fontSize = defaultGUIFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b.WriteString(strconv.Itoa(fontSize))
|
|
|
|
b.WriteString(strconv.Itoa(fontSize))
|
|
|
|
b.WriteString("\r\nLeave unmute: ")
|
|
|
|
b.WriteString("\r\nLeave unmute: ")
|
|
|
|
|