diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 77b75f8..aa87c3c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -23,11 +23,16 @@ jobs: - name: Check formatting shell: pwsh run: | - $files = Get-ChildItem -Path src -Include "*.c","*.h" -Recurse | - Select-Object -ExpandProperty FullName + # Get-ChildItem -Include quirk: use -Filter per extension to reliably + # capture files in the directory root as well as subdirectories. + $files = @( + Get-ChildItem -Path src -Filter "*.c" -Recurse + Get-ChildItem -Path src -Filter "*.h" -Recurse + ) | Select-Object -ExpandProperty FullName + $failed = $false foreach ($f in $files) { - $result = & clang-format --dry-run --Werror $f 2>&1 + clang-format --dry-run --Werror $f 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { Write-Host "NEEDS FORMAT: $f" $failed = $true @@ -35,7 +40,9 @@ jobs: } if ($failed) { Write-Host "" - Write-Host "Run 'clang-format -i src/*.c src/*.h' locally to fix formatting." + Write-Host "Run clang-format locally to fix formatting:" + Write-Host " clang-format -i (Get-ChildItem src -Filter *.c -Recurse).FullName" + Write-Host " clang-format -i (Get-ChildItem src -Filter *.h -Recurse).FullName" exit 1 } - Write-Host "All files formatted correctly." + Write-Host "All $($files.Count) files formatted correctly." diff --git a/src/main.h b/src/main.h index 93ae4d2..748dd49 100644 --- a/src/main.h +++ b/src/main.h @@ -13,28 +13,28 @@ /* Preprocessor guards — must be set before any Windows header */ /* ------------------------------------------------------------------ */ #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN /* exclude rarely-used Win32 APIs to speed up compilation */ +#define WIN32_LEAN_AND_MEAN /* exclude rarely-used Win32 APIs to speed up compilation */ #endif #ifndef UNICODE -#define UNICODE /* use wide-character Win32 entry points */ +#define UNICODE /* use wide-character Win32 entry points */ #endif #ifndef _UNICODE -#define _UNICODE /* align CRT with Win32 UNICODE mode */ +#define _UNICODE /* align CRT with Win32 UNICODE mode */ #endif /* ------------------------------------------------------------------ */ /* Windows API includes */ /* ------------------------------------------------------------------ */ #include -#include /* GET_X_LPARAM, GET_Y_LPARAM, message crackers */ -#include /* GetOpenFileName, OPENFILENAME */ -#include /* ListView, TreeView, tab control, etc. */ -#include /* DwmSetWindowAttribute (dark title bar) */ -#include /* SetWindowTheme (DarkMode_Explorer) */ -#include /* WinINet HTTPS (InternetOpen, HttpSendRequest) */ -#include /* Shell_NotifyIcon, SHFileOperation */ -#include /* SHGetKnownFolderPath (APPDATA) */ -#include /* PathFileExistsW, StrStrIW */ +#include /* GET_X_LPARAM, GET_Y_LPARAM, message crackers */ +#include /* GetOpenFileName, OPENFILENAME */ +#include /* ListView, TreeView, tab control, etc. */ +#include /* DwmSetWindowAttribute (dark title bar) */ +#include /* SetWindowTheme (DarkMode_Explorer) */ +#include /* WinINet HTTPS (InternetOpen, HttpSendRequest) */ +#include /* Shell_NotifyIcon, SHFileOperation */ +#include /* SHGetKnownFolderPath (APPDATA) */ +#include /* PathFileExistsW, StrStrIW */ /* ------------------------------------------------------------------ */ /* C standard library */ @@ -54,79 +54,79 @@ /* ------------------------------------------------------------------ */ /* App strings */ /* ------------------------------------------------------------------ */ -#define APP_CLASS L"CatiaMenuWin32Class" -#define APP_TITLE L"CATIA Macro Menu" -#define APP_APPDATA_DIR L"CatiaMenuWin32" -#define SETTINGS_FILE L"settings.ini" -#define MANIFEST_FILE L"manifest.ini" -#define PREFS_FILE L"prefs.ini" -#define GITHUB_OWNER L"KaiUR" -#define GITHUB_REPO L"Pycatia_Scripts" -#define GITHUB_BRANCH L"main" -#define GITHUB_API_HOST L"api.github.com" -#define GITHUB_RAW_HOST L"raw.githubusercontent.com" -#define AUTORUN_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Run" -#define AUTORUN_NAME L"CatiaMenuWin32" +#define APP_CLASS L"CatiaMenuWin32Class" +#define APP_TITLE L"CATIA Macro Menu" +#define APP_APPDATA_DIR L"CatiaMenuWin32" +#define SETTINGS_FILE L"settings.ini" +#define MANIFEST_FILE L"manifest.ini" +#define PREFS_FILE L"prefs.ini" +#define GITHUB_OWNER L"KaiUR" +#define GITHUB_REPO L"Pycatia_Scripts" +#define GITHUB_BRANCH L"main" +#define GITHUB_API_HOST L"api.github.com" +#define GITHUB_RAW_HOST L"raw.githubusercontent.com" +#define AUTORUN_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Run" +#define AUTORUN_NAME L"CatiaMenuWin32" /* ------------------------------------------------------------------ */ /* Layout */ /* ------------------------------------------------------------------ */ -#define WIN_MIN_W 820 /* minimum main window width (px) */ -#define WIN_MIN_H 420 /* minimum main window height (px) */ -#define TOOLBAR_H 38 /* toolbar strip height (px) */ -#define TAB_H 26 /* tab bar row height (px) */ -#define TAB_ARROW_W 22 /* tab scroll arrow click-zone width (px) */ -#define STATUS_H 22 /* status bar height (px) */ -#define BTN_H 40 /* script button height (px) */ -#define BTN_GAP 6 /* vertical gap between script buttons */ -#define BTN_MX 12 /* horizontal content margin inside button */ -#define BTN_MY 10 /* vertical content margin inside button */ -#define SCROLL_STEP 40 /* px scrolled per keyboard/wheel step */ -#define INFO_BTN_W 28 /* info (ℹ) button column width */ -#define STAR_BTN_W 28 /* width of favourite star badge */ -#define TIP_W 320 /* tooltip popup width (px) */ -#define TIP_ROW_H 18 /* height of one tooltip row (px) */ -#define TIP_HEADER_ROWS 5 /* rows shown in the tooltip header area */ -#define SEARCH_H 26 /* height of search/filter box */ +#define WIN_MIN_W 820 /* minimum main window width (px) */ +#define WIN_MIN_H 420 /* minimum main window height (px) */ +#define TOOLBAR_H 38 /* toolbar strip height (px) */ +#define TAB_H 26 /* tab bar row height (px) */ +#define TAB_ARROW_W 22 /* tab scroll arrow click-zone width (px) */ +#define STATUS_H 22 /* status bar height (px) */ +#define BTN_H 40 /* script button height (px) */ +#define BTN_GAP 6 /* vertical gap between script buttons */ +#define BTN_MX 12 /* horizontal content margin inside button */ +#define BTN_MY 10 /* vertical content margin inside button */ +#define SCROLL_STEP 40 /* px scrolled per keyboard/wheel step */ +#define INFO_BTN_W 28 /* info (ℹ) button column width */ +#define STAR_BTN_W 28 /* width of favourite star badge */ +#define TIP_W 320 /* tooltip popup width (px) */ +#define TIP_ROW_H 18 /* height of one tooltip row (px) */ +#define TIP_HEADER_ROWS 5 /* rows shown in the tooltip header area */ +#define SEARCH_H 26 /* height of search/filter box */ /* Quick Launch Bar */ -#define QBAR_BTN_SIZE 52 /* button face square (px) */ -#define QBAR_PAD 4 /* margin from bar edge to buttons */ -#define QBAR_GAP 4 /* gap between adjacent buttons */ -#define QBAR_ARROW_W 18 /* scroll arrow click area width/height */ -#define QBAR_TIP_W 240 /* tooltip popup width */ -#define QBAR_TIP_PAD 8 /* tooltip internal padding */ -#define QBAR_TIP_ROW 18 /* tooltip row height */ +#define QBAR_BTN_SIZE 52 /* button face square (px) */ +#define QBAR_PAD 4 /* margin from bar edge to buttons */ +#define QBAR_GAP 4 /* gap between adjacent buttons */ +#define QBAR_ARROW_W 18 /* scroll arrow click area width/height */ +#define QBAR_TIP_W 240 /* tooltip popup width */ +#define QBAR_TIP_PAD 8 /* tooltip internal padding */ +#define QBAR_TIP_ROW 18 /* tooltip row height */ /* ------------------------------------------------------------------ */ /* Limits */ /* ------------------------------------------------------------------ */ -#define MAX_FOLDERS 64 /* maximum number of tabs/folders */ -#define MAX_SCRIPTS 1024 /* default heap capacity per folder — grows as needed */ -#define MAX_NAME 128 /* max wide-char length for names and titles */ -#define MAX_SHA 64 /* SHA1 as hex = 40 chars; 64 gives headroom */ -#define MAX_APPPATH 520 /* MAX_PATH (260) doubled for wide + decoration */ -#define HTTP_BUF_SIZE (512 * 1024) /* 512 KB download buffer for GitHub API responses */ -#define MAX_EXTRA_REPOS 8 /* max user-added GitHub repository sources */ -#define MAX_LOCAL_DIRS 8 /* max user-added local folder sources */ -#define MAX_FAVOURITES 256 /* max favourite scripts stored in prefs.ini */ -#define MAX_HIDDEN 256 /* max hidden scripts stored in prefs.ini */ -#define MAX_NOTE_LEN 512 /* max note characters per script */ +#define MAX_FOLDERS 64 /* maximum number of tabs/folders */ +#define MAX_SCRIPTS 1024 /* default heap capacity per folder — grows as needed */ +#define MAX_NAME 128 /* max wide-char length for names and titles */ +#define MAX_SHA 64 /* SHA1 as hex = 40 chars; 64 gives headroom */ +#define MAX_APPPATH 520 /* MAX_PATH (260) doubled for wide + decoration */ +#define HTTP_BUF_SIZE (512 * 1024) /* 512 KB download buffer for GitHub API responses */ +#define MAX_EXTRA_REPOS 8 /* max user-added GitHub repository sources */ +#define MAX_LOCAL_DIRS 8 /* max user-added local folder sources */ +#define MAX_FAVOURITES 256 /* max favourite scripts stored in prefs.ini */ +#define MAX_HIDDEN 256 /* max hidden scripts stored in prefs.ini */ +#define MAX_NOTE_LEN 512 /* max note characters per script */ /* ------------------------------------------------------------------ */ /* Messages */ /* ------------------------------------------------------------------ */ -#define WM_SYNC_DONE (WM_USER + 1) /* Sync_Thread → UI: sync complete (lp = SyncResult*) */ -#define WM_STATUS_SET (WM_USER + 2) /* PostStatus → UI: update status bar (lp = WCHAR*) */ -#define WM_TRAYICON (WM_USER + 10) /* Shell_NotifyIcon callback (lp = mouse message) */ -#define WM_UPDATE_AVAIL (WM_USER + 11) /* Updater_CheckThread → UI: new version available */ -#define WM_AUTO_REFRESH (WM_USER + 12) /* timer-triggered automatic sync */ -#define WM_SCRIPT_STARTED (WM_USER + 13) /* posted by Runner_Thread when a bg script starts */ -#define WM_SCRIPT_STOPPED (WM_USER + 14) /* posted when bg script exits or is terminated */ -#define WM_LOG_OUTPUT (WM_USER + 15) /* LogReader_Thread → UI: script output (lp = WCHAR* heap) */ -#define TRAY_ID 1 /* notification area icon ID passed to Shell_NotifyIcon */ -#define TIMER_AUTO_REFRESH 1001 /* SetTimer ID for the auto-sync interval */ -#define TIMER_QBAR 1002 /* SetTimer ID for quick bar deferred update */ +#define WM_SYNC_DONE (WM_USER + 1) /* Sync_Thread → UI: sync complete (lp = SyncResult*) */ +#define WM_STATUS_SET (WM_USER + 2) /* PostStatus → UI: update status bar (lp = WCHAR*) */ +#define WM_TRAYICON (WM_USER + 10) /* Shell_NotifyIcon callback (lp = mouse message) */ +#define WM_UPDATE_AVAIL (WM_USER + 11) /* Updater_CheckThread → UI: new version available */ +#define WM_AUTO_REFRESH (WM_USER + 12) /* timer-triggered automatic sync */ +#define WM_SCRIPT_STARTED (WM_USER + 13) /* posted by Runner_Thread when a bg script starts */ +#define WM_SCRIPT_STOPPED (WM_USER + 14) /* posted when bg script exits or is terminated */ +#define WM_LOG_OUTPUT (WM_USER + 15) /* LogReader_Thread → UI: script output (lp = WCHAR* heap) */ +#define TRAY_ID 1 /* notification area icon ID passed to Shell_NotifyIcon */ +#define TIMER_AUTO_REFRESH 1001 /* SetTimer ID for the auto-sync interval */ +#define TIMER_QBAR 1002 /* SetTimer ID for quick bar deferred update */ /* ================================================================== */ /* SortMode */ @@ -134,11 +134,12 @@ /* In: (enum values used as g.cfg.sort_mode or folder.sort_mode) */ /* Out: (no return — used as a value type) */ /* ================================================================== */ -typedef enum { - SORT_ORDER = 0, /* order from GitHub API / disk */ - SORT_ALPHA = 1, /* alphabetical A-Z */ - SORT_DATE = 2, /* by script header Date: field */ - SORT_MOST_USED = 3 /* by run count descending */ +typedef enum +{ + SORT_ORDER = 0, /* order from GitHub API / disk */ + SORT_ALPHA = 1, /* alphabetical A-Z */ + SORT_DATE = 2, /* by script header Date: field */ + SORT_MOST_USED = 3 /* by run count descending */ } SortMode; /* ================================================================== */ @@ -149,10 +150,11 @@ typedef enum { /* In: (set by sync.c when populating Script entries) */ /* Out: (read by paint.c and quickbar.c for colour selection) */ /* ================================================================== */ -typedef enum { - SCRIPT_SRC_MAIN = 0, /* built-in KaiUR/Pycatia_Scripts repo */ - SCRIPT_SRC_EXTRA = 1, /* user-added extra GitHub repository */ - SCRIPT_SRC_LOCAL = 2 /* user-added local folder */ +typedef enum +{ + SCRIPT_SRC_MAIN = 0, /* built-in KaiUR/Pycatia_Scripts repo */ + SCRIPT_SRC_EXTRA = 1, /* user-added extra GitHub repository */ + SCRIPT_SRC_LOCAL = 2 /* user-added local folder */ } ScriptSource; /* ================================================================== */ @@ -161,7 +163,12 @@ typedef enum { /* In: (enum values used as g.cfg.theme) */ /* Out: (no return — used as a value type) */ /* ================================================================== */ -typedef enum { THEME_SYSTEM = 0, THEME_DARK = 1, THEME_LIGHT = 2 } ThemeMode; +typedef enum +{ + THEME_SYSTEM = 0, + THEME_DARK = 1, + THEME_LIGHT = 2 +} ThemeMode; /* ================================================================== */ /* SyncStatus / SyncResult */ @@ -170,8 +177,15 @@ typedef enum { THEME_SYSTEM = 0, THEME_DARK = 1, THEME_LIGHT = 2 } ThemeMode; /* In: (populated by Sync_Thread before PostMessage) */ /* Out: (consumed by Handle_SyncDone on the UI thread) */ /* ================================================================== */ -typedef enum { SR_OK=0, SR_NO_INTERNET, SR_API_ERROR, SR_PARTIAL } SyncStatus; -typedef struct { +typedef enum +{ + SR_OK = 0, + SR_NO_INTERNET, + SR_API_ERROR, + SR_PARTIAL +} SyncStatus; +typedef struct +{ SyncStatus status; int folders_added, folders_removed; int scripts_updated, scripts_added, scripts_removed; @@ -185,14 +199,15 @@ typedef struct { /* In: (populated by Meta_Parse from the script's local .py file) */ /* Out: (read by Paint_Tooltip, ScriptDetailsDlgProc, Tabs_ApplySort)*/ /* ================================================================== */ -typedef struct { +typedef struct +{ WCHAR purpose[128]; WCHAR author[64]; WCHAR version[32]; WCHAR date[32]; WCHAR description[1024]; - WCHAR code[64]; /* e.g. "Python3.10.4, Pycatia 0.8.3" */ - WCHAR release[32]; /* e.g. "V5R32" */ + WCHAR code[64]; /* e.g. "Python3.10.4, Pycatia 0.8.3" */ + WCHAR release[32]; /* e.g. "V5R32" */ WCHAR requirements[512]; } ScriptMeta; @@ -203,18 +218,19 @@ typedef struct { /* In: (populated by Sync_Thread / Sync_LoadManifest) */ /* Out: (consumed by Runner_Run, Meta_Parse, Paint_ScriptButton, etc.)*/ /* ================================================================== */ -typedef struct { - WCHAR name[MAX_NAME]; - WCHAR gh_path[MAX_APPPATH]; - WCHAR sha[MAX_SHA]; - WCHAR local[MAX_APPPATH]; - ScriptMeta meta; - bool meta_loaded; - bool is_favourite; - bool is_hidden; - int run_count; - WCHAR note[MAX_NOTE_LEN]; - ScriptSource source; /* where the script was loaded from */ +typedef struct +{ + WCHAR name[MAX_NAME]; + WCHAR gh_path[MAX_APPPATH]; + WCHAR sha[MAX_SHA]; + WCHAR local[MAX_APPPATH]; + ScriptMeta meta; + bool meta_loaded; + bool is_favourite; + bool is_hidden; + int run_count; + WCHAR note[MAX_NOTE_LEN]; + ScriptSource source; /* where the script was loaded from */ } Script; /* ================================================================== */ @@ -225,13 +241,14 @@ typedef struct { /* In: (populated by Sync_MergeFolder / Sync_LocalDir) */ /* Out: (consumed by Tabs_Build, Tabs_Switch, Runner_Run, paint.c) */ /* ================================================================== */ -typedef struct { - WCHAR name[MAX_NAME]; - WCHAR display[MAX_NAME]; - Script *scripts; /* heap allocated — use Folder_Alloc/Folder_Free */ - int count; - int capacity; /* allocated slots */ - bool loaded; +typedef struct +{ + WCHAR name[MAX_NAME]; + WCHAR display[MAX_NAME]; + Script *scripts; /* heap allocated — use Folder_Alloc/Folder_Free */ + int count; + int capacity; /* allocated slots */ + bool loaded; SortMode sort_mode; } ScriptFolder; @@ -253,9 +270,9 @@ static inline bool Folder_Alloc(ScriptFolder *f, int capacity) Script *p = (Script *)malloc((size_t)capacity * sizeof(Script)); if (!p) return false; ZeroMemory(p, (size_t)capacity * sizeof(Script)); - f->scripts = p; + f->scripts = p; f->capacity = capacity; - f->count = 0; + f->count = 0; return true; } @@ -268,8 +285,12 @@ static inline bool Folder_Alloc(ScriptFolder *f, int capacity) /* ================================================================== */ static inline void Folder_Free(ScriptFolder *f) { - if (f->scripts) { free(f->scripts); f->scripts = NULL; } - f->count = 0; + if (f->scripts) + { + free(f->scripts); + f->scripts = NULL; + } + f->count = 0; f->capacity = 0; } @@ -282,34 +303,36 @@ static inline void Folder_Free(ScriptFolder *f) /* ================================================================== */ static inline Script *Folder_Push(ScriptFolder *f) { - if (!f->scripts) { + if (!f->scripts) + { if (!Folder_Alloc(f, 64)) return NULL; } - if (f->count >= f->capacity) { + if (f->count >= f->capacity) + { int new_cap = f->capacity * 2; Script *p = (Script *)realloc(f->scripts, (size_t)new_cap * sizeof(Script)); if (!p) return NULL; ZeroMemory(p + f->capacity, (size_t)(new_cap - f->capacity) * sizeof(Script)); - f->scripts = p; + f->scripts = p; f->capacity = new_cap; } return &f->scripts[f->count++]; } - /* ================================================================== */ /* ExtraRepo */ /* Purpose: Describes one user-added GitHub repository script source. */ /* In: (loaded from settings.ini by Settings_Load) */ /* Out: (passed to Sync_ExtraRepo during each sync cycle) */ /* ================================================================== */ -typedef struct { - WCHAR url[512]; - WCHAR branch[64]; - WCHAR token[256]; - bool enabled; +typedef struct +{ + WCHAR url[512]; + WCHAR branch[64]; + WCHAR token[256]; + bool enabled; } ExtraRepo; /* ================================================================== */ @@ -318,9 +341,10 @@ typedef struct { /* In: (loaded from settings.ini by Settings_Load) */ /* Out: (passed to Sync_LocalDir during each sync cycle) */ /* ================================================================== */ -typedef struct { - WCHAR path[MAX_APPPATH]; - bool enabled; +typedef struct +{ + WCHAR path[MAX_APPPATH]; + bool enabled; } LocalDir; /* ================================================================== */ @@ -330,86 +354,87 @@ typedef struct { /* In: (populated by Settings_Load at startup) */ /* Out: (written back by Settings_Save on change or exit) */ /* ================================================================== */ -typedef struct { - WCHAR python_exe[MAX_APPPATH]; - WCHAR cache_dir[MAX_APPPATH]; - WCHAR github_token[256]; - bool auto_sync; - bool download_before_run; - bool show_console; - bool console_keep_open; - bool deps_keep_open; - bool always_on_top; - bool minimize_to_tray; - bool start_with_windows; - bool start_minimized; - bool check_updates; - bool auto_update; /* auto-download and install updates */ - bool offline_use_cache; /* show cached scripts when offline (default: true) */ +typedef struct +{ + WCHAR python_exe[MAX_APPPATH]; + WCHAR cache_dir[MAX_APPPATH]; + WCHAR github_token[256]; + bool auto_sync; + bool download_before_run; + bool show_console; + bool console_keep_open; + bool deps_keep_open; + bool always_on_top; + bool minimize_to_tray; + bool start_with_windows; + bool start_minimized; + bool check_updates; + bool auto_update; /* auto-download and install updates */ + bool offline_use_cache; /* show cached scripts when offline (default: true) */ ThemeMode theme; - int refresh_interval; /* hours, 0 = disabled, default 6 */ + int refresh_interval; /* hours, 0 = disabled, default 6 */ /* Sources */ - bool main_repo_enabled; + bool main_repo_enabled; ExtraRepo extra_repos[MAX_EXTRA_REPOS]; - int extra_repo_count; - LocalDir local_dirs[MAX_LOCAL_DIRS]; - int local_dir_count; + int extra_repo_count; + LocalDir local_dirs[MAX_LOCAL_DIRS]; + int local_dir_count; /* Sort */ - SortMode sort_mode; /* global sort mode */ + SortMode sort_mode; /* global sort mode */ /* Quick Launch Bar */ - bool qbar_enabled; - bool qbar_horizontal; - bool qbar_topmost_with_catia; - int qbar_x; - int qbar_y; - WCHAR qbar_target_app[MAX_NAME]; /* window-title substring; empty = no target */ - WCHAR qbar_target_exe[MAX_NAME]; /* process exe name (e.g. CNEXT.exe); empty = any */ + bool qbar_enabled; + bool qbar_horizontal; + bool qbar_topmost_with_catia; + int qbar_x; + int qbar_y; + WCHAR qbar_target_app[MAX_NAME]; /* window-title substring; empty = no target */ + WCHAR qbar_target_exe[MAX_NAME]; /* process exe name (e.g. CNEXT.exe); empty = any */ /* Double-click repeat */ - bool repeat_on_dblclick; /* repeat main-window scripts on double-click (default: true) */ - bool qbar_repeat_on_dblclick; /* repeat Quick Bar scripts on double-click (default: true) */ + bool repeat_on_dblclick; /* repeat main-window scripts on double-click (default: true) */ + bool qbar_repeat_on_dblclick; /* repeat Quick Bar scripts on double-click (default: true) */ /* Script display */ - bool tint_script_sources; /* tint local/extra-repo buttons differently (default: true) */ + bool tint_script_sources; /* tint local/extra-repo buttons differently (default: true) */ } Settings; /* ------------------------------------------------------------------ */ /* Colours */ /* ------------------------------------------------------------------ */ -#define COL_BG_DARK RGB(28, 28, 35) -#define COL_BG_LIGHT RGB(240, 240, 245) +#define COL_BG_DARK RGB(28, 28, 35) +#define COL_BG_LIGHT RGB(240, 240, 245) /* Source-tint colours (used when tint_script_sources is true) */ -#define COL_BTN_LOCAL_DARK RGB(54, 42, 38) /* warm brown for local-folder scripts */ -#define COL_BTN_LOCAL_LIGHT RGB(240, 220, 215) -#define COL_BTN_EXTRA_DARK RGB(38, 52, 42) /* muted green for extra-repo scripts */ -#define COL_BTN_EXTRA_LIGHT RGB(215, 235, 218) +#define COL_BTN_LOCAL_DARK RGB(54, 42, 38) /* warm brown for local-folder scripts */ +#define COL_BTN_LOCAL_LIGHT RGB(240, 220, 215) +#define COL_BTN_EXTRA_DARK RGB(38, 52, 42) /* muted green for extra-repo scripts */ +#define COL_BTN_EXTRA_LIGHT RGB(215, 235, 218) /* Offline-cached tint (g.status_offline + offline_use_cache) — two different reds */ -#define COL_BTN_OFFLINE_MAIN_DARK RGB(52, 24, 24) /* main repo, offline, dark mode */ -#define COL_BTN_OFFLINE_MAIN_LIGHT RGB(255, 208, 208) /* main repo, offline, light mode */ -#define COL_BTN_OFFLINE_EXTRA_DARK RGB(52, 34, 18) /* extra repo, offline, dark mode */ -#define COL_BTN_OFFLINE_EXTRA_LIGHT RGB(255, 222, 190) /* extra repo, offline, light mode */ -#define COL_TOOLBAR_DARK RGB(20, 20, 28) -#define COL_TOOLBAR_LIGHT RGB(210, 210, 220) -#define COL_BTN_NORM_DARK RGB(44, 46, 64) +#define COL_BTN_OFFLINE_MAIN_DARK RGB(52, 24, 24) /* main repo, offline, dark mode */ +#define COL_BTN_OFFLINE_MAIN_LIGHT RGB(255, 208, 208) /* main repo, offline, light mode */ +#define COL_BTN_OFFLINE_EXTRA_DARK RGB(52, 34, 18) /* extra repo, offline, dark mode */ +#define COL_BTN_OFFLINE_EXTRA_LIGHT RGB(255, 222, 190) /* extra repo, offline, light mode */ +#define COL_TOOLBAR_DARK RGB(20, 20, 28) +#define COL_TOOLBAR_LIGHT RGB(210, 210, 220) +#define COL_BTN_NORM_DARK RGB(44, 46, 64) #define COL_BTN_NORM_LIGHT RGB(220, 222, 235) -#define COL_BTN_HOT_DARK RGB(62, 65, 90) -#define COL_BTN_HOT_LIGHT RGB(190, 195, 220) -#define COL_BTN_PRESS_DARK RGB(28, 30, 48) -#define COL_BTN_PRESS_LIGHT RGB(170,175,205) -#define COL_INFO_ZONE_DARK RGB(36, 38, 55) -#define COL_INFO_ZONE_LIGHT RGB(200,202,220) -#define COL_ACCENT RGB(82, 155, 245) -#define COL_ACCENT_DIM RGB(48, 92, 160) -#define COL_SUCCESS RGB(80, 200, 120) -#define COL_WARN RGB(240, 190, 60) -#define COL_STAR RGB(255, 200, 60) /* favourite star */ -#define COL_TEXT_DARK RGB(210, 215, 240) -#define COL_TEXT_LIGHT RGB(30, 30, 40) -#define COL_SUBTEXT_DARK RGB(110, 116, 148) -#define COL_SUBTEXT_LIGHT RGB(100, 100, 120) -#define COL_DIVIDER_DARK RGB(46, 48, 66) -#define COL_DIVIDER_LIGHT RGB(190, 192, 210) -#define COL_TIP_BG_DARK RGB(22, 22, 32) -#define COL_TIP_BG_LIGHT RGB(245, 245, 252) -#define COL_TIP_BORDER RGB(82, 155, 245) +#define COL_BTN_HOT_DARK RGB(62, 65, 90) +#define COL_BTN_HOT_LIGHT RGB(190, 195, 220) +#define COL_BTN_PRESS_DARK RGB(28, 30, 48) +#define COL_BTN_PRESS_LIGHT RGB(170, 175, 205) +#define COL_INFO_ZONE_DARK RGB(36, 38, 55) +#define COL_INFO_ZONE_LIGHT RGB(200, 202, 220) +#define COL_ACCENT RGB(82, 155, 245) +#define COL_ACCENT_DIM RGB(48, 92, 160) +#define COL_SUCCESS RGB(80, 200, 120) +#define COL_WARN RGB(240, 190, 60) +#define COL_STAR RGB(255, 200, 60) /* favourite star */ +#define COL_TEXT_DARK RGB(210, 215, 240) +#define COL_TEXT_LIGHT RGB(30, 30, 40) +#define COL_SUBTEXT_DARK RGB(110, 116, 148) +#define COL_SUBTEXT_LIGHT RGB(100, 100, 120) +#define COL_DIVIDER_DARK RGB(46, 48, 66) +#define COL_DIVIDER_LIGHT RGB(190, 192, 210) +#define COL_TIP_BG_DARK RGB(22, 22, 32) +#define COL_TIP_BG_LIGHT RGB(245, 245, 252) +#define COL_TIP_BORDER RGB(82, 155, 245) /* ================================================================== */ /* AppState */ @@ -420,44 +445,45 @@ typedef struct { /* In: (initialised at startup, updated by all modules) */ /* Out: (read by all modules via the global `g` instance) */ /* ================================================================== */ -typedef struct { - HWND hwnd; /* main application window */ - HWND hwnd_tab; /* custom tab bar control */ - HWND hwnd_scroll; /* scrollable script panel */ - HWND hwnd_status; /* status bar at the bottom */ - HWND hwnd_tip; /* script tooltip popup */ - HWND hwnd_search; /* search/filter edit box */ - HWND hwnd_details; /* script details panel */ +typedef struct +{ + HWND hwnd; /* main application window */ + HWND hwnd_tab; /* custom tab bar control */ + HWND hwnd_scroll; /* scrollable script panel */ + HWND hwnd_status; /* status bar at the bottom */ + HWND hwnd_tip; /* script tooltip popup */ + HWND hwnd_search; /* search/filter edit box */ + HWND hwnd_details; /* script details panel */ ScriptFolder folders[MAX_FOLDERS]; - int folder_count; - int active_tab; /* index of the currently displayed tab */ - int tab_offset; /* first visible tab when tabs overflow */ + int folder_count; + int active_tab; /* index of the currently displayed tab */ + int tab_offset; /* first visible tab when tabs overflow */ Settings cfg; - bool dark_mode; /* true = dark theme active */ - - HFONT font_ui; /* default UI font (≈10pt) */ - HFONT font_bold; /* bold variant of font_ui */ - HFONT font_small; /* smaller font for secondary text (≈8pt) */ - HBRUSH br_bg; /* main background brush */ - HBRUSH br_toolbar; /* toolbar background brush */ - HBRUSH br_btn; /* script button idle-state brush */ - HBRUSH br_btn_hot; /* script button hovered-state brush */ - HBRUSH br_accent; /* accent colour brush */ - HBRUSH br_status; /* status bar background brush */ - - bool syncing; /* true = background sync thread is running */ - bool status_offline; /* true when showing stale cache due to no internet */ - int hot_btn; /* hovered button index, -1 = none */ - int tip_btn; /* button whose tooltip is displayed, -1 = none */ - int tip_h; /* current tooltip height in px */ - WCHAR last_run_path[MAX_APPPATH]; /* path of the most recently run script */ - WCHAR appdata_dir[MAX_APPPATH]; - WCHAR latest_version[32]; - WCHAR active_folder_name[MAX_NAME]; /* name of active folder for post-sync restoration */ - int scroll_y; /* current vertical scroll position (px) */ - int scroll_max; /* maximum scroll position (px) */ - bool tray_icon_added; /* guards against double-adding tray icon */ + bool dark_mode; /* true = dark theme active */ + + HFONT font_ui; /* default UI font (≈10pt) */ + HFONT font_bold; /* bold variant of font_ui */ + HFONT font_small; /* smaller font for secondary text (≈8pt) */ + HBRUSH br_bg; /* main background brush */ + HBRUSH br_toolbar; /* toolbar background brush */ + HBRUSH br_btn; /* script button idle-state brush */ + HBRUSH br_btn_hot; /* script button hovered-state brush */ + HBRUSH br_accent; /* accent colour brush */ + HBRUSH br_status; /* status bar background brush */ + + bool syncing; /* true = background sync thread is running */ + bool status_offline; /* true when showing stale cache due to no internet */ + int hot_btn; /* hovered button index, -1 = none */ + int tip_btn; /* button whose tooltip is displayed, -1 = none */ + int tip_h; /* current tooltip height in px */ + WCHAR last_run_path[MAX_APPPATH]; /* path of the most recently run script */ + WCHAR appdata_dir[MAX_APPPATH]; + WCHAR latest_version[32]; + WCHAR active_folder_name[MAX_NAME]; /* name of active folder for post-sync restoration */ + int scroll_y; /* current vertical scroll position (px) */ + int scroll_max; /* maximum scroll position (px) */ + bool tray_icon_added; /* guards against double-adding tray icon */ CRITICAL_SECTION cs_folders; /* guards g.folders[] and g.folder_count */ @@ -465,38 +491,38 @@ typedef struct { volatile HANDLE run_process; /* Filter */ - WCHAR filter_text[MAX_NAME]; /* current search/filter string */ + WCHAR filter_text[MAX_NAME]; /* current search/filter string */ /* Details panel */ - int details_script_fi; /* folder index of shown script */ - int details_script_si; /* script index of shown script */ - bool details_visible; + int details_script_fi; /* folder index of shown script */ + int details_script_si; /* script index of shown script */ + bool details_visible; /* Quick Launch Bar */ - HWND hwnd_qbar; /* floating bar window */ - HWND hwnd_qbar_tip; /* bar tooltip popup */ - int qbar_hot; /* hovered button index, -1 = none */ - int qbar_scroll; /* current scroll offset (px) */ - int qbar_scroll_max; /* maximum scroll offset */ - bool qbar_dragging; /* bar is being dragged */ - int qbar_drag_ox; /* drag start: cursor offset from left */ - int qbar_drag_oy; /* drag start: cursor offset from top */ - int qbar_tip_idx; /* button index shown in tip, -1 = none */ + HWND hwnd_qbar; /* floating bar window */ + HWND hwnd_qbar_tip; /* bar tooltip popup */ + int qbar_hot; /* hovered button index, -1 = none */ + int qbar_scroll; /* current scroll offset (px) */ + int qbar_scroll_max; /* maximum scroll offset */ + bool qbar_dragging; /* bar is being dragged */ + int qbar_drag_ox; /* drag start: cursor offset from left */ + int qbar_drag_oy; /* drag start: cursor offset from top */ + int qbar_tip_idx; /* button index shown in tip, -1 = none */ /* Double-click repeat mode */ - bool repeat_mode; /* true = re-run script after each completion */ - int repeat_fi; /* folder index of the script to repeat */ - int repeat_si; /* script index of the script to repeat */ - bool suppress_lbuttonup; /* suppress the extra LBUTTONUP after dblclick */ - HHOOK kbd_repeat_hook; /* low-level keyboard hook active during repeat */ + bool repeat_mode; /* true = re-run script after each completion */ + int repeat_fi; /* folder index of the script to repeat */ + int repeat_si; /* script index of the script to repeat */ + bool suppress_lbuttonup; /* suppress the extra LBUTTONUP after dblclick */ + HHOOK kbd_repeat_hook; /* low-level keyboard hook active during repeat */ /* Running state (background mode only, cleared when script exits) */ - bool script_running; /* true while a background script is in flight */ - int run_fi; /* folder index of the running script */ - int run_si; /* script index of the running script */ + bool script_running; /* true while a background script is in flight */ + int run_fi; /* folder index of the running script */ + int run_si; /* script index of the running script */ /* Script output log */ - HWND hwnd_log; /* modeless log window; NULL when not open */ + HWND hwnd_log; /* modeless log window; NULL when not open */ } AppState; @@ -518,20 +544,62 @@ extern AppState g; /* In: (none — reads g.dark_mode) */ /* Out: COLORREF — theme-appropriate colour value */ /* ================================================================== */ -static inline COLORREF COL_BG(void) { return g.dark_mode ? COL_BG_DARK : COL_BG_LIGHT; } -static inline COLORREF COL_TOOLBAR(void) { return g.dark_mode ? COL_TOOLBAR_DARK : COL_TOOLBAR_LIGHT; } -static inline COLORREF COL_BTN_NORM(void) { return g.dark_mode ? COL_BTN_NORM_DARK : COL_BTN_NORM_LIGHT; } -static inline COLORREF COL_BTN_HOT(void) { return g.dark_mode ? COL_BTN_HOT_DARK : COL_BTN_HOT_LIGHT; } -static inline COLORREF COL_BTN_PRESS(void) { return g.dark_mode ? COL_BTN_PRESS_DARK : COL_BTN_PRESS_LIGHT; } -static inline COLORREF COL_INFO_ZONE(void) { return g.dark_mode ? COL_INFO_ZONE_DARK : COL_INFO_ZONE_LIGHT; } -static inline COLORREF COL_TEXT(void) { return g.dark_mode ? COL_TEXT_DARK : COL_TEXT_LIGHT; } -static inline COLORREF COL_SUBTEXT(void) { return g.dark_mode ? COL_SUBTEXT_DARK : COL_SUBTEXT_LIGHT; } -static inline COLORREF COL_DIVIDER(void) { return g.dark_mode ? COL_DIVIDER_DARK : COL_DIVIDER_LIGHT; } -static inline COLORREF COL_TIP_BG(void) { return g.dark_mode ? COL_TIP_BG_DARK : COL_TIP_BG_LIGHT; } -static inline COLORREF COL_BTN_LOCAL(void) { return g.dark_mode ? COL_BTN_LOCAL_DARK : COL_BTN_LOCAL_LIGHT; } -static inline COLORREF COL_BTN_EXTRA(void) { return g.dark_mode ? COL_BTN_EXTRA_DARK : COL_BTN_EXTRA_LIGHT; } -static inline COLORREF COL_BTN_OFFLINE_MAIN(void) { return g.dark_mode ? COL_BTN_OFFLINE_MAIN_DARK : COL_BTN_OFFLINE_MAIN_LIGHT; } -static inline COLORREF COL_BTN_OFFLINE_EXTRA(void) { return g.dark_mode ? COL_BTN_OFFLINE_EXTRA_DARK : COL_BTN_OFFLINE_EXTRA_LIGHT; } +static inline COLORREF COL_BG(void) +{ + return g.dark_mode ? COL_BG_DARK : COL_BG_LIGHT; +} +static inline COLORREF COL_TOOLBAR(void) +{ + return g.dark_mode ? COL_TOOLBAR_DARK : COL_TOOLBAR_LIGHT; +} +static inline COLORREF COL_BTN_NORM(void) +{ + return g.dark_mode ? COL_BTN_NORM_DARK : COL_BTN_NORM_LIGHT; +} +static inline COLORREF COL_BTN_HOT(void) +{ + return g.dark_mode ? COL_BTN_HOT_DARK : COL_BTN_HOT_LIGHT; +} +static inline COLORREF COL_BTN_PRESS(void) +{ + return g.dark_mode ? COL_BTN_PRESS_DARK : COL_BTN_PRESS_LIGHT; +} +static inline COLORREF COL_INFO_ZONE(void) +{ + return g.dark_mode ? COL_INFO_ZONE_DARK : COL_INFO_ZONE_LIGHT; +} +static inline COLORREF COL_TEXT(void) +{ + return g.dark_mode ? COL_TEXT_DARK : COL_TEXT_LIGHT; +} +static inline COLORREF COL_SUBTEXT(void) +{ + return g.dark_mode ? COL_SUBTEXT_DARK : COL_SUBTEXT_LIGHT; +} +static inline COLORREF COL_DIVIDER(void) +{ + return g.dark_mode ? COL_DIVIDER_DARK : COL_DIVIDER_LIGHT; +} +static inline COLORREF COL_TIP_BG(void) +{ + return g.dark_mode ? COL_TIP_BG_DARK : COL_TIP_BG_LIGHT; +} +static inline COLORREF COL_BTN_LOCAL(void) +{ + return g.dark_mode ? COL_BTN_LOCAL_DARK : COL_BTN_LOCAL_LIGHT; +} +static inline COLORREF COL_BTN_EXTRA(void) +{ + return g.dark_mode ? COL_BTN_EXTRA_DARK : COL_BTN_EXTRA_LIGHT; +} +static inline COLORREF COL_BTN_OFFLINE_MAIN(void) +{ + return g.dark_mode ? COL_BTN_OFFLINE_MAIN_DARK : COL_BTN_OFFLINE_MAIN_LIGHT; +} +static inline COLORREF COL_BTN_OFFLINE_EXTRA(void) +{ + return g.dark_mode ? COL_BTN_OFFLINE_EXTRA_DARK : COL_BTN_OFFLINE_EXTRA_LIGHT; +} /* ------------------------------------------------------------------ */ /* Prototypes */ @@ -577,17 +645,17 @@ void GitHub_ParseFolder(const char *json, int fi); bool GitHub_DownloadRaw(const WCHAR *gh_path, const WCHAR *local_path, const WCHAR *token); bool GitHub_DownloadRawFull(const WCHAR *host, const WCHAR *path, - const WCHAR *local_path, const WCHAR *token); + const WCHAR *local_path, const WCHAR *token); bool GitHub_ComputeFileSHA1(const WCHAR *local_path, WCHAR *sha_out, int max); bool GitHub_VerifyScriptSHA(const Script *s); bool GitHub_ParseOwnerRepo(const WCHAR *url, WCHAR *owner, WCHAR *repo); /* sync.c */ DWORD WINAPI Sync_Thread(LPVOID); -void Sync_LoadManifest(void); -void Sync_SaveManifest(void); -bool Sync_GetLocalSHA(const WCHAR *gh_path, WCHAR *sha_out); -void Sync_MergeFolder(const WCHAR *folder_name, Script *scripts, int count); +void Sync_LoadManifest(void); +void Sync_SaveManifest(void); +bool Sync_GetLocalSHA(const WCHAR *gh_path, WCHAR *sha_out); +void Sync_MergeFolder(const WCHAR *folder_name, Script *scripts, int count); /* meta.c */ void Meta_Parse(Script *s); @@ -602,12 +670,12 @@ void Runner_Stop(void); /* Repeat-mode helpers (main.c) */ void Repeat_Start(int fi, int si); /* activate repeat + install global ESC hook */ -void Repeat_Stop(void); /* cancel repeat + remove hook + repaint */ +void Repeat_Stop(void); /* cancel repeat + remove hook + repaint */ /* updater.c */ DWORD WINAPI Updater_CheckThread(LPVOID); -void Updater_PromptAndInstall(const WCHAR *latest_tag); -void Updater_AutoUpdate(const WCHAR *latest_tag); +void Updater_PromptAndInstall(const WCHAR *latest_tag); +void Updater_AutoUpdate(const WCHAR *latest_tag); /* settings.c */ void Settings_Load(Settings *s); @@ -629,7 +697,7 @@ bool Prefs_IsFavourite(const WCHAR *gh_path); void Prefs_SetFavourite(const WCHAR *gh_path, bool fav); bool Prefs_IsHidden(const WCHAR *gh_path); void Prefs_SetHidden(const WCHAR *gh_path, bool hidden); -int Prefs_GetRunCount(const WCHAR *gh_path); +int Prefs_GetRunCount(const WCHAR *gh_path); void Prefs_IncrementRunCount(const WCHAR *gh_path); void Prefs_GetNote(const WCHAR *gh_path, WCHAR *note, int max); void Prefs_SetNote(const WCHAR *gh_path, const WCHAR *note); @@ -677,8 +745,10 @@ LRESULT CALLBACK BtnSubclassProc(HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR /* In: s — wide string (modified in-place); no-op if no '.' found */ /* Out: (void) */ /* ================================================================== */ -static inline void Util_StripExt(WCHAR *s) { - WCHAR *d = wcsrchr(s, L'.'); if (d) *d = L'\0'; +static inline void Util_StripExt(WCHAR *s) +{ + WCHAR *d = wcsrchr(s, L'.'); + if (d) *d = L'\0'; } /* ================================================================== */ @@ -689,11 +759,21 @@ static inline void Util_StripExt(WCHAR *s) { /* In: s — wide string (modified in-place) */ /* Out: (void) */ /* ================================================================== */ -static inline void Util_SnakeToTitle(WCHAR *s) { +static inline void Util_SnakeToTitle(WCHAR *s) +{ bool cap = true; - for (WCHAR *p = s; *p; p++) { - if (*p == L'_') { *p = L' '; cap = true; } - else if (cap && *p != L' ') { *p = (WCHAR)towupper(*p); cap = false; } + for (WCHAR *p = s; *p; p++) + { + if (*p == L'_') + { + *p = L' '; + cap = true; + } + else if (cap && *p != L' ') + { + *p = (WCHAR)towupper(*p); + cap = false; + } } } @@ -706,10 +786,13 @@ static inline void Util_SnakeToTitle(WCHAR *s) { /* ... — variadic arguments */ /* Out: (void) */ /* ================================================================== */ -static inline void Util_Log(const WCHAR *fmt, ...) { +static inline void Util_Log(const WCHAR *fmt, ...) +{ WCHAR buf[512]; - va_list va; va_start(va, fmt); - _vsnwprintf_s(buf, 512, _TRUNCATE, fmt, va); va_end(va); + va_list va; + va_start(va, fmt); + _vsnwprintf_s(buf, 512, _TRUNCATE, fmt, va); + va_end(va); OutputDebugStringW(buf); OutputDebugStringW(L"\n"); } @@ -723,11 +806,14 @@ static inline void Util_Log(const WCHAR *fmt, ...) { /* ... — variadic arguments */ /* Out: (void) — message is delivered asynchronously */ /* ================================================================== */ -static inline void PostStatus(const WCHAR *fmt, ...) { +static inline void PostStatus(const WCHAR *fmt, ...) +{ WCHAR *buf = (WCHAR *)malloc(256 * sizeof(WCHAR)); if (!buf) return; - va_list va; va_start(va, fmt); - _vsnwprintf_s(buf, 256, _TRUNCATE, fmt, va); va_end(va); + va_list va; + va_start(va, fmt); + _vsnwprintf_s(buf, 256, _TRUNCATE, fmt, va); + va_end(va); PostMessage(g.hwnd, WM_STATUS_SET, 0, (LPARAM)buf); } diff --git a/src/resource.h b/src/resource.h index e00ef6f..15e83ba 100644 --- a/src/resource.h +++ b/src/resource.h @@ -4,318 +4,318 @@ /* ------------------------------------------------------------------ */ /* Application icons (101–102) */ /* ------------------------------------------------------------------ */ -#define IDI_APP_ICON 101 /* main window / tray icon */ +#define IDI_APP_ICON 101 /* main window / tray icon */ /* IDI_HELP_ICON = 102 is defined further down with the help window */ /* ------------------------------------------------------------------ */ /* Menu resource and main menu command IDs (200–257) */ /* These are sent to WM_COMMAND when a menu item is selected. */ /* ------------------------------------------------------------------ */ -#define IDR_MAINMENU 200 /* menu resource handle */ -#define IDM_REFRESH 201 -#define IDM_SETTINGS 202 -#define IDM_EXIT 203 -#define IDM_RUN_LAST 204 -#define IDM_OPEN_CACHE 205 -#define IDM_ABOUT 206 -#define IDM_GITHUB 207 -#define IDM_GITHUB_SCRIPTS 216 -#define IDM_UPDATE_DEPS 208 -#define IDM_ALWAYS_ON_TOP 209 -#define IDM_MINIMIZE_TO_TRAY 210 -#define IDM_START_WITH_WINDOWS 211 -#define IDM_START_MINIMIZED 212 -#define IDM_THEME_DARK 213 -#define IDM_THEME_LIGHT 214 -#define IDM_THEME_SYSTEM 215 +#define IDR_MAINMENU 200 /* menu resource handle */ +#define IDM_REFRESH 201 +#define IDM_SETTINGS 202 +#define IDM_EXIT 203 +#define IDM_RUN_LAST 204 +#define IDM_OPEN_CACHE 205 +#define IDM_ABOUT 206 +#define IDM_GITHUB 207 +#define IDM_GITHUB_SCRIPTS 216 +#define IDM_UPDATE_DEPS 208 +#define IDM_ALWAYS_ON_TOP 209 +#define IDM_MINIMIZE_TO_TRAY 210 +#define IDM_START_WITH_WINDOWS 211 +#define IDM_START_MINIMIZED 212 +#define IDM_THEME_DARK 213 +#define IDM_THEME_LIGHT 214 +#define IDM_THEME_SYSTEM 215 /* ------------------------------------------------------------------ */ /* Dialog template IDs (300–309) */ /* Each IDD_ identifies a dialog template in the .rc resource file. */ /* ------------------------------------------------------------------ */ -#define IDD_SETTINGS 300 -#define IDD_ABOUT 301 +#define IDD_SETTINGS 300 +#define IDD_ABOUT 301 /* ------------------------------------------------------------------ */ /* Settings dialog controls — Script / Sync tab (401–414) */ /* ------------------------------------------------------------------ */ -#define IDC_EDIT_PYTHON 401 -#define IDC_BTN_BROWSE_PY 402 -#define IDC_EDIT_CACHE 403 -#define IDC_BTN_BROWSE_DIR 404 -#define IDC_CHK_DOWNLOAD 405 -#define IDC_CHK_CONSOLE 406 -#define IDC_CHK_TOKEN 407 -#define IDC_EDIT_TOKEN 408 -#define IDC_CHK_AUTOSYNC 409 -#define IDC_CHK_KEEP_OPEN 410 -#define IDC_CHK_CHECK_UPDATES 411 -#define IDC_CHK_DEPS_KEEP_OPEN 412 -#define IDC_BTN_RESET 420 -#define IDC_CHK_AUTO_UPDATE 413 /* auto-download and install updates */ +#define IDC_EDIT_PYTHON 401 +#define IDC_BTN_BROWSE_PY 402 +#define IDC_EDIT_CACHE 403 +#define IDC_BTN_BROWSE_DIR 404 +#define IDC_CHK_DOWNLOAD 405 +#define IDC_CHK_CONSOLE 406 +#define IDC_CHK_TOKEN 407 +#define IDC_EDIT_TOKEN 408 +#define IDC_CHK_AUTOSYNC 409 +#define IDC_CHK_KEEP_OPEN 410 +#define IDC_CHK_CHECK_UPDATES 411 +#define IDC_CHK_DEPS_KEEP_OPEN 412 +#define IDC_BTN_RESET 420 +#define IDC_CHK_AUTO_UPDATE 413 /* auto-download and install updates */ #define IDC_EDIT_REFRESH_INTERVAL 414 /* sync interval in hours */ /* ------------------------------------------------------------------ */ /* Main window controls (501–509) */ /* ------------------------------------------------------------------ */ -#define IDC_TAB_CTRL 501 -#define IDC_STATUS_BAR 507 /* was 502 — renumbered to avoid conflict with IDC_BTN_MENU */ -#define IDC_BTN_MENU 502 -#define IDC_BTN_REFRESH 503 -#define IDC_BTN_SETTINGS 504 -#define IDC_SCROLL_PANEL 505 -#define IDC_BTN_UPDATE_DEPS 506 -#define IDC_BTN_STOP 508 -#define IDC_BTN_LOG 509 /* script output log window button (visible in bg mode) */ +#define IDC_TAB_CTRL 501 +#define IDC_STATUS_BAR 507 /* was 502 — renumbered to avoid conflict with IDC_BTN_MENU */ +#define IDC_BTN_MENU 502 +#define IDC_BTN_REFRESH 503 +#define IDC_BTN_SETTINGS 504 +#define IDC_SCROLL_PANEL 505 +#define IDC_BTN_UPDATE_DEPS 506 +#define IDC_BTN_STOP 508 +#define IDC_BTN_LOG 509 /* script output log window button (visible in bg mode) */ /* ------------------------------------------------------------------ */ /* Script buttons (1000+) */ /* Buttons are created dynamically; each button's control ID is */ /* IDC_SCRIPT_BTN_BASE + script_index within the active folder. */ /* ------------------------------------------------------------------ */ -#define IDC_SCRIPT_BTN_BASE 1000 +#define IDC_SCRIPT_BTN_BASE 1000 /* ------------------------------------------------------------------ */ /* Sources dialog (217, 302, 601–616) */ /* ------------------------------------------------------------------ */ -#define IDM_SOURCES 217 -#define IDD_SOURCES 302 -#define IDC_LST_REPOS 601 -#define IDC_BTN_REPO_ADD 602 -#define IDC_BTN_REPO_EDIT 603 -#define IDC_BTN_REPO_REMOVE 604 -#define IDC_LST_LOCAL 605 -#define IDC_BTN_LOCAL_ADD 606 -#define IDC_BTN_LOCAL_REMOVE 607 -#define IDC_CHK_MAIN_REPO 608 +#define IDM_SOURCES 217 +#define IDD_SOURCES 302 +#define IDC_LST_REPOS 601 +#define IDC_BTN_REPO_ADD 602 +#define IDC_BTN_REPO_EDIT 603 +#define IDC_BTN_REPO_REMOVE 604 +#define IDC_LST_LOCAL 605 +#define IDC_BTN_LOCAL_ADD 606 +#define IDC_BTN_LOCAL_REMOVE 607 +#define IDC_CHK_MAIN_REPO 608 /* ------------------------------------------------------------------ */ /* Repo edit dialog (303, 610–616) */ /* ------------------------------------------------------------------ */ -#define IDD_REPO_EDIT 303 -#define IDC_EDIT_REPO_URL 610 -#define IDC_EDIT_REPO_BRANCH 611 -#define IDC_EDIT_REPO_TOKEN 612 -#define IDC_CHK_REPO_TOKEN 613 -#define IDC_CHK_REPO_ENABLED 614 -#define IDC_BTN_REPO_TOGGLE 615 -#define IDC_BTN_LOCAL_TOGGLE 616 +#define IDD_REPO_EDIT 303 +#define IDC_EDIT_REPO_URL 610 +#define IDC_EDIT_REPO_BRANCH 611 +#define IDC_EDIT_REPO_TOKEN 612 +#define IDC_CHK_REPO_TOKEN 613 +#define IDC_CHK_REPO_ENABLED 614 +#define IDC_BTN_REPO_TOGGLE 615 +#define IDC_BTN_LOCAL_TOGGLE 616 /* ------------------------------------------------------------------ */ /* Sort menu commands (218–221) */ /* ------------------------------------------------------------------ */ -#define IDM_SORT_DEFAULT 218 -#define IDM_SORT_ALPHA 219 -#define IDM_SORT_DATE 220 -#define IDM_SORT_MOST_USED 221 +#define IDM_SORT_DEFAULT 218 +#define IDM_SORT_ALPHA 219 +#define IDM_SORT_DATE 220 +#define IDM_SORT_MOST_USED 221 /* ------------------------------------------------------------------ */ /* View menu additions (222–223) */ /* ------------------------------------------------------------------ */ #define IDM_OPEN_EXE_FOLDER 222 -#define IDM_HIDDEN_SCRIPTS 223 +#define IDM_HIDDEN_SCRIPTS 223 /* ------------------------------------------------------------------ */ /* Script context menu commands (230–237) */ /* ------------------------------------------------------------------ */ -#define IDM_SCRIPT_DETAILS 230 -#define IDM_SCRIPT_FAVOURITE 231 -#define IDM_SCRIPT_HIDE 232 -#define IDM_SCRIPT_NOTE 233 -#define IDM_SCRIPT_RUN_ARGS 234 -#define IDM_SCRIPT_OPEN_LOCATION 235 -#define IDM_SCRIPT_OPEN_DEFAULT 236 -#define IDM_SCRIPT_OPEN_EDITOR 237 +#define IDM_SCRIPT_DETAILS 230 +#define IDM_SCRIPT_FAVOURITE 231 +#define IDM_SCRIPT_HIDE 232 +#define IDM_SCRIPT_NOTE 233 +#define IDM_SCRIPT_RUN_ARGS 234 +#define IDM_SCRIPT_OPEN_LOCATION 235 +#define IDM_SCRIPT_OPEN_DEFAULT 236 +#define IDM_SCRIPT_OPEN_EDITOR 237 /* ------------------------------------------------------------------ */ /* Script details dialog (304, 701–713) */ /* ------------------------------------------------------------------ */ -#define IDD_SCRIPT_DETAILS 304 -#define IDC_DETAIL_NAME 701 -#define IDC_DETAIL_PURPOSE 702 -#define IDC_DETAIL_AUTHOR 703 -#define IDC_DETAIL_VERSION 704 -#define IDC_DETAIL_DATE 705 -#define IDC_DETAIL_CODE 706 -#define IDC_DETAIL_RELEASE 707 -#define IDC_DETAIL_DESC 708 -#define IDC_DETAIL_REQS 709 -#define IDC_DETAIL_NOTE 710 -#define IDC_DETAIL_PATH 711 -#define IDC_CHK_FAVOURITE 712 -#define IDC_CHK_HIDDEN 713 +#define IDD_SCRIPT_DETAILS 304 +#define IDC_DETAIL_NAME 701 +#define IDC_DETAIL_PURPOSE 702 +#define IDC_DETAIL_AUTHOR 703 +#define IDC_DETAIL_VERSION 704 +#define IDC_DETAIL_DATE 705 +#define IDC_DETAIL_CODE 706 +#define IDC_DETAIL_RELEASE 707 +#define IDC_DETAIL_DESC 708 +#define IDC_DETAIL_REQS 709 +#define IDC_DETAIL_NOTE 710 +#define IDC_DETAIL_PATH 711 +#define IDC_CHK_FAVOURITE 712 +#define IDC_CHK_HIDDEN 713 /* ------------------------------------------------------------------ */ /* Run with args dialog (305, 720) */ /* ------------------------------------------------------------------ */ -#define IDD_RUN_ARGS 305 -#define IDC_EDIT_RUN_ARGS 720 +#define IDD_RUN_ARGS 305 +#define IDC_EDIT_RUN_ARGS 720 /* ------------------------------------------------------------------ */ /* Script note dialog (306, 721) */ /* ------------------------------------------------------------------ */ -#define IDD_SCRIPT_NOTE 306 -#define IDC_EDIT_NOTE 721 +#define IDD_SCRIPT_NOTE 306 +#define IDC_EDIT_NOTE 721 /* ------------------------------------------------------------------ */ /* Hidden scripts dialog (307, 730–732) */ /* ------------------------------------------------------------------ */ -#define IDD_HIDDEN_SCRIPTS 307 -#define IDC_LST_HIDDEN 730 -#define IDC_BTN_UNHIDE 731 -#define IDC_BTN_UNHIDE_ALL 732 +#define IDD_HIDDEN_SCRIPTS 307 +#define IDC_LST_HIDDEN 730 +#define IDC_BTN_UNHIDE 731 +#define IDC_BTN_UNHIDE_ALL 732 /* ------------------------------------------------------------------ */ /* Main window — search / filter box (800) */ /* ------------------------------------------------------------------ */ -#define IDC_SEARCH 800 +#define IDC_SEARCH 800 /* ------------------------------------------------------------------ */ /* Settings dialog — tab control and Window tab (415–420) */ /* ------------------------------------------------------------------ */ -#define IDC_TAB_SETTINGS 415 /* tab strip inside settings dialog */ -#define IDC_CHK_ALWAYS_ON_TOP 416 -#define IDC_CHK_MINIMIZE_TRAY 417 -#define IDC_CHK_START_WINDOWS 418 -#define IDC_CHK_START_MIN 419 +#define IDC_TAB_SETTINGS 415 /* tab strip inside settings dialog */ +#define IDC_CHK_ALWAYS_ON_TOP 416 +#define IDC_CHK_MINIMIZE_TRAY 417 +#define IDC_CHK_START_WINDOWS 418 +#define IDC_CHK_START_MIN 419 /* IDC_BTN_RESET = 420 already defined in the Script/Sync block above */ /* ------------------------------------------------------------------ */ /* Settings dialog — Theme radio buttons (421–423) */ /* ------------------------------------------------------------------ */ -#define IDC_RAD_THEME_DARK 421 -#define IDC_RAD_THEME_LIGHT 422 -#define IDC_RAD_THEME_SYSTEM 423 +#define IDC_RAD_THEME_DARK 421 +#define IDC_RAD_THEME_LIGHT 422 +#define IDC_RAD_THEME_SYSTEM 423 /* ------------------------------------------------------------------ */ /* Settings dialog — Sort radio buttons (424–427) */ /* ------------------------------------------------------------------ */ -#define IDC_RAD_SORT_DEFAULT 424 -#define IDC_RAD_SORT_ALPHA 425 -#define IDC_RAD_SORT_DATE 426 -#define IDC_RAD_SORT_USED 427 +#define IDC_RAD_SORT_DEFAULT 424 +#define IDC_RAD_SORT_ALPHA 425 +#define IDC_RAD_SORT_DATE 426 +#define IDC_RAD_SORT_USED 427 /* ------------------------------------------------------------------ */ /* Settings dialog — Quick Bar tab controls (428–433) */ /* ------------------------------------------------------------------ */ -#define IDC_CHK_QBAR_ENABLE 428 -#define IDC_RAD_QBAR_HORIZ 429 -#define IDC_RAD_QBAR_VERT 430 -#define IDC_CHK_QBAR_TOPMOST 431 -#define IDC_EDIT_QBAR_TARGET_S 432 /* title-substring filter field */ -#define IDC_EDIT_QBAR_TARGET_EXE_S 433 /* process exe name filter field */ +#define IDC_CHK_QBAR_ENABLE 428 +#define IDC_RAD_QBAR_HORIZ 429 +#define IDC_RAD_QBAR_VERT 430 +#define IDC_CHK_QBAR_TOPMOST 431 +#define IDC_EDIT_QBAR_TARGET_S 432 /* title-substring filter field */ +#define IDC_EDIT_QBAR_TARGET_EXE_S 433 /* process exe name filter field */ /* ------------------------------------------------------------------ */ /* Settings dialog — groupbox and label controls (450–466) */ /* These are shown/hidden when switching between settings tabs. */ /* ------------------------------------------------------------------ */ -#define IDC_GRP_PYTHON 450 -#define IDC_LBL_PYTHON_PATH 451 -#define IDC_GRP_CACHE 452 -#define IDC_LBL_CACHE_PATH 453 -#define IDC_GRP_TOKEN 454 -#define IDC_GRP_SYNC 455 -#define IDC_LBL_REFRESH1 456 /* "Refresh every" label */ -#define IDC_LBL_REFRESH2 457 /* "hours" label after the spinner */ -#define IDC_GRP_CONSOLE 458 -#define IDC_GRP_WINDOW 459 -#define IDC_GRP_THEME 460 -#define IDC_GRP_SORT 461 -#define IDC_GRP_QBAR_ORI 462 /* orientation group box */ -#define IDC_LBL_QBAR_TARGET 463 -#define IDC_LBL_QBAR_TIP 464 /* hint text below target field */ -#define IDC_LBL_QBAR_TARGET_EXE 465 -#define IDC_LBL_QBAR_EXE_TIP 466 /* hint text below exe field */ +#define IDC_GRP_PYTHON 450 +#define IDC_LBL_PYTHON_PATH 451 +#define IDC_GRP_CACHE 452 +#define IDC_LBL_CACHE_PATH 453 +#define IDC_GRP_TOKEN 454 +#define IDC_GRP_SYNC 455 +#define IDC_LBL_REFRESH1 456 /* "Refresh every" label */ +#define IDC_LBL_REFRESH2 457 /* "hours" label after the spinner */ +#define IDC_GRP_CONSOLE 458 +#define IDC_GRP_WINDOW 459 +#define IDC_GRP_THEME 460 +#define IDC_GRP_SORT 461 +#define IDC_GRP_QBAR_ORI 462 /* orientation group box */ +#define IDC_LBL_QBAR_TARGET 463 +#define IDC_LBL_QBAR_TIP 464 /* hint text below target field */ +#define IDC_LBL_QBAR_TARGET_EXE 465 +#define IDC_LBL_QBAR_EXE_TIP 466 /* hint text below exe field */ /* ------------------------------------------------------------------ */ /* Help window (240–245, 308, 840–842, 102) */ /* ------------------------------------------------------------------ */ -#define IDM_HELP_CONTENTS 240 -#define IDM_REPORT_BUG 241 -#define IDM_WIKI 242 -#define IDM_WIKI_SCRIPTS 243 -#define IDM_CHECK_UPDATES 244 -#define IDM_GITHUB_PAGES 245 -#define IDD_HELP 308 -#define IDC_HELP_TREE 840 -#define IDC_HELP_RICHEDIT 841 -#define IDC_HELP_SEARCH 842 -#define IDI_HELP_ICON 102 +#define IDM_HELP_CONTENTS 240 +#define IDM_REPORT_BUG 241 +#define IDM_WIKI 242 +#define IDM_WIKI_SCRIPTS 243 +#define IDM_CHECK_UPDATES 244 +#define IDM_GITHUB_PAGES 245 +#define IDD_HELP 308 +#define IDC_HELP_TREE 840 +#define IDC_HELP_RICHEDIT 841 +#define IDC_HELP_SEARCH 842 +#define IDI_HELP_ICON 102 /* ------------------------------------------------------------------ */ /* About dialog controls (740–743) */ /* ------------------------------------------------------------------ */ -#define IDC_ABOUT_ICON 740 -#define IDC_ABOUT_TITLE 741 -#define IDC_ABOUT_VER 742 -#define IDC_BTN_ABOUT_GITHUB 743 +#define IDC_ABOUT_ICON 740 +#define IDC_ABOUT_TITLE 741 +#define IDC_ABOUT_VER 742 +#define IDC_BTN_ABOUT_GITHUB 743 /* ------------------------------------------------------------------ */ /* Quick Launch Bar menu commands and settings (250–255) */ /* ------------------------------------------------------------------ */ -#define IDM_QBAR_TOGGLE 250 -#define IDM_QBAR_HORIZONTAL 251 -#define IDM_QBAR_VERTICAL 252 -#define IDM_QBAR_TOPMOST 253 -#define IDM_QBAR_RESET_POS 254 -#define IDM_QBAR_SET_TARGET 255 +#define IDM_QBAR_TOGGLE 250 +#define IDM_QBAR_HORIZONTAL 251 +#define IDM_QBAR_VERTICAL 252 +#define IDM_QBAR_TOPMOST 253 +#define IDM_QBAR_RESET_POS 254 +#define IDM_QBAR_SET_TARGET 255 /* ------------------------------------------------------------------ */ /* Double-click repeat menu commands (256–257) */ /* ------------------------------------------------------------------ */ -#define IDM_REPEAT_MAINAPP 256 /* toggle repeat-on-dblclick for main window */ -#define IDM_REPEAT_QBAR 257 /* toggle repeat-on-dblclick for Quick Bar */ +#define IDM_REPEAT_MAINAPP 256 /* toggle repeat-on-dblclick for main window */ +#define IDM_REPEAT_QBAR 257 /* toggle repeat-on-dblclick for Quick Bar */ /* ------------------------------------------------------------------ */ /* Quick Bar target app dialog (309, 760–762) */ /* ------------------------------------------------------------------ */ -#define IDD_QBAR_TARGET 309 -#define IDC_EDIT_QBAR_TARGET 760 -#define IDC_EDIT_QBAR_TARGET_EXE 761 -#define IDC_BTN_BROWSE_TARGET_EXE 762 +#define IDD_QBAR_TARGET 309 +#define IDC_EDIT_QBAR_TARGET 760 +#define IDC_EDIT_QBAR_TARGET_EXE 761 +#define IDC_BTN_BROWSE_TARGET_EXE 762 /* ------------------------------------------------------------------ */ /* Settings dialog — remaining Quick Bar / Console controls (467–470) */ /* ------------------------------------------------------------------ */ -#define IDC_BTN_BROWSE_QBAR_EXE_S 467 /* browse button for Quick Bar exe field */ -#define IDC_CHK_REPEAT_MAIN 468 /* Console tab: repeat main-window scripts */ -#define IDC_CHK_REPEAT_QBAR 469 /* Quick Bar tab: repeat Quick Bar scripts */ -#define IDC_CHK_OFFLINE_CACHE 470 /* Sync tab: show cached scripts when offline */ +#define IDC_BTN_BROWSE_QBAR_EXE_S 467 /* browse button for Quick Bar exe field */ +#define IDC_CHK_REPEAT_MAIN 468 /* Console tab: repeat main-window scripts */ +#define IDC_CHK_REPEAT_QBAR 469 /* Quick Bar tab: repeat Quick Bar scripts */ +#define IDC_CHK_OFFLINE_CACHE 470 /* Sync tab: show cached scripts when offline */ /* ------------------------------------------------------------------ */ /* Settings dialog — Script Display controls (471–472) */ /* ------------------------------------------------------------------ */ -#define IDC_CHK_TINT_SOURCES 471 /* Window tab: tint local/extra scripts differently */ -#define IDC_GRP_DISPLAY 472 /* Window tab: "Script Display" groupbox */ +#define IDC_CHK_TINT_SOURCES 471 /* Window tab: tint local/extra scripts differently */ +#define IDC_GRP_DISPLAY 472 /* Window tab: "Script Display" groupbox */ /* ------------------------------------------------------------------ */ /* Settings dialog — Import / Export buttons (473–474) */ /* ------------------------------------------------------------------ */ -#define IDC_BTN_EXPORT_SETTINGS 473 /* export settings.ini to a chosen file */ -#define IDC_BTN_IMPORT_SETTINGS 474 /* import settings.ini from a chosen file */ +#define IDC_BTN_EXPORT_SETTINGS 473 /* export settings.ini to a chosen file */ +#define IDC_BTN_IMPORT_SETTINGS 474 /* import settings.ini from a chosen file */ /* ------------------------------------------------------------------ */ /* Settings dialog — Create venv button (484) */ /* ------------------------------------------------------------------ */ -#define IDC_BTN_CREATE_VENV 484 /* create %APPDATA%\CatiaMenuWin32\venv */ -#define IDC_BTN_USE_GLOBAL_PY 485 /* auto-detect global Python; fill path */ -#define IDC_BTN_BROWSE_VENV 486 /* browse for an existing venv folder */ -#define IDC_BTN_DELETE_VENV 487 /* delete %APPDATA%\CatiaMenuWin32\venv */ +#define IDC_BTN_CREATE_VENV 484 /* create %APPDATA%\CatiaMenuWin32\venv */ +#define IDC_BTN_USE_GLOBAL_PY 485 /* auto-detect global Python; fill path */ +#define IDC_BTN_BROWSE_VENV 486 /* browse for an existing venv folder */ +#define IDC_BTN_DELETE_VENV 487 /* delete %APPDATA%\CatiaMenuWin32\venv */ /* ------------------------------------------------------------------ */ /* Settings Transfer dialog (310, 475–483) */ /* Shown before export/import to let the user choose which items to */ /* include. The three ListViews are populated dynamically. */ /* ------------------------------------------------------------------ */ -#define IDD_SETTINGS_TRANSFER 310 -#define IDC_CHK_TRANS_PYTHON 475 /* "Python path" checkbox */ -#define IDC_LBL_TRANS_REPOS 476 /* "Extra Repositories:" label */ -#define IDC_LBL_TRANS_TOKENS 477 /* "Tokens:" label */ -#define IDC_LBL_TRANS_DIRS 478 /* "Local Folders:" label */ -#define IDC_LST_TRANS_REPOS 479 /* ListView — extra repos with per-item checkboxes */ -#define IDC_LST_TRANS_DIRS 480 /* ListView — local dirs with per-item checkboxes */ -#define IDC_CHK_TRANS_CACHE 481 /* "Cache folder" checkbox */ -#define IDC_CHK_TRANS_OPTIONS 482 /* "Options, theme, window & Quick Bar" checkbox */ -#define IDC_LST_TRANS_TOKENS 483 /* ListView — tokens with per-item checkboxes */ +#define IDD_SETTINGS_TRANSFER 310 +#define IDC_CHK_TRANS_PYTHON 475 /* "Python path" checkbox */ +#define IDC_LBL_TRANS_REPOS 476 /* "Extra Repositories:" label */ +#define IDC_LBL_TRANS_TOKENS 477 /* "Tokens:" label */ +#define IDC_LBL_TRANS_DIRS 478 /* "Local Folders:" label */ +#define IDC_LST_TRANS_REPOS 479 /* ListView — extra repos with per-item checkboxes */ +#define IDC_LST_TRANS_DIRS 480 /* ListView — local dirs with per-item checkboxes */ +#define IDC_CHK_TRANS_CACHE 481 /* "Cache folder" checkbox */ +#define IDC_CHK_TRANS_OPTIONS 482 /* "Options, theme, window & Quick Bar" checkbox */ +#define IDC_LST_TRANS_TOKENS 483 /* ListView — tokens with per-item checkboxes */ #endif /* RESOURCE_H */