From 5d69828ed08c5f3a254a2d5ae9a9ed65decb54a7 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 14 Jul 2023 23:42:09 +0200 Subject: FLUID: fixes all overlapping widgets in all .fl files Also fixes an issue with multiple use of the same variable for different types of i18n. --- fluid/code.cxx | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'fluid/code.cxx') diff --git a/fluid/code.cxx b/fluid/code.cxx index f9f7a62df..7310c593f 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -134,7 +134,7 @@ int write_strings(const char *sfile) { case 2 : /* POSIX catgets, put a .msg file out */ fprintf(fp, "$ generated by Fast Light User Interface Designer (fluid) version %.4f\n", FL_VERSION); - fprintf(fp, "$set %s\n", g_project.i18n_set.c_str()); + fprintf(fp, "$set %s\n", g_project.i18n_pos_set.c_str()); fputs("$quote \"\n", fp); for (i = 1, p = Fl_Type::first; p; p = p->next) { @@ -774,33 +774,40 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview) write_c("#include \"%s\"\n", t); } } - if (g_project.i18n_type && g_project.i18n_include[0]) { - int conditional = (g_project.i18n_conditional[0]!=0); + Fl_String loc_include, loc_conditional; + if (g_project.i18n_type==1) { + loc_include = g_project.i18n_gnu_include; + loc_conditional = g_project.i18n_gnu_conditional; + } else { + loc_include = g_project.i18n_pos_include; + loc_conditional = g_project.i18n_pos_conditional; + } + if (g_project.i18n_type && !loc_include.empty()) { + int conditional = !loc_conditional.empty(); if (conditional) { - write_c("#ifdef %s\n", g_project.i18n_conditional.c_str()); + write_c("#ifdef %s\n", loc_conditional.c_str()); indentation++; } - if (g_project.i18n_include[0] != '<' && - g_project.i18n_include[0] != '\"') - write_c("#%sinclude \"%s\"\n", indent(), g_project.i18n_include.c_str()); + if (loc_include[0] != '<' && loc_include[0] != '\"') + write_c("#%sinclude \"%s\"\n", indent(), loc_include.c_str()); else - write_c("#%sinclude %s\n", indent(), g_project.i18n_include.c_str()); + write_c("#%sinclude %s\n", indent(), loc_include.c_str()); if (g_project.i18n_type == 2) { - if (g_project.i18n_file[0]) { - write_c("extern nl_catd %s;\n", g_project.i18n_file.c_str()); + if (!g_project.i18n_pos_file.empty()) { + write_c("extern nl_catd %s;\n", g_project.i18n_pos_file.c_str()); } else { write_c("// Initialize I18N stuff now for menus...\n"); write_c("#%sinclude \n", indent()); write_c("static char *_locale = setlocale(LC_MESSAGES, \"\");\n"); - write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", g_project.i18n_program.c_str()); + write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", g_project.basename.c_str()); } } if (conditional) { write_c("#else\n"); if (g_project.i18n_type == 1) { - if (g_project.i18n_function[0]) { - write_c("#%sifndef %s\n", indent(), g_project.i18n_function.c_str()); - write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_function.c_str()); + if (!g_project.i18n_gnu_function.empty()) { + write_c("#%sifndef %s\n", indent(), g_project.i18n_gnu_function.c_str()); + write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_gnu_function.c_str()); write_c("#%sendif\n", indent()); } } @@ -812,9 +819,9 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview) indentation--; write_c("#endif\n"); } - if (g_project.i18n_type == 1 && g_project.i18n_static_function[0]) { - write_c("#ifndef %s\n", g_project.i18n_static_function.c_str()); - write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_static_function.c_str()); + if (g_project.i18n_type == 1 && g_project.i18n_gnu_static_function[0]) { + write_c("#ifndef %s\n", g_project.i18n_gnu_static_function.c_str()); + write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_gnu_static_function.c_str()); write_c("#endif\n"); } } -- cgit v1.2.3