Skip to content

Developer Guide

KaiUR edited this page May 7, 2026 · 13 revisions

Developer Guide

Prerequisites

  • Qt Creator with Desktop Qt 6.x MinGW 64-bit kit
  • MinGW-w64 GCC 13+ (bundled with Qt)
  • CMake 3.16+ (bundled with Qt)
  • Ninja build system (bundled with Qt)
  • Git

Building

git clone https://github.com/KaiUR/CatiaMenuWin32
cd CatiaMenuWin32

Open CMakeLists.txt in Qt Creator, select the Desktop Qt MinGW 64-bit kit and click Build.

Or from the command line:

mkdir build && cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
ninja

Project Structure

src/         C source and header files
res/         Resource files (icons, manifest, resource.rc.in, version.h.in)
docs/        GitHub Pages documentation
.github/     GitHub Actions workflows and issue templates

Key Source Files

File Purpose
main.c / main.h Entry point, WndProc, AppState struct
window.c Window creation, menu, toolbar, layout
tabs.c Custom tab bar, script buttons, filter
paint.c GDI painting, script button rendering, tooltips
sync.c GitHub sync thread, manifest, offline cache
github.c HTTPS requests, JSON parsing, SHA verification
runner.c Script execution, Python detection
meta.c Script header metadata parsing
settings.c Settings load/save, Settings dialog
sources.c Script Sources dialog
prefs.c Favourites, hidden scripts, notes, run counts
help.c In-app help window
updater.c Update checker and auto-update

Versioning

  • Version is determined from the latest Git tag at CMake configure time
  • build_number.txt increments by 2 for local builds, 1 for CI builds
  • Local builds are always one build number ahead of the latest release
  • CI workflow: tag push → build → release → commit build_number.txt back to main

Releasing

  1. Develop on develop branch
  2. Open a pull request to main
  3. Merge the PR
  4. Tag from main: git tag v1.x.x && git push origin v1.x.x
  5. GitHub Actions builds and creates the release automatically

Code Style

  • C11, Win32 API only — no external libraries
  • Unicode throughout — WCHAR, L"" literals, _snwprintf_s
  • Bounds-safe string ops — always wcsncpy/wcsncat with explicit limits; never wcscpy/wcscat
  • Safe formatted output — always _snwprintf_s with _TRUNCATE; never raw sprintf/swprintf
  • All GDI painting double-buffered
  • All state in global AppState g struct
  • Heap memory for scripts — use Folder_Alloc / Folder_Free / Folder_Push helpers; always free on every exit path
  • Use COL_BG(), COL_TEXT() etc. — never hardcode RGB values
  • Cross-thread communication via PostMessage only

Clone this wiki locally