summaryrefslogtreecommitdiff
path: root/fluid/file.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-12-27 20:56:02 -0500
committerMatthias Melcher <github@matthiasm.com>2024-12-27 20:56:10 -0500
commit050cbabdfe2fdbd1337736f017456012e2437b2d (patch)
tree21efed95ef5368e67a7a6377ab0a3a2f936e4426 /fluid/file.cxx
parent2100655a1b55d1c77932b649b758f2eab1107fcb (diff)
Fluid: Rename Stratgy constants to comply with CMP.
Capitalized constants. Added flag to indicate creation by user or file. Removed global variable 'reading_file'.
Diffstat (limited to 'fluid/file.cxx')
-rw-r--r--fluid/file.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/fluid/file.cxx b/fluid/file.cxx
index cdbf10d62..9f5b78c39 100644
--- a/fluid/file.cxx
+++ b/fluid/file.cxx
@@ -63,6 +63,7 @@ int fdesign_flip = 0;
*/
int read_file(const char *filename, int merge, Strategy strategy) {
Fd_Project_Reader f;
+ strategy.source(Strategy::FROM_FILE);
return f.read_project(filename, merge, strategy);
}
@@ -260,7 +261,7 @@ Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strate
// back compatibility with Vincent Penne's original class code:
if (!p && !strcmp(c,"define_in_struct")) {
- Fl_Type *t = add_new_widget_from_file("class", kAddAsLastChild);
+ Fl_Type *t = add_new_widget_from_file("class", Strategy::FROM_FILE_AS_LAST_CHILD);
t->name(read_word());
Fl_Type::current = p = t;
merge = 1; // stops "missing }" error
@@ -390,7 +391,7 @@ Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strate
read_error("Missing child list for %s\n",t->title());
goto REUSE_C;
}
- read_children(t, 0, kAddAsLastChild, skip_options);
+ read_children(t, 0, Strategy::FROM_FILE_AS_LAST_CHILD, skip_options);
t->postprocess_read();
// FIXME: this has no business in the file reader!
// TODO: this is called whenever something is pasted from the top level into a grid
@@ -406,10 +407,10 @@ Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strate
t->layout_widget();
}
- if (strategy == kAddAsFirstChild) {
- strategy = kAddAfterCurrent;
+ if (strategy.placement() == Strategy::AS_FIRST_CHILD) {
+ strategy.placement(Strategy::AFTER_CURRENT);
}
- if (strategy == kAddAfterCurrent) {
+ if (strategy.placement() == Strategy::AFTER_CURRENT) {
Fl_Type::current = t;
} else {
Fl_Type::current = p;
@@ -733,7 +734,7 @@ void Fd_Project_Reader::read_fdesign() {
Fl_Widget_Type *group = 0;
Fl_Widget_Type *widget = 0;
if (!Fl_Type::current) {
- Fl_Type *t = add_new_widget_from_file("Function", kAddAsLastChild);
+ Fl_Type *t = add_new_widget_from_file("Function", Strategy::FROM_FILE_AS_LAST_CHILD);
t->name("create_the_forms()");
Fl_Type::current = t;
}
@@ -744,7 +745,7 @@ void Fd_Project_Reader::read_fdesign() {
if (!strcmp(name,"Name")) {
- window = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Window", kAddAsLastChild);
+ window = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Window", Strategy::FROM_FILE_AS_LAST_CHILD);
window->name(value);
window->label(value);
Fl_Type::current = widget = window;
@@ -752,7 +753,7 @@ void Fd_Project_Reader::read_fdesign() {
} else if (!strcmp(name,"class")) {
if (!strcmp(value,"FL_BEGIN_GROUP")) {
- group = widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Group", kAddAsLastChild);
+ group = widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Group", Strategy::FROM_FILE_AS_LAST_CHILD);
Fl_Type::current = group;
} else if (!strcmp(value,"FL_END_GROUP")) {
if (group) {
@@ -767,10 +768,10 @@ void Fd_Project_Reader::read_fdesign() {
for (int i = 0; class_matcher[i]; i += 2)
if (!strcmp(value,class_matcher[i])) {
value = class_matcher[i+1]; break;}
- widget = (Fl_Widget_Type*)add_new_widget_from_file(value, kAddAsLastChild);
+ widget = (Fl_Widget_Type*)add_new_widget_from_file(value, Strategy::FROM_FILE_AS_LAST_CHILD);
if (!widget) {
printf("class %s not found, using Fl_Button\n", value);
- widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Button", kAddAsLastChild);
+ widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Button", Strategy::FROM_FILE_AS_LAST_CHILD);
}
}