diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-01-01 20:05:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-01 20:05:42 +0100 |
| commit | a63ad76603accc70747a2073c78139299064c43b (patch) | |
| tree | b64302ca02847a73d9c8445c11023cfc34314dff /fluid | |
| parent | 23e8d831a868774c014993d52eead0cbe105f218 (diff) | |
FLUID refactor and macOS warnings removed (#623)
P renamed to g_project
class Project renamed to class Fluid_Project
fixes macOS type cast warnings
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/ExternalCodeEditor_UNIX.cxx | 2 | ||||
| -rw-r--r-- | fluid/ExternalCodeEditor_WIN32.cxx | 2 | ||||
| -rw-r--r-- | fluid/Fl_Menu_Type.cxx | 30 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 18 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 82 | ||||
| -rw-r--r-- | fluid/Shortcut_Button.cxx | 2 | ||||
| -rw-r--r-- | fluid/code.cxx | 50 | ||||
| -rw-r--r-- | fluid/file.cxx | 62 | ||||
| -rw-r--r-- | fluid/fluid.cxx | 86 | ||||
| -rw-r--r-- | fluid/fluid.h | 8 | ||||
| -rw-r--r-- | fluid/shell_command.h | 2 | ||||
| -rw-r--r-- | fluid/widget_panel.cxx | 24 | ||||
| -rw-r--r-- | fluid/widget_panel.fl | 26 | ||||
| -rw-r--r-- | fluid/widget_panel.h | 4 |
14 files changed, 199 insertions, 199 deletions
diff --git a/fluid/ExternalCodeEditor_UNIX.cxx b/fluid/ExternalCodeEditor_UNIX.cxx index 10e7f7195..687927f70 100644 --- a/fluid/ExternalCodeEditor_UNIX.cxx +++ b/fluid/ExternalCodeEditor_UNIX.cxx @@ -291,7 +291,7 @@ const char* ExternalCodeEditor::tmp_filename() { static char path[FL_PATH_MAX+1]; const char *tmpdir = create_tmpdir(); if ( !tmpdir ) return 0; - const char *ext = P.code_file_name; // e.g. ".cxx" + const char *ext = g_project.code_file_name; // e.g. ".cxx" snprintf(path, FL_PATH_MAX, "%s/%p%s", tmpdir, (void*)this, ext); path[FL_PATH_MAX] = 0; return path; diff --git a/fluid/ExternalCodeEditor_WIN32.cxx b/fluid/ExternalCodeEditor_WIN32.cxx index 175a6e5b2..55d68ba57 100644 --- a/fluid/ExternalCodeEditor_WIN32.cxx +++ b/fluid/ExternalCodeEditor_WIN32.cxx @@ -359,7 +359,7 @@ const char* ExternalCodeEditor::tmp_filename() { static char path[512]; const char *tmpdir = create_tmpdir(); if ( !tmpdir ) return 0; - const char *ext = P.code_file_name; // e.g. ".cxx" + const char *ext = g_project.code_file_name; // e.g. ".cxx" _snprintf(path, sizeof(path), "%s\\%p%s", tmpdir, (void*)this, ext); path[sizeof(path)-1] = 0; return path; diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index 92445ff17..f0a7b6af1 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -378,10 +378,10 @@ void Fl_Menu_Item_Type::write_item() { write_comment_inline_c(" "); write_c(" {"); if (label() && label()[0]) - switch (P.i18n_type) { + switch (g_project.i18n_type) { case 1: // we will call i18n when the menu is instantiated for the first time - write_c("%s(", P.i18n_static_function.value()); + write_c("%s(", g_project.i18n_static_function.value()); write_cstring(label()); write_c(")"); break; @@ -394,7 +394,7 @@ void Fl_Menu_Item_Type::write_item() { write_c("\"\""); if (((Fl_Button*)o)->shortcut()) { int s = ((Fl_Button*)o)->shortcut(); - if (P.use_FL_COMMAND && (s & (FL_CTRL|FL_META))) { + if (g_project.use_FL_COMMAND && (s & (FL_CTRL|FL_META))) { write_c(", FL_COMMAND|0x%x, ", s & ~(FL_CTRL|FL_META)); } else { write_c(", 0x%x, ", s); @@ -474,15 +474,15 @@ void Fl_Menu_Item_Type::write_code1() { write_c("%sml->labela = (char*)", indent()); image->write_inline(); write_c(";\n"); - if (P.i18n_type==0) { + if (g_project.i18n_type==0) { write_c("%sml->labelb = o->label();\n", indent()); - } else if (P.i18n_type==1) { + } else if (g_project.i18n_type==1) { write_c("%sml->labelb = %s(o->label());\n", - indent(), P.i18n_function.value()); - } else if (P.i18n_type==2) { + indent(), g_project.i18n_function.value()); + } else if (g_project.i18n_type==2) { write_c("%sml->labelb = catgets(%s,%s,i+%d,o->label());\n", - indent(), P.i18n_file[0] ? P.i18n_file.value() : "_catalog", - P.i18n_set.value(), msgnum()); + indent(), g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog", + g_project.i18n_set.value(), msgnum()); } write_c("%sml->typea = FL_IMAGE_LABEL;\n", indent()); write_c("%sml->typeb = FL_NORMAL_LABEL;\n", indent()); @@ -491,20 +491,20 @@ void Fl_Menu_Item_Type::write_code1() { image->write_code(0, "o"); } } - if (P.i18n_type && label() && label()[0]) { + if (g_project.i18n_type && label() && label()[0]) { Fl_Labeltype t = o->labeltype(); if (image) { // label was already copied a few lines up } else if ( t==FL_NORMAL_LABEL || t==FL_SHADOW_LABEL || t==FL_ENGRAVED_LABEL || t==FL_EMBOSSED_LABEL) { start_menu_initialiser(menuItemInitialized, mname, i); - if (P.i18n_type==1) { + if (g_project.i18n_type==1) { write_c("%so->label(%s(o->label()));\n", - indent(), P.i18n_function.value()); - } else if (P.i18n_type==2) { + indent(), g_project.i18n_function.value()); + } else if (g_project.i18n_type==2) { write_c("%so->label(catgets(%s,%s,i+%d,o->label()));\n", - indent(), P.i18n_file[0] ? P.i18n_file.value() : "_catalog", - P.i18n_set.value(), msgnum()); + indent(), g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog", + g_project.i18n_set.value(), msgnum()); } } } diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 17e522e14..cab346b5d 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -2869,18 +2869,18 @@ void Fl_Widget_Type::write_code1() { } if (label() && *label()) { write_c(", "); - switch (P.i18n_type) { + switch (g_project.i18n_type) { case 0 : /* None */ write_cstring(label()); break; case 1 : /* GNU gettext */ - write_c("%s(", P.i18n_function.value()); + write_c("%s(", g_project.i18n_function.value()); write_cstring(label()); write_c(")"); break; case 2 : /* POSIX catgets */ - write_c("catgets(%s,%s,%d,", P.i18n_file[0] ? P.i18n_file.value() : "_catalog", - P.i18n_set.value(), msgnum()); + write_c("catgets(%s,%s,%d,", g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog", + g_project.i18n_set.value(), msgnum()); write_cstring(label()); write_c(")"); break; @@ -2942,18 +2942,18 @@ void Fl_Widget_Type::write_widget_code() { if (tooltip() && *tooltip()) { write_c("%s%s->tooltip(",indent(), var); - switch (P.i18n_type) { + switch (g_project.i18n_type) { case 0 : /* None */ write_cstring(tooltip()); break; case 1 : /* GNU gettext */ - write_c("%s(", P.i18n_function.value()); + write_c("%s(", g_project.i18n_function.value()); write_cstring(tooltip()); write_c(")"); break; case 2 : /* POSIX catgets */ - write_c("catgets(%s,%s,%d,", P.i18n_file[0] ? P.i18n_file.value() : "_catalog", - P.i18n_set.value(), msgnum() + 1); + write_c("catgets(%s,%s,%d,", g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog", + g_project.i18n_set.value(), msgnum() + 1); write_cstring(tooltip()); write_c(")"); break; @@ -2975,7 +2975,7 @@ void Fl_Widget_Type::write_widget_code() { else if (is_value_input()) shortcut = ((Fl_Value_Input*)o)->shortcut(); else if (is_text_display()) shortcut = ((Fl_Text_Display*)o)->shortcut(); if (shortcut) { - if (P.use_FL_COMMAND && (shortcut & (FL_CTRL|FL_META))) { + if (g_project.use_FL_COMMAND && (shortcut & (FL_CTRL|FL_META))) { write_c("%s%s->shortcut(FL_COMMAND|0x%x);\n", indent(), var, shortcut & ~(FL_CTRL|FL_META)); } else { write_c("%s%s->shortcut(0x%x);\n", indent(), var, shortcut); diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 8f9ce2a14..a02f16baf 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -117,7 +117,7 @@ void default_widget_size_cb(Fl_Round_Button *b, long size) { void i18n_type_cb(Fl_Choice *c, void *) { undo_checkpoint(); - switch (P.i18n_type = c->value()) { + switch (g_project.i18n_type = c->value()) { case 0 : /* None */ i18n_include_input->hide(); i18n_conditional_input->hide(); @@ -128,13 +128,13 @@ void i18n_type_cb(Fl_Choice *c, void *) { break; case 1 : /* GNU gettext */ i18n_include_input->value("<libintl.h>"); - P.i18n_include = i18n_include_input->value(); + g_project.i18n_include = i18n_include_input->value(); i18n_conditional_input->value(""); - P.i18n_conditional = i18n_conditional_input->value(); + g_project.i18n_conditional = i18n_conditional_input->value(); i18n_function_input->value("gettext"); - P.i18n_function = i18n_function_input->value(); + g_project.i18n_function = i18n_function_input->value(); i18n_static_function_input->value("gettext_noop"); - P.i18n_static_function = i18n_static_function_input->value(); + g_project.i18n_static_function = i18n_static_function_input->value(); i18n_include_input->show(); i18n_conditional_input->show(); i18n_file_input->hide(); @@ -144,13 +144,13 @@ void i18n_type_cb(Fl_Choice *c, void *) { break; case 2 : /* POSIX cat */ i18n_include_input->value("<nl_types.h>"); - P.i18n_include = i18n_include_input->value(); + g_project.i18n_include = i18n_include_input->value(); i18n_conditional_input->value(""); - P.i18n_conditional = i18n_conditional_input->value(); + g_project.i18n_conditional = i18n_conditional_input->value(); i18n_file_input->value(""); - P.i18n_file = i18n_file_input->value(); + g_project.i18n_file = i18n_file_input->value(); i18n_set_input->value("1"); - P.i18n_set = i18n_set_input->value(); + g_project.i18n_set = i18n_set_input->value(); i18n_include_input->show(); i18n_conditional_input->show(); i18n_file_input->show(); @@ -167,15 +167,15 @@ void i18n_text_cb(Fl_Input *i, void *) { undo_checkpoint(); if (i == i18n_function_input) - P.i18n_function = i->value(); + g_project.i18n_function = i->value(); else if (i == i18n_static_function_input) - P.i18n_static_function = i->value(); + g_project.i18n_static_function = i->value(); else if (i == i18n_file_input) - P.i18n_file = i->value(); + g_project.i18n_file = i->value(); else if (i == i18n_include_input) - P.i18n_include = i->value(); + g_project.i18n_include = i->value(); else if (i == i18n_conditional_input) - P.i18n_conditional = i->value(); + g_project.i18n_conditional = i->value(); set_modflag(1); } @@ -184,27 +184,27 @@ void i18n_int_cb(Fl_Int_Input *i, void *) { undo_checkpoint(); if (i == i18n_set_input) - P.i18n_set = i->value(); + g_project.i18n_set = i->value(); set_modflag(1); } void show_project_cb(Fl_Widget *, void *) { if(project_window==0) make_project_window(); - include_H_from_C_button->value(P.include_H_from_C); - use_FL_COMMAND_button->value(P.use_FL_COMMAND); - utf8_in_src_button->value(P.utf8_in_src); - avoid_early_includes_button->value(P.avoid_early_includes); - header_file_input->value(P.header_file_name); - code_file_input->value(P.code_file_name); - i18n_type_chooser->value(P.i18n_type); - i18n_function_input->value(P.i18n_function); - i18n_static_function_input->value(P.i18n_static_function); - i18n_file_input->value(P.i18n_file); - i18n_set_input->value(P.i18n_set); - i18n_include_input->value(P.i18n_include); - i18n_conditional_input->value(P.i18n_conditional); - switch (P.i18n_type) { + include_H_from_C_button->value(g_project.include_H_from_C); + use_FL_COMMAND_button->value(g_project.use_FL_COMMAND); + utf8_in_src_button->value(g_project.utf8_in_src); + avoid_early_includes_button->value(g_project.avoid_early_includes); + header_file_input->value(g_project.header_file_name); + code_file_input->value(g_project.code_file_name); + i18n_type_chooser->value(g_project.i18n_type); + i18n_function_input->value(g_project.i18n_function); + i18n_static_function_input->value(g_project.i18n_static_function); + i18n_file_input->value(g_project.i18n_file); + i18n_set_input->value(g_project.i18n_set); + i18n_include_input->value(g_project.i18n_include); + i18n_conditional_input->value(g_project.i18n_conditional); + switch (g_project.i18n_type) { case 0 : /* None */ i18n_include_input->hide(); i18n_conditional_input->hide(); @@ -262,41 +262,41 @@ void show_global_settings_cb(Fl_Widget *, void *) { } void header_input_cb(Fl_Input* i, void*) { - if (strcmp(P.header_file_name, i->value())) + if (strcmp(g_project.header_file_name, i->value())) set_modflag(1); - P.header_file_name = i->value(); + g_project.header_file_name = i->value(); } void code_input_cb(Fl_Input* i, void*) { - if (strcmp(P.code_file_name, i->value())) + if (strcmp(g_project.code_file_name, i->value())) set_modflag(1); - P.code_file_name = i->value(); + g_project.code_file_name = i->value(); } void include_H_from_C_button_cb(Fl_Check_Button* b, void*) { - if (P.include_H_from_C != b->value()) { + if (g_project.include_H_from_C != b->value()) { set_modflag(1); - P.include_H_from_C = b->value(); + g_project.include_H_from_C = b->value(); } } void use_FL_COMMAND_button_cb(Fl_Check_Button* b, void*) { - if (P.use_FL_COMMAND != b->value()) { + if (g_project.use_FL_COMMAND != b->value()) { set_modflag(1); - P.use_FL_COMMAND = b->value(); + g_project.use_FL_COMMAND = b->value(); } } void utf8_in_src_cb(Fl_Check_Button *b, void*) { - if (P.utf8_in_src != b->value()) { + if (g_project.utf8_in_src != b->value()) { set_modflag(1); - P.utf8_in_src = b->value(); + g_project.utf8_in_src = b->value(); } } void avoid_early_includes_cb(Fl_Check_Button *b, void*) { - if (P.avoid_early_includes != b->value()) { + if (g_project.avoid_early_includes != b->value()) { set_modflag(1); - P.avoid_early_includes = b->value(); + g_project.avoid_early_includes = b->value(); } } diff --git a/fluid/Shortcut_Button.cxx b/fluid/Shortcut_Button.cxx index c1fa28162..134029082 100644 --- a/fluid/Shortcut_Button.cxx +++ b/fluid/Shortcut_Button.cxx @@ -44,7 +44,7 @@ void Shortcut_Button::draw() { if (value()) draw_box(FL_DOWN_BOX, (Fl_Color)9); else draw_box(FL_UP_BOX, FL_WHITE); fl_font(FL_HELVETICA,14); fl_color(FL_FOREGROUND_COLOR); - if (P.use_FL_COMMAND && (svalue & (FL_CTRL|FL_META))) { + if (g_project.use_FL_COMMAND && (svalue & (FL_CTRL|FL_META))) { char buf[1024]; fl_snprintf(buf, 1023, "Command+%s", fl_shortcut_label(svalue&~(FL_CTRL|FL_META))); fl_draw(buf,x()+6,y(),w(),h(),FL_ALIGN_LEFT); diff --git a/fluid/code.cxx b/fluid/code.cxx index 5cc02a241..6d1ab3f7c 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -270,7 +270,7 @@ void write_cstring(const char *s, int length) { break; } // if the UTF-8 option is checked, write unicode characters verbatim - if (P.utf8_in_src && (c&0x80)) { + if (g_project.utf8_in_src && (c&0x80)) { if ((c&0x40)) { // This is the first character in a utf-8 sequence (0b11......). // A line break would be ok here. Do not put linebreak in front of @@ -584,47 +584,47 @@ int write_code(const char *s, const char *t) { fprintf(header_file, "#define %s\n", define_name); } - if (P.avoid_early_includes==0) { + if (g_project.avoid_early_includes==0) { write_declare("#include <FL/Fl.H>"); } - if (t && P.include_H_from_C) { - if (P.header_file_name[0] == '.' && strchr(P.header_file_name, '/') == NULL) { + if (t && g_project.include_H_from_C) { + if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name, '/') == NULL) { write_c("#include \"%s\"\n", fl_filename_name(t)); } else { write_c("#include \"%s\"\n", t); } } - if (P.i18n_type && P.i18n_include[0]) { - int conditional = (P.i18n_conditional[0]!=0); + if (g_project.i18n_type && g_project.i18n_include[0]) { + int conditional = (g_project.i18n_conditional[0]!=0); if (conditional) { - write_c("#ifdef %s\n", P.i18n_conditional.value()); + write_c("#ifdef %s\n", g_project.i18n_conditional.value()); indentation++; } - if (P.i18n_include[0] != '<' && - P.i18n_include[0] != '\"') - write_c("#%sinclude \"%s\"\n", indent(), P.i18n_include.value()); + if (g_project.i18n_include[0] != '<' && + g_project.i18n_include[0] != '\"') + write_c("#%sinclude \"%s\"\n", indent(), g_project.i18n_include.value()); else - write_c("#%sinclude %s\n", indent(), P.i18n_include.value()); - if (P.i18n_type == 2) { - if (P.i18n_file[0]) { - write_c("extern nl_catd %s;\n", P.i18n_file.value()); + write_c("#%sinclude %s\n", indent(), g_project.i18n_include.value()); + if (g_project.i18n_type == 2) { + if (g_project.i18n_file[0]) { + write_c("extern nl_catd %s;\n", g_project.i18n_file.value()); } else { write_c("// Initialize I18N stuff now for menus...\n"); write_c("#%sinclude <locale.h>\n", indent()); write_c("static char *_locale = setlocale(LC_MESSAGES, \"\");\n"); - write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", P.i18n_program.value()); + write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", g_project.i18n_program.value()); } } if (conditional) { write_c("#else\n"); - if (P.i18n_type == 1) { - if (P.i18n_function[0]) { - write_c("#%sifndef %s\n", indent(), P.i18n_function.value()); - write_c("#%sdefine %s(text) text\n", indent_plus(1), P.i18n_function.value()); + if (g_project.i18n_type == 1) { + if (g_project.i18n_function[0]) { + write_c("#%sifndef %s\n", indent(), g_project.i18n_function.value()); + write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_function.value()); write_c("#%sendif\n", indent()); } } - if (P.i18n_type == 2) { + if (g_project.i18n_type == 2) { write_c("#%sifndef catgets\n", indent()); write_c("#%sdefine catgets(catalog, set, msgid, text) text\n", indent_plus(1)); write_c("#%sendif\n", indent()); @@ -632,9 +632,9 @@ int write_code(const char *s, const char *t) { indentation--; write_c("#endif\n"); } - if (P.i18n_type == 1 && P.i18n_static_function[0]) { - write_c("#ifndef %s\n", P.i18n_static_function.value()); - write_c("#%sdefine %s(text) text\n", indent_plus(1), P.i18n_static_function.value()); + if (g_project.i18n_type == 1 && g_project.i18n_static_function[0]) { + write_c("#ifndef %s\n", g_project.i18n_static_function.value()); + write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_static_function.value()); write_c("#endif\n"); } } @@ -692,7 +692,7 @@ int write_strings(const char *sfile) { if (!fp) return 1; - switch (P.i18n_type) { + switch (g_project.i18n_type) { case 0 : /* None, just put static text out */ fprintf(fp, "# generated by Fast Light User Interface Designer (fluid) version %.4f\n", FL_VERSION); @@ -772,7 +772,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", P.i18n_set.value()); + fprintf(fp, "$set %s\n", g_project.i18n_set.value()); fputs("$quote \"\n", fp); for (i = 1, p = Fl_Type::first; p; p = p->next) { diff --git a/fluid/file.cxx b/fluid/file.cxx index 9bbe0ce2a..cf457aa83 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -377,36 +377,36 @@ int write_file(const char *filename, int selected_only) { if (!open_write(filename)) return 0; write_string("# data file for the Fltk User Interface Designer (fluid)\n" "version %.4f",FL_VERSION); - if(!P.include_H_from_C) + if(!g_project.include_H_from_C) write_string("\ndo_not_include_H_from_C"); - if(P.use_FL_COMMAND) + if(g_project.use_FL_COMMAND) write_string("\nuse_FL_COMMAND"); - if (P.utf8_in_src) + if (g_project.utf8_in_src) write_string("\nutf8_in_src"); - if (P.avoid_early_includes) + if (g_project.avoid_early_includes) write_string("\navoid_early_includes"); - if (P.i18n_type) { - write_string("\ni18n_type %d", P.i18n_type); - write_string("\ni18n_include"); write_word(P.i18n_include); - write_string("\ni18n_conditional"); write_word(P.i18n_conditional); - switch (P.i18n_type) { + if (g_project.i18n_type) { + write_string("\ni18n_type %d", g_project.i18n_type); + write_string("\ni18n_include"); write_word(g_project.i18n_include); + write_string("\ni18n_conditional"); write_word(g_project.i18n_conditional); + switch (g_project.i18n_type) { case 1 : /* GNU gettext */ - write_string("\ni18n_function"); write_word(P.i18n_function); - write_string("\ni18n_static_function"); write_word(P.i18n_static_function); + write_string("\ni18n_function"); write_word(g_project.i18n_function); + write_string("\ni18n_static_function"); write_word(g_project.i18n_static_function); break; case 2 : /* POSIX catgets */ - if (P.i18n_file[0]) { + if (g_project.i18n_file[0]) { write_string("\ni18n_file"); - write_word(P.i18n_file); + write_word(g_project.i18n_file); } - write_string("\ni18n_set"); write_word(P.i18n_set); + write_string("\ni18n_set"); write_word(g_project.i18n_set); break; } } if (!selected_only) { - write_string("\nheader_name"); write_word(P.header_file_name); - write_string("\ncode_name"); write_word(P.code_file_name); + write_string("\nheader_name"); write_word(g_project.header_file_name); + write_string("\ncode_name"); write_word(g_project.code_file_name); #if 0 // https://github.com/fltk/fltk/issues/328 @@ -495,62 +495,62 @@ static void read_children(Fl_Type *p, int paste, Strategy strategy, char skip_op } if (!strcmp(c,"do_not_include_H_from_C")) { - P.include_H_from_C=0; + g_project.include_H_from_C=0; goto CONTINUE; } if (!strcmp(c,"use_FL_COMMAND")) { - P.use_FL_COMMAND=1; + g_project.use_FL_COMMAND=1; goto CONTINUE; } if (!strcmp(c,"utf8_in_src")) { - P.utf8_in_src=1; + g_project.utf8_in_src=1; goto CONTINUE; } if (!strcmp(c,"avoid_early_includes")) { - P.avoid_early_includes=1; + g_project.avoid_early_includes=1; goto CONTINUE; } if (!strcmp(c,"i18n_type")) { - P.i18n_type = atoi(read_word()); + g_project.i18n_type = atoi(read_word()); goto CONTINUE; } if (!strcmp(c,"i18n_function")) { - P.i18n_function = read_word(); + g_project.i18n_function = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_static_function")) { - P.i18n_static_function = read_word(); + g_project.i18n_static_function = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_file")) { - P.i18n_file = read_word(); + g_project.i18n_file = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_set")) { - P.i18n_set = read_word(); + g_project.i18n_set = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_include")) { - P.i18n_include = read_word(); + g_project.i18n_include = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_conditional")) { - P.i18n_conditional = read_word(); + g_project.i18n_conditional = read_word(); goto CONTINUE; } if (!strcmp(c,"i18n_type")) { - P.i18n_type = atoi(read_word()); + g_project.i18n_type = atoi(read_word()); goto CONTINUE; } if (!strcmp(c,"header_name")) { - if (!P.header_file_set) P.header_file_name = read_word(); + if (!g_project.header_file_set) g_project.header_file_name = read_word(); else read_word(); goto CONTINUE; } if (!strcmp(c,"code_name")) { - if (!P.code_file_set) P.code_file_name = read_word(); + if (!g_project.code_file_set) g_project.code_file_name = read_word(); else read_word(); goto CONTINUE; } @@ -649,7 +649,7 @@ int read_file(const char *filename, int merge, Strategy strategy) { if (merge) deselect(); else - P.reset(); + g_project.reset(); read_children(Fl_Type::current, merge, strategy); Fl_Type::current = 0; // Force menu items to be rebuilt... diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 38a74dec1..62c3e9636 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -167,28 +167,28 @@ int batch_mode = 0; // if set (-c, -u) don't open display Fd_String g_code_filename_arg; Fd_String g_header_filename_arg; -/** \var int Project::header_file_set +/** \var int Fluid_Project::header_file_set If set, commandline overrides header file name in .fl file. */ -/** \var int Project::code_file_set +/** \var int Fluid_Project::code_file_set If set, commandline overrides source code file name in .fl file. */ -/** \var int Project::header_file_name +/** \var int Fluid_Project::header_file_name Hold the default extension for header files, or the entire filename if set via command line. */ -/** \var int Project::code_file_name +/** \var int Fluid_Project::code_file_name Hold the default extension for source code files, or the entire filename if set via command line. */ -/** \var int Project::i18n_type +/** \var int Fluid_Project::i18n_type Saved in the .fl design file. \todo document me */ -/** \var int Project::i18n_include +/** \var int Fluid_Project::i18n_include For either type of translation, write a #include statement into the source file. @@ -202,12 +202,12 @@ Fd_String g_header_filename_arg; Saved in the .fl design file. */ -/** \var int Project::i18n_conditional +/** \var int Fluid_Project::i18n_conditional Saved in the .fl design file. \todo document me */ -/** \var int Project::i18n_function +/** \var int Fluid_Project::i18n_function For the gettext/intl.h options, this is the function that translates text at runtime. @@ -216,7 +216,7 @@ Fd_String g_header_filename_arg; Saved in the .fl design file. */ -/** \var int Project::i18n_static_function +/** \var int Fluid_Project::i18n_static_function For the gettext/intl.h options, this is the function that marks the translation of text at initialisation time. @@ -228,17 +228,17 @@ Fd_String g_header_filename_arg; Saved in the .fl design file. */ -/** \var int Project::i18n_file +/** \var int Fluid_Project::i18n_file Saved in the .fl design file. \todo document me */ -/** \var int Project::i18n_set +/** \var int Fluid_Project::i18n_set Saved in the .fl design file. \todo document me */ -/** \var int Project::i18n_program +/** \var int Fluid_Project::i18n_program \todo document me */ @@ -250,9 +250,9 @@ static int ipasteoffset = 0; // ---- project settings -Project P; +Fluid_Project g_project; -Project::Project() : +Fluid_Project::Fluid_Project() : i18n_type(0), include_H_from_C(1), use_FL_COMMAND(0), @@ -264,10 +264,10 @@ Project::Project() : code_file_name(".cxx") { } -Project::~Project() { +Fluid_Project::~Fluid_Project() { } -void Project::reset() { +void Fluid_Project::reset() { ::delete_all(); i18n_type = 0; i18n_include = ""; @@ -698,7 +698,7 @@ void exit_cb(Fl_Widget *,void *) { // Destroy tree // Doing so causes dtors to automatically close all external editors // and cleans up editor tmp files. Then remove fluid tmpdir /last/. - P.reset(); + g_project.reset(); ExternalCodeEditor::tmpdir_clear(); exit(0); @@ -865,7 +865,7 @@ void new_cb(Fl_Widget *, void *v) { } // Clear the current data... - P.reset(); + g_project.reset(); set_filename(NULL); set_modflag(0, 0); widget_browser->rebuild(); @@ -997,20 +997,20 @@ int write_code_files() { } char cname[FL_PATH_MAX+1]; char hname[FL_PATH_MAX+1]; - P.i18n_program = fl_filename_name(filename); - P.i18n_program.capacity(FL_PATH_MAX); - fl_filename_setext(P.i18n_program.buffer(), FL_PATH_MAX, ""); - if (P.code_file_name[0] == '.' && strchr(P.code_file_name, '/') == NULL) { + g_project.i18n_program = fl_filename_name(filename); + g_project.i18n_program.capacity(FL_PATH_MAX); + fl_filename_setext(g_project.i18n_program.buffer(), FL_PATH_MAX, ""); + if (g_project.code_file_name[0] == '.' && strchr(g_project.code_file_name, '/') == NULL) { strlcpy(cname, fl_filename_name(filename), FL_PATH_MAX); - fl_filename_setext(cname, FL_PATH_MAX, P.code_file_name); + fl_filename_setext(cname, FL_PATH_MAX, g_project.code_file_name); } else { - strlcpy(cname, P.code_file_name, FL_PATH_MAX); + strlcpy(cname, g_project.code_file_name, FL_PATH_MAX); } - if (P.header_file_name[0] == '.' && strchr(P.header_file_name, '/') == NULL) { + if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name, '/') == NULL) { strlcpy(hname, fl_filename_name(filename), FL_PATH_MAX); - fl_filename_setext(hname, FL_PATH_MAX, P.header_file_name); + fl_filename_setext(hname, FL_PATH_MAX, g_project.header_file_name); } else { - strlcpy(hname, P.header_file_name, FL_PATH_MAX); + strlcpy(hname, g_project.header_file_name, FL_PATH_MAX); } if (!batch_mode) enter_project_dir(); int x = write_code(cname,hname); @@ -1051,7 +1051,7 @@ void write_strings_cb(Fl_Widget *, void *) { } char sname[FL_PATH_MAX]; strlcpy(sname, fl_filename_name(filename), sizeof(sname)); - fl_filename_setext(sname, sizeof(sname), exts[P.i18n_type]); + fl_filename_setext(sname, sizeof(sname), exts[g_project.i18n_type]); if (!batch_mode) enter_project_dir(); int x = write_strings(sname); if (!batch_mode) leave_project_dir(); @@ -1757,7 +1757,7 @@ void set_modflag(int mf, int mfc) { #endif // _WIN32 else basename = filename; - code_ext = fl_filename_ext(P.code_file_name); + code_ext = fl_filename_ext(g_project.code_file_name); char mod_star = modflag ? '*' : ' '; char mod_c_star = modflag_c ? '*' : ' '; snprintf(title, sizeof(title), "%s%c %s%c", @@ -1872,19 +1872,19 @@ void update_sourceview_cb(Fl_Button*, void*) static const char *exts[] = { ".txt", ".po", ".msg" }; char fn[FL_PATH_MAX]; fluid_prefs.getUserdataPath(fn, FL_PATH_MAX); - fl_filename_setext(fn, FL_PATH_MAX, exts[P.i18n_type]); + fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]); write_strings(fn); int top = sv_strings->top_line(); sv_strings->buffer()->loadfile(fn); sv_strings->scroll(top, 0); } else if (sv_source->visible_r() || sv_header->visible_r()) { - P.i18n_program = fl_filename_name(sv_source_filename); - P.i18n_program.capacity(FL_PATH_MAX); - fl_filename_setext(P.i18n_program.buffer(), FL_PATH_MAX, ""); - Fd_String code_file_name_bak = P.code_file_name; - P.code_file_name = sv_source_filename; - Fd_String header_file_name_bak = P.header_file_name; - P.header_file_name = sv_header_filename; + g_project.i18n_program = fl_filename_name(sv_source_filename); + g_project.i18n_program.capacity(FL_PATH_MAX); + fl_filename_setext(g_project.i18n_program.buffer(), FL_PATH_MAX, ""); + Fd_String code_file_name_bak = g_project.code_file_name; + g_project.code_file_name = sv_source_filename; + Fd_String header_file_name_bak = g_project.header_file_name; + g_project.header_file_name = sv_header_filename; // generate the code and load the files write_sourceview = 1; @@ -1904,8 +1904,8 @@ void update_sourceview_cb(Fl_Button*, void*) } write_sourceview = 0; - P.code_file_name = code_file_name_bak; - P.header_file_name = header_file_name_bak; + g_project.code_file_name = code_file_name_bak; + g_project.header_file_name = header_file_name_bak; } } @@ -2059,12 +2059,12 @@ int main(int argc,char **argv) { // command line args override code and header filenams from the project file if (!g_code_filename_arg.empty()) { - P.code_file_set = 1; - P.code_file_name = g_code_filename_arg; + g_project.code_file_set = 1; + g_project.code_file_name = g_code_filename_arg; } if (!g_header_filename_arg.empty()) { - P.header_file_set = 1; - P.header_file_name = g_header_filename_arg; + g_project.header_file_set = 1; + g_project.header_file_name = g_header_filename_arg; } if (update_file) { // fluid -u diff --git a/fluid/fluid.h b/fluid/fluid.h index 52ba75ba2..c7b800849 100644 --- a/fluid/fluid.h +++ b/fluid/fluid.h @@ -92,10 +92,10 @@ public: // ---- project settings -class Project { +class Fluid_Project { public: - Project(); - ~Project(); + Fluid_Project(); + ~Fluid_Project(); void reset(); int i18n_type; @@ -116,7 +116,7 @@ public: Fd_String code_file_name; }; -extern Project P; +extern Fluid_Project g_project; extern Fd_String g_code_filename_arg; extern Fd_String g_header_filename_arg; diff --git a/fluid/shell_command.h b/fluid/shell_command.h index 8a1f4e2a2..530b34310 100644 --- a/fluid/shell_command.h +++ b/fluid/shell_command.h @@ -70,7 +70,7 @@ public: int get_fileno() const; -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) protected: HANDLE pin[2], pout[2], perr[2]; char ptmode; diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 4464f417d..1c8c97696 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -178,12 +178,6 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)image_browse_cb); } // Fl_Button* o - { Fl_Button* o = new Fl_Button(384, 65, 20, 20); - o->tooltip("bind the image to the widget, so it will be deleted automatically"); - o->type(1); - o->callback((Fl_Callback*)bind_image_cb); - o->image(bind_pixmap); - } // Fl_Button* o { Fl_Button* o = new Fl_Button(364, 65, 20, 20); o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\ mat"); @@ -191,6 +185,12 @@ mat"); o->callback((Fl_Callback*)compress_image_cb); o->image(compressed_pixmap); } // Fl_Button* o + { Fl_Button* o = new Fl_Button(384, 65, 20, 20); + o->tooltip("bind the image to the widget, so it will be deleted automatically"); + o->type(1); + o->callback((Fl_Callback*)bind_image_cb); + o->image(bind_pixmap); + } // Fl_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(95, 90, 309, 20, "Inactive:"); @@ -211,12 +211,6 @@ mat"); o->labelsize(11); o->callback((Fl_Callback*)inactive_browse_cb); } // Fl_Button* o - { Fl_Button* o = new Fl_Button(384, 90, 20, 20); - o->tooltip("bind the image to the widget, so it will be deleted automatically"); - o->type(1); - o->callback((Fl_Callback*)bind_deimage_cb); - o->image(bind_pixmap); - } // Fl_Button* o { Fl_Button* o = new Fl_Button(364, 90, 20, 20); o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\ mat"); @@ -224,6 +218,12 @@ mat"); o->callback((Fl_Callback*)compress_deimage_cb); o->image(compressed_pixmap); } // Fl_Button* o + { Fl_Button* o = new Fl_Button(384, 90, 20, 20); + o->tooltip("bind the image to the widget, so it will be deleted automatically"); + o->type(1); + o->callback((Fl_Callback*)bind_deimage_cb); + o->image(bind_pixmap); + } // Fl_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(95, 115, 310, 20, "Alignment:"); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index 2673aed86..e36e73afe 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -75,18 +75,18 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t tooltip {Click to choose the active image.} xywh {294 65 70 20} labelsize 11 } Fl_Button {} { - callback bind_image_cb - tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 65 20 20} type Toggle - code0 {o->image(bind_pixmap);} - code3 {\#include "pixmaps.h"} - } - Fl_Button {} { callback compress_image_cb tooltip {store image uncompressed as RGBA data or compressed in the original file format} xywh {364 65 20 20} type Toggle code0 {o->image(compressed_pixmap);} code3 {\#include "pixmaps.h"} } + Fl_Button {} { + callback bind_image_cb + tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 65 20 20} type Toggle + code0 {o->image(bind_pixmap);} + code3 {\#include "pixmaps.h"} + } } Fl_Group {} { label {Inactive:} @@ -103,18 +103,18 @@ or compressed in the original file format} xywh {364 65 20 20} type Toggle tooltip {Click to choose the inactive image.} xywh {294 90 70 20} labelsize 11 } Fl_Button {} { - callback bind_deimage_cb - tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 90 20 20} type Toggle - code0 {o->image(bind_pixmap);} - code3 {\#include "pixmaps.h"} - } - Fl_Button {} { callback compress_deimage_cb tooltip {store image uncompressed as RGBA data or compressed in the original file format} xywh {364 90 20 20} type Toggle code0 {o->image(compressed_pixmap);} code3 {\#include "pixmaps.h"} } + Fl_Button {} { + callback bind_deimage_cb selected + tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 90 20 20} type Toggle + code0 {o->image(bind_pixmap);} + code3 {\#include "pixmaps.h"} + } } Fl_Group {} { label {Alignment:} @@ -812,7 +812,7 @@ wCallback->do_callback(wCallback, v);} open } Fl_Button wLiveMode { label {Live &Resize} - callback live_mode_cb selected + callback live_mode_cb tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {155 370 80 20} type Toggle labelsize 11 } Fl_Button {} { diff --git a/fluid/widget_panel.h b/fluid/widget_panel.h index 630e5fd60..6d6ddfe95 100644 --- a/fluid/widget_panel.h +++ b/fluid/widget_panel.h @@ -33,12 +33,12 @@ extern void image_cb(Fl_Input*, void*); #include <FL/Fl_Button.H> extern void image_browse_cb(Fl_Button*, void*); #include "pixmaps.h" -extern void bind_image_cb(Fl_Button*, void*); extern void compress_image_cb(Fl_Button*, void*); +extern void bind_image_cb(Fl_Button*, void*); extern void inactive_cb(Fl_Input*, void*); extern void inactive_browse_cb(Fl_Button*, void*); -extern void bind_deimage_cb(Fl_Button*, void*); extern void compress_deimage_cb(Fl_Button*, void*); +extern void bind_deimage_cb(Fl_Button*, void*); extern void align_cb(Fl_Button*, void*); extern void align_text_image_cb(Fl_Choice*, void*); extern void align_position_cb(Fl_Choice*, void*); |
