#832: FLUID: Adds custom fonts and colors for widget browser.

This commit is contained in:
Matthias Melcher 2023-12-15 12:31:24 +01:00
parent ce06a6b519
commit a118930d95
7 changed files with 672 additions and 14 deletions

View File

@ -26,6 +26,42 @@
void scheme_cb(Fl_Scheme_Choice *, void *);
int w_settings_shell_list_selected;
static void cb_Comments(Fl_Choice* o, void* v) {
Fl_Font *font = (Fl_Font*)o->user_data();
if (v == LOAD) {
o->value(*font);
} else {
*font = (int)o->value();
widget_browser->redraw();
widget_browser->save_prefs();
}
}
static void cb_Color_Chip(Fl_Button* o, void* v) {
Fl_Color *color = (Fl_Color*)o->user_data();
if (v == LOAD) {
o->color(*color);
o->redraw();
} else {
Fl_Color d = fl_show_colormap(*color);
*color = d;
o->color(d);
widget_browser->redraw();
widget_browser->save_prefs();
}
}
static void cb_Color_Choice(Fl_Menu_Button* o, void* v) {
if (v != LOAD) {
Fl_Color *color = (Fl_Color*)o->user_data();
Fl_Color d = (Fl_Color)(o->mvalue()->argument());
*color = d;
o->parent()->do_callback(o->parent(), LOAD);
widget_browser->redraw();
widget_browser->save_prefs();
}
}
Fl_Double_Window *script_panel=(Fl_Double_Window *)0;
static void cb_script_panel(Fl_Double_Window*, void*) {
@ -55,6 +91,7 @@ Fl_Double_Window* make_script_panel() {
} // Fl_Text_Editor* script_input
{ Fl_Group* o = new Fl_Group(10, 150, 520, 20);
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
{ script_panel_ok = new Fl_Return_Button(400, 150, 60, 20, "OK");
script_panel_ok->labelsize(11);
script_panel_ok->window()->hotspot(script_panel_ok);
@ -2190,6 +2227,198 @@ static void cb_i18n_pos_set_input(Fl_Int_Input* o, void* v) {
}
}
Fl_Group *w_settings_user_tab=(Fl_Group *)0;
static void cb_w_settings_user_tab(Fl_Group* o, void* v) {
propagate_load(o, v);
}
static const unsigned char idata_user_circle_64[] =
{137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,96,0,0,0,64,8,6,0,0,0,
229,52,114,14,0,0,1,110,105,67,67,80,105,99,99,0,0,40,145,117,145,187,75,195,80,
20,198,127,182,74,69,171,14,138,136,56,68,80,113,168,32,10,226,168,117,232,82,
164,212,10,190,150,38,77,91,161,143,144,180,72,113,21,92,28,10,14,162,139,175,
193,255,64,87,193,85,65,16,20,65,196,205,221,215,34,18,207,53,66,69,244,134,155,
243,227,187,247,59,156,124,1,95,52,103,228,157,250,9,200,23,74,118,60,18,214,
230,230,23,180,192,35,65,90,233,100,132,222,164,225,88,147,177,88,148,127,215,
219,53,117,170,94,13,169,94,255,223,251,115,53,167,76,199,128,186,70,225,49,195,
178,75,194,50,13,209,149,146,165,120,67,184,195,200,38,83,194,123,194,33,91,6,
20,62,87,186,238,241,131,226,140,199,47,138,237,68,124,10,124,170,167,150,249,
193,250,15,54,178,118,94,120,80,184,47,159,43,27,223,243,168,47,9,154,133,217,
25,169,221,178,123,112,136,19,33,140,134,78,153,101,114,148,24,146,90,144,204,
254,246,13,127,249,166,41,138,199,144,183,69,5,91,28,25,178,226,13,137,90,150,
174,166,212,180,232,166,60,57,42,42,247,223,121,58,233,209,17,175,123,48,12,13,
247,174,251,220,15,129,77,248,168,186,238,251,190,235,126,28,128,255,14,78,11,
53,127,81,114,26,127,21,189,90,211,250,118,161,109,13,142,207,106,154,190,5,39,
235,208,117,107,37,237,228,151,228,151,237,75,167,225,233,8,90,230,161,253,18,
154,22,189,172,190,207,57,188,129,196,170,252,162,11,216,222,129,1,185,223,182,
244,9,79,172,104,46,25,119,193,26,0,0,0,9,112,72,89,115,0,0,59,14,0,0,59,14,1,
204,182,161,131,0,0,13,125,73,68,65,84,120,94,213,156,9,236,86,197,17,192,7,4,
20,177,10,8,2,162,96,16,209,130,40,136,82,4,27,174,214,139,195,8,8,166,73,1,5,
194,77,75,64,1,141,28,81,74,72,56,203,101,61,138,130,137,82,3,104,64,52,16,16,
218,130,28,22,149,163,9,1,4,148,163,30,92,162,92,94,157,223,203,247,253,243,142,
125,223,187,246,195,63,147,108,248,243,190,221,217,153,157,221,217,217,217,153,
45,35,25,225,231,159,127,206,136,193,220,188,76,153,50,21,244,151,22,90,218,
106,249,173,150,134,90,106,197,236,236,136,214,251,175,150,127,105,89,163,101,
147,210,121,62,102,219,68,213,148,206,68,245,173,87,70,0,182,138,18,87,86,203,
239,181,44,208,114,74,11,210,181,81,192,5,206,223,209,135,45,122,139,53,249,18,
9,201,6,51,218,225,229,90,254,164,229,128,165,1,47,36,52,250,24,166,165,162,
37,218,19,141,151,245,202,89,152,80,98,202,107,25,169,229,139,11,48,240,126,
161,252,79,251,28,14,13,25,121,200,52,166,153,21,88,218,101,168,186,179,141,82,
62,71,11,186,61,18,174,184,226,10,169,87,175,158,220,120,227,141,114,237,181,
215,202,149,87,94,41,149,42,85,114,218,125,247,221,119,242,205,55,223,200,161,
67,135,228,211,79,63,117,202,183,223,126,27,137,51,87,97,167,254,59,72,249,248,
103,220,6,238,122,89,247,128,11,46,0,37,248,50,101,96,154,150,1,90,66,251,47,91,
182,172,180,108,217,82,218,181,107,39,119,223,125,183,52,108,216,80,248,22,7,
126,250,233,39,217,185,115,167,108,216,176,65,214,172,89,35,27,55,110,20,190,21,
0,86,7,147,97,164,10,226,92,156,62,242,117,46,42,1,40,177,13,148,240,69,90,
154,132,49,89,163,70,13,233,213,171,151,116,235,214,77,106,213,138,107,244,20,
30,178,195,135,15,203,226,197,139,229,213,87,95,149,47,190,64,219,133,194,86,
253,165,135,10,97,79,92,33,92,52,2,80,66,239,81,166,150,105,169,108,98,174,118,
237,218,50,100,200,16,233,222,189,187,84,168,128,5,106,31,206,159,63,47,139,22,
45,146,89,179,102,201,145,35,88,170,70,56,166,95,59,169,16,54,196,161,224,162,
16,128,18,217,81,153,249,135,150,138,126,166,202,149,43,39,61,123,246,148,39,
158,120,66,208,243,23,2,206,156,57,35,243,230,205,147,217,179,103,203,247,223,
127,111,234,18,53,244,7,21,194,146,40,122,74,189,0,148,192,206,202,196,98,45,
229,252,204,176,169,206,157,59,87,26,53,106,20,197,103,81,126,223,190,125,187,
12,26,52,72,246,239,223,111,194,143,100,186,168,16,150,23,234,60,171,0,226,237,
106,41,217,87,226,56,193,190,97,26,252,78,157,58,201,59,239,188,243,139,13,62,
44,53,110,220,88,222,125,247,93,233,208,161,131,137,67,76,228,69,202,67,203,
148,236,199,106,86,52,43,40,183,225,110,82,42,2,58,191,95,191,126,242,204,51,
207,72,218,217,115,236,216,49,217,189,123,119,137,30,103,179,110,208,160,129,84,
169,82,37,22,211,254,74,88,72,207,62,251,172,188,244,210,75,166,246,236,9,205,
117,37,236,53,253,152,150,135,60,174,162,8,32,103,106,126,160,157,4,172,29,116,
253,176,97,28,68,147,1,231,141,101,203,150,201,194,133,11,101,203,150,45,242,
227,143,63,122,16,92,114,201,37,114,215,93,119,57,251,73,199,142,29,83,9,119,
230,204,153,50,101,202,20,19,97,255,209,143,173,76,38,106,105,21,192,92,37,120,
160,159,19,102,254,216,177,99,147,141,188,214,70,71,15,30,60,88,182,109,219,22,
171,109,211,166,77,157,13,182,78,157,58,177,234,187,43,77,152,48,33,108,37,204,
86,1,12,245,35,44,117,2,200,157,112,241,64,122,86,23,58,127,206,156,57,137,103,
38,179,189,79,159,62,114,252,248,241,68,131,89,181,106,85,121,249,229,151,229,
206,59,239,76,212,14,117,196,198,204,254,228,3,14,107,109,252,39,230,82,37,0,37,
6,75,135,195,76,99,55,241,55,220,112,131,179,217,37,53,51,63,255,252,115,71,
157,160,243,211,64,229,202,149,29,181,69,255,73,0,215,6,27,243,222,189,1,181,
143,219,162,169,10,161,196,118,45,109,2,24,161,4,122,148,40,118,254,242,229,203,
19,91,59,232,124,86,205,39,159,124,18,24,59,4,217,166,77,27,103,227,5,118,237,
218,37,235,214,173,51,250,127,238,184,227,14,121,235,173,183,18,175,60,76,212,
206,157,59,203,15,63,252,224,239,127,184,210,54,35,255,49,171,0,2,182,121,146,
153,226,174,171,132,224,82,126,210,223,190,127,255,254,137,7,31,28,8,205,52,248,
247,221,119,159,140,26,53,202,113,198,185,225,228,201,147,50,121,242,100,89,185,
114,165,231,251,214,173,91,29,117,194,74,74,2,152,168,143,63,254,184,188,240,
194,11,254,102,163,149,215,191,169,16,206,36,193,23,86,215,230,57,160,175,118,
114,141,187,35,220,11,105,44,30,112,224,183,241,3,131,255,220,115,207,5,6,159,
122,87,93,117,149,76,156,56,81,238,189,247,222,64,187,5,11,184,139,73,14,195,
135,15,151,154,53,107,250,27,214,208,15,125,146,99,51,183,176,34,0,157,17,224,
65,253,120,0,223,206,229,151,179,48,146,1,58,255,195,15,63,244,52,66,237,48,
243,11,45,121,126,163,78,222,77,157,71,192,70,126,226,196,137,100,68,104,109,
250,28,58,52,96,248,128,103,100,142,231,196,56,253,13,172,8,64,145,182,215,226,
177,249,170,87,175,46,143,60,242,72,42,2,209,233,126,59,31,157,239,87,59,38,228,
172,4,234,186,1,61,14,206,52,208,163,71,15,193,67,235,131,186,250,127,111,39,
105,144,107,27,91,2,248,163,191,127,244,231,165,151,94,154,138,44,147,203,56,
191,225,198,65,120,211,77,55,5,170,69,184,161,67,209,194,3,135,59,3,4,120,142,
67,155,245,21,160,75,145,81,126,216,141,152,139,147,174,93,187,166,161,199,105,
99,82,51,17,23,42,158,190,210,222,210,133,17,220,165,75,23,19,77,93,149,78,252,
69,153,192,198,10,248,141,82,224,241,35,115,147,149,229,50,229,154,107,60,123,
185,195,224,158,61,177,239,72,28,63,145,31,12,106,36,246,192,93,119,221,117,210,
188,121,115,127,253,95,233,135,192,199,216,72,115,21,109,8,160,157,191,83,174,
17,179,192,45,183,220,34,248,118,220,176,118,237,90,193,212,140,2,54,91,206,4,
110,224,44,114,243,205,55,71,53,45,248,123,8,79,217,24,213,30,109,8,0,151,179,7,
184,195,205,2,120,53,113,172,185,129,75,118,236,252,66,234,133,223,38,77,154,
228,92,210,187,129,217,203,169,56,11,220,115,15,23,122,1,8,240,158,180,15,27,2,
248,181,187,83,76,55,46,208,179,130,105,227,227,144,245,244,211,79,27,87,2,51,
127,244,232,209,178,122,245,234,64,215,33,155,104,34,18,185,52,242,155,183,138,
32,51,163,153,221,209,74,132,39,54,241,246,219,111,119,78,177,89,129,217,252,
208,67,15,201,71,31,125,20,64,197,64,180,110,221,186,68,173,228,93,17,254,153,
79,67,156,113,75,150,44,73,236,138,48,209,255,224,131,15,10,46,10,23,192,123,
166,73,108,205,21,145,39,138,184,29,27,128,37,196,117,37,46,132,163,71,143,122,
80,50,208,43,86,172,112,74,33,64,149,225,227,207,234,175,201,247,193,21,170,79,
0,153,39,112,38,233,153,152,39,104,202,22,96,125,224,82,198,181,156,20,104,
243,202,43,175,164,186,19,8,235,11,122,108,131,117,1,36,117,57,71,49,212,172,89,
51,199,165,140,87,51,46,160,118,112,192,37,105,19,7,183,97,15,136,211,172,96,
29,235,2,40,6,145,220,108,225,82,38,148,4,11,11,179,210,15,124,227,252,241,252,
243,207,59,58,191,24,179,213,246,228,130,7,235,123,64,230,41,17,130,0,61,206,
126,64,225,118,140,195,22,17,111,124,207,95,202,103,53,53,139,69,123,33,188,214,
5,96,178,68,108,51,198,230,106,56,153,218,238,38,128,47,65,192,111,108,90,172,
171,160,98,16,25,155,155,34,87,44,6,111,214,87,0,33,226,197,132,211,167,79,59,
234,135,59,131,252,69,61,43,2,171,7,47,104,154,251,135,184,244,22,131,55,235,2,
48,92,100,199,229,47,180,30,97,41,47,190,248,162,188,255,254,251,114,240,224,
193,80,119,4,251,193,245,215,95,47,109,219,182,21,66,96,234,214,197,109,111,15,
200,59,240,65,230,4,185,204,7,9,37,232,176,150,146,56,114,44,5,98,243,227,198,
242,23,26,30,240,112,195,69,60,80,82,23,51,194,224,84,142,255,200,134,107,132,
11,34,220,17,190,61,142,229,158,233,112,96,99,15,32,27,177,4,208,147,12,92,22,
56,123,246,172,60,245,212,83,242,192,3,15,56,23,243,73,7,159,190,105,243,241,
199,31,203,253,247,223,47,99,198,140,145,115,231,18,229,93,4,200,223,177,99,71,
192,201,167,149,60,188,167,225,217,134,0,72,5,245,192,7,31,16,149,152,14,208,
235,248,92,8,65,76,51,240,1,29,161,130,120,237,181,215,132,11,253,175,191,254,
58,29,81,218,106,253,250,245,166,182,169,210,154,220,136,108,168,32,92,178,30,
66,90,181,106,37,111,188,65,80,116,50,192,174,103,214,23,10,196,226,98,133,208,
67,14,90,220,255,2,220,19,16,196,133,227,238,203,47,191,12,237,180,90,181,106,
78,128,152,33,210,33,146,80,50,118,54,109,34,214,216,3,173,244,127,177,18,57,
194,58,176,33,0,210,89,240,150,149,220,138,161,255,89,5,73,252,66,232,214,246,
237,219,59,137,118,126,0,31,225,38,143,62,250,168,220,122,235,173,5,7,11,103,25,
194,199,117,109,90,65,108,210,171,86,173,50,185,150,67,241,178,241,115,202,246,
225,227,118,168,186,22,99,134,71,164,68,115,21,50,171,32,37,138,12,116,79,38,9,
247,183,228,100,37,129,199,30,123,204,56,248,184,33,8,27,39,30,40,106,240,233,
143,128,42,226,131,176,154,76,193,185,172,20,98,77,147,0,174,13,131,48,23,187,
67,20,147,224,115,215,205,44,128,28,178,133,126,2,230,207,159,47,108,166,113,
96,233,210,165,206,138,241,3,170,6,143,230,109,183,221,22,7,141,167,78,147,38,
77,4,26,76,109,209,231,111,191,253,118,44,156,108,222,33,129,93,1,158,99,33,
244,85,178,37,0,162,161,63,115,227,254,234,171,175,228,205,55,223,140,164,233,
212,169,83,142,149,226,7,14,85,248,242,227,196,2,133,117,194,30,65,66,30,126,
124,63,96,222,198,57,217,190,254,250,235,166,204,202,253,138,47,243,6,12,77,86,
4,160,75,145,36,220,169,126,38,97,62,202,55,132,247,210,95,135,211,236,212,
169,83,173,156,106,241,206,78,159,62,61,128,139,62,233,187,16,32,32,242,12,12,
48,37,199,115,228,4,139,170,96,69,0,185,78,136,98,245,228,126,146,10,58,99,70,
73,32,113,128,22,150,55,23,46,126,32,62,63,201,6,30,197,36,49,170,3,6,144,23,
238,5,246,137,66,106,114,218,180,105,166,217,207,19,7,127,143,234,51,238,239,
214,4,160,51,2,133,31,200,239,97,3,245,93,227,149,208,134,107,193,63,251,25,44,
194,1,109,3,56,253,66,197,175,68,184,139,9,56,125,179,135,24,224,47,182,34,163,
173,169,32,23,145,127,213,191,61,121,68,196,101,50,163,209,245,126,48,221,213,
226,195,241,199,4,217,16,6,201,223,36,6,198,161,129,119,39,6,14,28,104,202,13,
216,161,237,11,235,173,132,196,90,91,1,244,171,51,131,108,6,194,137,61,78,42,
156,105,36,231,249,195,11,113,154,229,55,72,108,125,254,38,41,34,73,24,98,92,
126,241,229,112,135,128,153,90,191,126,125,105,209,162,133,211,31,52,184,129,
190,71,140,24,33,159,125,230,177,41,28,246,180,12,180,97,122,186,251,203,124,16,
51,29,118,116,102,207,210,78,134,248,7,167,111,223,190,50,110,220,56,207,103,
102,27,106,136,213,192,204,47,198,224,187,59,164,143,124,228,53,127,95,125,245,
213,158,168,9,146,8,67,84,207,76,229,245,207,113,86,80,220,73,81,12,21,148,239,
155,55,128,200,21,243,0,251,1,166,101,30,80,79,60,27,192,236,71,0,89,6,159,246,
224,193,130,66,221,132,169,49,119,216,59,127,187,247,32,172,165,144,193,223,162,
52,7,178,127,146,12,116,88,221,162,172,0,58,211,1,169,175,255,224,60,9,196,148,
176,18,208,199,188,211,144,38,113,194,179,132,115,43,199,180,159,32,224,40,135,
30,2,195,84,29,63,126,124,216,224,227,102,33,81,59,112,25,144,227,51,147,28,
138,38,128,28,113,164,249,175,210,18,72,147,193,227,137,173,143,25,232,79,198,
200,196,81,130,198,172,24,226,255,209,249,239,189,247,158,169,229,105,253,216,
94,7,127,99,232,12,206,248,104,95,81,5,144,19,2,217,113,248,138,2,177,244,164,
143,114,24,194,103,195,83,50,134,140,196,4,195,25,191,42,171,165,98,197,138,114,
224,192,1,33,137,208,176,225,130,12,39,219,195,58,248,129,132,97,255,10,140,223,
115,176,102,209,5,224,18,2,15,53,5,86,130,251,185,26,234,70,157,156,211,50,203,
108,47,95,190,188,51,240,172,56,4,95,224,185,26,102,126,247,168,193,47,245,42,
200,55,83,80,71,60,216,100,140,51,196,71,79,66,28,15,54,1,172,6,27,234,137,217,
78,188,16,27,51,248,112,85,51,240,5,82,150,208,249,29,11,169,157,139,110,5,228,
9,214,193,32,114,151,149,208,44,108,38,147,29,211,187,119,111,33,45,136,83,49,
179,21,75,41,169,48,24,120,86,23,27,44,142,65,92,202,120,86,249,187,0,96,237,
240,100,217,190,184,43,45,107,224,239,5,81,65,190,25,67,78,25,46,139,193,90,10,
62,218,199,193,137,204,20,110,216,184,16,71,24,249,187,93,172,27,204,86,10,127,
163,98,242,129,0,12,60,41,77,60,218,71,190,192,230,205,155,163,172,33,14,89,156,
226,159,204,221,111,196,29,255,204,145,215,23,92,0,174,213,192,85,38,175,170,20,
190,226,202,53,96,38,115,114,165,224,211,193,213,236,126,182,146,107,73,110,211,
246,237,219,231,60,91,153,96,47,193,117,50,88,7,254,223,177,71,221,85,49,235,10,
72,211,167,167,13,179,47,109,81,68,88,70,188,152,139,23,213,198,19,197,73,112,
16,78,195,195,69,229,210,210,31,117,198,200,60,184,113,16,100,33,62,223,86,251,
225,49,63,92,23,232,222,36,131,152,166,46,125,160,254,46,179,68,123,156,97,42,
94,29,27,76,184,4,129,115,16,239,24,126,96,46,189,211,12,176,169,13,239,20,224,
195,7,119,169,122,188,251,23,219,3,162,166,68,46,9,154,60,92,82,65,243,207,215,
215,142,106,151,251,157,208,10,130,166,184,54,228,186,116,115,206,83,27,179,121,
252,106,89,247,128,255,3,60,207,245,248,165,38,113,147,0,0,0,0,73,69,78,68,174,
66,96,130};
static Fl_Image *image_user_circle_64() {
static Fl_Image *image = NULL;
if (!image)
image = new Fl_PNG_Image("user_circle_64.png", idata_user_circle_64, 3909);
return image;
}
static void cb_Close(Fl_Button*, void*) {
if (g_shell_config)
g_shell_config->write(fluid_prefs, FD_STORE_USER);
@ -3099,6 +3328,151 @@ le FLTK_GETTEXT_FOUND");
} // Fl_Box* o
w_settings_i18n_tab->end();
} // Fl_Group* w_settings_i18n_tab
{ w_settings_user_tab = new Fl_Group(10, 60, 320, 480, "User");
w_settings_user_tab->image( image_user_circle_64() );
w_settings_user_tab->image()->scale(36, 24, 0, 1);
w_settings_user_tab->labelsize(11);
w_settings_user_tab->callback((Fl_Callback*)cb_w_settings_user_tab);
w_settings_user_tab->hide();
{ Fl_Box* o = new Fl_Box(100, 84, 220, 20, "---- Widget Browser ----");
o->labelfont(1);
o->labelsize(11);
o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Group* o = new Fl_Group(100, 112, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 112, 151, 20, "Label:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::label_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 112, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::label_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 112, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::label_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(100, 137, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 137, 151, 20, "Class:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::class_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 137, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::class_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 137, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::class_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(100, 162, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 162, 151, 20, "Function:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::func_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 162, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::func_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 162, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::func_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(100, 187, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 187, 151, 20, "Name:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::name_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 187, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::name_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 187, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::name_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(100, 212, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 212, 151, 20, "Code:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::code_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 212, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::code_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 212, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::code_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(100, 237, 220, 20);
o->callback((Fl_Callback*)propagate_load);
{ Fl_Choice* o = new Fl_Choice(100, 237, 151, 20, "Comments:");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
o->labelfont(1);
o->labelsize(11);
o->textsize(11);
o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::comment_font));
Fl_Group::current()->resizable(o);
o->menu(fontmenu);
} // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 237, 51, 20);
o->labelsize(11);
o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::comment_color));
} // Fl_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 237, 18, 20);
o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::comment_color));
o->menu(colormenu);
} // Fl_Menu_Button* o
o->end();
} // Fl_Group* o
w_settings_user_tab->end();
} // Fl_Group* w_settings_user_tab
w_settings_tabs->end();
Fl_Group::current()->resizable(w_settings_tabs);
} // Fl_Tabs* w_settings_tabs

