From 3a357233b7c57b4e3c4d6fb73039d15f43448f4f Mon Sep 17 00:00:00 2001 From: ANSI TV Admin Date: Wed, 11 Nov 2026 17:09:16 -0800 Subject: [PATCH 24/24] Program Settings: Invert Wheel In Menus, and List Click (select-then-open or open at once) Invert Mouse Wheel now reverses the wheel the BBS is sent, and the new "Invert Wheel In Menus" (InvertWheelInMenus, default No) reverses SyncTERM's own lists, menus and scrollback too -- both Yes is stock's single setting. "List Click" (ListClickOpens, default "Select, then open"): one click selects a list entry and a second click or a double-click opens it; "Open at once" is stock's one click opens, the dialer's focusing click included. --- src/syncterm/menu_settings.c | 6 +++++- src/syncterm/scripts/auto/menu/main_menu.wren | 10 +++++++--- src/syncterm/scripts/menu_settings_ui.wren | 12 +++++++++++- src/syncterm/scripts/syncterm_menu.wren | 4 ++++ src/syncterm/scripts/ui_list.wren | 8 +++++++- src/syncterm/syncterm.c | 9 ++++++--- src/syncterm/syncterm.h | 2 ++ src/syncterm/term.c | 9 +++++---- src/syncterm/wren_bind_menu_settings.c | 4 ++++ 9 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/syncterm/menu_settings.c b/src/syncterm/menu_settings.c index 740163a0..73ee8064 100644 --- a/src/syncterm/menu_settings.c +++ b/src/syncterm/menu_settings.c @@ -110,6 +110,10 @@ set_ini_values(str_list_t *ini, const struct syncterm_settings *set) iniSetInteger(ini, "SyncTERM", "ExclusiveMouseBorderDOSColour", set->exclusive_border_colour, &ini_style); iniRemoveKey(ini, "SyncTERM", "ExclusiveMouseBorderColour"); /* test3 key */ + iniSetBool(ini, "SyncTERM", "InvertWheelInMenus", set->invert_wheel_menus, + &ini_style); + iniSetBool(ini, "SyncTERM", "ListClickOpens", set->list_click_opens, + &ini_style); iniSetBool(ini, "SyncTERM", "InvertMouseWheel", set->invert_wheel, &ini_style); iniSetString(ini, "SyncTERM", "KeyDerivationIterations", @@ -157,7 +161,7 @@ apply_settings(const struct syncterm_settings *set) settings.webgets = webgets; resolve_list_path(&settings); xpbeep_sound_devices_enabled = settings.audio_output_modes; - ciolib_swap_mouse_butt45 = false; /* applied to host reports in term.c */ + ciolib_swap_mouse_butt45 = settings.invert_wheel_menus; /* the menus' wheel; term.c sets the BBS's */ apply_exclusive_border(); if (settings.blocky) cio_api.options |= CONIO_OPT_BLOCKY_SCALING; diff --git a/src/syncterm/scripts/auto/menu/main_menu.wren b/src/syncterm/scripts/auto/menu/main_menu.wren index 11c5a57a..8ba7d68a 100644 --- a/src/syncterm/scripts/auto/menu/main_menu.wren +++ b/src/syncterm/scripts/auto/menu/main_menu.wren @@ -243,9 +243,12 @@ class MainList is ListView { var activate = _onFocus.call() if (!active && activate != true) { // The click that focuses this pane also picks the row under the - // pointer -- it only selects; a second click opens it. - var idx = scrollTop + (event.startY - bounds.y) - if (idx >= 0 && idx < count) selected = idx + // pointer -- it only selects; a second click opens it. (List + // Click "Open at once": the focusing click only focuses, stock.) + if (!ListView.clickOpens) { + var idx = scrollTop + (event.startY - bounds.y) + if (idx >= 0 && idx < count) selected = idx + } return true } } @@ -304,6 +307,7 @@ class MainMenuEventApp is App { class MainMenuApp { construct new(current, connected) { + ListView.clickOpens = Menu.settings.listClickOpens _app = MainMenuEventApp.new(Fn.new { _consoleIndicator.refresh() }) _connected = connected _current = current diff --git a/src/syncterm/scripts/menu_settings_ui.wren b/src/syncterm/scripts/menu_settings_ui.wren index 05091a3f..04490045 100644 --- a/src/syncterm/scripts/menu_settings_ui.wren +++ b/src/syncterm/scripts/menu_settings_ui.wren @@ -6,6 +6,7 @@ import "menu_bbs_editor" for BbsEditor import "menu_theme_editor" for ThemeEditor import "ui_popup" for Alert, Confirm import "ui_help" for Help +import "ui_list" for ListView class SettingsMenu { static directoryPassword { __directoryPassword } @@ -503,7 +504,9 @@ class SettingsMenu { helpItem_("Menu Font", "The typeface used by the dialer and menus; sessions keep theirs") + helpItem_("Scaling", "Cycle the display scaling algorithm") + - helpItem_("Invert Mouse Wheel", "Reverse the wheel as sent to the BBS; menus and lists are not affected") + + helpItem_("Invert Mouse Wheel", "Reverse the wheel as sent to the BBS") + + helpItem_("Invert Wheel In Menus", "Reverse the wheel in SyncTERM's own lists, menus and scrollback too") + + helpItem_("List Click", "Select, then open: one click selects, a second click or a double-click opens. Open at once: one click opens (stock)") + helpItem_("GPU Accelerated", "Use SDL/OpenGL; Pointy runs its edge-aware scaler on the GPU. Restart when enabling") + helpItem_("Mouse Motion Past Edges", @@ -754,6 +757,8 @@ class SettingsMenu { rows.add([13, settingsLine_("TERM For Shell", s.shellTerm)]) rows.add([14, settingsLine_("Scaling", Menu.scalingModes[s.scalingMode])]) rows.add([15, settingsLine_("Invert Mouse Wheel", yesNo_(s.invertWheel))]) + rows.add([27, settingsLine_("Invert Wheel In Menus", yesNo_(s.invertWheelMenus))]) + rows.add([28, settingsLine_("List Click", s.listClickOpens ? "Open at once" : "Select, then open")]) rows.add([16, settingsLine_("GPU Accelerated", yesNo_(s.gpuAccelerated))]) rows.add([23, settingsLine_("Exclusive Mouse Mode", yesNo_(s.exclusiveMouse))]) rows.add([24, settingsLine_("Mouse Motion Past Edges", yesNo_(s.mouseEdgeMotion))]) @@ -832,6 +837,11 @@ class SettingsMenu { s.scalingMode = (s.scalingMode + 1) % Menu.scalingModes.count } else if (value == 15) { s.invertWheel = !s.invertWheel + } else if (value == 27) { + s.invertWheelMenus = !s.invertWheelMenus + } else if (value == 28) { + s.listClickOpens = !s.listClickOpens + ListView.clickOpens = s.listClickOpens } else if (value == 16) { s.gpuAccelerated = !s.gpuAccelerated } else if (value == 23) { diff --git a/src/syncterm/scripts/syncterm_menu.wren b/src/syncterm/scripts/syncterm_menu.wren index 8c6fd562..22140cd6 100644 --- a/src/syncterm/scripts/syncterm_menu.wren +++ b/src/syncterm/scripts/syncterm_menu.wren @@ -196,6 +196,10 @@ foreign class Settings { foreign promptSave=(value) foreign invertWheel foreign invertWheel=(value) + foreign invertWheelMenus + foreign invertWheelMenus=(value) + foreign listClickOpens + foreign listClickOpens=(value) foreign gpuAccelerated foreign gpuAccelerated=(value) foreign exclusiveMouse diff --git a/src/syncterm/scripts/ui_list.wren b/src/syncterm/scripts/ui_list.wren index 8472ba0e..989b378d 100644 --- a/src/syncterm/scripts/ui_list.wren +++ b/src/syncterm/scripts/ui_list.wren @@ -28,6 +28,11 @@ import "ui_popup" for Find import "syncterm" for KeyEvent, MouseEvent, Key, Mouse class ListView is Widget { + // One click opens an entry (stock UIFC) when true; else a click selects + // and a second click or a double-click opens. Set from the settings. + static clickOpens { __clickOpens == true } + static clickOpens=(v) { __clickOpens = v } + construct new() { super() _items = [] @@ -681,7 +686,8 @@ class ListView is Widget { // doesn't fire onSelect prematurely. var already = idx == _selected selected = idx - if ((already || dbl) && _onSelect != null && selectedItem != null) { + if ((already || dbl || ListView.clickOpens) && _onSelect != null && + selectedItem != null) { _onSelect.call(_selected, selectedItem) } return true diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index 1d770abc..887c77bc 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -1957,6 +1957,8 @@ load_settings(struct syncterm_settings *set) if (set->exclusive_border_colour < 1 || set->exclusive_border_colour > 15) set->exclusive_border_colour = 3; set->invert_wheel = iniReadBool(inifile, "SyncTERM", "InvertMouseWheel", false); + set->invert_wheel_menus = iniReadBool(inifile, "SyncTERM", "InvertWheelInMenus", false); + set->list_click_opens = iniReadBool(inifile, "SyncTERM", "ListClickOpens", false); set->defaultCursor = iniReadEnum(inifile, "SyncTERM", "DefaultCursor", cursor_enum, ST_CT_DEFAULT); // TODO: Add this to the UI somewhere. @@ -2350,9 +2352,10 @@ main(int argc, char **argv) } atexit(syncterm_theme_shutdown); atexit(syncterm_cloud_themes_shutdown); - /* Invert Mouse Wheel reverses what the BBS is sent (term.c), not the - * wheel in SyncTERM's own lists, menus and scrollback. */ - ciolib_swap_mouse_butt45 = false; + /* Invert Mouse Wheel reverses what the BBS is sent (term.c); Invert + * Wheel In Menus reverses SyncTERM's own lists, menus and scrollback + * (ciolib's swap, which term.c then undoes for the BBS's report). */ + ciolib_swap_mouse_butt45 = settings.invert_wheel_menus; cvmode = find_vmode(CIOLIB_MODE_CUSTOM); vparams[cvmode].cols = settings.custom_cols; vparams[cvmode].rows = settings.custom_rows; diff --git a/src/syncterm/syncterm.h b/src/syncterm/syncterm.h index 7670d183..5c33dfad 100644 --- a/src/syncterm/syncterm.h +++ b/src/syncterm/syncterm.h @@ -98,6 +98,8 @@ struct syncterm_settings { int exclusive_border_colour; /* DOS colour 1-15 */ uint audio_output_modes; bool invert_wheel; + bool invert_wheel_menus; /* the wheel in SyncTERM's own lists too */ + bool list_click_opens; /* one click opens a list entry (stock) */ bool webgetUserList; char keyDerivationIterations[32]; /* KDF spec string, e.g. "scrypt-N15" */ enum CursorTypeEnum defaultCursor; diff --git a/src/syncterm/term.c b/src/syncterm/term.c index ef318e9d..8c227b8c 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -4930,10 +4930,11 @@ handle_mouse_event(struct mouse_state *ms) case CIOLIB_BUTTON_3_RELEASE: case CIOLIB_BUTTON_4_PRESS: case CIOLIB_BUTTON_5_PRESS: - /* Invert Mouse Wheel applies here only: the wheel report - * the BBS receives. SyncTERM's own UI (dialing directory, - * menus, scrollback) always follows the physical wheel. */ - if (settings.invert_wheel + /* Invert Mouse Wheel decides the wheel report the BBS + * receives. ciolib has already swapped the wheel when + * Invert Wheel In Menus is on (for SyncTERM's own lists), + * so the BBS's report is flipped when the two differ. */ + if (settings.invert_wheel != settings.invert_wheel_menus && (mevent.event == CIOLIB_BUTTON_4_PRESS || mevent.event == CIOLIB_BUTTON_5_PRESS)) mevent.event = (mevent.event == CIOLIB_BUTTON_4_PRESS) diff --git a/src/syncterm/wren_bind_menu_settings.c b/src/syncterm/wren_bind_menu_settings.c index 8086492d..bf909e1f 100644 --- a/src/syncterm/wren_bind_menu_settings.c +++ b/src/syncterm/wren_bind_menu_settings.c @@ -212,6 +212,8 @@ slot_bool(WrenVM *vm, int slot, bool *result) SETTINGS_BOOL_PROPERTY(confirmClose, confirm_close) SETTINGS_BOOL_PROPERTY(promptSave, prompt_save) SETTINGS_BOOL_PROPERTY(invertWheel, invert_wheel) +SETTINGS_BOOL_PROPERTY(invertWheelMenus, invert_wheel_menus) +SETTINGS_BOOL_PROPERTY(listClickOpens, list_click_opens) SETTINGS_BOOL_PROPERTY(gpuAccelerated, gpu_accel) SETTINGS_BOOL_PROPERTY(exclusiveMouse, exclusive_mouse) SETTINGS_BOOL_PROPERTY(mouseEdgeMotion, mouse_edge_motion) @@ -1682,6 +1684,8 @@ static const struct binding bindings[] = { SETTINGS_GETSET(confirmClose), SETTINGS_GETSET(promptSave), SETTINGS_GETSET(invertWheel), + SETTINGS_GETSET(invertWheelMenus), + SETTINGS_GETSET(listClickOpens), SETTINGS_GETSET(gpuAccelerated), SETTINGS_GETSET(exclusiveMouse), SETTINGS_GETSET(mouseEdgeMotion), -- 2.47.3