From c1f41342119b608b9d8036ee48ea45bf455fbcce Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 27 Dec 2024 21:16:35 -0500 Subject: [PATCH] Fluid: Improve UID generation. --- fluid/Fl_Type.cxx | 5 +++-- fluid/file.cxx | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index 0f1026301f..49b0498f7b 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -703,8 +703,9 @@ void Fl_Type::add(Fl_Type *anchor, Strategy strategy) { } #ifdef FLUID_OPTION_MERGEBACK + if ( g_project.write_mergeback_data + && strategy.source() == Strategy::FROM_USER) { // make sure that we have no duplicate uid's - // FIXME: if 'add' is called while loading a file, the UID will be set by the tag later Fl_Type *tp = this; do { tp->set_uid(tp->uid_); @@ -759,7 +760,7 @@ void Fl_Type::insert(Fl_Type *g) { g->prev = end; update_visibility_flag(this); #ifdef FLUID_OPTION_MERGEBACK - { // make sure that we have no duplicate uid's + if (g_project.write_mergeback_data) { // make sure that we have no duplicate uid's Fl_Type *tp = this; do { tp->set_uid(tp->uid_); diff --git a/fluid/file.cxx b/fluid/file.cxx index 9f5b78c391..4509a7a739 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -384,6 +384,8 @@ Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strate if (!cc || !strcmp(cc,"}")) break; t->read_property(*this, cc); } + if (g_project.write_mergeback_data && t->get_uid()==0) + t->set_uid(0); if (t->can_have_children()) { c = read_word(1);