summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--fluid/Fl_Menu_Type.cxx21
-rw-r--r--fluid/Fl_Type.cxx5
-rw-r--r--fluid/Fl_Type.h1
-rw-r--r--fluid/Fl_Widget_Type.cxx10
-rw-r--r--fluid/Fl_Window_Type.cxx11
-rw-r--r--fluid/alignment_panel.cxx30
-rw-r--r--fluid/alignment_panel.fl23
-rw-r--r--fluid/alignment_panel.h9
-rw-r--r--fluid/file.cxx6
10 files changed, 85 insertions, 33 deletions
diff --git a/CHANGES b/CHANGES
index de95d7972..5b5d7b281 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.8
- Documentation fixes (STR #1454, STR #1455, STR #1456,
STR #1457, STR #1458, STR #1460, STR #1481, STR #1578,
STR #1639, STR #1645, STR #1644)
+ - New option in Fluid project settings to translate all
+ shortcut modifiers from FL_META or FL_CTRL to FL_COMMAND
- Added static icon, text selection, and HTML formatting to
fl_message etc. (STR #1626)
- Fixed selection of first word in Fl_Help_View
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index fe2bc73a9..94bd160e7 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -308,9 +308,14 @@ void Fl_Menu_Item_Type::write_item() {
}
}
else write_c("\"\"");
- if (((Fl_Button*)o)->shortcut())
- write_c(", 0x%x, ", ((Fl_Button*)o)->shortcut());
- else
+ if (((Fl_Button*)o)->shortcut()) {
+ int s = ((Fl_Button*)o)->shortcut();
+ if (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);
+ }
+ } else
write_c(", 0, ");
if (callback()) {
const char* k = is_name(callback()) ? 0 : class_name(1);
@@ -544,7 +549,13 @@ 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);
- fl_draw(fl_shortcut_label(svalue),x()+6,y(),w(),h(),FL_ALIGN_LEFT);
+ if (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);
+ } else {
+ fl_draw(fl_shortcut_label(svalue),x()+6,y(),w(),h(),FL_ALIGN_LEFT);
+ }
}
int Shortcut_Button::handle(int e) {
@@ -562,7 +573,7 @@ int Shortcut_Button::handle(int e) {
v = Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT) | Fl::event_key();
if (v == FL_BackSpace && svalue) v = 0;
}
- if (v != svalue) {svalue = v; set_changed(); redraw(); do_callback(); }
+ if (v != svalue) {svalue = v; set_changed(); redraw(); do_callback(); }
return 1;
} else if (e == FL_UNFOCUS) {
int c = changed(); value(0); if (c) set_changed();
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx
index eb28bcc12..75be910f4 100644
--- a/fluid/Fl_Type.cxx
+++ b/fluid/Fl_Type.cxx
@@ -709,7 +709,10 @@ void delete_all(int selected_only) {
f = g;
} else f = f->next;
}
- if(!selected_only) include_H_from_C=1;
+ if(!selected_only) {
+ include_H_from_C=1;
+ use_FL_COMMAND=0;
+ }
selection_changed(0);
}
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index f5a18d831..0eed936a2 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -763,6 +763,7 @@ const char *c_check(const char *c, int type = 0);
int storestring(const char *n, const char * & p, int nostrip=0);
extern int include_H_from_C;
+extern int use_FL_COMMAND;
//
// End of "$Id$".
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index d7851f9c5..087297752 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -2138,8 +2138,14 @@ void Fl_Widget_Type::write_widget_code() {
if (b->down_box()) write_c("%s%s->down_box(FL_%s);\n", indent(), var,
boxname(b->down_box()));
if (b->value()) write_c("%s%s->value(1);\n", indent(), var);
- if (b->shortcut())
- write_c("%s%s->shortcut(0x%x);\n", indent(), var, b->shortcut());
+ if (b->shortcut()) {
+ int s = b->shortcut();
+ if (use_FL_COMMAND && (s & (FL_CTRL|FL_META))) {
+ write_c("%s%s->shortcut(FL_COMMAND|0x%x);\n", indent(), var, s & ~(FL_CTRL|FL_META));
+ } else {
+ write_c("%s%s->shortcut(0x%x);\n", indent(), var, s);
+ }
+ }
} else if (!strcmp(type_name(), "Fl_Input_Choice")) {
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
if (b->down_box()) write_c("%s%s->down_box(FL_%s);\n", indent(), var,
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index dec2cddef..f43a14929 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -49,6 +49,7 @@ extern int snap;
extern int show_guides;
int include_H_from_C = 1;
+int use_FL_COMMAND = 0;
extern int i18n_type;
extern const char* i18n_include;
extern const char* i18n_function;
@@ -183,6 +184,7 @@ extern const char* code_file_name;
void show_project_cb(Fl_Widget *, void *) {
if(project_window==0) make_project_window();
include_H_from_C_button->value(include_H_from_C);
+ use_FL_COMMAND_button->value(use_FL_COMMAND);
header_file_input->value(header_file_name);
code_file_input->value(code_file_name);
i18n_type_chooser->value(i18n_type);
@@ -247,13 +249,20 @@ void code_input_cb(Fl_Input* i, void*) {
code_file_name = i->value();
}
-void include_H_from_C_button_cb(Fl_Light_Button* b, void*) {
+void include_H_from_C_button_cb(Fl_Check_Button* b, void*) {
if (include_H_from_C != b->value()) {
set_modflag(1);
include_H_from_C = b->value();
}
}
+void use_FL_COMMAND_button_cb(Fl_Check_Button* b, void*) {
+ if (use_FL_COMMAND != b->value()) {
+ set_modflag(1);
+ use_FL_COMMAND = b->value();
+ }
+}
+
////////////////////////////////////////////////////////////////
Fl_Menu_Item window_type_menu[] = {
diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx
index c4e253350..09acba752 100644
--- a/fluid/alignment_panel.cxx
+++ b/fluid/alignment_panel.cxx
@@ -39,7 +39,9 @@ Fl_Input *header_file_input=(Fl_Input *)0;
Fl_Input *code_file_input=(Fl_Input *)0;
-Fl_Light_Button *include_H_from_C_button=(Fl_Light_Button *)0;
+Fl_Check_Button *include_H_from_C_button=(Fl_Check_Button *)0;
+
+Fl_Check_Button *use_FL_COMMAND_button=(Fl_Check_Button *)0;
Fl_Choice *i18n_type_chooser=(Fl_Choice *)0;
@@ -59,20 +61,20 @@ Fl_Input *i18n_set_input=(Fl_Input *)0;
Fl_Input *i18n_function_input=(Fl_Input *)0;
Fl_Double_Window* make_project_window() {
- { project_window = new Fl_Double_Window(345, 190, "Project Settings");
- { Fl_Button* o = new Fl_Button(293, 160, 42, 20, "Close");
+ { project_window = new Fl_Double_Window(358, 207, "Project Settings");
+ { Fl_Button* o = new Fl_Button(293, 175, 52, 20, "Close");
o->tooltip("Close this dialog.");
o->labelsize(11);
o->callback((Fl_Callback*)cb_Close);
} // Fl_Button* o
- { Fl_Tabs* o = new Fl_Tabs(10, 10, 325, 140);
+ { Fl_Tabs* o = new Fl_Tabs(10, 10, 335, 151);
o->selection_color((Fl_Color)12);
o->labelsize(11);
- { Fl_Group* o = new Fl_Group(10, 30, 325, 116, "Output");
+ { Fl_Group* o = new Fl_Group(10, 30, 335, 131, "Output");
o->labelsize(11);
- { Fl_Box* o = new Fl_Box(20, 40, 304, 15, "Use \"name.ext\" to set name or just \".ext\" to set extension.");
+ { Fl_Box* o = new Fl_Box(15, 40, 325, 15, "Use \"name.ext\" to set name or just \".ext\" to set extension.");
o->labelsize(11);
- o->align(132|FL_ALIGN_INSIDE);
+ o->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE);
} // Fl_Box* o
{ header_file_input = new Fl_Input(96, 60, 228, 20, "Header File:");
header_file_input->tooltip("The name of the generated header file.");
@@ -94,15 +96,21 @@ Fl_Double_Window* make_project_window() {
code_file_input->callback((Fl_Callback*)code_input_cb, (void*)(1));
code_file_input->when(FL_WHEN_CHANGED);
} // Fl_Input* code_file_input
- { include_H_from_C_button = new Fl_Light_Button(166, 110, 158, 20, "Include Header from Code");
+ { include_H_from_C_button = new Fl_Check_Button(95, 110, 145, 20, "Include Header from Code");
include_H_from_C_button->tooltip("Include the header file from the code file.");
- include_H_from_C_button->value(1);
+ include_H_from_C_button->down_box(FL_DOWN_BOX);
include_H_from_C_button->labelsize(11);
include_H_from_C_button->callback((Fl_Callback*)include_H_from_C_button_cb);
- } // Fl_Light_Button* include_H_from_C_button
+ } // Fl_Check_Button* include_H_from_C_button
+ { use_FL_COMMAND_button = new Fl_Check_Button(95, 130, 245, 20, "Generate menu shortcuts using FL_COMMAND");
+ use_FL_COMMAND_button->tooltip("Replace FL_CTRL with FL_COMMAND when generating menu shortcut code.");
+ use_FL_COMMAND_button->down_box(FL_DOWN_BOX);
+ use_FL_COMMAND_button->labelsize(11);
+ use_FL_COMMAND_button->callback((Fl_Callback*)use_FL_COMMAND_button_cb);
+ } // Fl_Check_Button* use_FL_COMMAND_button
o->end();
} // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 30, 325, 116, "Internationalization");
+ { Fl_Group* o = new Fl_Group(10, 30, 335, 131, "Internationalization");
o->labelsize(11);
o->hide();
{ i18n_type_chooser = new Fl_Choice(80, 42, 100, 20, "Use:");
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index d8a38e53f..db155c688 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -44,25 +44,25 @@ Function {make_project_window()} {open
} {
Fl_Window project_window {
label {Project Settings}
- xywh {312 395 345 190} type Double
+ xywh {312 395 358 207} type Double
code0 {\#include <FL/Fl_Preferences.H>}
code1 {\#include <FL/Fl_Tooltip.H>} modal visible
} {
Fl_Button {} {
label Close
callback {project_window->hide();}
- tooltip {Close this dialog.} xywh {293 160 42 20} labelsize 11
+ tooltip {Close this dialog.} xywh {293 175 52 20} labelsize 11
}
Fl_Tabs {} {open
- xywh {10 10 325 140} selection_color 12 labelsize 11
+ xywh {10 10 335 151} selection_color 12 labelsize 11
} {
Fl_Group {} {
label Output open
- xywh {10 30 325 116} labelsize 11
+ xywh {10 30 335 131} labelsize 11
} {
Fl_Box {} {
label {Use "name.ext" to set name or just ".ext" to set extension.}
- xywh {20 40 304 15} labelsize 11 align 148
+ xywh {15 40 325 15} labelsize 11 align 144
}
Fl_Input header_file_input {
label {Header File:}
@@ -76,15 +76,20 @@ Function {make_project_window()} {open
callback code_input_cb
tooltip {The name of the generated code file.} xywh {97 85 227 20} box THIN_DOWN_BOX labelfont 1 labelsize 11 when 1 textfont 4 textsize 11
}
- Fl_Light_Button include_H_from_C_button {
+ Fl_Check_Button include_H_from_C_button {
label {Include Header from Code}
callback include_H_from_C_button_cb
- tooltip {Include the header file from the code file.} xywh {166 110 158 20} value 1 labelsize 11
+ tooltip {Include the header file from the code file.} xywh {95 110 145 20} down_box DOWN_BOX labelsize 11
+ }
+ Fl_Check_Button use_FL_COMMAND_button {
+ label {Generate menu shortcuts using FL_COMMAND}
+ callback use_FL_COMMAND_button_cb selected
+ tooltip {Replace FL_CTRL with FL_COMMAND when generating menu shortcut code.} xywh {95 130 245 20} down_box DOWN_BOX labelsize 11
}
}
Fl_Group {} {
label Internationalization open
- xywh {10 30 325 116} labelsize 11 hide
+ xywh {10 30 335 131} labelsize 11 hide
} {
Fl_Choice i18n_type_chooser {
label {Use:}
@@ -280,7 +285,7 @@ Function {make_shell_window()} {open
}
Fl_Button {} {
label Cancel
- callback {shell_window->hide();} selected
+ callback {shell_window->hide();}
xywh {285 90 72 25}
}
}
diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h
index fb2c96ace..0706d165d 100644
--- a/fluid/alignment_panel.h
+++ b/fluid/alignment_panel.h
@@ -46,9 +46,11 @@ extern void header_input_cb(Fl_Input*, void*);
extern Fl_Input *header_file_input;
extern void code_input_cb(Fl_Input*, void*);
extern Fl_Input *code_file_input;
-#include <FL/Fl_Light_Button.H>
-extern void include_H_from_C_button_cb(Fl_Light_Button*, void*);
-extern Fl_Light_Button *include_H_from_C_button;
+#include <FL/Fl_Check_Button.H>
+extern void include_H_from_C_button_cb(Fl_Check_Button*, void*);
+extern Fl_Check_Button *include_H_from_C_button;
+extern void use_FL_COMMAND_button_cb(Fl_Check_Button*, void*);
+extern Fl_Check_Button *use_FL_COMMAND_button;
#include <FL/Fl_Choice.H>
extern void i18n_type_cb(Fl_Choice*, void*);
extern Fl_Choice *i18n_type_chooser;
@@ -66,7 +68,6 @@ extern void scheme_cb(Fl_Choice *, void *);
extern Fl_Double_Window *settings_window;
extern void scheme_cb(Fl_Choice*, void*);
extern Fl_Choice *scheme_choice;
-#include <FL/Fl_Check_Button.H>
extern Fl_Check_Button *tooltips_button;
extern Fl_Check_Button *completion_button;
extern Fl_Check_Button *openlast_button;
diff --git a/fluid/file.cxx b/fluid/file.cxx
index 2bc47a6d8..f8bff43b2 100644
--- a/fluid/file.cxx
+++ b/fluid/file.cxx
@@ -323,6 +323,8 @@ int write_file(const char *filename, int selected_only) {
"version %.4f",FL_VERSION);
if(!include_H_from_C)
write_string("\ndo_not_include_H_from_C");
+ if(use_FL_COMMAND)
+ write_string("\nuse_FL_COMMAND");
if (i18n_type) {
write_string("\ni18n_type %d", i18n_type);
write_string("\ni18n_include %s", i18n_include);
@@ -404,6 +406,10 @@ static void read_children(Fl_Type *p, int paste) {
include_H_from_C=0;
goto CONTINUE;
}
+ if (!strcmp(c,"use_FL_COMMAND")) {
+ use_FL_COMMAND=1;
+ goto CONTINUE;
+ }
if (!strcmp(c,"i18n_type")) {
i18n_type = atoi(read_word());
goto CONTINUE;