View File

@ -110,6 +110,45 @@ decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local
decl {int w_settings_shell_list_selected;} {public local
}
Function {cb_Comments(Fl_Choice* o, void* v)} {open private return_type void
} {
code {Fl_Font *font = (Fl_Font*)o->user_data();
if (v == LOAD) {
o->value(*font);
} else {
*font = (int)o->value();
widget_browser->redraw();
widget_browser->save_prefs();
}} {}
}
Function {cb_Color_Chip(Fl_Button* o, void* v)} {open private return_type void
} {
code {Fl_Color *color = (Fl_Color*)o->user_data();
if (v == LOAD) {
o->color(*color);
o->redraw();
} else {
Fl_Color d = fl_show_colormap(*color);
*color = d;
o->color(d);
widget_browser->redraw();
widget_browser->save_prefs();
}} {}
}
Function {cb_Color_Choice(Fl_Menu_Button* o, void* v)} {open private return_type void
} {
code {if (v != LOAD) {
Fl_Color *color = (Fl_Color*)o->user_data();
Fl_Color d = (Fl_Color)(o->mvalue()->argument());
*color = d;
o->parent()->do_callback(o->parent(), LOAD);
widget_browser->redraw();
widget_browser->save_prefs();
}} {}
}
Function {make_script_panel()} {open
} {
Fl_Window script_panel {
@ -124,7 +163,8 @@ script_panel->hide(); // otherwise hide..} open
xywh {10 10 520 130} box DOWN_BOX labelsize 11 when 13 textfont 4 textsize 11 resizable
code0 {script_input->buffer(new Fl_Text_Buffer);}
}
Fl_Group {} {open
Fl_Group {} {
callback propagate_load open
xywh {10 150 520 20} labelsize 11
} {
Fl_Return_Button script_panel_ok {
@ -1617,6 +1657,167 @@ if (v == LOAD) {
xywh {100 530 220 10} hide resizable
}
}
Fl_Group w_settings_user_tab {
label User
callback {propagate_load(o, v);} open
scale_image {36 24} image {icons/user_circle_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {\#include <FL/fl_show_colormap.H>}
} {
Fl_Box {} {
label {---- Widget Browser ----}
xywh {100 84 220 20} labelfont 1 labelsize 11 align 20
}
Fl_Group {} {
callback propagate_load open
xywh {100 112 220 20}
} {
Fl_Choice {} {
label {Label:}
user_data {&Widget_Browser::label_font}
callback cb_Comments open
xywh {100 112 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::label_color}
callback cb_Color_Chip
xywh {251 112 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::label_color}
callback cb_Color_Choice open
xywh {302 112 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
Fl_Group {} {
callback propagate_load open
xywh {100 137 220 20}
} {
Fl_Choice {} {
label {Class:}
user_data {&Widget_Browser::class_font}
callback cb_Comments open
xywh {100 137 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::class_color}
callback cb_Color_Chip
xywh {251 137 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::class_color}
callback cb_Color_Choice open
xywh {302 137 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
Fl_Group {} {
callback propagate_load open
xywh {100 162 220 20}
} {
Fl_Choice {} {
label {Function:}
user_data {&Widget_Browser::func_font}
callback cb_Comments open
xywh {100 162 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::func_color}
callback cb_Color_Chip
xywh {251 162 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::func_color}
callback cb_Color_Choice open
xywh {302 162 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
Fl_Group {} {
callback propagate_load open
xywh {100 187 220 20}
} {
Fl_Choice {} {
label {Name:}
user_data {&Widget_Browser::name_font}
callback cb_Comments open
xywh {100 187 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::name_color}
callback cb_Color_Chip
xywh {251 187 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::name_color}
callback cb_Color_Choice open
xywh {302 187 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
Fl_Group {} {
callback propagate_load open
xywh {100 212 220 20}
} {
Fl_Choice {} {
label {Code:}
user_data {&Widget_Browser::code_font}
callback cb_Comments open
xywh {100 212 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::code_color}
callback cb_Color_Chip
xywh {251 212 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::code_color}
callback cb_Color_Choice open
xywh {302 212 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
Fl_Group {} {
callback propagate_load open
xywh {100 237 220 20}
} {
Fl_Choice {} {
label {Comments:}
user_data {&Widget_Browser::comment_font}
callback cb_Comments open
xywh {100 237 151 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);}
} {}
Fl_Button {} {
user_data {&Widget_Browser::comment_color}
callback cb_Color_Chip
xywh {251 237 51 20} labelsize 11
}
Fl_Menu_Button {} {
user_data {&Widget_Browser::comment_color}
callback cb_Color_Choice open
xywh {302 237 18 20}
code0 {extern Fl_Menu_Item colormenu[];}
code1 {o->menu(colormenu);}
} {}
}
}
}
Fl_Group {} {open
xywh {10 550 320 20}
@ -1641,7 +1842,7 @@ Function {make_shell_window()} {open
} {
Fl_Window shell_run_window {
label {Shell Command Output} open
xywh {769 585 555 430} type Double align 80 resizable visible
xywh {769 584 555 430} type Double align 80 resizable visible
} {
Fl_Terminal shell_run_terminal {
xywh {10 10 535 375} resizable
@ -1676,6 +1877,3 @@ shell_run_window->hide();}
decl {Fl_Menu_Item *w_layout_menu_storage[4];} {private global
}
Function {make_window()} {open
} {}

View File

@ -41,6 +41,7 @@ extern Fl_Double_Window *script_panel;
#include <FL/Fl_Text_Editor.H>
extern Fl_Text_Editor *script_input;
#include <FL/Fl_Group.H>
extern void propagate_load(Fl_Group*, void*);
#include <FL/Fl_Return_Button.H>
extern Fl_Return_Button *script_panel_ok;
#include <FL/Fl_Button.H>
@ -83,7 +84,6 @@ extern Fl_Choice *layout_choice;
#include <FL/Fl_Menu_Button.H>
extern Fl_Menu_Button *w_layout_menu;
#include <FL/Fl_Native_File_Chooser.H>
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>
@ -116,6 +116,10 @@ extern Fl_Input *i18n_pos_conditional_input;
extern Fl_Input *i18n_pos_file_input;
#include <FL/Fl_Int_Input.H>
extern Fl_Int_Input *i18n_pos_set_input;
#include <FL/fl_show_colormap.H>
extern Fl_Group *w_settings_user_tab;
extern Fl_Menu_Item fontmenu[];
extern Fl_Menu_Item colormenu[];
Fl_Double_Window* make_settings_window();
extern Fl_Menu_Item menu_layout_choice[];
extern Fl_Menu_Item menu_w_layout_menu[];
@ -134,5 +138,4 @@ extern Fl_Double_Window *shell_run_window;
extern Fl_Terminal *shell_run_terminal;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
void make_window();
#endif

View File

@ -1907,6 +1907,7 @@ void make_main_window() {
if (!batch_mode) {
load_history();
g_shell_config = new Fd_Shell_Command_List;
widget_browser->load_prefs();
make_settings_window();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -41,6 +41,21 @@
/// Global access to the widget browser.
Widget_Browser *widget_browser = NULL;
// ---- static variables
Fl_Color Widget_Browser::label_color = 72;
Fl_Font Widget_Browser::label_font = FL_HELVETICA;
Fl_Color Widget_Browser::class_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::class_font = FL_HELVETICA_BOLD;
Fl_Color Widget_Browser::func_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::func_font = FL_HELVETICA;
Fl_Color Widget_Browser::name_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::name_font = FL_HELVETICA;
Fl_Color Widget_Browser::code_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::code_font = FL_HELVETICA;
Fl_Color Widget_Browser::comment_color = FL_DARK_GREEN;
Fl_Font Widget_Browser::comment_font = FL_HELVETICA;
// ---- global functions
/**
@ -58,7 +73,7 @@ Fl_Widget *make_widget_browser(int x,int y,int w,int h) {
}
/**
Make sure thet the caller is visible in the widget browser.
Make sure that the caller is visible in the widget browser.
\param[in] caller scroll the browser in y so that caller
is visible (may be NULL)
*/
@ -302,12 +317,12 @@ void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const {
// line inside this browser line
int comment_incr = 0;
if (show_comments && l->comment()) {
// -- comment
copy_trunc(buf, l->comment(), 80, 0);
comment_incr = textsize()-1;
Fl_Color comment_color = fl_color_average(FL_DARK_GREEN, FL_BLACK, 0.9f);
if (l->new_selected) fl_color(fl_contrast(comment_color, FL_SELECTION_COLOR));
else fl_color(fl_contrast(comment_color, color()));
fl_font(textfont()+FL_ITALIC, textsize()-2);
else fl_color(comment_color);
fl_font(comment_font, textsize()-2);
fl_draw(buf, X, Y+12);
Y += comment_incr/2;
comment_incr -= comment_incr/2;
@ -365,20 +380,40 @@ void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const {
if (l->is_widget() || l->is_class()) {
const char* c = subclassname(l);
if (!strncmp(c,"Fl_",3)) c += 3;
fl_font(textfont(), textsize());
// -- class
fl_font(class_font, textsize());
if (l->new_selected) fl_color(fl_contrast(class_color, FL_SELECTION_COLOR));
else fl_color(class_color);
fl_draw(c, X, Y+13);
X += int(fl_width(c)+fl_width('n'));
c = l->name();
if (c) {
fl_font(textfont()|FL_BOLD, textsize());
// -- name
fl_font(name_font, textsize());
if (l->new_selected) fl_color(fl_contrast(name_color, FL_SELECTION_COLOR));
else fl_color(name_color);
fl_draw(c, X, Y+13);
} else if ((c = l->label())) {
// -- label
fl_font(label_font, textsize());
if (l->new_selected) fl_color(fl_contrast(label_color, FL_SELECTION_COLOR));
else fl_color(label_color);
copy_trunc(buf, c, 20, 1); // quoted string
fl_draw(buf, X, Y+13);
}
} else {
if (l->is_code_block() && (l->level==0 || l->parent->is_class())) {
// -- function names
fl_font(func_font, textsize());
if (l->new_selected) fl_color(fl_contrast(func_color, FL_SELECTION_COLOR));
else fl_color(func_color);
} else {
// -- code
fl_font(code_font, textsize());
if (l->new_selected) fl_color(fl_contrast(code_color, FL_SELECTION_COLOR));
else fl_color(code_color);
}
copy_trunc(buf, l->title(), 55, 0);
fl_font(textfont() | (l->is_code_block() && (l->level==0 || l->parent->is_class())?0:FL_BOLD), textsize());
fl_draw(buf, X, Y+13);
}
@ -579,3 +614,35 @@ void Widget_Browser::display(Fl_Type *inNode) {
vposition(newV);
}
void Widget_Browser::load_prefs() {
int c;
Fl_Preferences p(fluid_prefs, "widget_browser");
p.get("label_color", c, 72); label_color = c;
p.get("label_font", c, FL_HELVETICA); label_font = c;
p.get("class_color", c, FL_FOREGROUND_COLOR); class_color = c;
p.get("class_font", c, FL_HELVETICA_BOLD); class_font = c;
p.get("func_color", c, FL_FOREGROUND_COLOR); func_color = c;
p.get("func_font", c, FL_HELVETICA); func_font = c;
p.get("name_color", c, FL_FOREGROUND_COLOR); name_color = c;
p.get("name_font", c, FL_HELVETICA); name_font = c;
p.get("code_color", c, FL_FOREGROUND_COLOR); code_color = c;
p.get("code_font", c, FL_HELVETICA); code_font = c;
p.get("comment_color",c, FL_DARK_GREEN); comment_color = c;
p.get("comment_font", c, FL_HELVETICA); comment_font = c;
}
void Widget_Browser::save_prefs() {
Fl_Preferences p(fluid_prefs, "widget_browser");
p.set("label_color", (int)label_color);
p.set("label_font", (int)label_font);
p.set("class_color", (int)class_color);
p.set("class_font", (int)class_font);
p.set("func_color", (int)func_color);
p.set("func_font", (int)func_font);
p.set("name_color", (int)name_color);
p.set("name_font", (int)name_font);
p.set("code_color", (int)code_color);
p.set("code_font", (int)code_font);
p.set("comment_color", (int)comment_color);
p.set("comment_font", (int)comment_font);
}

View File

@ -63,6 +63,21 @@ public:
void restore_scroll_position();
void rebuild();
void display(Fl_Type *);
void load_prefs();
void save_prefs();
static Fl_Color label_color;
static Fl_Font label_font;
static Fl_Color class_color;
static Fl_Font class_font;
static Fl_Color func_color;
static Fl_Font func_font;
static Fl_Color name_color;
static Fl_Font name_font;
static Fl_Color code_color;
static Fl_Font code_font;
static Fl_Color comment_color;
static Fl_Font comment_font;
};
#endif // _FLUID_WIDGET_BROWSER_H