Compare commits

..
Author SHA1 Message Date
Muse 8f00f9096b Palette window: widget palette in its own top-level window, tight Lazarus-style grid
- Move the palette out of main_paned into a new top-level GtkWindow
  (palette_window, title FDesigner — Widgets), opened with the designer
  and parked beside the design window (left if room, else right).
- Plain top-level window, never transient/modal; delete-event hides it
  instead of destroying it, View -> Widget Palette (check item) toggles
  it back, state stays in sync.
- Tight Lazarus-style packing: palette_box is now a 2-column GtkGrid
  (row/column spacing 2, 2px margins), buttons compact via USER-priority
  CSS (min-height 20px, 1px vertical padding); all 36 buttons + 5
  section labels render, all 24 grid rows fit without scrolling.
- New tests/palette_window_tests.sh (16 checks: separate windows,
  not transient, beside-main placement, palette clicks place widgets,
  WM_DELETE hide + app survives, View-menu reopen, clean log).

Tests (VPS, Xvfb): make 0 warnings; matrix 21/0 (re-run; first run 20/1
on the known flaky chart-pro-render pixel check, no code change);
debugger console 37/37 + GTK 7/7; widget 5/5 (+40/40 markers);
font ALL PASS; theme ALL PASS; event 6/6 + runtime 41/41;
cmake probe 31/31 + script 4/4; self-test 29 PASS;
palette_window_tests 16/16.
2026-11-25 14:30:41 -05:00
13 changed files with 793 additions and 1215 deletions

No files matched your search

