mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-10-08 08:10:26 -04:00
2.3 KiB
2.3 KiB
Plan: Split AppFrame.cpp
See also: RECOMMENDATIONS.md | PLAN.md | Architecture Overview
Current State
AppFrame.cpp: 3,202 lines in a single fileAppFrame.h: 389 lines- Handles menus, keyboard, device management, UI layout, hamlib, sessions, idle handlers, and accessors
Implementation Plan
Split into 5 compilation units (same class, multiple .cpp files — no header changes needed):
| New File | Content | ~Lines |
|---|---|---|
AppFrame.cpp (kept) |
Constructor, destructor, init*, make* factory methods, OnClose, OnNewWindow, splitter events, accessors, utilities | ~1,030 |
AppFrame_Menus.cpp |
OnMenu, all 19 actionOnMenu* methods, makeFileMenu, makeDisplayMenu, makeAudioSampleRateMenu, makeRecordingMenu, updateRecordingMenu, getSettingsLabel |
~900 |
AppFrame_Handlers.cpp |
OnIdle, all 12 handle* methods, handleUpdateDeviceParams |
~710 |
AppFrame_Keyboard.cpp |
OnGlobalKeyDown, OnGlobalKeyUp, gkNudge, toggleActiveDemodRecording, toggleAllActiveDemodRecording |
~334 |
AppFrame_Hamlib.cpp |
All #ifdef USE_HAMLIB methods: makeRigMenu, enableRig, disableRig, setRigControlPort, dismissRigControlPortDialog, actionOnMenuRig, handleRigMenu |
~301 |
Steps
- Create the 4 new
.cppfiles, each includingAppFrame.h. - Move the method implementations (not declarations) to the new files.
- Update
CMakeLists.txtto add the new source files tocubicsdr_sources. - Build and verify no regressions.
- This is a low-risk change — the header stays the same, only the implementation is split across compilation units.
Verification Criteria
cmake --build buildsucceeds with the 4 new.cppfiles in the source list.- Application starts and all menu items, keyboard shortcuts, idle handlers, and hamlib functions work identically.
- No linker errors (each method appears in exactly one
.cppfile). AppFrame.cppis reduced to approximately 1,030 lines.
Files to Create/Modify
| File | Action |
|---|---|
src/AppFrame_Menus.cpp |
Create |
src/AppFrame_Handlers.cpp |
Create |
src/AppFrame_Keyboard.cpp |
Create |
src/AppFrame_Hamlib.cpp |
Create |
src/AppFrame.cpp |
Remove moved methods |
CMakeLists.txt |
Add new source files |