Skip to content

Commit

Permalink
Updating the Preferences Mode to ignore locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasWM committed Jan 19, 2022
1 parent cc33f94 commit 50cf313
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
14 changes: 7 additions & 7 deletions fluid/Fl_Function_Type.cxx
Expand Up @@ -1530,7 +1530,7 @@ static void load_comments_preset(Fl_Preferences &menu) {
"FLTK/Header" };
int i;
menu.set("n", 5);
Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
for (i=0; i<5; i++) {
menu.set(Fl_Preferences::Name(i), predefined_comment[i]);
db.set(predefined_comment[i], comment_text[i]);
Expand All @@ -1545,7 +1545,7 @@ void Fl_Comment_Type::open() {
const char *text = name();
{
int i=0, n=0;
Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
Fl_Preferences menu(Fl_Preferences::USER_L, "fltk.org", "fluid_comments_menu");
comment_predefined->clear();
comment_predefined->add("_Edit/Add current comment...");
comment_predefined->add("_Edit/Remove last selection...");
Expand Down Expand Up @@ -1583,9 +1583,9 @@ void Fl_Comment_Type::open() {
char *name = fl_strdup(xname);
for (char*s=name;*s;s++) if (*s==':') *s = ';';
int n;
Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
db.set(name, comment_input->buffer()->text());
Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
Fl_Preferences menu(Fl_Preferences::USER_L, "fltk.org", "fluid_comments_menu");
menu.get("n", n, 0);
menu.set(Fl_Preferences::Name(n), name);
menu.set("n", ++n);
Expand All @@ -1599,10 +1599,10 @@ void Fl_Comment_Type::open() {
} else if (fl_choice("Are you sure that you want to delete the entry\n"
"\"%s\"\nfrom the database?", "Cancel", "Delete",
NULL, itempath)) {
Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
db.deleteEntry(itempath);
comment_predefined->remove(last_selected_item);
Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
Fl_Preferences menu(Fl_Preferences::USER_L, "fltk.org", "fluid_comments_menu");
int i, n;
for (i=4, n=0; i<comment_predefined->size(); i++) {
const Fl_Menu_Item *mi = comment_predefined->menu()+i;
Expand All @@ -1617,7 +1617,7 @@ void Fl_Comment_Type::open() {
// load the selected comment from the database
if (comment_predefined->item_pathname(itempath, 255)==0) {
if (itempath[0]=='/') memmove(itempath, itempath+1, 255);
Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
char *text;
db.get(itempath, text, "(no text found in data base)");
comment_input->buffer()->text(text);
Expand Down
23 changes: 14 additions & 9 deletions fluid/alignment_panel.fl
@@ -1,5 +1,10 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0400
i18n_type 1
i18n_include {<libintl.h>}
i18n_conditional FLTK_GETTEXT_FOUND
i18n_function gettext
i18n_static_function gettext_noop
header_name {.h}
code_name {.cxx}
comment {//
Expand Down Expand Up @@ -35,7 +40,7 @@ decl {\#include <FL/Fl_Text_Buffer.H>} {public local
decl {\#include <FL/Fl_Text_Display.H>} {public local
}

decl {\#include <FL/filename.H>} {selected public local
decl {\#include <FL/filename.H>} {public local
}

decl {\#include <FL/Fl_Preferences.H>} {private global
Expand Down Expand Up @@ -323,7 +328,7 @@ Function {make_shell_window()} {open
tooltip {save the design to the .fl file before running the command} xywh {82 39 136 19} down_box DOWN_BOX labelsize 12
}
Fl_Check_Button shell_writecode_button {
label {save source code}
label {save source code} selected
tooltip {generate the source code and header file before running the command} xywh {82 59 120 19} down_box DOWN_BOX labelsize 12
}
Fl_Check_Button shell_writemsgs_button {
Expand Down Expand Up @@ -524,11 +529,11 @@ wShowZoomFactor->value(opt[Fl::OPTION_SHOW_SCALING][mode]);} {}
}

Function {readPrefs()} {
comment {read all preferences and refresh the GUI} private return_type void
comment {read all preferences and refresh the GUI} open private return_type void
} {
code {// read all preferences and refresh the GUI
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2);
Expand All @@ -539,7 +544,7 @@ Function {readPrefs()} {
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2);
Expand All @@ -553,11 +558,11 @@ refreshUI();} {}
}

Function {writePrefs()} {
comment {write all preferences using the array} private return_type void
comment {write all preferences using the array} open private return_type void
} {
code {// write all preferences using the array
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][1]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1]);
Expand All @@ -575,7 +580,7 @@ Function {writePrefs()} {
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][0]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0]);
Expand All @@ -594,7 +599,7 @@ Function {writePrefs()} {
}} {}
}

Function {show_global_settings_window()} {return_type void
Function {show_global_settings_window()} {open return_type void
} {
code {if (!global_settings_window)
make_global_settings_window();
Expand Down
2 changes: 1 addition & 1 deletion fluid/fluid.cxx
Expand Up @@ -72,7 +72,7 @@ Fl_Menu_Bar *main_menubar = NULL;
Fl_Window *main_window;

/// Fluid application preferences, allways accessible, will be flushed when app closes.
Fl_Preferences fluid_prefs(Fl_Preferences::USER, "fltk.org", "fluid");
Fl_Preferences fluid_prefs(Fl_Preferences::USER_L, "fltk.org", "fluid");

/// Align widget position and size when designing, saved in app preferences and project file.
int gridx = 5;
Expand Down
2 changes: 1 addition & 1 deletion test/blocks.cxx
Expand Up @@ -497,7 +497,7 @@ class BlockWindow : public Fl_Double_Window {
};


Fl_Preferences BlockWindow::prefs_(Fl_Preferences::USER, "fltk.org", "blocks");
Fl_Preferences BlockWindow::prefs_(Fl_Preferences::USER_L, "fltk.org", "blocks");


int main(int argc, char *argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion test/sudoku.cxx
Expand Up @@ -625,7 +625,7 @@ SudokuCell::handle(int event) {

// Sudoku class globals...
Fl_Help_Dialog *Sudoku::help_dialog_ = (Fl_Help_Dialog *)0;
Fl_Preferences Sudoku::prefs_(Fl_Preferences::USER, "fltk.org", "sudoku");
Fl_Preferences Sudoku::prefs_(Fl_Preferences::USER_L, "fltk.org", "sudoku");


// Create a Sudoku game window...
Expand Down

0 comments on commit 50cf313

Please sign in to comment.