XRC File Editor
  • C++ 98.7%
  • CMake 1%
  • Batchfile 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-08 15:45:40 -08:00
samples First Commit 2026-10-20 21:51:13 -07:00
src Pushing to go back to Linux 2026-11-08 15:45:40 -08:00
.gitignore First Commit 2026-10-20 21:51:13 -07:00
build.cmd First Commit 2026-10-20 21:51:13 -07:00
CMakeLists.txt Pushing to go back to Linux 2026-11-08 15:45:40 -08:00
LICENSE-2.0.txt First Commit 2026-10-20 21:51:13 -07:00
README.md First Commit 2026-10-20 21:51:13 -07:00
run.cmd First Commit 2026-10-20 21:51:13 -07:00

XRC Editor

A Resource Hacker style editor for wxWidgets XRC resource files, written in C++ with wxWidgets 3.3.

  • Design view (WYSIWYG): the selected resource is loaded as its real wxWidgets controls. Dialogs and frames are shown inside drawn window chrome, with the frame's menu bar, toolbar and status bar. In the design view you can:

    • click a control to select it (synced with the tree and properties);
    • drag it to a new place: a blue marker shows where it will land, before or after a sibling, or inside a container, following the sizer layout;
    • double-click a label, button text, menu item, notebook tab or dialog title to edit it in place;
    • right-click for the object menu.

    Menus, menu bars and toolbars have drawn designers you can click through.

  • Toolbox: click a class, then click in the design to place it (hold Shift to place several, Esc cancels). Double-click a class to add it at the selection.

  • Layout menu (also on right-click): Expand, Stretch, horizontal and vertical alignment, border sides and border width for the selected sizer item.

  • Resource tree: resources grouped into Dialogs, Frames, Panels, Menu Bars, Menus, Tool Bars, Bitmaps and Icons, with each object's controls and sizers underneath. Sizer items and notebook pages are folded into the control they hold.

  • Script editor: the XML of the selected resource (or the whole file, under View), with syntax highlighting and folding. Edit it and press F5 / Compile Script to apply.

  • Property grid: typed editors for every known XRC property: style and sizer flags pickers, colours, fonts, bitmaps (stock art or files), item lists, and the sizer item or page settings that wrap the control. Right-click a row to remove a property or add a custom one.

  • Live preview (F6): the resource is loaded by wxWidgets' own wxXmlResource, so you see the real window. The selected control is outlined in red. Click a control in the preview to select it. XRC load errors appear in the Messages pane.

  • Test (F7) runs a dialog modally, exactly as your application would.

  • Editing: New resource from templates, Add Control (palette of sizers, controls, pickers, containers, menu and toolbar items), Cut/Copy/Paste (as XRC XML on the clipboard), Duplicate, Delete, Rename, Move Up/Down, and drag and drop in the tree. Undo/redo covers everything.

  • XRC format coverage follows the wxWidgets XRC format reference:

    • Classes: standard controls, pickers, books (including wxToolbook), wxBannerWindow, wxInfoBar, wxBitmapToggleButton, wxEditableListBox, wxFileCtrl, wxOwnerDrawnComboBox and wxSimpleHtmlListBox. Also wxPropertySheetDialog, wxWizard (pages), the MDI frames, wxAuiManager/wxAuiPaneInfo, wxAuiToolBar, wxPropertyGrid, and the wxRibbon family (bar, page, panel, button bar, gallery).
    • Property types:
      • fonts with sysfont/inherit/relativesize;
      • ownfg/ownbg/ownfont;
      • colours with |dark: variants;
      • SVG bitmaps with default_size, and multi-resolution a.png;a_2x.png;
      • presence elements such as <dock/>;
      • extra-accels;
      • the button bitmap states.
    • Object attributes: platform and feature are editable on every object.
    • Check All Resources also applies the format's rules:
      • grid-bag items need cellpos/cellspan;
      • a tool can be only one of radio, toggle or dropdown;
      • SVG bitmaps need default_size;
      • platform must name a known platform;
      • plus required bitmaps, menu labels and splitter limits.
  • Import resources from another XRC file, export one resource, and Check All Resources (load errors, duplicate names).

  • Faithful saving: an unedited file saves byte for byte, and an edit changes only the lines it touches. The original declaration, CRLF line endings, mixed tab/space indentation, blank lines, comment placement and <x /> vs <x></x> forms are all kept. Saving also writes a one-time .bak of the original.

Build

Requires MSYS2 with the UCRT64 toolchain, CMake, Ninja and wxWidgets 3.3 (mingw-w64-ucrt-x86_64-wxwidgets3.3-msw, mingw-w64-ucrt-x86_64-cmake, mingw-w64-ucrt-x86_64-ninja). The build uses wxWidgets' own CMake package (find_package(wxWidgets CONFIG)).

build.cmd           :: configure (first time) and build build\xrceditor.exe
build.cmd test      :: build and run the tests with CTest
build.cmd dist      :: copy the exe and every DLL it needs into dist\ (runs without MSYS2)
build.cmd clean     :: remove build outputs
run.cmd sample.xrc  :: run build\xrceditor.exe with MSYS2's DLLs on PATH

From a UCRT64 shell the usual CMake commands work too:

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release   # or Debug
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install build --prefix dist

Tests

xrceditor --selftest <file.xrc> <report.txt> drives the real editor through its commands. It covers:

  • add control, undo/redo, copy/paste, duplicate, delete, move, rename and drag-move;
  • script compile (valid, invalid and whole file);
  • new-resource templates and adding every palette class;
  • preview loading, click-to-select, and a save round trip;
  • the design view: hit testing, drag-moves, toolbox placement, in-place edits, Layout commands, and the menu and toolbar designers;
  • the XRC-format additions: AUI, ribbon, property sheets, wizards and validation.

It saves roundtrip.xrc and edited.xrc next to the report, so run it on a copy of samples/sample.xrc; CTest does that for you.

xrceditor --verify <file.xrc> <report.txt> checks that a real file round-trips: a byte-identical save, formatting kept through undo and script compile, one-line diffs for one-line edits, and every resource loading in both the preview and the design view. The file itself is only read. To include it in CTest, configure with -DXRCEDITOR_VERIFY_FILE=path/to/file.xrc.

xrceditor <file.xrc> --select Resource[/Control] opens a file with that object selected.

Source layout

File Purpose
src/Schema.* Known XRC classes: properties, styles, defaults, categories
src/XrcModel.* wxXmlDocument helpers: structure, properties, containment rules, serialisation
src/MainFrame.* Main window, tree, script editor, commands, undo
src/PropertyPanel.* Property grid and custom property editors
src/DesignView.* WYSIWYG design surface: hit testing, drag/drop, placement, in-place edits
src/XrcLoader.* Private wxXmlResource loading, log capture, outline overlays
src/Preview.* Floating preview window, test and check