FLUID: fix window visibility across project file update

This commit is contained in:
Matthias Melcher 2023-07-17 12:56:23 +02:00
parent 4dffa31520
commit 4d94a08bd2
11 changed files with 51 additions and 26 deletions

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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")) {

View File

@ -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);}
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@ header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite {My Test}
current_suite FLTK
current_preset 1
}
comment {//

View File

@ -4,7 +4,7 @@ header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite {My Test}
current_suite FLTK
current_preset 1
}
comment {//