From ddba971ebb304512ba9e0a01b77ec71b59b977b6 Mon Sep 17 00:00:00 2001 From: maxim nikonov Date: Fri, 6 Feb 2026 03:20:53 +0500 Subject: wip --- fluid/io/Code_Writer.cxx | 6 ++---- fluid/io/Code_Writer.h | 3 +-- fluid/io/Project_Writer.h | 3 --- fluid/io/String_Writer.cxx | 23 +++++++++++++---------- fluid/io/String_Writer.h | 4 +--- 5 files changed, 17 insertions(+), 22 deletions(-) (limited to 'fluid/io') diff --git a/fluid/io/Code_Writer.cxx b/fluid/io/Code_Writer.cxx index 9460a6ac0..f451d187e 100644 --- a/fluid/io/Code_Writer.cxx +++ b/fluid/io/Code_Writer.cxx @@ -27,14 +27,12 @@ #include -#include #include #include #include using namespace fld; using namespace fld::io; -using namespace fld::proj; // ---- Fd_Id_Map implementation ---- @@ -915,9 +913,9 @@ Code_Writer::~Code_Writer() \param[in] type FD_TAG_GENERIC, FD_TAG_CODE, FD_TAG_MENU_CALLBACK, or FD_TAG_WIDGET_CALLBACK \param[in] uid the unique id of the current type */ -void Code_Writer::tag(proj::Mergeback::Tag prev_type, proj::Mergeback::Tag next_type, unsigned short uid) { +void Code_Writer::tag(Mergeback::Tag prev_type, Mergeback::Tag next_type, unsigned short uid) { if (proj_.write_mergeback_data) { - Mergeback::print_tag(code_file, prev_type, next_type, uid, (uint32_t)block_crc_); + ::Mergeback::print_tag(code_file, prev_type, next_type, uid, (uint32_t)block_crc_); } block_crc_ = crc32(0, 0, 0); } diff --git a/fluid/io/Code_Writer.h b/fluid/io/Code_Writer.h index f2ca32a3e..bd99395e5 100644 --- a/fluid/io/Code_Writer.h +++ b/fluid/io/Code_Writer.h @@ -25,7 +25,6 @@ #include #include #include -#include class Node; @@ -157,7 +156,7 @@ public: int write_code(const char *cfile, const char *hfile, bool to_codeview=false); void write_public(int state); // writes pubic:/private: as needed - void tag(proj::Mergeback::Tag prev_type, proj::Mergeback::Tag next_type, unsigned short uid); + void tag(Mergeback::Tag prev_type, Mergeback::Tag next_type, unsigned short uid); static unsigned long block_crc(const void *data, int n=-1, unsigned long in_crc=0, bool *inout_line_start=0); }; diff --git a/fluid/io/Project_Writer.h b/fluid/io/Project_Writer.h index 64769a762..845f77f1e 100644 --- a/fluid/io/Project_Writer.h +++ b/fluid/io/Project_Writer.h @@ -21,8 +21,6 @@ #include -#include - class Node; namespace fld { @@ -54,7 +52,6 @@ public: int write_project(const char *filename, int selected_only, bool codeview); void NewFunction(); void write_word(const char *); - void write_word(const std::string& word) { write_word(word.c_str()); } void write_string(const char *,...) __fl_attr((__format__ (__printf__, 2, 3))); void write_indent(int n); void write_open(); diff --git a/fluid/io/String_Writer.cxx b/fluid/io/String_Writer.cxx index 3066aa97b..97245697b 100644 --- a/fluid/io/String_Writer.cxx +++ b/fluid/io/String_Writer.cxx @@ -60,26 +60,29 @@ static int write_escaped_strings(FILE *out, const char *text) { \param[in] filename file path and name to a file that will hold the strings \return 1 if the file could not be opened for writing, or the result of `fclose`. */ -int fld::io::write_strings(Project &proj, const std::string &filename) { +int fld::io::write_strings(Project &proj, const char *filename) { Node *p; Widget_Node *w; int i; - FILE *fp = fl_fopen(filename.c_str(), "wb"); + FILE *fp = fl_fopen(filename, "wb"); if (!fp) return 1; switch (proj.i18n.type) { case FLD_I18N_TYPE_NONE : /* None, just put static text out */ fprintf(fp, "# generated by Fast Light User Interface Designer (fluid) version %.4f\n", FL_VERSION); - for (auto w: proj.tree.all_widgets()) { - if (w->label()) { - write_escaped_strings(fp, w->label()); - putc('\n', fp); - } - if (!(!w->tooltip() || !w->tooltip()[0])) { - write_escaped_strings(fp, w->tooltip()); - putc('\n', fp); + for (p = proj.tree.first; p; p = p->next) { + if (p->is_widget()) { + w = (Widget_Node *)p; + if (w->label()) { + write_escaped_strings(fp, w->label()); + putc('\n', fp); + } + if (!(!w->tooltip() || !w->tooltip()[0])) { + write_escaped_strings(fp, w->tooltip()); + putc('\n', fp); + } } } break; diff --git a/fluid/io/String_Writer.h b/fluid/io/String_Writer.h index 0109a32a3..8402836c1 100644 --- a/fluid/io/String_Writer.h +++ b/fluid/io/String_Writer.h @@ -17,15 +17,13 @@ #ifndef FLUID_IO_STRING_WRITER_H #define FLUID_IO_STRING_WRITER_H -#include - namespace fld { class Project; namespace io { -int write_strings(Project &proj, const std::string &filename); +int write_strings(Project &proj, const char *filename); } // namespace io } // namespace fld -- cgit v1.2.3