summaryrefslogtreecommitdiff
path: root/fluid/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/nodes')
-rw-r--r--fluid/nodes/Button_Node.cxx8
-rw-r--r--fluid/nodes/Function_Node.cxx30
-rw-r--r--fluid/nodes/Function_Node.h2
-rw-r--r--fluid/nodes/Grid_Node.cxx20
-rw-r--r--fluid/nodes/Group_Node.cxx42
-rw-r--r--fluid/nodes/Group_Node.h14
-rw-r--r--fluid/nodes/Menu_Node.cxx110
-rw-r--r--fluid/nodes/Menu_Node.h10
-rw-r--r--fluid/nodes/Node.cxx134
-rw-r--r--fluid/nodes/Node.h6
-rw-r--r--fluid/nodes/Tree.cxx8
-rw-r--r--fluid/nodes/Tree.h18
-rw-r--r--fluid/nodes/Widget_Node.cxx617
-rw-r--r--fluid/nodes/Widget_Node.h68
-rw-r--r--fluid/nodes/Window_Node.cxx54
-rw-r--r--fluid/nodes/Window_Node.h8
-rw-r--r--fluid/nodes/factory.cxx234
17 files changed, 715 insertions, 668 deletions
diff --git a/fluid/nodes/Button_Node.cxx b/fluid/nodes/Button_Node.cxx
index c1ac26e95..d989c527c 100644
--- a/fluid/nodes/Button_Node.cxx
+++ b/fluid/nodes/Button_Node.cxx
@@ -46,10 +46,10 @@
Button_Node Button_Node::prototype;
static Fl_Menu_Item buttontype_menu[] = {
- {"Normal", 0, nullptr, (void*)nullptr},
- {"Toggle", 0, nullptr, (void*)FL_TOGGLE_BUTTON},
- {"Radio", 0, nullptr, (void*)FL_RADIO_BUTTON},
- {nullptr}
+ {"Normal", 0, 0, (void*)0},
+ {"Toggle", 0, 0, (void*)FL_TOGGLE_BUTTON},
+ {"Radio", 0, 0, (void*)FL_RADIO_BUTTON},
+ {0}
};
Fl_Menu_Item *Button_Node::subtypes() {
diff --git a/fluid/nodes/Function_Node.cxx b/fluid/nodes/Function_Node.cxx
index 02f4d75ca..27e8c83de 100644
--- a/fluid/nodes/Function_Node.cxx
+++ b/fluid/nodes/Function_Node.cxx
@@ -42,14 +42,14 @@ using namespace fld::io;
using namespace fld::proj;
/// Set a current class, so that the code of the children is generated correctly.
-Class_Node *current_class = nullptr;
+Class_Node *current_class = 0;
/**
\brief Return 1 if the list contains a function with the given signature at the top level.
Widget_Node uses this to check if a callback by a certain signature is
already defined by the user within this file. If not, Widget_Node will
generate an `extern $sig$;` statement.
- \param[in] rtype return type, can be nullptr to avoid checking (not used by Widget_Node)
+ \param[in] rtype return type, can be 0 to avoid checking (not used by Widget_Node)
\param[in] sig function signature
\return 1 if found.
*/
@@ -76,7 +76,7 @@ static char buffer[128]; // for error messages
This is used to find a matching " or ' in a string.
\param[inout] c start searching here, return where we found \c type
\param[in] type find this character
- \return nullptr if the character was found, else a pointer to a static string
+ \return 0 if the character was found, else a pointer to a static string
with an error message
*/
const char *_q_check(const char * & c, int type) {
@@ -88,7 +88,7 @@ const char *_q_check(const char * & c, int type) {
if (*c) c++;
break;
default:
- if (*(c-1) == type) return nullptr;
+ if (*(c-1) == type) return 0;
}
}
@@ -98,14 +98,14 @@ const char *_q_check(const char * & c, int type) {
{, [, ", ', and ( are matched.
\param[inout] c start searching here, return the end of the search
\param[in] type find this character match
- \return nullptr if the character was found, else a pointer to a static string
+ \return 0 if the character was found, else a pointer to a static string
with an error message
*/
const char *_c_check(const char * & c, int type) {
const char *d;
for (;;) switch (*c++) {
case 0:
- if (!type) return nullptr;
+ if (!type) return 0;
sprintf(buffer, "missing '%c'", type);
return buffer;
case '/':
@@ -153,7 +153,7 @@ const char *_c_check(const char * & c, int type) {
case ')':
case ']':
// UNEXPECTED:
- if (type == *(c-1)) return nullptr;
+ if (type == *(c-1)) return 0;
sprintf(buffer, "unexpected '%c'", *(c-1));
return buffer;
}
@@ -164,7 +164,7 @@ const char *_c_check(const char * & c, int type) {
Make sure that {, ", ', and ( are matched.
\param[in] c start searching here
\param[in] type find this character match (default is 0)
- \return nullptr if the character was found, else a pointer to a static string
+ \return 0 if the character was found, else a pointer to a static string
with an error message
\note This function checks every conceivable line of code, which is not
always wanted. It can't differentiate characters in comments, and the
@@ -436,7 +436,7 @@ void Function_Node::write_code1(fld::io::Code_Writer& f) {
}
if (havewidgets && child && !child->name())
- f.write_c("%s%s* w;\n", f.indent(1), subclassname(child).c_str());
+ f.write_c("%s%s* w;\n", f.indent(1), subclassname(child));
f.indentation++;
}
@@ -478,7 +478,7 @@ int Function_Node::has_signature(const char *rtype, const char *sig) const {
return 0;
if (!name())
return 0;
- if ( (rtype==nullptr || (return_type() == rtype)) && fl_filename_match(name(), sig)) {
+ if ( (rtype==0 || (return_type() == rtype)) && fl_filename_match(name(), sig)) {
return 1;
}
return 0;
@@ -515,7 +515,7 @@ Node *Code_Node::make(Strategy strategy) {
}
if (!p) {
fl_message("Please select a function");
- return nullptr;
+ return 0;
}
Code_Node *o = new Code_Node();
o->name("printf(\"Hello, World!\\n\");");
@@ -591,7 +591,7 @@ int Code_Node::reap_editor() {
current contents of editor file..
*/
int Code_Node::handle_editor_changes() {
- const char *newcode = nullptr;
+ const char *newcode = 0;
switch ( editor_.handle_changes(&newcode) ) {
case 1: { // (1)=changed
name(newcode); // update value in ram
@@ -636,7 +636,7 @@ Node *CodeBlock_Node::make(Strategy strategy) {
}
if (!p) {
fl_message("Please select a function");
- return nullptr;
+ return 0;
}
CodeBlock_Node *o = new CodeBlock_Node();
o->name("if (test())");
@@ -950,11 +950,11 @@ void Data_Node::open() {
Write the content of the external file inline into the source code.
*/
void Data_Node::write_code1(fld::io::Code_Writer& f) {
- const char *message = nullptr;
+ const char *message = 0;
const char *c = name();
if (!c) return;
std::string fn = filename();
- char *data = nullptr;
+ char *data = 0;
int nData = -1;
int uncompressedDataSize = 0;
// path should be set correctly already
diff --git a/fluid/nodes/Function_Node.h b/fluid/nodes/Function_Node.h
index e92f36f80..0ad4494f3 100644
--- a/fluid/nodes/Function_Node.h
+++ b/fluid/nodes/Function_Node.h
@@ -65,7 +65,7 @@ public:
void write_code1(fld::io::Code_Writer& f) override;
void write_code2(fld::io::Code_Writer& f) override;
void open() override;
- int ismain() {return name_ == nullptr;}
+ int ismain() {return name_ == 0;}
const char *type_name() override {return "Function";}
const char *title() override { return name() ? name() : "main()"; }
int can_have_children() const override {return 1;}
diff --git a/fluid/nodes/Grid_Node.cxx b/fluid/nodes/Grid_Node.cxx
index 2304a7a10..d38bbd1ca 100644
--- a/fluid/nodes/Grid_Node.cxx
+++ b/fluid/nodes/Grid_Node.cxx
@@ -51,7 +51,7 @@
*/
Fl_Grid_Proxy::Fl_Grid_Proxy(int X,int Y,int W,int H)
: Fl_Grid(X,Y,W,H),
- transient_(nullptr),
+ transient_(0),
num_transient_(0),
cap_transient_(0)
{
@@ -137,19 +137,19 @@ void Fl_Grid_Proxy::move_cell(Fl_Widget *in_child, int to_row, int to_col, int h
}
if ((to_row < 0) || (to_row+rowspan > rows())) return;
if ((to_col < 0) || (to_col+colspan > cols())) return;
- Fl_Grid::Cell *new_cell = nullptr;
+ Fl_Grid::Cell *new_cell = 0;
if (how == 0) { // replace old occupant in cell, making that one homeless
new_cell = widget(in_child, to_row, to_col, rowspan, colspan, align);
} else if (how == 1) { // don't replace an old occupant, making ourselves homeless
// todo: colspan, rowspan?
- if (cell(to_row, to_col) == nullptr) {
+ if (cell(to_row, to_col) == 0) {
new_cell = widget(in_child, to_row, to_col, rowspan, colspan, align);
} else {
if (old_cell) remove_cell(old_cell->row(), old_cell->col());
}
} else if (how == 2) {
Cell *current = cell(to_row, to_col);
- if (current == nullptr) {
+ if (current == 0) {
new_cell = widget(in_child, to_row, to_col, rowspan, colspan, align);
} else {
if (old_cell) remove_cell(old_cell->row(), old_cell->col());
@@ -240,7 +240,7 @@ void Fl_Grid_Proxy::transient_remove_(Fl_Widget *w) {
/**
Find a cell in the grid or in the transient cell list.
\param[in] widget must be a child of the grid.
- \return the cell, the transient cell, or nullptr if neither was found.
+ \return the cell, the transient cell, or 0 if neither was found.
*/
Fl_Grid_Proxy::Cell *Fl_Grid_Proxy::any_cell(Fl_Widget *widget) const {
Cell *c = cell(widget);
@@ -251,14 +251,14 @@ Fl_Grid_Proxy::Cell *Fl_Grid_Proxy::any_cell(Fl_Widget *widget) const {
/**
Find a cell in the transient cell list.
\param[in] widget must be a child of the grid.
- \return the transient cell, or nullptr if it was not found.
+ \return the transient cell, or 0 if it was not found.
*/
Fl_Grid_Proxy::Cell *Fl_Grid_Proxy::transient_cell(Fl_Widget *widget) const {
for (int i=0; i<num_transient_; i++) {
if (transient_[i].widget == widget)
return transient_[i].cell;
}
- return nullptr;
+ return 0;
}
/**
@@ -292,7 +292,7 @@ Grid_Node::Grid_Node() {
Fl_Widget *Grid_Node::widget(int X,int Y,int W,int H) {
Fl_Grid *g = new Fl_Grid_Proxy(X,Y,W,H);
g->layout(3, 3);
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
return g;
}
@@ -678,7 +678,7 @@ void Grid_Node::child_resized(Widget_Node *child_type) {
Fl_Grid *Grid_Node::selected() {
if (current_widget && current_widget->is_a(FLD_NODE_TYPE_Grid))
return ((Fl_Grid*)((Grid_Node*)current_widget)->o);
- return nullptr;
+ return 0;
}
/**
@@ -689,7 +689,7 @@ Fl_Grid *Grid_Node::selected() {
void Grid_Node::insert_child_at(Fl_Widget *child, int x, int y) {
Fl_Grid_Proxy *grid = (Fl_Grid_Proxy*)o;
int row = -1, col = -1, ml, mt, grg, gcg;
- grid->margin(&ml, &mt, nullptr, nullptr);
+ grid->margin(&ml, &mt, 0, 0);
grid->gap(&grg, &gcg);
int x0 = grid->x() + Fl::box_dx(grid->box()) + ml;
int y0 = grid->y() + Fl::box_dy(grid->box()) + mt;
diff --git a/fluid/nodes/Group_Node.cxx b/fluid/nodes/Group_Node.cxx
index 088e999aa..eb735cbeb 100644
--- a/fluid/nodes/Group_Node.cxx
+++ b/fluid/nodes/Group_Node.cxx
@@ -215,7 +215,7 @@ void Group_Node::write_code2(fld::io::Code_Writer& f) {
// sure it is visible:
void Group_Node::add_child(Node* cc, Node* before) {
Widget_Node* c = (Widget_Node*)cc;
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
((Fl_Group*)o)->insert(*(c->o), b);
o->redraw();
}
@@ -233,7 +233,7 @@ void Group_Node::remove_child(Node* cc) {
// move, don't change selected value:
void Group_Node::move_child(Node* cc, Node* before) {
Widget_Node* c = (Widget_Node*)cc;
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
((Fl_Group*)o)->insert(*(c->o), b);
o->redraw();
}
@@ -261,9 +261,9 @@ Pack_Node Pack_Node::prototype; // the "factory"
const char pack_type_name[] = "Fl_Pack";
Fl_Menu_Item pack_type_menu[] = {
- {"HORIZONTAL", 0, nullptr, (void*)Fl_Pack::HORIZONTAL},
- {"VERTICAL", 0, nullptr, (void*)Fl_Pack::VERTICAL},
- {nullptr}
+ {"HORIZONTAL", 0, 0, (void*)Fl_Pack::HORIZONTAL},
+ {"VERTICAL", 0, 0, (void*)Fl_Pack::VERTICAL},
+ {0}
};
Fl_Widget *Pack_Node::enter_live_mode(int) {
@@ -283,9 +283,9 @@ void Pack_Node::copy_properties()
const char flex_type_name[] = "Fl_Flex";
Fl_Menu_Item flex_type_menu[] = {
- {"HORIZONTAL", 0, nullptr, (void*)Fl_Flex::HORIZONTAL},
- {"VERTICAL", 0, nullptr, (void*)Fl_Flex::VERTICAL},
- {nullptr}};
+ {"HORIZONTAL", 0, 0, (void*)Fl_Flex::HORIZONTAL},
+ {"VERTICAL", 0, 0, (void*)Fl_Flex::VERTICAL},
+ {0}};
Flex_Node Flex_Node::prototype; // the "factory"
@@ -420,7 +420,7 @@ void Flex_Node::postprocess_read()
}
fixedSizeTupleSize = 0;
delete[] fixedSizeTuple;
- fixedSizeTuple = nullptr;
+ fixedSizeTuple = 0;
}
suspend_auto_layout = 0;
}
@@ -655,7 +655,7 @@ class Fl_Table_Proxy : public Fl_Table {
}
}
public:
- Fl_Table_Proxy(int x, int y, int w, int h, const char *l=nullptr)
+ Fl_Table_Proxy(int x, int y, int w, int h, const char *l=0)
: Fl_Table(x, y, w, h, l) {
end();
for ( int r=0; r<MAX_ROWS; r++ )
@@ -681,7 +681,7 @@ Fl_Widget *Table_Node::widget(int X,int Y,int W,int H) {
void Table_Node::add_child(Node* cc, Node* before) {
Widget_Node* c = (Widget_Node*)cc;
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
if (((Fl_Table*)o)->children()==1) { // the FLuid_Table has one extra child
fl_message("Inserting child widgets into an Fl_Table is not recommended.\n"
"Please refer to the documentation on Fl_Table.");
@@ -698,7 +698,7 @@ void Table_Node::remove_child(Node* cc) {
void Table_Node::move_child(Node* cc, Node* before) {
Widget_Node* c = (Widget_Node*)cc;
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
((Fl_Table*)o)->insert(*(c->o), b);
o->redraw();
}
@@ -750,7 +750,7 @@ void Fl_Tabs_Proxy::draw() {
Node* Tabs_Node::click_test(int x, int y) {
Fl_Tabs *t = (Fl_Tabs*)o;
Fl_Widget *a = t->which(x,y);
- if (!a) return nullptr; // didn't click on tab
+ if (!a) return 0; // didn't click on tab
// changing the visible tab has an impact on the generated
// source code, so mark this project as changed.
int changed = (a!=t->value());
@@ -770,7 +770,7 @@ void Tabs_Node::remove_child(Node* cc) {
if (cc->is_widget()) {
Widget_Node* c = (Widget_Node*)cc;
Fl_Tabs *t = (Fl_Tabs*)o;
- if (t->value() == c->o) t->value(nullptr);
+ if (t->value() == c->o) t->value(0);
}
Group_Node::remove_child(cc);
}
@@ -792,13 +792,13 @@ Scroll_Node Scroll_Node::prototype; // the "factory"
const char scroll_type_name[] = "Fl_Scroll";
Fl_Menu_Item scroll_type_menu[] = {
- {"BOTH", 0, nullptr, nullptr/*(void*)Fl_Scroll::BOTH*/},
- {"HORIZONTAL", 0, nullptr, (void*)Fl_Scroll::HORIZONTAL},
- {"VERTICAL", 0, nullptr, (void*)Fl_Scroll::VERTICAL},
- {"HORIZONTAL_ALWAYS", 0, nullptr, (void*)Fl_Scroll::HORIZONTAL_ALWAYS},
- {"VERTICAL_ALWAYS", 0, nullptr, (void*)Fl_Scroll::VERTICAL_ALWAYS},
- {"BOTH_ALWAYS", 0, nullptr, (void*)Fl_Scroll::BOTH_ALWAYS},
- {nullptr}};
+ {"BOTH", 0, 0, 0/*(void*)Fl_Scroll::BOTH*/},
+ {"HORIZONTAL", 0, 0, (void*)Fl_Scroll::HORIZONTAL},
+ {"VERTICAL", 0, 0, (void*)Fl_Scroll::VERTICAL},
+ {"HORIZONTAL_ALWAYS", 0, 0, (void*)Fl_Scroll::HORIZONTAL_ALWAYS},
+ {"VERTICAL_ALWAYS", 0, 0, (void*)Fl_Scroll::VERTICAL_ALWAYS},
+ {"BOTH_ALWAYS", 0, 0, (void*)Fl_Scroll::BOTH_ALWAYS},
+ {0}};
Fl_Widget *Scroll_Node::enter_live_mode(int) {
Fl_Group *grp = new Fl_Scroll(o->x(), o->y(), o->w(), o->h());
diff --git a/fluid/nodes/Group_Node.h b/fluid/nodes/Group_Node.h
index 52f31a907..71df8aa46 100644
--- a/fluid/nodes/Group_Node.h
+++ b/fluid/nodes/Group_Node.h
@@ -39,7 +39,7 @@ void ungroup_cb(Fl_Widget *, void *);
*/
class Fl_Group_Proxy : public Fl_Group {
public:
- Fl_Group_Proxy(int X,int Y,int W,int H) : Fl_Group(X, Y, W, H) { Fl_Group::current(nullptr); }
+ Fl_Group_Proxy(int X,int Y,int W,int H) : Fl_Group(X, Y, W, H) { Fl_Group::current(0); }
void resize(int x, int y, int w, int h) override;
void draw() override;
};
@@ -54,7 +54,7 @@ public:
const char *type_name() override {return "Fl_Group";}
const char *alt_type_name() override {return "fltk::Group";}
Fl_Widget *widget(int X,int Y,int W,int H) override {
- Fl_Group_Proxy *g = new Fl_Group_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
+ Fl_Group_Proxy *g = new Fl_Group_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() override {return new Group_Node();}
void write_code1(fld::io::Code_Writer& f) override;
void write_code2(fld::io::Code_Writer& f) override;
@@ -98,7 +98,7 @@ extern Fl_Menu_Item flex_type_menu[];
class Fl_Flex_Proxy : public Fl_Flex {
public:
- Fl_Flex_Proxy(int X,int Y,int W,int H) : Fl_Flex(X, Y, W, H) { Fl_Group::current(nullptr); }
+ Fl_Flex_Proxy(int X,int Y,int W,int H) : Fl_Flex(X, Y, W, H) { Fl_Group::current(0); }
void resize(int x, int y, int w, int h) override;
void draw() override;
};
@@ -114,12 +114,12 @@ private:
int *fixedSizeTuple; /* [ index, size, index2, size2, ... ] */
int suspend_auto_layout;
public:
- Flex_Node() : fixedSizeTupleSize(0), fixedSizeTuple(nullptr), suspend_auto_layout(0) { }
+ Flex_Node() : fixedSizeTupleSize(0), fixedSizeTuple(0), suspend_auto_layout(0) { }
const char *type_name() override {return flex_type_name;}
const char *alt_type_name() override {return "fltk::FlexGroup";}
Widget_Node *_make() override { return new Flex_Node(); }
Fl_Widget *widget(int X,int Y,int W,int H) override {
- Fl_Flex *g = new Fl_Flex_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
+ Fl_Flex *g = new Fl_Flex_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Type type() const override { return FLD_NODE_TYPE_Flex; }
bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Flex) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
@@ -182,7 +182,7 @@ public:
const char *type_name() override {return tabs_type_name;}
const char *alt_type_name() override {return "fltk::TabGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) override {
- Fl_Tabs_Proxy *g = new Fl_Tabs_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
+ Fl_Tabs_Proxy *g = new Fl_Tabs_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() override {return new Tabs_Node();}
Node* click_test(int,int) override;
void add_child(Node*, Node*) override;
@@ -254,7 +254,7 @@ public:
const char *type_name() override {return wizard_type_name;}
const char *alt_type_name() override {return "fltk::WizardGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) override {
- Fl_Wizard_Proxy *g = new Fl_Wizard_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
+ Fl_Wizard_Proxy *g = new Fl_Wizard_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() override {return new Wizard_Node();}
Type type() const override { return FLD_NODE_TYPE_Wizard; }
bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Wizard) ? true : super::is_a(inType); }
diff --git a/fluid/nodes/Menu_Node.cxx b/fluid/nodes/Menu_Node.cxx
index e0f1c11ee..b669c18e0 100644
--- a/fluid/nodes/Menu_Node.cxx
+++ b/fluid/nodes/Menu_Node.cxx
@@ -48,17 +48,17 @@ using namespace fld;
using namespace fld::proj;
Fl_Menu_Item menu_item_type_menu[] = {
- {"Normal",0,nullptr,(void*)nullptr},
- {"Toggle",0,nullptr,(void*)FL_MENU_BOX},
- {"Radio",0,nullptr,(void*)FL_MENU_RADIO},
- {nullptr}};
+ {"Normal",0,0,(void*)0},
+ {"Toggle",0,0,(void*)FL_MENU_BOX},
+ {"Radio",0,0,(void*)FL_MENU_RADIO},
+ {0}};
static void delete_dependents(Fl_Menu_Item *m) {
if (!m)
return;
int level = 0;
for (;;m++) {
- if (m->label()==nullptr) {
+ if (m->label()==0) {
if (level==0) {
break;
} else {
@@ -90,7 +90,7 @@ void Input_Choice_Node::build_menu() {
}
if (!n) {
if (menusize) delete_menu((Fl_Menu_Item*)(w->menu()));
- w->menu(nullptr);
+ w->menu(0);
menusize = 0;
} else {
n++; // space for null at end of menu
@@ -102,7 +102,7 @@ void Input_Choice_Node::build_menu() {
if (menusize) delete_dependents((Fl_Menu_Item*)(w->menu()));
}
// Menus are already built during the .fl file reading process, so if the
- // end of a menu list is not read yet, the end markers (label==nullptr) will
+ // end of a menu list is not read yet, the end markers (label==0) will
// not be set, and deleting dependents will randomly free memory.
// Clearing the array should avoid that.
memset( (void*)w->menu(), 0, menusize * sizeof(Fl_Menu_Item) );
@@ -127,7 +127,7 @@ void Input_Choice_Node::build_menu() {
m->labeltype(i->o->labeltype());
}
m->shortcut(((Fl_Button*)(i->o))->shortcut());
- m->callback(nullptr,(void*)i);
+ m->callback(0,(void*)i);
m->flags = i->flags() & ~FL_MENU_HEADLINE;
m->labelfont(i->o->labelfont());
m->labelsize(i->o->labelsize());
@@ -136,7 +136,7 @@ void Input_Choice_Node::build_menu() {
m++;
int l1 =
(q->next && q->next->is_a(FLD_NODE_TYPE_Menu_Item)) ? q->next->level : level;
- while (lvl > l1) {m->label(nullptr); m++; lvl--;}
+ while (lvl > l1) {m->label(0); m++; lvl--;}
lvl = l1;
}
}
@@ -170,13 +170,13 @@ Node* Menu_Item_Node::make(int flags, Strategy strategy) {
}
if (!p) {
fl_message("Please select a menu widget or a menu item");
- return nullptr;
+ return 0;
}
if (!o) {
o = new Fl_Button(0,0,100,20); // create template widget
}
- Menu_Item_Node* t = nullptr;
+ Menu_Item_Node* t = 0;
if (flags==FL_SUBMENU) {
t = new Submenu_Node();
} else {
@@ -326,8 +326,8 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
f.write_h_once("extern void %s(Fl_Menu_*, %s);", callback(),
user_data_type() ? user_data_type() : "void*");
for (int n=0; n < NUM_EXTRA_CODE; n++) {
- if (!extra_code(n).empty() && isdeclare(extra_code(n).c_str()))
- f.write_h_once("%s", extra_code(n).c_str());
+ if (extra_code(n) && extra_code(n)[0] && isdeclare(extra_code(n)))
+ f.write_h_once("%s", extra_code(n));
}
if (callback() && !is_name(callback()) && (callback()[0] != '[')) {
// see if 'o' or 'v' used, to prevent unused argument warnings:
@@ -376,8 +376,8 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
// Find the Fl_Menu_ container for this menu item
Node* t = parent; while (t->is_a(FLD_NODE_TYPE_Menu_Item)) t = t->parent;
if (t) {
- Widget_Node *tw = (t->is_widget()) ? static_cast<Widget_Node*>(t) : nullptr;
- Node *q = nullptr;
+ Widget_Node *tw = (t->is_widget()) ? static_cast<Widget_Node*>(t) : 0;
+ Node *q = 0;
// Generate code to call the callback
if (tw->is_a(FLD_NODE_TYPE_Menu_Bar) && ((Menu_Bar_Node*)tw)->is_sys_menu_bar()) {
// Fl_Sys_Menu_Bar removes itself from any parent on macOS, so we
@@ -463,7 +463,7 @@ int Menu_Item_Node::flags() {
if (!o->active()) i |= FL_MENU_INACTIVE;
if (!o->visible()) i |= FL_MENU_INVISIBLE;
if (can_have_children()) {
- if (user_data() == nullptr) i |= FL_SUBMENU;
+ if (user_data() == 0) i |= FL_SUBMENU;
else i |= FL_SUBMENU_POINTER;
}
if (hotspot()) i |= FL_MENU_DIVIDER;
@@ -528,7 +528,7 @@ void Menu_Item_Node::write_item(fld::io::Code_Writer& f) {
f.tag(FLD_MERGEBACK_TAG_WIDGET_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("%s, ", f.indent_plus(1));
} else {
- const char* k = is_name(callback()) ? nullptr : class_name(1);
+ const char* k = is_name(callback()) ? 0 : class_name(1);
if (k) {
f.write_c(" (Fl_Callback*)%s::%s,", k, callback_name(f));
} else {
@@ -638,9 +638,9 @@ void Menu_Item_Node::write_code1(fld::io::Code_Writer& f) {
}
}
for (int n=0; n < NUM_EXTRA_CODE; n++) {
- if (!extra_code(n).empty() && !isdeclare(extra_code(n).c_str())) {
+ if (extra_code(n) && extra_code(n)[0] && !isdeclare(extra_code(n))) {
start_menu_initialiser(f, menuItemInitialized, mname, i);
- f.write_c("%s%s\n", f.indent(), extra_code(n).c_str());
+ f.write_c("%s%s\n", f.indent(), extra_code(n));
}
}
if (menuItemInitialized) {
@@ -669,7 +669,7 @@ void Menu_Base_Node::build_menu() {
}
if (!n) {
if (menusize) delete_menu((Fl_Menu_Item*)(w->menu()));
- w->menu(nullptr);
+ w->menu(0);
menusize = 0;
} else {
n++; // space for null at end of menu
@@ -681,7 +681,7 @@ void Menu_Base_Node::build_menu() {
if (menusize) delete_dependents((Fl_Menu_Item*)(w->menu()));
}
// Menus are already built during the .fl file reading process, so if the
- // end of a menu list is not read yet, the end markers (label==nullptr) will
+ // end of a menu list is not read yet, the end markers (label==0) will
// not be set, and deleting dependents will randomly free memory.
// Clearing the array should avoid that.
memset( (void*)w->menu(), 0, menusize * sizeof(Fl_Menu_Item) );
@@ -706,7 +706,7 @@ void Menu_Base_Node::build_menu() {
m->labeltype(i->o->labeltype());
}
m->shortcut(((Fl_Button*)(i->o))->shortcut());
- m->callback(nullptr,(void*)i);
+ m->callback(0,(void*)i);
m->flags = (i->flags() | i->o->type()) & ~FL_MENU_HEADLINE;
m->labelfont(i->o->labelfont());
m->labelsize(i->o->labelsize());
@@ -715,7 +715,7 @@ void Menu_Base_Node::build_menu() {
m++;
int l1 =
(q->next && q->next->is_a(FLD_NODE_TYPE_Menu_Item)) ? q->next->level : level;
- while (lvl > l1) {m->label(nullptr); m++; lvl--;}
+ while (lvl > l1) {m->label(0); m++; lvl--;}
lvl = l1;
}
}
@@ -723,14 +723,14 @@ void Menu_Base_Node::build_menu() {
}
Node* Menu_Base_Node::click_test(int, int) {
- if (selected) return nullptr; // let user move the widget
+ if (selected) return 0; // let user move the widget
Fl_Menu_* w = (Fl_Menu_*)o;
- if (!menusize) return nullptr;
+ if (!menusize) return 0;
const Fl_Menu_Item* save = w->mvalue();
- w->value((Fl_Menu_Item*)nullptr);
+ w->value((Fl_Menu_Item*)0);
Fl::pushed(w);
w->handle(FL_PUSH);
- Fl::focus(nullptr);
+ Fl::focus(0);
const Fl_Menu_Item* m = w->mvalue();
if (m) {
// restore the settings of toggles & radio items:
@@ -762,21 +762,21 @@ void Menu_Base_Node::copy_properties() {
////////////////////////////////////////////////////////////////
Fl_Menu_Item button_type_menu[] = {
- {"normal",0,nullptr,(void*)nullptr},
- {"popup1",0,nullptr,(void*)Fl_Menu_Button::POPUP1},
- {"popup2",0,nullptr,(void*)Fl_Menu_Button::POPUP2},
- {"popup3",0,nullptr,(void*)Fl_Menu_Button::POPUP3},
- {"popup12",0,nullptr,(void*)Fl_Menu_Button::POPUP12},
- {"popup23",0,nullptr,(void*)Fl_Menu_Button::POPUP23},
- {"popup13",0,nullptr,(void*)Fl_Menu_Button::POPUP13},
- {"popup123",0,nullptr,(void*)Fl_Menu_Button::POPUP123},
- {nullptr}};
+ {"normal",0,0,(void*)0},
+ {"popup1",0,0,(void*)Fl_Menu_Button::POPUP1},
+ {"popup2",0,0,(void*)Fl_Menu_Button::POPUP2},
+ {"popup3",0,0,(void*)Fl_Menu_Button::POPUP3},
+ {"popup12",0,0,(void*)Fl_Menu_Button::POPUP12},
+ {"popup23",0,0,(void*)Fl_Menu_Button::POPUP23},
+ {"popup13",0,0,(void*)Fl_Menu_Button::POPUP13},
+ {"popup123",0,0,(void*)Fl_Menu_Button::POPUP123},
+ {0}};
Menu_Button_Node Menu_Button_Node::prototype;
////////////////////////////////////////////////////////////////
-Fl_Menu_Item dummymenu[] = {{"CHOICE"},{nullptr}};
+Fl_Menu_Item dummymenu[] = {{"CHOICE"},{0}};
Choice_Node Choice_Node::prototype;
@@ -793,14 +793,14 @@ void Input_Choice_Node::copy_properties() {
}
Node* Input_Choice_Node::click_test(int, int) {
- if (selected) return nullptr; // let user move the widget
+ if (selected) return 0; // let user move the widget
Fl_Menu_* w = ((Fl_Input_Choice*)o)->menubutton();
- if (!menusize) return nullptr;
+ if (!menusize) return 0;
const Fl_Menu_Item* save = w->mvalue();
- w->value((Fl_Menu_Item*)nullptr);
+ w->value((Fl_Menu_Item*)0);
Fl::pushed(w);
w->handle(FL_PUSH);
- Fl::focus(nullptr);
+ Fl::focus(0);
const Fl_Menu_Item* m = w->mvalue();
if (m) {
// restore the settings of toggles & radio items:
@@ -816,12 +816,12 @@ Node* Input_Choice_Node::click_test(int, int) {
Menu_Bar_Node Menu_Bar_Node::prototype;
Fl_Menu_Item menu_bar_type_menu[] = {
- {"Fl_Menu_Bar",0,nullptr,(void*)nullptr},
- {"Fl_Sys_Menu_Bar",0,nullptr,(void*)1},
- {nullptr}};
+ {"Fl_Menu_Bar",0,0,(void*)0},
+ {"Fl_Sys_Menu_Bar",0,0,(void*)1},
+ {0}};
Menu_Bar_Node::Menu_Bar_Node()
-: _proxy_name(nullptr)
+: _proxy_name(0)
{
}
@@ -835,14 +835,16 @@ Menu_Bar_Node::~Menu_Bar_Node() {
This test fails if subclass() is the name of a class that the user may have
derived from Fl_Sys_Menu_Bar.
*/
-bool Menu_Bar_Node::is_sys_menu_bar() {
- if (o->type()==1) return true;
- return (subclass() == "Fl_Sys_Menu_Bar");
+int Menu_Bar_Node::is_sys_menu_bar() {
+ if (o->type()==1) return 1;
+ const char* sc = subclass();
+ return (sc && strcmp(sc, "Fl_Sys_Menu_Bar") == 0);
}
-std::string Menu_Bar_Node::sys_menubar_name() const {
- if (!subclass().empty())
- return subclass();
+const char* Menu_Bar_Node::sys_menubar_name() const {
+ const char* sc = subclass();
+ if (sc && sc[0])
+ return sc;
else
return "Fl_Sys_Menu_Bar";
}
@@ -850,7 +852,7 @@ std::string Menu_Bar_Node::sys_menubar_name() const {
const char *Menu_Bar_Node::sys_menubar_proxy_name() {
if (!_proxy_name)
_proxy_name = (char*)::malloc(128);
- ::snprintf(_proxy_name, 63, "%s_Proxy", sys_menubar_name().c_str());
+ ::snprintf(_proxy_name, 63, "%s_Proxy", sys_menubar_name());
return _proxy_name;
}
@@ -868,8 +870,8 @@ void Menu_Bar_Node::write_static(fld::io::Code_Writer& f) {
" : %s(x, y, w, h, l) { }\n"
" void *_parent_class;\n"
"};\n",
- sys_menubar_proxy_name(), sys_menubar_name().c_str(),
- sys_menubar_proxy_name(), sys_menubar_name().c_str()
+ sys_menubar_proxy_name(), sys_menubar_name(),
+ sys_menubar_proxy_name(), sys_menubar_name()
);
}
}
diff --git a/fluid/nodes/Menu_Node.h b/fluid/nodes/Menu_Node.h
index 4bf27ed34..42484ed43 100644
--- a/fluid/nodes/Menu_Node.h
+++ b/fluid/nodes/Menu_Node.h
@@ -58,8 +58,8 @@ public:
Node* make(Strategy strategy) override;
Node* make(int flags, Strategy strategy);
int is_button() const override {return 1;} // this gets shortcut to work
- Fl_Widget* widget(int,int,int,int) override {return nullptr;}
- Widget_Node* _make() override {return nullptr;}
+ Fl_Widget* widget(int,int,int,int) override {return 0;}
+ Widget_Node* _make() override {return 0;}
virtual const char* menu_name(fld::io::Code_Writer& f, int& i);
int flags();
void write_static(fld::io::Code_Writer& f) override;
@@ -114,7 +114,7 @@ public:
typedef Menu_Item_Node super;
static Submenu_Node prototype;
public:
- Fl_Menu_Item* subtypes() override {return nullptr;}
+ Fl_Menu_Item* subtypes() override {return 0;}
const char* type_name() override {return "Submenu";}
const char* alt_type_name() override {return "fltk::ItemGroup";}
int can_have_children() const override {return 1;}
@@ -299,8 +299,8 @@ public:
// void write_code2(fld::io::Code_Writer& f) override;
Type type() const override { return FLD_NODE_TYPE_Menu_Bar; }
bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_Bar) ? true : super::is_a(inType); }
- bool is_sys_menu_bar();
- std::string sys_menubar_name() const;
+ int is_sys_menu_bar();
+ const char* sys_menubar_name() const;
const char *sys_menubar_proxy_name();
protected:
char *_proxy_name;
diff --git a/fluid/nodes/Node.cxx b/fluid/nodes/Node.cxx
index be54ce3a1..2971bad2d 100644
--- a/fluid/nodes/Node.cxx
+++ b/fluid/nodes/Node.cxx
@@ -151,16 +151,16 @@ void print_project_tree() {
*/
bool validate_project_tree() {
// Validate `first` and `last`
- if (Fluid.proj.tree.first == nullptr) {
- if (Fluid.proj.tree.last == nullptr) {
+ if (Fluid.proj.tree.first == 0) {
+ if (Fluid.proj.tree.last == 0) {
return true;
} else {
- fprintf(stderr, "ERROR: `first` is nullptr, but `last` is not!\n");
+ fprintf(stderr, "ERROR: `first` is 0, but `last` is not!\n");
return false;
}
}
- if (Fluid.proj.tree.last == nullptr) {
- fprintf(stderr, "ERROR: `last` is nullptr, but `first` is not!\n");
+ if (Fluid.proj.tree.last == 0) {
+ fprintf(stderr, "ERROR: `last` is 0, but `first` is not!\n");
return false;
}
// Validate the branch linkage, parent links, etc.
@@ -242,9 +242,9 @@ bool validate_branch(class Node *root) {
}
// Validate the `parent` entry
for (Node *p = t->prev; ; p = p->prev) {
- if (p == nullptr) {
- if (t->parent != nullptr) {
- fprintf(stderr, "ERROR: `parent` pointer should be nullptr!\n");
+ if (p == 0) {
+ if (t->parent != 0) {
+ fprintf(stderr, "ERROR: `parent` pointer should be 0!\n");
return false;
}
break;
@@ -264,7 +264,7 @@ bool validate_branch(class Node *root) {
#endif
void select_all_cb(Fl_Widget *,void *) {
- Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : nullptr;
+ Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : 0;
if (in_this_only) {
Node *t = p;
for (; t && t != in_this_only; t = t->parent) {/*empty*/}
@@ -288,7 +288,7 @@ void select_all_cb(Fl_Widget *,void *) {
}
void select_none_cb(Fl_Widget *,void *) {
- Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : nullptr;
+ Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : 0;
if (in_this_only) {
Node *t = p;
for (; t && t != in_this_only; t = t->parent) {/*empty*/}
@@ -409,12 +409,12 @@ void delete_all(int selected_only) {
widget_browser->hposition(0);
widget_browser->vposition(0);
}
- Fluid.layout_list.remove_all(FLD_TOOL_STORE_PROJECT);
- Fluid.layout_list.current_suite(0);
- Fluid.layout_list.current_preset(0);
- Fluid.layout_list.update_dialogs();
+ Fluid.layout_list->remove_all(FLD_TOOL_STORE_PROJECT);
+ Fluid.layout_list->current_suite(0);
+ Fluid.layout_list->current_preset(0);
+ Fluid.layout_list->update_dialogs();
}
- selection_changed(nullptr);
+ selection_changed(0);
if (widget_browser) {
if (selected_only)
widget_browser->restore_scroll_position();
@@ -425,7 +425,7 @@ void delete_all(int selected_only) {
/** Update a string.
Replace a string pointer with new value, strips leading/trailing blanks.
As a side effect, this call also sets the mod flags.
- \param[in] n new string, can be nullptr
+ \param[in] n new string, can be 0
\param[out] p update this pointer, possibly reallocate memory
\param[in] nostrip if set, do not strip leading and trailing spaces and tabs
\return 1 if the string in p changed
@@ -439,13 +439,13 @@ int storestring(const char *n, const char * & p, int nostrip) {
const char *e = n + strlen(n);
if (!nostrip) while (e > n && isspace((int)(unsigned char)*(e-1))) e--;
length = int(e-n);
- if (!length) n = nullptr;
+ if (!length) n = 0;
}
if (n == p) return 0;
if (n && p && !strncmp(n,p,length) && !p[length]) return 0;
if (p) free((void *)p);
if (!n || !*n) {
- p = nullptr;
+ p = 0;
} else {
char *q = (char *)malloc(length+1);
strlcpy(q,n,length+1);
@@ -457,7 +457,7 @@ int storestring(const char *n, const char * & p, int nostrip) {
// C++11 version, still using the original to copy all the side effects.
int storestring(const std::string& n, std::string& p, int nostrip) {
- const char *buffer { nullptr };
+ const char *buffer { 0 };
int ret = storestring(n.c_str(), buffer);
if (buffer) {
p = buffer;
@@ -496,12 +496,12 @@ void update_visibility_flag(Node *p) {
*/
/** \var Node *Node::next
Points to the next node in the doubly linked list.
- If this is nullptr, we are at the end of the list.
+ If this is 0, we are at the end of the list.
Used for simulating a tree structure via a doubly linked list.
*/
/** \var Node *Node::prev
Link to the next node in the tree structure.
- If this is nullptr, we are at the beginning of the list.
+ If this is 0, we are at the beginning of the list.
Used for simulating a tree structure via a doubly linked list.
*/
@@ -509,21 +509,21 @@ void update_visibility_flag(Node *p) {
Constructor and base for any node in the widget tree.
*/
Node::Node() :
- name_(nullptr),
- label_(nullptr),
- callback_(nullptr),
- user_data_(nullptr),
- user_data_type_(nullptr),
- comment_(nullptr),
+ name_(0),
+ label_(0),
+ callback_(0),
+ user_data_(0),
+ user_data_type_(0),
+ comment_(0),
uid_(0),
- parent(nullptr),
+ parent(0),
new_selected(0),
selected(0),
folded_(0),
visible(0),
level(0),
- next(nullptr), prev(nullptr),
- factory(nullptr),
+ next(0), prev(0),
+ factory(0),
code_static_start(-1), code_static_end(-1),
code1_start(-1), code1_end(-1),
code2_start(-1), code2_end(-1),
@@ -549,9 +549,9 @@ Node::~Node() {
if (next) next->prev = prev; // else last = prev;
if (Fluid.proj.tree.last == this) Fluid.proj.tree.last = prev;
if (Fluid.proj.tree.first == this) Fluid.proj.tree.first = next;
- if (Fluid.proj.tree.current == this) Fluid.proj.tree.current = nullptr;
- if (current_widget == this) current_widget = nullptr;
- if (current_node == this) current_node = nullptr;
+ if (Fluid.proj.tree.current == this) Fluid.proj.tree.current = 0;
+ if (current_widget == this) current_widget = 0;
+ if (current_node == this) current_node = 0;
if (parent) parent->remove_child(this);
if (name_) free((void*)name_);
if (label_) free((void*)label_);
@@ -561,30 +561,30 @@ Node::~Node() {
if (comment_) free((void*)comment_);
}
-// Return the previous sibling in the tree structure or nullptr.
+// Return the previous sibling in the tree structure or 0.
Node *Node::prev_sibling() {
Node *n;
for (n = prev; n && n->level > level; n = n->prev) ;
if (n && (n->level == level))
return n;
- return nullptr;
+ return 0;
}
-// Return the next sibling in the tree structure or nullptr.
+// Return the next sibling in the tree structure or 0.
Node *Node::next_sibling() {
Node *n;
for (n = next; n && n->level > level; n = n->next) ;
if (n && (n->level == level))
return n;
- return nullptr;
+ return 0;
}
-// Return the first child or nullptr
+// Return the first child or 0
Node *Node::first_child() {
Node *n = next;
if (n->level > level)
return n;
- return nullptr;
+ return 0;
}
// Generate a descriptive text for this item, to put in browser & window titles
@@ -597,28 +597,28 @@ const char* Node::title() {
/**
Return the window that contains this widget.
- \return nullptr if this is not a widget.
+ \return 0 if this is not a widget.
*/
Window_Node *Node::window() {
if (!is_widget())
- return nullptr;
+ return 0;
for (Node *t = this; t; t=t->parent)
if (t->is_a(FLD_NODE_TYPE_Window))
return (Window_Node*)t;
- return nullptr;
+ return 0;
}
/**
Return the group that contains this widget.
- \return nullptr if this is not a widget.
+ \return 0 if this is not a widget.
*/
Group_Node *Node::group() {
if (!is_widget())
- return nullptr;
+ return 0;
for (Node *t = this; t; t=t->parent)
if (t->is_a(FLD_NODE_TYPE_Group))
return (Group_Node*)t;
- return nullptr;
+ return 0;
}
/**
@@ -643,15 +643,15 @@ void Node::add(Node *anchor, Strategy strategy) {
#endif
#endif
- Node *target = nullptr; // insert self before target node, if nullptr, insert last
- Node *target_parent = nullptr; // this will be the new parent for branch
+ Node *target = 0; // insert self before target node, if 0, insert last
+ Node *target_parent = 0; // this will be the new parent for branch
int target_level = 0; // adjust self to this new level
// Find the node after our insertion position
switch (strategy.placement()) {
case Strategy::AS_FIRST_CHILD:
default:
- if (anchor == nullptr) {
+ if (anchor == 0) {
target = Fluid.proj.tree.first;
} else {
target = anchor->next;
@@ -660,7 +660,7 @@ void Node::add(Node *anchor, Strategy strategy) {
}
break;
case Strategy::AS_LAST_CHILD:
- if (anchor == nullptr) {
+ if (anchor == 0) {
/* empty */
} else {
for (target = anchor->next; target && target->level > anchor->level; target = target->next) {/*empty*/}
@@ -669,7 +669,7 @@ void Node::add(Node *anchor, Strategy strategy) {
}
break;
case Strategy::AFTER_CURRENT:
- if (anchor == nullptr) {
+ if (anchor == 0) {
target = Fluid.proj.tree.first;
} else {
for (target = anchor->next; target && target->level > anchor->level; target = target->next) {/*empty*/}
@@ -695,14 +695,14 @@ void Node::add(Node *anchor, Strategy strategy) {
t->parent = target_parent;
}
- // Now link ourselves and our children before 'target', or last, if 'target' is nullptr
+ // Now link ourselves and our children before 'target', or last, if 'target' is 0
if (target) {
prev = target->prev;
target->prev = end;
end->next = target;
} else {
prev = Fluid.proj.tree.last;
- end->next = nullptr;
+ end->next = 0;
Fluid.proj.tree.last = end;
}
if (prev) {
@@ -716,13 +716,13 @@ void Node::add(Node *anchor, Strategy strategy) {
do {
tp->ensure_unique_uid();
tp = tp->next;
- } while (tp!=end && tp!=nullptr);
+ } while (tp!=end && tp!=0);
}
// Give the widgets in our tree a chance to update themselves
for (Node *t = this; t && t!=end->next; t = t->next) {
if (target_parent && (t->level == target_level))
- target_parent->add_child(t, nullptr);
+ target_parent->add_child(t, 0);
update_visibility_flag(t);
}
@@ -769,7 +769,7 @@ void Node::insert(Node *g) {
do {
tp->ensure_unique_uid();
tp = tp->next;
- } while (tp!=end && tp!=nullptr);
+ } while (tp!=end && tp!=0);
}
// tell parent that it has a new child, so it can update itself
if (parent) parent->add_child(this, g);
@@ -783,7 +783,7 @@ int Node::msgnum() {
for (count = 0, p = this; p;) {
if (p->label()) count ++;
- if (p != this && p->is_widget() && !((Widget_Node *)p)->tooltip().empty()) count ++;
+ if (p != this && p->is_widget() && ((Widget_Node *)p)->tooltip() && ((Widget_Node *)p)->tooltip()[0]) count ++;
if (p->prev) p = p->prev;
else p = p->parent;
@@ -799,7 +799,7 @@ int Node::msgnum() {
the widget_browser, so \c Fluid.proj.tree.first and \c Fluid.proj.tree.last do not apply
to it.
- \return the node that follows this node after the operation; can be nullptr
+ \return the node that follows this node after the operation; can be 0
*/
Node *Node::remove() {
// find the last child of this node
@@ -820,13 +820,13 @@ Node *Node::remove() {
else
Fluid.proj.tree.last = prev;
Node *r = end->next;
- prev = end->next = nullptr;
+ prev = end->next = 0;
// allow the parent to update changes in the UI
if (parent) parent->remove_child(this);
- parent = nullptr;
+ parent = 0;
// tell the widget_browser that we removed some nodes
widget_browser->redraw();
- selection_changed(nullptr);
+ selection_changed(0);
return r;
}
@@ -1130,7 +1130,7 @@ void Node::write_comment_inline_c(fld::io::Code_Writer& f, const char *pre)
{
if (comment() && *comment()) {
const char *s = comment();
- if (strchr(s, '\n')==nullptr) {
+ if (strchr(s, '\n')==0) {
// single line comment
if (pre) f.write_c("%s", pre);
f.write_c("// %s\n", s);
@@ -1173,7 +1173,7 @@ void Node::write_comment_inline_c(fld::io::Code_Writer& f, const char *pre)
\see leave_live_mode()
*/
Fl_Widget *Node::enter_live_mode(int) {
- return nullptr;
+ return 0;
}
/**
@@ -1199,7 +1199,7 @@ void Node::copy_properties() {
*/
int Node::user_defined(const char* cbname) const {
for (Node* p = Fluid.proj.tree.first; p ; p = p->next)
- if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != nullptr)
+ if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != 0)
if (strncmp(p->name(), cbname, strlen(cbname)) == 0)
if (p->name()[strlen(cbname)] == '(')
return 1;
@@ -1222,7 +1222,7 @@ const char *Node::callback_name(fld::io::Code_Writer& f) {
\param need_nest if clear, search up one level to the first enclosing class.
If set, recurse all the way up to the top node.
\return the name of the enclosing class, or names of the enclosing classes
- in a static buffe (don't call free), or nullptr if this Type is not inside a class
+ in a static buffe (don't call free), or 0 if this Type is not inside a class
*/
const char* Node::class_name(const int need_nest) const {
Node* p = parent;
@@ -1230,7 +1230,7 @@ const char* Node::class_name(const int need_nest) const {
if (p->is_class()) {
// see if we are nested in another class, we must fully-qualify name:
// this is lame but works...
- const char* q = nullptr;
+ const char* q = 0;
if(need_nest) q=p->class_name(need_nest);
if (q) {
static char s[256];
@@ -1243,7 +1243,7 @@ const char* Node::class_name(const int need_nest) const {
}
p = p->parent;
}
- return nullptr;
+ return 0;
}
/**
@@ -1297,7 +1297,7 @@ unsigned short Node::set_uid(unsigned short suggested_uid) {
}
}
// we are done if we have not fund the suggested id anywhere else
- if (tp==nullptr) {
+ if (tp==0) {
break;
}
// try again with another random number
diff --git a/fluid/nodes/Node.h b/fluid/nodes/Node.h
index 1c94e493d..02338903f 100644
--- a/fluid/nodes/Node.h
+++ b/fluid/nodes/Node.h
@@ -167,7 +167,7 @@ protected:
/** Label text of a widget. */
const char *label_;
/** If it is just a word, it's the name of the callback function. Otherwise
- it is the full callback C++ code. Can be nullptr. */
+ it is the full callback C++ code. Can be 0. */
const char *callback_;
/** Widget user data field as C++ text. */
const char *user_data_;
@@ -243,7 +243,7 @@ public:
const char *comment() { return comment_; }
void comment(const char *);
- virtual Node* click_test(int,int) { return nullptr; }
+ virtual Node* click_test(int,int) { return 0; }
virtual void add_child(Node *, Node *beforethis) { (void)beforethis; }
virtual void move_child(Node *, Node *beforethis) { (void)beforethis; }
@@ -274,7 +274,7 @@ public:
virtual void write_code2(fld::io::Code_Writer& f); // code and .h after children
void write_comment_h(fld::io::Code_Writer& f, const char *ind=""); // write the commentary text into the header file
void write_comment_c(fld::io::Code_Writer& f, const char *ind=""); // write the commentary text into the source file
- void write_comment_inline_c(fld::io::Code_Writer& f, const char *ind=nullptr); // write the commentary text
+ void write_comment_inline_c(fld::io::Code_Writer& f, const char *ind=0); // write the commentary text
// live mode
virtual Fl_Widget *enter_live_mode(int top=0); // build widgets needed for live mode
diff --git a/fluid/nodes/Tree.cxx b/fluid/nodes/Tree.cxx
index 92b5e7506..a163c4181 100644
--- a/fluid/nodes/Tree.cxx
+++ b/fluid/nodes/Tree.cxx
@@ -89,13 +89,13 @@ Tree::Tree(Project &proj)
Walk the tree and return the node with this uid.
\param[in] uid any number between 0 and 65535
- \return the node with this uid, or nullptr if not found
+ \return the node with this uid, or 0 if not found
*/
Node *Tree::find_by_uid(unsigned short uid) {
for (auto tp: all_nodes()) {
if (tp->get_uid() == uid) return tp;
}
- return nullptr;
+ return 0;
}
@@ -103,7 +103,7 @@ Node *Tree::find_by_uid(unsigned short uid) {
\param[in] text_type 0=source file, 1=header, 2=.fl project file
\param[in] crsr cursor position in text
- \return the node we found or nullptr
+ \return the node we found or 0
*/
Node *Tree::find_in_text(int text_type, int crsr) {
for (auto node: all_nodes()) {
@@ -124,5 +124,5 @@ Node *Tree::find_in_text(int text_type, int crsr) {
break;
}
}
- return nullptr;
+ return 0;
}
diff --git a/fluid/nodes/Tree.h b/fluid/nodes/Tree.h
index f494af651..f1a338630 100644
--- a/fluid/nodes/Tree.h
+++ b/fluid/nodes/Tree.h
@@ -31,7 +31,7 @@ class Tree {
// A class that can iterate over the entire scene graph.
class Iterator {
- Node *type_ = nullptr;
+ Node *type_ = 0;
bool only_selected_ = false;
public:
explicit Iterator(Node *t, bool only_selected);
@@ -47,12 +47,12 @@ class Tree {
public:
Container(Tree &tree, bool only_selected) : tree_(tree), only_selected_(only_selected) { }
Iterator begin() { return Iterator(tree_.first, only_selected_); }
- Iterator end() { return Iterator(nullptr, only_selected_); }
+ Iterator end() { return Iterator(0, only_selected_); }
};
// A class that iterate over the scene graph, but returns only nodes of type widget.
class WIterator {
- Node *type_ = nullptr;
+ Node *type_ = 0;
bool only_selected_ = false;
public:
explicit WIterator(Node *t, bool only_selected);
@@ -68,7 +68,7 @@ class Tree {
public:
WContainer(Tree &tree, bool only_selected) : tree_(tree), only_selected_(only_selected) { }
WIterator begin() { return WIterator(tree_.first, only_selected_); }
- WIterator end() { return WIterator(nullptr, only_selected_); }
+ WIterator end() { return WIterator(0, only_selected_); }
};
/// Link Tree class to the project.
@@ -76,10 +76,10 @@ class Tree {
public:
- Node *first = nullptr;
- Node *last = nullptr;
- Node *current = nullptr; // most recently picked object
- Node *current_dnd = nullptr;
+ Node *first = 0;
+ Node *last = 0;
+ Node *current = 0; // most recently picked object
+ Node *current_dnd = 0;
/// If this is greater zero, widgets will be allowed to lay out their children.
int allow_layout = 0;
@@ -87,7 +87,7 @@ public:
Tree(Project &proj);
- bool empty() { return first == nullptr; }
+ bool empty() { return first == 0; }
// Iterators: `for (auto &n: tree.all_nodes()) { n.print(); }
Container all_nodes() { return Container(*this, false); }
diff --git a/fluid/nodes/Widget_Node.cxx b/fluid/nodes/Widget_Node.cxx
index 929a88bf9..6f5a6a0fb 100644
--- a/fluid/nodes/Widget_Node.cxx
+++ b/fluid/nodes/Widget_Node.cxx
@@ -38,6 +38,7 @@
#include <FL/Fl_Spinner.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Flex.H>
+#include <FL/filename.H>
#include "../src/flstring.h"
#include <stdio.h>
@@ -70,16 +71,16 @@ int Widget_Node::is_public() const {
return public_;
}
-std::string subclassname(Node* l) {
+const char* subclassname(Node* l) {
if (l->is_a(FLD_NODE_TYPE_Menu_Bar)) {
- Menu_Bar_Node* mb = static_cast<Menu_Bar_Node*>(l);
+ Menu_Bar_Node* mb = (Menu_Bar_Node*)l;
if (mb->is_sys_menu_bar())
return mb->sys_menubar_name();
}
if (l->is_widget()) {
Widget_Node* p = (Widget_Node*)l;
- std::string c = p->subclass();
- if (!c.empty())
+ const char* c = p->subclass();
+ if (c && c[0])
return c;
if (l->is_class())
return "Fl_Group";
@@ -118,7 +119,7 @@ Node* Widget_Node::make(Strategy strategy) {
}
if (!pp || !pp->is_true_widget() || !anchor->is_true_widget()) {
fl_message("Please select a group widget or window");
- return nullptr;
+ return 0;
}
Widget_Node* p = (Widget_Node*)pp;
@@ -170,7 +171,7 @@ Node* Widget_Node::make(Strategy strategy) {
// Construct the Fl_Widget:
t->o = widget(X,Y,W,H);
if (strategy.source() == Strategy::FROM_FILE)
- t->o->label(nullptr);
+ t->o->label(0);
else if (t->o->label())
t->label(t->o->label()); // allow editing
t->o->user_data((void*)t);
@@ -199,7 +200,7 @@ void Widget_Node::setimage(Image_Asset* i) {
o->image()->scale(iw, ih, 0, 1);
}
} else {
- o->image(nullptr);
+ o->image(0);
//scale_image_w_ = scale_image_h_ = 0;
}
redraw();
@@ -221,7 +222,7 @@ void Widget_Node::setinactive(Image_Asset* i) {
o->deimage()->scale(iw, ih, 0, 1);
}
} else {
- o->deimage(nullptr);
+ o->deimage(0);
//scale_deimage_w_ = scale_deimage_h_ = 0;
}
redraw();
@@ -232,6 +233,32 @@ void Widget_Node::setlabel(const char* n) {
redraw();
}
+Widget_Node::Widget_Node() {
+ int i;
+ for (i = 0; i < NUM_EXTRA_CODE; i++)
+ extra_code_[i] = 0;
+ subclass_ = 0;
+ tooltip_ = 0;
+ image_name_ = 0;
+ inactive_name_ = 0;
+ hotspot_ = 0;
+ menu_headline_ = 0;
+ override_visible_ = 0;
+ live_widget = 0;
+ o = 0;
+ public_ = 1;
+ bind_image_ = 0;
+ compress_image_ = 1;
+ scale_image_w_ = 0;
+ scale_image_h_ = 0;
+ image = 0;
+ bind_deimage_ = 0;
+ compress_deimage_ = 1;
+ scale_deimage_w_ = 0;
+ scale_deimage_h_ = 0;
+ inactive = 0;
+}
+
Widget_Node::~Widget_Node() {
if (o) {
Fl_Window* win = o->window();
@@ -243,34 +270,47 @@ Widget_Node::~Widget_Node() {
image->dec_ref();
if (inactive)
inactive->dec_ref();
+ int i;
+ for (i = 0; i < NUM_EXTRA_CODE; i++)
+ if (extra_code_[i]) free(extra_code_[i]);
+ if (subclass_) free(subclass_);
+ if (tooltip_) free(tooltip_);
+ if (image_name_) free(image_name_);
+ if (inactive_name_) free(inactive_name_);
}
-void Widget_Node::extra_code(int m, const std::string& n) {
- storestring(n, extra_code_[m]);
+void Widget_Node::extra_code(int m, const char *n) {
+ if (extra_code_[m]) free(extra_code_[m]);
+ extra_code_[m] = (n && n[0]) ? fl_strdup(n) : 0;
}
-void Widget_Node::subclass(const std::string& n) {
- if (storestring(n, subclass_) && visible)
+void Widget_Node::subclass(const char *n) {
+ if (subclass_) free(subclass_);
+ subclass_ = (n && n[0]) ? fl_strdup(n) : 0;
+ if (visible)
redraw_browser();
}
-void Widget_Node::tooltip(const std::string& text) {
- storestring(text, tooltip_);
- if (text.empty()) {
- o->tooltip(nullptr);
+void Widget_Node::tooltip(const char *text) {
+ if (tooltip_) free(tooltip_);
+ tooltip_ = (text && text[0]) ? fl_strdup(text) : 0;
+ if (!text || !text[0]) {
+ o->tooltip(0);
} else {
- o->copy_tooltip(text.c_str());
+ o->copy_tooltip(text);
}
}
-void Widget_Node::image_name(const std::string& name) {
- setimage(Image_Asset::find(name.c_str()));
- storestring(name, image_name_);
+void Widget_Node::image_name(const char *name) {
+ setimage(Image_Asset::find(name));
+ if (image_name_) free(image_name_);
+ image_name_ = (name && name[0]) ? fl_strdup(name) : 0;
}
-void Widget_Node::inactive_name(const std::string& name) {
- setinactive(Image_Asset::find(name.c_str()));
- storestring(name, inactive_name_);
+void Widget_Node::inactive_name(const char *name) {
+ setinactive(Image_Asset::find(name));
+ if (inactive_name_) free(inactive_name_);
+ inactive_name_ = (name && name[0]) ? fl_strdup(name) : 0;
}
void Widget_Node::redraw() {
@@ -282,7 +322,7 @@ void Widget_Node::redraw() {
} while (t && t->is_a(FLD_NODE_TYPE_Menu_Item));
// kludge to cause build_menu to be called again:
if (t)
- t->add_child(nullptr, nullptr);
+ t->add_child(0, 0);
} else {
while (t->parent && t->parent->is_widget())
t = t->parent;
@@ -293,7 +333,7 @@ void Widget_Node::redraw() {
// the recursive part sorts all children, returns pointer to next:
Node* sort(Node* parent) {
Node* f;
- Node* n = nullptr;
+ Node* n = 0;
for (f = parent ? parent->next : Fluid.proj.tree.first; ; f = n) {
if (!f || (parent && f->level <= parent->level))
break;
@@ -322,7 +362,7 @@ Node* sort(Node* parent) {
////////////////////////////////////////////////////////////////
// The control panels!
-Fl_Window* the_panel = nullptr;
+Fl_Window* the_panel = 0;
// All the callbacks use the argument to indicate whether to load or store.
// This avoids the need for pointers to all the widgets, and keeps the
@@ -331,8 +371,8 @@ Fl_Window* the_panel = nullptr;
// with any actual useful values for the argument. I also use this to
// initialized parts of the widget that are nyi by fluid.
-Node* current_node = nullptr;
-Widget_Node* current_widget = nullptr; // one of the selected ones
+Node* current_node = 0;
+Widget_Node* current_widget = 0; // one of the selected ones
void* const LOAD = (void *)"LOAD"; // "magic" pointer to indicate that we need to load values into the dialog
int numselected = 0; // number selected
int haderror = 0;
@@ -569,7 +609,7 @@ fld::widget::Formula_Input_Vars widget_vars[] = {
{ "cy", vars_cy_cb },
{ "cw", vars_cw_cb },
{ "ch", vars_ch_cb },
- { nullptr }
+ { 0 }
};
////////////////////////////////////////////////////////////////
@@ -608,86 +648,86 @@ int item_number(Fl_Menu_Item* m, const char* i) {
#define ZERO_ENTRY 1000
Fl_Menu_Item boxmenu[] = {
- {"NO_BOX",0,nullptr,(void *)ZERO_ENTRY},
- {"boxes",0,nullptr,nullptr,FL_SUBMENU},
- {"UP_BOX",0,nullptr,(void *)FL_UP_BOX},
- {"DOWN_BOX",0,nullptr,(void *)FL_DOWN_BOX},
- {"FLAT_BOX",0,nullptr,(void *)FL_FLAT_BOX},
- {"BORDER_BOX",0,nullptr,(void *)FL_BORDER_BOX},
- {"THIN_UP_BOX",0,nullptr,(void *)FL_THIN_UP_BOX},
- {"THIN_DOWN_BOX",0,nullptr,(void *)FL_THIN_DOWN_BOX},
- {"ENGRAVED_BOX",0,nullptr,(void *)FL_ENGRAVED_BOX},
- {"EMBOSSED_BOX",0,nullptr,(void *)FL_EMBOSSED_BOX},
- {"ROUND_UP_BOX",0,nullptr,(void *)FL_ROUND_UP_BOX},
- {"ROUND_DOWN_BOX",0,nullptr,(void *)FL_ROUND_DOWN_BOX},
- {"DIAMOND_UP_BOX",0,nullptr,(void *)FL_DIAMOND_UP_BOX},
- {"DIAMOND_DOWN_BOX",0,nullptr,(void *)FL_DIAMOND_DOWN_BOX},
- {"SHADOW_BOX",0,nullptr,(void *)FL_SHADOW_BOX},
- {"ROUNDED_BOX",0,nullptr,(void *)FL_ROUNDED_BOX},
- {"RSHADOW_BOX",0,nullptr,(void *)FL_RSHADOW_BOX},
- {"RFLAT_BOX",0,nullptr,(void *)FL_RFLAT_BOX},
- {"OVAL_BOX",0,nullptr,(void *)FL_OVAL_BOX},
- {"OSHADOW_BOX",0,nullptr,(void *)FL_OSHADOW_BOX},
- {"OFLAT_BOX",0,nullptr,(void *)FL_OFLAT_BOX},
- {"PLASTIC_UP_BOX",0,nullptr,(void *)FL_PLASTIC_UP_BOX},
- {"PLASTIC_DOWN_BOX",0,nullptr,(void *)FL_PLASTIC_DOWN_BOX},
- {"PLASTIC_THIN_UP_BOX",0,nullptr,(void *)FL_PLASTIC_THIN_UP_BOX},
- {"PLASTIC_THIN_DOWN_BOX",0,nullptr,(void *)FL_PLASTIC_THIN_DOWN_BOX},
- {"PLASTIC_ROUND_UP_BOX",0,nullptr,(void *)FL_PLASTIC_ROUND_UP_BOX},
- {"PLASTIC_ROUND_DOWN_BOX",0,nullptr,(void *)FL_PLASTIC_ROUND_DOWN_BOX},
- {"GTK_UP_BOX",0,nullptr,(void *)FL_GTK_UP_BOX},
- {"GTK_DOWN_BOX",0,nullptr,(void *)FL_GTK_DOWN_BOX},
- {"GTK_THIN_UP_BOX",0,nullptr,(void *)FL_GTK_THIN_UP_BOX},
- {"GTK_THIN_DOWN_BOX",0,nullptr,(void *)FL_GTK_THIN_DOWN_BOX},
- {"GTK_ROUND_UP_BOX",0,nullptr,(void *)FL_GTK_ROUND_UP_BOX},
- {"GTK_ROUND_DOWN_BOX",0,nullptr,(void *)FL_GTK_ROUND_DOWN_BOX},
- {"GLEAM_UP_BOX",0,nullptr,(void *)FL_GLEAM_UP_BOX},
- {"GLEAM_DOWN_BOX",0,nullptr,(void *)FL_GLEAM_DOWN_BOX},
- {"GLEAM_THIN_UP_BOX",0,nullptr,(void *)FL_GLEAM_THIN_UP_BOX},
- {"GLEAM_THIN_DOWN_BOX",0,nullptr,(void *)FL_GLEAM_THIN_DOWN_BOX},
- {"GLEAM_ROUND_UP_BOX",0,nullptr,(void *)FL_GLEAM_ROUND_UP_BOX},
- {"GLEAM_ROUND_DOWN_BOX",0,nullptr,(void *)FL_GLEAM_ROUND_DOWN_BOX},
- {"OXY_UP_BOX",0,nullptr,(void *)FL_OXY_UP_BOX},
- {"OXY_DOWN_BOX",0,nullptr,(void *)FL_OXY_DOWN_BOX},
- {"OXY_THIN_UP_BOX",0,nullptr,(void *)FL_OXY_THIN_UP_BOX},
- {"OXY_THIN_DOWN_BOX",0,nullptr,(void *)FL_OXY_THIN_DOWN_BOX},
- {"OXY_ROUND_UP_BOX",0,nullptr,(void *)FL_OXY_ROUND_UP_BOX},
- {"OXY_ROUND_DOWN_BOX",0,nullptr,(void *)FL_OXY_ROUND_DOWN_BOX},
- {"OXY_BUTTON_UP_BOX",0,nullptr,(void *)FL_OXY_BUTTON_UP_BOX},
- {"OXY_BUTTON_DOWN_BOX",0,nullptr,(void *)FL_OXY_BUTTON_DOWN_BOX},
- {nullptr},
- {"frames",0,nullptr,nullptr,FL_SUBMENU},
- {"UP_FRAME",0,nullptr,(void *)FL_UP_FRAME},
- {"DOWN_FRAME",0,nullptr,(void *)FL_DOWN_FRAME},
- {"THIN_UP_FRAME",0,nullptr,(void *)FL_THIN_UP_FRAME},
- {"THIN_DOWN_FRAME",0,nullptr,(void *)FL_THIN_DOWN_FRAME},
- {"ENGRAVED_FRAME",0,nullptr,(void *)FL_ENGRAVED_FRAME},
- {"EMBOSSED_FRAME",0,nullptr,(void *)FL_EMBOSSED_FRAME},
- {"BORDER_FRAME",0,nullptr,(void *)FL_BORDER_FRAME},
- {"SHADOW_FRAME",0,nullptr,(void *)FL_SHADOW_FRAME},
- {"ROUNDED_FRAME",0,nullptr,(void *)FL_ROUNDED_FRAME},
- {"OVAL_FRAME",0,nullptr,(void *)FL_OVAL_FRAME},
- {"PLASTIC_UP_FRAME",0,nullptr,(void *)FL_PLASTIC_UP_FRAME},
- {"PLASTIC_DOWN_FRAME",0,nullptr,(void *)FL_PLASTIC_DOWN_FRAME},
- {"GTK_UP_FRAME",0,nullptr,(void *)FL_GTK_UP_FRAME},
- {"GTK_DOWN_FRAME",0,nullptr,(void *)FL_GTK_DOWN_FRAME},
- {"GTK_THIN_UP_FRAME",0,nullptr,(void *)FL_GTK_THIN_UP_FRAME},
- {"GTK_THIN_DOWN_FRAME",0,nullptr,(void *)FL_GTK_THIN_DOWN_FRAME},
- {"GLEAM_UP_FRAME",0,nullptr,(void *)FL_GLEAM_UP_FRAME},
- {"GLEAM_DOWN_FRAME",0,nullptr,(void *)FL_GLEAM_DOWN_FRAME},
- {"OXY_UP_FRAME",0,nullptr,(void *)FL_OXY_UP_FRAME},
- {"OXY_DOWN_FRAME",0,nullptr,(void *)FL_OXY_DOWN_FRAME},
- {"OXY_THIN_UP_FRAME",0,nullptr,(void *)FL_OXY_THIN_UP_FRAME},
- {"OXY_THIN_DOWN_FRAME",0,nullptr,(void *)FL_OXY_THIN_DOWN_FRAME},
- {nullptr},
- {nullptr}};
+ {"NO_BOX",0,0,(void *)ZERO_ENTRY},
+ {"boxes",0,0,0,FL_SUBMENU},
+ {"UP_BOX",0,0,(void *)FL_UP_BOX},
+ {"DOWN_BOX",0,0,(void *)FL_DOWN_BOX},
+ {"FLAT_BOX",0,0,(void *)FL_FLAT_BOX},
+ {"BORDER_BOX",0,0,(void *)FL_BORDER_BOX},
+ {"THIN_UP_BOX",0,0,(void *)FL_THIN_UP_BOX},
+ {"THIN_DOWN_BOX",0,0,(void *)FL_THIN_DOWN_BOX},
+ {"ENGRAVED_BOX",0,0,(void *)FL_ENGRAVED_BOX},
+ {"EMBOSSED_BOX",0,0,(void *)FL_EMBOSSED_BOX},
+ {"ROUND_UP_BOX",0,0,(void *)FL_ROUND_UP_BOX},
+ {"ROUND_DOWN_BOX",0,0,(void *)FL_ROUND_DOWN_BOX},
+ {"DIAMOND_UP_BOX",0,0,(void *)FL_DIAMOND_UP_BOX},
+ {"DIAMOND_DOWN_BOX",0,0,(void *)FL_DIAMOND_DOWN_BOX},
+ {"SHADOW_BOX",0,0,(void *)FL_SHADOW_BOX},
+ {"ROUNDED_BOX",0,0,(void *)FL_ROUNDED_BOX},
+ {"RSHADOW_BOX",0,0,(void *)FL_RSHADOW_BOX},
+ {"RFLAT_BOX",0,0,(void *)FL_RFLAT_BOX},
+ {"OVAL_BOX",0,0,(void *)FL_OVAL_BOX},
+ {"OSHADOW_BOX",0,0,(void *)FL_OSHADOW_BOX},
+ {"OFLAT_BOX",0,0,(void *)FL_OFLAT_BOX},
+ {"PLASTIC_UP_BOX",0,0,(void *)FL_PLASTIC_UP_BOX},
+ {"PLASTIC_DOWN_BOX",0,0,(void *)FL_PLASTIC_DOWN_BOX},
+ {"PLASTIC_THIN_UP_BOX",0,0,(void *)FL_PLASTIC_THIN_UP_BOX},
+ {"PLASTIC_THIN_DOWN_BOX",0,0,(void *)FL_PLASTIC_THIN_DOWN_BOX},
+ {"PLASTIC_ROUND_UP_BOX",0,0,(void *)FL_PLASTIC_ROUND_UP_BOX},
+ {"PLASTIC_ROUND_DOWN_BOX",0,0,(void *)FL_PLASTIC_ROUND_DOWN_BOX},
+ {"GTK_UP_BOX",0,0,(void *)FL_GTK_UP_BOX},
+ {"GTK_DOWN_BOX",0,0,(void *)FL_GTK_DOWN_BOX},
+ {"GTK_THIN_UP_BOX",0,0,(void *)FL_GTK_THIN_UP_BOX},
+ {"GTK_THIN_DOWN_BOX",0,0,(void *)FL_GTK_THIN_DOWN_BOX},
+ {"GTK_ROUND_UP_BOX",0,0,(void *)FL_GTK_ROUND_UP_BOX},
+ {"GTK_ROUND_DOWN_BOX",0,0,(void *)FL_GTK_ROUND_DOWN_BOX},
+ {"GLEAM_UP_BOX",0,0,(void *)FL_GLEAM_UP_BOX},
+ {"GLEAM_DOWN_BOX",0,0,(void *)FL_GLEAM_DOWN_BOX},
+ {"GLEAM_THIN_UP_BOX",0,0,(void *)FL_GLEAM_THIN_UP_BOX},
+ {"GLEAM_THIN_DOWN_BOX",0,0,(void *)FL_GLEAM_THIN_DOWN_BOX},
+ {"GLEAM_ROUND_UP_BOX",0,0,(void *)FL_GLEAM_ROUND_UP_BOX},
+ {"GLEAM_ROUND_DOWN_BOX",0,0,(void *)FL_GLEAM_ROUND_DOWN_BOX},
+ {"OXY_UP_BOX",0,0,(void *)FL_OXY_UP_BOX},
+ {"OXY_DOWN_BOX",0,0,(void *)FL_OXY_DOWN_BOX},
+ {"OXY_THIN_UP_BOX",0,0,(void *)FL_OXY_THIN_UP_BOX},
+ {"OXY_THIN_DOWN_BOX",0,0,(void *)FL_OXY_THIN_DOWN_BOX},
+ {"OXY_ROUND_UP_BOX",0,0,(void *)FL_OXY_ROUND_UP_BOX},
+ {"OXY_ROUND_DOWN_BOX",0,0,(void *)FL_OXY_ROUND_DOWN_BOX},
+ {"OXY_BUTTON_UP_BOX",0,0,(void *)FL_OXY_BUTTON_UP_BOX},
+ {"OXY_BUTTON_DOWN_BOX",0,0,(void *)FL_OXY_BUTTON_DOWN_BOX},
+ {0},
+ {"frames",0,0,0,FL_SUBMENU},
+ {"UP_FRAME",0,0,(void *)FL_UP_FRAME},
+ {"DOWN_FRAME",0,0,(void *)FL_DOWN_FRAME},
+ {"THIN_UP_FRAME",0,0,(void *)FL_THIN_UP_FRAME},
+ {"THIN_DOWN_FRAME",0,0,(void *)FL_THIN_DOWN_FRAME},
+ {"ENGRAVED_FRAME",0,0,(void *)FL_ENGRAVED_FRAME},
+ {"EMBOSSED_FRAME",0,0,(void *)FL_EMBOSSED_FRAME},
+ {"BORDER_FRAME",0,0,(void *)FL_BORDER_FRAME},
+ {"SHADOW_FRAME",0,0,(void *)FL_SHADOW_FRAME},
+ {"ROUNDED_FRAME",0,0,(void *)FL_ROUNDED_FRAME},
+ {"OVAL_FRAME",0,0,(void *)FL_OVAL_FRAME},
+ {"PLASTIC_UP_FRAME",0,0,(void *)FL_PLASTIC_UP_FRAME},
+ {"PLASTIC_DOWN_FRAME",0,0,(void *)FL_PLASTIC_DOWN_FRAME},
+ {"GTK_UP_FRAME",0,0,(void *)FL_GTK_UP_FRAME},
+ {"GTK_DOWN_FRAME",0,0,(void *)FL_GTK_DOWN_FRAME},
+ {"GTK_THIN_UP_FRAME",0,0,(void *)FL_GTK_THIN_UP_FRAME},
+ {"GTK_THIN_DOWN_FRAME",0,0,(void *)FL_GTK_THIN_DOWN_FRAME},
+ {"GLEAM_UP_FRAME",0,0,(void *)FL_GLEAM_UP_FRAME},
+ {"GLEAM_DOWN_FRAME",0,0,(void *)FL_GLEAM_DOWN_FRAME},
+ {"OXY_UP_FRAME",0,0,(void *)FL_OXY_UP_FRAME},
+ {"OXY_DOWN_FRAME",0,0,(void *)FL_OXY_DOWN_FRAME},
+ {"OXY_THIN_UP_FRAME",0,0,(void *)FL_OXY_THIN_UP_FRAME},
+ {"OXY_THIN_DOWN_FRAME",0,0,(void *)FL_OXY_THIN_DOWN_FRAME},
+ {0},
+ {0}};
const char* boxname(int i) {
if (!i) i = ZERO_ENTRY;
for (int j = 0; j < int(sizeof(boxmenu)/sizeof(*boxmenu)); j++)
if (boxmenu[j].argument() == i)
return boxmenu[j].label();
- return nullptr;
+ return 0;
}
int boxnumber(const char* i) {
@@ -707,37 +747,37 @@ int boxnumber(const char* i) {
Fl_Menu_Item whenmenu[] = {
// set individual bits
- {"FL_WHEN_CHANGED",0,nullptr,(void*)FL_WHEN_CHANGED, FL_MENU_TOGGLE},
- {"FL_WHEN_NOT_CHANGED",0,nullptr,(void*)FL_WHEN_NOT_CHANGED, FL_MENU_TOGGLE},
- {"FL_WHEN_RELEASE",0,nullptr,(void*)FL_WHEN_RELEASE, FL_MENU_TOGGLE},
- {"FL_WHEN_ENTER_KEY",0,nullptr,(void*)FL_WHEN_ENTER_KEY, FL_MENU_TOGGLE},
- {"FL_WHEN_CLOSED",0,nullptr,(void*)FL_WHEN_CLOSED, FL_MENU_TOGGLE|FL_MENU_DIVIDER},
+ {"FL_WHEN_CHANGED",0,0,(void*)FL_WHEN_CHANGED, FL_MENU_TOGGLE},
+ {"FL_WHEN_NOT_CHANGED",0,0,(void*)FL_WHEN_NOT_CHANGED, FL_MENU_TOGGLE},
+ {"FL_WHEN_RELEASE",0,0,(void*)FL_WHEN_RELEASE, FL_MENU_TOGGLE},
+ {"FL_WHEN_ENTER_KEY",0,0,(void*)FL_WHEN_ENTER_KEY, FL_MENU_TOGGLE},
+ {"FL_WHEN_CLOSED",0,0,(void*)FL_WHEN_CLOSED, FL_MENU_TOGGLE|FL_MENU_DIVIDER},
// set bit combinations
- {"FL_WHEN_NEVER",0,nullptr,(void*)FL_WHEN_NEVER},
- {"FL_WHEN_RELEASE_ALWAYS",0,nullptr,(void*)FL_WHEN_RELEASE_ALWAYS},
- {"FL_WHEN_ENTER_KEY_ALWAYS",0,nullptr,(void*)FL_WHEN_ENTER_KEY_ALWAYS},
- {"FL_WHEN_ENTER_KEY_CHANGED",0,nullptr,(void*)FL_WHEN_ENTER_KEY_CHANGED},
- {nullptr}};
+ {"FL_WHEN_NEVER",0,0,(void*)FL_WHEN_NEVER},
+ {"FL_WHEN_RELEASE_ALWAYS",0,0,(void*)FL_WHEN_RELEASE_ALWAYS},
+ {"FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)FL_WHEN_ENTER_KEY_ALWAYS},
+ {"FL_WHEN_ENTER_KEY_CHANGED",0,0,(void*)FL_WHEN_ENTER_KEY_CHANGED},
+ {0}};
static Fl_Menu_Item whensymbolmenu[] = {
- /* 0 */ {"FL_WHEN_NEVER",0,nullptr,(void*)FL_WHEN_NEVER},
- /* 1 */ {"FL_WHEN_CHANGED",0,nullptr,(void*)FL_WHEN_CHANGED},
- /* 2 */ {"FL_WHEN_NOT_CHANGED",0,nullptr,(void*)FL_WHEN_NOT_CHANGED},
- /* 3 */ {"FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED",0,nullptr,(void*)(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED)},
- /* 4 */ {"FL_WHEN_RELEASE",0,nullptr,(void*)FL_WHEN_RELEASE},
- /* 5 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE",0,nullptr,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE)},
- /* 6 */ {"FL_WHEN_RELEASE_ALWAYS",0,nullptr,(void*)FL_WHEN_RELEASE_ALWAYS},
- /* 7 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE_ALWAYS",0,nullptr,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE_ALWAYS)},
- /* 8 */ {"FL_WHEN_ENTER_KEY",0,nullptr,(void*)FL_WHEN_ENTER_KEY},
- /* 9 */ {"FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,nullptr,(void*)(FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)},
- /* 10 */ {"FL_WHEN_ENTER_KEY_ALWAYS",0,nullptr,(void*)FL_WHEN_ENTER_KEY_ALWAYS},
- /* 11 */ {"FL_WHEN_ENTER_KEY_CHANGED",0,nullptr,(void*)FL_WHEN_ENTER_KEY_CHANGED},
- /* 12 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY",0,nullptr,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY)},
- /* 13 */ {"FL_WHEN_RELEASE | FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,nullptr,(void*)(FL_WHEN_RELEASE|FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)},
- /* 14 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_ALWAYS",0,nullptr,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_ALWAYS)},
- /* 15 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_CHANGED",0,nullptr,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_CHANGED)},
- {nullptr}
+ /* 0 */ {"FL_WHEN_NEVER",0,0,(void*)FL_WHEN_NEVER},
+ /* 1 */ {"FL_WHEN_CHANGED",0,0,(void*)FL_WHEN_CHANGED},
+ /* 2 */ {"FL_WHEN_NOT_CHANGED",0,0,(void*)FL_WHEN_NOT_CHANGED},
+ /* 3 */ {"FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED)},
+ /* 4 */ {"FL_WHEN_RELEASE",0,0,(void*)FL_WHEN_RELEASE},
+ /* 5 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE)},
+ /* 6 */ {"FL_WHEN_RELEASE_ALWAYS",0,0,(void*)FL_WHEN_RELEASE_ALWAYS},
+ /* 7 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE_ALWAYS",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE_ALWAYS)},
+ /* 8 */ {"FL_WHEN_ENTER_KEY",0,0,(void*)FL_WHEN_ENTER_KEY},
+ /* 9 */ {"FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)},
+ /* 10 */ {"FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)FL_WHEN_ENTER_KEY_ALWAYS},
+ /* 11 */ {"FL_WHEN_ENTER_KEY_CHANGED",0,0,(void*)FL_WHEN_ENTER_KEY_CHANGED},
+ /* 12 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY)},
+ /* 13 */ {"FL_WHEN_RELEASE | FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)},
+ /* 14 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_ALWAYS)},
+ /* 15 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_CHANGED",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_CHANGED)},
+ {0}
};
// Return a text string representing the Fl_When value n
@@ -765,7 +805,7 @@ void set_whenmenu(int n) {
uchar Widget_Node::resizable() const {
if (is_a(FLD_NODE_TYPE_Window))
- return ((Fl_Window*)o)->resizable() != nullptr;
+ return ((Fl_Window*)o)->resizable() != 0;
Fl_Group* p = (Fl_Group*)o->parent();
if (p)
return p->resizable() == o;
@@ -787,10 +827,10 @@ void Widget_Node::resizable(uchar v) {
if (!resizable())
return;
if (is_a(FLD_NODE_TYPE_Window)) {
- ((Fl_Window*)o)->resizable(nullptr);
+ ((Fl_Window*)o)->resizable(0);
} else {
Fl_Group* p = (Fl_Group*)o->parent();
- if (p) p->resizable(nullptr);
+ if (p) p->resizable(0);
}
}
}
@@ -816,11 +856,11 @@ Fl_Menu_Item fontmenu[] = {
{"Terminal"},
{"Terminal Bold"},
{"Zapf Dingbats"},
- {nullptr}
+ {0}
};
Fl_Menu_Item fontmenu_w_default[] = {
- {"<default>", 0, nullptr, nullptr, FL_MENU_DIVIDER},
+ {"<default>", 0, 0, 0, FL_MENU_DIVIDER},
{"Helvetica"},
{"Helvetica bold"},
{"Helvetica italic"},
@@ -837,7 +877,7 @@ Fl_Menu_Item fontmenu_w_default[] = {
{"Terminal"},
{"Terminal Bold"},
{"Zapf Dingbats"},
- {nullptr}
+ {0}
};
@@ -845,12 +885,12 @@ Fl_Menu_Item fontmenu_w_default[] = {
extern const char* ui_find_image_name;
Fl_Menu_Item labeltypemenu[] = {
- {"NORMAL_LABEL",0,nullptr,(void*)nullptr},
- {"SHADOW_LABEL",0,nullptr,(void*)FL_SHADOW_LABEL},
- {"ENGRAVED_LABEL",0,nullptr,(void*)FL_ENGRAVED_LABEL},
- {"EMBOSSED_LABEL",0,nullptr,(void*)FL_EMBOSSED_LABEL},
- {"NO_LABEL",0,nullptr,(void*)(FL_NO_LABEL)},
- {nullptr}};
+ {"NORMAL_LABEL",0,0,(void*)0},
+ {"SHADOW_LABEL",0,0,(void*)FL_SHADOW_LABEL},
+ {"ENGRAVED_LABEL",0,0,(void*)FL_ENGRAVED_LABEL},
+ {"EMBOSSED_LABEL",0,0,(void*)FL_EMBOSSED_LABEL},
+ {"NO_LABEL",0,0,(void*)(FL_NO_LABEL)},
+ {0}};
void labeltype_cb(Fl_Choice* i, void* v) {
if (v == LOAD) {
@@ -884,21 +924,21 @@ void labeltype_cb(Fl_Choice* i, void* v) {
////////////////////////////////////////////////////////////////
Fl_Menu_Item colormenu[] = {
- { "Foreground Color", 0, nullptr, (void*)(fl_intptr_t)FL_FOREGROUND_COLOR, 0, 0, FL_HELVETICA, 11},
- { "Background Color", 0, nullptr, (void*)(fl_intptr_t)FL_BACKGROUND_COLOR, 0, 0, FL_HELVETICA, 11},
- { "Background Color 2", 0, nullptr, (void*)(fl_intptr_t)FL_BACKGROUND2_COLOR, 0, 0, FL_HELVETICA, 11},
- { "Selection Color", 0, nullptr, (void*)(fl_intptr_t)FL_SELECTION_COLOR, 0, 0, FL_HELVETICA, 11},
- { "Inactive Color", 0, nullptr, (void*)(fl_intptr_t)FL_INACTIVE_COLOR, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11},
- { "Black", 0, nullptr, (void*)(fl_intptr_t)FL_BLACK, 0, 0, FL_HELVETICA, 11},
- { "White", 0, nullptr, (void*)(fl_intptr_t)FL_WHITE, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11},
- { "Gray 0", 0, nullptr, (void*)(fl_intptr_t)FL_GRAY0, 0, 0, FL_HELVETICA, 11},
- { "Dark 3", 0, nullptr, (void*)(fl_intptr_t)FL_DARK3, 0, 0, FL_HELVETICA, 11},
- { "Dark 2", 0, nullptr, (void*)(fl_intptr_t)FL_DARK2, 0, 0, FL_HELVETICA, 11},
- { "Dark 1", 0, nullptr, (void*)(fl_intptr_t)FL_DARK1, 0, 0, FL_HELVETICA, 11},
- { "Light 1", 0, nullptr, (void*)(fl_intptr_t)FL_LIGHT1, 0, 0, FL_HELVETICA, 11},
- { "Light 2", 0, nullptr, (void*)(fl_intptr_t)FL_LIGHT2, 0, 0, FL_HELVETICA, 11},
- { "Light 3", 0, nullptr, (void*)(fl_intptr_t)FL_LIGHT3, 0, 0, FL_HELVETICA, 11},
- { nullptr }
+ { "Foreground Color", 0, 0, (void*)(fl_intptr_t)FL_FOREGROUND_COLOR, 0, 0, FL_HELVETICA, 11},
+ { "Background Color", 0, 0, (void*)(fl_intptr_t)FL_BACKGROUND_COLOR, 0, 0, FL_HELVETICA, 11},
+ { "Background Color 2", 0, 0, (void*)(fl_intptr_t)FL_BACKGROUND2_COLOR, 0, 0, FL_HELVETICA, 11},
+ { "Selection Color", 0, 0, (void*)(fl_intptr_t)FL_SELECTION_COLOR, 0, 0, FL_HELVETICA, 11},
+ { "Inactive Color", 0, 0, (void*)(fl_intptr_t)FL_INACTIVE_COLOR, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11},
+ { "Black", 0, 0, (void*)(fl_intptr_t)FL_BLACK, 0, 0, FL_HELVETICA, 11},
+ { "White", 0, 0, (void*)(fl_intptr_t)FL_WHITE, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11},
+ { "Gray 0", 0, 0, (void*)(fl_intptr_t)FL_GRAY0, 0, 0, FL_HELVETICA, 11},
+ { "Dark 3", 0, 0, (void*)(fl_intptr_t)FL_DARK3, 0, 0, FL_HELVETICA, 11},
+ { "Dark 2", 0, 0, (void*)(fl_intptr_t)FL_DARK2, 0, 0, FL_HELVETICA, 11},
+ { "Dark 1", 0, 0, (void*)(fl_intptr_t)FL_DARK1, 0, 0, FL_HELVETICA, 11},
+ { "Light 1", 0, 0, (void*)(fl_intptr_t)FL_LIGHT1, 0, 0, FL_HELVETICA, 11},
+ { "Light 2", 0, 0, (void*)(fl_intptr_t)FL_LIGHT2, 0, 0, FL_HELVETICA, 11},
+ { "Light 3", 0, 0, (void*)(fl_intptr_t)FL_LIGHT3, 0, 0, FL_HELVETICA, 11},
+ { 0 }
};
void color_common(Fl_Color c) {
@@ -956,24 +996,24 @@ static Fl_Button* relative(Fl_Widget* o, int i) {
}
static Fl_Menu_Item alignmenu[] = {
- {"FL_ALIGN_CENTER",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_CENTER)},
- {"FL_ALIGN_TOP",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_TOP)},
- {"FL_ALIGN_BOTTOM",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM)},
- {"FL_ALIGN_LEFT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_LEFT)},
- {"FL_ALIGN_RIGHT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT)},
- {"FL_ALIGN_INSIDE",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_INSIDE)},
- {"FL_ALIGN_CLIP",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_CLIP)},
- {"FL_ALIGN_WRAP",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_WRAP)},
- {"FL_ALIGN_TEXT_OVER_IMAGE",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_TEXT_OVER_IMAGE)},
- {"FL_ALIGN_TOP_LEFT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_TOP_LEFT)},
- {"FL_ALIGN_TOP_RIGHT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_TOP_RIGHT)},
- {"FL_ALIGN_BOTTOM_LEFT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM_LEFT)},
- {"FL_ALIGN_BOTTOM_RIGHT",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM_RIGHT)},
- {"FL_ALIGN_LEFT_TOP",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_LEFT_TOP)},
- {"FL_ALIGN_RIGHT_TOP",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT_TOP)},
- {"FL_ALIGN_LEFT_BOTTOM",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_LEFT_BOTTOM)},
- {"FL_ALIGN_RIGHT_BOTTOM",0,nullptr,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT_BOTTOM)},
- {nullptr}
+ {"FL_ALIGN_CENTER",0,0,(void*)(fl_intptr_t)(FL_ALIGN_CENTER)},
+ {"FL_ALIGN_TOP",0,0,(void*)(fl_intptr_t)(FL_ALIGN_TOP)},
+ {"FL_ALIGN_BOTTOM",0,0,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM)},
+ {"FL_ALIGN_LEFT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_LEFT)},
+ {"FL_ALIGN_RIGHT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT)},
+ {"FL_ALIGN_INSIDE",0,0,(void*)(fl_intptr_t)(FL_ALIGN_INSIDE)},
+ {"FL_ALIGN_CLIP",0,0,(void*)(fl_intptr_t)(FL_ALIGN_CLIP)},
+ {"FL_ALIGN_WRAP",0,0,(void*)(fl_intptr_t)(FL_ALIGN_WRAP)},
+ {"FL_ALIGN_TEXT_OVER_IMAGE",0,0,(void*)(fl_intptr_t)(FL_ALIGN_TEXT_OVER_IMAGE)},
+ {"FL_ALIGN_TOP_LEFT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_TOP_LEFT)},
+ {"FL_ALIGN_TOP_RIGHT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_TOP_RIGHT)},
+ {"FL_ALIGN_BOTTOM_LEFT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM_LEFT)},
+ {"FL_ALIGN_BOTTOM_RIGHT",0,0,(void*)(fl_intptr_t)(FL_ALIGN_BOTTOM_RIGHT)},
+ {"FL_ALIGN_LEFT_TOP",0,0,(void*)(fl_intptr_t)(FL_ALIGN_LEFT_TOP)},
+ {"FL_ALIGN_RIGHT_TOP",0,0,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT_TOP)},
+ {"FL_ALIGN_LEFT_BOTTOM",0,0,(void*)(fl_intptr_t)(FL_ALIGN_LEFT_BOTTOM)},
+ {"FL_ALIGN_RIGHT_BOTTOM",0,0,(void*)(fl_intptr_t)(FL_ALIGN_RIGHT_BOTTOM)},
+ {0}
};
void align_cb(Fl_Button* i, void* v) {
@@ -1197,7 +1237,7 @@ void position_group_cb(Fl_Group* g, void* v) {
// subtypes:
-Fl_Menu_Item* Widget_Node::subtypes() { return nullptr; }
+Fl_Menu_Item* Widget_Node::subtypes() { return 0; }
////////////////////////////////////////////////////////////////
@@ -1241,9 +1281,9 @@ void leave_live_mode_cb(Fl_Widget*, void*);
void live_mode_cb(Fl_Button* o, void *) {
/// \todo live mode should end gracefully when the application quits
/// or when the user closes the live widget
- static Node* live_type = nullptr;
- static Fl_Widget* live_widget = nullptr;
- static Fl_Window* live_window = nullptr;
+ static Node* live_type = 0;
+ static Fl_Widget* live_widget = 0;
+ static Fl_Window* live_window = 0;
if (!current_widget) {
o->value(0);
@@ -1257,11 +1297,11 @@ void live_mode_cb(Fl_Button* o, void *) {
}
if (o->value()) {
if (numselected == 1) {
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
live_widget = current_widget->enter_live_mode(1);
if (live_widget) {
live_type = current_widget;
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
int w = live_widget->w();
int h = live_widget->h();
live_window = new Fl_Double_Window(w+20, h+55, "Fluid Live Resize");
@@ -1301,9 +1341,9 @@ void live_mode_cb(Fl_Button* o, void *) {
live_window->hide();
Fl::delete_widget(live_window);
}
- live_type = nullptr;
- live_widget = nullptr;
- live_window = nullptr;
+ live_type = 0;
+ live_widget = 0;
+ live_window = 0;
}
}
@@ -1313,7 +1353,7 @@ void load_panel() {
// find all the Fl_Widget subclasses currently selected:
numselected = 0;
- current_widget = nullptr;
+ current_widget = 0;
if (Fluid.proj.tree.current) {
if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Data)) {
current_node = Fluid.proj.tree.current;
@@ -1348,7 +1388,7 @@ void load_panel() {
tabs_wizard->value(func_tabs);
numselected = 1;
} else {
- current_node = nullptr;
+ current_node = 0;
if (Fluid.proj.tree.current->is_widget())
current_widget=(Widget_Node*)Fluid.proj.tree.current;
for (Node* o = Fluid.proj.tree.first; o; o = o->next) {
@@ -1429,10 +1469,10 @@ extern void update_codeview_position();
void selection_changed(Node* p) {
// store all changes to the current selected objects:
if (p && the_panel && the_panel->visible()) {
- set_cb(nullptr,nullptr);
+ set_cb(0,0);
// if there was an error, we try to leave the selected set unchanged:
if (haderror) {
- Node* q = nullptr;
+ Node* q = 0;
for (Node* o = Fluid.proj.tree.first; o; o = o->next) {
o->new_selected = o->selected;
if (!q && o->selected) q = o;
@@ -1444,7 +1484,7 @@ void selection_changed(Node* p) {
}
}
// update the selected flags to new set:
- Node* q = nullptr;
+ Node* q = 0;
for (Node* o = Fluid.proj.tree.first; o; o = o->next) {
o->selected = o->new_selected;
if (!q && o->selected) q = o;
@@ -1474,11 +1514,11 @@ int is_name(const char* c) {
// number or a field or function. Return name() if not an array entry.
const char* array_name(Widget_Node* o) {
const char* c = o->name();
- if (!c) return nullptr;
+ if (!c) return 0;
const char* d;
for (d = c; *d != '['; d++) {
if (!*d) return c;
- if (ispunct(*d) && *d!='_') return nullptr;
+ if (ispunct(*d) && *d!='_') return 0;
}
int num = atoi(d+1);
int sawthis = 0;
@@ -1492,7 +1532,7 @@ const char* array_name(Widget_Node* o) {
if (!e) continue;
if (strncmp(c,e,d-c)) continue;
int n1 = atoi(e+(d-c)+1);
- if (n1 > num || (n1==num && sawthis)) return nullptr;
+ if (n1 > num || (n1==num && sawthis)) return 0;
}
static char buffer[128];
// MRS: we want strncpy() here...
@@ -1512,14 +1552,17 @@ int isdeclare(const char* c) {
}
void Widget_Node::write_static(fld::io::Code_Writer& f) {
- std::string t = subclassname(this);
- if (subclass().empty() || (is_class() && (t.compare(0, 3, "Fl_")==0))) {
+ const char* t = subclassname(this);
+ const char* sc = subclass();
+ if (!sc || !sc[0] || (is_class() && strncmp(t, "Fl_", 3)==0)) {
f.write_h_once("#include <FL/Fl.H>");
- f.write_h_once("#include <FL/%s.H>", t.c_str());
+ f.write_h_once("#include <FL/%s.H>", t);
}
- for (int n=0; n < NUM_EXTRA_CODE; n++) {
- if (!extra_code(n).empty() && isdeclare(extra_code(n).c_str()))
- f.write_h_once("%s", extra_code(n).c_str());
+ int n;
+ for (n=0; n < NUM_EXTRA_CODE; n++) {
+ const char* ec = extra_code(n);
+ if (ec && ec[0] && isdeclare(ec))
+ f.write_h_once("%s", ec);
}
if (callback() && is_name(callback())) {
int write_extern_declaration = 1;
@@ -1528,11 +1571,11 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
if (has_function("static void", buf))
write_extern_declaration = 0;
} else {
- if (has_toplevel_function(nullptr, buf))
+ if (has_toplevel_function(0, buf))
write_extern_declaration = 0;
}
if (write_extern_declaration)
- f.write_h_once("extern void %s(%s*, %s);", callback(), t.c_str(),
+ f.write_h_once("extern void %s(%s*, %s);", callback(), t,
user_data_type() ? user_data_type() : "void*");
}
const char* k = class_name(1);
@@ -1540,9 +1583,9 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
if (c && !k && !is_class()) {
f.write_c("\n");
if (!public_) f.write_c("static ");
- else f.write_h("extern %s *%s;\n", t.c_str(), c);
- if (strchr(c, '[') == nullptr) f.write_c("%s *%s=(%s *)0;\n", t.c_str(), c, t.c_str());
- else f.write_c("%s *%s={(%s *)0};\n", t.c_str(), c, t.c_str());
+ else f.write_h("extern %s *%s;\n", t, c);
+ if (strchr(c, '[') == 0) f.write_c("%s *%s=(%s *)0;\n", t, c, t);
+ else f.write_c("%s *%s={(%s *)0};\n", t, c, t);
}
if (callback() && !is_name(callback()) && (callback()[0] != '[')) {
// see if 'o' or 'v' used, to prevent unused argument warnings:
@@ -1557,9 +1600,9 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
}
const char* cn = callback_name(f);
if (k) {
- f.write_c("\nvoid %s::%s_i(%s*", k, cn, t.c_str());
+ f.write_c("\nvoid %s::%s_i(%s*", k, cn, t);
} else {
- f.write_c("\nstatic void %s(%s*", cn, t.c_str());
+ f.write_c("\nstatic void %s(%s*", cn, t);
}
if (use_o) f.write_c(" o");
const char* ut = user_data_type() ? user_data_type() : "void*";
@@ -1580,9 +1623,9 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
f.tag(FLD_MERGEBACK_TAG_WIDGET_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("}\n");
if (k) {
- f.write_c("void %s::%s(%s* o, %s v) {\n", k, cn, t.c_str(), ut);
+ f.write_c("void %s::%s(%s* o, %s v) {\n", k, cn, t, ut);
f.write_c("%s((%s*)(o", f.indent(1), k);
- Node* q = nullptr;
+ Node* q = 0;
for (Node* p = parent; p && p->is_widget(); q = p, p = p->parent)
f.write_c("->parent()");
if (!q || !q->is_a(FLD_NODE_TYPE_Widget_Class))
@@ -1601,20 +1644,20 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
}
void Widget_Node::write_code1(fld::io::Code_Writer& f) {
- std::string t = subclassname(this);
+ const char* t = subclassname(this);
const char* c = array_name(this);
if (c) {
if (class_name(1)) {
f.write_public(public_);
- f.write_h("%s%s *%s;\n", f.indent(1), t.c_str(), c);
+ f.write_h("%s%s *%s;\n", f.indent(1), t, c);
}
}
if (class_name(1) && callback() && !is_name(callback())) {
const char* cn = callback_name(f);
const char* ut = user_data_type() ? user_data_type() : "void*";
f.write_public(0);
- f.write_h("%sinline void %s_i(%s*, %s);\n", f.indent(1), cn, t.c_str(), ut);
- f.write_h("%sstatic void %s(%s*, %s);\n", f.indent(1), cn, t.c_str(), ut);
+ f.write_h("%sinline void %s_i(%s*, %s);\n", f.indent(1), cn, t, ut);
+ f.write_h("%sstatic void %s(%s*, %s);\n", f.indent(1), cn, t, ut);
}
// figure out if local variable will be used (prevent compiler warnings):
int wused = !name() && is_a(FLD_NODE_TYPE_Window);
@@ -1633,15 +1676,16 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
}
if (!f.varused) {
- for (int n=0; n < NUM_EXTRA_CODE; n++)
- if (!extra_code(n).empty() && !isdeclare(extra_code(n).c_str()))
+ int n;
+ for (n=0; n < NUM_EXTRA_CODE; n++) {
+ const char* ec = extra_code(n);
+ if (ec && ec[0] && !isdeclare(ec))
{
int instring = 0;
int inname = 0;
int incomment = 0;
int incppcomment = 0;
- std::string code = extra_code(n);
- for (ptr = code.c_str(); *ptr; ptr ++) {
+ for (ptr = ec; *ptr; ptr ++) {
if (instring) {
if (*ptr == '\\') ptr++;
else if (*ptr == '\"') instring = 0;
@@ -1673,27 +1717,28 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
}
}
}
+ }
}
f.write_c("%s{ ", f.indent());
write_comment_inline_c(f);
- if (f.varused) f.write_c("%s* o = ", t.c_str());
+ if (f.varused) f.write_c("%s* o = ", t);
if (name()) f.write_c("%s = ", name());
if (is_a(FLD_NODE_TYPE_Window)) {
// Handle special case where user is faking a Fl_Group type as a window,
// there is no 2-argument constructor in that case:
- if (t.find("Window")==t.npos)
- f.write_c("new %s(0, 0, %d, %d", t.c_str(), o->w(), o->h());
+ if (strstr(t, "Window") == 0)
+ f.write_c("new %s(0, 0, %d, %d", t, o->w(), o->h());
else
- f.write_c("new %s(%d, %d", t.c_str(), o->w(), o->h());
+ f.write_c("new %s(%d, %d", t, o->w(), o->h());
} else if (is_a(FLD_NODE_TYPE_Menu_Bar)
&& ((Menu_Bar_Node*)this)->is_sys_menu_bar()
&& is_in_class()) {
f.write_c("(%s*)new %s(%d, %d, %d, %d",
- t.c_str(), ((Menu_Bar_Node*)this)->sys_menubar_proxy_name(),
+ t, ((Menu_Bar_Node*)this)->sys_menubar_proxy_name(),
o->x(), o->y(), o->w(), o->h());
} else {
- f.write_c("new %s(%d, %d, %d, %d", t.c_str(), o->x(), o->y(), o->w(), o->h());
+ f.write_c("new %s(%d, %d, %d, %d", t, o->x(), o->y(), o->w(), o->h());
}
if (label() && *label()) {
f.write_c(", ");
@@ -1727,7 +1772,7 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
}
void Widget_Node::write_color(fld::io::Code_Writer& f, const char* field, Fl_Color color) {
- const char* color_name = nullptr;
+ const char* color_name = 0;
switch (color) {
case FL_FOREGROUND_COLOR: color_name = "FL_FOREGROUND_COLOR"; break;
case FL_BACKGROUND2_COLOR: color_name = "FL_BACKGROUND2_COLOR"; break;
@@ -1769,15 +1814,15 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
Fl_Widget* tplate = ((Widget_Node*)factory)->o;
const char* var = is_class() ? "this" : name() ? name() : "o";
- if (!tooltip().empty()) {
+ if (tooltip() && tooltip()[0]) {
f.write_c("%s%s->tooltip(",f.indent(), var);
switch (Fluid.proj.i18n.type) {
case FLD_I18N_TYPE_NONE : /* None */
- f.write_cstring(tooltip().c_str());
+ f.write_cstring(tooltip());
break;
case FLD_I18N_TYPE_GNU : /* GNU gettext */
f.write_c("%s(", Fluid.proj.i18n.gnu_function.c_str());
- f.write_cstring(tooltip().c_str());
+ f.write_cstring(tooltip());
f.write_c(")");
break;
case FLD_I18N_TYPE_POSIX : /* POSIX catgets */
@@ -1785,7 +1830,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
Fluid.proj.i18n.posix_file.empty() ? "_catalog" : Fluid.proj.i18n.posix_file.c_str(),
Fluid.proj.i18n.posix_set.c_str(),
msgnum() + 1);
- f.write_cstring(tooltip().c_str());
+ f.write_cstring(tooltip());
f.write_c(")");
break;
}
@@ -1796,7 +1841,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("%s%s->type(%d);\n", f.indent(), var, ((Fl_Spinner*)o)->type());
else if (o->type() != tplate->type() && !is_a(FLD_NODE_TYPE_Window))
f.write_c("%s%s->type(%d);\n", f.indent(), var, o->type());
- if (o->box() != tplate->box() || !subclass().empty())
+ if (o->box() != tplate->box() || subclass() && subclass()[0])
f.write_c("%s%s->box(FL_%s);\n", f.indent(), var, boxname(o->box()));
// write shortcut command if needed
@@ -1838,9 +1883,9 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
}
- if (o->color() != tplate->color() || !subclass().empty())
+ if (o->color() != tplate->color() || subclass() && subclass()[0])
write_color(f, "color", o->color());
- if (o->selection_color() != tplate->selection_color() || !subclass().empty())
+ if (o->selection_color() != tplate->selection_color() || subclass() && subclass()[0])
write_color(f, "selection_color", o->selection_color());
if (image) {
image->write_code(f, bind_image_, var);
@@ -1870,14 +1915,14 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("%s->deimage()->data_h(), 0, 1);\n", var);
}
}
- if (o->labeltype() != tplate->labeltype() || !subclass().empty())
+ if (o->labeltype() != tplate->labeltype() || subclass() && subclass()[0])
f.write_c("%s%s->labeltype(FL_%s);\n", f.indent(), var,
item_name(labeltypemenu, o->labeltype()));
- if (o->labelfont() != tplate->labelfont() || !subclass().empty())
+ if (o->labelfont() != tplate->labelfont() || subclass() && subclass()[0])
f.write_c("%s%s->labelfont(%d);\n", f.indent(), var, o->labelfont());
- if (o->labelsize() != tplate->labelsize() || !subclass().empty())
+ if (o->labelsize() != tplate->labelsize() || subclass() && subclass()[0])
f.write_c("%s%s->labelsize(%d);\n", f.indent(), var, o->labelsize());
- if (o->labelcolor() != tplate->labelcolor() || !subclass().empty())
+ if (o->labelcolor() != tplate->labelcolor() || subclass() && subclass()[0])
write_color(f, "labelcolor", o->labelcolor());
if (o->horizontal_label_margin() != tplate->horizontal_label_margin())
f.write_c("%s%s->horizontal_label_margin(%d);\n", f.indent(), var, o->horizontal_label_margin());
@@ -1946,7 +1991,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
} else if (ud) {
f.write_c("%s%s->user_data((void*)(%s));\n", f.indent(), var, ud);
}
- if (o->align() != tplate->align() || !subclass().empty()) {
+ if (o->align() != tplate->align() || subclass() && subclass()[0]) {
int i = o->align();
f.write_c("%s%s->align(Fl_Align(%s", f.indent(), var,
item_name(alignmenu, i & ~FL_ALIGN_INSIDE));
@@ -1954,7 +1999,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("));\n");
}
Fl_When ww = o->when();
- if (ww != tplate->when() || !subclass().empty())
+ if (ww != tplate->when() || subclass() && subclass()[0])
f.write_c("%s%s->when(%s);\n", f.indent(), var, when_symbol_name(ww));
if (!o->visible() && o->parent())
f.write_c("%s%s->hide();\n", f.indent(), var);
@@ -1974,13 +2019,13 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
void Widget_Node::write_extra_code(fld::io::Code_Writer& f) {
for (int n=0; n < NUM_EXTRA_CODE; n++)
- if (!extra_code(n).empty() && !isdeclare(extra_code(n).c_str()))
- f.write_c("%s%s\n", f.indent(), extra_code(n).c_str());
+ if (extra_code(n) && extra_code(n)[0] && !isdeclare(extra_code(n)))
+ f.write_c("%s%s\n", f.indent(), extra_code(n));
}
void Widget_Node::write_block_close(fld::io::Code_Writer& f) {
f.indentation--;
- f.write_c("%s} // %s* %s\n", f.indent(), subclassname(this).c_str(),
+ f.write_c("%s} // %s* %s\n", f.indent(), subclassname(this),
name() ? name() : "o");
}
@@ -1999,11 +2044,11 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
case 1: break;
case 2: f.write_string("protected"); break;
}
- if (!tooltip().empty()) {
+ if (tooltip() && tooltip()[0]) {
f.write_string("tooltip");
f.write_word(tooltip());
}
- if (!image_name().empty()) {
+ if (image_name() && image_name()[0]) {
if (scale_image_w_ || scale_image_h_)
f.write_string("scale_image {%d %d}", scale_image_w_, scale_image_h_);
f.write_string("image");
@@ -2011,7 +2056,7 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
f.write_string("compress_image %d", compress_image_);
}
if (bind_image_) f.write_string("bind_image 1");
- if (!inactive_name().empty()) {
+ if (inactive_name() && inactive_name()[0]) {
if (scale_deimage_w_ || scale_deimage_h_)
f.write_string("scale_deimage {%d %d}", scale_deimage_w_, scale_deimage_h_);
f.write_string("deimage");
@@ -2113,12 +2158,12 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
if (resizable()) f.write_string("resizable");
if (hotspot()) f.write_string(is_a(FLD_NODE_TYPE_Menu_Item) ? "divider" : "hotspot");
if (menu_headline()) f.write_string("headline");
- for (int n=0; n < NUM_EXTRA_CODE; n++) if (!extra_code(n).empty()) {
+ for (int n=0; n < NUM_EXTRA_CODE; n++) if (extra_code(n) && extra_code(n)[0]) {
f.write_indent(level+1);
f.write_string("code%d",n);
- f.write_word(extra_code(n).c_str());
+ f.write_word(extra_code(n));
}
- if (!subclass().empty()) {
+ if (subclass() && subclass()[0]) {
f.write_indent(level+1);
f.write_string("class");
f.write_word(subclass());
@@ -2153,11 +2198,11 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
image_name(f.read_word());
// starting in 2023, `image` is always followed by `compress_image`
// the code below is for compatibility with older .fl files
- std::string ext = fl_filename_ext_str(image_name());
- if ( (ext != ".jpg")
- && (ext != ".png")
- && (ext != ".svg")
- && (ext != ".svgz"))
+ const char *ext = fl_filename_ext(image_name());
+ if ( (strcmp(ext, ".jpg") != 0)
+ && (strcmp(ext, ".png") != 0)
+ && (strcmp(ext, ".svg") != 0)
+ && (strcmp(ext, ".svgz") != 0))
compress_image_ = 0; // if it is neither of those, default to uncompressed
} else if (!strcmp(c,"bind_image")) {
bind_image_ = (int)atol(f.read_word());
@@ -2172,11 +2217,11 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
inactive_name(f.read_word());
// starting in 2023, `deimage` is always followed by `compress_deimage`
// the code below is for compatibility with older .fl files
- std::string ext = fl_filename_ext_str(inactive_name());
- if ( (ext != ".jpg")
- && (ext != ".png")
- && (ext != ".svg")
- && (ext != ".svgz"))
+ const char *ext = fl_filename_ext(inactive_name());
+ if ( (strcmp(ext, ".jpg") != 0)
+ && (strcmp(ext, ".png") != 0)
+ && (strcmp(ext, ".svg") != 0)
+ && (strcmp(ext, ".svgz") != 0))
compress_deimage_ = 0; // if it is neither of those, default to uncompressed
} else if (!strcmp(c,"bind_deimage")) {
bind_deimage_ = (int)atol(f.read_word());
@@ -2258,19 +2303,19 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
} else if (!strcmp(c,"when")) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->when(x);
} else if (!strcmp(c,"minimum")) {
- if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),nullptr));
- if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->minimum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),0));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->minimum(strtod(f.read_word(),0));
} else if (!strcmp(c,"maximum")) {
- if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),nullptr));
- if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->maximum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),0));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->maximum(strtod(f.read_word(),0));
} else if (!strcmp(c,"step")) {
- if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),nullptr));
- if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->step(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),0));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->step(strtod(f.read_word(),0));
} else if (!strcmp(c,"value")) {
- if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),nullptr));
- if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->value(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),0));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->value(strtod(f.read_word(),0));
} else if ( (!strcmp(c,"slider_size") || !strcmp(c,"size")) && is_a(FLD_NODE_TYPE_Slider)) {
- ((Fl_Slider*)o)->slider_size(strtod(f.read_word(),nullptr));
+ ((Fl_Slider*)o)->slider_size(strtod(f.read_word(),0));
} else if (!strcmp(c,"textfont")) {
if (sscanf(f.read_word(),"%d",&x) == 1) {ft=(Fl_Font)x; textstuff(1,ft,s,cc);}
} else if (!strcmp(c,"textsize")) {
@@ -2290,7 +2335,7 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
} else if (!strcmp(c,"class")) {
subclass(f.read_word());
} else if (!strcmp(c,"shortcut")) {
- int shortcut = (int)strtol(f.read_word(),nullptr,0);
+ int shortcut = (int)strtol(f.read_word(),0,0);
if (is_button()) ((Fl_Button*)o)->shortcut(shortcut);
else if (is_a(FLD_NODE_TYPE_Input)) ((Fl_Input_*)o)->shortcut(shortcut);
else if (is_a(FLD_NODE_TYPE_Value_Input)) ((Fl_Value_Input*)o)->shortcut(shortcut);
@@ -2312,24 +2357,24 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
Fl_Menu_Item boxmenu1[] = {
// these extra ones are for looking up fdesign saved strings:
- {"NO_FRAME", 0,nullptr,(void *)FL_NO_BOX},
- {"ROUNDED3D_UPBOX", 0,nullptr,(void *)FL_ROUND_UP_BOX},
- {"ROUNDED3D_DOWNBOX", 0,nullptr,(void *)FL_ROUND_DOWN_BOX},
- {"OVAL3D_UPBOX", 0,nullptr,(void *)FL_ROUND_UP_BOX},
- {"OVAL3D_DOWNBOX", 0,nullptr,(void *)FL_ROUND_DOWN_BOX},
- {"0", 0,nullptr,(void *)ZERO_ENTRY},
- {"1", 0,nullptr,(void *)FL_UP_BOX},
- {"2", 0,nullptr,(void *)FL_DOWN_BOX},
- {"3", 0,nullptr,(void *)FL_FLAT_BOX},
- {"4", 0,nullptr,(void *)FL_BORDER_BOX},
- {"5", 0,nullptr,(void *)FL_SHADOW_BOX},
- {"6", 0,nullptr,(void *)FL_FRAME_BOX},
- {"7", 0,nullptr,(void *)FL_ROUNDED_BOX},
- {"8", 0,nullptr,(void *)FL_RFLAT_BOX},
- {"9", 0,nullptr,(void *)FL_RSHADOW_BOX},
- {"10", 0,nullptr,(void *)FL_UP_FRAME},
- {"11", 0,nullptr,(void *)FL_DOWN_FRAME},
- {nullptr}};
+ {"NO_FRAME", 0,0,(void *)FL_NO_BOX},
+ {"ROUNDED3D_UPBOX", 0,0,(void *)FL_ROUND_UP_BOX},
+ {"ROUNDED3D_DOWNBOX", 0,0,(void *)FL_ROUND_DOWN_BOX},
+ {"OVAL3D_UPBOX", 0,0,(void *)FL_ROUND_UP_BOX},
+ {"OVAL3D_DOWNBOX", 0,0,(void *)FL_ROUND_DOWN_BOX},
+ {"0", 0,0,(void *)ZERO_ENTRY},
+ {"1", 0,0,(void *)FL_UP_BOX},
+ {"2", 0,0,(void *)FL_DOWN_BOX},
+ {"3", 0,0,(void *)FL_FLAT_BOX},
+ {"4", 0,0,(void *)FL_BORDER_BOX},
+ {"5", 0,0,(void *)FL_SHADOW_BOX},
+ {"6", 0,0,(void *)FL_FRAME_BOX},
+ {"7", 0,0,(void *)FL_ROUNDED_BOX},
+ {"8", 0,0,(void *)FL_RFLAT_BOX},
+ {"9", 0,0,(void *)FL_RSHADOW_BOX},
+ {"10", 0,0,(void *)FL_UP_FRAME},
+ {"11", 0,0,(void *)FL_DOWN_FRAME},
+ {0}};
int lookup_symbol(const char *, int &, int numberok = 0);
@@ -2425,7 +2470,7 @@ int Widget_Node::read_fdesign(const char* propname, const char* value) {
}
void leave_live_mode_cb(Fl_Widget*, void*) {
- live_mode_cb(nullptr, nullptr);
+ live_mode_cb(0, 0);
}
Fl_Widget* Widget_Node::enter_live_mode(int) {
@@ -2472,10 +2517,10 @@ void Widget_Node::copy_properties() {
// copy all attributes common to all widget types
Fl_Widget* w = live_widget;
w->label(o->label());
- if (tooltip().empty())
- w->tooltip(nullptr);
+ if ((!tooltip() || !tooltip()[0]))
+ w->tooltip(0);
else
- w->copy_tooltip(tooltip().c_str());
+ w->copy_tooltip(tooltip());
w->type(o->type());
w->box(o->box());
w->color(o->color());
diff --git a/fluid/nodes/Widget_Node.h b/fluid/nodes/Widget_Node.h
index b2afa58a6..98a943333 100644
--- a/fluid/nodes/Widget_Node.h
+++ b/fluid/nodes/Widget_Node.h
@@ -19,7 +19,7 @@
#include "nodes/Node.h"
-#include <string>
+#include <FL/fl_string_functions.h>
#define NUM_EXTRA_CODE 4
@@ -30,7 +30,7 @@ extern void* const LOAD;
extern Node* current_node; // one of the selected ones
extern Widget_Node* current_widget; // one of the selected ones
-extern std::string subclassname(Node* l);
+extern const char* subclassname(Node* l);
extern int is_name(const char* c);
void selection_changed(Node* new_current);
Node* sort(Node* parent);
@@ -47,19 +47,19 @@ class Widget_Node : public Node
void setlabel(const char *) override;
/// Additional code blocks that can be inserted in the generated code
- std::string extra_code_[NUM_EXTRA_CODE];
+ char *extra_code_[NUM_EXTRA_CODE];
/// User can call the ctor for a class that is derived from the node class
- std::string subclass_;
+ char *subclass_;
/// Keep a copy the tooltip here, also always updates the widget's tooltip
- std::string tooltip_;
+ char *tooltip_;
/// Image name or file name.
- std::string image_name_;
+ char *image_name_;
/// Name or file name of deactivated image
- std::string inactive_name_;
+ char *inactive_name_;
/// Set's a widget's hotspot, or adds a divider to a menu item
- uchar hotspot_ = 0;
+ uchar hotspot_;
/// On menu items, set the "headline" flag
- bool menu_headline_ = false;
+ int menu_headline_;
protected:
@@ -67,7 +67,7 @@ protected:
/// 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
/// disabling the output of the "hide" property by the Widget Type.
- uchar override_visible_ = 0;
+ uchar override_visible_;
void write_static(fld::io::Code_Writer& f) override;
void write_code1(fld::io::Code_Writer& f) override;
@@ -83,58 +83,58 @@ protected:
public:
/// Pointer to widget for interactive editing.
- Fl_Widget* o = nullptr;
+ Fl_Widget* o;
/// Widget access mode, 0=private, 1=public, 2=protected
- int public_ = 1;
+ int public_;
// ---- Image stuff
/// Set the bind image flag for the active image
- int bind_image_ = 0;
+ int bind_image_;
/// Compress the active image when inlining into source code
- int compress_image_ = 1;
+ int compress_image_;
/// Scale the active image, great for hires screens
- int scale_image_w_ = 0, scale_image_h_ = 0;
+ int scale_image_w_, scale_image_h_;
/// Pointer to the shared image data of the active image
- Image_Asset* image = nullptr;
+ Image_Asset* image;
/// Set the bind image flag for the inactive image
- int bind_deimage_ = 0;
+ int bind_deimage_;
/// Compress the inactive image when inlining into source code
- int compress_deimage_ = 1;
+ int compress_deimage_;
/// Scale the inactive image
- int scale_deimage_w_ = 0, scale_deimage_h_ = 0;
+ int scale_deimage_w_, scale_deimage_h_;
/// Pointer to the shared image data of the inactive image
- Image_Asset* inactive = nullptr;
+ Image_Asset* inactive;
void setimage(Image_Asset *);
- std::string image_name() const { return image_name_; }
- void image_name(const std::string& name);
+ const char* image_name() const { return image_name_ ? image_name_ : ""; }
+ void image_name(const char *name);
void setinactive(Image_Asset *);
- std::string inactive_name() const { return inactive_name_; }
- void inactive_name(const std::string& name);
+ const char* inactive_name() const { return inactive_name_ ? inactive_name_ : ""; }
+ void inactive_name(const char *name);
- Widget_Node() = default;
- ~Widget_Node() override;
+ Widget_Node();
+ ~Widget_Node();
Node* make(Strategy strategy) override;
void open() override;
- const std::string& extra_code(int n) const { return extra_code_[n]; }
- void extra_code(int n, const std::string& code);
- std::string subclass() const { return subclass_; }
- void subclass(const std::string& name);
- std::string tooltip() const { return tooltip_; }
- void tooltip(const std::string& text);
+ const char* extra_code(int n) const { return extra_code_[n] ? extra_code_[n] : ""; }
+ void extra_code(int n, const char *code);
+ const char* subclass() const { return subclass_ ? subclass_ : ""; }
+ void subclass(const char *name);
+ const char* tooltip() const { return tooltip_ ? tooltip_ : ""; }
+ void tooltip(const char *text);
// Note: hotspot is misused by menu items to indicate a divider
uchar hotspot() const { return hotspot_; }
void hotspot(uchar v) { hotspot_ = v; }
uchar resizable() const;
void resizable(uchar v);
- bool menu_headline() const { return menu_headline_; }
- void menu_headline(bool v) { menu_headline_ = v; }
+ int menu_headline() const { return menu_headline_; }
+ void menu_headline(int v) { menu_headline_ = v; }
virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &);
virtual Fl_Menu_Item* subtypes();
diff --git a/fluid/nodes/Window_Node.cxx b/fluid/nodes/Window_Node.cxx
index 965d0e8d6..0c3b0f01c 100644
--- a/fluid/nodes/Window_Node.cxx
+++ b/fluid/nodes/Window_Node.cxx
@@ -115,9 +115,9 @@ void show_settings_cb(Fl_Widget *, void *) {
////////////////////////////////////////////////////////////////
Fl_Menu_Item window_type_menu[] = {
- {"Single",0,nullptr,(void*)FL_WINDOW},
- {"Double",0,nullptr,(void*)(FL_DOUBLE_WINDOW)},
- {nullptr}};
+ {"Single",0,0,(void*)FL_WINDOW},
+ {"Double",0,0,(void*)(FL_DOUBLE_WINDOW)},
+ {0}};
static int overlays_invisible;
@@ -132,7 +132,7 @@ public:
Window_Node *window;
int handle(int) override;
Overlay_Window(int W,int H) : Fl_Overlay_Window(W,H) {
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
callback((Fl_Callback*)close_cb);
}
void resize(int,int,int,int) override;
@@ -201,7 +201,7 @@ uchar *Overlay_Window::read_image(int &ww, int &hh) {
draw();
// Read the screen image...
- pixels = fl_read_image(nullptr, 0, 0, ww, hh);
+ pixels = fl_read_image(0, 0, 0, ww, hh);
fl_end_offscreen();
@@ -242,12 +242,12 @@ Node *Window_Node::make(Strategy strategy) {
}
if (!p) {
fl_message("Please select a function");
- return nullptr;
+ return 0;
}
Window_Node *myo = new Window_Node();
if (!this->o) {// template widget
this->o = new Fl_Window(100,100);
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
}
myo->factory = this;
myo->drag = 0;
@@ -265,7 +265,7 @@ Node *Window_Node::make(Strategy strategy) {
void Window_Node::add_child(Node* cc, Node* before) {
if (!cc->is_widget()) return;
Widget_Node* c = (Widget_Node*)cc;
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
((Fl_Window*)o)->insert(*(c->o), b);
o->redraw();
}
@@ -281,7 +281,7 @@ void Window_Node::remove_child(Node* cc) {
void Window_Node::move_child(Node* cc, Node* before) {
Widget_Node* c = (Widget_Node*)cc;
((Fl_Window*)o)->remove(c->o);
- Fl_Widget* b = before ? ((Widget_Node*)before)->o : nullptr;
+ Fl_Widget* b = before ? ((Widget_Node*)before)->o : 0;
((Fl_Window*)o)->insert(*(c->o), b);
o->redraw();
}
@@ -369,7 +369,7 @@ void Overlay_Window::resize(int X,int Y,int W,int H) {
Fl_Widget* t = resizable();
if (Fluid.proj.tree.allow_layout == 0) {
- resizable(nullptr);
+ resizable(0);
}
// do not set the mod flag if the window was not resized. In FLUID, all
@@ -401,7 +401,7 @@ void Window_Node::newdx() {
}
if (Fluid.show_guides && (drag & (FD_DRAG|FD_TOP|FD_LEFT|FD_BOTTOM|FD_RIGHT))) {
- Node *selection = nullptr; // special power for the first selected widget
+ Node *selection = 0; // special power for the first selected widget
for (Node *q=next; q && q->level>level; q = q->next) {
if (q->selected && q->is_true_widget()) {
selection = q;
@@ -591,7 +591,7 @@ void Window_Node::draw_overlay() {
int mybx,myby,mybr,mybt;
int mysx,mysy,mysr,myst;
mybx = mysx = o->w(); myby = mysy = o->h(); mybr = mysr = 0; mybt = myst = 0;
- Node *selection = nullptr; // special power for the first selected widget
+ Node *selection = 0; // special power for the first selected widget
for (Node *q=next; q && q->level>level; q = q->next)
if (q->selected && q->is_true_widget()) {
if (!selection) selection = q;
@@ -672,7 +672,7 @@ void Window_Node::fix_overlay() {
// check if we must redraw any parent of tabs/wizard type
void check_redraw_corresponding_parent(Node *s) {
- Widget_Node * prev_parent = nullptr;
+ Widget_Node * prev_parent = 0;
if( !s || !s->selected || !s->is_widget()) return;
for (Node *i=s; i && i->parent; i=i->parent) {
if (i->is_a(FLD_NODE_TYPE_Group) && prev_parent) {
@@ -743,7 +743,7 @@ void toggle_guides(Fl_Widget *,void *) {
This is called from the check button in the Settings dialog.
*/
void toggle_guides_cb(Fl_Check_Button *o, void *v) {
- toggle_guides(nullptr, nullptr);
+ toggle_guides(0, 0);
}
/**
@@ -789,7 +789,7 @@ void toggle_ghosted_outline_cb(Fl_Check_Button *,void *) {
This is called from the check button in the Settings dialog.
*/
void toggle_restricted_cb(Fl_Check_Button *o, void *v) {
- toggle_restricted(nullptr, nullptr);
+ toggle_restricted(0, 0);
}
extern void select(Node *,int);
@@ -913,7 +913,7 @@ int Window_Node::popupx = 0x7FFFFFFF; // mark as invalid (MAXINT)
int Window_Node::popupy = 0x7FFFFFFF;
int Window_Node::handle(int event) {
- static Node* selection = nullptr;
+ static Node* selection = 0;
switch (event) {
case FL_DND_ENTER:
// printf("DND enter\n");
@@ -945,11 +945,11 @@ int Window_Node::handle(int event) {
case FL_PASTE:
// printf("DND paste\n");
{ Node *prototype = typename_to_prototype(Fl::event_text());
- if (prototype==nullptr) {
+ if (prototype==0) {
// it's not a FLUID type, so it could be the filename of an image
const char *cfn = Fl::event_text();
// printf("DND is filename %s?\n", cfn);
- if ((cfn == nullptr) || (*cfn == 0)) return 0;
+ if ((cfn == 0) || (*cfn == 0)) return 0;
if (strlen(cfn) >= FL_PATH_MAX) return 0;
char fn[FL_PATH_MAX+1];
// some platform prepend "file://" or "computer://" or similar text
@@ -973,7 +973,7 @@ int Window_Node::handle(int event) {
if (!img || (img->ld() < 0)) return 0;
// ok, so it is an image - now add it as image() or deimage() to the widget
// printf("DND check for target %s\n", fn);
- Widget_Node *tgt = nullptr;
+ Widget_Node *tgt = 0;
for (Node* i=next; i && i->level>level; i=i->next) {
if (i->is_widget()) {
Widget_Node* myo = (Widget_Node*)i;
@@ -1022,7 +1022,7 @@ int Window_Node::handle(int event) {
}
popupx = 0x7FFFFFFF;
popupy = 0x7FFFFFFF; // mark as invalid (MAXINT)
- in_this_only = nullptr;
+ in_this_only = 0;
widget_browser->display(Fluid.proj.tree.current);
widget_browser->rebuild();
return 1;
@@ -1039,7 +1039,7 @@ int Window_Node::handle(int event) {
const Fl_Menu_Item* m = New_Menu->popup(mx,my,"New",myprev);
if (m && m->callback()) {myprev = m; m->do_callback(this->o);}
popupx = 0x7FFFFFFF; popupy = 0x7FFFFFFF; // mark as invalid (MAXINT)
- in_this_only = nullptr;
+ in_this_only = 0;
return 1;
}
// find the innermost item clicked on:
@@ -1178,7 +1178,7 @@ int Window_Node::handle(int event) {
return 1;
case 'o':
- toggle_overlays(nullptr, nullptr);
+ toggle_overlays(0, 0);
break;
default:
@@ -1189,8 +1189,8 @@ int Window_Node::handle(int event) {
in_this_only = this; // modifies how some menu items work.
const Fl_Menu_Item* m = Fluid.main_menu->test_shortcut();
if (m && m->callback()) m->do_callback(this->o);
- in_this_only = nullptr;
- return (m != nullptr);}
+ in_this_only = 0;
+ return (m != 0);}
default:
return 0;
@@ -1310,7 +1310,7 @@ int Window_Node::read_fdesign(const char* propname, const char* value) {
Widget_Class_Node Widget_Class_Node::prototype;
-Widget_Class_Node *current_widget_class = nullptr;
+Widget_Class_Node *current_widget_class = 0;
/**
Create and add a new Widget Class node.
@@ -1330,7 +1330,7 @@ Node *Widget_Class_Node::make(Strategy strategy) {
if (!this->o) {// template widget
this->o = new Fl_Window(100,100);
- Fl_Group::current(nullptr);
+ Fl_Group::current(0);
}
myo->factory = this;
myo->drag = 0;
@@ -1369,7 +1369,7 @@ void Widget_Class_Node::read_property(fld::io::Project_Reader &f, const char *c)
// This is useful for classes that contain a namespace component
static const char *trimclassname(const char *n) {
if (!n)
- return nullptr;
+ return 0;
const char *nn;
while((nn = strstr(n, "::"))) {
n = nn + 2;
diff --git a/fluid/nodes/Window_Node.h b/fluid/nodes/Window_Node.h
index 422326734..6403dd78e 100644
--- a/fluid/nodes/Window_Node.h
+++ b/fluid/nodes/Window_Node.h
@@ -72,8 +72,8 @@ protected:
void setlabel(const char *) override;
void write_code1(fld::io::Code_Writer& f) override;
void write_code2(fld::io::Code_Writer& f) override;
- Widget_Node *_make() override {return nullptr;} // we don't call this
- Fl_Widget *widget(int,int,int,int) override {return nullptr;}
+ Widget_Node *_make() override {return 0;} // we don't call this
+ Fl_Widget *widget(int,int,int,int) override {return 0;}
int recalc; // set by fix_overlay()
void moveallchildren(int key=0);
Type type() const override { return FLD_NODE_TYPE_Window; }
@@ -92,7 +92,7 @@ public:
numselected(0),
recalc(0),
modal(0), non_modal(0),
- xclass(nullptr),
+ xclass(0),
sr_min_w(0), sr_min_h(0), sr_max_w(0), sr_max_h(0)
{ }
uchar modal, non_modal;
@@ -134,7 +134,7 @@ public:
static Widget_Class_Node prototype;
protected:
- Fl_Menu_Item* subtypes() override {return nullptr;}
+ Fl_Menu_Item* subtypes() override {return 0;}
public:
Widget_Class_Node() {
diff --git a/fluid/nodes/factory.cxx b/fluid/nodes/factory.cxx
index 90a1c4687..792a9ff72 100644
--- a/fluid/nodes/factory.cxx
+++ b/fluid/nodes/factory.cxx
@@ -89,11 +89,11 @@
// ---- Browser_Base ----
static Fl_Menu_Item browser_base_type_menu[] = {
- {"No Select", 0, nullptr, (void*)nullptr},
- {"Select", 0, nullptr, (void*)FL_SELECT_BROWSER},
- {"Hold", 0, nullptr, (void*)FL_HOLD_BROWSER},
- {"Multi", 0, nullptr, (void*)FL_MULTI_BROWSER},
- {nullptr}
+ {"No Select", 0, 0, (void*)0},
+ {"Select", 0, 0, (void*)FL_SELECT_BROWSER},
+ {"Hold", 0, 0, (void*)FL_HOLD_BROWSER},
+ {"Multi", 0, 0, (void*)FL_MULTI_BROWSER},
+ {0}
};
/**
@@ -361,9 +361,9 @@ Valuator_Node Valuator_Node::prototype;
// ---- Counter ----
static Fl_Menu_Item counter_type_menu[] = {
- { "Normal", 0, nullptr, (void*)nullptr },
- { "Simple", 0, nullptr, (void*)FL_SIMPLE_COUNTER },
- { nullptr }
+ { "Normal", 0, 0, (void*)0 },
+ { "Simple", 0, 0, (void*)FL_SIMPLE_COUNTER },
+ { 0 }
};
/**
@@ -441,10 +441,10 @@ Adjuster_Node Adjuster_Node::prototype;
// ---- Dial ----
static Fl_Menu_Item dial_type_menu[] = {
- { "Dot", 0, nullptr, (void*)nullptr },
- { "Line", 0, nullptr, (void*)FL_LINE_DIAL },
- { "Fill", 0, nullptr, (void*)FL_FILL_DIAL },
- { nullptr }
+ { "Dot", 0, 0, (void*)0 },
+ { "Line", 0, 0, (void*)FL_LINE_DIAL },
+ { "Fill", 0, 0, (void*)FL_FILL_DIAL },
+ { 0 }
};
/**
@@ -478,9 +478,9 @@ Dial_Node Dial_Node::prototype;
// ---- Roller ----
static Fl_Menu_Item roller_type_menu[] = {
- { "Vertical", 0, nullptr, (void*)nullptr },
- { "Horizontal", 0, nullptr, (void*)FL_HORIZONTAL },
- { nullptr }
+ { "Vertical", 0, 0, (void*)0 },
+ { "Horizontal", 0, 0, (void*)FL_HORIZONTAL },
+ { 0 }
};
/**
@@ -516,13 +516,13 @@ Roller_Node Roller_Node::prototype;
// ---- Slider ----
static Fl_Menu_Item slider_type_menu[] = {
- { "Vertical", 0, nullptr, (void*)nullptr },
- { "Horizontal", 0, nullptr, (void*)FL_HOR_SLIDER },
- { "Vert Fill", 0, nullptr, (void*)FL_VERT_FILL_SLIDER },
- { "Horz Fill", 0, nullptr, (void*)FL_HOR_FILL_SLIDER },
- { "Vert Knob", 0, nullptr, (void*)FL_VERT_NICE_SLIDER },
- { "Horz Knob", 0, nullptr, (void*)FL_HOR_NICE_SLIDER },
- { nullptr }
+ { "Vertical", 0, 0, (void*)0 },
+ { "Horizontal", 0, 0, (void*)FL_HOR_SLIDER },
+ { "Vert Fill", 0, 0, (void*)FL_VERT_FILL_SLIDER },
+ { "Horz Fill", 0, 0, (void*)FL_HOR_FILL_SLIDER },
+ { "Vert Knob", 0, 0, (void*)FL_VERT_NICE_SLIDER },
+ { "Horz Knob", 0, 0, (void*)FL_HOR_NICE_SLIDER },
+ { 0 }
};
/**
@@ -560,9 +560,9 @@ Slider_Node Slider_Node::prototype;
// ---- Scrollbar ----
static Fl_Menu_Item scrollbar_type_menu[] = {
- { "Vertical", 0, nullptr, (void*)nullptr },
- { "Horizontal", 0, nullptr, (void*)FL_HOR_SLIDER },
- { nullptr }
+ { "Vertical", 0, 0, (void*)0 },
+ { "Horizontal", 0, 0, (void*)FL_HOR_SLIDER },
+ { 0 }
};
/**
@@ -718,12 +718,12 @@ Value_Output_Node Value_Output_Node::prototype;
// ---- Input ----
static Fl_Menu_Item input_type_menu[] = {
- { "Normal", 0, nullptr, (void*)nullptr },
- { "Multiline", 0, nullptr, (void*)FL_MULTILINE_INPUT },
- { "Secret", 0, nullptr, (void*)FL_SECRET_INPUT },
- { "Int", 0, nullptr, (void*)FL_INT_INPUT },
- { "Float", 0, nullptr, (void*)FL_FLOAT_INPUT },
- {nullptr}
+ { "Normal", 0, 0, (void*)0 },
+ { "Multiline", 0, 0, (void*)FL_MULTILINE_INPUT },
+ { "Secret", 0, 0, (void*)FL_SECRET_INPUT },
+ { "Int", 0, 0, (void*)FL_INT_INPUT },
+ { "Float", 0, 0, (void*)FL_FLOAT_INPUT },
+ {0}
};
/**
@@ -790,7 +790,7 @@ public:
typedef Input_Node super;
static File_Input_Node prototype;
private:
- Fl_Menu_Item *subtypes() override { return nullptr; } // Don't inherit.
+ Fl_Menu_Item *subtypes() override { return 0; } // Don't inherit.
public:
void ideal_size(int &w, int &h) override {
auto layout = Fluid.proj.layout;
@@ -816,9 +816,9 @@ File_Input_Node File_Input_Node::prototype;
// ---- Output ----
static Fl_Menu_Item output_type_menu[] = {
- { "Normal", 0, nullptr, (void*)FL_NORMAL_OUTPUT },
- { "Multiline", 0, nullptr, (void*)FL_MULTILINE_OUTPUT },
- { nullptr }
+ { "Normal", 0, 0, (void*)FL_NORMAL_OUTPUT },
+ { "Multiline", 0, 0, (void*)FL_MULTILINE_OUTPUT },
+ { 0 }
};
/**
@@ -936,7 +936,7 @@ Text_Editor_Node Text_Editor_Node::prototype;
/** Use this terminal instead of Fl_Terminal to capture resize actions. */
class Fl_Terminal_Proxy : public Fl_Terminal {
public:
- Fl_Terminal_Proxy(int x, int y, int w, int h, const char *l=nullptr)
+ Fl_Terminal_Proxy(int x, int y, int w, int h, const char *l=0)
: Fl_Terminal(x, y, w, h, l) { }
void print_sample_text() {
clear_screen_home(false);
@@ -955,7 +955,7 @@ public:
Fl_Font tfont_;
int tsize_;
Fl_Color tcolor_;
- Fl_Batchmode_Terminal(int x, int y, int w, int h, const char *l=nullptr)
+ Fl_Batchmode_Terminal(int x, int y, int w, int h, const char *l=0)
: Fl_Group(x, y, w, h, l)
{ // set the defaults that Fl_Terminal would set
box(FL_DOWN_BOX);
@@ -987,7 +987,7 @@ public:
// Older .fl files with Fl_Simple_Terminal will create a Fl_Terminal instead.
const char *alt_type_name() override { return "Fl_Simple_Terminal"; }
Fl_Widget *widget(int x, int y, int w, int h) override {
- Fl_Widget *ret = nullptr;
+ Fl_Widget *ret = 0;
if (Fluid.batch_mode) {
ret = new Fl_Batchmode_Terminal(x, y, w, h);
} else {
@@ -1123,9 +1123,9 @@ Progress_Node Progress_Node::prototype;
// ---- Spinner ----
static Fl_Menu_Item spinner_type_menu[] = {
- { "Integer", 0, nullptr, (void*)FL_INT_INPUT },
- { "Float", 0, nullptr, (void*)FL_FLOAT_INPUT },
- { nullptr }
+ { "Integer", 0, 0, (void*)FL_INT_INPUT },
+ { "Float", 0, 0, (void*)FL_FLOAT_INPUT },
+ { 0 }
};
/**
@@ -1273,7 +1273,7 @@ static Node *known_types[] = {
lower case 't' in type.
\param[in] strategy add after current or as last child
\param[in] and_open if set to true, call open() on the widget after creating it
- \return the newly created type or nullptr
+ \return the newly created type or 0
\see add_new_widget_from_file(const char*, int)
add_new_widget_from_user(Node*, int)
@@ -1403,7 +1403,7 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
\param[in] inName find the right prototype by this name
\param[in] strategy where to add the node
\param[in] and_open if set to true, call open() on the widget after creating it
- \return the newly created type or nullptr
+ \return the newly created type or 0
\see add_new_widget_from_file(const char*, int)
add_new_widget_from_user(Node*, int)
@@ -1414,14 +1414,14 @@ Node *add_new_widget_from_user(const char *inName, Strategy strategy, bool and_o
if (prototype)
return add_new_widget_from_user(prototype, strategy, and_open);
else
- return nullptr;
+ return 0;
}
/**
Callback for all non-widget menu items.
*/
static void cbf(Fl_Widget *, void *v) {
- Node *t = nullptr;
+ Node *t = 0;
if (Fluid.proj.tree.current && Fluid.proj.tree.current->can_have_children())
t = ((Node*)v)->make(Strategy::AS_LAST_CHILD);
else
@@ -1436,7 +1436,7 @@ static void cbf(Fl_Widget *, void *v) {
wants to create.
*/
static void cb(Fl_Widget *, void *v) {
- Node *t = nullptr;
+ Node *t = 0;
if (Fluid.proj.tree.current && Fluid.proj.tree.current->can_have_children())
t = add_new_widget_from_user((Node*)v, Strategy::AS_LAST_CHILD);
else
@@ -1449,7 +1449,7 @@ static void cb(Fl_Widget *, void *v) {
defined further up in this file.
*/
Fl_Menu_Item New_Menu[] = {
- {"Code",0,nullptr,nullptr,FL_SUBMENU},
+ {"Code",0,0,0,FL_SUBMENU},
{"Function/Method",0,cbf,(void*)&Function_Node::prototype},
{"Code",0,cbf,(void*)&Code_Node::prototype},
{"Code Block",0,cbf,(void*)&CodeBlock_Node::prototype},
@@ -1459,70 +1459,70 @@ Fl_Menu_Item New_Menu[] = {
{"Widget Class",0,cb,(void*)&Widget_Class_Node::prototype},
{"Comment",0,cbf,(void*)&Comment_Node::prototype},
{"Inlined Data",0,cbf,(void*)&Data_Node::prototype},
- {nullptr},
- {"Group",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Window_Node::prototype},
- {nullptr,0,cb,(void*)&Group_Node::prototype},
- {nullptr,0,cb,(void*)&Pack_Node::prototype},
- {nullptr,0,cb,(void*)&Flex_Node::prototype},
- {nullptr,0,cb,(void*)&Tabs_Node::prototype},
- {nullptr,0,cb,(void*)&Scroll_Node::prototype},
- {nullptr,0,cb,(void*)&Tile_Node::prototype},
- {nullptr,0,cb,(void*)&Wizard_Node::prototype},
- {nullptr,0,cb,(void*)&Grid_Node::prototype},
- {nullptr},
- {"Buttons",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Button_Node::prototype},
- {nullptr,0,cb,(void*)&Return_Button_Node::prototype},
- {nullptr,0,cb,(void*)&Light_Button_Node::prototype},
- {nullptr,0,cb,(void*)&Check_Button_Node::prototype},
- {nullptr,0,cb,(void*)&Repeat_Button_Node::prototype},
- {nullptr,0,cb,(void*)&Round_Button_Node::prototype},
- {nullptr},
- {"Valuators",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Slider_Node::prototype},
- {nullptr,0,cb,(void*)&Scrollbar_Node::prototype},
- {nullptr,0,cb,(void*)&Value_Slider_Node::prototype},
- {nullptr,0,cb,(void*)&Adjuster_Node::prototype},
- {nullptr,0,cb,(void*)&Counter_Node::prototype},
- {nullptr,0,cb,(void*)&Spinner_Node::prototype},
- {nullptr,0,cb,(void*)&Dial_Node::prototype},
- {nullptr,0,cb,(void*)&Roller_Node::prototype},
- {nullptr,0,cb,(void*)&Value_Input_Node::prototype},
- {nullptr,0,cb,(void*)&Value_Output_Node::prototype},
- {nullptr},
- {"Text",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Input_Node::prototype},
- {nullptr,0,cb,(void*)&Output_Node::prototype},
- {nullptr,0,cb,(void*)&Text_Editor_Node::prototype},
- {nullptr,0,cb,(void*)&Text_Display_Node::prototype},
- {nullptr,0,cb,(void*)&File_Input_Node::prototype},
- {nullptr,0,cb,(void*)&Terminal_Node::prototype},
- {nullptr},
- {"Menus",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Menu_Bar_Node::prototype},
- {nullptr,0,cb,(void*)&Menu_Button_Node::prototype},
- {nullptr,0,cb,(void*)&Choice_Node::prototype},
- {nullptr,0,cb,(void*)&Input_Choice_Node::prototype},
- {nullptr,0,cb, (void*)&Submenu_Node::prototype},
- {nullptr,0,cb, (void*)&Menu_Item_Node::prototype},
+ {0},
+ {"Group",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Window_Node::prototype},
+ {0,0,cb,(void*)&Group_Node::prototype},
+ {0,0,cb,(void*)&Pack_Node::prototype},
+ {0,0,cb,(void*)&Flex_Node::prototype},
+ {0,0,cb,(void*)&Tabs_Node::prototype},
+ {0,0,cb,(void*)&Scroll_Node::prototype},
+ {0,0,cb,(void*)&Tile_Node::prototype},
+ {0,0,cb,(void*)&Wizard_Node::prototype},
+ {0,0,cb,(void*)&Grid_Node::prototype},
+ {0},
+ {"Buttons",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Button_Node::prototype},
+ {0,0,cb,(void*)&Return_Button_Node::prototype},
+ {0,0,cb,(void*)&Light_Button_Node::prototype},
+ {0,0,cb,(void*)&Check_Button_Node::prototype},
+ {0,0,cb,(void*)&Repeat_Button_Node::prototype},
+ {0,0,cb,(void*)&Round_Button_Node::prototype},
+ {0},
+ {"Valuators",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Slider_Node::prototype},
+ {0,0,cb,(void*)&Scrollbar_Node::prototype},
+ {0,0,cb,(void*)&Value_Slider_Node::prototype},
+ {0,0,cb,(void*)&Adjuster_Node::prototype},
+ {0,0,cb,(void*)&Counter_Node::prototype},
+ {0,0,cb,(void*)&Spinner_Node::prototype},
+ {0,0,cb,(void*)&Dial_Node::prototype},
+ {0,0,cb,(void*)&Roller_Node::prototype},
+ {0,0,cb,(void*)&Value_Input_Node::prototype},
+ {0,0,cb,(void*)&Value_Output_Node::prototype},
+ {0},
+ {"Text",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Input_Node::prototype},
+ {0,0,cb,(void*)&Output_Node::prototype},
+ {0,0,cb,(void*)&Text_Editor_Node::prototype},
+ {0,0,cb,(void*)&Text_Display_Node::prototype},
+ {0,0,cb,(void*)&File_Input_Node::prototype},
+ {0,0,cb,(void*)&Terminal_Node::prototype},
+ {0},
+ {"Menus",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Menu_Bar_Node::prototype},
+ {0,0,cb,(void*)&Menu_Button_Node::prototype},
+ {0,0,cb,(void*)&Choice_Node::prototype},
+ {0,0,cb,(void*)&Input_Choice_Node::prototype},
+ {0,0,cb, (void*)&Submenu_Node::prototype},
+ {0,0,cb, (void*)&Menu_Item_Node::prototype},
{"Checkbox Menu Item",0,cb, (void*)&Checkbox_Menu_Item_Node::prototype},
{"Radio Menu Item",0,cb, (void*)&Radio_Menu_Item_Node::prototype},
- {nullptr},
- {"Browsers",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Browser_Node::prototype},
- {nullptr,0,cb,(void*)&Check_Browser_Node::prototype},
- {nullptr,0,cb,(void*)&File_Browser_Node::prototype},
- {nullptr,0,cb,(void*)&Tree_Node::prototype},
- {nullptr,0,cb,(void*)&Help_View_Node::prototype},
- {nullptr,0,cb,(void*)&Table_Node::prototype},
- {nullptr},
- {"Other",0,nullptr,nullptr,FL_SUBMENU},
- {nullptr,0,cb,(void*)&Box_Node::prototype},
- {nullptr,0,cb,(void*)&Clock_Node::prototype},
- {nullptr,0,cb,(void*)&Progress_Node::prototype},
- {nullptr},
- {nullptr}};
+ {0},
+ {"Browsers",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Browser_Node::prototype},
+ {0,0,cb,(void*)&Check_Browser_Node::prototype},
+ {0,0,cb,(void*)&File_Browser_Node::prototype},
+ {0,0,cb,(void*)&Tree_Node::prototype},
+ {0,0,cb,(void*)&Help_View_Node::prototype},
+ {0,0,cb,(void*)&Table_Node::prototype},
+ {0},
+ {"Other",0,0,0,FL_SUBMENU},
+ {0,0,cb,(void*)&Box_Node::prototype},
+ {0,0,cb,(void*)&Clock_Node::prototype},
+ {0,0,cb,(void*)&Progress_Node::prototype},
+ {0},
+ {0}};
#include <FL/Fl_Multi_Label.H>
@@ -1532,8 +1532,8 @@ Fl_Menu_Item New_Menu[] = {
The icon may be null. If ic is null only the text is assigned
to the label and Fl_Multi_Label is not used.
\param[in] mi pointer to tme menu item that will be modified
- \param[in] ic icon for the menu, may be nullptr
- \param[in] txt new label text, may *not* be nullptr, will not be copied
+ \param[in] ic icon for the menu, may be 0
+ \param[in] txt new label text, may *not* be 0, will not be copied
*/
static void make_iconlabel(Fl_Menu_Item *mi, Fl_Image *ic, const char *txt)
{
@@ -1580,12 +1580,12 @@ void fill_in_New_Menu() {
Find the correct prototype for a given type name.
\param[in] inName a C string that must match type_name() or alt_type_name() of
one of the known Node classes.
- \return the matching prototype or nullptr
+ \return the matching prototype or 0
*/
Node *typename_to_prototype(const char *inName)
{
- if (inName==nullptr || *inName==0)
- return nullptr;
+ if (inName==0 || *inName==0)
+ return 0;
for (unsigned i = 0; i < sizeof(known_types)/sizeof(*known_types); i++) {
Node *prototype = known_types[i];
if (fl_ascii_strcasecmp(inName, prototype->type_name())==0)
@@ -1593,7 +1593,7 @@ Node *typename_to_prototype(const char *inName)
if (fl_ascii_strcasecmp(inName, prototype->alt_type_name())==0)
return prototype;
}
- return nullptr;
+ return 0;
}
/**
@@ -1605,7 +1605,7 @@ Node *typename_to_prototype(const char *inName)
\param[in] inName a C string that described the type we want
\param[in] strategy add after current or as last child
- \return the node that was created or nullptr
+ \return the node that was created or 0
\see add_new_widget_from_file(const char*, int)
add_new_widget_from_user(Node*, int)
add_new_widget_from_user(const char*, int)
@@ -1613,7 +1613,7 @@ Node *typename_to_prototype(const char *inName)
Node *add_new_widget_from_file(const char *inName, Strategy strategy) {
Node *prototype = typename_to_prototype(inName);
if (!prototype)
- return nullptr;
+ return 0;
Node *new_node = prototype->make(strategy);
return new_node;
}