diff options
Diffstat (limited to 'fluid/proj/mergeback.cxx')
| -rw-r--r-- | fluid/proj/mergeback.cxx | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fluid/proj/mergeback.cxx b/fluid/proj/mergeback.cxx index 34e4e1361..016732795 100644 --- a/fluid/proj/mergeback.cxx +++ b/fluid/proj/mergeback.cxx @@ -263,7 +263,7 @@ void Mergeback::analyse_callback(unsigned long code_crc, unsigned long tag_crc, */ void Mergeback::analyse_code(unsigned long code_crc, unsigned long tag_crc, int uid) { Node *tp = proj_.tree.find_by_uid(uid); - if (tp && tp->is_a(Type::Code)) { + if (tp && tp->is_a(FLD_NODE_TYPE_Code)) { std::string code = tp->name(); code += "\n"; unsigned long project_crc = fld::io::Code_Writer::block_crc(code.c_str()); // check if the code and project crc are the same, so this modification was already applied @@ -361,10 +361,10 @@ void Mergeback::print_tag(FILE *out, Tag prev_type, Tag next_type, uint16_t uid, static const char *tag_lut[] = { "----------", "-- code --", " callback ", " callback " }; fputs("//fl ", out); // Distinct start of tag using utf8 // Indicate that the text above can be edited - if (prev_type != Tag::GENERIC) fputs("▲", out); - if (prev_type != Tag::GENERIC && next_type != Tag::GENERIC) fputc('/', out); + if (prev_type != FLD_MERGEBACK_TAG_GENERIC) fputs("▲", out); + if (prev_type != FLD_MERGEBACK_TAG_GENERIC && next_type != FLD_MERGEBACK_TAG_GENERIC) fputc('/', out); // Indicate that the text below can be edited - if (next_type != Tag::GENERIC) fputs("▼", out); + if (next_type != FLD_MERGEBACK_TAG_GENERIC) fputs("▼", out); fputc(' ', out); // Write the first 32 bit word as an encoded divider line uint32_t pt = static_cast<uint32_t>(prev_type); @@ -372,18 +372,18 @@ void Mergeback::print_tag(FILE *out, Tag prev_type, Tag next_type, uint16_t uid, uint32_t word = (0<<24) | (pt<<16) | (uid); // top 8 bit available for encoding type print_trichar32(out, word); // Write a string indicating the type of editable text - if ( next_type != Tag::GENERIC) { + if ( next_type != FLD_MERGEBACK_TAG_GENERIC) { fputs(tag_lut[nt], out); - } else if (prev_type != Tag::GENERIC) { + } else if (prev_type != FLD_MERGEBACK_TAG_GENERIC) { fputs(tag_lut[nt], out); } // Write the second 32 bit word as an encoded divider line print_trichar32(out, crc); // Repeat the intor pattern fputc(' ', out); - if (prev_type != Tag::GENERIC) fputs("▲", out); - if (prev_type != Tag::GENERIC && next_type != Tag::GENERIC) fputc('/', out); - if (next_type != Tag::GENERIC) fputs("▼", out); + if (prev_type != FLD_MERGEBACK_TAG_GENERIC) fputs("▲", out); + if (prev_type != FLD_MERGEBACK_TAG_GENERIC && next_type != FLD_MERGEBACK_TAG_GENERIC) fputc('/', out); + if (next_type != FLD_MERGEBACK_TAG_GENERIC) fputs("▼", out); fputs(" fl//\n", out); } @@ -431,24 +431,24 @@ int Mergeback::analyse() { code_crc = fld::io::Code_Writer::block_crc(line, -1, code_crc, &line_start); } else { // if this line has a tag, read all tag data - Tag tag_type = Tag::UNUSED_; + Tag tag_type = FLD_MERGEBACK_TAG_UNUSED_; uint16_t uid = 0; uint32_t tag_crc = 0; bool tag_ok = read_tag(tag, &tag_type, &uid, &tag_crc); - if (!tag_ok || tag_type==Tag::UNUSED_ ) { + if (!tag_ok || tag_type==FLD_MERGEBACK_TAG_UNUSED_ ) { tag_error = 1; return -1; } if (code_crc != tag_crc) { switch (tag_type) { - case Tag::GENERIC: + case FLD_MERGEBACK_TAG_GENERIC: num_changed_structure++; break; - case Tag::MENU_CALLBACK: - case Tag::WIDGET_CALLBACK: + case FLD_MERGEBACK_TAG_MENU_CALLBACK: + case FLD_MERGEBACK_TAG_WIDGET_CALLBACK: analyse_callback(code_crc, tag_crc, uid); break; - case Tag::CODE: + case FLD_MERGEBACK_TAG_CODE: analyse_code(code_crc, tag_crc, uid); break; default: break; @@ -483,7 +483,7 @@ int Mergeback::apply_callback(long block_end, long block_start, unsigned long co */ int Mergeback::apply_code(long block_end, long block_start, unsigned long code_crc, int uid) { Node *tp = proj_.tree.find_by_uid(uid); - if (tp && tp->is_a(Type::Code)) { + if (tp && tp->is_a(FLD_NODE_TYPE_Code)) { std::string cb = tp->name(); cb += "\n"; unsigned long project_crc = fld::io::Code_Writer::block_crc(cb.c_str()); if (project_crc!=code_crc) { @@ -525,18 +525,18 @@ int Mergeback::apply() { block_end = ::ftell(code); } else { // if this line has a tag, read all tag data - Tag tag_type = Tag::UNUSED_; + Tag tag_type = FLD_MERGEBACK_TAG_UNUSED_; uint16_t uid = 0; uint32_t tag_crc = 0; bool tag_ok = read_tag(tag, &tag_type, &uid, &tag_crc); - if (!tag_ok || tag_type==Tag::UNUSED_ ) { + if (!tag_ok || tag_type==FLD_MERGEBACK_TAG_UNUSED_ ) { tag_error = 1; return -1; } if (code_crc != tag_crc) { - if (tag_type==Tag::MENU_CALLBACK || tag_type==Tag::WIDGET_CALLBACK) { + if (tag_type==FLD_MERGEBACK_TAG_MENU_CALLBACK || tag_type==FLD_MERGEBACK_TAG_WIDGET_CALLBACK) { changed |= apply_callback(block_end, block_start, code_crc, uid); - } else if (tag_type==Tag::CODE) { + } else if (tag_type==FLD_MERGEBACK_TAG_CODE) { changed |= apply_code(block_end, block_start, code_crc, uid); } } @@ -562,7 +562,7 @@ int Mergeback::merge_back(const std::string &s, const std::string &p, Task task) code = fl_fopen(s.c_str(), "rb"); if (!code) return -2; do { // no actual loop, just make sure we close the code file - if (task == Task::ANALYSE) { + if (task == FLD_MERGEBACK_TASK_ANALYSE) { analyse(); if (tag_error) {ret = -1; break; } if (num_changed_structure) ret |= 1; @@ -571,14 +571,14 @@ int Mergeback::merge_back(const std::string &s, const std::string &p, Task task) if (num_possible_override) ret |= 8; break; } - if (task == Task::INTERACTIVE) { + if (task == FLD_MERGEBACK_TASK_INTERACTIVE) { analyse(); ret = ask_user_to_merge(s, p); if (ret != 1) return ret; - task = Task::APPLY; // fall through + task = FLD_MERGEBACK_TASK_APPLY; // fall through } - if (task == Task::APPLY_IF_SAFE) { + if (task == FLD_MERGEBACK_TASK_APPLY_IF_SAFE) { analyse(); if (tag_error || num_changed_structure || num_possible_override) { ret = -1; @@ -588,9 +588,9 @@ int Mergeback::merge_back(const std::string &s, const std::string &p, Task task) ret = 0; break; } - task = Task::APPLY; // fall through + task = FLD_MERGEBACK_TASK_APPLY; // fall through } - if (task == Task::APPLY) { + if (task == FLD_MERGEBACK_TASK_APPLY) { ret = apply(); if (ret == 1) { proj_.set_modflag(1); @@ -660,7 +660,7 @@ int mergeback_code_files(Project &proj, Mergeback::Feedback feedback) if (code_filename.empty()) code_filename = proj.codefile_path() + proj.codefile_name(); if (!Fluid.batch_mode) proj.enter_project_dir(); - int c = merge_back(proj, code_filename, proj_filename, Mergeback::Task::INTERACTIVE); + int c = merge_back(proj, code_filename, proj_filename, FLD_MERGEBACK_TASK_INTERACTIVE); if (c>0) { // update the project to reflect the changes proj.set_modflag(1); |
