Rename FDesigner/cfree to LightGUI (binary lightgui, all docs)

This commit is contained in:
cnmcdee committed 2026-11-29 03:35:48 +00:00
1 parent 115a3a2772
commit 800883b024
52 files changed
+353 -353

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
fdesigner lightgui
*.o *.o
tests/gen_matrix tests/gen_matrix
tests/debugger/work/ tests/debugger/work/
+14 -14
View File
@@ -1,9 +1,9 @@
# FDesigner — C++/GTK conversion design # LightGUI — C++/GTK conversion design
## What we're building ## What we're building
A C++ rebuild of the author's fdesigner (Tkinter Rapid Designer). The original is a A C++ rebuild of the author's lightgui (Tkinter Rapid Designer). The original is a
~7,000-line Python/Tkinter app (`original/tkinter_designer/fdesigner7.py`): ~7,000-line Python/Tkinter app (`original/tkinter_designer/lightgui7.py`):
place widgets on a canvas at absolute positions, edit their properties, then place widgets on a canvas at absolute positions, edit their properties, then
generate runnable source code for the layout. generate runnable source code for the layout.
@@ -113,7 +113,7 @@ has old .pkl designs to keep, a one-off Python converter script
widget (drawing area) support. widget (drawing area) support.
**Status 2026-11-25: all five phases built and verified.** The self-test **Status 2026-11-25: all five phases built and verified.** The self-test
(`FDESIGNER_SELFTEST=1 ./fdesigner`) exercises placement, properties, bulk (`LIGHTGUI_SELFTEST=1 ./lightgui`) exercises placement, properties, bulk
ops, generation, save/load round-trips, and the Phase 5 extras; generated ops, generation, save/load round-trips, and the Phase 5 extras; generated
projects compile with their own Makefile and run. Known v1 limits: projects compile with their own Makefile and run. Known v1 limits:
designing *inside* a Toplevel or a generated menu's submenus is not designing *inside* a Toplevel or a generated menu's submenus is not
@@ -225,7 +225,7 @@ and wheel zoom, in both the designer preview and generated code.
- `original/` — the Python source, read-only reference (do not run it here). - `original/` — the Python source, read-only reference (do not run it here).
- `ui/designer.ui` — the designer's own main window (Glade). - `ui/designer.ui` — the designer's own main window (Glade).
- `src/main.cpp` — entry point; loads the .ui via GtkBuilder. - `src/main.cpp` — entry point; loads the .ui via GtkBuilder.
- `Makefile` — builds `./fdesigner`. - `Makefile` — builds `./lightgui`.
## Stepping debugger (GDB/MI) ## Stepping debugger (GDB/MI)
@@ -238,7 +238,7 @@ panel in the main window). It drives real gdb over the MI protocol
- **Breakpoints:** type `file.cpp:123` or a function name and press Add BP; - **Breakpoints:** type `file.cpp:123` or a function name and press Add BP;
the list shows id / location / enabled toggle / hit count. Enable/disable the list shows id / location / enabled toggle / hit count. Enable/disable
via the toggle, Remove deletes. Breakpoints are saved to via the toggle, Remove deletes. Breakpoints are saved to
`~/.config/fdesigner/debugger_bps.conf` and restored on the next run. `~/.config/lightgui/debugger_bps.conf` and restored on the next run.
- **Variables:** Locals (name / type / value) and a watch list (add any - **Variables:** Locals (name / type / value) and a watch list (add any
expression, e.g. `sum + 1`) refresh on every stop; the Stack pane shows expression, e.g. `sum + 1`) refresh on every stop; the Stack pane shows
the current frames, and the status line shows the stopped file:line and the current frames, and the status line shows the stopped file:line and
@@ -246,7 +246,7 @@ panel in the main window). It drives real gdb over the MI protocol
- **Settings:** the Settings toolbar button, **Debug → Debugger Settings…**, - **Settings:** the Settings toolbar button, **Debug → Debugger Settings…**,
and the **Debug → Debugger** sub-menu (which also has Break on main / and the **Debug → Debugger** sub-menu (which also has Break on main /
Stop on entry / Pretty-print values toggles). Settings live in Stop on entry / Pretty-print values toggles). Settings live in
`~/.config/fdesigner/debugger.conf`: `gdb_path`, `break_on_main`, `~/.config/lightgui/debugger.conf`: `gdb_path`, `break_on_main`,
`stop_on_entry`, `pretty_print`, `print_all_locals`, `default_args`. `stop_on_entry`, `pretty_print`, `print_all_locals`, `default_args`.
They take effect on the next Run (pretty-printing is applied when the They take effect on the next Run (pretty-printing is applied when the
gdb session starts). The same settings are honoured by the backend gdb session starts). The same settings are honoured by the backend
@@ -284,8 +284,8 @@ The logic lives in new files `src/cmake_build.h/.cpp`
`CMakeSettings`); the generator only gains the emit call, `main.cpp` `CMakeSettings`); the generator only gains the emit call, `main.cpp`
only the menu callbacks, and `ui/designer.ui` the three File-menu items. only the menu callbacks, and `ui/designer.ui` the three File-menu items.
Settings (cmake command, generator — empty = CMake default, build type, Settings (cmake command, generator — empty = CMake default, build type,
build directory) persist in `~/.config/fdesigner/cmake.conf` (key=value, build directory) persist in `~/.config/lightgui/cmake.conf` (key=value,
same pattern as `debugger.conf`; `FDESIGNER_CMAKE_CONF` overrides the same pattern as `debugger.conf`; `LIGHTGUI_CMAKE_CONF` overrides the
path for tests) and are edited via **File → CMake Settings…**. path for tests) and are edited via **File → CMake Settings…**.
Tests: `tests/cmake_tests.sh` builds a headless probe Tests: `tests/cmake_tests.sh` builds a headless probe
@@ -344,8 +344,8 @@ automatically via `kTypes`.
**Edit → Preferences…** opens a font dialog (interface font + code / **Edit → Preferences…** opens a font dialog (interface font + code /
text-view font, via GtkFontButton). Choices persist in text-view font, via GtkFontButton). Choices persist in
`~/.config/fdesigner/settings.conf` (`font=`, `code_font=`, Pango `~/.config/lightgui/settings.conf` (`font=`, `code_font=`, Pango
descriptions; `FDESIGNER_SETTINGS_CONF` overrides the path for tests) and descriptions; `LIGHTGUI_SETTINGS_CONF` overrides the path for tests) and
are applied live at startup and on Apply: the interface font via a are applied live at startup and on Apply: the interface font via a
screen-wide CSS provider, the code font via a `textview` CSS rule (so screen-wide CSS provider, the code font via a `textview` CSS rule (so
Text/Memo views and any other GtkTextView use it). Invalid sizes are Text/Memo views and any other GtkTextView use it). Invalid sizes are
@@ -370,8 +370,8 @@ Color themes (`src/theme.h/.cpp`): four built-ins — Light, Dark, Monokai,
Solarized Dark — colouring keywords, types, strings, comments, numbers, Solarized Dark — colouring keywords, types, strings, comments, numbers,
preprocessor lines, background/foreground and the current line. View -> preprocessor lines, background/foreground and the current line. View ->
Color Theme... opens the picker (built-in combo + per-role colour buttons); Color Theme... opens the picker (built-in combo + per-role colour buttons);
the choice persists to `~/.config/fdesigner/theme.conf` the choice persists to `~/.config/lightgui/theme.conf`
(`FDESIGNER_THEME_CONF` overrides). Deliberately separate from the (`LIGHTGUI_THEME_CONF` overrides). Deliberately separate from the
font-settings branch's `settings.conf` / Preferences dialog so the two font-settings branch's `settings.conf` / Preferences dialog so the two
merge cleanly; a later pass can move the picker into Preferences. merge cleanly; a later pass can move the picker into Preferences.
Gotcha: GTK 3.20+ draws the text area from the `text` subnode, so the Gotcha: GTK 3.20+ draws the text area from the `text` subnode, so the
@@ -399,5 +399,5 @@ and unbalanced, visible lines, widget-level fold/gutter/current-line,
real gutter->debugger toggle with HOME redirected) + self-test Phase 8 + real gutter->debugger toggle with HOME redirected) + self-test Phase 8 +
xdotool smoke tests for the Code View window and the theme dialog. xdotool smoke tests for the Code View window and the theme dialog.
A live xdotool gutter click on the real app set A live xdotool gutter click on the real app set
`/tmp/fdesigner_codeview/MyWindow.cpp:6|1` in the persisted bps file, and `/tmp/lightgui_codeview/MyWindow.cpp:6|1` in the persisted bps file, and
a fold click collapsed the constructor body (lines 7-20 hidden, 6 -> 21). a fold click collapsed the constructor body (lines 7-20 hidden, 6 -> 21).
+2 -2
View File
@@ -3,7 +3,7 @@ CXXFLAGS ?= -O2 -Wall -Wextra -std=c++17
GTKFLAGS := $(shell pkg-config --cflags gtk+-3.0) GTKFLAGS := $(shell pkg-config --cflags gtk+-3.0)
GTKLIBS := $(shell pkg-config --libs gtk+-3.0) GTKLIBS := $(shell pkg-config --libs gtk+-3.0)
fdesigner: src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp src/model.h src/props.h src/events.h src/generator.h src/cmake_build.h src/project_io.h src/debugger.h src/debugger_ui.h src/preferences.h src/theme.h src/codeview.h src/indicators.h src/indicators_embedded.h src/drawings.h src/drawings_embedded.h ui/designer.ui lightgui: src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp src/model.h src/props.h src/events.h src/generator.h src/cmake_build.h src/project_io.h src/debugger.h src/debugger_ui.h src/preferences.h src/theme.h src/codeview.h src/indicators.h src/indicators_embedded.h src/drawings.h src/drawings_embedded.h ui/designer.ui
$(CXX) $(CXXFLAGS) -o $@ src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp $(GTKFLAGS) $(GTKLIBS) $(CXX) $(CXXFLAGS) -o $@ src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp $(GTKFLAGS) $(GTKLIBS)
src/indicators_embedded.h: src/indicators.h tools/embed_indicators.sh src/indicators_embedded.h: src/indicators.h tools/embed_indicators.sh
sh tools/embed_indicators.sh src/indicators.h $@ sh tools/embed_indicators.sh src/indicators.h $@
@@ -12,6 +12,6 @@ src/drawings_embedded.h: src/drawings.h tools/embed_drawings.sh
sh tools/embed_drawings.sh src/drawings.h $@ sh tools/embed_drawings.sh src/drawings.h $@
clean: clean:
rm -f fdesigner rm -f lightgui
.PHONY: clean .PHONY: clean
+10 -10
View File
@@ -1,11 +1,11 @@
# FDesigner — a visual GUI designer in C++/GTK # LightGUI — a visual GUI designer in C++/GTK
FDesigner is a visual designer for building GTK 3 applications in C++. Place LightGUI is a visual designer for building GTK 3 applications in C++. Place
widgets on a canvas at absolute positions, edit their properties, then widgets on a canvas at absolute positions, edit their properties, then
generate runnable C++/GTK source code — a `.ui` layout file plus a C++ class generate runnable C++/GTK source code — a `.ui` layout file plus a C++ class
with stub signal handlers, ready to fill in and build. with stub signal handlers, ready to fill in and build.
It is a C++ rebuild of the author's `fdesigner` (Tkinter Rapid Designer), a It is a C++ rebuild of the author's `lightgui` (Tkinter Rapid Designer), a
~7,000-line Python/Tkinter app. The C++ version generates C++/GTK code, not ~7,000-line Python/Tkinter app. The C++ version generates C++/GTK code, not
Tkinter Python, and its own UI is GTK as well, defined in Glade `.ui` files. Tkinter Python, and its own UI is GTK as well, defined in Glade `.ui` files.
No Qt anywhere. No Qt anywhere.
@@ -48,7 +48,7 @@ No Qt anywhere.
## Requirements ## Requirements
FDesigner builds and runs on Linux with GTK 3. This section assumes a LightGUI builds and runs on Linux with GTK 3. This section assumes a
**bare system** — a fresh ParrotOS (or Debian/Ubuntu) install with nothing **bare system** — a fresh ParrotOS (or Debian/Ubuntu) install with nothing
yet installed. One command installs the compiler and everything else; you yet installed. One command installs the compiler and everything else; you
do not need anything beforehand, not even `make` or a C++ compiler. do not need anything beforehand, not even `make` or a C++ compiler.
@@ -61,7 +61,7 @@ sudo apt update && sudo apt install build-essential pkg-config libgtk-3-dev glad
That single command is the complete toolchain from scratch: the compiler, That single command is the complete toolchain from scratch: the compiler,
the build tools, GTK 3, and every feature dependency. Nothing else is the build tools, GTK 3, and every feature dependency. Nothing else is
required to build and run FDesigner. required to build and run LightGUI.
What each package is for: What each package is for:
@@ -132,7 +132,7 @@ Each distro below was verified end to end in its own LXC container
(images from images.linuxcontainers.org, 4 CPU cores, 15 GB RAM, 30 GB (images from images.linuxcontainers.org, 4 CPU cores, 15 GB RAM, 30 GB
disk, SSH verified from the host): update/upgrade, install the toolchain disk, SSH verified from the host): update/upgrade, install the toolchain
with the distro's own package manager, `git clone` this repo, `make` — with the distro's own package manager, `git clone` this repo, `make` —
and the `fdesigner` binary was produced. Run the script for your distro and the `lightgui` binary was produced. Run the script for your distro
as root, or with `sudo` (`sudo bash install-ubuntu.sh`). as root, or with `sudo` (`sudo bash install-ubuntu.sh`).
| Distro | Version tested | Script | gtk+-3.0 | Notes | | Distro | Version tested | Script | gtk+-3.0 | Notes |
@@ -156,18 +156,18 @@ normal desktop install `git clone` just works.
```sh ```sh
make make
./fdesigner ./lightgui
``` ```
That is the whole build: one `g++` invocation driven by a plain Makefile, That is the whole build: one `g++` invocation driven by a plain Makefile,
using `pkg-config --cflags --libs gtk+-3.0`. No configure step, no using `pkg-config --cflags --libs gtk+-3.0`. No configure step, no
external build system for FDesigner itself. `make clean` removes the external build system for LightGUI itself. `make clean` removes the
binary. binary.
To open an existing design, pass its `.fdj` file: To open an existing design, pass its `.fdj` file:
```sh ```sh
./fdesigner mywindow.fdj ./lightgui mywindow.fdj
``` ```
## Using the designer ## Using the designer
@@ -192,7 +192,7 @@ cmake -S . -B build && cmake --build build
**Debugger:** Debug → Open Debugger… runs any program compiled with `-g`. **Debugger:** Debug → Open Debugger… runs any program compiled with `-g`.
Add a breakpoint as `file.cpp:123` or a function name, press Run, and step Add a breakpoint as `file.cpp:123` or a function name, press Run, and step
through it. Breakpoints and debugger settings live under through it. Breakpoints and debugger settings live under
`~/.config/fdesigner/`. `~/.config/lightgui/`.
## Tests ## Tests
+5 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# install-arch.sh — build cfree (FDesigner) on Arch Linux # install-arch.sh — build lightgui (LightGUI) on Arch Linux
# Tested 2026-11-28 in LXC container cfree-arch (archlinux current, amd64, IP 10.0.3.50). # Tested 2026-11-28 in LXC container lightgui-arch (archlinux current, amd64, IP 10.0.3.50).
# Run as root (or prefix pacman commands with sudo) on a fresh system. # Run as root (or prefix pacman commands with sudo) on a fresh system.
# Gotcha: the LXC Arch image ships with an empty pacman keyring, so package # Gotcha: the LXC Arch image ships with an empty pacman keyring, so package
# signatures fail ("unknown trust") until you run pacman-key --init and # signatures fail ("unknown trust") until you run pacman-key --init and
@@ -11,7 +11,7 @@ pacman-key --init
pacman-key --populate archlinux pacman-key --populate archlinux
pacman -Syu --noconfirm pacman -Syu --noconfirm
pacman -S --noconfirm --needed git base-devel pkgconf gtk3 glade cmake gdb xorg-server-xvfb python pacman -S --noconfirm --needed git base-devel pkgconf gtk3 glade cmake gdb xorg-server-xvfb python
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+5 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# install-debian.sh — build cfree (FDesigner) on Debian GNU/Linux 13 (trixie) # install-debian.sh — build lightgui (LightGUI) on Debian GNU/Linux 13 (trixie)
# Tested 2026-11-28 in LXC container cfree-debian (debian trixie, amd64, IP 10.0.3.128). # Tested 2026-11-28 in LXC container lightgui-debian (debian trixie, amd64, IP 10.0.3.128).
# Run as root (or prefix apt commands with sudo) on a fresh system. # Run as root (or prefix apt commands with sudo) on a fresh system.
# Requires: internet access, git (installed below if missing). # Requires: internet access, git (installed below if missing).
set -e set -e
@@ -8,7 +8,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get upgrade -y apt-get upgrade -y
apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3 apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+5 -5
View File
@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# install-fedora.sh — build cfree (FDesigner) on Fedora Linux 43 (Container Image) # install-fedora.sh — build lightgui (LightGUI) on Fedora Linux 43 (Container Image)
# Tested 2026-11-28 in LXC container cfree-fedora (fedora 43, amd64, IP 10.0.3.133). # Tested 2026-11-28 in LXC container lightgui-fedora (fedora 43, amd64, IP 10.0.3.133).
# Run as root (or prefix dnf commands with sudo) on a fresh system. # Run as root (or prefix dnf commands with sudo) on a fresh system.
set -e set -e
dnf update -y dnf update -y
dnf install -y git gcc gcc-c++ make pkg-config gtk3-devel glade cmake gdb xorg-x11-server-Xvfb python3 dnf install -y git gcc gcc-c++ make pkg-config gtk3-devel glade cmake gdb xorg-x11-server-Xvfb python3
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+5 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# install-mint.sh — build cfree (FDesigner) on Linux Mint 22.3 # install-mint.sh — build lightgui (LightGUI) on Linux Mint 22.3
# Tested 2026-11-28 in LXC container cfree-mint (mint zena, amd64, IP 10.0.3.200). # Tested 2026-11-28 in LXC container lightgui-mint (mint zena, amd64, IP 10.0.3.200).
# Run as root (or prefix apt commands with sudo) on a fresh system. # Run as root (or prefix apt commands with sudo) on a fresh system.
# Requires: internet access, git (installed below if missing). # Requires: internet access, git (installed below if missing).
set -e set -e
@@ -8,7 +8,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get upgrade -y apt-get upgrade -y
apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3 apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+6 -6
View File
@@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
# install-parrot.sh — build cfree (FDesigner) on ParrotOS (Debian 13 / trixie based). # install-parrot.sh — build lightgui (LightGUI) on ParrotOS (Debian 13 / trixie based).
# Tested 2026-11-28 in LXC container cfree-parrot. NOTE: there is no native # Tested 2026-11-28 in LXC container lightgui-parrot. NOTE: there is no native
# Parrot LXC image on images.linuxcontainers.org, so the test ran on Parrot's # Parrot LXC image on images.linuxcontainers.org, so the test ran on Parrot's
# parent, Debian 13 (trixie), amd64, IP 10.0.3.9. The same apt commands apply # parent, Debian 13 (trixie), amd64, IP 10.0.3.9. The same apt commands apply
# on real ParrotOS; the plain install below worked on the stand-in. # on real ParrotOS; the plain install below worked on the stand-in.
# Result on stand-in: clean build, fdesigner binary produced, gtk+-3.0 3.24.49. # Result on stand-in: clean build, lightgui binary produced, gtk+-3.0 3.24.49.
# Real-Parrot gotcha (from the author's own ParrotOS machine, NOT reproduced # Real-Parrot gotcha (from the author's own ParrotOS machine, NOT reproduced
# in the container): if `apt install libgtk-3-dev` fails with a dependency # in the container): if `apt install libgtk-3-dev` fails with a dependency
# conflict (newer ATK runtimes vs older -dev packages), prefer the backports # conflict (newer ATK runtimes vs older -dev packages), prefer the backports
@@ -16,7 +16,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get upgrade -y apt-get upgrade -y
apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3 apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+6 -6
View File
@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# install-ubuntu.sh — build cfree (FDesigner) on Ubuntu 24.04 LTS (noble). # install-ubuntu.sh — build lightgui (LightGUI) on Ubuntu 24.04 LTS (noble).
# Tested 2026-11-28 in LXC container cfree-ubuntu (Ubuntu 24.04.5 LTS, amd64). # Tested 2026-11-28 in LXC container lightgui-ubuntu (Ubuntu 24.04.5 LTS, amd64).
# Run as root (or prefix the apt commands with sudo) on a fresh system. # Run as root (or prefix the apt commands with sudo) on a fresh system.
# Result: clean build, fdesigner binary produced, gtk+-3.0 3.24.41. # Result: clean build, lightgui binary produced, gtk+-3.0 3.24.41.
# Gotcha: none — the plain one-line install from the README works as-is on # Gotcha: none — the plain one-line install from the README works as-is on
# a fresh minimal Ubuntu 24.04. No backports flag or extra step was needed. # a fresh minimal Ubuntu 24.04. No backports flag or extra step was needed.
set -e set -e
@@ -10,7 +10,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get upgrade -y apt-get upgrade -y
apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3 apt-get install -y git build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3
git clone https://github.com/cnmcdee/cfree.git git clone https://github.com/cnmcdee/lightgui.git
cd cfree cd lightgui
make make
ls -l fdesigner ls -l lightgui
+5 -5
View File
@@ -1,4 +1,4 @@
// FDesigner CMake handling — see cmake_build.h. // LightGUI CMake handling — see cmake_build.h.
#include "cmake_build.h" #include "cmake_build.h"
#include <cstdio> #include <cstdio>
@@ -17,9 +17,9 @@ static std::string home_dir() {
} }
std::string CMakeSettings::default_path() { std::string CMakeSettings::default_path() {
const char* e = std::getenv("FDESIGNER_CMAKE_CONF"); const char* e = std::getenv("LIGHTGUI_CMAKE_CONF");
if (e && *e) return e; if (e && *e) return e;
return home_dir() + "/.config/fdesigner/cmake.conf"; return home_dir() + "/.config/lightgui/cmake.conf";
} }
static bool ensure_parent_dir(const std::string& path) { static bool ensure_parent_dir(const std::string& path) {
@@ -42,7 +42,7 @@ bool CMakeSettings::save(const std::string& path) const {
ensure_parent_dir(p); ensure_parent_dir(p);
std::ofstream f(p); std::ofstream f(p);
if (!f) return false; if (!f) return false;
f << "# FDesigner CMake settings\n"; f << "# LightGUI CMake settings\n";
f << "cmake_path=" << cmake_path << "\n"; f << "cmake_path=" << cmake_path << "\n";
f << "generator=" << generator << "\n"; f << "generator=" << generator << "\n";
f << "build_type=" << build_type << "\n"; f << "build_type=" << build_type << "\n";
@@ -79,7 +79,7 @@ bool CMakeSettings::load(const std::string& path) {
std::string cmake_lists_text(const std::string& project_name, std::string cmake_lists_text(const std::string& project_name,
const std::vector<std::string>& sources) { const std::vector<std::string>& sources) {
std::ostringstream o; std::ostringstream o;
o << "# Generated by FDesigner (C++/GTK). Build with:\n" o << "# Generated by LightGUI (C++/GTK). Build with:\n"
<< "# cmake -S . -B build && cmake --build build\n" << "# cmake -S . -B build && cmake --build build\n"
<< "# (or use File -> Build with CMake in the designer).\n" << "# (or use File -> Build with CMake in the designer).\n"
<< "cmake_minimum_required(VERSION 3.10)\n" << "cmake_minimum_required(VERSION 3.10)\n"
+4 -4
View File
@@ -1,9 +1,9 @@
// FDesigner CMake handling — no GTK dependency. // LightGUI CMake handling — no GTK dependency.
// Emits CMakeLists.txt text for generated projects, builds any directory // Emits CMakeLists.txt text for generated projects, builds any directory
// containing one (configure + build), and persists the CMake settings // containing one (configure + build), and persists the CMake settings
// (generator / build type / build directory) in // (generator / build type / build directory) in
// ~/.config/fdesigner/cmake.conf, following the debugger.conf pattern // ~/.config/lightgui/cmake.conf, following the debugger.conf pattern
// (key=value; FDESIGNER_CMAKE_CONF overrides the path, used by tests). // (key=value; LIGHTGUI_CMAKE_CONF overrides the path, used by tests).
#pragma once #pragma once
#include <string> #include <string>
@@ -15,7 +15,7 @@ struct CMakeSettings {
std::string build_type = "Release"; std::string build_type = "Release";
std::string build_dir = "build"; // relative to the project directory std::string build_dir = "build"; // relative to the project directory
static std::string default_path(); // ~/.config/fdesigner/cmake.conf static std::string default_path(); // ~/.config/lightgui/cmake.conf
bool save(const std::string& path = "") const; bool save(const std::string& path = "") const;
bool load(const std::string& path = ""); bool load(const std::string& path = "");
}; };
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner code view — implementation. See codeview.h. // LightGUI code view — implementation. See codeview.h.
#include "codeview.h" #include "codeview.h"
#include <algorithm> #include <algorithm>
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner code view — GtkTextView showing generated code, with a // LightGUI code view — GtkTextView showing generated code, with a
// gutter (line numbers, red-dot breakpoints, fold toggles) and syntax // gutter (line numbers, red-dot breakpoints, fold toggles) and syntax
// highlighting from a CodeTheme (src/theme.h). // highlighting from a CodeTheme (src/theme.h).
// //
+5 -5
View File
@@ -1,4 +1,4 @@
// FDesigner stepping debugger — GDB/MI backend implementation. // LightGUI stepping debugger — GDB/MI backend implementation.
// See debugger.h. Talks to `gdb -q -i=mi2` over pipes; the protocol notes // See debugger.h. Talks to `gdb -q -i=mi2` over pipes; the protocol notes
// in the probe (target stdout arrives as bare lines) are handled in // in the probe (target stdout arrives as bare lines) are handled in
// handle_line(). // handle_line().
@@ -219,13 +219,13 @@ static std::string home_dir() {
} }
std::string DebuggerSettings::default_path() { std::string DebuggerSettings::default_path() {
const char* e = std::getenv("FDESIGNER_DEBUGGER_CONF"); const char* e = std::getenv("LIGHTGUI_DEBUGGER_CONF");
if (e && *e) return e; if (e && *e) return e;
return home_dir() + "/.config/fdesigner/debugger.conf"; return home_dir() + "/.config/lightgui/debugger.conf";
} }
std::string GdbSession::default_bps_path() { std::string GdbSession::default_bps_path() {
return home_dir() + "/.config/fdesigner/debugger_bps.conf"; return home_dir() + "/.config/lightgui/debugger_bps.conf";
} }
static bool ensure_parent_dir(const std::string& path) { static bool ensure_parent_dir(const std::string& path) {
@@ -343,7 +343,7 @@ bool DebuggerSettings::save(const std::string& path) const {
ensure_parent_dir(p); ensure_parent_dir(p);
std::ofstream f(p); std::ofstream f(p);
if (!f) return false; if (!f) return false;
f << "# FDesigner debugger settings\n"; f << "# LightGUI debugger settings\n";
f << "gdb_path=" << gdb_path << "\n"; f << "gdb_path=" << gdb_path << "\n";
f << "break_on_main=" << (break_on_main ? "1" : "0") << "\n"; f << "break_on_main=" << (break_on_main ? "1" : "0") << "\n";
f << "stop_on_entry=" << (stop_on_entry ? "1" : "0") << "\n"; f << "stop_on_entry=" << (stop_on_entry ? "1" : "0") << "\n";
+5 -5
View File
@@ -1,4 +1,4 @@
// FDesigner stepping debugger — GDB/MI backend (no GTK dependency). // LightGUI stepping debugger — GDB/MI backend (no GTK dependency).
// Drives a real gdb process over the machine interface (gdb -i=mi2): // Drives a real gdb process over the machine interface (gdb -i=mi2):
// launch target, breakpoints, step over/into/out, continue, kill, restart, // launch target, breakpoints, step over/into/out, continue, kill, restart,
// locals / watches / stack frames, target stdout/stderr capture. // locals / watches / stack frames, target stdout/stderr capture.
@@ -20,10 +20,10 @@
// pointer. A conditional breakpoint's `times` counts stops only — reaches // pointer. A conditional breakpoint's `times` counts stops only — reaches
// where the condition is false are not hits at all. // where the condition is false are not hits at all.
// //
// Settings live in ~/.config/fdesigner/debugger.conf (key=value, see // Settings live in ~/.config/lightgui/debugger.conf (key=value, see
// DebuggerSettings::save/load). FDESIGNER_DEBUGGER_CONF overrides the // DebuggerSettings::save/load). LIGHTGUI_DEBUGGER_CONF overrides the
// path (used by tests). Breakpoints are persisted per session in // path (used by tests). Breakpoints are persisted per session in
// ~/.config/fdesigner/debugger_bps.conf, one per line: // ~/.config/lightgui/debugger_bps.conf, one per line:
// location|enabled|kind|condition|ignore|log_message|group // location|enabled|kind|condition|ignore|log_message|group
// (\, | and newline inside fields are backslash-escaped.) Old two-field // (\, | and newline inside fields are backslash-escaped.) Old two-field
// lines (location|enabled) still load as plain breakpoints. // lines (location|enabled) still load as plain breakpoints.
@@ -43,7 +43,7 @@ struct DebuggerSettings {
int stop_timeout_ms = 10000; // how long to wait for a stop event int stop_timeout_ms = 10000; // how long to wait for a stop event
int cmd_timeout_ms = 5000; // how long to wait for a ^done/^error int cmd_timeout_ms = 5000; // how long to wait for a ^done/^error
static std::string default_path(); // ~/.config/fdesigner/debugger.conf static std::string default_path(); // ~/.config/lightgui/debugger.conf
bool save(const std::string& path = "") const; bool save(const std::string& path = "") const;
bool load(const std::string& path = ""); bool load(const std::string& path = "");
}; };
+3 -3
View File
@@ -1,4 +1,4 @@
// FDesigner stepping debugger — GTK window implementation. // LightGUI stepping debugger — GTK window implementation.
// Layout (all built in code, no extra .ui file — the window is dynamic): // Layout (all built in code, no extra .ui file — the window is dynamic):
// toolbar: Run | Continue | Step Over | Step Into | Step Out | Stop | Restart | Settings // toolbar: Run | Continue | Step Over | Step Into | Step Out | Stop | Restart | Settings
// target row: executable entry + Browse + args entry + status label // target row: executable entry + Browse + args entry + status label
@@ -687,7 +687,7 @@ static bool settings_dialog(GtkWidget* parent, DebuggerSettings& s) {
gtk_grid_attach(GTK_GRID(grid), cb_locals, 0, 5, 2, 1); gtk_grid_attach(GTK_GRID(grid), cb_locals, 0, 5, 2, 1);
GtkWidget* note = gtk_label_new( GtkWidget* note = gtk_label_new(
"Settings are saved to ~/.config/fdesigner/debugger.conf\n" "Settings are saved to ~/.config/lightgui/debugger.conf\n"
"and apply to the next debug session (pretty-print and the\n" "and apply to the next debug session (pretty-print and the\n"
"break-on-main / stop-on-entry options take effect on Run)."); "break-on-main / stop-on-entry options take effect on Run).");
gtk_label_set_xalign(GTK_LABEL(note), 0.0); gtk_label_set_xalign(GTK_LABEL(note), 0.0);
@@ -765,7 +765,7 @@ void debugger_window_open(GtkWidget* parent) {
ensure_session(err); ensure_session(err);
} }
GtkWidget* win = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win), "FDesigner Debugger"); gtk_window_set_title(GTK_WINDOW(win), "LightGUI Debugger");
gtk_window_set_default_size(GTK_WINDOW(win), 960, 640); gtk_window_set_default_size(GTK_WINDOW(win), 960, 640);
if (parent) gtk_window_set_transient_for(GTK_WINDOW(win), if (parent) gtk_window_set_transient_for(GTK_WINDOW(win),
GTK_WINDOW(parent)); GTK_WINDOW(parent));
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner stepping debugger — GTK window (separate from the main window). // LightGUI stepping debugger — GTK window (separate from the main window).
// Open with debugger_window_open(parent). The window owns a GdbSession and // Open with debugger_window_open(parent). The window owns a GdbSession and
// polls it on a GTK timeout; all gdb traffic stays in the backend. // polls it on a GTK timeout; all gdb traffic stays in the backend.
#pragma once #pragma once
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner event table — the natural GTK signal(s) for every widget type. // LightGUI event table — the natural GTK signal(s) for every widget type.
// //
// Every palette type is listed here exactly once: either with the signals // Every palette type is listed here exactly once: either with the signals
// a user can connect (each gets a generated stub handler, connected via // a user can connect (each gets a generated stub handler, connected via
+12 -12
View File
@@ -1,4 +1,4 @@
// FDesigner code generator — see generator.h. All-code output with one // LightGUI code generator — see generator.h. All-code output with one
// standalone class per widget, mirroring the Python generator's shape. // standalone class per widget, mirroring the Python generator's shape.
#include "generator.h" #include "generator.h"
@@ -434,11 +434,11 @@ static void event_handler_decls(std::ostringstream& o, const Widget& w) {
} }
} }
// The trace line a stub prints under FDESIGNER_EVENT_TRACE (compiled // The trace line a stub prints under LIGHTGUI_EVENT_TRACE (compiled
// into generated apps only when the test harness defines the macro). // into generated apps only when the test harness defines the macro).
static std::string event_trace(const Widget& w, const EventDef& d, static std::string event_trace(const Widget& w, const EventDef& d,
const std::string& detail) { const std::string& detail) {
std::string line = "#ifdef FDESIGNER_EVENT_TRACE\n" std::string line = "#ifdef LIGHTGUI_EVENT_TRACE\n"
" std::fprintf(stderr, \"EVENT " + " std::fprintf(stderr, \"EVENT " +
w.name + " " + d.signal + detail + "\\n\");\n#endif\n"; w.name + " " + d.signal + detail + "\\n\");\n#endif\n";
return line; return line;
@@ -792,7 +792,7 @@ static std::string shape_plot_draw_methods(const Widget& w) {
o << "\ngboolean " << w.name << "::on_draw(GtkWidget* w, cairo_t* cr,\n" o << "\ngboolean " << w.name << "::on_draw(GtkWidget* w, cairo_t* cr,\n"
<< " gpointer self) {\n" << " gpointer self) {\n"
<< " auto* me = static_cast<" << w.name << "*>(self);\n" << " auto* me = static_cast<" << w.name << "*>(self);\n"
<< "#ifdef FDESIGNER_EVENT_TRACE\n" << "#ifdef LIGHTGUI_EVENT_TRACE\n"
<< " std::fprintf(stderr, \"EVENT " << w.name << " draw\\n\");\n" << " std::fprintf(stderr, \"EVENT " << w.name << " draw\\n\");\n"
<< "#endif\n" << "#endif\n"
<< " GtkAllocation a;\n" << " GtkAllocation a;\n"
@@ -861,7 +861,7 @@ static const StubNames kRootStubs{"Root_001_", "on_Root_001_press",
static std::string emit_widget_header(const Widget& w) { static std::string emit_widget_header(const Widget& w) {
std::ostringstream o; std::ostringstream o;
o << "// Generated by FDesigner (C++/GTK) — standalone widget class.\n" o << "// Generated by LightGUI (C++/GTK) — standalone widget class.\n"
<< "#pragma once\n\n" << "#pragma once\n\n"
<< "#include <gtk/gtk.h>\n"; << "#include <gtk/gtk.h>\n";
if (w.type == "StockChart") if (w.type == "StockChart")
@@ -1295,7 +1295,7 @@ fdw::Map %CLASS%::current_map(const Layout& L) const {
gboolean %CLASS%::on_draw(GtkWidget* drawing, cairo_t* cr, gboolean %CLASS%::on_draw(GtkWidget* drawing, cairo_t* cr,
gpointer self) { gpointer self) {
auto* me = static_cast<%CLASS%*>(self); auto* me = static_cast<%CLASS%*>(self);
#ifdef FDESIGNER_EVENT_TRACE #ifdef LIGHTGUI_EVENT_TRACE
std::fprintf(stderr, "EVENT %CLASS% draw\n"); std::fprintf(stderr, "EVENT %CLASS% draw\n");
#endif #endif
int width = gtk_widget_get_allocated_width(drawing); int width = gtk_widget_get_allocated_width(drawing);
@@ -1781,7 +1781,7 @@ static std::string emit_widget_cpp(const Widget& w) {
const std::string& t = w.type; const std::string& t = w.type;
const std::string M = "widget_"; const std::string M = "widget_";
std::ostringstream o; std::ostringstream o;
o << "// Generated by FDesigner (C++/GTK) — standalone widget class.\n" o << "// Generated by LightGUI (C++/GTK) — standalone widget class.\n"
<< "#include \"" << w.name << ".h\"\n\n" << "#include \"" << w.name << ".h\"\n\n"
<< "#include <cstdio>\n"; << "#include <cstdio>\n";
if (t == "StockChart") if (t == "StockChart")
@@ -2195,9 +2195,9 @@ static std::string emit_window_header(const std::string& cls,
const std::vector<Widget>& widgets, const std::vector<Widget>& widgets,
const std::vector<MenuDef>& menus) { const std::vector<MenuDef>& menus) {
std::ostringstream o; std::ostringstream o;
o << "// Generated by FDesigner (C++/GTK) — all code, no .ui file.\n" o << "// Generated by LightGUI (C++/GTK) — all code, no .ui file.\n"
<< "// Every widget is a standalone class; this class instantiates\n" << "// Every widget is a standalone class; this class instantiates\n"
<< "// them. Construction mirrors the Python fdesigner generator.\n" << "// them. Construction mirrors the Python lightgui generator.\n"
<< "#pragma once\n\n" << "#pragma once\n\n"
<< "#include <gtk/gtk.h>\n" << "#include <gtk/gtk.h>\n"
<< "#include <string>\n\n"; << "#include <string>\n\n";
@@ -2278,7 +2278,7 @@ static std::string emit_window_cpp(const std::string& cls, const Project& p,
const std::vector<Widget>& widgets, const std::vector<Widget>& widgets,
const std::vector<MenuDef>& menus) { const std::vector<MenuDef>& menus) {
std::ostringstream o; std::ostringstream o;
o << "// Generated by FDesigner (C++/GTK) — all code, no .ui file.\n" o << "// Generated by LightGUI (C++/GTK) — all code, no .ui file.\n"
<< "#include \"" << cls << ".h\"\n\n" << "#include \"" << cls << ".h\"\n\n"
<< "#include <cstdio>\n\n" << "#include <cstdio>\n\n"
<< cls << "::" << cls << "() {\n" << cls << "::" << cls << "() {\n"
@@ -2348,7 +2348,7 @@ static std::string emit_window_cpp(const std::string& cls, const Project& p,
static std::string emit_main(const std::string& cls) { static std::string emit_main(const std::string& cls) {
std::ostringstream o; std::ostringstream o;
o << "// Generated by FDesigner (C++/GTK).\n" o << "// Generated by LightGUI (C++/GTK).\n"
<< "#include <gtk/gtk.h>\n\n" << "#include <gtk/gtk.h>\n\n"
<< "#include \"" << cls << ".h\"\n\n" << "#include \"" << cls << ".h\"\n\n"
<< "int main(int argc, char** argv) {\n" << "int main(int argc, char** argv) {\n"
@@ -2375,7 +2375,7 @@ static std::string emit_cmake_lists(
static std::string emit_makefile(const std::string& cls) { static std::string emit_makefile(const std::string& cls) {
std::ostringstream o; std::ostringstream o;
o << "# Generated by FDesigner (C++/GTK). One class per widget:\n" o << "# Generated by LightGUI (C++/GTK). One class per widget:\n"
<< "# SRCS picks up every .cpp, so hand-added classes build too.\n" << "# SRCS picks up every .cpp, so hand-added classes build too.\n"
<< "CXX ?= g++\n" << "CXX ?= g++\n"
<< "CXXFLAGS ?= -O2 -Wall -std=c++17\n" << "CXXFLAGS ?= -O2 -Wall -std=c++17\n"
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner code generator. // LightGUI code generator.
// Turns the designed window (Project + widgets) into a compilable C++/GTK // Turns the designed window (Project + widgets) into a compilable C++/GTK
// project. The output is ALL CODE — no .ui file — and every widget is a // project. The output is ALL CODE — no .ui file — and every widget is a
// STANDALONE CLASS in its own .h/.cpp pair, mirroring the Python // STANDALONE CLASS in its own .h/.cpp pair, mirroring the Python
+1 -1
View File
@@ -1,4 +1,4 @@
// indicators.h — 250 technical indicator submodules for the FDesigner // indicators.h — 250 technical indicator submodules for the LightGUI
// StockChart widget, in ONE self-contained header. // StockChart widget, in ONE self-contained header.
// //
// Every indicator is a named module in the registry below: it consumes // Every indicator is a named module in the registry below: it consumes
+1 -1
View File
@@ -2,7 +2,7 @@
// Do not edit; run 'make' to regenerate. // Do not edit; run 'make' to regenerate.
#pragma once #pragma once
static const char kIndicatorsHeader[] = R"FDINDICATORS7f3a( static const char kIndicatorsHeader[] = R"FDINDICATORS7f3a(
// indicators.h — 250 technical indicator submodules for the FDesigner // indicators.h — 250 technical indicator submodules for the LightGUI
// StockChart widget, in ONE self-contained header. // StockChart widget, in ONE self-contained header.
// //
// Every indicator is a named module in the registry below: it consumes // Every indicator is a named module in the registry below: it consumes
+84 -84
View File
@@ -1,4 +1,4 @@
// FDesigner (C++/GTK) — Phase 2: property editor + bulk parameter ops. // LightGUI (C++/GTK) — Phase 2: property editor + bulk parameter ops.
// Main window loads from the Glade file ui/designer.ui via GtkBuilder. // Main window loads from the Glade file ui/designer.ui via GtkBuilder.
// //
// Phase 1: palette places real GTK widgets on a GtkFixed canvas; click to // Phase 1: palette places real GTK widgets on a GtkFixed canvas; click to
@@ -9,7 +9,7 @@
// operations: set a parameter on all / selected / filtered widgets, and // operations: set a parameter on all / selected / filtered widgets, and
// clear a parameter everywhere. // clear a parameter everywhere.
// //
// Headless check: FDESIGNER_SELFTEST=1 exercises both phases through the // Headless check: LIGHTGUI_SELFTEST=1 exercises both phases through the
// same functions the UI calls, prints SELFTEST PASS/FAIL. // same functions the UI calls, prints SELFTEST PASS/FAIL.
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -2461,7 +2461,7 @@ static void palette_attach_icons(GtkBuilder* builder) {
} }
// ------------------------------------------------------- palette window // ------------------------------------------------------- palette window
// The widget palette lives in its own top-level window ("FDesigner — // The widget palette lives in its own top-level window ("LightGUI —
// Widgets"), opened together with the designer. It is a plain top-level // Widgets"), opened together with the designer. It is a plain top-level
// window, never transient/modal, so design, palette and code windows // window, never transient/modal, so design, palette and code windows
// coexist. Closing it only hides it; View -> Widget Palette brings it // coexist. Closing it only hides it; View -> Widget Palette brings it
@@ -2537,7 +2537,7 @@ static GtkWidget* g_codeview = nullptr;
static void refresh_code_view() { static void refresh_code_view() {
if (!g_codeview) return; if (!g_codeview) return;
Project p = snapshot_project(); Project p = snapshot_project();
GenResult r = generate_project(p, p.widgets, "/tmp/fdesigner_codeview"); GenResult r = generate_project(p, p.widgets, "/tmp/lightgui_codeview");
std::string path, text; std::string path, text;
if (r.ok) { if (r.ok) {
for (const auto& f : r.files) for (const auto& f : r.files)
@@ -2562,7 +2562,7 @@ static void refresh_code_view() {
} }
} }
if (path.empty()) { if (path.empty()) {
path = "/tmp/fdesigner_codeview/MyWindow.cpp"; path = "/tmp/lightgui_codeview/MyWindow.cpp";
text = "// Generate a design first: File -> Generate C++/GTK...\n"; text = "// Generate a design first: File -> Generate C++/GTK...\n";
} }
codeview_set_text(g_codeview, text, path); codeview_set_text(g_codeview, text, path);
@@ -2600,12 +2600,12 @@ static const char* cw_state_name(DbgState st) {
return "Idle"; return "Idle";
} }
// Test hook: FDESIGNER_CODEWIN_DUMP=<path> writes a snapshot of the // Test hook: LIGHTGUI_CODEWIN_DUMP=<path> writes a snapshot of the
// code window's debug state (state, scope, file, paused line, locals) // code window's debug state (state, scope, file, paused line, locals)
// every time the sync applies a change. Used by // every time the sync applies a change. Used by
// tests/code_window_tests.sh to assert on the live app. // tests/code_window_tests.sh to assert on the live app.
static void codewin_dump_snapshot(DbgState st) { static void codewin_dump_snapshot(DbgState st) {
const char* path = std::getenv("FDESIGNER_CODEWIN_DUMP"); const char* path = std::getenv("LIGHTGUI_CODEWIN_DUMP");
if (!path || !*path || !g_codeview) return; if (!path || !*path || !g_codeview) return;
std::string out = "state="; std::string out = "state=";
out += cw_state_name(st); out += cw_state_name(st);
@@ -2717,7 +2717,7 @@ static void open_code_view() {
if (!g_codeview_window) { if (!g_codeview_window) {
g_codeview_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_codeview_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(g_codeview_window), gtk_window_set_title(GTK_WINDOW(g_codeview_window),
"FDesigner \u2014 Code"); "LightGUI \u2014 Code");
gtk_window_set_default_size(GTK_WINDOW(g_codeview_window), 1000, gtk_window_set_default_size(GTK_WINDOW(g_codeview_window), 1000,
700); 700);
// Deliberately NOT transient for the designer: this is its own // Deliberately NOT transient for the designer: this is its own
@@ -2846,7 +2846,7 @@ static void on_generate(GtkMenuItem*, gpointer) {
// ------------------------------------------------------- CMake // ------------------------------------------------------- CMake
// (cmake_build.h) Builds a project directory with CMake instead of the // (cmake_build.h) Builds a project directory with CMake instead of the
// plain g++ / make command. Settings (generator, build type, build // plain g++ / make command. Settings (generator, build type, build
// directory) live in ~/.config/fdesigner/cmake.conf. // directory) live in ~/.config/lightgui/cmake.conf.
static void show_build_result(const std::string& title, static void show_build_result(const std::string& title,
const CMakeBuildResult& r) { const CMakeBuildResult& r) {
@@ -2942,7 +2942,7 @@ static void on_cmake_open(GtkMenuItem*, gpointer) {
} }
// File -> CMake Settings… : generator / build type / build directory / // File -> CMake Settings… : generator / build type / build directory /
// cmake command, persisted to ~/.config/fdesigner/cmake.conf. // cmake command, persisted to ~/.config/lightgui/cmake.conf.
static void on_cmake_settings(GtkMenuItem*, gpointer) { static void on_cmake_settings(GtkMenuItem*, gpointer) {
CMakeSettings s; CMakeSettings s;
s.load(); s.load();
@@ -2998,7 +2998,7 @@ static void update_title() {
: g_current_file.substr(slash + 1); : g_current_file.substr(slash + 1);
} }
gtk_window_set_title(GTK_WINDOW(g_window), gtk_window_set_title(GTK_WINDOW(g_window),
("FDesigner — C++/GTK — " + name).c_str()); ("LightGUI — C++/GTK — " + name).c_str());
} }
static bool save_to(const std::string& path) { static bool save_to(const std::string& path) {
@@ -3021,7 +3021,7 @@ static GtkWidget* make_fdj_filter_dialog(const char* title,
action == GTK_FILE_CHOOSER_ACTION_SAVE ? "_Save" : "_Open", action == GTK_FILE_CHOOSER_ACTION_SAVE ? "_Save" : "_Open",
GTK_RESPONSE_ACCEPT, nullptr); GTK_RESPONSE_ACCEPT, nullptr);
GtkFileFilter* filter = gtk_file_filter_new(); GtkFileFilter* filter = gtk_file_filter_new();
gtk_file_filter_set_name(filter, "FDesigner projects (*.fdj)"); gtk_file_filter_set_name(filter, "LightGUI projects (*.fdj)");
gtk_file_filter_add_pattern(filter, "*.fdj"); gtk_file_filter_add_pattern(filter, "*.fdj");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dlg), filter); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dlg), filter);
return dlg; return dlg;
@@ -3156,14 +3156,14 @@ static gboolean selftest_step(gpointer) {
check(combo && scale && text); check(combo && scale && text);
Project snap = snapshot_project(); Project snap = snapshot_project();
GenResult gr = generate_project(snap, snap.widgets, GenResult gr = generate_project(snap, snap.widgets,
"/tmp/fdesigner_gen_test"); "/tmp/lightgui_gen_test");
check(gr.ok && gr.files.size() == 5 + 2 * snap.widgets.size()); check(gr.ok && gr.files.size() == 5 + 2 * snap.widgets.size());
check(!g_file_test("/tmp/fdesigner_gen_test/mywindow.ui", check(!g_file_test("/tmp/lightgui_gen_test/mywindow.ui",
G_FILE_TEST_EXISTS)); // all code, no .ui G_FILE_TEST_EXISTS)); // all code, no .ui
// ---- CMake (cmake_build.h) ---- // ---- CMake (cmake_build.h) ----
// The generator also emits a CMakeLists.txt for the project. // The generator also emits a CMakeLists.txt for the project.
gchar* cmake_text = nullptr; gchar* cmake_text = nullptr;
check(g_file_get_contents("/tmp/fdesigner_gen_test/CMakeLists.txt", check(g_file_get_contents("/tmp/lightgui_gen_test/CMakeLists.txt",
&cmake_text, nullptr, nullptr) && &cmake_text, nullptr, nullptr) &&
cmake_text != nullptr); cmake_text != nullptr);
if (cmake_text) { if (cmake_text) {
@@ -3182,7 +3182,7 @@ static gboolean selftest_step(gpointer) {
g_free(cmake_text); g_free(cmake_text);
} }
gchar* code_text = nullptr; gchar* code_text = nullptr;
check(g_file_get_contents("/tmp/fdesigner_gen_test/MyWindow.cpp", check(g_file_get_contents("/tmp/lightgui_gen_test/MyWindow.cpp",
&code_text, nullptr, nullptr) && &code_text, nullptr, nullptr) &&
code_text != nullptr); code_text != nullptr);
if (code_text) { if (code_text) {
@@ -3194,7 +3194,7 @@ static gboolean selftest_step(gpointer) {
g_free(code_text); g_free(code_text);
} }
gchar* btn_text = nullptr; gchar* btn_text = nullptr;
check(g_file_get_contents("/tmp/fdesigner_gen_test/Button_001.cpp", check(g_file_get_contents("/tmp/lightgui_gen_test/Button_001.cpp",
&btn_text, nullptr, nullptr) && &btn_text, nullptr, nullptr) &&
btn_text != nullptr); btn_text != nullptr);
if (btn_text) { if (btn_text) {
@@ -3207,7 +3207,7 @@ static gboolean selftest_step(gpointer) {
check(code.find("util_error_print") != std::string::npos); check(code.find("util_error_print") != std::string::npos);
g_free(btn_text); g_free(btn_text);
} }
std::printf("GENERATED /tmp/fdesigner_gen_test\n"); std::printf("GENERATED /tmp/lightgui_gen_test\n");
} }
// Phase 4: save -> clear -> load round-trip, counter continuation, // Phase 4: save -> clear -> load round-trip, counter continuation,
@@ -3215,11 +3215,11 @@ static gboolean selftest_step(gpointer) {
{ {
Project snap = snapshot_project(); Project snap = snapshot_project();
std::string err; std::string err;
check(save_project_file("/tmp/fdesigner_test.fdj", snap, err)); check(save_project_file("/tmp/lightgui_test.fdj", snap, err));
clear_canvas(); clear_canvas();
check(g_items.empty()); check(g_items.empty());
Project loaded; Project loaded;
check(load_project_file("/tmp/fdesigner_test.fdj", loaded, err)); check(load_project_file("/tmp/lightgui_test.fdj", loaded, err));
load_into_canvas(loaded); load_into_canvas(loaded);
check(g_items.size() == 6); check(g_items.size() == 6);
Item* b = nullptr; Item* b = nullptr;
@@ -3236,10 +3236,10 @@ static gboolean selftest_step(gpointer) {
check(b2 && b2->model.name == "Button_002"); check(b2 && b2->model.name == "Button_002");
delete_item(b2); delete_item(b2);
check(g_items.size() == 6); check(g_items.size() == 6);
check(g_file_set_contents("/tmp/fdesigner_bad.fdj", check(g_file_set_contents("/tmp/lightgui_bad.fdj",
"this is not json", -1, nullptr)); "this is not json", -1, nullptr));
Project junk; Project junk;
check(!load_project_file("/tmp/fdesigner_bad.fdj", junk, err)); check(!load_project_file("/tmp/lightgui_bad.fdj", junk, err));
} }
// Phase 5: Toplevel + Spreadsheet widgets, colour palette, menu bar. // Phase 5: Toplevel + Spreadsheet widgets, colour palette, menu bar.
@@ -3290,10 +3290,10 @@ static gboolean selftest_step(gpointer) {
g_project.menubar = "File: New | Open | - | Quit\nHelp: About"; g_project.menubar = "File: New | Open | - | Quit\nHelp: About";
Project snap = snapshot_project(); Project snap = snapshot_project();
GenResult gr = generate_project(snap, snap.widgets, GenResult gr = generate_project(snap, snap.widgets,
"/tmp/fdesigner_gen_test5"); "/tmp/lightgui_gen_test5");
check(gr.ok); check(gr.ok);
gchar* code_text = nullptr; gchar* code_text = nullptr;
check(g_file_get_contents("/tmp/fdesigner_gen_test5/MyWindow.cpp", check(g_file_get_contents("/tmp/lightgui_gen_test5/MyWindow.cpp",
&code_text, nullptr, nullptr) && &code_text, nullptr, nullptr) &&
code_text != nullptr); code_text != nullptr);
if (code_text) { if (code_text) {
@@ -3306,7 +3306,7 @@ static gboolean selftest_step(gpointer) {
} }
gchar* top_text = nullptr; gchar* top_text = nullptr;
check(g_file_get_contents( check(g_file_get_contents(
"/tmp/fdesigner_gen_test5/Toplevel_001.cpp", &top_text, "/tmp/lightgui_gen_test5/Toplevel_001.cpp", &top_text,
nullptr, nullptr) && nullptr, nullptr) &&
top_text != nullptr); top_text != nullptr);
if (top_text) { if (top_text) {
@@ -3316,7 +3316,7 @@ static gboolean selftest_step(gpointer) {
} }
gchar* ss_text = nullptr; gchar* ss_text = nullptr;
check(g_file_get_contents( check(g_file_get_contents(
"/tmp/fdesigner_gen_test5/Spreadsheet_001.cpp", &ss_text, "/tmp/lightgui_gen_test5/Spreadsheet_001.cpp", &ss_text,
nullptr, nullptr) && nullptr, nullptr) &&
ss_text != nullptr); ss_text != nullptr);
if (ss_text) { if (ss_text) {
@@ -3324,13 +3324,13 @@ static gboolean selftest_step(gpointer) {
std::string::npos); std::string::npos);
g_free(ss_text); g_free(ss_text);
} }
std::printf("GENERATED5 /tmp/fdesigner_gen_test5\n"); std::printf("GENERATED5 /tmp/lightgui_gen_test5\n");
// Round-trip with the Phase 5 pieces included. // Round-trip with the Phase 5 pieces included.
check(save_project_file("/tmp/fdesigner_test5.fdj", snap, err)); check(save_project_file("/tmp/lightgui_test5.fdj", snap, err));
clear_canvas(); clear_canvas();
Project loaded; Project loaded;
check(load_project_file("/tmp/fdesigner_test5.fdj", loaded, err)); check(load_project_file("/tmp/lightgui_test5.fdj", loaded, err));
load_into_canvas(loaded); load_into_canvas(loaded);
check(g_items.size() == 8); check(g_items.size() == 8);
check(g_project.menubar == snap.menubar); check(g_project.menubar == snap.menubar);
@@ -3396,15 +3396,15 @@ static gboolean selftest_step(gpointer) {
} }
Project snap3 = snapshot_project(); Project snap3 = snapshot_project();
GenResult gr3 = generate_project(snap3, snap3.widgets, GenResult gr3 = generate_project(snap3, snap3.widgets,
"/tmp/fdesigner_gen_test6"); "/tmp/lightgui_gen_test6");
check(gr3.ok); check(gr3.ok);
check(g_file_test("/tmp/fdesigner_gen_test6/indicators.h", check(g_file_test("/tmp/lightgui_gen_test6/indicators.h",
G_FILE_TEST_EXISTS)); G_FILE_TEST_EXISTS));
check(g_file_test("/tmp/fdesigner_gen_test6/drawings.h", check(g_file_test("/tmp/lightgui_gen_test6/drawings.h",
G_FILE_TEST_EXISTS)); G_FILE_TEST_EXISTS));
gchar* chart_text = nullptr; gchar* chart_text = nullptr;
check(g_file_get_contents( check(g_file_get_contents(
"/tmp/fdesigner_gen_test6/StockChart_001.cpp", "/tmp/lightgui_gen_test6/StockChart_001.cpp",
&chart_text, nullptr, nullptr) && &chart_text, nullptr, nullptr) &&
chart_text != nullptr); chart_text != nullptr);
if (chart_text) { if (chart_text) {
@@ -3427,7 +3427,7 @@ static gboolean selftest_step(gpointer) {
} }
gchar* chart_h = nullptr; gchar* chart_h = nullptr;
check(g_file_get_contents( check(g_file_get_contents(
"/tmp/fdesigner_gen_test6/StockChart_001.h", &chart_h, "/tmp/lightgui_gen_test6/StockChart_001.h", &chart_h,
nullptr, nullptr) && nullptr, nullptr) &&
chart_h != nullptr); chart_h != nullptr);
if (chart_h) { if (chart_h) {
@@ -3555,7 +3555,7 @@ static gboolean selftest_step(gpointer) {
// Generate the whole canvas and check each new widget's code. // Generate the whole canvas and check each new widget's code.
Project snap7 = snapshot_project(); Project snap7 = snapshot_project();
GenResult gr7 = generate_project(snap7, snap7.widgets, GenResult gr7 = generate_project(snap7, snap7.widgets,
"/tmp/fdesigner_gen_test7"); "/tmp/lightgui_gen_test7");
check(gr7.ok); check(gr7.ok);
std::map<std::string, const char*> markers = { std::map<std::string, const char*> markers = {
{"Memo_001", "gtk_text_view_new"}, {"Memo_001", "gtk_text_view_new"},
@@ -3581,15 +3581,15 @@ static gboolean selftest_step(gpointer) {
}; };
for (const auto& [name, marker] : markers) { for (const auto& [name, marker] : markers) {
std::string code = std::string code =
read_file("/tmp/fdesigner_gen_test7/" + name + ".cpp"); read_file("/tmp/lightgui_gen_test7/" + name + ".cpp");
check(!code.empty() && check(!code.empty() &&
code.find(marker) != std::string::npos); code.find(marker) != std::string::npos);
} }
check(read_file("/tmp/fdesigner_gen_test7/Shape_001.cpp") check(read_file("/tmp/lightgui_gen_test7/Shape_001.cpp")
.find("Shape_001::on_draw") != std::string::npos); .find("Shape_001::on_draw") != std::string::npos);
check(read_file("/tmp/fdesigner_gen_test7/Plot_001.cpp") check(read_file("/tmp/lightgui_gen_test7/Plot_001.cpp")
.find("Plot_001::on_draw") != std::string::npos); .find("Plot_001::on_draw") != std::string::npos);
std::printf("GENERATED7 /tmp/fdesigner_gen_test7\n"); std::printf("GENERATED7 /tmp/lightgui_gen_test7\n");
} }
// Phase 8: event handlers — connect every natural signal on every // Phase 8: event handlers — connect every natural signal on every
@@ -3654,13 +3654,13 @@ static gboolean selftest_step(gpointer) {
Project snap8 = snapshot_project(); Project snap8 = snapshot_project();
check(snap8.widgets.size() == 29); check(snap8.widgets.size() == 29);
GenResult gr8 = generate_project(snap8, snap8.widgets, GenResult gr8 = generate_project(snap8, snap8.widgets,
"/tmp/fdesigner_gen_test8"); "/tmp/lightgui_gen_test8");
check(gr8.ok); check(gr8.ok);
for (const Widget& w : snap8.widgets) { for (const Widget& w : snap8.widgets) {
std::string cpp = std::string cpp =
read_file8("/tmp/fdesigner_gen_test8/" + w.name + ".cpp"); read_file8("/tmp/lightgui_gen_test8/" + w.name + ".cpp");
std::string hdr = std::string hdr =
read_file8("/tmp/fdesigner_gen_test8/" + w.name + ".h"); read_file8("/tmp/lightgui_gen_test8/" + w.name + ".h");
check(!cpp.empty() && !hdr.empty()); check(!cpp.empty() && !hdr.empty());
const std::vector<EventDef>& evs = events_for(w.type); const std::vector<EventDef>& evs = events_for(w.type);
if (evs.empty()) { if (evs.empty()) {
@@ -3697,11 +3697,11 @@ static gboolean selftest_step(gpointer) {
} }
} }
// Save/load round-trip keeps the connections. // Save/load round-trip keeps the connections.
check(save_project_file("/tmp/fdesigner_test8.fdj", snap8, err)); check(save_project_file("/tmp/lightgui_test8.fdj", snap8, err));
clear_canvas(); clear_canvas();
check(g_items.empty()); check(g_items.empty());
Project loaded8; Project loaded8;
check(load_project_file("/tmp/fdesigner_test8.fdj", loaded8, err)); check(load_project_file("/tmp/lightgui_test8.fdj", loaded8, err));
load_into_canvas(loaded8); load_into_canvas(loaded8);
check(g_items.size() == 29); check(g_items.size() == 29);
for (Item* it : g_items) { for (Item* it : g_items) {
@@ -3714,7 +3714,7 @@ static gboolean selftest_step(gpointer) {
if (it->model.type == "Label") if (it->model.type == "Label")
check(it->model.signals.empty()); check(it->model.signals.empty());
} }
std::printf("GENERATED8 /tmp/fdesigner_gen_test8\n"); std::printf("GENERATED8 /tmp/lightgui_gen_test8\n");
} }
// Debugger backend: settings round-trip, breakpoint-location // Debugger backend: settings round-trip, breakpoint-location
@@ -3725,9 +3725,9 @@ static gboolean selftest_step(gpointer) {
ds.break_on_main = true; ds.break_on_main = true;
ds.pretty_print = false; ds.pretty_print = false;
ds.default_args = "--test-arg"; ds.default_args = "--test-arg";
check(ds.save("/tmp/fdesigner_dbg.conf")); check(ds.save("/tmp/lightgui_dbg.conf"));
DebuggerSettings ds2; DebuggerSettings ds2;
check(ds2.load("/tmp/fdesigner_dbg.conf")); check(ds2.load("/tmp/lightgui_dbg.conf"));
check(ds2.gdb_path == "/usr/bin/gdb" && ds2.break_on_main && check(ds2.gdb_path == "/usr/bin/gdb" && ds2.break_on_main &&
!ds2.pretty_print && ds2.default_args == "--test-arg"); !ds2.pretty_print && ds2.default_args == "--test-arg");
std::string f; std::string f;
@@ -3748,9 +3748,9 @@ static gboolean selftest_step(gpointer) {
check(sess.stage_breakpoint("foo.cpp:42")); check(sess.stage_breakpoint("foo.cpp:42"));
check(!sess.stage_breakpoint("")); check(!sess.stage_breakpoint(""));
check(sess.breakpoints().size() == 2); check(sess.breakpoints().size() == 2);
check(sess.save_breakpoints("/tmp/fdesigner_dbg_bps.conf")); check(sess.save_breakpoints("/tmp/lightgui_dbg_bps.conf"));
GdbSession sess2; GdbSession sess2;
check(sess2.load_breakpoints("/tmp/fdesigner_dbg_bps.conf")); check(sess2.load_breakpoints("/tmp/lightgui_dbg_bps.conf"));
check(sess2.breakpoints().size() == 2 && check(sess2.breakpoints().size() == 2 &&
sess2.breakpoints()[0].location == "main"); sess2.breakpoints()[0].location == "main");
} }
@@ -3761,9 +3761,9 @@ static gboolean selftest_step(gpointer) {
FontSettings fs; FontSettings fs;
fs.font = "DejaVu Sans 14"; fs.font = "DejaVu Sans 14";
fs.code_font = "DejaVu Sans Mono 13"; fs.code_font = "DejaVu Sans Mono 13";
check(fs.save("/tmp/fdesigner_font.conf")); check(fs.save("/tmp/lightgui_font.conf"));
FontSettings fs2; FontSettings fs2;
check(fs2.load("/tmp/fdesigner_font.conf")); check(fs2.load("/tmp/lightgui_font.conf"));
check(fs2.font == "DejaVu Sans 14" && check(fs2.font == "DejaVu Sans 14" &&
fs2.code_font == "DejaVu Sans Mono 13"); fs2.code_font == "DejaVu Sans Mono 13");
check(FontSettings::sanitized("", "Sans 10") == "Sans 10"); check(FontSettings::sanitized("", "Sans 10") == "Sans 10");
@@ -3793,50 +3793,50 @@ static gboolean selftest_step(gpointer) {
cs.build_type = "Debug"; cs.build_type = "Debug";
cs.build_dir = "out"; cs.build_dir = "out";
cs.cmake_path = "cmake"; cs.cmake_path = "cmake";
check(cs.save("/tmp/fdesigner_cmake.conf")); check(cs.save("/tmp/lightgui_cmake.conf"));
CMakeSettings cs2; CMakeSettings cs2;
check(cs2.load("/tmp/fdesigner_cmake.conf")); check(cs2.load("/tmp/lightgui_cmake.conf"));
check(cs2.generator == "Unix Makefiles" && check(cs2.generator == "Unix Makefiles" &&
cs2.build_type == "Debug" && cs2.build_dir == "out" && cs2.build_type == "Debug" && cs2.build_dir == "out" &&
cs2.cmake_path == "cmake"); cs2.cmake_path == "cmake");
check(cmake_lists_text("Demo", {"main.cpp", "Foo.cpp"}).find( check(cmake_lists_text("Demo", {"main.cpp", "Foo.cpp"}).find(
"add_executable(app") != std::string::npos); "add_executable(app") != std::string::npos);
check(!cmake_project_exists("/tmp/fdesigner_cmake_nodir_xyz")); check(!cmake_project_exists("/tmp/lightgui_cmake_nodir_xyz"));
// Hand-written console CMake project: configure + build + run. // Hand-written console CMake project: configure + build + run.
std::system("rm -rf /tmp/fdesigner_cmake_console && mkdir -p " std::system("rm -rf /tmp/lightgui_cmake_console && mkdir -p "
"/tmp/fdesigner_cmake_console"); "/tmp/lightgui_cmake_console");
{ {
std::ofstream f("/tmp/fdesigner_cmake_console/CMakeLists.txt"); std::ofstream f("/tmp/lightgui_cmake_console/CMakeLists.txt");
f << "cmake_minimum_required(VERSION 3.10)\n" f << "cmake_minimum_required(VERSION 3.10)\n"
<< "project(console_demo CXX)\n" << "project(console_demo CXX)\n"
<< "add_executable(app main.cpp)\n"; << "add_executable(app main.cpp)\n";
} }
{ {
std::ofstream f("/tmp/fdesigner_cmake_console/main.cpp"); std::ofstream f("/tmp/lightgui_cmake_console/main.cpp");
f << "#include <cstdio>\nint main() { std::printf(\"hi\\n\"); " f << "#include <cstdio>\nint main() { std::printf(\"hi\\n\"); "
"return 0; }\n"; "return 0; }\n";
} }
CMakeSettings def; CMakeSettings def;
check(cmake_project_exists("/tmp/fdesigner_cmake_console")); check(cmake_project_exists("/tmp/lightgui_cmake_console"));
CMakeBuildResult cr = CMakeBuildResult cr =
cmake_build_project("/tmp/fdesigner_cmake_console", def); cmake_build_project("/tmp/lightgui_cmake_console", def);
check(cr.ok && cr.configured); check(cr.ok && cr.configured);
check(std::system("/tmp/fdesigner_cmake_console/build/app " check(std::system("/tmp/lightgui_cmake_console/build/app "
"> /tmp/fdesigner_cmake_console/run.log 2>&1") == "> /tmp/lightgui_cmake_console/run.log 2>&1") ==
0); 0);
// A broken CMakeLists.txt must fail cleanly, not claim success. // A broken CMakeLists.txt must fail cleanly, not claim success.
std::system("rm -rf /tmp/fdesigner_cmake_broken && mkdir -p " std::system("rm -rf /tmp/lightgui_cmake_broken && mkdir -p "
"/tmp/fdesigner_cmake_broken"); "/tmp/lightgui_cmake_broken");
{ {
std::ofstream f("/tmp/fdesigner_cmake_broken/CMakeLists.txt"); std::ofstream f("/tmp/lightgui_cmake_broken/CMakeLists.txt");
f << "this is not valid cmake (\n"; f << "this is not valid cmake (\n";
} }
CMakeBuildResult bad = CMakeBuildResult bad =
cmake_build_project("/tmp/fdesigner_cmake_broken", def); cmake_build_project("/tmp/lightgui_cmake_broken", def);
check(!bad.ok); check(!bad.ok);
// The generated GTK project from Phase 3 builds with cmake too. // The generated GTK project from Phase 3 builds with cmake too.
CMakeBuildResult gr_cmake = CMakeBuildResult gr_cmake =
cmake_build_project("/tmp/fdesigner_gen_test", def); cmake_build_project("/tmp/lightgui_gen_test", def);
check(gr_cmake.ok && gr_cmake.configured); check(gr_cmake.ok && gr_cmake.configured);
} }
@@ -3860,14 +3860,14 @@ static gboolean selftest_step(gpointer) {
// Persistence, including a customised colour on a named base. // Persistence, including a customised colour on a named base.
CodeTheme custom = dark; CodeTheme custom = dark;
custom.keyword = "#ff0000"; custom.keyword = "#ff0000";
check(custom.save("/tmp/fdesigner_theme.conf")); check(custom.save("/tmp/lightgui_theme.conf"));
CodeTheme reloaded; CodeTheme reloaded;
check(reloaded.load("/tmp/fdesigner_theme.conf")); check(reloaded.load("/tmp/lightgui_theme.conf"));
check(reloaded.name == "Dark" && reloaded.keyword == "#ff0000" && check(reloaded.name == "Dark" && reloaded.keyword == "#ff0000" &&
reloaded.background == dark.background); reloaded.background == dark.background);
// Missing file: load fails, defaults kept. // Missing file: load fails, defaults kept.
CodeTheme missing; CodeTheme missing;
check(!missing.load("/tmp/fdesigner_theme_no_such.conf")); check(!missing.load("/tmp/lightgui_theme_no_such.conf"));
check(missing.name == "Light"); check(missing.name == "Light");
// Tokeniser spans on a representative snippet. // Tokeniser spans on a representative snippet.
std::string sample = std::string sample =
@@ -3941,7 +3941,7 @@ static gboolean selftest_step(gpointer) {
std::string ftext; std::string ftext;
for (const auto& l : flines) ftext += l + "\n"; for (const auto& l : flines) ftext += l + "\n";
GtkWidget* cv = codeview_new(); GtkWidget* cv = codeview_new();
codeview_set_text(cv, ftext, "/tmp/fdesigner_codeview_test.cpp"); codeview_set_text(cv, ftext, "/tmp/lightgui_codeview_test.cpp");
check(codeview_line_count(cv) == 17); check(codeview_line_count(cv) == 17);
check(codeview_regions(cv).size() == 6); check(codeview_regions(cv).size() == 6);
check(codeview_toggle_fold_at(cv, 3)); // bar() starts line 3 check(codeview_toggle_fold_at(cv, 3)); // bar() starts line 3
@@ -4044,9 +4044,9 @@ static gboolean selftest_step(gpointer) {
check(!bsess.remove_staged_breakpoint("foo.cpp:42")); check(!bsess.remove_staged_breakpoint("foo.cpp:42"));
check(bsess.breakpoints().empty()); check(bsess.breakpoints().empty());
check(bsess.stage_breakpoint("foo.cpp:7")); check(bsess.stage_breakpoint("foo.cpp:7"));
check(bsess.save_breakpoints("/tmp/fdesigner_theme_bps.conf")); check(bsess.save_breakpoints("/tmp/lightgui_theme_bps.conf"));
GdbSession bsess2; GdbSession bsess2;
check(bsess2.load_breakpoints("/tmp/fdesigner_theme_bps.conf")); check(bsess2.load_breakpoints("/tmp/lightgui_theme_bps.conf"));
check(bsess2.breakpoints().size() == 1 && check(bsess2.breakpoints().size() == 1 &&
bsess2.breakpoints()[0].location == "foo.cpp:7"); bsess2.breakpoints()[0].location == "foo.cpp:7");
} }
@@ -4105,7 +4105,7 @@ int main(int argc, char** argv) {
if (!gtk_builder_add_from_file(builder, "ui/designer.ui", &error)) { if (!gtk_builder_add_from_file(builder, "ui/designer.ui", &error)) {
g_clear_error(&error); g_clear_error(&error);
if (!gtk_builder_add_from_file(builder, "../ui/designer.ui", &error)) { if (!gtk_builder_add_from_file(builder, "../ui/designer.ui", &error)) {
std::fprintf(stderr, "fdesigner: cannot load designer.ui: %s\n", std::fprintf(stderr, "lightgui: cannot load designer.ui: %s\n",
error ? error->message : "unknown error"); error ? error->message : "unknown error");
return 1; return 1;
} }
@@ -4122,7 +4122,7 @@ int main(int argc, char** argv) {
GTK_WIDGET(gtk_builder_get_object(builder, "palette_window")); GTK_WIDGET(gtk_builder_get_object(builder, "palette_window"));
if (!g_window || !g_canvas || !g_statusbar || !g_props_grid || if (!g_window || !g_canvas || !g_statusbar || !g_props_grid ||
!g_props_box || !g_selected_label || !g_palette_window) { !g_props_box || !g_selected_label || !g_palette_window) {
std::fprintf(stderr, "fdesigner: designer.ui is missing core objects\n"); std::fprintf(stderr, "lightgui: designer.ui is missing core objects\n");
return 1; return 1;
} }
g_status_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(g_statusbar), g_status_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(g_statusbar),
@@ -4336,7 +4336,7 @@ int main(int argc, char** argv) {
// Keep the code window's paused line + inspection pane in step // Keep the code window's paused line + inspection pane in step
// with the shared debugger session (200 ms poll). // with the shared debugger session (200 ms poll).
g_timeout_add(200, on_codewin_poll, nullptr); g_timeout_add(200, on_codewin_poll, nullptr);
if (std::getenv("FDESIGNER_OPEN_DEBUGGER") != nullptr) if (std::getenv("LIGHTGUI_OPEN_DEBUGGER") != nullptr)
g_idle_add(+[](gpointer) -> gboolean { g_idle_add(+[](gpointer) -> gboolean {
debugger_window_open(g_window); debugger_window_open(g_window);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
@@ -4344,7 +4344,7 @@ int main(int argc, char** argv) {
nullptr); nullptr);
// Test hook (also used by tests/debugger_tests.sh): open the debugger // Test hook (also used by tests/debugger_tests.sh): open the debugger
// window and its settings dialog at startup. // window and its settings dialog at startup.
if (std::getenv("FDESIGNER_OPEN_DEBUGGER_SETTINGS") != nullptr) if (std::getenv("LIGHTGUI_OPEN_DEBUGGER_SETTINGS") != nullptr)
g_idle_add(+[](gpointer) -> gboolean { g_idle_add(+[](gpointer) -> gboolean {
debugger_window_open(g_window); debugger_window_open(g_window);
debugger_settings_open(g_window); debugger_settings_open(g_window);
@@ -4353,7 +4353,7 @@ int main(int argc, char** argv) {
nullptr); nullptr);
// [font-settings] Test hook (used by tests/font_tests.sh): // [font-settings] Test hook (used by tests/font_tests.sh):
// open the Preferences dialog at startup. // open the Preferences dialog at startup.
if (std::getenv("FDESIGNER_OPEN_PREFERENCES") != nullptr) if (std::getenv("LIGHTGUI_OPEN_PREFERENCES") != nullptr)
g_idle_add(+[](gpointer) -> gboolean { g_idle_add(+[](gpointer) -> gboolean {
preferences_open(g_window); preferences_open(g_window);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
@@ -4362,11 +4362,11 @@ int main(int argc, char** argv) {
// Test hook (used by tests/code_window_tests.sh): start a target // Test hook (used by tests/code_window_tests.sh): start a target
// under the debugger at startup, staging a breakpoint first. // under the debugger at startup, staging a breakpoint first.
// FDESIGNER_DEBUG_TARGET=<exe> FDESIGNER_DEBUG_BREAK=<file:line> // LIGHTGUI_DEBUG_TARGET=<exe> LIGHTGUI_DEBUG_BREAK=<file:line>
const char* dbg_target = std::getenv("FDESIGNER_DEBUG_TARGET"); const char* dbg_target = std::getenv("LIGHTGUI_DEBUG_TARGET");
if (dbg_target != nullptr) { if (dbg_target != nullptr) {
std::string exe = dbg_target; std::string exe = dbg_target;
const char* bp = std::getenv("FDESIGNER_DEBUG_BREAK"); const char* bp = std::getenv("LIGHTGUI_DEBUG_BREAK");
std::string loc = bp ? bp : ""; std::string loc = bp ? bp : "";
g_idle_add( g_idle_add(
+[](gpointer data) -> gboolean { +[](gpointer data) -> gboolean {
@@ -4382,20 +4382,20 @@ int main(int argc, char** argv) {
} }
// Test hooks (also used by tests/theme_tests.sh): open the code // Test hooks (also used by tests/theme_tests.sh): open the code
// view / theme picker at startup. // view / theme picker at startup.
if (std::getenv("FDESIGNER_OPEN_CODEVIEW") != nullptr) if (std::getenv("LIGHTGUI_OPEN_CODEVIEW") != nullptr)
g_idle_add(+[](gpointer) -> gboolean { g_idle_add(+[](gpointer) -> gboolean {
open_code_view(); open_code_view();
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
}, },
nullptr); nullptr);
if (std::getenv("FDESIGNER_OPEN_THEME") != nullptr) if (std::getenv("LIGHTGUI_OPEN_THEME") != nullptr)
g_idle_add(+[](gpointer) -> gboolean { g_idle_add(+[](gpointer) -> gboolean {
theme_picker_open(g_window, nullptr); theme_picker_open(g_window, nullptr);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
}, },
nullptr); nullptr);
bool selftest = std::getenv("FDESIGNER_SELFTEST") != nullptr; bool selftest = std::getenv("LIGHTGUI_SELFTEST") != nullptr;
if (selftest) g_idle_add(selftest_step, nullptr); if (selftest) g_idle_add(selftest_step, nullptr);
gtk_main(); gtk_main();
+1 -1
View File
@@ -1,4 +1,4 @@
// FDesigner model — the designed window as data. // LightGUI model — the designed window as data.
// Mirrors the Python original's widget dict: every placed widget has a name, // Mirrors the Python original's widget dict: every placed widget has a name,
// a type, absolute geometry (Tk .place() style), and a property map. // a type, absolute geometry (Tk .place() style), and a property map.
+5 -5
View File
@@ -1,4 +1,4 @@
// FDesigner global font settings — implementation. See preferences.h. // LightGUI global font settings — implementation. See preferences.h.
#include "preferences.h" #include "preferences.h"
#include <sys/stat.h> #include <sys/stat.h>
@@ -50,7 +50,7 @@ void load_css(GtkCssProvider* provider, const std::string& css) {
GError* error = nullptr; GError* error = nullptr;
gtk_css_provider_load_from_data(provider, css.c_str(), -1, &error); gtk_css_provider_load_from_data(provider, css.c_str(), -1, &error);
if (error) { if (error) {
std::fprintf(stderr, "fdesigner: font CSS failed: %s\n", std::fprintf(stderr, "lightgui: font CSS failed: %s\n",
error->message); error->message);
g_error_free(error); g_error_free(error);
} }
@@ -62,9 +62,9 @@ bool g_current_loaded = false;
} // namespace } // namespace
std::string FontSettings::default_path() { std::string FontSettings::default_path() {
const char* e = std::getenv("FDESIGNER_SETTINGS_CONF"); const char* e = std::getenv("LIGHTGUI_SETTINGS_CONF");
if (e && *e) return e; if (e && *e) return e;
return home_dir() + "/.config/fdesigner/settings.conf"; return home_dir() + "/.config/lightgui/settings.conf";
} }
std::string FontSettings::sanitized(const std::string& desc, std::string FontSettings::sanitized(const std::string& desc,
@@ -128,7 +128,7 @@ bool FontSettings::save(const std::string& path) const {
ensure_parent_dir(p); ensure_parent_dir(p);
std::ofstream f(p); std::ofstream f(p);
if (!f) return false; if (!f) return false;
f << "# FDesigner settings\n"; f << "# LightGUI settings\n";
f << "font=" << sanitized(font, "Sans 10") << "\n"; f << "font=" << sanitized(font, "Sans 10") << "\n";
f << "code_font=" << sanitized(code_font, "Monospace 11") << "\n"; f << "code_font=" << sanitized(code_font, "Monospace 11") << "\n";
return (bool)f; return (bool)f;
+4 -4
View File
@@ -1,8 +1,8 @@
// FDesigner global font settings — Edit -> Preferences... // LightGUI global font settings — Edit -> Preferences...
// //
// One interface font and one code/text-view font, chosen with GtkFontButton // One interface font and one code/text-view font, chosen with GtkFontButton
// widgets. Persisted in ~/.config/fdesigner/settings.conf (key=value, the // widgets. Persisted in ~/.config/lightgui/settings.conf (key=value, the
// same pattern as the debugger's debugger.conf); FDESIGNER_SETTINGS_CONF // same pattern as the debugger's debugger.conf); LIGHTGUI_SETTINGS_CONF
// overrides the path (used by tests). // overrides the path (used by tests).
// //
// Application is live and visible: the interface font is installed as a // Application is live and visible: the interface font is installed as a
@@ -21,7 +21,7 @@ struct FontSettings {
std::string font = "Sans 10"; // interface font (Pango description) std::string font = "Sans 10"; // interface font (Pango description)
std::string code_font = "Monospace 11"; // code / text-view font std::string code_font = "Monospace 11"; // code / text-view font
static std::string default_path(); // ~/.config/fdesigner/settings.conf static std::string default_path(); // ~/.config/lightgui/settings.conf
bool save(const std::string& path = "") const; bool save(const std::string& path = "") const;
bool load(const std::string& path = ""); bool load(const std::string& path = "");
+4 -4
View File
@@ -1,4 +1,4 @@
// FDesigner project files (.fdj) — see project_io.h. // LightGUI project files (.fdj) — see project_io.h.
#include "project_io.h" #include "project_io.h"
@@ -39,7 +39,7 @@ bool save_project_file(const std::string& path, const Project& p,
std::string& err) { std::string& err) {
std::ostringstream o; std::ostringstream o;
o << "{\n" o << "{\n"
<< " \"format\": \"fdesigner\",\n" << " \"format\": \"lightgui\",\n"
<< " \"version\": 1,\n" << " \"version\": 1,\n"
<< " \"window\": {\n" << " \"window\": {\n"
<< " \"title\": \"" << json_escape(p.title) << "\",\n" << " \"title\": \"" << json_escape(p.title) << "\",\n"
@@ -316,8 +316,8 @@ bool load_project_file(const std::string& path, Project& out,
err = "trailing data after JSON in " + path; err = "trailing data after JSON in " + path;
return false; return false;
} }
if (jstr(root.find("format"), "") != "fdesigner") { if (jstr(root.find("format"), "") != "lightgui") {
err = path + " is not an fdesigner project file"; err = path + " is not an lightgui project file";
return false; return false;
} }
if (jint(root.find("version"), 0) != 1) { if (jint(root.find("version"), 0) != 1) {
+2 -2
View File
@@ -1,8 +1,8 @@
// FDesigner project files (.fdj) — JSON save/load, replacing the Python // LightGUI project files (.fdj) — JSON save/load, replacing the Python
// original's pickle files. Hand-rolled JSON (the model is small; no new // original's pickle files. Hand-rolled JSON (the model is small; no new
// dependencies). Format version 1: // dependencies). Format version 1:
// //
// { "format": "fdesigner", "version": 1, // { "format": "lightgui", "version": 1,
// "window": { "title", "class_name", "width", "height", "background" }, // "window": { "title", "class_name", "width", "height", "background" },
// "widgets": [ { "name", "type", "x", "y", "width", "height", // "widgets": [ { "name", "type", "x", "y", "width", "height",
// "props": { name: value, ... } } ] } // "props": { name: value, ... } } ] }
+2 -2
View File
@@ -1,5 +1,5 @@
// FDesigner property tables — the GTK counterpart of the original's // LightGUI property tables — the GTK counterpart of the original's
// per-widget parameter mapping (the Entry_001..019 tables in fdesigner7.py). // per-widget parameter mapping (the Entry_001..019 tables in lightgui7.py).
// Each palette type lists the properties the designer can edit; values are // Each palette type lists the properties the designer can edit; values are
// stored in Widget.props as canonical strings and applied live with // stored in Widget.props as canonical strings and applied live with
// g_object_set (or, for the two pseudo-properties background/foreground, // g_object_set (or, for the two pseudo-properties background/foreground,
+5 -5
View File
@@ -1,4 +1,4 @@
// FDesigner code-view color themes — implementation. See theme.h. // LightGUI code-view color themes — implementation. See theme.h.
#include "theme.h" #include "theme.h"
#include <sys/stat.h> #include <sys/stat.h>
@@ -132,9 +132,9 @@ bool CodeTheme::is_builtin(const std::string& name) {
} }
std::string CodeTheme::default_path() { std::string CodeTheme::default_path() {
const char* e = std::getenv("FDESIGNER_THEME_CONF"); const char* e = std::getenv("LIGHTGUI_THEME_CONF");
if (e && *e) return e; if (e && *e) return e;
return home_dir() + "/.config/fdesigner/theme.conf"; return home_dir() + "/.config/lightgui/theme.conf";
} }
bool CodeTheme::save(const std::string& path) const { bool CodeTheme::save(const std::string& path) const {
@@ -370,7 +370,7 @@ void theme_apply_to_view(GtkWidget* view, const CodeTheme& theme) {
GError* error = nullptr; GError* error = nullptr;
gtk_css_provider_load_from_data(provider, theme.css().c_str(), -1, &error); gtk_css_provider_load_from_data(provider, theme.css().c_str(), -1, &error);
if (error) { if (error) {
std::fprintf(stderr, "fdesigner: theme CSS failed: %s\n", std::fprintf(stderr, "lightgui: theme CSS failed: %s\n",
error->message); error->message);
g_error_free(error); g_error_free(error);
} }
@@ -483,7 +483,7 @@ bool theme_picker_open(GtkWidget* parent,
} }
GtkWidget* note = gtk_label_new( GtkWidget* note = gtk_label_new(
"Pick a built-in theme, then tweak any colour.\n" "Pick a built-in theme, then tweak any colour.\n"
"Apply saves to ~/.config/fdesigner/theme.conf."); "Apply saves to ~/.config/lightgui/theme.conf.");
gtk_label_set_line_wrap(GTK_LABEL(note), TRUE); gtk_label_set_line_wrap(GTK_LABEL(note), TRUE);
gtk_widget_set_halign(note, GTK_ALIGN_START); gtk_widget_set_halign(note, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(grid), note, 0, row, 2, 1); gtk_grid_attach(GTK_GRID(grid), note, 0, row, 2, 1);
+5 -5
View File
@@ -1,11 +1,11 @@
// FDesigner code-view color themes — syntax-highlighting themes for the // LightGUI code-view color themes — syntax-highlighting themes for the
// code view (src/codeview.h). Four built-ins: Light, Dark, Monokai, // code view (src/codeview.h). Four built-ins: Light, Dark, Monokai,
// Solarized Dark. Each theme colours keywords, types, strings, comments, // Solarized Dark. Each theme colours keywords, types, strings, comments,
// numbers, preprocessor lines, plus the view background/foreground and // numbers, preprocessor lines, plus the view background/foreground and
// the current-execution-line background. // the current-execution-line background.
// //
// Persistence: ~/.config/fdesigner/theme.conf (key=value, same pattern // Persistence: ~/.config/lightgui/theme.conf (key=value, same pattern
// as the debugger settings); FDESIGNER_THEME_CONF overrides the path // as the debugger settings); LIGHTGUI_THEME_CONF overrides the path
// (used by tests). The file stores the theme name plus every colour, so // (used by tests). The file stores the theme name plus every colour, so
// a hand-edited or picker-customised colour survives a restart: on load // a hand-edited or picker-customised colour survives a restart: on load
// the named built-in is taken as the base and any colour keys present // the named built-in is taken as the base and any colour keys present
@@ -13,7 +13,7 @@
// a custom variant of that base; name "Custom" starts from Dark. // a custom variant of that base; name "Custom" starts from Dark.
// //
// NOTE (merge): the font-settings branch owns Edit -> Preferences and // NOTE (merge): the font-settings branch owns Edit -> Preferences and
// ~/.config/fdesigner/settings.conf. The theme picker lives under // ~/.config/lightgui/settings.conf. The theme picker lives under
// View -> Color Theme... and its own theme.conf, deliberately, so the // View -> Color Theme... and its own theme.conf, deliberately, so the
// two branches merge without touching each other; a later pass can move // two branches merge without touching each other; a later pass can move
// the picker into Preferences. // the picker into Preferences.
@@ -43,7 +43,7 @@ struct CodeTheme {
// Strict "#rrggbb" (case-insensitive hex). Exposed for tests. // Strict "#rrggbb" (case-insensitive hex). Exposed for tests.
static bool valid_color(const std::string& s); static bool valid_color(const std::string& s);
static std::string default_path(); // ~/.config/fdesigner/theme.conf static std::string default_path(); // ~/.config/lightgui/theme.conf
bool save(const std::string& path = "") const; bool save(const std::string& path = "") const;
bool load(const std::string& path = ""); bool load(const std::string& path = "");
// CSS for the view (sets both "textview" and "textview text": // CSS for the view (sets both "textview" and "textview text":
+1 -1
View File
@@ -44,7 +44,7 @@ static int run(const std::string& cmd) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
std::string base = argc > 1 ? argv[1] : "/tmp/fdesigner_cmake_tests"; std::string base = argc > 1 ? argv[1] : "/tmp/lightgui_cmake_tests";
std::error_code ec; std::error_code ec;
fs::remove_all(base, ec); fs::remove_all(base, ec);
fs::create_directories(base, ec); fs::create_directories(base, ec);
+9 -9
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# CMake tests for FDesigner: generated CMakeLists.txt contents, real # CMake tests for LightGUI: generated CMakeLists.txt contents, real
# configure+build of generated and hand-written CMake projects (GTK under # configure+build of generated and hand-written CMake projects (GTK under
# Xvfb, console run), settings persistence, and failure reporting. # Xvfb, console run), settings persistence, and failure reporting.
# Usage: tests/cmake_tests.sh (run from the repo root; builds fdesigner # Usage: tests/cmake_tests.sh (run from the repo root; builds lightgui
# first so the self-test's CMake phase is exercised too.) # first so the self-test's CMake phase is exercised too.)
set -u set -u
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
@@ -10,10 +10,10 @@ cd "$(dirname "$0")/.."
pass=0; fail=0 pass=0; fail=0
note() { if [ "$1" = 0 ]; then pass=$((pass+1)); else fail=$((fail+1)); fi; } note() { if [ "$1" = 0 ]; then pass=$((pass+1)); else fail=$((fail+1)); fi; }
echo "== building fdesigner ==" echo "== building lightgui =="
make > /tmp/fdesigner_cmake_make.log 2>&1 make > /tmp/lightgui_cmake_make.log 2>&1
note $? note $?
if [ $fail -ne 0 ]; then echo "FAIL make — see /tmp/fdesigner_cmake_make.log"; exit 1; fi if [ $fail -ne 0 ]; then echo "FAIL make — see /tmp/lightgui_cmake_make.log"; exit 1; fi
echo "PASS make" echo "PASS make"
echo "== building cmake probe ==" echo "== building cmake probe =="
@@ -25,17 +25,17 @@ if [ $fail -ne 0 ]; then echo "FAIL probe build — see /tmp/cmake_probe_build.l
echo "PASS probe build" echo "PASS probe build"
echo "== probe (generate + cmake configure/build + run + settings + failures) ==" echo "== probe (generate + cmake configure/build + run + settings + failures) =="
/tmp/cmake_probe /tmp/fdesigner_cmake_tests /tmp/cmake_probe /tmp/lightgui_cmake_tests
rc=$? rc=$?
note $rc note $rc
echo "== designer self-test (includes CMake Phase 9) ==" echo "== designer self-test (includes CMake Phase 9) =="
FDESIGNER_SELFTEST=1 timeout 120 xvfb-run -a ./fdesigner > /tmp/fdesigner_cmake_selftest.log 2>&1 LIGHTGUI_SELFTEST=1 timeout 120 xvfb-run -a ./lightgui > /tmp/lightgui_cmake_selftest.log 2>&1
rc=$? rc=$?
if [ $rc -eq 0 ] && grep -q "SELFTEST PASS" /tmp/fdesigner_cmake_selftest.log; then if [ $rc -eq 0 ] && grep -q "SELFTEST PASS" /tmp/lightgui_cmake_selftest.log; then
echo "PASS selftest"; pass=$((pass+1)) echo "PASS selftest"; pass=$((pass+1))
else else
echo "FAIL selftest (rc=$rc) — see /tmp/fdesigner_cmake_selftest.log"; fail=$((fail+1)) echo "FAIL selftest (rc=$rc) — see /tmp/lightgui_cmake_selftest.log"; fail=$((fail+1))
fi fi
echo "== cmake tests: $pass passed, $fail failed ==" echo "== cmake tests: $pass passed, $fail failed =="
+16 -16
View File
@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# FDesigner code-window tests (round 3). # LightGUI code-window tests (round 3).
# tests/code_window_tests.sh # tests/code_window_tests.sh
# Verifies, against the REAL app under Xvfb: # Verifies, against the REAL app under Xvfb:
# (a) the code window is a separate top-level window with its own # (a) the code window is a separate top-level window with its own
@@ -16,8 +16,8 @@
# not stale values; # not stale values;
# (f) closing the code window does not kill the app, and View -> # (f) closing the code window does not kill the app, and View ->
# Code View reopens it. # Code View reopens it.
# The app is driven through FDESIGNER_DEBUG_TARGET / BREAK (autorun) # The app is driven through LIGHTGUI_DEBUG_TARGET / BREAK (autorun)
# and the FDESIGNER_CODEWIN_DUMP snapshot; stepping uses the debugger # and the LIGHTGUI_CODEWIN_DUMP snapshot; stepping uses the debugger
# window's F5/F10/F11 shortcuts. Prints a PASS/FAIL summary; exits # window's F5/F10/F11 shortcuts. Prints a PASS/FAIL summary; exits
# non-zero if anything fails. Run from the repo root. # non-zero if anything fails. Run from the repo root.
set -u set -u
@@ -34,10 +34,10 @@ fail() { say "FAIL $1"; FAIL=1; }
note() { say " -- $1"; } note() { say " -- $1"; }
# --- build --------------------------------------------------------------- # --- build ---------------------------------------------------------------
say "== building fdesigner ==" say "== building lightgui =="
make >"$WORK/make.log" 2>&1 || { say "FAIL fdesigner build"; cat "$WORK/make.log"; exit 1; } make >"$WORK/make.log" 2>&1 || { say "FAIL lightgui build"; cat "$WORK/make.log"; exit 1; }
if grep -q "warning" "$WORK/make.log"; then if grep -q "warning" "$WORK/make.log"; then
say "FAIL fdesigner build has warnings"; grep "warning" "$WORK/make.log"; FAIL=1 say "FAIL lightgui build has warnings"; grep "warning" "$WORK/make.log"; FAIL=1
fi fi
say "== building test targets ==" say "== building test targets =="
cp "$ROOT/tests/codewin/prog.c" "$WORK/prog.c" cp "$ROOT/tests/codewin/prog.c" "$WORK/prog.c"
@@ -49,8 +49,8 @@ sed -n '11p' "$WORK/prog.c" | grep -q "return z" || fail "prog.c:11 is not retur
sed -n '14p' "$WORK/prog.c" | grep -q "int a = 42" || fail "prog.c:14 is not a=42" sed -n '14p' "$WORK/prog.c" | grep -q "int a = 42" || fail "prog.c:14 is not a=42"
# --- self-test (unit: paused tag colours, inspection API) ---------------- # --- self-test (unit: paused tag colours, inspection API) ----------------
say "== fdesigner self-test (paused line + inspection block) ==" say "== lightgui self-test (paused line + inspection block) =="
if FDESIGNER_SELFTEST=1 xvfb-run -a timeout 120 ./fdesigner >"$WORK/selftest.log" 2>&1; then if LIGHTGUI_SELFTEST=1 xvfb-run -a timeout 120 ./lightgui >"$WORK/selftest.log" 2>&1; then
grep -q "SELFTEST PASS" "$WORK/selftest.log" && pass "selftest" || fail "selftest-no-pass-line" grep -q "SELFTEST PASS" "$WORK/selftest.log" && pass "selftest" || fail "selftest-no-pass-line"
else else
fail "selftest"; cat "$WORK/selftest.log" fail "selftest"; cat "$WORK/selftest.log"
@@ -59,9 +59,9 @@ fi
# --- GUI helpers ---------------------------------------------------------- # --- GUI helpers ----------------------------------------------------------
XDISP=":99" XDISP=":99"
export DISPLAY="$XDISP" export DISPLAY="$XDISP"
codewin_id() { xdotool search --name "FDesigner — Code" 2>/dev/null | head -1; } codewin_id() { xdotool search --name "LightGUI — Code" 2>/dev/null | head -1; }
dbgwin_id() { xdotool search --name "FDesigner Debugger" 2>/dev/null | head -1; } dbgwin_id() { xdotool search --name "LightGUI Debugger" 2>/dev/null | head -1; }
mainwin_id() { xdotool search --name '^FDesigner — C\+\+/GTK$' 2>/dev/null | head -1; } mainwin_id() { xdotool search --name '^LightGUI — C\+\+/GTK$' 2>/dev/null | head -1; }
dump_has() { grep -q "$1" "$WORK/dump.txt" 2>/dev/null; } dump_has() { grep -q "$1" "$WORK/dump.txt" 2>/dev/null; }
wait_dump() { # $1=pattern $2=timeout-secs wait_dump() { # $1=pattern $2=timeout-secs
i=0 i=0
@@ -82,14 +82,14 @@ wait_win() { # $1=which(codewin|dbgwin|mainwin) $2=timeout-secs
launch() { # $1=target $2=breakloc-or-empty $3=home-dir launch() { # $1=target $2=breakloc-or-empty $3=home-dir
rm -f "$WORK/dump.txt" rm -f "$WORK/dump.txt"
(cd "$ROOT" && HOME="$3" DISPLAY="$XDISP" \ (cd "$ROOT" && HOME="$3" DISPLAY="$XDISP" \
FDESIGNER_DEBUG_TARGET="$1" FDESIGNER_DEBUG_BREAK="$2" \ LIGHTGUI_DEBUG_TARGET="$1" LIGHTGUI_DEBUG_BREAK="$2" \
FDESIGNER_CODEWIN_DUMP="$WORK/dump.txt" \ LIGHTGUI_CODEWIN_DUMP="$WORK/dump.txt" \
timeout 120 ./fdesigner >"$WORK/app.log" 2>&1) & timeout 120 ./lightgui >"$WORK/app.log" 2>&1) &
APP=$! APP=$!
} }
kill_app() { kill_app() {
kill $APP 2>/dev/null kill $APP 2>/dev/null
pkill -x fdesigner 2>/dev/null pkill -x lightgui 2>/dev/null
wait $APP 2>/dev/null wait $APP 2>/dev/null
sleep 1 sleep 1
} }
@@ -216,7 +216,7 @@ if [ "${BAND_H:-0}" -gt 5 ] && [ "${BAND_TOP:- -1}" -ge 0 ]; then
Y16=$(( (BAND_TOP + BAND_BOT) / 2 - TITLE_OFF )) Y16=$(( (BAND_TOP + BAND_BOT) / 2 - TITLE_OFF ))
Y14=$(( Y16 - 2 * BAND_H )) Y14=$(( Y16 - 2 * BAND_H ))
note "gutter-click geometry: win_h=$WIN_H shot_h=$SHOT_H title_off=$TITLE_OFF y16=$Y16 y14=$Y14" note "gutter-click geometry: win_h=$WIN_H shot_h=$SHOT_H title_off=$TITLE_OFF y16=$Y16 y14=$Y14"
BPS="$WORK/homeA/.config/fdesigner/debugger_bps.conf" BPS="$WORK/homeA/.config/lightgui/debugger_bps.conf"
GUT_OK=0 GUT_OK=0
for TRY in 0 1 2; do for TRY in 0 1 2; do
case $TRY in case $TRY in
+2 -2
View File
@@ -1,6 +1,6 @@
// FDesigner code-window test target: known locals in two scopes. // LightGUI code-window test target: known locals in two scopes.
// Compile with: gcc -g -O0 -o prog prog.c (from the work dir, so the // Compile with: gcc -g -O0 -o prog prog.c (from the work dir, so the
// DWARF paths match the FDESIGNER_DEBUG_BREAK locations used by // DWARF paths match the LIGHTGUI_DEBUG_BREAK locations used by
// tests/code_window_tests.sh). Line numbers are load-bearing: // tests/code_window_tests.sh). Line numbers are load-bearing:
// main: a=42 at line 14, msg="hello" at line 15 // main: a=42 at line 14, msg="hello" at line 15
// helper: x=42, y=3.5, z=44 at line 11 (return) // helper: x=42, y=3.5, z=44 at line 11 (return)
+1 -1
View File
@@ -1,4 +1,4 @@
// Headless driver for the FDesigner debugger backend (GdbSession). // Headless driver for the LightGUI debugger backend (GdbSession).
// Usage: dbg_harness console <dir> — console C++ tests // Usage: dbg_harness console <dir> — console C++ tests
// dbg_harness gtk <dir> — GTK app tests (run under xvfb-run) // dbg_harness gtk <dir> — GTK app tests (run under xvfb-run)
// Each test prints PASS/FAIL with its name; exit code is non-zero if any // Each test prints PASS/FAIL with its name; exit code is non-zero if any
+12 -12
View File
@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# FDesigner debugger test suite. # LightGUI debugger test suite.
# tests/debugger_tests.sh [--no-gui] # tests/debugger_tests.sh [--no-gui]
# Builds the console + GTK test targets and the headless harness, runs the # Builds the console + GTK test targets and the headless harness, runs the
# console suite, the GTK suite under Xvfb, and a GUI smoke test (the real # console suite, the GTK suite under Xvfb, and a GUI smoke test (the real
# fdesigner opens its debugger window and the Settings dialog path is # lightgui opens its debugger window and the Settings dialog path is
# exercised through the Debug menu ids in ui/designer.ui). # exercised through the Debug menu ids in ui/designer.ui).
# Prints a PASS/FAIL summary; exits non-zero if anything fails. # Prints a PASS/FAIL summary; exits non-zero if anything fails.
# Run from the repo root. # Run from the repo root.
@@ -27,8 +27,8 @@ g++ -g -O0 -o "$WORK/console" "$WORK/console.cpp" || FAIL=1
g++ -g -O0 -o "$WORK/spin" "$WORK/spin.cpp" || FAIL=1 g++ -g -O0 -o "$WORK/spin" "$WORK/spin.cpp" || FAIL=1
g++ -g -O0 -o "$WORK/gtkapp" "$WORK/gtkapp.cpp" $(pkg-config --cflags --libs gtk+-3.0) || FAIL=1 g++ -g -O0 -o "$WORK/gtkapp" "$WORK/gtkapp.cpp" $(pkg-config --cflags --libs gtk+-3.0) || FAIL=1
g++ -O2 -Wall -Wextra -std=c++17 -o "$WORK/dbg_harness" "$D/dbg_harness.cpp" "$ROOT/src/debugger.cpp" || FAIL=1 g++ -O2 -Wall -Wextra -std=c++17 -o "$WORK/dbg_harness" "$D/dbg_harness.cpp" "$ROOT/src/debugger.cpp" || FAIL=1
# fdesigner itself (with the debugger window) must build clean # lightgui itself (with the debugger window) must build clean
(cd "$ROOT" && make >/tmp/dbg_make.log 2>&1) || { say "FAIL fdesigner build"; cat /tmp/dbg_make.log; FAIL=1; } (cd "$ROOT" && make >/tmp/dbg_make.log 2>&1) || { say "FAIL lightgui build"; cat /tmp/dbg_make.log; FAIL=1; }
if [ "$FAIL" != "0" ]; then say "BUILD FAILED"; exit 1; fi if [ "$FAIL" != "0" ]; then say "BUILD FAILED"; exit 1; fi
@@ -48,38 +48,38 @@ cat "$WORK/gtk.log"
# --- GUI smoke test -------------------------------------------------------- # --- GUI smoke test --------------------------------------------------------
if [ "${1:-}" != "--no-gui" ]; then if [ "${1:-}" != "--no-gui" ]; then
say "== GUI smoke test: fdesigner + debugger window ==" say "== GUI smoke test: lightgui + debugger window =="
# Debug menu + Debugger sub-menu ids must exist in the .ui # Debug menu + Debugger sub-menu ids must exist in the .ui
for id in menu_debug mi_debug_open mi_dbg_settings mi_debug_settings \ for id in menu_debug mi_debug_open mi_dbg_settings mi_debug_settings \
menu_debugger_sub mi_dbg_break_main mi_dbg_stop_entry mi_dbg_pretty; do menu_debugger_sub mi_dbg_break_main mi_dbg_stop_entry mi_dbg_pretty; do
grep -q "id=\"$id\"" "$ROOT/ui/designer.ui" || { say "FAIL ui missing id $id"; FAIL=1; } grep -q "id=\"$id\"" "$ROOT/ui/designer.ui" || { say "FAIL ui missing id $id"; FAIL=1; }
done done
say "ui menu ids present" say "ui menu ids present"
# Launch fdesigner on a fixed Xvfb display with the debugger window # Launch lightgui on a fixed Xvfb display with the debugger window
# auto-opened, then verify the window exists via xdotool. # auto-opened, then verify the window exists via xdotool.
Xvfb :99 -screen 0 1280x900x24 >/dev/null 2>&1 & Xvfb :99 -screen 0 1280x900x24 >/dev/null 2>&1 &
XVPID=$! XVPID=$!
sleep 2 sleep 2
(cd "$ROOT" && DISPLAY=:99 FDESIGNER_OPEN_DEBUGGER=1 timeout 25 ./fdesigner >"$WORK/gui.log" 2>&1) & (cd "$ROOT" && DISPLAY=:99 LIGHTGUI_OPEN_DEBUGGER=1 timeout 25 ./lightgui >"$WORK/gui.log" 2>&1) &
APID=$! APID=$!
OK=0 OK=0
for i in $(seq 1 20); do for i in $(seq 1 20); do
sleep 1 sleep 1
if DISPLAY=:99 xdotool search --name "FDesigner Debugger" >/dev/null 2>&1; then OK=1; break; fi if DISPLAY=:99 xdotool search --name "LightGUI Debugger" >/dev/null 2>&1; then OK=1; break; fi
done done
if [ "$OK" = "1" ]; then if [ "$OK" = "1" ]; then
DISPLAY=:99 xdotool search --name "FDesigner Debugger" getwindowname %@ 2>/dev/null | head -3 DISPLAY=:99 xdotool search --name "LightGUI Debugger" getwindowname %@ 2>/dev/null | head -3
# Screenshot for the record (xwd if present, else skip gracefully). # Screenshot for the record (xwd if present, else skip gracefully).
if command -v xwd >/dev/null 2>&1; then if command -v xwd >/dev/null 2>&1; then
DISPLAY=:99 xwd -root -silent -out "$WORK/debugger_window.xwd" 2>/dev/null || true DISPLAY=:99 xwd -root -silent -out "$WORK/debugger_window.xwd" 2>/dev/null || true
fi fi
fi fi
kill $APID 2>/dev/null kill $APID 2>/dev/null
pkill -x fdesigner 2>/dev/null pkill -x lightgui 2>/dev/null
wait $APID 2>/dev/null wait $APID 2>/dev/null
if [ "$OK" = "1" ]; then say "PASS gui_debugger_window_opens"; else say "FAIL gui_debugger_window_opens"; cat "$WORK/gui.log"; FAIL=1; fi if [ "$OK" = "1" ]; then say "PASS gui_debugger_window_opens"; else say "FAIL gui_debugger_window_opens"; cat "$WORK/gui.log"; FAIL=1; fi
# Settings dialog: launch with the settings hook and look for its window. # Settings dialog: launch with the settings hook and look for its window.
(cd "$ROOT" && DISPLAY=:99 FDESIGNER_OPEN_DEBUGGER_SETTINGS=1 timeout 25 ./fdesigner >"$WORK/gui_settings.log" 2>&1) & (cd "$ROOT" && DISPLAY=:99 LIGHTGUI_OPEN_DEBUGGER_SETTINGS=1 timeout 25 ./lightgui >"$WORK/gui_settings.log" 2>&1) &
APID=$! APID=$!
OK2=0 OK2=0
for i in $(seq 1 20); do for i in $(seq 1 20); do
@@ -87,7 +87,7 @@ if [ "${1:-}" != "--no-gui" ]; then
if DISPLAY=:99 xdotool search --name "Debugger Settings" >/dev/null 2>&1; then OK2=1; break; fi if DISPLAY=:99 xdotool search --name "Debugger Settings" >/dev/null 2>&1; then OK2=1; break; fi
done done
kill $APID 2>/dev/null kill $APID 2>/dev/null
pkill -x fdesigner 2>/dev/null pkill -x lightgui 2>/dev/null
wait $APID 2>/dev/null wait $APID 2>/dev/null
kill $XVPID 2>/dev/null kill $XVPID 2>/dev/null
if [ "$OK2" = "1" ]; then say "PASS gui_debugger_settings_dialog_opens"; else say "FAIL gui_debugger_settings_dialog_opens"; cat "$WORK/gui_settings.log"; FAIL=1; fi if [ "$OK2" = "1" ]; then say "PASS gui_debugger_settings_dialog_opens"; else say "FAIL gui_debugger_settings_dialog_opens"; cat "$WORK/gui_settings.log"; FAIL=1; fi
+1 -1
View File
@@ -4,7 +4,7 @@
// Xvfb with stderr redirected to argv[1]; the harness reads that file // Xvfb with stderr redirected to argv[1]; the harness reads that file
// back and prints a per-widget pass/fail table to stdout. // back and prints a per-widget pass/fail table to stdout.
// Usage: event_handler_runtime <event-log-path> // Usage: event_handler_runtime <event-log-path>
// (Compile with -DFDESIGNER_EVENT_TRACE and -I <generated dir>, linking // (Compile with -DLIGHTGUI_EVENT_TRACE and -I <generated dir>, linking
// the generated widget .cpp files except main.cpp.) // the generated widget .cpp files except main.cpp.)
#include <gtk/gtk.h> #include <gtk/gtk.h>
+1 -1
View File
@@ -69,7 +69,7 @@ static std::string first_item_id(const Widget& w, const EventDef& d) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
std::string out = argc > 1 ? argv[1] : "/tmp/fdesigner_events_gen"; std::string out = argc > 1 ? argv[1] : "/tmp/lightgui_events_gen";
Project p; Project p;
p.title = "Event Test"; p.title = "Event Test";
p.class_name = "MyWindow"; p.class_name = "MyWindow";
+16 -16
View File
@@ -13,13 +13,13 @@ pass=0; fail=0; failed=""
ok() { echo "PASS $1"; pass=$((pass+1)); } ok() { echo "PASS $1"; pass=$((pass+1)); }
bad() { echo "FAIL $1"; fail=$((fail+1)); failed="$failed $1"; } bad() { echo "FAIL $1"; fail=$((fail+1)); failed="$failed $1"; }
echo "== building fdesigner ==" echo "== building lightgui =="
if make > /tmp/events_make.log 2>&1; then ok make; else if make > /tmp/events_make.log 2>&1; then ok make; else
bad make; cat /tmp/events_make.log; exit 1 bad make; cat /tmp/events_make.log; exit 1
fi fi
echo "== designer self-test (Phase 8: event handlers) ==" echo "== designer self-test (Phase 8: event handlers) =="
if FDESIGNER_SELFTEST=1 timeout 60 xvfb-run -a ./fdesigner \ if LIGHTGUI_SELFTEST=1 timeout 60 xvfb-run -a ./lightgui \
> /tmp/events_selftest.log 2>&1; then > /tmp/events_selftest.log 2>&1; then
if grep -q "SELFTEST PASS" /tmp/events_selftest.log; then ok selftest; if grep -q "SELFTEST PASS" /tmp/events_selftest.log; then ok selftest;
else bad "selftest(no PASS line)"; tail -20 /tmp/events_selftest.log; fi else bad "selftest(no PASS line)"; tail -20 /tmp/events_selftest.log; fi
@@ -31,8 +31,8 @@ grep -E "GENERATED8" /tmp/events_selftest.log || true
echo "== event generator test (all 36 widget types) ==" echo "== event generator test (all 36 widget types) =="
if g++ -O2 -Wall -Wextra -std=c++17 -o /tmp/event_handler_tests \ if g++ -O2 -Wall -Wextra -std=c++17 -o /tmp/event_handler_tests \
tests/event_handler_tests.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp; then tests/event_handler_tests.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp; then
rm -rf /tmp/fdesigner_events_gen rm -rf /tmp/lightgui_events_gen
if /tmp/event_handler_tests /tmp/fdesigner_events_gen; then if /tmp/event_handler_tests /tmp/lightgui_events_gen; then
ok event-markers ok event-markers
else else
bad event-markers bad event-markers
@@ -42,37 +42,37 @@ else
fi fi
echo "== compile generated project (all widgets + handlers) ==" echo "== compile generated project (all widgets + handlers) =="
if (cd /tmp/fdesigner_events_gen && \ if (cd /tmp/lightgui_events_gen && \
make CXXFLAGS="-O2 -Wall -Wextra -std=c++17" >build.log 2>&1); then make CXXFLAGS="-O2 -Wall -Wextra -std=c++17" >build.log 2>&1); then
if grep -q "warning" /tmp/fdesigner_events_gen/build.log; then if grep -q "warning" /tmp/lightgui_events_gen/build.log; then
bad "generated-compile(warnings)" bad "generated-compile(warnings)"
grep "warning" /tmp/fdesigner_events_gen/build.log | head grep "warning" /tmp/lightgui_events_gen/build.log | head
else ok generated-compile; fi else ok generated-compile; fi
else else
bad generated-compile; cat /tmp/fdesigner_events_gen/build.log bad generated-compile; cat /tmp/lightgui_events_gen/build.log
fi fi
echo "== run generated project briefly ==" echo "== run generated project briefly =="
timeout 3 xvfb-run -a /tmp/fdesigner_events_gen/app \ timeout 3 xvfb-run -a /tmp/lightgui_events_gen/app \
> /tmp/fdesigner_events_gen/run.log 2>&1 > /tmp/lightgui_events_gen/run.log 2>&1
rc=$? rc=$?
if [ $rc -ne 124 ]; then if [ $rc -ne 124 ]; then
bad "generated-run(exit $rc)"; cat /tmp/fdesigner_events_gen/run.log bad "generated-run(exit $rc)"; cat /tmp/lightgui_events_gen/run.log
else else
badlog=$(grep -E "CRITICAL|WARNING \*\*" \ badlog=$(grep -E "CRITICAL|WARNING \*\*" \
/tmp/fdesigner_events_gen/run.log | grep -v "Could not load a pixbuf" || true) /tmp/lightgui_events_gen/run.log | grep -v "Could not load a pixbuf" || true)
if [ -n "$badlog" ]; then if [ -n "$badlog" ]; then
bad "generated-run(runtime warnings)"; echo "$badlog" bad "generated-run(runtime warnings)"; echo "$badlog"
else ok generated-run; fi else ok generated-run; fi
fi fi
echo "== runtime harness: trigger every signal, check handlers ran ==" echo "== runtime harness: trigger every signal, check handlers ran =="
GEN_SRCS=$(cd /tmp/fdesigner_events_gen && ls *.cpp | grep -v '^main.cpp$') GEN_SRCS=$(cd /tmp/lightgui_events_gen && ls *.cpp | grep -v '^main.cpp$')
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if g++ -O2 -Wall -Wextra -std=c++17 -DFDESIGNER_EVENT_TRACE \ if g++ -O2 -Wall -Wextra -std=c++17 -DLIGHTGUI_EVENT_TRACE \
-I/tmp/fdesigner_events_gen -o /tmp/event_handler_runtime \ -I/tmp/lightgui_events_gen -o /tmp/event_handler_runtime \
tests/event_handler_runtime.cpp \ tests/event_handler_runtime.cpp \
$(for s in $GEN_SRCS; do echo "/tmp/fdesigner_events_gen/$s"; done) \ $(for s in $GEN_SRCS; do echo "/tmp/lightgui_events_gen/$s"; done) \
$(pkg-config --cflags --libs gtk+-3.0) \ $(pkg-config --cflags --libs gtk+-3.0) \
> /tmp/event_runtime_build.log 2>&1; then > /tmp/event_runtime_build.log 2>&1; then
if grep -q "warning" /tmp/event_runtime_build.log; then if grep -q "warning" /tmp/event_runtime_build.log; then
+7 -7
View File
@@ -33,7 +33,7 @@ int main(int argc, char** argv) {
FontSettings fs; FontSettings fs;
fs.font = "DejaVu Sans 14"; fs.font = "DejaVu Sans 14";
fs.code_font = "DejaVu Sans Mono 13"; fs.code_font = "DejaVu Sans Mono 13";
const char* path = "/tmp/fdesigner_font_harness.conf"; const char* path = "/tmp/lightgui_font_harness.conf";
check(fs.save(path), "save-roundtrip"); check(fs.save(path), "save-roundtrip");
FontSettings fs2; FontSettings fs2;
check(fs2.load(path), "load-roundtrip"); check(fs2.load(path), "load-roundtrip");
@@ -43,18 +43,18 @@ int main(int argc, char** argv) {
// 3. Missing file: load fails, defaults kept. // 3. Missing file: load fails, defaults kept.
FontSettings fs3; FontSettings fs3;
check(!fs3.load("/tmp/fdesigner_font_no_such_file.conf"), check(!fs3.load("/tmp/lightgui_font_no_such_file.conf"),
"load-missing-fails"); "load-missing-fails");
check(fs3.font == "Sans 10", "load-missing-keeps-defaults"); check(fs3.font == "Sans 10", "load-missing-keeps-defaults");
// 4. Garbage in the file does not break loading. // 4. Garbage in the file does not break loading.
{ {
FILE* f = std::fopen("/tmp/fdesigner_font_garbage.conf", "w"); FILE* f = std::fopen("/tmp/lightgui_font_garbage.conf", "w");
std::fprintf(f, "# comment\nnot-a-kv-line\nfont=\ncode_font=\n"); std::fprintf(f, "# comment\nnot-a-kv-line\nfont=\ncode_font=\n");
std::fclose(f); std::fclose(f);
} }
FontSettings fs4; FontSettings fs4;
check(fs4.load("/tmp/fdesigner_font_garbage.conf"), check(fs4.load("/tmp/lightgui_font_garbage.conf"),
"load-garbage-file"); "load-garbage-file");
check(fs4.font == "Sans 10" && fs4.code_font == "Monospace 11", check(fs4.font == "Sans 10" && fs4.code_font == "Monospace 11",
"garbage-falls-back-to-defaults"); "garbage-falls-back-to-defaults");
@@ -74,11 +74,11 @@ int main(int argc, char** argv) {
"sanitize-keeps-family"); "sanitize-keeps-family");
// 6. Env override for the default path (mirrors debugger.conf). // 6. Env override for the default path (mirrors debugger.conf).
::setenv("FDESIGNER_SETTINGS_CONF", "/tmp/fdesigner_font_env.conf", 1); ::setenv("LIGHTGUI_SETTINGS_CONF", "/tmp/lightgui_font_env.conf", 1);
check(FontSettings::default_path() == check(FontSettings::default_path() ==
"/tmp/fdesigner_font_env.conf", "/tmp/lightgui_font_env.conf",
"env-override-path"); "env-override-path");
::unsetenv("FDESIGNER_SETTINGS_CONF"); ::unsetenv("LIGHTGUI_SETTINGS_CONF");
// 7. CSS generation. // 7. CSS generation.
check(fs.ui_css().find("DejaVu Sans") != std::string::npos && check(fs.ui_css().find("DejaVu Sans") != std::string::npos &&
+9 -9
View File
@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# FDesigner font settings tests. # LightGUI font settings tests.
# tests/font_tests.sh # tests/font_tests.sh
# Builds + runs the preferences harness (tests/font_tests.cpp, needs Xvfb), # Builds + runs the preferences harness (tests/font_tests.cpp, needs Xvfb),
# runs the fdesigner self-test (which has its own font block), and smoke # runs the lightgui self-test (which has its own font block), and smoke
# tests the real Preferences dialog (FDESIGNER_OPEN_PREFERENCES=1) with # tests the real Preferences dialog (LIGHTGUI_OPEN_PREFERENCES=1) with
# xdotool if available. Prints a PASS/FAIL summary; exits non-zero on # xdotool if available. Prints a PASS/FAIL summary; exits non-zero on
# any failure. Run from the repo root. # any failure. Run from the repo root.
set -u set -u
@@ -21,13 +21,13 @@ g++ -O2 -Wall -Wextra -std=c++17 -I src -o /tmp/font_tests tests/font_tests.cpp
say "== font harness (under Xvfb) ==" say "== font harness (under Xvfb) =="
xvfb-run -a /tmp/font_tests || FAIL=1 xvfb-run -a /tmp/font_tests || FAIL=1
say "== building fdesigner ==" say "== building lightgui =="
make >/tmp/font_make.log 2>&1 || { make >/tmp/font_make.log 2>&1 || {
say "FAIL fdesigner build"; cat /tmp/font_make.log; FAIL=1 say "FAIL lightgui build"; cat /tmp/font_make.log; FAIL=1
} }
if [ "$FAIL" = "0" ]; then if [ "$FAIL" = "0" ]; then
say "== fdesigner self-test (includes font block) ==" say "== lightgui self-test (includes font block) =="
FDESIGNER_SELFTEST=1 xvfb-run -a ./fdesigner || FAIL=1 LIGHTGUI_SELFTEST=1 xvfb-run -a ./lightgui || FAIL=1
fi fi
say "== Preferences dialog smoke test ==" say "== Preferences dialog smoke test =="
@@ -37,7 +37,7 @@ else
# Launch under a fresh Xvfb; the env hook opens the dialog at startup. # Launch under a fresh Xvfb; the env hook opens the dialog at startup.
# The dialog is modal, so the app stays up until we close it with Esc. # The dialog is modal, so the app stays up until we close it with Esc.
xvfb-run -a sh -c ' xvfb-run -a sh -c '
FDESIGNER_OPEN_PREFERENCES=1 ./fdesigner >/tmp/font_dlg.log 2>&1 & LIGHTGUI_OPEN_PREFERENCES=1 ./lightgui >/tmp/font_dlg.log 2>&1 &
APP=$! APP=$!
FOUND="" FOUND=""
i=0 i=0
@@ -68,7 +68,7 @@ else
say "== Preferences dialog Apply test ==" say "== Preferences dialog Apply test =="
rm -f /tmp/font_gui_apply.conf rm -f /tmp/font_gui_apply.conf
xvfb-run -a sh -c ' xvfb-run -a sh -c '
FDESIGNER_SETTINGS_CONF=/tmp/font_gui_apply.conf FDESIGNER_OPEN_PREFERENCES=1 ./fdesigner >/tmp/font_apply.log 2>&1 & LIGHTGUI_SETTINGS_CONF=/tmp/font_gui_apply.conf LIGHTGUI_OPEN_PREFERENCES=1 ./lightgui >/tmp/font_apply.log 2>&1 &
APP=$! APP=$!
FOUND="" FOUND=""
i=0 i=0
+1 -1
View File
@@ -156,7 +156,7 @@ int main(int argc, char** argv) {
"Edit: Cut | Copy & Paste | Select All\n" "Edit: Cut | Copy & Paste | Select All\n"
"this line has no colon and is ignored\n" "this line has no colon and is ignored\n"
": empty menu label ignored\n" ": empty menu label ignored\n"
"Help: About FDesigner\n"; "Help: About LightGUI\n";
p.widgets.push_back(mk("Button", "Button_001", 10, 10)); p.widgets.push_back(mk("Button", "Button_001", 10, 10));
emit("05_menus", p); emit("05_menus", p);
} }
+6 -6
View File
@@ -23,7 +23,7 @@ if python3 tools/verify_palette_icons.py > /tmp/icons_verify.log 2>&1; then
ok icons-verify; cat /tmp/icons_verify.log ok icons-verify; cat /tmp/icons_verify.log
else bad icons-verify; cat /tmp/icons_verify.log; fi else bad icons-verify; cat /tmp/icons_verify.log; fi
echo "== building fdesigner ==" echo "== building lightgui =="
if make clean > /tmp/icons_make.log 2>&1 && make >> /tmp/icons_make.log 2>&1; then if make clean > /tmp/icons_make.log 2>&1 && make >> /tmp/icons_make.log 2>&1; then
ok make ok make
if grep -qi "warning" /tmp/icons_make.log; then if grep -qi "warning" /tmp/icons_make.log; then
@@ -32,13 +32,13 @@ if make clean > /tmp/icons_make.log 2>&1 && make >> /tmp/icons_make.log 2>&1; th
else bad make; cat /tmp/icons_make.log; exit 1; fi else bad make; cat /tmp/icons_make.log; exit 1; fi
echo "== self-test (36/36 icons + no-scroll checks are inside) ==" echo "== self-test (36/36 icons + no-scroll checks are inside) =="
if FDESIGNER_SELFTEST=1 ./fdesigner > /tmp/icons_selftest.log 2>&1; then if LIGHTGUI_SELFTEST=1 ./lightgui > /tmp/icons_selftest.log 2>&1; then
grep -q "SELFTEST PASS" /tmp/icons_selftest.log && ok selftest || \ grep -q "SELFTEST PASS" /tmp/icons_selftest.log && ok selftest || \
{ bad selftest; tail -3 /tmp/icons_selftest.log; } { bad selftest; tail -3 /tmp/icons_selftest.log; }
else bad selftest; tail -3 /tmp/icons_selftest.log; fi else bad selftest; tail -3 /tmp/icons_selftest.log; fi
echo "== launching designer under Xvfb ($DISPLAY) ==" echo "== launching designer under Xvfb ($DISPLAY) =="
./fdesigner > /tmp/icons_app.log 2>&1 & ./lightgui > /tmp/icons_app.log 2>&1 &
APP_PID=$! APP_PID=$!
trap 'kill $APP_PID 2>/dev/null || true' EXIT trap 'kill $APP_PID 2>/dev/null || true' EXIT
sleep 3 sleep 3
@@ -47,9 +47,9 @@ if ! kill -0 $APP_PID 2>/dev/null; then
fi fi
ok app-start ok app-start
MAIN=$(xdotool search --name "FDesigner — C\+\+/GTK" | head -1) MAIN=$(xdotool search --name "LightGUI — C\+\+/GTK" | head -1)
PAL=$(xdotool search --name "FDesigner — Widgets" | head -1) PAL=$(xdotool search --name "LightGUI — Widgets" | head -1)
CODE=$(xdotool search --name "FDesigner — Code" | head -1) CODE=$(xdotool search --name "LightGUI — Code" | head -1)
[ -n "$PAL" ] && ok palette-window || bad palette-window [ -n "$PAL" ] && ok palette-window || bad palette-window
# Palette still exactly 250x780. # Palette still exactly 250x780.
+8 -8
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Palette-window tests: the widget palette is its own top-level window # Palette-window tests: the widget palette is its own top-level window
# ("FDesigner — Widgets"), tight 2-column Lazarus-style grid, opens with # ("LightGUI — Widgets"), tight 2-column Lazarus-style grid, opens with
# the designer, closes (hide, app survives) and reopens from View menu. # the designer, closes (hide, app survives) and reopens from View menu.
# Uses a tiny Xlib helper to send a real WM_DELETE_WINDOW (xdotool # Uses a tiny Xlib helper to send a real WM_DELETE_WINDOW (xdotool
# windowclose destroys the X window outright under bare Xvfb, which is # windowclose destroys the X window outright under bare Xvfb, which is
@@ -18,7 +18,7 @@ if [ -z "${DISPLAY:-}" ]; then
exit $? exit $?
fi fi
echo "== building fdesigner ==" echo "== building lightgui =="
if make > /tmp/palette_make.log 2>&1; then ok make; else if make > /tmp/palette_make.log 2>&1; then ok make; else
bad make; cat /tmp/palette_make.log; exit 1 bad make; cat /tmp/palette_make.log; exit 1
fi fi
@@ -69,7 +69,7 @@ if gcc -O2 -Wall -Wextra -o /tmp/palette_wmclose /tmp/palette_wmclose.c -lX11 \
else bad wmclose-helper-build; cat /tmp/palette_wmclose_build.log; exit 1; fi else bad wmclose-helper-build; cat /tmp/palette_wmclose_build.log; exit 1; fi
echo "== launching designer under Xvfb ($DISPLAY) ==" echo "== launching designer under Xvfb ($DISPLAY) =="
./fdesigner > /tmp/palette_app.log 2>&1 & ./lightgui > /tmp/palette_app.log 2>&1 &
APP_PID=$! APP_PID=$!
trap 'kill $APP_PID 2>/dev/null || true' EXIT trap 'kill $APP_PID 2>/dev/null || true' EXIT
sleep 3 sleep 3
@@ -78,8 +78,8 @@ if ! kill -0 $APP_PID 2>/dev/null; then
fi fi
ok app-start ok app-start
MAIN=$(xdotool search --name "FDesigner — C\+\+/GTK" | head -1) MAIN=$(xdotool search --name "LightGUI — C\+\+/GTK" | head -1)
PAL=$(xdotool search --name "FDesigner — Widgets" | head -1) PAL=$(xdotool search --name "LightGUI — Widgets" | head -1)
[ -n "$MAIN" ] && ok main-window || bad main-window [ -n "$MAIN" ] && ok main-window || bad main-window
[ -n "$PAL" ] && ok palette-window || bad palette-window [ -n "$PAL" ] && ok palette-window || bad palette-window
if [ -n "$MAIN" ] && [ -n "$PAL" ] && [ "$MAIN" != "$PAL" ]; then if [ -n "$MAIN" ] && [ -n "$PAL" ] && [ "$MAIN" != "$PAL" ]; then
@@ -132,17 +132,17 @@ fi
if [ -n "$PAL" ]; then if [ -n "$PAL" ]; then
/tmp/palette_wmclose "$PAL" close > /tmp/palette_close.log 2>&1 /tmp/palette_wmclose "$PAL" close > /tmp/palette_close.log 2>&1
sleep 1 sleep 1
if [ -z "$(xdotool search --onlyvisible --name "FDesigner — Widgets")" ]; then if [ -z "$(xdotool search --onlyvisible --name "LightGUI — Widgets")" ]; then
ok palette-hides-on-close ok palette-hides-on-close
else bad palette-hides-on-close; fi else bad palette-hides-on-close; fi
if kill -0 $APP_PID 2>/dev/null && \ if kill -0 $APP_PID 2>/dev/null && \
[ -n "$(xdotool search --onlyvisible --name "FDesigner — C\+\+/GTK")" ]; then [ -n "$(xdotool search --onlyvisible --name "LightGUI — C\+\+/GTK")" ]; then
ok app-alive-after-close ok app-alive-after-close
else bad app-alive-after-close; fi else bad app-alive-after-close; fi
# Reopen from View -> Widget Palette (menu coords from main geometry). # Reopen from View -> Widget Palette (menu coords from main geometry).
xdotool mousemove $((MX + 110)) $((MY + 12)) click 1; sleep 0.8 xdotool mousemove $((MX + 110)) $((MY + 12)) click 1; sleep 0.8
xdotool mousemove $((MX + 141)) $((MY + 89)) click 1; sleep 1 xdotool mousemove $((MX + 141)) $((MY + 89)) click 1; sleep 1
if [ -n "$(xdotool search --onlyvisible --name "FDesigner — Widgets")" ]; then if [ -n "$(xdotool search --onlyvisible --name "LightGUI — Widgets")" ]; then
ok palette-reopens-from-view-menu ok palette-reopens-from-view-menu
else bad palette-reopens-from-view-menu; fi else bad palette-reopens-from-view-menu; fi
# Clicking the canvas still works after palette + design interplay. # Clicking the canvas still works after palette + design interplay.
+16 -16
View File
@@ -4,7 +4,7 @@
// xvfb-run -a ./theme_tests // xvfb-run -a ./theme_tests
// Prints one PASS/FAIL line per check; exit 0 only if all pass. // Prints one PASS/FAIL line per check; exit 0 only if all pass.
// HOME is redirected to a scratch dir so the debugger toggle test // HOME is redirected to a scratch dir so the debugger toggle test
// never touches the real ~/.config/fdesigner/debugger_bps.conf. // never touches the real ~/.config/lightgui/debugger_bps.conf.
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <cstdio> #include <cstdio>
@@ -76,8 +76,8 @@ static std::string join_lines(const std::vector<std::string>& lines) {
int main(int argc, char** argv) { int main(int argc, char** argv) {
// Isolate all HOME-based config (debugger bps file, theme file). // Isolate all HOME-based config (debugger bps file, theme file).
::setenv("HOME", "/tmp/fdesigner_theme_home", 1); ::setenv("HOME", "/tmp/lightgui_theme_home", 1);
::setenv("FDESIGNER_THEME_CONF", "", 1); ::setenv("LIGHTGUI_THEME_CONF", "", 1);
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
// 1. Built-in themes. // 1. Built-in themes.
@@ -113,7 +113,7 @@ int main(int argc, char** argv) {
// 3. Save / load round-trip at an explicit path, incl. custom colour. // 3. Save / load round-trip at an explicit path, incl. custom colour.
CodeTheme custom = dark; CodeTheme custom = dark;
custom.keyword = "#ff0000"; custom.keyword = "#ff0000";
const char* tpath = "/tmp/fdesigner_theme_harness.conf"; const char* tpath = "/tmp/lightgui_theme_harness.conf";
check(custom.save(tpath), "save-roundtrip"); check(custom.save(tpath), "save-roundtrip");
CodeTheme reloaded; CodeTheme reloaded;
check(reloaded.load(tpath), "load-roundtrip"); check(reloaded.load(tpath), "load-roundtrip");
@@ -122,18 +122,18 @@ int main(int argc, char** argv) {
"roundtrip-values"); "roundtrip-values");
// Missing file: load fails, defaults kept. // Missing file: load fails, defaults kept.
CodeTheme miss; CodeTheme miss;
check(!miss.load("/tmp/fdesigner_theme_no_such.conf"), check(!miss.load("/tmp/lightgui_theme_no_such.conf"),
"load-missing-fails"); "load-missing-fails");
check(miss.name == "Light", "load-missing-keeps-defaults"); check(miss.name == "Light", "load-missing-keeps-defaults");
// Garbage in the file does not break loading; bad colours ignored. // Garbage in the file does not break loading; bad colours ignored.
{ {
FILE* f = std::fopen("/tmp/fdesigner_theme_garbage.conf", "w"); FILE* f = std::fopen("/tmp/lightgui_theme_garbage.conf", "w");
std::fprintf(f, "# comment\nnot-a-kv-line\ntheme=Dark\nkeyword=red\n" std::fprintf(f, "# comment\nnot-a-kv-line\ntheme=Dark\nkeyword=red\n"
"background=#1e1e1e\n"); "background=#1e1e1e\n");
std::fclose(f); std::fclose(f);
} }
CodeTheme garb; CodeTheme garb;
check(garb.load("/tmp/fdesigner_theme_garbage.conf"), check(garb.load("/tmp/lightgui_theme_garbage.conf"),
"load-garbage-file"); "load-garbage-file");
check(garb.name == "Dark" && garb.keyword == dark.keyword && check(garb.name == "Dark" && garb.keyword == dark.keyword &&
garb.background == "#1e1e1e", garb.background == "#1e1e1e",
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
CodeTheme dp = CodeTheme::builtin("Monokai"); CodeTheme dp = CodeTheme::builtin("Monokai");
theme_set_current(dp); theme_set_current(dp);
check(file_contains( check(file_contains(
"/tmp/fdesigner_theme_home/.config/fdesigner/theme.conf", "/tmp/lightgui_theme_home/.config/lightgui/theme.conf",
"theme=Monokai"), "theme=Monokai"),
"default-path-persists"); "default-path-persists");
CodeTheme cur = theme_current(); CodeTheme cur = theme_current();
@@ -267,7 +267,7 @@ int main(int argc, char** argv) {
gtk_widget_show_all(win); gtk_widget_show_all(win);
while (gtk_events_pending()) gtk_main_iteration(); while (gtk_events_pending()) gtk_main_iteration();
codeview_set_text(cv, join_lines(flines), codeview_set_text(cv, join_lines(flines),
"/tmp/fdesigner_codeview_test.cpp"); "/tmp/lightgui_codeview_test.cpp");
while (gtk_events_pending()) gtk_main_iteration(); while (gtk_events_pending()) gtk_main_iteration();
check(codeview_line_count(cv) == 17, "widget-line-count"); check(codeview_line_count(cv) == 17, "widget-line-count");
check(codeview_regions(cv).size() == 6, "widget-regions"); check(codeview_regions(cv).size() == 6, "widget-regions");
@@ -318,22 +318,22 @@ int main(int argc, char** argv) {
// 9. Gutter -> debugger backend toggle (HOME redirected: the bps // 9. Gutter -> debugger backend toggle (HOME redirected: the bps
// file lands in the scratch dir, never the real config). // file lands in the scratch dir, never the real config).
const std::string bpfile = const std::string bpfile =
"/tmp/fdesigner_theme_home/.config/fdesigner/debugger_bps.conf"; "/tmp/lightgui_theme_home/.config/lightgui/debugger_bps.conf";
::remove(bpfile.c_str()); ::remove(bpfile.c_str());
check(debugger_toggle_breakpoint("/tmp/fdesigner_codeview_test.cpp", check(debugger_toggle_breakpoint("/tmp/lightgui_codeview_test.cpp",
42), 42),
"dbg-toggle-sets"); "dbg-toggle-sets");
check(debugger_has_breakpoint("/tmp/fdesigner_codeview_test.cpp", 42), check(debugger_has_breakpoint("/tmp/lightgui_codeview_test.cpp", 42),
"dbg-has-after-set"); "dbg-has-after-set");
check(file_contains(bpfile, "/tmp/fdesigner_codeview_test.cpp:42"), check(file_contains(bpfile, "/tmp/lightgui_codeview_test.cpp:42"),
"dbg-toggle-persists"); "dbg-toggle-persists");
check(!debugger_toggle_breakpoint("/tmp/fdesigner_codeview_test.cpp", check(!debugger_toggle_breakpoint("/tmp/lightgui_codeview_test.cpp",
42), 42),
"dbg-toggle-clears"); "dbg-toggle-clears");
check(!debugger_has_breakpoint("/tmp/fdesigner_codeview_test.cpp", check(!debugger_has_breakpoint("/tmp/lightgui_codeview_test.cpp",
42), 42),
"dbg-has-after-clear"); "dbg-has-after-clear");
check(!file_contains(bpfile, "/tmp/fdesigner_codeview_test.cpp:42"), check(!file_contains(bpfile, "/tmp/lightgui_codeview_test.cpp:42"),
"dbg-clear-persists"); "dbg-clear-persists");
std::printf("THEME TESTS: %d pass, %d fail\n", g_pass, g_fail); std::printf("THEME TESTS: %d pass, %d fail\n", g_pass, g_fail);
+12 -12
View File
@@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# FDesigner color themes + code-view gutter/folding tests. # LightGUI color themes + code-view gutter/folding tests.
# tests/theme_tests.sh # tests/theme_tests.sh
# Builds + runs the theme harness (tests/theme_tests.cpp, needs Xvfb), # Builds + runs the theme harness (tests/theme_tests.cpp, needs Xvfb),
# runs the fdesigner self-test (which has its own theme/folding block), # runs the lightgui self-test (which has its own theme/folding block),
# and smoke tests the real Code View window and Color Theme dialog # and smoke tests the real Code View window and Color Theme dialog
# (FDESIGNER_OPEN_CODEVIEW / FDESIGNER_OPEN_THEME) with xdotool if # (LIGHTGUI_OPEN_CODEVIEW / LIGHTGUI_OPEN_THEME) with xdotool if
# available. Prints a PASS/FAIL summary; exits non-zero on any failure. # available. Prints a PASS/FAIL summary; exits non-zero on any failure.
# Run from the repo root. # Run from the repo root.
set -u set -u
@@ -25,21 +25,21 @@ if grep -q "warning" /tmp/theme_tests_build.log; then
FAIL=1 FAIL=1
fi fi
say "== theme harness (under Xvfb) ==" say "== theme harness (under Xvfb) =="
rm -rf /tmp/fdesigner_theme_home rm -rf /tmp/lightgui_theme_home
xvfb-run -a /tmp/theme_tests || FAIL=1 xvfb-run -a /tmp/theme_tests || FAIL=1
say "== building fdesigner ==" say "== building lightgui =="
make >/tmp/theme_make.log 2>&1 || { make >/tmp/theme_make.log 2>&1 || {
say "FAIL fdesigner build"; cat /tmp/theme_make.log; FAIL=1 say "FAIL lightgui build"; cat /tmp/theme_make.log; FAIL=1
} }
if grep -q "warning" /tmp/theme_make.log; then if grep -q "warning" /tmp/theme_make.log; then
say "FAIL fdesigner build has warnings" say "FAIL lightgui build has warnings"
grep "warning" /tmp/theme_make.log grep "warning" /tmp/theme_make.log
FAIL=1 FAIL=1
fi fi
if [ "$FAIL" = "0" ]; then if [ "$FAIL" = "0" ]; then
say "== fdesigner self-test (includes theme/folding block) ==" say "== lightgui self-test (includes theme/folding block) =="
FDESIGNER_SELFTEST=1 xvfb-run -a ./fdesigner || FAIL=1 LIGHTGUI_SELFTEST=1 xvfb-run -a ./lightgui || FAIL=1
fi fi
say "== View menu wiring ==" say "== View menu wiring =="
@@ -55,12 +55,12 @@ if ! command -v xdotool >/dev/null 2>&1; then
else else
say "== Code View window smoke test ==" say "== Code View window smoke test =="
xvfb-run -a sh -c ' xvfb-run -a sh -c '
FDESIGNER_OPEN_CODEVIEW=1 ./fdesigner >/tmp/theme_codeview.log 2>&1 & LIGHTGUI_OPEN_CODEVIEW=1 ./lightgui >/tmp/theme_codeview.log 2>&1 &
APP=$! APP=$!
FOUND="" FOUND=""
i=0 i=0
while [ $i -lt 50 ]; do while [ $i -lt 50 ]; do
FOUND=$(xdotool search --name "FDesigner — Code" 2>/dev/null | head -1) FOUND=$(xdotool search --name "LightGUI — Code" 2>/dev/null | head -1)
[ -n "$FOUND" ] && break [ -n "$FOUND" ] && break
sleep 0.2; i=$((i+1)) sleep 0.2; i=$((i+1))
done done
@@ -71,7 +71,7 @@ else
' || FAIL=1 ' || FAIL=1
say "== Color Theme dialog smoke test ==" say "== Color Theme dialog smoke test =="
xvfb-run -a sh -c ' xvfb-run -a sh -c '
FDESIGNER_OPEN_THEME=1 ./fdesigner >/tmp/theme_dlg.log 2>&1 & LIGHTGUI_OPEN_THEME=1 ./lightgui >/tmp/theme_dlg.log 2>&1 &
APP=$! APP=$!
FOUND="" FOUND=""
i=0 i=0
+3 -3
View File
@@ -51,7 +51,7 @@ static std::string read_file(const std::string& path) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
std::string out = argc > 1 ? argv[1] : "/tmp/fdesigner_widgets_gen"; std::string out = argc > 1 ? argv[1] : "/tmp/lightgui_widgets_gen";
Project p; Project p;
p.title = "Widget Test"; p.title = "Widget Test";
p.class_name = "MyWindow"; p.class_name = "MyWindow";
@@ -100,12 +100,12 @@ int main(int argc, char** argv) {
// Save/load round-trip (.fdj) for every new widget type. // Save/load round-trip (.fdj) for every new widget type.
{ {
std::string err; std::string err;
if (!save_project_file("/tmp/fdesigner_widgets.fdj", p, err)) { if (!save_project_file("/tmp/lightgui_widgets.fdj", p, err)) {
std::printf("FAIL save %s\n", err.c_str()); std::printf("FAIL save %s\n", err.c_str());
++fail; ++fail;
} else { } else {
Project q; Project q;
if (!load_project_file("/tmp/fdesigner_widgets.fdj", q, err)) { if (!load_project_file("/tmp/lightgui_widgets.fdj", q, err)) {
std::printf("FAIL load %s\n", err.c_str()); std::printf("FAIL load %s\n", err.c_str());
++fail; ++fail;
} else if (q.widgets.size() != p.widgets.size()) { } else if (q.widgets.size() != p.widgets.size()) {
+12 -12
View File
@@ -10,13 +10,13 @@ pass=0; fail=0; failed=""
ok() { echo "PASS $1"; pass=$((pass+1)); } ok() { echo "PASS $1"; pass=$((pass+1)); }
bad() { echo "FAIL $1"; fail=$((fail+1)); failed="$failed $1"; } bad() { echo "FAIL $1"; fail=$((fail+1)); failed="$failed $1"; }
echo "== building fdesigner ==" echo "== building lightgui =="
if make > /tmp/widget_make.log 2>&1; then ok make; else if make > /tmp/widget_make.log 2>&1; then ok make; else
bad make; cat /tmp/widget_make.log; exit 1 bad make; cat /tmp/widget_make.log; exit 1
fi fi
echo "== designer self-test (includes Phase 7 Lazarus widgets) ==" echo "== designer self-test (includes Phase 7 Lazarus widgets) =="
if FDESIGNER_SELFTEST=1 timeout 60 xvfb-run -a ./fdesigner \ if LIGHTGUI_SELFTEST=1 timeout 60 xvfb-run -a ./lightgui \
> /tmp/widget_selftest.log 2>&1; then > /tmp/widget_selftest.log 2>&1; then
if grep -q "SELFTEST PASS" /tmp/widget_selftest.log; then ok selftest; if grep -q "SELFTEST PASS" /tmp/widget_selftest.log; then ok selftest;
else bad "selftest(no PASS line)"; tail -20 /tmp/widget_selftest.log; fi else bad "selftest(no PASS line)"; tail -20 /tmp/widget_selftest.log; fi
@@ -28,8 +28,8 @@ grep -E "GENERATED7" /tmp/widget_selftest.log || true
echo "== widget generator test (per-widget markers) ==" echo "== widget generator test (per-widget markers) =="
if g++ -O2 -Wall -Wextra -std=c++17 -o /tmp/widget_tests \ if g++ -O2 -Wall -Wextra -std=c++17 -o /tmp/widget_tests \
tests/widget_tests.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp; then tests/widget_tests.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp; then
rm -rf /tmp/fdesigner_widgets_gen rm -rf /tmp/lightgui_widgets_gen
if /tmp/widget_tests /tmp/fdesigner_widgets_gen; then if /tmp/widget_tests /tmp/lightgui_widgets_gen; then
ok widget-markers ok widget-markers
else else
bad widget-markers bad widget-markers
@@ -39,25 +39,25 @@ else
fi fi
echo "== compile generated project (all new widgets) ==" echo "== compile generated project (all new widgets) =="
if (cd /tmp/fdesigner_widgets_gen && \ if (cd /tmp/lightgui_widgets_gen && \
make CXXFLAGS="-O2 -Wall -Wextra -std=c++17" >build.log 2>&1); then make CXXFLAGS="-O2 -Wall -Wextra -std=c++17" >build.log 2>&1); then
if grep -q "warning" /tmp/fdesigner_widgets_gen/build.log; then if grep -q "warning" /tmp/lightgui_widgets_gen/build.log; then
bad "generated-compile(warnings)" bad "generated-compile(warnings)"
grep "warning" /tmp/fdesigner_widgets_gen/build.log | head grep "warning" /tmp/lightgui_widgets_gen/build.log | head
else ok generated-compile; fi else ok generated-compile; fi
else else
bad generated-compile; cat /tmp/fdesigner_widgets_gen/build.log bad generated-compile; cat /tmp/lightgui_widgets_gen/build.log
fi fi
echo "== run generated project briefly ==" echo "== run generated project briefly =="
timeout 3 xvfb-run -a /tmp/fdesigner_widgets_gen/app \ timeout 3 xvfb-run -a /tmp/lightgui_widgets_gen/app \
> /tmp/fdesigner_widgets_gen/run.log 2>&1 > /tmp/lightgui_widgets_gen/run.log 2>&1
rc=$? rc=$?
if [ $rc -ne 124 ]; then if [ $rc -ne 124 ]; then
bad "generated-run(exit $rc)"; cat /tmp/fdesigner_widgets_gen/run.log bad "generated-run(exit $rc)"; cat /tmp/lightgui_widgets_gen/run.log
else else
badlog=$(grep -E "CRITICAL|WARNING \*\*" \ badlog=$(grep -E "CRITICAL|WARNING \*\*" \
/tmp/fdesigner_widgets_gen/run.log | grep -v "Could not load a pixbuf" || true) /tmp/lightgui_widgets_gen/run.log | grep -v "Could not load a pixbuf" || true)
if [ -n "$badlog" ]; then if [ -n "$badlog" ]; then
bad "generated-run(runtime warnings)"; echo "$badlog" bad "generated-run(runtime warnings)"; echo "$badlog"
else ok generated-run; fi else ok generated-run; fi
+5 -5
View File
@@ -1,17 +1,17 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Generate one 16x16 PNG icon per FDesigner palette widget (icons/<Key>.png). """Generate one 16x16 PNG icon per LightGUI palette widget (icons/<Key>.png).
Purpose-drawn glyphs (PIL ImageDraw), NOT downscaled screenshots: at 16x16 Purpose-drawn glyphs (PIL ImageDraw), NOT downscaled screenshots: at 16x16
a screenshot is mush, a 2-3 element glyph stays readable. a screenshot is mush, a 2-3 element glyph stays readable.
Style matches the CWidgets icons (tools/gen_icons.py in the CWidgets repo): Style matches the LightGUI icons (tools/gen_icons.py in the LightGUI repo):
dark ink + mid grey + light fill, one accent colour per palette section. dark ink + mid grey + light fill, one accent colour per palette section.
The glyphs are drawn on white and the white is then turned transparent, so The glyphs are drawn on white and the white is then turned transparent, so
each icon sits directly on the GTK button face with no white box around it. each icon sits directly on the GTK button face with no white box around it.
Glyph functions below are copied verbatim from the CWidgets icon generator Glyph functions below are copied verbatim from the LightGUI icon generator
(same style, same constants) except g_stockchart / g_scrollbox / g_listview, (same style, same constants) except g_stockchart / g_scrollbox / g_listview,
which are new here because FDesigner has no CWidgets twin for them. which are new here because LightGUI has no LightGUI twin for them.
Usage: python3 tools/gen_palette_icons.py (run from the repo root) Usage: python3 tools/gen_palette_icons.py (run from the repo root)
""" """
@@ -27,7 +27,7 @@ WHITE = (255, 255, 255)
GREEN = (22, 163, 74) GREEN = (22, 163, 74)
RED = (220, 38, 38) RED = (220, 38, 38)
# Accent colour per palette section (same palette as CWidgets sections). # Accent colour per palette section (same palette as LightGUI sections).
BLUE = (37, 99, 235) # Widgets BLUE = (37, 99, 235) # Widgets
LAZ_GREEN = (22, 163, 74) # Lazarus - Basic LAZ_GREEN = (22, 163, 74) # Lazarus - Basic
CYAN = (8, 145, 178) # Containers CYAN = (8, 145, 178) # Containers
+3 -3
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- FDesigner main window. Authored for Glade / GtkBuilder, GTK 3.24. --> <!-- LightGUI main window. Authored for Glade / GtkBuilder, GTK 3.24. -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkWindow" id="main_window"> <object class="GtkWindow" id="main_window">
<property name="title">FDesigner — C++/GTK</property> <property name="title">LightGUI — C++/GTK</property>
<property name="default_width">1150</property> <property name="default_width">1150</property>
<property name="default_height">720</property> <property name="default_height">720</property>
<child> <child>
@@ -291,7 +291,7 @@
</child> </child>
</object> </object>
<object class="GtkWindow" id="palette_window"> <object class="GtkWindow" id="palette_window">
<property name="title">FDesigner — Widgets</property> <property name="title">LightGUI — Widgets</property>
<property name="default_width">250</property> <property name="default_width">250</property>
<property name="default_height">780</property> <property name="default_height">780</property>
<child> <child>