summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fd_Snap_Action.cxx24
-rw-r--r--fluid/Fd_Snap_Action.h2
-rw-r--r--fluid/Fl_Widget_Type.cxx58
-rw-r--r--fluid/alignment_panel.cxx57
-rw-r--r--fluid/alignment_panel.fl50
-rw-r--r--fluid/alignment_panel.h2
-rw-r--r--fluid/factory.cxx15
7 files changed, 131 insertions, 77 deletions
diff --git a/fluid/Fd_Snap_Action.cxx b/fluid/Fd_Snap_Action.cxx
index cc1debf2f..e6949e68d 100644
--- a/fluid/Fd_Snap_Action.cxx
+++ b/fluid/Fd_Snap_Action.cxx
@@ -42,7 +42,7 @@ static Fd_Layout_Preset fltk_app = {
25, 25, // tabs: t, b
20, 10, 4, // widget_x: min, inc, gap
20, 4, 8, // widget_y: min, inc, gap
- 0, 14, 0, 14 // labelfont/size, textfont/size
+ 0, 14, -1, 14 // labelfont/size, textfont/size
};
static Fd_Layout_Preset fltk_dlg = {
10, 10, 10, 10, 0, 0, // window: l, r, t, b, gx, gy
@@ -50,7 +50,7 @@ static Fd_Layout_Preset fltk_dlg = {
20, 20, // tabs: t, b
20, 10, 5, // widget_x: min, inc, gap
20, 5, 5, // widget_y: min, inc, gap
- 0, 11, 0, 11 // labelfont/size, textfont/size
+ 0, 11, -1, 11 // labelfont/size, textfont/size
};
static Fd_Layout_Preset fltk_tool = {
10, 10, 10, 10, 0, 0, // window: l, r, t, b, gx, gy
@@ -58,7 +58,7 @@ static Fd_Layout_Preset fltk_tool = {
18, 18, // tabs: t, b
16, 8, 2, // widget_x: min, inc, gap
16, 4, 2, // widget_y: min, inc, gap
- 0, 10, 0, 10 // labelfont/size, textfont/size
+ 0, 10, -1, 10 // labelfont/size, textfont/size
};
static Fd_Layout_Preset grid_app = {
@@ -67,7 +67,7 @@ static Fd_Layout_Preset grid_app = {
24, 24, // tabs: t, b
12, 6, 6, // widget_x: min, inc, gap
12, 6, 6, // widget_y: min, inc, gap
- 0, 14, 0, 14 // labelfont/size, textfont/size
+ 0, 14, -1, 14 // labelfont/size, textfont/size
};
static Fd_Layout_Preset grid_dlg = {
@@ -76,7 +76,7 @@ static Fd_Layout_Preset grid_dlg = {
20, 20, // tabs: t, b
10, 5, 5, // widget_x: min, inc, gap
10, 5, 5, // widget_y: min, inc, gap
- 0, 12, 0, 12 // labelfont/size, textfont/size
+ 0, 12, -1, 12 // labelfont/size, textfont/size
};
static Fd_Layout_Preset grid_tool = {
@@ -85,7 +85,7 @@ static Fd_Layout_Preset grid_tool = {
16, 16, // tabs: t, b
8, 4, 4, // widget_x: min, inc, gap
8, 4, 4, // widget_y: min, inc, gap
- 0, 10, 0, 10 // labelfont/size, textfont/size
+ 0, 10, -1, 10 // labelfont/size, textfont/size
};
static Fd_Layout_Suite static_suite_list[] = {
@@ -302,6 +302,18 @@ void Fd_Layout_Preset::read(Fd_Project_Reader *in) {
}
}
+/**
+ Return the preferred text size, but make sure it's not 0.
+ */
+int Fd_Layout_Preset::textsize_not_null() {
+ // try the user selected text size
+ if (textsize > 0) return textsize;
+ // if the user did not set one, try the label size
+ if (labelsize > 0) return labelsize;
+ // if that doesn;t work, fall back to the default value
+ return 14;
+}
+
// ---- Fd_Layout_Suite ------------------------------------------------ MARK: -
diff --git a/fluid/Fd_Snap_Action.h b/fluid/Fd_Snap_Action.h
index afa8491d7..336a591d6 100644
--- a/fluid/Fd_Snap_Action.h
+++ b/fluid/Fd_Snap_Action.h
@@ -76,6 +76,8 @@ public:
void read(Fl_Preferences &prefs);
void write(Fd_Project_Writer*);
void read(Fd_Project_Reader*);
+
+ int textsize_not_null();
};
extern Fd_Layout_Preset *layout;
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index f24b1d081..674949df5 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -1300,23 +1300,45 @@ void active_cb(Fl_Light_Button* i, void* v) {
////////////////////////////////////////////////////////////////
Fl_Menu_Item fontmenu[] = {
-{"Helvetica"},
-{"Helvetica bold"},
-{"Helvetica italic"},
-{"Helvetica bold italic"},
-{"Courier"},
-{"Courier bold"},
-{"Courier italic"},
-{"Courier bold italic"},
-{"Times"},
-{"Times bold"},
-{"Times italic"},
-{"Times bold italic"},
-{"Symbol"},
-{"Terminal"},
-{"Terminal Bold"},
-{"Zapf Dingbats"},
-{0}};
+ {"Helvetica"},
+ {"Helvetica bold"},
+ {"Helvetica italic"},
+ {"Helvetica bold italic"},
+ {"Courier"},
+ {"Courier bold"},
+ {"Courier italic"},
+ {"Courier bold italic"},
+ {"Times"},
+ {"Times bold"},
+ {"Times italic"},
+ {"Times bold italic"},
+ {"Symbol"},
+ {"Terminal"},
+ {"Terminal Bold"},
+ {"Zapf Dingbats"},
+ {NULL}
+};
+
+Fl_Menu_Item fontmenu_w_default[] = {
+ {"<default>", 0, NULL, NULL, FL_MENU_DIVIDER},
+ {"Helvetica"},
+ {"Helvetica bold"},
+ {"Helvetica italic"},
+ {"Helvetica bold italic"},
+ {"Courier"},
+ {"Courier bold"},
+ {"Courier italic"},
+ {"Courier bold italic"},
+ {"Times"},
+ {"Times bold"},
+ {"Times italic"},
+ {"Times bold italic"},
+ {"Symbol"},
+ {"Terminal"},
+ {"Terminal Bold"},
+ {"Zapf Dingbats"},
+ {NULL}
+};
void labelfont_cb(Fl_Choice* i, void *v) {
if (v == LOAD) {
@@ -1327,6 +1349,7 @@ void labelfont_cb(Fl_Choice* i, void *v) {
int mod = 0;
int n = i->value();
if (n <= 0) n = layout->labelfont;
+ if (n <= 0) n = FL_HELVETICA;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
@@ -1827,6 +1850,7 @@ void textsize_cb(Fl_Value_Input* i, void* v) {
int mod = 0;
s = int(i->value());
if (s <= 0) s = layout->textsize;
+ if (s <= 0) s = layout->labelsize;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx
index e66906a22..323c04cf3 100644
--- a/fluid/alignment_panel.cxx
+++ b/fluid/alignment_panel.cxx
@@ -687,9 +687,9 @@ static void cb_3(Fl_Value_Input* o, void* v) {
static void cb_4(Fl_Choice* o, void* v) {
if (v == LOAD) {
- o->value(layout->labelfont);
+ o->value(layout->labelfont+1);
} else {
- layout->labelfont = (int)o->value();
+ layout->labelfont = (int)o->value()-1;
}
}
@@ -703,9 +703,9 @@ static void cb_5(Fl_Value_Input* o, void* v) {
static void cb_6(Fl_Choice* o, void* v) {
if (v == LOAD) {
- o->value(layout->textfont);
+ o->value(layout->textfont+1);
} else {
- layout->textfont = (int)o->value();
+ layout->textfont = (int)o->value()-1;
}
}
@@ -1476,7 +1476,7 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
o->callback((Fl_Callback*)cb_3);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
} // Fl_Value_Input* o
- { Fl_Group* o = new Fl_Group(85, 464, 201, 21, "Label Font:");
+ { Fl_Group* o = new Fl_Group(85, 465, 201, 20, "Label Font:");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->align(Fl_Align(FL_ALIGN_LEFT));
@@ -1489,12 +1489,13 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
o->textsize(11);
o->callback((Fl_Callback*)cb_4);
Fl_Group::current()->resizable(o);
- o->menu(fontmenu);
+ o->menu(fontmenu_w_default);
} // Fl_Choice* o
{ Fl_Value_Input* o = new Fl_Value_Input(235, 465, 50, 20);
o->tooltip("The size of the label text.");
o->labelsize(11);
- o->maximum(100);
+ o->minimum(1);
+ o->maximum(1000);
o->step(1);
o->value(14);
o->textsize(11);
@@ -1502,25 +1503,31 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
} // Fl_Value_Input* o
o->end();
} // Fl_Group* o
- { Fl_Choice* o = new Fl_Choice(85, 490, 150, 20);
- o->tooltip("The value text style.");
- o->box(FL_DOWN_BOX);
- o->down_box(FL_BORDER_BOX);
- o->labelfont(1);
- o->labelsize(11);
- o->textsize(11);
- o->callback((Fl_Callback*)cb_6);
- o->menu(fontmenu);
- } // Fl_Choice* o
- { Fl_Value_Input* o = new Fl_Value_Input(235, 490, 50, 20);
- o->tooltip("The value text size.");
+ { Fl_Group* o = new Fl_Group(85, 490, 200, 20, "Text Font:");
o->labelsize(11);
- o->maximum(100);
- o->step(1);
- o->value(14);
- o->textsize(11);
- o->callback((Fl_Callback*)cb_7);
- } // Fl_Value_Input* o
+ o->callback((Fl_Callback*)propagate_load);
+ o->align(Fl_Align(FL_ALIGN_LEFT));
+ { Fl_Choice* o = new Fl_Choice(85, 490, 150, 20);
+ o->tooltip("The value text style.");
+ o->box(FL_DOWN_BOX);
+ o->down_box(FL_BORDER_BOX);
+ o->labelfont(1);
+ o->labelsize(11);
+ o->textsize(11);
+ o->callback((Fl_Callback*)cb_6);
+ o->menu(fontmenu_w_default);
+ } // Fl_Choice* o
+ { Fl_Value_Input* o = new Fl_Value_Input(235, 490, 50, 20);
+ o->tooltip("The value text size.");
+ o->labelsize(11);
+ o->maximum(1000);
+ o->step(1);
+ o->value(14);
+ o->textsize(11);
+ o->callback((Fl_Callback*)cb_7);
+ } // Fl_Value_Input* o
+ o->end();
+ } // Fl_Group* o
o->image()->scale(36, 24);
w_settings_layout_tab->end();
} // Fl_Group* w_settings_layout_tab
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index e48dd29dd..2bc7925dd 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -107,7 +107,7 @@ decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local
Function {make_settings_window()} {open
} {
Fl_Window settings_window {
- label {FLUID Settings} open selected
+ label {FLUID Settings} open
xywh {423 204 340 580} type Double align 80
code0 {o->size_range(o->w(), o->h());} non_modal visible
} {
@@ -116,7 +116,7 @@ Function {make_settings_window()} {open
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255
} {
Fl_Group {} {
- label General open
+ label General open selected
image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11
code0 {o->image()->scale(36, 24);}
} {
@@ -316,7 +316,7 @@ Examples:
}
Fl_Group w_settings_layout_tab {
label Layout
- callback {propagate_load(o, v);}
+ callback {propagate_load(o, v);} open
image {icons/layout_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
} {
@@ -723,17 +723,17 @@ g_layout_list.update_dialogs();}
Fl_Group {} {
label {Label Font:}
callback propagate_load open
- xywh {85 464 201 21} labelsize 11 align 4
+ xywh {85 465 201 20} labelsize 11 align 4
} {
Fl_Choice {} {
callback {if (v == LOAD) {
- o->value(layout->labelfont);
+ o->value(layout->labelfont+1);
} else {
- layout->labelfont = (int)o->value();
+ layout->labelfont = (int)o->value()-1;
}} open
tooltip {The style of the label text.} xywh {85 465 150 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
- code0 {extern Fl_Menu_Item fontmenu[];}
- code1 {o->menu(fontmenu);}
+ code0 {extern Fl_Menu_Item fontmenu_w_default[];}
+ code1 {o->menu(fontmenu_w_default);}
} {}
Fl_Value_Input {} {
callback {if (v == LOAD) {
@@ -741,26 +741,32 @@ g_layout_list.update_dialogs();}
} else {
layout->labelsize = (int)o->value();
}}
- tooltip {The size of the label text.} xywh {235 465 50 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
+ tooltip {The size of the label text.} xywh {235 465 50 20} labelsize 11 minimum 1 maximum 1000 step 1 value 14 textsize 11
}
}
- Fl_Choice {} {
- callback {if (v == LOAD) {
- o->value(layout->textfont);
+ Fl_Group {} {
+ label {Text Font:}
+ callback propagate_load open
+ xywh {85 490 200 20} labelsize 11 align 4
+ } {
+ Fl_Choice {} {
+ callback {if (v == LOAD) {
+ o->value(layout->textfont+1);
} else {
- layout->textfont = (int)o->value();
+ layout->textfont = (int)o->value()-1;
}} open
- tooltip {The value text style.} xywh {85 490 150 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11
- code0 {extern Fl_Menu_Item fontmenu[];}
- code1 {o->menu(fontmenu);}
- } {}
- Fl_Value_Input {} {
- callback {if (v == LOAD) {
+ tooltip {The value text style.} xywh {85 490 150 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11
+ code0 {extern Fl_Menu_Item fontmenu_w_default[];}
+ code1 {o->menu(fontmenu_w_default);}
+ } {}
+ Fl_Value_Input {} {
+ callback {if (v == LOAD) {
o->value(layout->textsize);
} else {
layout->textsize = (int)o->value();
}}
- tooltip {The value text size.} xywh {235 490 50 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
+ tooltip {The value text size.} xywh {235 490 50 20} labelsize 11 maximum 1000 step 1 value 14 textsize 11
+ }
}
}
Fl_Group w_settings_shell_tab {
@@ -836,7 +842,7 @@ g_layout_list.update_dialogs();}
}
Fl_Group w_settings_i18n_tab {
label Locale
- callback {propagate_load(o, v);} open
+ callback {propagate_load(o, v);}
image {icons/language_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
} {
@@ -971,7 +977,7 @@ Function {make_shell_window()} {open
} {
Fl_Window shell_run_window {
label {Shell Command Output} open
- xywh {454 638 555 430} type Double align 80 resizable visible
+ xywh {769 585 555 430} type Double align 80 resizable visible
} {
Fl_Simple_Terminal shell_run_terminal {
xywh {10 10 535 375} resizable
diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h
index e2fd64fc5..a084917b3 100644
--- a/fluid/alignment_panel.h
+++ b/fluid/alignment_panel.h
@@ -76,7 +76,7 @@ extern void propagate_load(Fl_Group*, void*);
extern void edit_layout_preset_cb(Fl_Button*, long);
extern Fl_Button *preset_choice[3];
#include <FL/Fl_Value_Input.H>
-extern Fl_Menu_Item fontmenu[];
+extern Fl_Menu_Item fontmenu_w_default[];
extern Fl_Group *w_settings_shell_tab;
extern Fl_Check_Button *shell_use_fl_button;
#include <FL/Fl_Return_Button.H>
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index d42941f73..7ed855cd5 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -350,7 +350,7 @@ class Fl_Counter_Type : public Fl_Valuator_Type
}
public:
void ideal_size(int &w, int &h) FL_OVERRIDE {
- h = layout->textsize + 8;
+ h = layout->textsize_not_null() + 8;
w = layout->labelsize * 4 + 4 * h; // make room for the arrows
Fd_Snap_Action::better_size(w, h);
}
@@ -791,8 +791,8 @@ class Fl_Text_Display_Type : public Fl_Widget_Type
}
public:
void ideal_size(int &w, int &h) FL_OVERRIDE {
- h = layout->textsize * 4 + 8;
- w = layout->textsize * 10 + 8;
+ h = layout->textsize_not_null() * 4 + 8;
+ w = layout->textsize_not_null() * 10 + 8;
Fd_Snap_Action::better_size(w, h);
}
const char *type_name() FL_OVERRIDE { return "Fl_Text_Display"; }
@@ -1155,14 +1155,17 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
// Set font sizes...
wt->o->labelsize(layout->labelsize);
- wt->o->labelfont(layout->labelfont);
+ if (layout->labelfont >= 0)
+ wt->o->labelfont(layout->labelfont);
Fl_Font f = layout->textfont;
int s = layout->textsize;
Fl_Color c;
- wt->textstuff(1, f, s, c);
- wt->textstuff(2, f, s, c);
+ if (layout->textfont >= 0)
+ wt->textstuff(1, f, s, c);
+ if (layout->textsize > 0)
+ wt->textstuff(2, f, s, c);
// Resize and/or reposition new widget...
int w = 0, h = 0;