Compare commits
3 Commits
v0.1.3-tes
...
v0.1.3-tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01d5799914 | ||
|
|
f9968895ac | ||
|
|
452c7c59b6 |
@@ -591,9 +591,11 @@ func exportHistoryDay(app *guiApp, day time.Time, selected map[string]bool) (str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func exportHistoryDayFromRequest(req historyExportRequest) (string, error) {
|
func exportHistoryDayFromRequest(req historyExportRequest) (string, error) {
|
||||||
|
events := historyEventsFromSnapshot()
|
||||||
|
visits := historyVisitSource()
|
||||||
rows := append([]historyDetailRow(nil), req.Rows...)
|
rows := append([]historyDetailRow(nil), req.Rows...)
|
||||||
if len(rows) == 0 {
|
if len(rows) == 0 {
|
||||||
rows = historyVisitsForDayFromData(nil, req.Day, historyVisitSource(), historyEventsFromSnapshot(), req.Query)
|
rows = historyVisitsForDayFromData(nil, req.Day, visits, events, req.Query)
|
||||||
}
|
}
|
||||||
if len(req.Selected) > 0 {
|
if len(req.Selected) > 0 {
|
||||||
filtered := rows[:0]
|
filtered := rows[:0]
|
||||||
@@ -679,6 +681,9 @@ func exportHistoryDayFromRequest(req historyExportRequest) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
appendExportDayVisits(&b, req.Day, visits, req.Query)
|
||||||
|
appendExportDayEvents(&b, req.Day, events, req.Query)
|
||||||
|
appendExportGuestSnapshot(&b, req.Day, req.Query)
|
||||||
exportDir := runtimeDir()
|
exportDir := runtimeDir()
|
||||||
if strings.TrimSpace(req.ExportDir) != "" {
|
if strings.TrimSpace(req.ExportDir) != "" {
|
||||||
exportDir = normalizeHistoryExportDir(req.ExportDir)
|
exportDir = normalizeHistoryExportDir(req.ExportDir)
|
||||||
@@ -696,6 +701,153 @@ func exportHistoryDayFromRequest(req historyExportRequest) (string, error) {
|
|||||||
return path, nil
|
return path, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendExportDayVisits(b *strings.Builder, day time.Time, visits []historyVisitRecord, q historyQuery) {
|
||||||
|
if b == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dayStart, dayEnd := historyDayBounds(day)
|
||||||
|
matched := make([]historyVisitRecord, 0, len(visits))
|
||||||
|
for _, visit := range visits {
|
||||||
|
start := visit.Start
|
||||||
|
if start.IsZero() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
end := visit.End
|
||||||
|
if end.IsZero() {
|
||||||
|
end = time.Now()
|
||||||
|
}
|
||||||
|
if !start.Before(dayEnd) || !end.After(dayStart) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if q.Pattern != nil && !q.Pattern.MatchString(visit.WorldLabel) && !q.Pattern.MatchString(visit.WorldID) && !q.Pattern.MatchString(visit.InstanceID) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
matched = append(matched, visit)
|
||||||
|
}
|
||||||
|
sort.SliceStable(matched, func(i, j int) bool {
|
||||||
|
return matched[i].Start.Before(matched[j].Start)
|
||||||
|
})
|
||||||
|
b.WriteString("\nAll visits:\n")
|
||||||
|
if len(matched) == 0 {
|
||||||
|
b.WriteString("(no visits)\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, visit := range matched {
|
||||||
|
b.WriteString("- ")
|
||||||
|
b.WriteString(historyTimeRangeLabel(visit.Start, visit.End, visit.Current))
|
||||||
|
b.WriteString(" ")
|
||||||
|
b.WriteString(strings.TrimSpace(visit.WorldLabel))
|
||||||
|
if strings.TrimSpace(visit.WorldID) != "" {
|
||||||
|
b.WriteString(" world_id=")
|
||||||
|
b.WriteString(strings.TrimSpace(visit.WorldID))
|
||||||
|
}
|
||||||
|
if strings.TrimSpace(visit.InstanceID) != "" {
|
||||||
|
b.WriteString(" instance_id=")
|
||||||
|
b.WriteString(strings.TrimSpace(visit.InstanceID))
|
||||||
|
}
|
||||||
|
b.WriteString("\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func appendExportDayEvents(b *strings.Builder, day time.Time, events []historyEventRecord, q historyQuery) {
|
||||||
|
if b == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dayStart, dayEnd := historyDayBounds(day)
|
||||||
|
matched := make([]historyEventRecord, 0, len(events))
|
||||||
|
for _, ev := range events {
|
||||||
|
if ev.At.IsZero() || ev.At.Before(dayStart) || !ev.At.Before(dayEnd) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
raw := fmt.Sprintf("[%s] %s %s", ev.At.Format("15:04"), ev.Kind, ev.Name)
|
||||||
|
if q.Pattern != nil && !q.Pattern.MatchString(ev.Name) && !q.Pattern.MatchString(raw) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
matched = append(matched, ev)
|
||||||
|
}
|
||||||
|
sort.SliceStable(matched, func(i, j int) bool {
|
||||||
|
if matched[i].At.Equal(matched[j].At) {
|
||||||
|
return strings.ToLower(matched[i].Name) < strings.ToLower(matched[j].Name)
|
||||||
|
}
|
||||||
|
return matched[i].At.Before(matched[j].At)
|
||||||
|
})
|
||||||
|
b.WriteString("\nAll join/leave events:\n")
|
||||||
|
if len(matched) == 0 {
|
||||||
|
b.WriteString("(no events)\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, ev := range matched {
|
||||||
|
b.WriteString("- ")
|
||||||
|
b.WriteString(ev.At.Format("15:04"))
|
||||||
|
b.WriteString(" ")
|
||||||
|
b.WriteString(ev.Kind)
|
||||||
|
b.WriteString(" ")
|
||||||
|
b.WriteString(strings.TrimSpace(ev.Name))
|
||||||
|
if ev.Raw != "" {
|
||||||
|
b.WriteString(" | ")
|
||||||
|
b.WriteString(strings.TrimSpace(ev.Raw))
|
||||||
|
}
|
||||||
|
b.WriteString("\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func appendExportGuestSnapshot(b *strings.Builder, day time.Time, q historyQuery) {
|
||||||
|
if b == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guests := readGuestSnapshot()
|
||||||
|
dayStart, dayEnd := historyDayBounds(day)
|
||||||
|
type guestLine struct {
|
||||||
|
name string
|
||||||
|
present bool
|
||||||
|
join time.Time
|
||||||
|
leave time.Time
|
||||||
|
}
|
||||||
|
lines := make([]guestLine, 0, len(guests))
|
||||||
|
for _, guest := range guests {
|
||||||
|
name := strings.TrimSpace(guest.Name)
|
||||||
|
if name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
inDay := guest.Present ||
|
||||||
|
(!guest.LastJoin.IsZero() && !guest.LastJoin.Before(dayStart) && guest.LastJoin.Before(dayEnd)) ||
|
||||||
|
(!guest.LastLeave.IsZero() && !guest.LastLeave.Before(dayStart) && guest.LastLeave.Before(dayEnd))
|
||||||
|
if !inDay {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if q.Pattern != nil && !q.Pattern.MatchString(name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
lines = append(lines, guestLine{name: name, present: guest.Present, join: guest.LastJoin, leave: guest.LastLeave})
|
||||||
|
}
|
||||||
|
sort.SliceStable(lines, func(i, j int) bool {
|
||||||
|
return strings.ToLower(lines[i].name) < strings.ToLower(lines[j].name)
|
||||||
|
})
|
||||||
|
b.WriteString("\nGuest snapshot:\n")
|
||||||
|
if len(lines) == 0 {
|
||||||
|
b.WriteString("(no guests)\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, line := range lines {
|
||||||
|
b.WriteString("- ")
|
||||||
|
if line.present {
|
||||||
|
b.WriteString("present ")
|
||||||
|
} else {
|
||||||
|
b.WriteString("left ")
|
||||||
|
}
|
||||||
|
b.WriteString(line.name)
|
||||||
|
if !line.join.IsZero() {
|
||||||
|
b.WriteString(" join=")
|
||||||
|
b.WriteString(line.join.Format("15:04"))
|
||||||
|
}
|
||||||
|
if !line.leave.IsZero() {
|
||||||
|
b.WriteString(" leave=")
|
||||||
|
b.WriteString(line.leave.Format("15:04"))
|
||||||
|
}
|
||||||
|
b.WriteString("\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func cloneHistorySelection(selected map[string]bool) map[string]bool {
|
func cloneHistorySelection(selected map[string]bool) map[string]bool {
|
||||||
if len(selected) == 0 {
|
if len(selected) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -121,6 +121,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-]+)`)
|
||||||
@@ -450,7 +456,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 {
|
||||||
@@ -632,38 +638,42 @@ func runNativeGUI(initialTab string) error {
|
|||||||
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.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)
|
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)
|
||||||
@@ -749,8 +759,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)
|
||||||
@@ -764,8 +777,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)
|
||||||
@@ -1433,7 +1449,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 {
|
||||||
@@ -1508,7 +1524,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
|
||||||
@@ -1538,7 +1554,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
|
||||||
@@ -1546,14 +1562,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
|
||||||
}
|
}
|
||||||
@@ -1860,19 +1876,13 @@ func paintSettingsPane(hwnd uintptr, app *guiApp) uintptr {
|
|||||||
drawPaneText(hdc, 24, 190, "文字サイズ", app.hFont, clrMutedText)
|
drawPaneText(hdc, 24, 190, "文字サイズ", app.hFont, clrMutedText)
|
||||||
drawSettingsRefreshControl(hdc, app)
|
drawSettingsRefreshControl(hdc, app)
|
||||||
drawSettingsFontControl(hdc, app)
|
drawSettingsFontControl(hdc, app)
|
||||||
drawPaneText(hdc, 24, 390, "履歴 Export", app.hFont, clrMutedText)
|
drawPaneText(hdc, 24, 374, "履歴 Export", app.hFont, clrMutedText)
|
||||||
drawPaneText(hdc, 24, 414, "出力先フォルダ", app.hFont, clrMutedText)
|
drawPaneText(hdc, 24, 396, "出力先フォルダ", 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, 516, "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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1913,35 +1923,35 @@ func settingsFontUpRect() winRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportDirRect() winRect {
|
func settingsHistoryExportDirRect() winRect {
|
||||||
return winRect{Left: 116, Top: 410, Right: 636, Bottom: 434}
|
return winRect{Left: 116, Top: 420, Right: 636, Bottom: 444}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportBrowseRect() winRect {
|
func settingsHistoryExportBrowseRect() winRect {
|
||||||
return winRect{Left: 644, Top: 410, Right: 736, Bottom: 434}
|
return winRect{Left: 644, Top: 420, Right: 736, Bottom: 444}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportTimeRect() winRect {
|
func settingsHistoryExportTimeRect() winRect {
|
||||||
return winRect{Left: 24, Top: 442, Right: 360, Bottom: 476}
|
return winRect{Left: 24, Top: 452, Right: 360, Bottom: 482}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportWorldRect() winRect {
|
func settingsHistoryExportWorldRect() winRect {
|
||||||
return winRect{Left: 376, Top: 442, Right: 736, Bottom: 476}
|
return winRect{Left: 376, Top: 452, Right: 736, Bottom: 482}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportJoinLeaveRect() winRect {
|
func settingsHistoryExportJoinLeaveRect() winRect {
|
||||||
return winRect{Left: 24, Top: 480, Right: 360, Bottom: 514}
|
return winRect{Left: 24, Top: 488, Right: 360, Bottom: 518}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportCustomToggleRect() winRect {
|
func settingsHistoryExportCustomToggleRect() winRect {
|
||||||
return winRect{Left: 376, Top: 480, Right: 736, Bottom: 514}
|
return winRect{Left: 376, Top: 488, Right: 736, Bottom: 518}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportCustomRect() winRect {
|
func settingsHistoryExportCustomRect() winRect {
|
||||||
return winRect{Left: 116, Top: 520, Right: 636, Bottom: 544}
|
return winRect{Left: 116, Top: 536, Right: 636, Bottom: 558}
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsHistoryExportCustomSaveRect() winRect {
|
func settingsHistoryExportCustomSaveRect() winRect {
|
||||||
return winRect{Left: 644, Top: 520, Right: 736, Bottom: 544}
|
return winRect{Left: 644, Top: 536, Right: 736, Bottom: 558}
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSettingsPaneClick(app *guiApp, x, y int32, getWindowText, setWindowText *syscall.LazyProc) bool {
|
func handleSettingsPaneClick(app *guiApp, x, y int32, getWindowText, setWindowText *syscall.LazyProc) bool {
|
||||||
@@ -1972,15 +1982,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)
|
||||||
@@ -3310,7 +3326,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
|
||||||
@@ -3323,8 +3339,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
|
||||||
}
|
}
|
||||||
@@ -3779,7 +3795,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,
|
||||||
@@ -3788,7 +3804,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)
|
||||||
@@ -4139,7 +4155,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: ")
|
||||||
@@ -4177,7 +4193,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: ")
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func Load(path string) (*Config, error) {
|
|||||||
cfg := &Config{
|
cfg := &Config{
|
||||||
OSC: OSCConfig{Host: "127.0.0.1", Port: 9001},
|
OSC: OSCConfig{Host: "127.0.0.1", Port: 9001},
|
||||||
GUI: GUIConfig{
|
GUI: GUIConfig{
|
||||||
FontSize: 18,
|
FontSize: 14,
|
||||||
RefreshIntervalValue: 2,
|
RefreshIntervalValue: 2,
|
||||||
RefreshIntervalUnit: "sec",
|
RefreshIntervalUnit: "sec",
|
||||||
HistoryExportIncludeTime: true,
|
HistoryExportIncludeTime: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user