Browse Source

FLUID: add image spacing control

pull/1043/head
Matthias Melcher 10 months ago
parent
commit
ede61089be
  1. 29
      fluid/Fl_Widget_Type.cxx
  2. 1
      fluid/README_fl.txt
  3. 34
      fluid/widget_panel.cxx
  4. 27
      fluid/widget_panel.fl
  5. 1
      fluid/widget_panel.h

29
fluid/Fl_Widget_Type.cxx

@ -1967,6 +1967,31 @@ void textcolor_menu_cb(Fl_Menu_Button* i, void* v) { @@ -1967,6 +1967,31 @@ void textcolor_menu_cb(Fl_Menu_Button* i, void* v) {
}
}
void image_spacing_cb(Fl_Value_Input* i, void* v) {
Fl_Font n; int s; Fl_Color c;
if (v == LOAD) {
if (!current_widget->is_true_widget()) return;
i->value(((Fl_Widget_Type*)current_widget)->o->label_image_spacing());
} else {
int mod = 0;
s = int(i->value());
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_true_widget()) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
if (q->o->label_image_spacing() != s) {
q->o->label_image_spacing(s);
if (q->o->parent())
q->o->parent()->damage(FL_DAMAGE_EXPOSE); // outside labels
q->o->redraw();
mod = 1;
}
}
}
if (mod) set_modflag(1);
}
i->value(s);
}
////////////////////////////////////////////////////////////////
// Kludges to the panel for subclasses:
@ -3368,6 +3393,8 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) { @@ -3368,6 +3393,8 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
f.write_string("labelcolor %d", o->labelcolor());
if (o->align()!=tplate->align())
f.write_string("align %d", o->align());
if (o->label_image_spacing()!=tplate->label_image_spacing())
f.write_string("image_spacing %d", o->label_image_spacing());
if (o->when() != tplate->when())
f.write_string("when %d", o->when());
if (is_a(ID_Valuator_)) {
@ -3537,6 +3564,8 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) { @@ -3537,6 +3564,8 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->labelcolor(x);
} else if (!strcmp(c,"align")) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->align(x);
} else if (!strcmp(c,"image_spacing")) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->label_image_spacing(x);
} else if (!strcmp(c,"when")) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->when(x);
} else if (!strcmp(c,"minimum")) {

1
fluid/README_fl.txt

@ -468,6 +468,7 @@ Type "Fl_Widget" <word> : C++ variable name @@ -468,6 +468,7 @@ Type "Fl_Widget" <word> : C++ variable name
"labelsize" <word> : integer
"labelcolor" <word> : integer, color index
"align" <word> : integer, see Fl_Align
"image_spacing" <word> : integer, see Fl_Widget::label_image_spacing()
"when" <word> : integer, see Fl_When
"minimum" <word> : (is_valuator(), is_spinner()) double
"maximum" <word> : (is_valuator(), is_spinner()) double

34
fluid/widget_panel.cxx

@ -1538,12 +1538,12 @@ Fl_Double_Window* make_widget_panel() { @@ -1538,12 +1538,12 @@ Fl_Double_Window* make_widget_panel() {
wp_style_tab->callback((Fl_Callback*)propagate_load);
wp_style_tab->when(FL_WHEN_NEVER);
wp_style_tab->hide();
{ wp_style_label = new Fl_Group(95, 40, 309, 20, "Label Font:");
{ wp_style_label = new Fl_Group(99, 40, 305, 20, "Label Font:");
wp_style_label->labelfont(1);
wp_style_label->labelsize(11);
wp_style_label->callback((Fl_Callback*)propagate_load);
wp_style_label->align(Fl_Align(FL_ALIGN_LEFT));
{ Fl_Choice* o = new Fl_Choice(95, 40, 152, 20);
{ Fl_Choice* o = new Fl_Choice(99, 40, 148, 20);
o->tooltip("The style of the label text.");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
@ -1574,12 +1574,12 @@ Fl_Double_Window* make_widget_panel() { @@ -1574,12 +1574,12 @@ Fl_Double_Window* make_widget_panel() {
} // Fl_Menu_Button* o
wp_style_label->end();
} // Fl_Group* wp_style_label
{ wp_style_box = new Fl_Group(95, 65, 309, 20, "Box:");
{ wp_style_box = new Fl_Group(99, 65, 305, 20, "Box:");
wp_style_box->labelfont(1);
wp_style_box->labelsize(11);
wp_style_box->callback((Fl_Callback*)propagate_load);
wp_style_box->align(Fl_Align(FL_ALIGN_LEFT));
{ Fl_Choice* o = new Fl_Choice(95, 65, 201, 20);
{ Fl_Choice* o = new Fl_Choice(100, 65, 196, 20);
o->tooltip("The \"up\" box of the widget.");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
@ -1601,12 +1601,12 @@ Fl_Double_Window* make_widget_panel() { @@ -1601,12 +1601,12 @@ Fl_Double_Window* make_widget_panel() {
} // Fl_Menu_Button* o
wp_style_box->end();
} // Fl_Group* wp_style_box
{ wp_style_downbox = new Fl_Group(95, 90, 309, 20, "Down Box:");
{ wp_style_downbox = new Fl_Group(99, 90, 305, 20, "Down Box:");
wp_style_downbox->labelfont(1);
wp_style_downbox->labelsize(11);
wp_style_downbox->callback((Fl_Callback*)propagate_load);
wp_style_downbox->align(Fl_Align(FL_ALIGN_LEFT));
{ Fl_Choice* o = new Fl_Choice(95, 90, 201, 20);
{ Fl_Choice* o = new Fl_Choice(99, 90, 197, 20);
o->tooltip("The \"down\" box of the widget.");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
@ -1628,12 +1628,12 @@ Fl_Double_Window* make_widget_panel() { @@ -1628,12 +1628,12 @@ Fl_Double_Window* make_widget_panel() {
} // Fl_Menu_Button* o
wp_style_downbox->end();
} // Fl_Group* wp_style_downbox
{ wp_style_text = new Fl_Group(95, 115, 309, 20, "Text Font:");
{ wp_style_text = new Fl_Group(99, 115, 305, 20, "Text Font:");
wp_style_text->labelfont(1);
wp_style_text->labelsize(11);
wp_style_text->callback((Fl_Callback*)propagate_load);
wp_style_text->align(Fl_Align(FL_ALIGN_LEFT));
{ Fl_Choice* o = new Fl_Choice(95, 115, 152, 20);
{ Fl_Choice* o = new Fl_Choice(99, 115, 148, 20);
o->tooltip("The value text style.");
o->box(FL_DOWN_BOX);
o->down_box(FL_BORDER_BOX);
@ -1664,16 +1664,26 @@ Fl_Double_Window* make_widget_panel() { @@ -1664,16 +1664,26 @@ Fl_Double_Window* make_widget_panel() {
} // Fl_Menu_Button* o
wp_style_text->end();
} // Fl_Group* wp_style_text
{ Fl_Box* o = new Fl_Box(95, 165, 300, 40);
{ Fl_Value_Input* o = new Fl_Value_Input(99, 140, 49, 20, "Image Spacing:");
o->tooltip("Gap between label image and text in pixels");
o->labelfont(1);
o->labelsize(11);
Fl_Group::current()->resizable(o);
} // Fl_Box* o
{ Fl_Light_Button* o = new Fl_Light_Button(95, 140, 90, 20, "Compact");
o->maximum(100);
o->step(1);
o->value(14);
o->textsize(11);
o->callback((Fl_Callback*)image_spacing_cb);
} // Fl_Value_Input* o
{ Fl_Light_Button* o = new Fl_Light_Button(99, 165, 90, 20, "Compact");
o->tooltip("use compact box types for closely set buttons");
o->selection_color((Fl_Color)1);
o->labelsize(11);
o->callback((Fl_Callback*)compact_cb);
} // Fl_Light_Button* o
{ Fl_Box* o = new Fl_Box(195, 195, 40, 40);
o->labelsize(11);
Fl_Group::current()->resizable(o);
} // Fl_Box* o
wp_style_tab->end();
} // Fl_Group* wp_style_tab
{ wp_cpp_tab = new Fl_Group(10, 30, 400, 330, "C++");

27
fluid/widget_panel.fl

@ -838,11 +838,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -838,11 +838,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group wp_style_label {
label {Label Font:}
callback propagate_load open
xywh {95 40 309 20} labelfont 1 labelsize 11 align 4
xywh {99 40 305 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
callback labelfont_cb open
tooltip {The style of the label text.} xywh {95 40 152 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
tooltip {The style of the label text.} xywh {99 40 148 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);}
} {}
@ -865,11 +865,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -865,11 +865,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group wp_style_box {
label {Box:}
callback propagate_load open
xywh {95 65 309 20} labelfont 1 labelsize 11 align 4
xywh {99 65 305 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
callback box_cb open
tooltip {The "up" box of the widget.} xywh {95 65 201 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
tooltip {The "up" box of the widget.} xywh {100 65 196 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
code0 {extern Fl_Menu_Item boxmenu[];}
code1 {o->menu(boxmenu);}
} {}
@ -888,11 +888,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -888,11 +888,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group wp_style_downbox {
label {Down Box:}
callback propagate_load open
xywh {95 90 309 20} labelfont 1 labelsize 11 align 4
xywh {99 90 305 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
callback down_box_cb open
tooltip {The "down" box of the widget.} xywh {95 90 201 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
tooltip {The "down" box of the widget.} xywh {99 90 197 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
code0 {extern Fl_Menu_Item boxmenu[];}
code1 {o->menu(boxmenu);}
} {}
@ -911,11 +911,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -911,11 +911,11 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group wp_style_text {
label {Text Font:}
callback propagate_load open
xywh {95 115 309 20} labelfont 1 labelsize 11 align 4
xywh {99 115 305 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
callback textfont_cb open
tooltip {The value text style.} xywh {95 115 152 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
tooltip {The value text style.} xywh {99 115 148 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);}
} {}
@ -935,13 +935,18 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize @@ -935,13 +935,18 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
code1 {o->menu(colormenu);}
} {}
}
Fl_Box {} {
xywh {95 165 300 40} labelsize 11 resizable
Fl_Value_Input {} {
label {Image Spacing:}
callback image_spacing_cb
tooltip {Gap between label image and text in pixels} xywh {99 140 49 20} labelfont 1 labelsize 11 maximum 100 step 1 value 14 textsize 11
}
Fl_Light_Button {} {
label Compact
callback compact_cb
tooltip {use compact box types for closely set buttons} xywh {95 140 90 20} selection_color 1 labelsize 11
tooltip {use compact box types for closely set buttons} xywh {99 165 90 20} selection_color 1 labelsize 11
}
Fl_Box {} {
xywh {195 195 40 40} labelsize 11 resizable
}
}
Fl_Group wp_cpp_tab {

1
fluid/widget_panel.h

@ -144,6 +144,7 @@ extern void textsize_cb(Fl_Value_Input*, void*); @@ -144,6 +144,7 @@ extern void textsize_cb(Fl_Value_Input*, void*);
extern void textcolor_cb(Fl_Button*, void*);
extern Fl_Button *w_textcolor;
extern void textcolor_menu_cb(Fl_Menu_Button*, void*);
extern void image_spacing_cb(Fl_Value_Input*, void*);
extern void compact_cb(Fl_Light_Button*, void*);
extern Fl_Group *wp_cpp_tab;
extern Fl_Group *wp_cpp_class;

Loading…
Cancel
Save