-1
View File
@@ -3,4 +3,3 @@ fdesigner
tests/gen_matrix
tests/debugger/work/
tests/out/
tests/codewin/work/
+13 -212
View File
@@ -287,19 +287,10 @@ struct CodeViewData {
std::set<int> folded; // 0-based region start lines
std::set<int> breakpoints; // 1-based file lines
int current_line = 0; // 1-based, 0 = none
int paused_line = 0; // 1-based, 0 = none (debugger paused here)
CodeTheme theme;
std::function<bool(const std::string&, int)> bp_cb;
GtkTextTag* fold_tag = nullptr;
GtkTextTag* cur_tag = nullptr;
GtkTextTag* paused_tag = nullptr;
// Automatic inspection pane (bottom of the window).
CodeViewInspectState inspect_state = CodeViewInspectState::NoTarget;
std::string inspect_scope;
std::vector<Variable> inspect_vars;
GtkWidget* inspect_frame = nullptr;
GtkWidget* scope_label = nullptr;
GtkListStore* vars_store = nullptr;
};
CodeViewData* data_of(GtkWidget* cv) {
@@ -352,109 +343,30 @@ void apply_folds(CodeViewData* d) {
}
}
// (Re)apply the current-line and paused-line tags. The paused tag has
// higher priority than the current-line tag (set at creation), so when
// both mark the same line the red paused background wins — exactly the
// Lazarus distinction between "execution is here" and "current line".
void apply_line_marks(CodeViewData* d) {
void apply_current_line(CodeViewData* d) {
GtkTextBuffer* buf =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(d->view));
if (!d->cur_tag) return;
GtkTextIter a, b;
gtk_text_buffer_get_bounds(buf, &a, &b);
if (d->cur_tag) gtk_text_buffer_remove_tag(buf, d->cur_tag, &a, &b);
if (d->paused_tag)
gtk_text_buffer_remove_tag(buf, d->paused_tag, &a, &b);
auto apply_one = [&](GtkTextTag* tag, int line1) {
if (!tag || line1 < 1 ||
line1 > gtk_text_buffer_get_line_count(buf))
return;
gtk_text_buffer_remove_tag(buf, d->cur_tag, &a, &b);
if (d->current_line >= 1 &&
d->current_line <= gtk_text_buffer_get_line_count(buf)) {
GtkTextIter sa, sb;
gtk_text_buffer_get_iter_at_line(buf, &sa, line1 - 1);
if (line1 < gtk_text_buffer_get_line_count(buf))
gtk_text_buffer_get_iter_at_line(buf, &sb, line1);
gtk_text_buffer_get_iter_at_line(buf, &sa, d->current_line - 1);
if (d->current_line < gtk_text_buffer_get_line_count(buf))
gtk_text_buffer_get_iter_at_line(buf, &sb, d->current_line);
else
gtk_text_buffer_get_end_iter(buf, &sb);
gtk_text_buffer_apply_tag(buf, tag, &sa, &sb);
};
apply_one(d->cur_tag, d->current_line);
if (d->paused_tag && d->paused_line >= 1) {
GtkTextTagTable* table = gtk_text_buffer_get_tag_table(buf);
gtk_text_tag_set_priority(
d->paused_tag, gtk_text_tag_table_get_size(table) - 1);
gtk_text_buffer_apply_tag(buf, d->cur_tag, &sa, &sb);
}
apply_one(d->paused_tag, d->paused_line);
}
// The paused-line tag: solid red background, white text — readable on
// any theme, unmistakable next to the theme's current-line highlight.
// Created (or re-pointed) whenever the buffer's tags are (re)built.
void ensure_paused_tag(CodeViewData* d, GtkTextBuffer* buf) {
GtkTextTagTable* table = gtk_text_buffer_get_tag_table(buf);
d->paused_tag = gtk_text_tag_table_lookup(table, "theme-paused-line");
if (!d->paused_tag)
d->paused_tag = gtk_text_buffer_create_tag(
buf, "theme-paused-line", "background", "#c00000",
"foreground", "white", NULL);
else
g_object_set(d->paused_tag, "background", "#c00000",
"foreground", "white", NULL);
// Outrank every other tag on the line (current-line tag and any
// syntax tag): top priority in the table is always valid, while
// cur_priority+1 can exceed the table size when the current-line
// tag was created last.
gtk_text_tag_set_priority(
d->paused_tag, gtk_text_tag_table_get_size(table) - 1);
}
void apply_current_line(CodeViewData* d) { apply_line_marks(d); }
void queue_redraw(CodeViewData* d) {
gtk_widget_queue_draw(d->gutter);
gtk_widget_queue_draw(d->view);
}
// Repaint the inspection pane from the stored snapshot. While the
// target runs the pane shows the running state and NO values, so stale
// locals are never presented as current.
void refresh_inspection_ui(CodeViewData* d) {
if (!d->scope_label || !d->vars_store) return;
std::string scope;
switch (d->inspect_state) {
case CodeViewInspectState::NoTarget:
scope = "No target running \u2014 start the debugger to "
"inspect variables.";
break;
case CodeViewInspectState::Running:
scope = "Running \u2014 variables will appear when the "
"target stops.";
break;
case CodeViewInspectState::Stopped:
scope = d->inspect_scope.empty() ? "Stopped."
: d->inspect_scope;
break;
case CodeViewInspectState::Exited:
scope = d->inspect_scope.empty() ? "Target exited."
: d->inspect_scope;
break;
}
gtk_label_set_text(GTK_LABEL(d->scope_label), scope.c_str());
gtk_list_store_clear(d->vars_store);
if (d->inspect_state == CodeViewInspectState::Stopped) {
for (const auto& v : d->inspect_vars) {
GtkTreeIter it;
gtk_list_store_append(d->vars_store, &it);
gtk_list_store_set(d->vars_store, &it, 0, v.name.c_str(), 1,
v.type.c_str(), 2, v.value.c_str(), -1);
}
if (d->inspect_vars.empty()) {
GtkTreeIter it;
gtk_list_store_append(d->vars_store, &it);
gtk_list_store_set(d->vars_store, &it, 0,
"(no locals in scope)", 1, "", 2, "", -1);
}
}
}
bool region_starts_at(CodeViewData* d, int line0) {
for (const auto& r : d->regions)
if (r.start_line == line0) return true;
@@ -525,21 +437,7 @@ gboolean on_gutter_draw(GtkWidget* gutter, cairo_t* cr, gpointer user) {
gint y, h;
gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(d->view), &it, &y, &h);
if (h <= 0) continue; // folded away
bool paused = (d->paused_line == ln + 1);
if (paused) {
// Red gutter strip to match the red paused-line background.
cairo_set_source_rgb(cr, 0.75, 0.0, 0.0);
cairo_rectangle(cr, 0, y, alloc.width, h);
cairo_fill(cr);
// White right-pointing execution arrow (Lazarus-style).
double yc = y + h / 2.0;
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
cairo_move_to(cr, 14, yc - 5);
cairo_line_to(cr, 14, yc + 5);
cairo_line_to(cr, 22, yc);
cairo_close_path(cr);
cairo_fill(cr);
} else if (d->current_line == ln + 1) {
if (d->current_line == ln + 1) {
cairo_set_source_rgb(cr, cr_, cg, cb);
cairo_rectangle(cr, 0, y, alloc.width, h);
cairo_fill(cr);
@@ -563,10 +461,7 @@ gboolean on_gutter_draw(GtkWidget* gutter, cairo_t* cr, gpointer user) {
std::snprintf(num, sizeof num, "%d", ln + 1);
cairo_text_extents_t ext;
cairo_text_extents(cr, num, &ext);
if (paused)
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0);
else
cairo_set_source_rgba(cr, fr, fg, fb, 0.65);
cairo_set_source_rgba(cr, fr, fg, fb, 0.65);
cairo_move_to(cr, alloc.width - 6 - ext.width, y + h - 4);
cairo_show_text(cr, num);
}
@@ -604,12 +499,7 @@ void on_scroll_changed(GtkAdjustment*, gpointer user) {
GtkWidget* codeview_new() {
CodeViewData* d = new CodeViewData();
d->theme = theme_current();
// Outer box is vertical: code area on top, automatic-inspection
// pane at the bottom. The inner box keeps the old horizontal
// gutter + text view layout.
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget* code_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(box), code_box, TRUE, TRUE, 0);
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
d->box = box;
d->gutter = gtk_drawing_area_new();
gtk_widget_set_size_request(d->gutter, 76, 100);
@@ -630,43 +520,7 @@ GtkWidget* codeview_new() {
gtk_box_pack_start(GTK_BOX(inner), d->gutter, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(inner), d->view, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(d->scroll), inner);
gtk_box_pack_start(GTK_BOX(code_box), d->scroll, TRUE, TRUE, 0);
// Inspection pane: scope label + name/type/value list.
d->inspect_frame =
gtk_frame_new("Variables in scope \u2014 automatic inspection");
GtkWidget* ivbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_container_set_border_width(GTK_CONTAINER(ivbox), 6);
d->scope_label = gtk_label_new(
"No target running \u2014 start the debugger to inspect "
"variables.");
gtk_label_set_xalign(GTK_LABEL(d->scope_label), 0.0);
gtk_label_set_ellipsize(GTK_LABEL(d->scope_label),
PANGO_ELLIPSIZE_END);
gtk_box_pack_start(GTK_BOX(ivbox), d->scope_label, FALSE, FALSE, 0);
d->vars_store =
gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
GtkWidget* vars_view =
gtk_tree_view_new_with_model(GTK_TREE_MODEL(d->vars_store));
{
auto add_col = [&](const char* title, int col, bool expand) {
GtkCellRenderer* r = gtk_cell_renderer_text_new();
GtkTreeViewColumn* c = gtk_tree_view_column_new_with_attributes(
title, r, "text", col, NULL);
gtk_tree_view_column_set_expand(c, expand);
gtk_tree_view_append_column(GTK_TREE_VIEW(vars_view), c);
};
add_col("Name", 0, FALSE);
add_col("Type", 1, FALSE);
add_col("Value", 2, TRUE);
}
GtkWidget* vscroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vscroll),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request(vscroll, -1, 140);
gtk_container_add(GTK_CONTAINER(vscroll), vars_view);
gtk_box_pack_start(GTK_BOX(ivbox), vscroll, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(d->inspect_frame), ivbox);
gtk_box_pack_start(GTK_BOX(box), d->inspect_frame, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), d->scroll, TRUE, TRUE, 0);
g_signal_connect(d->view, "size-allocate",
G_CALLBACK(on_view_size_allocate), d);
GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(
@@ -691,7 +545,6 @@ void codeview_set_text(GtkWidget* cv, const std::string& text,
d->folded.clear();
d->breakpoints.clear();
d->current_line = 0;
d->paused_line = 0; // new file: no paused line until the next stop
GtkTextBuffer* buf =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(d->view));
gtk_text_buffer_set_text(buf, text.c_str(), -1);
@@ -708,7 +561,6 @@ void codeview_set_text(GtkWidget* cv, const std::string& text,
else
g_object_set(d->cur_tag, "background", d->theme.current_line.c_str(),
NULL);
ensure_paused_tag(d, buf);
theme_highlight_buffer(buf, d->theme);
theme_apply_to_view(d->view, d->theme);
apply_folds(d);
@@ -737,8 +589,6 @@ void codeview_set_theme(GtkWidget* cv, const CodeTheme& theme) {
if (d->cur_tag)
g_object_set(d->cur_tag, "background", theme.current_line.c_str(),
NULL);
ensure_paused_tag(d, buf); // paused red is theme-independent
apply_line_marks(d);
theme_highlight_buffer(buf, theme);
theme_apply_to_view(d->view, theme);
queue_redraw(d);
@@ -762,55 +612,6 @@ int codeview_current_line(GtkWidget* cv) {
return d ? d->current_line : 0;
}
void codeview_set_paused_line(GtkWidget* cv, int line_1based) {
CodeViewData* d = data_of(cv);
if (!d) return;
d->paused_line = line_1based;
apply_line_marks(d);
queue_redraw(d);
if (line_1based >= 1) {
GtkTextBuffer* buf =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(d->view));
if (line_1based <= gtk_text_buffer_get_line_count(buf)) {
GtkTextIter it;
gtk_text_buffer_get_iter_at_line(buf, &it, line_1based - 1);
gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(d->view), &it, 0.0,
TRUE, 0.0, 0.5);
}
}
}
int codeview_paused_line(GtkWidget* cv) {
CodeViewData* d = data_of(cv);
return d ? d->paused_line : 0;
}
void codeview_set_inspection(GtkWidget* cv, CodeViewInspectState state,
const std::string& scope_label,
const std::vector<Variable>& vars) {
CodeViewData* d = data_of(cv);
if (!d) return;
d->inspect_state = state;
d->inspect_scope = scope_label;
d->inspect_vars = vars;
refresh_inspection_ui(d);
}
CodeViewInspectState codeview_inspection_state(GtkWidget* cv) {
CodeViewData* d = data_of(cv);
return d ? d->inspect_state : CodeViewInspectState::NoTarget;
}
std::string codeview_inspection_scope(GtkWidget* cv) {
CodeViewData* d = data_of(cv);
return d ? d->inspect_scope : std::string();
}
std::vector<Variable> codeview_inspection_vars(GtkWidget* cv) {
CodeViewData* d = data_of(cv);
return d ? d->inspect_vars : std::vector<Variable>();
}
void codeview_set_breakpoint_callback(
GtkWidget* cv,
const std::function<bool(const std::string&, int)>& cb) {
-28
View File
@@ -33,7 +33,6 @@
#include <string>
#include <vector>
#include "debugger.h" // Variable (name/type/value) for the inspection pane
#include "theme.h"
// One foldable span. Lines are 0-based, inclusive at both ends; only
@@ -75,18 +74,6 @@ CodeTheme codeview_theme(GtkWidget* cv);
// Highlight this file line as the current execution line (0 = none).
void codeview_set_current_line(GtkWidget* cv, int line_1based);
int codeview_current_line(GtkWidget* cv);
// Paused line (0 = none): the line the debugger is paused on. Rendered
// with a RED full-line background (white text) plus a gutter arrow, in
// the Lazarus manner: Lazarus marks the execution point with a full-line
// background highlight (ahaExecutionPoint) and a gutter arrow, distinct
// from the breakpoint marker (red dot / red highlight). Here the user
// asked for the paused line in red, so the execution-point background
// is solid red (#c00000) with white text — readable on any theme —
// while a breakpoint stays just the red dot in the gutter. The paused
// tag outranks the current-line tag, so when both point at the same
// line the red background wins. Clears when execution resumes.
void codeview_set_paused_line(GtkWidget* cv, int line_1based);
int codeview_paused_line(GtkWidget* cv);
// Breakpoint dots (1-based file lines). The widget does not own the
// debugger; toggling goes through the callback, which returns true
// when the breakpoint is now set. With no callback, toggling just
@@ -97,21 +84,6 @@ void codeview_set_breakpoint_callback(
void codeview_set_breakpoint_lines(GtkWidget* cv,
const std::set<int>& lines_1based);
std::set<int> codeview_breakpoint_lines(GtkWidget* cv);
// Automatic variable inspection (pane at the bottom of the code
// window). The host (main) pushes a fresh snapshot whenever the
// debugger stops / steps / runs / exits; the widget only displays.
// NoTarget: no debug session / no target — "start the debugger"
// Running: target is running — NEVER show stale values as current
// Stopped: scope_label names the scope ("func() — file:line
// (reason)") and vars are the locals of that frame
// Exited: target exited — scope_label carries the exit code
enum class CodeViewInspectState { NoTarget, Running, Stopped, Exited };
void codeview_set_inspection(GtkWidget* cv, CodeViewInspectState state,
const std::string& scope_label,
const std::vector<Variable>& vars);
CodeViewInspectState codeview_inspection_state(GtkWidget* cv);
std::string codeview_inspection_scope(GtkWidget* cv);
std::vector<Variable> codeview_inspection_vars(GtkWidget* cv);
// Fold state (0-based start lines in the pure API; 1-based here).
std::vector<FoldRegion> codeview_regions(GtkWidget* cv);
bool codeview_toggle_fold_at(GtkWidget* cv, int line_1based);
-3
View File
@@ -171,9 +171,6 @@ public:
// Non-blocking drain of pending MI output (used by the GUI poll tick).
void poll_events();
const StopInfo& last_stop() const { return last_stop_; }
// Monotonic stop counter (incremented on every *stopped event).
// Lets a UI poll tell a fresh stop apart from a stale Stopped state.
unsigned long stop_seq() const { return stop_seq_; }
// Breakpoints.
// Remember a breakpoint before gdb is running (e.g. typed in the UI
-76
View File
@@ -770,31 +770,6 @@ void debugger_window_open(GtkWidget* parent) {
if (parent) gtk_window_set_transient_for(GTK_WINDOW(win),
GTK_WINDOW(parent));
g_dbg_window = win;
// Keyboard shortcuts matching the toolbar tooltips: F5 Continue,
// F10 Step Over, F11 Step Into. (Also lets scripted tests drive
// stepping with xdotool key.)
g_signal_connect(win, "key-press-event",
G_CALLBACK(+[](GtkWidget*, GdkEventKey* e,
gpointer) -> gboolean {
if (!g_session) return FALSE;
std::string err;
const char* w = nullptr;
if (e->keyval == GDK_KEY_F5) w = "cont";
else if (e->keyval == GDK_KEY_F10) w = "over";
else if (e->keyval == GDK_KEY_F11) w = "into";
else return FALSE;
bool ok = false;
if (!std::strcmp(w, "cont"))
ok = g_session->cont(err);
else if (!std::strcmp(w, "over"))
ok = g_session->step_over(err);
else if (!std::strcmp(w, "into"))
ok = g_session->step_into(err);
if (ok) sync_ui_from_session();
else show_error(g_dbg_window, err);
return TRUE;
}),
nullptr);
g_signal_connect(win, "destroy", G_CALLBACK(+[](GtkWidget*) {
g_dbg_window = nullptr;
// Keep the session alive for the menu toggles;
@@ -1057,54 +1032,3 @@ std::vector<int> debugger_breakpoint_lines(const std::string& file) {
out.push_back(b.line);
return out;
}
// --- code-window integration: the code window reads the SAME session ---
// (never a second gdb) through these accessors, on its own poll tick.
void debugger_poll_events() {
if (g_session) g_session->poll_events();
}
DbgState debugger_session_state() {
return g_session ? g_session->state() : DbgState::Idle;
}
unsigned long debugger_stop_seq() {
return g_session ? g_session->stop_seq() : 0;
}
StopInfo debugger_last_stop() {
return g_session ? g_session->last_stop() : StopInfo();
}
std::vector<Variable> debugger_locals() {
return g_session ? g_session->locals() : std::vector<Variable>();
}
void debugger_refresh_on_stop() {
if (g_session) g_session->refresh_on_stop();
}
bool debugger_autorun(const std::string& exe, const std::string& bp_loc,
std::string& err) {
if (!ensure_session(err)) return false;
if (g_target_entry)
gtk_entry_set_text(GTK_ENTRY(g_target_entry), exe.c_str());
if (!bp_loc.empty()) {
if (g_session->is_alive()) {
Breakpoint b;
if (!g_session->add_breakpoint(bp_loc, b, err)) return false;
} else if (!g_session->stage_breakpoint(bp_loc)) {
err = "not a breakpoint location: " + bp_loc;
return false;
}
g_session->save_breakpoints();
}
if (g_session->state() == DbgState::Stopped ||
g_session->state() == DbgState::Exited) {
if (!g_session->restart(err)) return false;
} else {
if (!g_session->start(exe, "", err)) return false;
}
if (g_dbg_window) sync_ui_from_session();
return true;
}
+1 -24
View File
@@ -7,8 +7,6 @@
#include <string>
#include <vector>
#include "debugger.h" // DbgState, StopInfo, Variable, DebuggerSettings
// Show the debugger window (creates it on first call, raises it after).
void debugger_window_open(GtkWidget* parent);
// Open the debugger settings dialog (also reachable from the Debug menu's
@@ -23,29 +21,8 @@ bool debugger_toggle_breakpoint(const std::string& file, int line);
bool debugger_has_breakpoint(const std::string& file, int line);
// 1-based lines in `file` that currently have breakpoints.
std::vector<int> debugger_breakpoint_lines(const std::string& file);
// --- code-window integration (same shared session, no second gdb) ---
// Drain pending gdb events without needing the debugger window open.
// Safe to call from another UI poll; the debugger window's own poll
// drains the same queue.
void debugger_poll_events();
// Session state as seen by the code window's poll.
DbgState debugger_session_state();
// Monotonic stop counter; changes on every fresh *stopped event.
unsigned long debugger_stop_seq();
// Copy of the last stop record (frame, reason, exit code).
StopInfo debugger_last_stop();
// Locals of the current frame (refreshed by debugger_refresh_on_stop).
std::vector<Variable> debugger_locals();
// Refresh locals/frames/watches after a stop (best effort, no-op
// unless stopped). The debugger window's poll does this too; calling
// twice is harmless.
void debugger_refresh_on_stop();
// Test hook: start `exe` under the debugger, staging a breakpoint at
// `bp_loc` ("file:line", may be empty) first. Opens the debugger
// window if needed. Returns false + err when gdb refuses to start.
bool debugger_autorun(const std::string& exe, const std::string& bp_loc,
std::string& err);
// True once the debugger window has been created (used by the GUI smoke test).
bool debugger_window_is_open();
// For tests: the settings currently in effect (loaded from disk at open).
#include "debugger.h"
DebuggerSettings debugger_current_settings();
+89 -259
View File
@@ -27,7 +27,6 @@
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "model.h"
@@ -183,6 +182,8 @@ struct Item {
static Project g_project;
static GtkWidget* g_window = nullptr;
static GtkWidget* g_palette_window = nullptr; // top-level palette window
static GtkWidget* g_palette_menu_item = nullptr; // View -> Widget Palette
static GtkWidget* g_canvas = nullptr; // GtkFixed
static GtkWidget* g_viewport = nullptr; // canvas parent (window background)
static GtkWidget* g_statusbar = nullptr;
@@ -2408,6 +2409,39 @@ static void on_palette_clicked(GtkButton*, gpointer data) {
add_widget((const char*)data);
}
// ------------------------------------------------------- palette window
// The widget palette lives in its own top-level window ("FDesigner —
// Widgets"), opened together with the designer. It is a plain top-level
// window, never transient/modal, so design, palette and code windows
// coexist. Closing it only hides it; View -> Widget Palette brings it
// back.
static void palette_window_show() {
if (!g_palette_window) return;
gtk_widget_show_all(g_palette_window);
gtk_window_present(GTK_WINDOW(g_palette_window));
}
static void palette_window_hide() {
if (g_palette_window) gtk_widget_hide(g_palette_window);
}
static gboolean on_palette_window_delete(GtkWidget*, GdkEvent*,
gpointer) {
// Close button hides the palette instead of destroying it, so the
// app keeps running and the palette can be reopened.
if (g_palette_menu_item)
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM(g_palette_menu_item), FALSE);
gtk_widget_hide(g_palette_window);
return TRUE; // do not destroy
}
static void on_view_palette_toggled(GtkCheckMenuItem* item, gpointer) {
if (gtk_check_menu_item_get_active(item)) palette_window_show();
else palette_window_hide();
}
static gboolean on_canvas_press(GtkWidget*, GdkEventButton* e, gpointer) {
if (e->button == 1) select_item(nullptr); // clicked empty canvas
return FALSE;
@@ -2487,170 +2521,19 @@ static void refresh_code_view() {
status("Code view - " + path);
}
// --- code window <-> debugger sync ------------------------------------
// Polls the SHARED GdbSession (owned by the debugger window) and keeps
// the code window's paused line + inspection pane in step with it:
// Running -> inspection shows "running", paused line cleared (never
// present stale values as current)
// Stopped -> refresh locals, load the stopped file into the code view
// if it is not already shown, red paused-line background,
// scope label + locals in the inspection pane
// Exited -> paused line cleared, inspection shows the exit code
// Idle -> inspection shows "no target"
// Only acts when (state, stop_seq) changed, or when `force` is set
// (reopen / theme change / startup). The debugger window's own poll
// drains the same gdb queue; this poll just reads the shared session.
static unsigned long s_cw_last_seq = 0;
static DbgState s_cw_last_state = DbgState::Idle;
static const char* cw_state_name(DbgState st) {
switch (st) {
case DbgState::Idle: return "Idle";
case DbgState::Starting: return "Starting";
case DbgState::Running: return "Running";
case DbgState::Stopped: return "Stopped";
case DbgState::Exited: return "Exited";
case DbgState::Error: return "Error";
}
return "Idle";
}
// Test hook: FDESIGNER_CODEWIN_DUMP=<path> writes a snapshot of the
// code window's debug state (state, scope, file, paused line, locals)
// every time the sync applies a change. Used by
// tests/code_window_tests.sh to assert on the live app.
static void codewin_dump_snapshot(DbgState st) {
const char* path = std::getenv("FDESIGNER_CODEWIN_DUMP");
if (!path || !*path || !g_codeview) return;
std::string out = "state=";
out += cw_state_name(st);
out += "\n";
out += "scope=" + codeview_inspection_scope(g_codeview) + "\n";
out += "file=" + codeview_file_path(g_codeview) + "\n";
out += "paused_line=" +
std::to_string(codeview_paused_line(g_codeview)) + "\n";
out += "current_line=" +
std::to_string(codeview_current_line(g_codeview)) + "\n";
for (const auto& v : codeview_inspection_vars(g_codeview))
out += "var=" + v.name + "|" + v.type + "|" + v.value + "\n";
std::string tmp = std::string(path) + ".tmp";
std::ofstream f(tmp, std::ios::trunc);
if (!f) return;
f << out;
f.close();
std::rename(tmp.c_str(), path);
}
static void codewin_sync_from_debugger(bool force) {
if (!g_codeview) return;
debugger_poll_events();
DbgState st = debugger_session_state();
unsigned long seq = debugger_stop_seq();
bool changed = force || st != s_cw_last_state || seq != s_cw_last_seq;
if (!changed) return;
s_cw_last_state = st;
s_cw_last_seq = seq;
StopInfo stop = debugger_last_stop();
switch (st) {
case DbgState::Running:
codeview_set_paused_line(g_codeview, 0);
codeview_set_current_line(g_codeview, 0);
codeview_set_inspection(g_codeview,
CodeViewInspectState::Running, "", {});
break;
case DbgState::Stopped: {
debugger_refresh_on_stop();
stop = debugger_last_stop();
if (!stop.frame.file.empty() &&
stop.frame.file != codeview_file_path(g_codeview)) {
gchar* c = nullptr;
if (g_file_get_contents(stop.frame.file.c_str(), &c,
nullptr, nullptr) &&
c) {
codeview_set_text(g_codeview, c, stop.frame.file);
g_free(c);
std::set<int> bps;
for (int ln :
debugger_breakpoint_lines(stop.frame.file))
bps.insert(ln);
codeview_set_breakpoint_lines(g_codeview, bps);
}
}
std::string scope =
stop.frame.function + "() \u2014 " + stop.frame.file +
":" + std::to_string(stop.frame.line);
if (!stop.reason.empty()) scope += " (" + stop.reason + ")";
codeview_set_inspection(g_codeview,
CodeViewInspectState::Stopped, scope,
debugger_locals());
// Red paused-line background only on the file actually
// shown; otherwise the line number would be meaningless.
if (!stop.frame.file.empty() &&
stop.frame.file == codeview_file_path(g_codeview)) {
// Unfold any region hiding the paused line.
int l0 = stop.frame.line - 1;
for (const auto& r : codeview_regions(g_codeview))
if (r.start_line < l0 && l0 < r.end_line &&
codeview_is_folded(g_codeview, r.start_line + 1))
codeview_toggle_fold_at(g_codeview,
r.start_line + 1);
codeview_set_current_line(g_codeview, stop.frame.line);
codeview_set_paused_line(g_codeview, stop.frame.line);
} else {
codeview_set_current_line(g_codeview, 0);
codeview_set_paused_line(g_codeview, 0);
}
break;
}
case DbgState::Exited: {
codeview_set_paused_line(g_codeview, 0);
codeview_set_current_line(g_codeview, 0);
std::string scope = "Target exited";
if (stop.exit_code >= 0)
scope += " (code " + std::to_string(stop.exit_code) + ")";
scope += ".";
codeview_set_inspection(g_codeview,
CodeViewInspectState::Exited, scope, {});
break;
}
default:
codeview_set_paused_line(g_codeview, 0);
codeview_set_current_line(g_codeview, 0);
codeview_set_inspection(g_codeview,
CodeViewInspectState::NoTarget, "", {});
break;
}
codewin_dump_snapshot(st);
}
static gboolean on_codewin_poll(gpointer) {
codewin_sync_from_debugger(false);
return G_SOURCE_CONTINUE;
}
static void open_code_view() {
if (!g_codeview_window) {
g_codeview_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(g_codeview_window),
"FDesigner \u2014 Code");
gtk_window_set_default_size(GTK_WINDOW(g_codeview_window), 1000,
700);
// Deliberately NOT transient for the designer: this is its own
// top-level window, listed separately by the window manager.
"Code - generated C++");
gtk_window_set_default_size(GTK_WINDOW(g_codeview_window), 900, 600);
gtk_window_set_transient_for(GTK_WINDOW(g_codeview_window),
GTK_WINDOW(g_window));
g_codeview = codeview_new();
codeview_set_theme(g_codeview, theme_current());
codeview_set_breakpoint_callback(g_codeview,
debugger_toggle_breakpoint);
gtk_container_add(GTK_CONTAINER(g_codeview_window), g_codeview);
// Closing the window hides it (the app keeps running);
// reopening from View -> Code View restores it, refreshed.
g_signal_connect(
g_codeview_window, "delete-event",
G_CALLBACK(+[](GtkWidget* w, GdkEvent*, gpointer) -> gboolean {
gtk_widget_hide(w);
return TRUE;
}),
nullptr);
g_signal_connect(
g_codeview_window, "destroy",
G_CALLBACK(+[](GtkWidget*, gpointer) {
@@ -2660,19 +2543,9 @@ static void open_code_view() {
nullptr);
gtk_widget_show_all(g_codeview_window);
} else {
gtk_widget_show(g_codeview_window);
gtk_window_present(GTK_WINDOW(g_codeview_window));
}
refresh_code_view();
codewin_sync_from_debugger(true);
}
// View -> Code View toggles the separate top-level code window.
static void toggle_code_view() {
if (g_codeview_window && gtk_widget_get_visible(g_codeview_window))
gtk_widget_hide(g_codeview_window);
else
open_code_view();
}
static void on_generate(GtkMenuItem*, gpointer) {
GtkWidget* dlg = gtk_file_chooser_dialog_new(
@@ -3832,71 +3705,6 @@ static gboolean selftest_step(gpointer) {
check(codeview_breakpoint_lines(cv).empty());
codeview_set_current_line(cv, 4);
check(codeview_current_line(cv) == 4);
// Round 3: red paused line (Lazarus-style execution-point
// background) + automatic inspection pane.
codeview_set_paused_line(cv, 5);
check(codeview_paused_line(cv) == 5);
{
GtkTextBuffer* pbuf = gtk_text_view_get_buffer(
GTK_TEXT_VIEW(codeview_text_view(cv)));
GtkTextTagTable* ptab =
gtk_text_buffer_get_tag_table(pbuf);
GtkTextTag* paused = gtk_text_tag_table_lookup(
ptab, "theme-paused-line");
check(paused != nullptr);
if (paused) {
// "background"/"foreground" are write-only; the
// readable form is "background-gdk"/"foreground-gdk"
// (boxed GdkColor*, 16-bit channels), as for the
// keyword tag below.
GdkColor* bg = nullptr;
GdkColor* fg = nullptr;
g_object_get(paused, "background-gdk", &bg,
"foreground-gdk", &fg, NULL);
// #c00000: red dominant; white text for readability.
check(bg && fg && bg->red > 40000 && bg->green < 8000 &&
bg->blue < 8000);
check(bg && fg && fg->red > 60000 && fg->green > 60000 &&
fg->blue > 60000);
if (bg)
g_boxed_free(g_type_from_name("GdkColor"), bg);
if (fg)
g_boxed_free(g_type_from_name("GdkColor"), fg);
// Paused tag outranks the current-line tag, so red
// wins when both mark the same line.
GtkTextTag* cur = gtk_text_tag_table_lookup(
ptab, "theme-current-line");
check(cur != nullptr);
if (cur)
check(gtk_text_tag_get_priority(paused) >
gtk_text_tag_get_priority(cur));
}
}
codeview_set_paused_line(cv, 0);
check(codeview_paused_line(cv) == 0);
// Inspection pane: states + scope + vars round-trip, and the
// running state carries no (stale) values.
check(codeview_inspection_state(cv) ==
CodeViewInspectState::NoTarget);
std::vector<Variable> ivars = {
{"a", "int", "42"}, {"msg", "const char *", "\"hello\""}};
codeview_set_inspection(cv, CodeViewInspectState::Stopped,
"main() \u2014 /tmp/x.c:8 (breakpoint-hit)",
ivars);
check(codeview_inspection_state(cv) ==
CodeViewInspectState::Stopped);
check(codeview_inspection_scope(cv) ==
"main() \u2014 /tmp/x.c:8 (breakpoint-hit)");
check(codeview_inspection_vars(cv).size() == 2);
check(codeview_inspection_vars(cv)[0].name == "a");
check(codeview_inspection_vars(cv)[0].value == "42");
check(codeview_inspection_vars(cv)[1].name == "msg");
codeview_set_inspection(cv, CodeViewInspectState::Running, "", {});
check(codeview_inspection_state(cv) ==
CodeViewInspectState::Running);
check(codeview_inspection_vars(cv).empty());
codeview_set_inspection(cv, CodeViewInspectState::NoTarget, "",
{});
codeview_set_theme(cv, dark);
GtkTextBuffer* cbuf = gtk_text_view_get_buffer(
GTK_TEXT_VIEW(codeview_text_view(cv)));
@@ -3974,8 +3782,10 @@ int main(int argc, char** argv) {
g_props_box = GTK_WIDGET(gtk_builder_get_object(builder, "props_box"));
g_selected_label =
GTK_WIDGET(gtk_builder_get_object(builder, "selected_label"));
g_palette_window =
GTK_WIDGET(gtk_builder_get_object(builder, "palette_window"));
if (!g_window || !g_canvas || !g_statusbar || !g_props_grid ||
!g_props_box || !g_selected_label) {
!g_props_box || !g_selected_label || !g_palette_window) {
std::fprintf(stderr, "fdesigner: designer.ui is missing core objects\n");
return 1;
}
@@ -4048,7 +3858,7 @@ int main(int argc, char** argv) {
if (mi_code)
g_signal_connect(mi_code, "activate",
G_CALLBACK(+[](GtkMenuItem*, gpointer) {
toggle_code_view();
open_code_view();
}),
nullptr);
GObject* mi_theme = gtk_builder_get_object(builder, "mi_view_theme");
@@ -4063,6 +3873,16 @@ int main(int argc, char** argv) {
});
}),
nullptr);
// View menu -> widget palette window (show/hide toggle).
GObject* mi_pal = gtk_builder_get_object(builder, "mi_view_palette");
if (mi_pal) {
g_palette_menu_item = GTK_WIDGET(mi_pal);
g_signal_connect(mi_pal, "toggled",
G_CALLBACK(on_view_palette_toggled), nullptr);
}
g_signal_connect(g_palette_window, "delete-event",
G_CALLBACK(on_palette_window_delete), nullptr);
// Debug menu -> stepping debugger window / settings.
GObject* mi_dbg = gtk_builder_get_object(builder, "mi_debug_open");
if (mi_dbg)
@@ -4128,12 +3948,42 @@ int main(int argc, char** argv) {
status("Phase 2 — pick a widget from the palette to place it");
gtk_widget_show_all(g_window);
// The code window is a separate top-level window that opens
// together with the designer (View -> Code View toggles it).
open_code_view();
// Keep the code window's paused line + inspection pane in step
// with the shared debugger session (200 ms poll).
g_timeout_add(200, on_codewin_poll, nullptr);
// Palette window: its own top-level window, opened together with the
// designer and parked to the left of the design window (right if
// there is no room on the left). Plain top-level, not transient or
// modal, so it never blocks the canvas.
if (g_palette_window) {
// [palette-window] Tight Lazarus-style packing: small buttons,
// minimal padding, no whitespace between rows. USER priority so
// it wins over the application theme/font providers.
GtkCssProvider* pal_css = gtk_css_provider_new();
gtk_css_provider_load_from_data(
pal_css,
"#palette_window button { min-height: 20px; padding: 1px 4px; }"
"#palette_window button label { padding: 0px; }"
"#palette_window label { padding: 0px; }",
-1, nullptr);
gtk_style_context_add_provider(
gtk_widget_get_style_context(g_palette_window),
GTK_STYLE_PROVIDER(pal_css),
GTK_STYLE_PROVIDER_PRIORITY_USER);
gtk_widget_show_all(g_palette_window);
while (gtk_events_pending()) gtk_main_iteration();
gint mx = 0, my = 0, mw = 0;
gtk_window_get_position(GTK_WINDOW(g_window), &mx, &my);
gtk_window_get_size(GTK_WINDOW(g_window), &mw, nullptr);
gint pw = 0;
gtk_window_get_size(GTK_WINDOW(g_palette_window), &pw, nullptr);
gint px = (mx >= pw + 12) ? mx - pw - 12 : mx + mw + 12;
GdkRectangle mgeo = {0, 0, 1920, 1080};
GdkMonitor* mon = gdk_display_get_primary_monitor(
gdk_screen_get_display(gdk_screen_get_default()));
if (mon) gdk_monitor_get_geometry(mon, &mgeo);
gint sw = mgeo.width;
if (px + pw > sw) px = sw - pw - 4;
if (px < 0) px = 0;
gtk_window_move(GTK_WINDOW(g_palette_window), px, my);
}
if (std::getenv("FDESIGNER_OPEN_DEBUGGER") != nullptr)
g_idle_add(+[](gpointer) -> gboolean {
@@ -4159,26 +4009,6 @@ int main(int argc, char** argv) {
},
nullptr);
// Test hook (used by tests/code_window_tests.sh): start a target
// under the debugger at startup, staging a breakpoint first.
// FDESIGNER_DEBUG_TARGET=<exe> FDESIGNER_DEBUG_BREAK=<file:line>
const char* dbg_target = std::getenv("FDESIGNER_DEBUG_TARGET");
if (dbg_target != nullptr) {
std::string exe = dbg_target;
const char* bp = std::getenv("FDESIGNER_DEBUG_BREAK");
std::string loc = bp ? bp : "";
g_idle_add(
+[](gpointer data) -> gboolean {
auto* pair = (std::pair<std::string, std::string>*)data;
debugger_window_open(g_window);
std::string err;
if (!debugger_autorun(pair->first, pair->second, err))
status("Debug autorun failed: " + err);
delete pair;
return G_SOURCE_REMOVE;
},
new std::pair<std::string, std::string>(exe, loc));
}
// Test hooks (also used by tests/theme_tests.sh): open the code
// view / theme picker at startup.
if (std::getenv("FDESIGNER_OPEN_CODEVIEW") != nullptr)
-281
View File
@@ -1,281 +0,0 @@
#!/bin/sh
# FDesigner code-window tests (round 3).
# tests/code_window_tests.sh
# Verifies, against the REAL app under Xvfb:
# (a) the code window is a separate top-level window with its own
# title, opened together with the designer at startup;
# (b) red dots render on breakpoint lines set via the debugger
# (and via a gutter click, which must stage a breakpoint in
# the backend);
# (c) the inspection pane auto-populates on a breakpoint hit with
# the CORRECT locals for that scope, and stepping into another
# function changes the shown scope;
# (d) the red paused-line background appears on a breakpoint pause,
# clears on resume, and moves on step (pixel-checked);
# (e) while the target runs, the inspection pane shows "running",
# not stale values;
# (f) closing the code window does not kill the app, and View ->
# Code View reopens it.
# The app is driven through FDESIGNER_DEBUG_TARGET / BREAK (autorun)
# and the FDESIGNER_CODEWIN_DUMP snapshot; stepping uses the debugger
# window's F5/F10/F11 shortcuts. Prints a PASS/FAIL summary; exits
# non-zero if anything fails. Run from the repo root.
set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
cd "$ROOT"
FAIL=0
WORK="$ROOT/tests/codewin/work"
rm -rf "$WORK"
mkdir -p "$WORK/homeA" "$WORK/homeB" "$WORK/homeC"
say() { printf '%s\n' "$*"; }
pass() { say "PASS $1"; }
fail() { say "FAIL $1"; FAIL=1; }
note() { say " -- $1"; }
# --- build ---------------------------------------------------------------
say "== building fdesigner =="
make >"$WORK/make.log" 2>&1 || { say "FAIL fdesigner build"; cat "$WORK/make.log"; exit 1; }
if grep -q "warning" "$WORK/make.log"; then
say "FAIL fdesigner build has warnings"; grep "warning" "$WORK/make.log"; FAIL=1
fi
say "== building test targets =="
cp "$ROOT/tests/codewin/prog.c" "$WORK/prog.c"
gcc -g -O0 -o "$WORK/prog" "$WORK/prog.c" || fail "build-prog"
gcc -g -O0 -o "$WORK/spin" "$ROOT/tests/debugger/spin.cpp" || fail "build-spin"
# Sanity: the break lines must hold the statements the test expects.
sed -n '16p' "$WORK/prog.c" | grep -q "helper(a)" || fail "prog.c:16 is not the helper call"
sed -n '11p' "$WORK/prog.c" | grep -q "return z" || fail "prog.c:11 is not return z"
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) ----------------
say "== fdesigner self-test (paused line + inspection block) =="
if FDESIGNER_SELFTEST=1 xvfb-run -a timeout 120 ./fdesigner >"$WORK/selftest.log" 2>&1; then
grep -q "SELFTEST PASS" "$WORK/selftest.log" && pass "selftest" || fail "selftest-no-pass-line"
else
fail "selftest"; cat "$WORK/selftest.log"
fi
# --- GUI helpers ----------------------------------------------------------
XDISP=":99"
export DISPLAY="$XDISP"
codewin_id() { xdotool search --name "FDesigner — Code" 2>/dev/null | head -1; }
dbgwin_id() { xdotool search --name "FDesigner Debugger" 2>/dev/null | head -1; }
mainwin_id() { xdotool search --name '^FDesigner — C\+\+/GTK$' 2>/dev/null | head -1; }
dump_has() { grep -q "$1" "$WORK/dump.txt" 2>/dev/null; }
wait_dump() { # $1=pattern $2=timeout-secs
i=0
while [ $i -lt $(( $2 * 5 )) ]; do
dump_has "$1" && return 0
sleep 0.2; i=$((i+1))
done
return 1
}
wait_win() { # $1=which(codewin|dbgwin|mainwin) $2=timeout-secs
i=0
while [ $i -lt $(( $2 * 5 )) ]; do
[ -n "$(${1}_id)" ] && return 0
sleep 0.2; i=$((i+1))
done
return 1
}
launch() { # $1=target $2=breakloc-or-empty $3=home-dir
rm -f "$WORK/dump.txt"
(cd "$ROOT" && HOME="$3" DISPLAY="$XDISP" \
FDESIGNER_DEBUG_TARGET="$1" FDESIGNER_DEBUG_BREAK="$2" \
FDESIGNER_CODEWIN_DUMP="$WORK/dump.txt" \
timeout 120 ./fdesigner >"$WORK/app.log" 2>&1) &
APP=$!
}
kill_app() {
kill $APP 2>/dev/null
pkill -x fdesigner 2>/dev/null
wait $APP 2>/dev/null
sleep 1
}
count_red() { # $1=png $2=x0 $3=x1 [$4=band] -> stdout count (+band line)
python3 "$ROOT/tests/codewin/count_red.py" "$1" "$2" "$3" "${4:-}"
}
if ! command -v xdotool >/dev/null 2>&1 || ! command -v import >/dev/null 2>&1; then
say "SKIP GUI e2e (xdotool/import not installed)"
[ "$FAIL" = "0" ] && say "CODE-WINDOW TESTS: ALL PASS" || say "CODE-WINDOW TESTS: FAILURES"
exit "$FAIL"
fi
Xvfb $XDISP -screen 0 1920x1080x24 >/dev/null 2>&1 &
XVPID=$!
sleep 2
trap 'kill_app; kill $XVPID 2>/dev/null' EXIT
# === Run A: breakpoint in main ============================================
say "== Run A: breakpoint in main (prog.c:16) =="
launch "$WORK/prog" "$WORK/prog.c:16" "$WORK/homeA"
if wait_win codewin 20; then
CW=$(codewin_id); pass "code-window-opens-at-startup (id $CW)"
else
fail "code-window-opens-at-startup"; kill_app; kill $XVPID 2>/dev/null; exit 1
fi
MW=$(mainwin_id)
if [ -n "$MW" ] && [ "$MW" != "$CW" ]; then
pass "code-window-is-separate-toplevel (main $MW, code $CW)"
else
fail "code-window-is-separate-toplevel (main=$MW code=$CW)"
fi
if wait_win dbgwin 20; then
DW=$(dbgwin_id); pass "debugger-window-open (id $DW)"
else
fail "debugger-window-open"
fi
if wait_dump "^state=Stopped" 20; then pass "stops-at-breakpoint"; else fail "stops-at-breakpoint"; cat "$WORK/dump.txt" 2>/dev/null; cat "$WORK/app.log"; fi
dump_has "^file=$WORK/prog.c" && pass "code-view-loads-stopped-file" || fail "code-view-loads-stopped-file"
dump_has "^paused_line=16" && pass "paused-line-16" || fail "paused-line-16"
dump_has "^current_line=16" && pass "current-line-16" || fail "current-line-16"
dump_has "main()" && pass "scope-is-main" || fail "scope-is-main"
dump_has "^var=a|int|42" && pass "local-a-42" || fail "local-a-42"
dump_has "^var=msg|" && grep "^var=msg|" "$WORK/dump.txt" | grep -q "hello" && pass "local-msg-hello" || fail "local-msg-hello"
note "dump after stop:"; sed 's/^/ dump: /' "$WORK/dump.txt" 2>/dev/null
# (d) red paused-line background, pixel-checked. Raise the code window
# first: Xvfb has no compositor, so an obscured window reads back wrong.
sleep 1
DISPLAY="$XDISP" xdotool windowraise "$CW" 2>/dev/null
sleep 0.5
DISPLAY="$XDISP" import -window "$CW" "$WORK/shot_paused.png" 2>/dev/null
RED_ALL=$(count_red "$WORK/shot_paused.png" 0 10000)
RED_TEXT=$(count_red "$WORK/shot_paused.png" 150 10000)
BAND=$(count_red "$WORK/shot_paused.png" 0 10000 band | tail -1)
note "paused screenshot: red_all=$RED_ALL red_text_area=$RED_TEXT ($BAND)"
if [ "${RED_TEXT:-0}" -ge 500 ]; then pass "red-paused-band-present"; else fail "red-paused-band-present (red_text=$RED_TEXT)"; fi
# Band geometry (screenshot coords) for the gutter-click test below.
BAND_TOP=$(echo "$BAND" | sed 's/.*band_top=\([0-9-]*\).*/\1/')
BAND_BOT=$(echo "$BAND" | sed 's/.*band_bottom=\([0-9-]*\).*/\1/')
BAND_H=0
if [ "${BAND_TOP:- -1}" -ge 0 ] && [ "${BAND_BOT:-0}" -gt "${BAND_TOP:-0}" ]; then
BAND_H=$((BAND_BOT - BAND_TOP + 1))
fi
note "band_top=$BAND_TOP band_bottom=$BAND_BOT line_h~$BAND_H"
# (c2) Step Over (F10) -> line 16, scope still main, locals still correct.
DISPLAY="$XDISP" xdotool windowfocus --sync "$DW" key F10 2>/dev/null
if wait_dump "^paused_line=17" 15; then pass "step-over-moves-paused-line-to-17"; else fail "step-over-moves-paused-line-to-17"; cat "$WORK/dump.txt" 2>/dev/null; fi
dump_has "main()" && pass "scope-still-main-after-step" || fail "scope-still-main-after-step"
sleep 1
DISPLAY="$XDISP" xdotool windowraise "$CW" 2>/dev/null
sleep 0.5
DISPLAY="$XDISP" import -window "$CW" "$WORK/shot_stepped.png" 2>/dev/null
RED_STEP=$(count_red "$WORK/shot_stepped.png" 150 10000)
[ "${RED_STEP:-0}" -ge 500 ] && pass "red-band-follows-step" || fail "red-band-follows-step (red=$RED_STEP)"
# (d2) Continue (F5) -> target exits, red background clears.
DISPLAY="$XDISP" xdotool windowfocus --sync "$DW" key F5 2>/dev/null
if wait_dump "^state=Exited" 15; then pass "continue-exits-target"; else fail "continue-exits-target"; cat "$WORK/dump.txt" 2>/dev/null; fi
dump_has "^paused_line=0" && pass "paused-line-clears-on-resume" || fail "paused-line-clears-on-resume"
sleep 1
DISPLAY="$XDISP" xdotool windowraise "$CW" 2>/dev/null
sleep 0.5
DISPLAY="$XDISP" import -window "$CW" "$WORK/shot_exited.png" 2>/dev/null
RED_EXIT_TEXT=$(count_red "$WORK/shot_exited.png" 150 10000)
RED_EXIT_GUTTER=$(count_red "$WORK/shot_exited.png" 0 110)
note "exited screenshot: red_text=$RED_EXIT_TEXT red_gutter=$RED_EXIT_GUTTER"
[ "${RED_EXIT_TEXT:-9999}" -lt 200 ] && pass "red-band-clears-on-resume" || fail "red-band-clears-on-resume (red=$RED_EXIT_TEXT)"
# (b) the debugger-set breakpoint dot is still drawn in the gutter.
[ "${RED_EXIT_GUTTER:-0}" -ge 20 ] && pass "breakpoint-dot-still-drawn" || fail "breakpoint-dot-still-drawn (gutter_red=$RED_EXIT_GUTTER)"
# (b2) Gutter click stages a breakpoint in the backend: line 14 is two
# lines above the (old) paused line 16. Click the gutter dot zone.
if [ "${BAND_H:-0}" -gt 5 ] && [ "${BAND_TOP:- -1}" -ge 0 ]; then
GEOM=$(DISPLAY="$XDISP" xdotool getwindowgeometry --shell "$CW" 2>/dev/null)
SHOT_H=$(python3 -c "from PIL import Image; print(Image.open('$WORK/shot_paused.png').size[1])")
WIN_H=$(echo "$GEOM" | sed -n 's/^HEIGHT=//p')
TITLE_OFF=0
if [ -n "$SHOT_H" ] && [ -n "$WIN_H" ] && [ "$SHOT_H" -gt "$WIN_H" ]; then
TITLE_OFF=$((SHOT_H - WIN_H))
fi
Y16=$(( (BAND_TOP + BAND_BOT) / 2 - TITLE_OFF ))
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"
BPS="$WORK/homeA/.config/fdesigner/debugger_bps.conf"
GUT_OK=0
for TRY in 0 1 2; do
case $TRY in
0) YY=$Y14;;
1) YY=$((Y14 - BAND_H));;
2) YY=$((Y14 + BAND_H));;
esac
DISPLAY="$XDISP" xdotool windowraise "$CW" windowfocus --sync "$CW" mousemove --window "$CW" 40 "$YY" click 1 2>/dev/null
sleep 1
if grep -q "prog.c:14|" "$BPS" 2>/dev/null; then GUT_OK=1; break; fi
# Wrong line? remove whatever that click staged, then retry.
if grep -q "prog.c:" "$BPS" 2>/dev/null; then
DISPLAY="$XDISP" xdotool windowraise "$CW" windowfocus --sync "$CW" mousemove --window "$CW" 40 "$YY" click 1 2>/dev/null
sleep 1
fi
done
if [ "$GUT_OK" = "1" ]; then
pass "gutter-click-stages-breakpoint (prog.c:14 in bps conf)"
# Click again: the breakpoint must go away.
DISPLAY="$XDISP" xdotool windowraise "$CW" windowfocus --sync "$CW" mousemove --window "$CW" 40 "$YY" click 1 2>/dev/null
sleep 1
grep -q "prog.c:14|" "$BPS" 2>/dev/null && fail "gutter-click-removes-breakpoint" || pass "gutter-click-removes-breakpoint"
else
fail "gutter-click-stages-breakpoint"
grep "prog.c:" "$BPS" 2>/dev/null | sed 's/^/ bps: /' || note "no bps conf"
fi
else
fail "gutter-click-stages-breakpoint (no band geometry)"
fi
kill_app
# === Run B: breakpoint in helper — scope must change =======================
say "== Run B: breakpoint in helper (prog.c:11) =="
launch "$WORK/prog" "$WORK/prog.c:11" "$WORK/homeB"
wait_win codewin 20 || fail "runB-code-window-opens"
if wait_dump "^state=Stopped" 20; then pass "runB-stops-at-breakpoint"; else fail "runB-stops-at-breakpoint"; fi
dump_has "^paused_line=11" && pass "runB-paused-line-11" || fail "runB-paused-line-11"
dump_has "helper()" && pass "scope-is-helper" || fail "scope-is-helper"
dump_has "^var=x|int|42" && pass "runB-local-x-42" || fail "runB-local-x-42"
dump_has "^var=y|double|3.5" && pass "runB-local-y-3.5" || fail "runB-local-y-3.5"
dump_has "^var=z|int|44" && pass "runB-local-z-44" || fail "runB-local-z-44"
dump_has "^var=a|" && fail "runB-no-main-locals-leak" || pass "runB-no-main-locals-leak"
note "dump run B:"; sed 's/^/ dump: /' "$WORK/dump.txt" 2>/dev/null
kill_app
# === Run C: spinning target — "running", never stale =======================
say "== Run C: spinning target, no breakpoint =="
launch "$WORK/spin" "" "$WORK/homeC"
wait_win codewin 20 || fail "runC-code-window-opens"
if wait_dump "^state=Running" 20; then pass "running-state-shown"; else fail "running-state-shown"; cat "$WORK/dump.txt" 2>/dev/null; fi
dump_has "^paused_line=0" && pass "runC-no-paused-line" || fail "runC-no-paused-line"
if grep -q "^var=" "$WORK/dump.txt" 2>/dev/null; then fail "runC-no-stale-values"; else pass "runC-no-stale-values"; fi
note "dump run C:"; sed 's/^/ dump: /' "$WORK/dump.txt" 2>/dev/null
# (f) close the code window: app must survive; View -> Code View reopens.
CW=$(codewin_id); MW=$(mainwin_id)
DISPLAY="$XDISP" xdotool windowclose "$CW" 2>/dev/null
sleep 1
if kill -0 $APP 2>/dev/null && [ -n "$(mainwin_id)" ]; then
pass "close-code-window-keeps-app-alive"
else
fail "close-code-window-keeps-app-alive"
fi
[ -z "$(codewin_id)" ] && pass "code-window-actually-closed" || fail "code-window-actually-closed"
DISPLAY="$XDISP" xdotool windowfocus --sync "$MW" key F10 Right Right Down Return 2>/dev/null
if wait_win codewin 10; then
pass "view-menu-reopens-code-window"
else
# Fallback: click the View menu, then its first item.
GEOM=$(DISPLAY="$XDISP" xdotool getwindowgeometry --shell "$MW" 2>/dev/null)
WX=$(echo "$GEOM" | sed -n 's/^X=//p'); WY=$(echo "$GEOM" | sed -n 's/^Y=//p')
DISPLAY="$XDISP" xdotool windowraise "$MW" mousemove --window "$MW" 130 12 click 1 2>/dev/null
sleep 0.7
DISPLAY="$XDISP" xdotool mousemove --window "$MW" 140 55 click 1 2>/dev/null
if wait_win codewin 10; then pass "view-menu-reopens-code-window (click fallback)"; else fail "view-menu-reopens-code-window"; fi
fi
kill_app
kill $XVPID 2>/dev/null
trap - EXIT
if [ "$FAIL" = "0" ]; then say "CODE-WINDOW TESTS: ALL PASS"; else say "CODE-WINDOW TESTS: FAILURES (see above)"; fi
exit "$FAIL"
-39
View File
@@ -1,39 +0,0 @@
#!/usr/bin/env python3
"""Count red-ish pixels in a screenshot (the paused-line band is
#c00000, breakpoint dots are the same red).
Usage: count_red.py <png> [x0 x1] [band]
Prints the red pixel count in columns [x0, x1).
With "band": also prints the top/bottom row of the densest run of
rows that each contain >100 red pixels (the full-line paused band),
as band_top=.. band_bottom=.. band_rows=..
"""
import sys
from PIL import Image
im = Image.open(sys.argv[1]).convert("RGB")
px = im.load()
w, h = im.size
x0 = int(sys.argv[2]) if len(sys.argv) > 2 else 0
x1 = int(sys.argv[3]) if len(sys.argv) > 3 else w
x1 = min(x1, w)
n = 0
band_rows = []
for y in range(h):
row = 0
for x in range(x0, x1):
r, g, b = px[x, y]
if r > 150 and g < 70 and b < 70:
n += 1
row += 1
if row > 100:
band_rows.append(y)
print(n)
if len(sys.argv) > 4 and sys.argv[4] == "band":
if band_rows:
print("band_top=%d band_bottom=%d band_rows=%d"
% (band_rows[0], band_rows[-1], len(band_rows)))
else:
print("band_top=-1 band_bottom=-1 band_rows=0")
-19
View File
@@ -1,19 +0,0 @@
// FDesigner code-window test target: known locals in two scopes.
// 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
// tests/code_window_tests.sh). Line numbers are load-bearing:
// main: a=42 at line 14, msg="hello" at line 15
// helper: x=42, y=3.5, z=44 at line 11 (return)
#include <stdio.h>
static int helper(int x) {
double y = 3.5;
int z = x + 2;
return z;
}
int main(void) {
int a = 42;
const char *msg = "hello";
int r = helper(a);
printf("%d %s\n", r, msg);
return 0;
}
+162
View File
@@ -0,0 +1,162 @@
#!/usr/bin/env bash
# Palette-window tests: the widget palette is its own top-level window
# ("FDesigner — Widgets"), tight 2-column Lazarus-style grid, opens with
# the designer, closes (hide, app survives) and reopens from View menu.
# Uses a tiny Xlib helper to send a real WM_DELETE_WINDOW (xdotool
# windowclose destroys the X window outright under bare Xvfb, which is
# not what a window manager does).
set -u
cd "$(dirname "$0")/.."
pass=0; fail=0; failed=""
ok() { echo "PASS $1"; pass=$((pass+1)); }
bad() { echo "FAIL $1"; fail=$((fail+1)); failed="$failed $1"; }
# Re-run the body under Xvfb when no display is set.
if [ -z "${DISPLAY:-}" ]; then
PALETTE_TEST_IN_XVFB=1 xvfb-run -a -s "-screen 0 2560x1440x24" "$0"
exit $?
fi
echo "== building fdesigner =="
if make > /tmp/palette_make.log 2>&1; then ok make; else
bad make; cat /tmp/palette_make.log; exit 1
fi
echo "== building Xlib close helper =="
cat > /tmp/palette_wmclose.c << "C_EOF"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
Display* d = XOpenDisplay(NULL);
if (!d) return 2;
Window w = (Window)strtoul(argv[1], NULL, 0);
Atom trans = XInternAtom(d, "WM_TRANSIENT_FOR", False);
Atom actual; int fmt; unsigned long n, extra; unsigned char* prop = NULL;
XGetWindowProperty(d, w, trans, 0, 1, False, XA_WINDOW,
&actual, &fmt, &n, &extra, &prop);
printf("TRANSIENT=%lu\n", n);
if (prop) XFree(prop);
Atom protos = XInternAtom(d, "WM_PROTOCOLS", False);
Atom del = XInternAtom(d, "WM_DELETE_WINDOW", False);
Atom* plist = NULL; int count = 0, has_del = 0;
if (XGetWMProtocols(d, w, &plist, &count)) {
for (int i = 0; i < count; i++) if (plist[i] == del) has_del = 1;
XFree(plist);
}
printf("DELETE_PROTOCOL=%d\n", has_del);
if (argc > 2 && !strcmp(argv[2], "close")) {
XEvent ev; memset(&ev, 0, sizeof(ev));
ev.xclient.type = ClientMessage;
ev.xclient.window = w;
ev.xclient.message_type = protos;
ev.xclient.format = 32;
ev.xclient.data.l[0] = del;
ev.xclient.data.l[1] = CurrentTime;
XSendEvent(d, w, False, NoEventMask, &ev);
XSync(d, False);
printf("SENT_CLOSE\n");
}
XCloseDisplay(d);
return 0;
}
C_EOF
if gcc -O2 -Wall -Wextra -o /tmp/palette_wmclose /tmp/palette_wmclose.c -lX11 \
> /tmp/palette_wmclose_build.log 2>&1; then ok wmclose-helper-build;
else bad wmclose-helper-build; cat /tmp/palette_wmclose_build.log; exit 1; fi
echo "== launching designer under Xvfb ($DISPLAY) =="
./fdesigner > /tmp/palette_app.log 2>&1 &
APP_PID=$!
trap 'kill $APP_PID 2>/dev/null || true' EXIT
sleep 3
if ! kill -0 $APP_PID 2>/dev/null; then
bad "app-start"; cat /tmp/palette_app.log; exit 1
fi
ok app-start
MAIN=$(xdotool search --name "FDesigner — C\+\+/GTK" | head -1)
PAL=$(xdotool search --name "FDesigner — Widgets" | head -1)
[ -n "$MAIN" ] && ok main-window || bad main-window
[ -n "$PAL" ] && ok palette-window || bad palette-window
if [ -n "$MAIN" ] && [ -n "$PAL" ] && [ "$MAIN" != "$PAL" ]; then
ok distinct-windows
else bad distinct-windows; fi
# Palette must be a plain top-level window, not transient/modal.
if [ -n "$PAL" ]; then
OUT=$(/tmp/palette_wmclose "$PAL")
echo "$OUT" | grep -q "TRANSIENT=0" && ok not-transient || bad not-transient
echo "$OUT" | grep -q "DELETE_PROTOCOL=1" && ok delete-protocol || \
bad delete-protocol
fi
# Palette parked beside the designer (left or right, not overlapping it).
geom() { # $1 = window id, $2/$3 = name prefix for X/Y/W/H vars
eval "$(xdotool getwindowgeometry "$1" | sed -n \
-e 's/ *Position: \([0-9]*\),\([0-9]*\).*/'"$2"'X=\1; '"$2"'Y=\2/p' \
-e 's/ *Geometry: \([0-9]*\)x\([0-9]*\)/'"$2"'W=\1; '"$2"'H=\2/p')"
}
if [ -n "$MAIN" ] && [ -n "$PAL" ]; then
geom "$MAIN" M
geom "$PAL" P
echo "main ${MW}x${MH}@${MX},${MY} palette ${PW}x${PH}@${PX},${PY}"
if [ "$PX" -eq $((MX - PW - 12)) ] || [ "$PX" -eq $((MX + MW + 12)) ]; then
ok palette-beside-main
else bad palette-beside-main; fi
if [ "$PW" -ge 200 ] && [ "$PW" -le 300 ]; then ok palette-width;
else bad palette-width; fi
fi
# Clicking palette buttons places widgets on the canvas: screenshot the
# canvas corner before/after clicking Button, then Memo (Lazarus).
if [ -n "$PAL" ] && [ -n "$MAIN" ]; then
CX=$((MX + 10)); CY=$((MY + 30))
import -window root -crop 500x220+${CX}+${CY} /tmp/palette_before.png
# First button (Button, left column, first grid row).
xdotool mousemove $((PX + 62)) $((PY + 39)) click 1; sleep 0.7
# Memo button (Lazarus — Basic, left column).
xdotool mousemove $((PX + 62)) $((PY + 350)) click 1; sleep 0.7
import -window root -crop 500x220+${CX}+${CY} /tmp/palette_after.png
DIFF=$(compare -metric AE -fuzz 5% /tmp/palette_before.png \
/tmp/palette_after.png /tmp/palette_diff.png 2>&1 || true)
echo "canvas pixel diff: $DIFF"
if [ "${DIFF:-0}" -gt 1000 ] 2>/dev/null; then ok palette-places-widgets;
else bad palette-places-widgets; fi
fi
# Closing the palette (real WM close) hides it; the app stays alive.
if [ -n "$PAL" ]; then
/tmp/palette_wmclose "$PAL" close > /tmp/palette_close.log 2>&1
sleep 1
if [ -z "$(xdotool search --onlyvisible --name "FDesigner — Widgets")" ]; then
ok palette-hides-on-close
else bad palette-hides-on-close; fi
if kill -0 $APP_PID 2>/dev/null && \
[ -n "$(xdotool search --onlyvisible --name "FDesigner — C\+\+/GTK")" ]; then
ok app-alive-after-close
else bad app-alive-after-close; fi
# Reopen from View -> Widget Palette (menu coords from main geometry).
xdotool mousemove $((MX + 110)) $((MY + 12)) click 1; sleep 0.8
xdotool mousemove $((MX + 141)) $((MY + 89)) click 1; sleep 1
if [ -n "$(xdotool search --onlyvisible --name "FDesigner — Widgets")" ]; then
ok palette-reopens-from-view-menu
else bad palette-reopens-from-view-menu; fi
# Clicking the canvas still works after palette + design interplay.
xdotool mousemove $((MX + 300)) $((MY + 400)) click 1; sleep 0.5
kill -0 $APP_PID 2>/dev/null && ok canvas-click-after-reopen || \
bad canvas-click-after-reopen
fi
# No GTK warnings/criticals from the palette windows in the app log.
if grep -qE "Gtk-CRITICAL|Gdk-WARNING" /tmp/palette_app.log; then
bad "app-log-warnings"; grep -E "Gtk-CRITICAL|Gdk-WARNING" /tmp/palette_app.log
else ok app-log-clean; fi
kill $APP_PID 2>/dev/null || true
trap - EXIT
echo "== palette_window_tests: $pass passed, $fail failed ==$failed"
[ $fail -eq 0 ]
+1 -1
View File
@@ -60,7 +60,7 @@ else
FOUND=""
i=0
while [ $i -lt 50 ]; do
FOUND=$(xdotool search --name "FDesigner — Code" 2>/dev/null | head -1)
FOUND=$(xdotool search --name "Code - generated C\+\+" 2>/dev/null | head -1)
[ -n "$FOUND" ] && break
sleep 0.2; i=$((i+1))
done
+527 -272
View File
@@ -108,7 +108,7 @@
<property name="visible">True</property>
<child>
<object class="GtkMenuItem" id="mi_view_code">
<property name="label">Code View</property>
<property name="label">Code View…</property>
<property name="visible">True</property>
</object>
</child>
@@ -118,6 +118,13 @@
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mi_view_palette">
<property name="label">Widget Palette</property>
<property name="visible">True</property>
<property name="active">True</property>
</object>
</child>
</object>
</child>
</object>
@@ -202,277 +209,6 @@
<object class="GtkPaned" id="main_paned">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
<child>
<object class="GtkScrolledWindow" id="palette_scroll">
<property name="width_request">170</property>
<property name="visible">True</property>
<child>
<object class="GtkBox" id="palette_box">
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="palette_label">
<property name="label">&lt;b&gt;Widgets&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_button">
<property name="label">Button</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_label">
<property name="label">Label</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_entry">
<property name="label">Entry</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_checkbutton">
<property name="label">CheckButton</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_radiobutton">
<property name="label">RadioButton</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_frame">
<property name="label">Frame</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_combobox">
<property name="label">ComboBox</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_listbox">
<property name="label">ListBox</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_menubutton">
<property name="label">MenuButton</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_canvas">
<property name="label">Canvas</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_scale">
<property name="label">Scale</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_scrollbar">
<property name="label">Scrollbar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_text">
<property name="label">Text</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_toplevel">
<property name="label">Toplevel</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_spreadsheet">
<property name="label">Spreadsheet</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_stockchart">
<property name="label">StockChart</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="pal_section_lazarus">
<property name="label">&lt;b&gt;Lazarus — Basic&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_memo">
<property name="label">Memo</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_groupbox">
<property name="label">GroupBox</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_panel">
<property name="label">Panel</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_image">
<property name="label">Image</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_shape">
<property name="label">Shape</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="pal_section_containers">
<property name="label">&lt;b&gt;Containers&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_notebook">
<property name="label">Notebook</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_scrollbox">
<property name="label">ScrollBox</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_splitter">
<property name="label">Splitter</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_statusbar">
<property name="label">StatusBar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_toolbar">
<property name="label">ToolBar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_menubar">
<property name="label">MenuBar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="pal_section_input">
<property name="label">&lt;b&gt;Input&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_spinedit">
<property name="label">SpinEdit</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_trackbar">
<property name="label">TrackBar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_progressbar">
<property name="label">ProgressBar</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_datetimepicker">
<property name="label">DateTimePicker</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_colorbox">
<property name="label">ColorBox</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="pal_section_data">
<property name="label">&lt;b&gt;Data / Display&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_listview">
<property name="label">ListView</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_treeview">
<property name="label">TreeView</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_stringgrid">
<property name="label">StringGrid</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="pal_plot">
<property name="label">Plot</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkPaned" id="canvas_props_paned">
<property name="orientation">horizontal</property>
@@ -554,4 +290,523 @@
</object>
</child>
</object>
<object class="GtkWindow" id="palette_window">
<property name="title">FDesigner — Widgets</property>
<property name="default_width">250</property>
<property name="default_height">780</property>
<child>
<object class="GtkScrolledWindow" id="palette_scroll">
<property name="width_request">230</property>
<property name="visible">True</property>
<child>
<object class="GtkGrid" id="palette_box">
<property name="row_spacing">2</property>
<property name="column_spacing">2</property>
<property name="margin_start">2</property>
<property name="margin_end">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="palette_label">
<property name="label">&lt;b&gt;Widgets&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_button">
<property name="label">Button</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_label">
<property name="label">Label</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_entry">
<property name="label">Entry</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_checkbutton">
<property name="label">CheckButton</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_radiobutton">
<property name="label">RadioButton</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_frame">
<property name="label">Frame</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_combobox">
<property name="label">ComboBox</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_listbox">
<property name="label">ListBox</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_menubutton">
<property name="label">MenuButton</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_canvas">
<property name="label">Canvas</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_scale">
<property name="label">Scale</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_scrollbar">
<property name="label">Scrollbar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_text">
<property name="label">Text</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_toplevel">
<property name="label">Toplevel</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_spreadsheet">
<property name="label">Spreadsheet</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_stockchart">
<property name="label">StockChart</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pal_section_lazarus">
<property name="label">&lt;b&gt;Lazarus — Basic&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_memo">
<property name="label">Memo</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_groupbox">
<property name="label">GroupBox</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">10</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_panel">
<property name="label">Panel</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_image">
<property name="label">Image</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">11</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_shape">
<property name="label">Shape</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">12</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pal_section_containers">
<property name="label">&lt;b&gt;Containers&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">13</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_notebook">
<property name="label">Notebook</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">14</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_scrollbox">
<property name="label">ScrollBox</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">14</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_splitter">
<property name="label">Splitter</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">15</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_statusbar">
<property name="label">StatusBar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">15</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_toolbar">
<property name="label">ToolBar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_menubar">
<property name="label">MenuBar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pal_section_input">
<property name="label">&lt;b&gt;Input&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">17</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_spinedit">
<property name="label">SpinEdit</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">18</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_trackbar">
<property name="label">TrackBar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">18</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_progressbar">
<property name="label">ProgressBar</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">19</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_datetimepicker">
<property name="label">DateTimePicker</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">19</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_colorbox">
<property name="label">ColorBox</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">20</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pal_section_data">
<property name="label">&lt;b&gt;Data / Display&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">21</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_listview">
<property name="label">ListView</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">22</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_treeview">
<property name="label">TreeView</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">22</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_stringgrid">
<property name="label">StringGrid</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">23</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pal_plot">
<property name="label">Plot</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">23</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>