diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-03-08 00:14:09 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2025-03-08 00:14:27 +0100 |
| commit | 15ad447e2a0301b2aa4ea350615ae71f0e5e5ef5 (patch) | |
| tree | 706f8f9a6317f1074951e6174a4857ebafbca117 /fluid/nodes | |
| parent | ca22660bbb7efe4b38ab5af6a233a1ef5ef33389 (diff) | |
Fluid: last incremental chage, restructuring
Diffstat (limited to 'fluid/nodes')
| -rw-r--r-- | fluid/nodes/Fl_Button_Type.cxx | 7 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Button_Type.h | 4 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Function_Type.cxx | 67 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Function_Type.h | 66 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Grid_Type.cxx | 17 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Grid_Type.h | 12 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Group_Type.cxx | 15 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Group_Type.h | 10 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Menu_Type.cxx | 28 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Menu_Type.h | 18 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Type.cxx | 38 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Type.h | 42 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Widget_Type.cxx | 28 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Widget_Type.h | 18 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Window_Type.cxx | 24 | ||||
| -rw-r--r-- | fluid/nodes/Fl_Window_Type.h | 16 |
16 files changed, 214 insertions, 196 deletions
diff --git a/fluid/nodes/Fl_Button_Type.cxx b/fluid/nodes/Fl_Button_Type.cxx index 18620b477..2d3b7f31f 100644 --- a/fluid/nodes/Fl_Button_Type.cxx +++ b/fluid/nodes/Fl_Button_Type.cxx @@ -25,7 +25,8 @@ #include "nodes/Fl_Button_Type.h" #include "app/Fd_Snap_Action.h" -#include "io/file.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" #include <FL/Fl.H> #include <FL/Fl_Button.H> @@ -65,7 +66,7 @@ Fl_Widget *Fl_Button_Type::widget(int x, int y, int w, int h) { return new Fl_Button(x, y, w, h, "Button"); } -void Fl_Button_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Button_Type::write_properties(fld::io::Project_Writer &f) { Fl_Widget_Type::write_properties(f); Fl_Button *btn = (Fl_Button*)o; if (btn->compact()) { @@ -74,7 +75,7 @@ void Fl_Button_Type::write_properties(Fd_Project_Writer &f) { } } -void Fl_Button_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Button_Type::read_property(fld::io::Project_Reader &f, const char *c) { Fl_Button *btn = (Fl_Button*)o; if (!strcmp(c, "compact")) { btn->compact((uchar)atol(f.read_word())); diff --git a/fluid/nodes/Fl_Button_Type.h b/fluid/nodes/Fl_Button_Type.h index d513c1398..4229ac82d 100644 --- a/fluid/nodes/Fl_Button_Type.h +++ b/fluid/nodes/Fl_Button_Type.h @@ -35,8 +35,8 @@ public: int is_button() const FL_OVERRIDE { return 1; } ID id() const FL_OVERRIDE { return ID_Button; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Button) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; void copy_properties() FL_OVERRIDE; }; diff --git a/fluid/nodes/Fl_Function_Type.cxx b/fluid/nodes/Fl_Function_Type.cxx index f8845dcdd..5778324bf 100644 --- a/fluid/nodes/Fl_Function_Type.cxx +++ b/fluid/nodes/Fl_Function_Type.cxx @@ -19,8 +19,9 @@ #include "app/fluid.h" #include "app/mergeback.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Group_Type.h" #include "panels/function_panel.h" @@ -230,7 +231,7 @@ Fl_Type *Fl_Function_Type::make(Strategy strategy) { - "C" is written if we want a C signature instead of C++ - "return_type" is followed by the return type of the function */ -void Fl_Function_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Function_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); switch (public_) { case 0: f.write_string("private"); break; @@ -247,7 +248,7 @@ void Fl_Function_Type::write_properties(Fd_Project_Writer &f) { Read function specific properties fron an .fl file. \param[in] c read from this string */ -void Fl_Function_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Function_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"private")) { public_ = 0; } else if (!strcmp(c,"protected")) { @@ -407,9 +408,9 @@ static void clean_function_for_implementation(char *out, const char *function_na /** Write the code for the source and the header file. This writes the code that goes \b before all children of this class. - \see write_code2(Fd_Code_Writer& f) + \see write_code2(fld::io::Code_Writer& f) */ -void Fl_Function_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Function_Type::write_code1(fld::io::Code_Writer& f) { constructor=0; havewidgets = 0; Fl_Type *child; @@ -526,9 +527,9 @@ void Fl_Function_Type::write_code1(Fd_Code_Writer& f) { /** Write the code for the source and the header file. This writes the code that goes \b after all children of this class. - \see write_code1(Fd_Code_Writer& f) + \see write_code1(fld::io::Code_Writer& f) */ -void Fl_Function_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Function_Type::write_code2(fld::io::Code_Writer& f) { Fl_Type *child; const char *var = "w"; char havechildren = 0; @@ -664,7 +665,7 @@ BREAK2: /** Grab changes from an external editor and write this node. */ -void Fl_Code_Type::write(Fd_Project_Writer &f) { +void Fl_Code_Type::write(fld::io::Project_Writer &f) { // External editor changes? If so, load changes into ram, update mtime/size if ( handle_editor_changes() == 1 ) { main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents @@ -675,7 +676,7 @@ void Fl_Code_Type::write(Fd_Project_Writer &f) { /** Write the code block with the correct indentation. */ -void Fl_Code_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Code_Type::write_code1(fld::io::Code_Writer& f) { // External editor changes? If so, load changes into ram, update mtime/size if ( handle_editor_changes() == 1 ) { main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents @@ -789,7 +790,7 @@ Fl_Type *Fl_CodeBlock_Type::make(Strategy strategy) { - "after" is followed by the code that comes after the children The "before" code is stored in the name() field. */ -void Fl_CodeBlock_Type::write_properties(Fd_Project_Writer &f) { +void Fl_CodeBlock_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); if (after) { f.write_string("after"); @@ -800,7 +801,7 @@ void Fl_CodeBlock_Type::write_properties(Fd_Project_Writer &f) { /** Read the node specific properties. */ -void Fl_CodeBlock_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_CodeBlock_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"after")) { storestring(f.read_word(),after); } else { @@ -849,7 +850,7 @@ BREAK2: /** Write the "before" code. */ -void Fl_CodeBlock_Type::write_code1(Fd_Code_Writer& f) { +void Fl_CodeBlock_Type::write_code1(fld::io::Code_Writer& f) { const char* c = name(); f.write_c("%s%s {\n", f.indent(), c ? c : ""); f.indentation++; @@ -858,7 +859,7 @@ void Fl_CodeBlock_Type::write_code1(Fd_Code_Writer& f) { /** Write the "after" code. */ -void Fl_CodeBlock_Type::write_code2(Fd_Code_Writer& f) { +void Fl_CodeBlock_Type::write_code2(fld::io::Code_Writer& f) { f.indentation--; if (after) f.write_c("%s} %s\n", f.indent(), after); else f.write_c("%s}\n", f.indent()); @@ -928,7 +929,7 @@ Fl_Type *Fl_Decl_Type::make(Strategy strategy) { - "private"/"public"/"protected" - "local"/"global" if this is static or not */ -void Fl_Decl_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Decl_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); switch (public_) { case 0: f.write_string("private"); break; @@ -944,7 +945,7 @@ void Fl_Decl_Type::write_properties(Fd_Project_Writer &f) { /** Read the specific properties. */ -void Fl_Decl_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Decl_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"public")) { public_ = 1; } else if (!strcmp(c,"private")) { @@ -1035,7 +1036,7 @@ BREAK2: \todo There are a lot of side effect in this node depending on the given text and the parent node. They need to be understood and documented. */ -void Fl_Decl_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Decl_Type::write_code1(fld::io::Code_Writer& f) { const char* c = name(); if (!c) return; // handle a few keywords differently if inside a class @@ -1158,7 +1159,7 @@ Fl_Type *Fl_Data_Type::make(Strategy strategy) { - "filename" followed by the filename of the file to inline - "textmode" if data is written in ASCII vs. binary */ -void Fl_Data_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Data_Type::write_properties(fld::io::Project_Writer &f) { Fl_Decl_Type::write_properties(f); if (filename_) { f.write_string("filename"); @@ -1175,7 +1176,7 @@ void Fl_Data_Type::write_properties(Fd_Project_Writer &f) { /** Read specific properties. */ -void Fl_Data_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Data_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"filename")) { storestring(f.read_word(), filename_, 1); } else if (!strcmp(c,"textmode")) { @@ -1300,7 +1301,7 @@ BREAK2: /** Write the content of the external file inline into the source code. */ -void Fl_Data_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Data_Type::write_code1(fld::io::Code_Writer& f) { const char *message = 0; const char *c = name(); if (!c) return; @@ -1499,7 +1500,7 @@ Fl_Type *Fl_DeclBlock_Type::make(Strategy strategy) { - "public"/"protected" - "after" followed by the second code block. */ -void Fl_DeclBlock_Type::write_properties(Fd_Project_Writer &f) { +void Fl_DeclBlock_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); // deprecated if (is_public()) f.write_string("public"); @@ -1513,7 +1514,7 @@ void Fl_DeclBlock_Type::write_properties(Fd_Project_Writer &f) { /** Read the specific properties. */ -void Fl_DeclBlock_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_DeclBlock_Type::read_property(fld::io::Project_Reader &f, const char *c) { if(!strcmp(c,"public")) { write_map_ |= CODE_IN_HEADER; } else if(!strcmp(c,"protected")) { @@ -1632,7 +1633,7 @@ BREAK2: Write the \b before static code to the source file, and to the header file if declared public. The before code is stored in the name() field. */ -void Fl_DeclBlock_Type::write_static(Fd_Code_Writer& f) { +void Fl_DeclBlock_Type::write_static(fld::io::Code_Writer& f) { const char* c = name(); if (c && *c) { if (write_map_ & STATIC_IN_HEADER) @@ -1645,7 +1646,7 @@ void Fl_DeclBlock_Type::write_static(Fd_Code_Writer& f) { /** Write the \b after static code to the source file, and to the header file if declared public. */ -void Fl_DeclBlock_Type::write_static_after(Fd_Code_Writer& f) { +void Fl_DeclBlock_Type::write_static_after(fld::io::Code_Writer& f) { const char* c = after; if (c && *c) { if (write_map_ & STATIC_IN_HEADER) @@ -1659,7 +1660,7 @@ void Fl_DeclBlock_Type::write_static_after(Fd_Code_Writer& f) { Write the \b before code to the source file, and to the header file if declared public. The before code is stored in the name() field. */ -void Fl_DeclBlock_Type::write_code1(Fd_Code_Writer& f) { +void Fl_DeclBlock_Type::write_code1(fld::io::Code_Writer& f) { const char* c = name(); if (c && *c) { if (write_map_ & CODE_IN_HEADER) @@ -1672,7 +1673,7 @@ void Fl_DeclBlock_Type::write_code1(Fd_Code_Writer& f) { /** Write the \b after code to the source file, and to the header file if declared public. */ -void Fl_DeclBlock_Type::write_code2(Fd_Code_Writer& f) { +void Fl_DeclBlock_Type::write_code2(fld::io::Code_Writer& f) { const char* c = after; if (c && *c) { if (write_map_ & CODE_IN_HEADER) @@ -1733,7 +1734,7 @@ Fl_Type *Fl_Comment_Type::make(Strategy strategy) { - "in_source"/"not_in_source" if the comment will be written to the source code - "in_header"/"not_in_header" if the comment will be written to the header file */ -void Fl_Comment_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Comment_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); if (in_c_) f.write_string("in_source"); else f.write_string("not_in_source"); if (in_h_) f.write_string("in_header"); else f.write_string("not_in_header"); @@ -1742,7 +1743,7 @@ void Fl_Comment_Type::write_properties(Fd_Project_Writer &f) { /** Read extra properties. */ -void Fl_Comment_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Comment_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"in_source")) { in_c_ = 1; } else if (!strcmp(c,"not_in_source")) { @@ -1900,7 +1901,7 @@ BREAK2: /** Write the comment to the files. */ -void Fl_Comment_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Comment_Type::write_code1(fld::io::Code_Writer& f) { const char* c = name(); if (!c) return; if (!in_c_ && !in_h_) return; @@ -2013,7 +2014,7 @@ Fl_Type *Fl_Class_Type::make(Strategy strategy) { - ":" followed by the super class - "private"/"protected" */ -void Fl_Class_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Class_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); if (subclass_of) { f.write_string(":"); @@ -2028,7 +2029,7 @@ void Fl_Class_Type::write_properties(Fd_Project_Writer &f) { /** Read additional properties. */ -void Fl_Class_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Class_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"private")) { public_ = 0; } else if (!strcmp(c,"protected")) { @@ -2118,7 +2119,7 @@ BREAK2: /** Write the header code that declares this class. */ -void Fl_Class_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Class_Type::write_code1(fld::io::Code_Writer& f) { parent_class = current_class; current_class = this; write_public_state = 0; @@ -2135,7 +2136,7 @@ void Fl_Class_Type::write_code1(Fd_Code_Writer& f) { /** Write the header code that ends the declaration of this class. */ -void Fl_Class_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Class_Type::write_code2(fld::io::Code_Writer& f) { f.write_h("};\n"); current_class = parent_class; } diff --git a/fluid/nodes/Fl_Function_Type.h b/fluid/nodes/Fl_Function_Type.h index 536a511c0..4c2319aee 100644 --- a/fluid/nodes/Fl_Function_Type.h +++ b/fluid/nodes/Fl_Function_Type.h @@ -52,8 +52,8 @@ public: Fl_Function_Type(); ~Fl_Function_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void open() FL_OVERRIDE; int ismain() {return name_ == 0;} const char *type_name() FL_OVERRIDE {return "Function";} @@ -65,8 +65,8 @@ public: int is_public() const FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Function; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Function) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int has_signature(const char *, const char*) const; }; @@ -83,9 +83,9 @@ class Fl_Code_Type : public Fl_Type public: Fl_Code_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write(Fd_Project_Writer &f) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { } + void write(fld::io::Project_Writer &f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE { } void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "code";} int is_code_block() const FL_OVERRIDE {return 0;} @@ -108,8 +108,8 @@ public: Fl_CodeBlock_Type(); ~Fl_CodeBlock_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "codeblock";} int is_code_block() const FL_OVERRIDE {return 1;} @@ -117,8 +117,8 @@ public: int is_public() const FL_OVERRIDE { return -1; } ID id() const FL_OVERRIDE { return ID_CodeBlock; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_CodeBlock) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; }; // ---- Fl_Decl_Type declaration @@ -134,12 +134,12 @@ protected: public: Fl_Decl_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { } + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE { } void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "decl";} - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int is_public() const FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Decl; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Decl) ? true : super::is_a(inID); } @@ -157,12 +157,12 @@ public: Fl_Data_Type(); ~Fl_Data_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE {} + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE {} void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "data";} - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Data; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Data) ? true : super::is_a(inID); } }; @@ -185,14 +185,14 @@ public: Fl_DeclBlock_Type(); ~Fl_DeclBlock_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_static(Fd_Code_Writer& f) FL_OVERRIDE; - void write_static_after(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_static(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_static_after(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "declblock";} - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int can_have_children() const FL_OVERRIDE {return 1;} int is_decl_block() const FL_OVERRIDE {return 1;} int is_public() const FL_OVERRIDE; @@ -210,12 +210,12 @@ class Fl_Comment_Type : public Fl_Type public: Fl_Comment_Type(); Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { } + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE { } void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "comment";} - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int is_public() const FL_OVERRIDE { return 1; } ID id() const FL_OVERRIDE { return ID_Comment; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Comment) ? true : super::is_a(inID); } @@ -238,8 +238,8 @@ public: Fl_Class_Type* parent_class; // save class if nested // Fl_Type *make(Strategy strategy) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void open() FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "class";} int can_have_children() const FL_OVERRIDE {return 1;} @@ -248,8 +248,8 @@ public: int is_public() const FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Class; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Class) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; // class prefix attribute access void prefix(const char* p); diff --git a/fluid/nodes/Fl_Grid_Type.cxx b/fluid/nodes/Fl_Grid_Type.cxx index c2a803c19..03d6620ea 100644 --- a/fluid/nodes/Fl_Grid_Type.cxx +++ b/fluid/nodes/Fl_Grid_Type.cxx @@ -19,8 +19,9 @@ #include "app/fluid.h" #include "app/Fd_Snap_Action.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "widgets/Node_Browser.h" #include "widgets/Formula_Input.h" @@ -338,7 +339,7 @@ void Fl_Grid_Type::copy_properties_for_children() { d->layout(); } -void Fl_Grid_Type::write_properties(Fd_Project_Writer &f) +void Fl_Grid_Type::write_properties(fld::io::Project_Writer &f) { super::write_properties(f); Fl_Grid* grid = (Fl_Grid*)o; @@ -403,7 +404,7 @@ void Fl_Grid_Type::write_properties(Fd_Project_Writer &f) } } -void Fl_Grid_Type::read_property(Fd_Project_Reader &f, const char *c) +void Fl_Grid_Type::read_property(fld::io::Project_Reader &f, const char *c) { Fl_Grid* grid = (Fl_Grid*)o; if (!strcmp(c,"dimensions")) { @@ -453,7 +454,7 @@ void Fl_Grid_Type::read_property(Fd_Project_Reader &f, const char *c) } } -void Fl_Grid_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate) { +void Fl_Grid_Type::write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate) { Fl_Grid *grid; Fl_Widget *child_widget; Fl_Grid::Cell *cell; @@ -500,7 +501,7 @@ void Fl_Grid_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, // NOTE: we have to do this in a loop just as ::read_property() in case a new // property is added. In the current setup, all the remaining properties // will be skipped -void Fl_Grid_Type::read_parent_property(Fd_Project_Reader &f, Fl_Type *child, const char *property) { +void Fl_Grid_Type::read_parent_property(fld::io::Project_Reader &f, Fl_Type *child, const char *property) { if (!child->is_true_widget()) { super::read_parent_property(f, child, property); return; @@ -539,7 +540,7 @@ void Fl_Grid_Type::read_parent_property(Fd_Project_Reader &f, Fl_Type *child, co } } -void Fl_Grid_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Grid_Type::write_code1(fld::io::Code_Writer& f) { const char *var = name() ? name() : "o"; Fl_Grid* grid = (Fl_Grid*)o; Fl_Widget_Type::write_code1(f); @@ -603,7 +604,7 @@ void Fl_Grid_Type::write_code1(Fd_Code_Writer& f) { } } -void Fl_Grid_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Grid_Type::write_code2(fld::io::Code_Writer& f) { const char *var = name() ? name() : "o"; Fl_Grid* grid = (Fl_Grid*)o; bool first_cell = true; diff --git a/fluid/nodes/Fl_Grid_Type.h b/fluid/nodes/Fl_Grid_Type.h index 1093a38f3..1ce5321c8 100644 --- a/fluid/nodes/Fl_Grid_Type.h +++ b/fluid/nodes/Fl_Grid_Type.h @@ -57,16 +57,16 @@ public: Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Grid; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Grid) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; - void write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate) FL_OVERRIDE; - void read_parent_property(Fd_Project_Reader &f, Fl_Type *child, const char *property) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; + void write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate) FL_OVERRIDE; + void read_parent_property(fld::io::Project_Reader &f, Fl_Type *child, const char *property) FL_OVERRIDE; Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE; void leave_live_mode() FL_OVERRIDE; void copy_properties() FL_OVERRIDE; void copy_properties_for_children() FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; void remove_child(Fl_Type*) FL_OVERRIDE; diff --git a/fluid/nodes/Fl_Group_Type.cxx b/fluid/nodes/Fl_Group_Type.cxx index dc602e870..5d3cba07c 100644 --- a/fluid/nodes/Fl_Group_Type.cxx +++ b/fluid/nodes/Fl_Group_Type.cxx @@ -23,8 +23,9 @@ #include "app/fluid.h" #include "app/undo.h" #include "app/Fd_Snap_Action.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "widgets/Node_Browser.h" #include <FL/Fl.H> @@ -195,11 +196,11 @@ void Fl_Group_Type::ideal_size(int &w, int &h) { Fd_Snap_Action::better_size(w, h); } -void Fl_Group_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Group_Type::write_code1(fld::io::Code_Writer& f) { Fl_Widget_Type::write_code1(f); } -void Fl_Group_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Group_Type::write_code2(fld::io::Code_Writer& f) { const char *var = name() ? name() : "o"; write_extra_code(f); f.write_c("%s%s->end();\n", f.indent(), var); @@ -348,7 +349,7 @@ void Fl_Flex_Type::copy_properties_for_children() { d->layout(); } -void Fl_Flex_Type::write_properties(Fd_Project_Writer &f) +void Fl_Flex_Type::write_properties(fld::io::Project_Writer &f) { Fl_Group_Type::write_properties(f); Fl_Flex* flex = (Fl_Flex*)o; @@ -373,7 +374,7 @@ void Fl_Flex_Type::write_properties(Fd_Project_Writer &f) } } -void Fl_Flex_Type::read_property(Fd_Project_Reader &f, const char *c) +void Fl_Flex_Type::read_property(fld::io::Project_Reader &f, const char *c) { Fl_Flex* flex = (Fl_Flex*)o; suspend_auto_layout = 1; @@ -421,7 +422,7 @@ void Fl_Flex_Type::postprocess_read() suspend_auto_layout = 0; } -void Fl_Flex_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Flex_Type::write_code2(fld::io::Code_Writer& f) { const char *var = name() ? name() : "o"; Fl_Flex* flex = (Fl_Flex*)o; int lm, tm, rm, bm; diff --git a/fluid/nodes/Fl_Group_Type.h b/fluid/nodes/Fl_Group_Type.h index 88645a08e..30fab1d20 100644 --- a/fluid/nodes/Fl_Group_Type.h +++ b/fluid/nodes/Fl_Group_Type.h @@ -54,8 +54,8 @@ public: Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE { Fl_Group_Proxy *g = new Fl_Group_Proxy(X,Y,W,H); Fl_Group::current(0); return g;} Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Group_Type();} - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; void remove_child(Fl_Type*) FL_OVERRIDE; @@ -114,13 +114,13 @@ public: Fl_Flex *g = new Fl_Flex_Proxy(X,Y,W,H); Fl_Group::current(0); return g;} ID id() const FL_OVERRIDE { return ID_Flex; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Flex) ? true : super::is_a(inID); } - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE; void copy_properties() FL_OVERRIDE; void copy_properties_for_children() FL_OVERRIDE; void postprocess_read() FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; // void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; // void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; void remove_child(Fl_Type*) FL_OVERRIDE; diff --git a/fluid/nodes/Fl_Menu_Type.cxx b/fluid/nodes/Fl_Menu_Type.cxx index 145f0082d..83435df50 100644 --- a/fluid/nodes/Fl_Menu_Type.cxx +++ b/fluid/nodes/Fl_Menu_Type.cxx @@ -23,11 +23,13 @@ #include "nodes/Fl_Menu_Type.h" #include "app/fluid.h" +#include "app/project.h" #include "app/Fluid_Image.h" #include "app/mergeback.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "nodes/Fl_Window_Type.h" #include "widgets/Formula_Input.h" #include "widgets/Node_Browser.h" @@ -300,7 +302,7 @@ int isdeclare(const char *c); // Search backwards to find the parent menu button and return it's name. // Also put in i the index into the button's menu item array belonging // to this menu item. -const char* Fl_Menu_Item_Type::menu_name(Fd_Code_Writer& f, int& i) { +const char* Fl_Menu_Item_Type::menu_name(fld::io::Code_Writer& f, int& i) { i = 0; Fl_Type* t = prev; while (t && t->is_a(ID_Menu_Item)) { @@ -315,7 +317,7 @@ const char* Fl_Menu_Item_Type::menu_name(Fd_Code_Writer& f, int& i) { return f.unique_id(t, "menu", t->name(), t->label()); } -void Fl_Menu_Item_Type::write_static(Fd_Code_Writer& f) { +void Fl_Menu_Item_Type::write_static(fld::io::Code_Writer& f) { if (image && label() && label()[0]) { f.write_h_once("#include <FL/Fl.H>"); f.write_h_once("#include <FL/Fl_Multi_Label.H>"); @@ -447,7 +449,7 @@ void Fl_Menu_Item_Type::write_static(Fd_Code_Writer& f) { f.write_c("Fl_Menu_Item* %s::%s = %s::%s + %d;\n", k, c, k, n, i); } else { // if the name is an array, only define the array. - // The actual assignment is in write_code1(Fd_Code_Writer& f) + // The actual assignment is in write_code1(fld::io::Code_Writer& f) f.write_c("Fl_Menu_Item* %s::%s;\n", k, c); } } @@ -468,7 +470,7 @@ int Fl_Menu_Item_Type::flags() { return i; } -void Fl_Menu_Item_Type::write_item(Fd_Code_Writer& f) { +void Fl_Menu_Item_Type::write_item(fld::io::Code_Writer& f) { static const char * const labeltypes[] = { "FL_NORMAL_LABEL", "FL_NO_LABEL", @@ -534,7 +536,7 @@ void Fl_Menu_Item_Type::write_item(Fd_Code_Writer& f) { f.write_c("},\n"); } -void start_menu_initialiser(Fd_Code_Writer& f, int &initialized, const char *name, int index) { +void start_menu_initialiser(fld::io::Code_Writer& f, int &initialized, const char *name, int index) { if (!initialized) { initialized = 1; f.write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", f.indent(), name, index); @@ -542,7 +544,7 @@ void start_menu_initialiser(Fd_Code_Writer& f, int &initialized, const char *nam } } -void Fl_Menu_Item_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Menu_Item_Type::write_code1(fld::io::Code_Writer& f) { int i; const char* mname = menu_name(f, i); if (!prev->is_a(ID_Menu_Item)) { @@ -637,7 +639,7 @@ void Fl_Menu_Item_Type::write_code1(Fd_Code_Writer& f) { } } -void Fl_Menu_Item_Type::write_code2(Fd_Code_Writer&) {} +void Fl_Menu_Item_Type::write_code2(fld::io::Code_Writer&) {} //////////////////////////////////////////////////////////////// // This is the base class for widgets that contain a menu (ie @@ -729,7 +731,7 @@ Fl_Type* Fl_Menu_Base_Type::click_test(int, int) { return this; } -void Fl_Menu_Manager_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Menu_Manager_Type::write_code2(fld::io::Code_Writer& f) { if (next && next->is_a(ID_Menu_Item)) { f.write_c("%s%s->menu(%s);\n", f.indent(), name() ? name() : "o", f.unique_id(this, "menu", name(), label())); @@ -843,7 +845,7 @@ const char *Fl_Menu_Bar_Type::sys_menubar_proxy_name() { } -void Fl_Menu_Bar_Type::write_static(Fd_Code_Writer& f) { +void Fl_Menu_Bar_Type::write_static(fld::io::Code_Writer& f) { super::write_static(f); if (is_sys_menu_bar()) { f.write_h_once("#include <FL/Fl_Sys_Menu_Bar.H>"); @@ -863,7 +865,7 @@ void Fl_Menu_Bar_Type::write_static(Fd_Code_Writer& f) { } } -void Fl_Menu_Bar_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Menu_Bar_Type::write_code1(fld::io::Code_Writer& f) { super::write_code1(f); if (is_sys_menu_bar() && is_in_class()) { f.write_c("%s((%s*)%s)->_parent_class = (void*)this;\n", @@ -871,7 +873,7 @@ void Fl_Menu_Bar_Type::write_code1(Fd_Code_Writer& f) { } } -//void Fl_Menu_Bar_Type::write_code2(Fd_Code_Writer& f) { +//void Fl_Menu_Bar_Type::write_code2(fld::io::Code_Writer& f) { // super::write_code2(f); //} diff --git a/fluid/nodes/Fl_Menu_Type.h b/fluid/nodes/Fl_Menu_Type.h index b4ad90081..136a1c289 100644 --- a/fluid/nodes/Fl_Menu_Type.h +++ b/fluid/nodes/Fl_Menu_Type.h @@ -55,12 +55,12 @@ public: int is_button() const FL_OVERRIDE {return 1;} // this gets shortcut to work Fl_Widget* widget(int,int,int,int) FL_OVERRIDE {return 0;} Fl_Widget_Type* _make() FL_OVERRIDE {return 0;} - virtual const char* menu_name(Fd_Code_Writer& f, int& i); + virtual const char* menu_name(fld::io::Code_Writer& f, int& i); int flags(); - void write_static(Fd_Code_Writer& f) FL_OVERRIDE; - void write_item(Fd_Code_Writer& f); - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_static(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_item(fld::io::Code_Writer& f); + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; int is_true_widget() const FL_OVERRIDE { return 0; } ID id() const FL_OVERRIDE { return ID_Menu_Item; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Item) ? true : super::is_a(inID); } @@ -142,7 +142,7 @@ public: void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE { build_menu(); } void remove_child(Fl_Type*) FL_OVERRIDE { build_menu();} Fl_Type* click_test(int x, int y) FL_OVERRIDE = 0; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; void copy_properties() FL_OVERRIDE = 0; ID id() const FL_OVERRIDE { return ID_Menu_Manager_; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Manager_) ? true : super::is_a(inID); } @@ -271,9 +271,9 @@ public: const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuBar";} Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {return new Fl_Menu_Bar(X,Y,W,H);} Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Bar_Type();} - void write_static(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; -// void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_static(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; +// void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; ID id() const FL_OVERRIDE { return ID_Menu_Bar; } bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Bar) ? true : super::is_a(inID); } bool is_sys_menu_bar(); diff --git a/fluid/nodes/Fl_Type.cxx b/fluid/nodes/Fl_Type.cxx index 02b95888e..8f078e06e 100644 --- a/fluid/nodes/Fl_Type.cxx +++ b/fluid/nodes/Fl_Type.cxx @@ -97,11 +97,13 @@ #include "nodes/Fl_Type.h" #include "app/fluid.h" +#include "app/project.h" #include "app/Fd_Snap_Action.h" #include "app/shell_command.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "nodes/Fl_Function_Type.h" #include "nodes/Fl_Widget_Type.h" #include "nodes/Fl_Window_Type.h" @@ -886,7 +888,7 @@ void Fl_Type::move_before(Fl_Type* g) { // write a widget and all its children: -void Fl_Type::write(Fd_Project_Writer &f) { +void Fl_Type::write(fld::io::Project_Writer &f) { if (f.write_codeview()) proj1_start = (int)ftell(f.file()) + 1; if (f.write_codeview()) proj2_start = (int)ftell(f.file()) + 1; f.write_indent(level); @@ -918,7 +920,7 @@ void Fl_Type::write(Fd_Project_Writer &f) { if (f.write_codeview()) proj2_end = (int)ftell(f.file()); } -void Fl_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Type::write_properties(fld::io::Project_Writer &f) { // repeat this for each attribute: if (g_project.write_mergeback_data && uid_) { f.write_word("uid"); @@ -952,7 +954,7 @@ void Fl_Type::write_properties(Fd_Project_Writer &f) { if (selected) f.write_word("selected"); } -void Fl_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"uid")) { const char *hex = f.read_word(); int x = 0; @@ -1017,13 +1019,13 @@ void Fl_Type::read_property(Fd_Project_Reader &f, const char *c) { Lastly, this method should call the super class to give it a chance to append its own properties. - \see Fl_Grid_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate) + \see Fl_Grid_Type::write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate) \param[in] f the project file writer \param[in] child write properties for this child, make sure it has the correct type \param[in] encapsulate write the `parent_properties {}` block if true before writing any properties */ -void Fl_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate) { +void Fl_Type::write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate) { (void)f; (void)child; (void)encapsulate; // nothing to do here // put the following code into your implementation of write_parent_properties @@ -1050,14 +1052,14 @@ void Fl_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool method reads back those properties. This function is virtual, so if a Type does not support a property, it will propagate to its super class. - \see Fl_Type::write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate) - \see Fl_Grid_Type::read_parent_property(Fd_Project_Reader &f, Fl_Type *child, const char *property) + \see Fl_Type::write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate) + \see Fl_Grid_Type::read_parent_property(fld::io::Project_Reader &f, Fl_Type *child, const char *property) \param[in] f the project file writer \param[in] child read properties for this child \param[in] property the name of a property, or "}" when we reach the end of the list */ -void Fl_Type::read_parent_property(Fd_Project_Reader &f, Fl_Type *child, const char *property) { +void Fl_Type::read_parent_property(fld::io::Project_Reader &f, Fl_Type *child, const char *property) { (void)child; f.read_error("Unknown parent property \"%s\"", property); } @@ -1069,7 +1071,7 @@ int Fl_Type::read_fdesign(const char*, const char*) {return 0;} Write a comment into the header file. \param[in] pre indent the comment by this string */ -void Fl_Type::write_comment_h(Fd_Code_Writer& f, const char *pre) +void Fl_Type::write_comment_h(fld::io::Code_Writer& f, const char *pre) { if (comment() && *comment()) { f.write_h("%s/**\n", pre); @@ -1092,7 +1094,7 @@ void Fl_Type::write_comment_h(Fd_Code_Writer& f, const char *pre) /** Write a comment into the source file. */ -void Fl_Type::write_comment_c(Fd_Code_Writer& f, const char *pre) +void Fl_Type::write_comment_c(fld::io::Code_Writer& f, const char *pre) { if (comment() && *comment()) { f.write_c("%s/**\n", pre); @@ -1117,7 +1119,7 @@ void Fl_Type::write_comment_c(Fd_Code_Writer& f, const char *pre) /** Write a comment into the source file. */ -void Fl_Type::write_comment_inline_c(Fd_Code_Writer& f, const char *pre) +void Fl_Type::write_comment_inline_c(fld::io::Code_Writer& f, const char *pre) { if (comment() && *comment()) { const char *s = comment(); @@ -1197,7 +1199,7 @@ int Fl_Type::user_defined(const char* cbname) const { return 0; } -const char *Fl_Type::callback_name(Fd_Code_Writer& f) { +const char *Fl_Type::callback_name(fld::io::Code_Writer& f) { if (is_name(callback())) return callback(); return f.unique_id(this, "cb", name(), label()); } @@ -1250,18 +1252,18 @@ bool Fl_Type::is_in_class() const { return false; } -void Fl_Type::write_static(Fd_Code_Writer&) { +void Fl_Type::write_static(fld::io::Code_Writer&) { } -void Fl_Type::write_static_after(Fd_Code_Writer&) { +void Fl_Type::write_static_after(fld::io::Code_Writer&) { } -void Fl_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Type::write_code1(fld::io::Code_Writer& f) { f.write_h("// Header for %s\n", title()); f.write_c("// Code for %s\n", title()); } -void Fl_Type::write_code2(Fd_Code_Writer&) { +void Fl_Type::write_code2(fld::io::Code_Writer&) { } /** Set a uid that is unique within the project. diff --git a/fluid/nodes/Fl_Type.h b/fluid/nodes/Fl_Type.h index 478059c13..e7dde3b39 100644 --- a/fluid/nodes/Fl_Type.h +++ b/fluid/nodes/Fl_Type.h @@ -17,7 +17,7 @@ #ifndef _FLUID_FL_TYPE_H #define _FLUID_FL_TYPE_H -#include "io/code.h" +#include "io/Code_Writer.h" #include <FL/Fl_Widget.H> #include <FL/fl_draw.H> @@ -26,8 +26,14 @@ class Fl_Type; class Fl_Group_Type; class Fl_Window_Type; -class Fd_Project_Reader; -class Fd_Project_Writer; +namespace fld { +namespace io { + +class Project_Reader; +class Project_Writer; + +} // namespace io +} // namespace fld /** Declare where a new type is placed and how to create it. @@ -47,8 +53,8 @@ class Fd_Project_Writer; Add a hierarchy of Types void Fl_Type::add(Fl_Type *p, Strategy strategy) int read_file(const char *filename, int merge, Strategy strategy) - Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strategy, char skip_options) - int Fd_Project_Reader::read_project(const char *filename, int merge, Strategy strategy) + Fl_Type *fld::io::Project_Reader::read_children(Fl_Type *p, int merge, Strategy strategy, char skip_options) + int fld::io::Project_Reader::read_project(const char *filename, int merge, Strategy strategy) */ typedef struct Strategy { enum Flags { @@ -188,7 +194,7 @@ public: // things that should not be public: Fl_Type *first_child(); Fl_Type *factory; - const char *callback_name(Fd_Code_Writer& f); + const char *callback_name(fld::io::Code_Writer& f); // text positions of this type in code, header, and project file (see codeview) int code_static_start, code_static_end; @@ -252,22 +258,22 @@ public: virtual void open(); // what happens when you double-click // read and write data to a saved file: - virtual void write(Fd_Project_Writer &f); - virtual void write_properties(Fd_Project_Writer &f); - virtual void read_property(Fd_Project_Reader &f, const char *); - virtual void write_parent_properties(Fd_Project_Writer &f, Fl_Type *child, bool encapsulate); - virtual void read_parent_property(Fd_Project_Reader &f, Fl_Type *child, const char *property); + virtual void write(fld::io::Project_Writer &f); + virtual void write_properties(fld::io::Project_Writer &f); + virtual void read_property(fld::io::Project_Reader &f, const char *); + virtual void write_parent_properties(fld::io::Project_Writer &f, Fl_Type *child, bool encapsulate); + virtual void read_parent_property(fld::io::Project_Reader &f, Fl_Type *child, const char *property); virtual int read_fdesign(const char*, const char*); virtual void postprocess_read() { } // write code, these are called in order: - virtual void write_static(Fd_Code_Writer& f); // write static stuff to .c file - virtual void write_static_after(Fd_Code_Writer& f); // write static stuff after children - virtual void write_code1(Fd_Code_Writer& f); // code and .h before children - virtual void write_code2(Fd_Code_Writer& f); // code and .h after children - void write_comment_h(Fd_Code_Writer& f, const char *ind=""); // write the commentary text into the header file - void write_comment_c(Fd_Code_Writer& f, const char *ind=""); // write the commentary text into the source file - void write_comment_inline_c(Fd_Code_Writer& f, const char *ind=0L); // write the commentary text + virtual void write_static(fld::io::Code_Writer& f); // write static stuff to .c file + virtual void write_static_after(fld::io::Code_Writer& f); // write static stuff after children + virtual void write_code1(fld::io::Code_Writer& f); // code and .h before children + 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=0L); // 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/Fl_Widget_Type.cxx b/fluid/nodes/Fl_Widget_Type.cxx index 2ed31f0d8..2cde4d531 100644 --- a/fluid/nodes/Fl_Widget_Type.cxx +++ b/fluid/nodes/Fl_Widget_Type.cxx @@ -17,11 +17,13 @@ #include "nodes/Fl_Widget_Type.h" #include "app/fluid.h" +#include "app/project.h" #include "app/Fluid_Image.h" #include "app/mergeback.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Group_Type.h" #include "nodes/Fl_Menu_Type.h" @@ -2912,7 +2914,7 @@ int isdeclare(const char *c) { return 0; } -void Fl_Widget_Type::write_static(Fd_Code_Writer& f) { +void Fl_Widget_Type::write_static(fld::io::Code_Writer& f) { const char* t = subclassname(this); if (!subclass() || (is_class() && !strncmp(t, "Fl_", 3))) { f.write_h_once("#include <FL/Fl.H>"); @@ -3001,7 +3003,7 @@ void Fl_Widget_Type::write_static(Fd_Code_Writer& f) { } } -void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Widget_Type::write_code1(fld::io::Code_Writer& f) { const char* t = subclassname(this); const char *c = array_name(this); if (c) { @@ -3126,7 +3128,7 @@ void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) { write_widget_code(f); } -void Fl_Widget_Type::write_color(Fd_Code_Writer& f, const char* field, Fl_Color color) { +void Fl_Widget_Type::write_color(fld::io::Code_Writer& f, const char* field, Fl_Color color) { const char* color_name = 0; switch (color) { case FL_FOREGROUND_COLOR: color_name = "FL_FOREGROUND_COLOR"; break; @@ -3164,8 +3166,8 @@ void Fl_Widget_Type::write_color(Fd_Code_Writer& f, const char* field, Fl_Color } } -// this is split from write_code1(Fd_Code_Writer& f) for Fl_Window_Type: -void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) { +// this is split from write_code1(fld::io::Code_Writer& f) for Fl_Window_Type: +void Fl_Widget_Type::write_widget_code(fld::io::Code_Writer& f) { Fl_Widget* tplate = ((Fl_Widget_Type*)factory)->o; const char *var = is_class() ? "this" : name() ? name() : "o"; @@ -3363,26 +3365,26 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) { } } -void Fl_Widget_Type::write_extra_code(Fd_Code_Writer& f) { +void Fl_Widget_Type::write_extra_code(fld::io::Code_Writer& f) { for (int n=0; n < NUM_EXTRA_CODE; n++) if (extra_code(n) && !isdeclare(extra_code(n))) f.write_c("%s%s\n", f.indent(), extra_code(n)); } -void Fl_Widget_Type::write_block_close(Fd_Code_Writer& f) { +void Fl_Widget_Type::write_block_close(fld::io::Code_Writer& f) { f.indentation--; f.write_c("%s} // %s* %s\n", f.indent(), subclassname(this), name() ? name() : "o"); } -void Fl_Widget_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Widget_Type::write_code2(fld::io::Code_Writer& f) { write_extra_code(f); write_block_close(f); } //////////////////////////////////////////////////////////////// -void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Widget_Type::write_properties(fld::io::Project_Writer &f) { Fl_Type::write_properties(f); f.write_indent(level+1); switch (public_) { @@ -3515,7 +3517,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) { } } -void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Widget_Type::read_property(fld::io::Project_Reader &f, const char *c) { int x,y,w,h; Fl_Font ft; int s; Fl_Color cc; if (!strcmp(c,"private")) { public_ = 0; @@ -3726,7 +3728,7 @@ int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) { if (!strcmp(propname,"box")) { float x,y,w,h; if (sscanf(value,"%f %f %f %f",&x,&y,&w,&h) == 4) { - if (fdesign_flip) { + if (fld::io::fdesign_flip) { Fl_Type *p; for (p = parent; p && !p->is_a(ID_Window); p = p->parent) {/*empty*/} if (p && p->is_widget()) y = ((Fl_Widget_Type*)p)->o->h()-(y+h); diff --git a/fluid/nodes/Fl_Widget_Type.h b/fluid/nodes/Fl_Widget_Type.h index 76bea3404..6a26921cc 100644 --- a/fluid/nodes/Fl_Widget_Type.h +++ b/fluid/nodes/Fl_Widget_Type.h @@ -60,13 +60,13 @@ protected: /// disabling the output of the "hide" property by the Widget Type. uchar override_visible_; - void write_static(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_widget_code(Fd_Code_Writer& f); - void write_extra_code(Fd_Code_Writer& f); - void write_block_close(Fd_Code_Writer& f); - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; - void write_color(Fd_Code_Writer& f, const char*, Fl_Color); + void write_static(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_widget_code(fld::io::Code_Writer& f); + void write_extra_code(fld::io::Code_Writer& f); + void write_block_close(fld::io::Code_Writer& f); + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_color(fld::io::Code_Writer& f, const char*, Fl_Color); Fl_Widget *live_widget; public: @@ -112,8 +112,8 @@ public: int is_true_widget() const FL_OVERRIDE { return 1; } int is_public() const FL_OVERRIDE; - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int read_fdesign(const char*, const char*) FL_OVERRIDE; Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE; diff --git a/fluid/nodes/Fl_Window_Type.cxx b/fluid/nodes/Fl_Window_Type.cxx index 7de2ba3dc..3f68f7980 100644 --- a/fluid/nodes/Fl_Window_Type.cxx +++ b/fluid/nodes/Fl_Window_Type.cxx @@ -22,9 +22,11 @@ #include "app/Fd_Snap_Action.h" #include "app/fluid.h" +#include "app/project.h" #include "app/undo.h" -#include "io/file.h" -#include "io/code.h" +#include "io/Project_Reader.h" +#include "io/Project_Writer.h" +#include "io/Code_Writer.h" #include "nodes/factory.h" #include "nodes/Fl_Group_Type.h" #include "nodes/Fl_Grid_Type.h" @@ -1262,7 +1264,7 @@ int Fl_Window_Type::handle(int event) { Write the C++ code that comes before the children of the window are written. \param f the source code output stream */ -void Fl_Window_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Window_Type::write_code1(fld::io::Code_Writer& f) { Fl_Widget_Type::write_code1(f); } @@ -1271,7 +1273,7 @@ void Fl_Window_Type::write_code1(Fd_Code_Writer& f) { Write the C++ code that comes after the children of the window are written. \param f the source code output stream */ -void Fl_Window_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Window_Type::write_code2(fld::io::Code_Writer& f) { const char *var = is_class() ? "this" : name() ? name() : "o"; // make the window modal or non-modal if (modal) { @@ -1306,7 +1308,7 @@ void Fl_Window_Type::write_code2(Fd_Code_Writer& f) { write_block_close(f); } -void Fl_Window_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Window_Type::write_properties(fld::io::Project_Writer &f) { Fl_Widget_Type::write_properties(f); if (modal) f.write_string("modal"); else if (non_modal) f.write_string("non_modal"); @@ -1317,7 +1319,7 @@ void Fl_Window_Type::write_properties(Fd_Project_Writer &f) { if (o->visible() || override_visible_) f.write_string("visible"); } -void Fl_Window_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Window_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"modal")) { modal = 1; } else if (!strcmp(c,"non_modal")) { @@ -1404,7 +1406,7 @@ Fl_Type *Fl_Widget_Class_Type::make(Strategy strategy) { return myo; } -void Fl_Widget_Class_Type::write_properties(Fd_Project_Writer &f) { +void Fl_Widget_Class_Type::write_properties(fld::io::Project_Writer &f) { Fl_Window_Type::write_properties(f); if (wc_relative==1) f.write_string("position_relative"); @@ -1412,7 +1414,7 @@ void Fl_Widget_Class_Type::write_properties(Fd_Project_Writer &f) { f.write_string("position_relative_rescale"); } -void Fl_Widget_Class_Type::read_property(Fd_Project_Reader &f, const char *c) { +void Fl_Widget_Class_Type::read_property(fld::io::Project_Reader &f, const char *c) { if (!strcmp(c,"position_relative")) { wc_relative = 1; } else if (!strcmp(c,"position_relative_rescale")) { @@ -1435,9 +1437,9 @@ static const char *trimclassname(const char *n) { } -void Fl_Widget_Class_Type::write_code1(Fd_Code_Writer& f) { +void Fl_Widget_Class_Type::write_code1(fld::io::Code_Writer& f) { #if 0 - Fl_Widget_Type::write_code1(Fd_Code_Writer& f); + Fl_Widget_Type::write_code1(fld::io::Code_Writer& f); #endif // 0 current_widget_class = this; @@ -1505,7 +1507,7 @@ void Fl_Widget_Class_Type::write_code1(Fd_Code_Writer& f) { Write the C++ code that comes after the children of the window are written. \param f the source code output stream */ -void Fl_Widget_Class_Type::write_code2(Fd_Code_Writer& f) { +void Fl_Widget_Class_Type::write_code2(fld::io::Code_Writer& f) { // make the window modal or non-modal if (modal) { f.write_c("%sset_modal();\n", f.indent()); diff --git a/fluid/nodes/Fl_Window_Type.h b/fluid/nodes/Fl_Window_Type.h index a0695f2a1..0dcb9e96e 100644 --- a/fluid/nodes/Fl_Window_Type.h +++ b/fluid/nodes/Fl_Window_Type.h @@ -67,8 +67,8 @@ protected: void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h); int handle(int); void setlabel(const char *) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; Fl_Widget_Type *_make() FL_OVERRIDE {return 0;} // we don't call this Fl_Widget *widget(int,int,int,int) FL_OVERRIDE {return 0;} int recalc; // set by fix_overlay() @@ -105,8 +105,8 @@ public: void fix_overlay(); // Update the bounding box, etc uchar *read_image(int &ww, int &hh); // Read an image of the window - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; int read_fdesign(const char*, const char*) FL_OVERRIDE; void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE; @@ -139,11 +139,11 @@ public: char write_public_state; // true when public: has been printed char wc_relative; // if 1, reposition all children, if 2, reposition and resize - void write_properties(Fd_Project_Writer &f) FL_OVERRIDE; - void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE; + void write_properties(fld::io::Project_Writer &f) FL_OVERRIDE; + void read_property(fld::io::Project_Reader &f, const char *) FL_OVERRIDE; - void write_code1(Fd_Code_Writer& f) FL_OVERRIDE; - void write_code2(Fd_Code_Writer& f) FL_OVERRIDE; + void write_code1(fld::io::Code_Writer& f) FL_OVERRIDE; + void write_code2(fld::io::Code_Writer& f) FL_OVERRIDE; Fl_Type *make(Strategy strategy) FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "widget_class";} ID id() const FL_OVERRIDE { return ID_Widget_Class; } |
