summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-07-17 12:56:23 +0200
committerMatthias Melcher <github@matthiasm.com>2023-07-17 12:56:35 +0200
commit4d94a08bd2fcd681d33bfb51228ace3b432b19ab (patch)
tree5867ce7627bf48eaf8cd7fe8ce76839ea37ab36b /fluid
parent4dffa31520f66fe0baea574ea391ec58a77eaa49 (diff)
FLUID: fix window visibility across project file update
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fd_Snap_Action.cxx3
-rw-r--r--fluid/Fl_Widget_Type.cxx6
-rw-r--r--fluid/Fl_Widget_Type.h6
-rw-r--r--fluid/Fl_Window_Type.cxx7
-rw-r--r--fluid/about_panel.fl9
-rw-r--r--fluid/alignment_panel.fl10
-rw-r--r--fluid/function_panel.cxx8
-rw-r--r--fluid/function_panel.fl15
-rw-r--r--fluid/print_panel.fl9
-rw-r--r--fluid/template_panel.fl2
-rw-r--r--fluid/widget_panel.fl2
11 files changed, 51 insertions, 26 deletions
diff --git a/fluid/Fd_Snap_Action.cxx b/fluid/Fd_Snap_Action.cxx
index 4c9be9b2b..1334b0a05 100644
--- a/fluid/Fd_Snap_Action.cxx
+++ b/fluid/Fd_Snap_Action.cxx
@@ -111,7 +111,6 @@ Fd_Layout_List g_layout_list;
// ---- Callbacks ------------------------------------------------------ MARK: -
void layout_suite_marker(Fl_Widget *, void *) {
- assert(0);
// intentionally left empty
}
@@ -820,7 +819,7 @@ void Fd_Layout_List::capacity(int n) {
new_choice_menu[i] = choice_menu_[i];
if (!list_is_static_) ::free(choice_menu_);
choice_menu_ = new_choice_menu;
- layout_choice->menu(choice_menu_);
+ if (layout_choice) layout_choice->menu(choice_menu_);
list_capacity_ = n;
list_is_static_ = false;
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 342d2145a..87c3ada06 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -175,7 +175,9 @@ void Fl_Widget_Type::setlabel(const char *n) {
redraw();
}
-Fl_Widget_Type::Fl_Widget_Type() {
+Fl_Widget_Type::Fl_Widget_Type()
+: override_visible_(0)
+{
for (int n=0; n<NUM_EXTRA_CODE; n++) {extra_code_[n] = 0; }
subclass_ = 0;
hotspot_ = 0;
@@ -3264,7 +3266,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
if (s != fs) f.write_string("textsize %d", s);
if (c != fc) f.write_string("textcolor %d", c);
}}
- if (!o->visible()) f.write_string("hide");
+ if (!o->visible() && !override_visible_) f.write_string("hide");
if (!o->active()) f.write_string("deactivate");
if (resizable()) f.write_string("resizable");
if (hotspot()) f.write_string(is_menu_item() ? "divider" : "hotspot");
diff --git a/fluid/Fl_Widget_Type.h b/fluid/Fl_Widget_Type.h
index b41ba0e53..580a8cacf 100644
--- a/fluid/Fl_Widget_Type.h
+++ b/fluid/Fl_Widget_Type.h
@@ -51,6 +51,12 @@ class Fl_Widget_Type : public Fl_Type {
protected:
+ /// This variable is set for visible windows in batch mode.
+ /// We can't open a window in batch mode, even if we want the "visible" flags
+ /// set, so we need a second place to store this information while also
+ /// disabeling the output of the "hide" property by the Widget Type.
+ uchar override_visible_;
+
void write_static(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_widget_code(Fd_Code_Writer& f);
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index cb7292947..37fd10b93 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1193,7 +1193,7 @@ void Fl_Window_Type::write_properties(Fd_Project_Writer &f) {
if (xclass) {f.write_string("xclass"); f.write_word(xclass);}
if (sr_min_w || sr_min_h || sr_max_w || sr_max_h)
f.write_string("size_range {%d %d %d %d}", sr_min_w, sr_min_h, sr_max_w, sr_max_h);
- if (o->visible()) f.write_string("visible");
+ if (o->visible() || override_visible_) f.write_string("visible");
}
void Fl_Window_Type::read_property(Fd_Project_Reader &f, const char *c) {
@@ -1202,7 +1202,10 @@ void Fl_Window_Type::read_property(Fd_Project_Reader &f, const char *c) {
} else if (!strcmp(c,"non_modal")) {
non_modal = 1;
} else if (!strcmp(c, "visible")) {
- if (Fl::first_window()) open_(); // only if we are using user interface
+ if (batch_mode) // don't actually open any windows in batch mode
+ override_visible_ = 1;
+ else // in interactive mode, we simply show the window
+ open_();
} else if (!strcmp(c,"noborder")) {
((Fl_Window*)o)->border(0);
} else if (!strcmp(c,"xclass")) {
diff --git a/fluid/about_panel.fl b/fluid/about_panel.fl
index 82c8ce627..8c524a5dd 100644
--- a/fluid/about_panel.fl
+++ b/fluid/about_panel.fl
@@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
+snap {
+ ver 1
+ current_suite FLTK
+ current_preset 1
+}
comment {//
// About dialog for the Fast Light Tool Kit (FLTK).
//
@@ -35,11 +40,11 @@ if (!cbuf[0]) {
sprintf(cbuf, "Copyright © 1998 - %d\\nby Bill Spitzak and others", lt->tm_year+1900);
}} {}
Fl_Window about_panel {
- label {About FLUID} open
+ label {About FLUID} open selected
xywh {449 217 345 180} type Double color 50 selection_color 47 hotspot
code0 {\#include "../src/flstring.h"} non_modal visible
} {
- Fl_Box {} {selected
+ Fl_Box {} {
image {icons/fluid.animated.gif} compress_image 1 xywh {10 10 115 120}
code0 {((Fl_Anim_GIF_Image*)(o->image()))->speed(0.5f);}
}
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index 3bc8bded6..e48dd29dd 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -4,7 +4,7 @@ header_name {.h}
code_name {.cxx}
snap {
ver 1
- current_suite {My Test}
+ current_suite FLTK
current_preset 1
suite {
name {FLUID (based on FLTK)}
@@ -107,8 +107,8 @@ decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local
Function {make_settings_window()} {open
} {
Fl_Window settings_window {
- label {FLUID Settings} open
- xywh {617 331 340 580} type Double align 80
+ label {FLUID Settings} open selected
+ xywh {423 204 340 580} type Double align 80
code0 {o->size_range(o->w(), o->h());} non_modal visible
} {
Fl_Tabs w_settings_tabs {
@@ -116,7 +116,7 @@ Function {make_settings_window()} {open
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255
} {
Fl_Group {} {
- label General open selected
+ label General open
image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11
code0 {o->image()->scale(36, 24);}
} {
@@ -971,7 +971,7 @@ Function {make_shell_window()} {open
} {
Fl_Window shell_run_window {
label {Shell Command Output} open
- xywh {455 590 555 430} type Double align 80 resizable visible
+ xywh {454 638 555 430} type Double align 80 resizable visible
} {
Fl_Simple_Terminal shell_run_terminal {
xywh {10 10 535 375} resizable
diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx
index c9a43b2fb..88a2762cb 100644
--- a/fluid/function_panel.cxx
+++ b/fluid/function_panel.cxx
@@ -191,8 +191,8 @@ Fl_Double_Window* make_code_panel() {
} // Fl_Box* o
o->end();
} // Fl_Group* o
- o->size_range(200, 150);
code_panel->set_modal();
+ o->size_range(200, 150);
code_panel->end();
} // Fl_Double_Window* code_panel
// Enable line numbers
@@ -245,8 +245,8 @@ Fl_Double_Window* make_codeblock_panel() {
} // Fl_Box* o
o->end();
} // Fl_Group* o
- o->size_range(o->w(), o->h(), Fl::w(), o->h());
codeblock_panel->set_modal();
+ o->size_range(o->w(), o->h(), Fl::w(), o->h());
codeblock_panel->end();
} // Fl_Double_Window* codeblock_panel
return codeblock_panel;
@@ -326,8 +326,8 @@ Fl_Double_Window* make_declblock_panel() {
} // Fl_Box* o
o->end();
} // Fl_Group* o
- o->size_range(o->w(), o->h(), Fl::w(), o->h());
declblock_panel->set_modal();
+ o->size_range(o->w(), o->h(), Fl::w(), o->h());
declblock_panel->end();
} // Fl_Double_Window* declblock_panel
return declblock_panel;
@@ -693,8 +693,8 @@ Fl_Double_Window* make_comment_panel() {
} // Fl_Box* o
o->end();
} // Fl_Group* o
- o->size_range(320, 180);
comment_panel->set_modal();
+ o->size_range(320, 180);
comment_panel->end();
} // Fl_Double_Window* comment_panel
return comment_panel;
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index 0607f6d82..914ebc9f8 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
+snap {
+ ver 1
+ current_suite FLTK
+ current_preset 1
+}
comment {//
// Code dialogs for the Fast Light Tool Kit (FLTK).
//
@@ -23,10 +28,10 @@ comment {//
decl {\#include "fluid.h"} {private local
}
-decl {\#include "custom_widgets.h"} {selected private global
+decl {\#include "custom_widgets.h"} {private global
}
-decl {\#include "pixmaps.h"} {private local
+decl {\#include "pixmaps.h"} {selected private local
}
decl {\#include "factory.h"} {private local
@@ -480,7 +485,7 @@ Function {make_comment_panel()} {open
} {
Fl_Window comment_panel {
label {Comment Properties} open
- xywh {780 296 550 280} type Double labelsize 11 resizable
+ xywh {519 374 550 280} type Double labelsize 11 resizable
code0 {o->size_range(320, 180);} modal visible
} {
Fl_Text_Editor comment_input {
@@ -546,7 +551,7 @@ Function {make_widgetbin()} {open
exit_cb((Fl_Widget*)o, v);
else
toggle_widgetbin_cb((Fl_Widget*)o, v);}
- xywh {449 206 600 102} type Single align 80 non_modal visible
+ xywh {421 218 600 102} type Single align 80 non_modal visible
} {
Fl_Group {} {
label Code open
@@ -979,7 +984,7 @@ Function {make_sourceview()} {open
Fl_Window sourceview_panel {
label {Code View}
callback toggle_sourceview_cb open
- xywh {464 265 520 490} type Double align 80 resizable size_range {384 120 0 0} visible
+ xywh {400 569 520 490} type Double align 80 resizable size_range {384 120 0 0} visible
} {
Fl_Tabs sv_tab {
callback update_sourceview_position_cb open
diff --git a/fluid/print_panel.fl b/fluid/print_panel.fl
index eaaefcf79..47ce530d7 100644
--- a/fluid/print_panel.fl
+++ b/fluid/print_panel.fl
@@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
+snap {
+ ver 1
+ current_suite FLTK
+ current_preset 1
+}
comment {//
// FLUID print panel for the Fast Light Tool Kit (FLTK).
//
@@ -26,7 +31,7 @@ decl {\#include "fluid.h"} {private local
decl {\#include <FL/fl_string_functions.h>} {private local
}
-decl {\#include "../src/flstring.h"} {selected private local
+decl {\#include "../src/flstring.h"} {private local
}
decl {\#include <stdlib.h>} {private local
@@ -38,7 +43,7 @@ decl {\#include <stdio.h>} {private local
Function {make_print_panel()} {open
} {
Fl_Window print_panel {
- label Print
+ label Print selected
xywh {465 222 465 235} type Double modal visible
} {
Fl_Group print_panel_controls {open
diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl
index 5cd543e77..4ccc9db42 100644
--- a/fluid/template_panel.fl
+++ b/fluid/template_panel.fl
@@ -4,7 +4,7 @@ header_name {.h}
code_name {.cxx}
snap {
ver 1
- current_suite {My Test}
+ current_suite FLTK
current_preset 1
}
comment {//
diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl
index cef84425e..1af617206 100644
--- a/fluid/widget_panel.fl
+++ b/fluid/widget_panel.fl
@@ -4,7 +4,7 @@ header_name {.h}
code_name {.cxx}
snap {
ver 1
- current_suite {My Test}
+ current_suite FLTK
current_preset 1
}
comment {//