From 47276e733d9d422ca6ac49cd4f87c2b8b712ef7c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 4 Jul 2004 06:49:34 +0000 Subject: [PATCH] In order to make the whitte text field at the bottom left of the Help Dialog clearer, I added a magnifying glass in front of the field sybolising "search". I made the scaleable magnifying glass available as a symbol via "@search" I added yet another symbol that draw a vectorized version of the FLTK logo. Available via "@FLTK". Lastly, I changed the 'symbol' test program to show the additional symbols, and added a slider to changae the relative symbol size. I hope the new symbols look good enough on other platforms, too. I tested only OS X. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ FL/Fl_Help_Dialog.H | 1 + src/Fl_Help_Dialog.cxx | 16 ++++++++--- src/Fl_Help_Dialog.fl | 15 ++++++---- src/fl_symbols.cxx | 51 +++++++++++++++++++++++++++++++-- test/symbols.cxx | 65 ++++++++++++++++++++++++++---------------- 6 files changed, 114 insertions(+), 36 deletions(-) diff --git a/CHANGES b/CHANGES index 5d0b34f53..c1baeca7b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.5rc2 + - Added Search symbol to the search field of the Help + Dialog (@serach). Added FLTK logo (@FLTK) - Documentation updates (STR #365, STR #399, STR #412) - MacOS X: fixed NumLock mixup, added support for FL_Menu and FL_Delete keys on external (PC) keyboards diff --git a/FL/Fl_Help_Dialog.H b/FL/Fl_Help_Dialog.H index 40a329c77..f5f9e6a37 100644 --- a/FL/Fl_Help_Dialog.H +++ b/FL/Fl_Help_Dialog.H @@ -6,6 +6,7 @@ #include #include #include +#include #include class FL_EXPORT Fl_Help_Dialog { diff --git a/src/Fl_Help_Dialog.cxx b/src/Fl_Help_Dialog.cxx index aadee5495..5d03cc7fc 100644 --- a/src/Fl_Help_Dialog.cxx +++ b/src/Fl_Help_Dialog.cxx @@ -114,7 +114,7 @@ inline void Fl_Help_Dialog::cb_find__i(Fl_Input*, void*) { find_pos_ = view_->find(find_->value(), find_pos_); } void Fl_Help_Dialog::cb_find_(Fl_Input* o, void* v) { - ((Fl_Help_Dialog*)(o->parent()->user_data()))->cb_find__i(o,v); + ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_find__i(o,v); } Fl_Help_Dialog::Fl_Help_Dialog() { @@ -164,9 +164,17 @@ Fl_Help_Dialog::Fl_Help_Dialog() { o->labelsize(16); o->callback((Fl_Callback*)cb_larger_); } - { Fl_Input* o = find_ = new Fl_Input(10, 350, 265, 25); - o->callback((Fl_Callback*)cb_find_); - o->when(FL_WHEN_ENTER_KEY_ALWAYS); + { Fl_Group* o = new Fl_Group(10, 350, 265, 25); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + { Fl_Input* o = find_ = new Fl_Input(35, 352, 238, 21, "@search"); + o->tooltip("find text in document"); + o->box(FL_FLAT_BOX); + o->labelsize(13); + o->callback((Fl_Callback*)cb_find_); + o->when(FL_WHEN_ENTER_KEY_ALWAYS); + } + o->end(); } o->end(); } diff --git a/src/Fl_Help_Dialog.fl b/src/Fl_Help_Dialog.fl index 7647aaab6..4524cbda3 100644 --- a/src/Fl_Help_Dialog.fl +++ b/src/Fl_Help_Dialog.fl @@ -17,7 +17,7 @@ class FL_EXPORT Fl_Help_Dialog {open } { Fl_Window window_ { label {Help Dialog} open - private xywh {398 65 530 385} type Double hide resizable + private xywh {398 65 530 385} type Double resizable visible } { Fl_Group view_ { callback {if (view_->changed()) @@ -48,7 +48,7 @@ else if (view_->filename()) { strlcpy(file_[index_], view_->filename(), sizeof(file_[0])); line_[index_] = view_->topline(); -}} open selected +}} open private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable code0 {\#include } class Fl_Help_View @@ -115,9 +115,14 @@ if (view_->textsize() >= 18) smaller_->activate();} private tooltip {Make the help text larger.} xywh {320 350 25 25} labelfont 1 labelsize 16 } - Fl_Input find_ { - callback {find_pos_ = view_->find(find_->value(), find_pos_);} - private xywh {10 350 265 25} when 10 + Fl_Group {} {open + xywh {10 350 265 25} box DOWN_BOX color 7 + } { + Fl_Input find_ { + label {@search} + callback {find_pos_ = view_->find(find_->value(), find_pos_);} selected + private tooltip {find text in document} xywh {35 352 238 21} box FLAT_BOX labelsize 13 when 10 + } } } code {back_->deactivate(); diff --git a/src/fl_symbols.cxx b/src/fl_symbols.cxx index 1c1456a8e..25e8ee38e 100644 --- a/src/fl_symbols.cxx +++ b/src/fl_symbols.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_symbols.cxx,v 1.8.2.3.2.8 2004/04/11 04:39:00 easysw Exp $" +// "$Id: fl_symbols.cxx,v 1.8.2.3.2.9 2004/07/04 06:49:33 matthiaswm Exp $" // // Symbol drawing code for the Fast Light Tool Kit (FLTK). // @@ -171,6 +171,51 @@ static void rectangle(double x,double y,double x2,double y2,Fl_Color col) { /* The drawing routines */ +static void draw_fltk(Fl_Color col) +{ + fl_color(col); + // F fill + BP; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3); + vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1); + vv(-1.8, 0.5); vv(-2.0, 0.5); EP; + // L fill + BP; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3); + vv(0.0, 0.5); vv(-1.0, 0.5); EP; + // T outline + BP; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3); + vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); EP; + // K outline + BP; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5); + vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5); + vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); EP; + set_outline_color(col); + // F outline + BC; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3); + vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1); + vv(-1.8, 0.5); vv(-2.0, 0.5); EC; + // L outline + BC; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3); + vv(0.0, 0.5); vv(-1.0, 0.5); EC; + // T outline + BC; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3); + vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); EC; + // K outline + BC; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5); + vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5); + vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); EC; +} + +static void draw_search(Fl_Color col) +{ + fl_color(col); + BP; vv(.4, .13); vv(1.0, .73); vv(.73, 1.0); vv(.13, .4); EP; + set_outline_color(col); + fl_line_style(FL_SOLID, 3, 0); + BC; fl_circle(-.2, -.2, .8); EC; + fl_line_style(FL_SOLID, 1, 0); + BC; vv(.4, .13); vv(1.0, .73); vv(.73, 1.0); vv(.13, .4); EC; +} + static void draw_arrow1(Fl_Color col) { fl_color(col); @@ -358,8 +403,10 @@ static void fl_init_symbols(void) { fl_add_symbol("UpArrow", draw_uparrow, 1); fl_add_symbol("DnArrow", draw_downarrow, 1); fl_add_symbol("||", draw_doublebar, 1); + fl_add_symbol("search", draw_search, 1); + fl_add_symbol("FLTK", draw_fltk, 1); } // -// End of "$Id: fl_symbols.cxx,v 1.8.2.3.2.8 2004/04/11 04:39:00 easysw Exp $". +// End of "$Id: fl_symbols.cxx,v 1.8.2.3.2.9 2004/07/04 06:49:33 matthiaswm Exp $". // diff --git a/test/symbols.cxx b/test/symbols.cxx index 069e8c5c1..c3d0acf4f 100644 --- a/test/symbols.cxx +++ b/test/symbols.cxx @@ -1,5 +1,5 @@ // -// "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $" +// "$Id: symbols.cxx,v 1.4.2.3.2.7 2004/07/04 06:49:34 matthiaswm Exp $" // // Symbol test program for the Fast Light Tool Kit (FLTK). // @@ -36,34 +36,40 @@ int N = 0; #define W 70 #define H 70 -#define ROWS 5 -#define COLS 5 +#define ROWS 7 +#define COLS 4 Fl_Window *window; +Fl_Value_Slider *orientation; +Fl_Value_Slider *size; void slider_cb(Fl_Widget *w, void *) { static char buf[80]; - int val = (int)(((Fl_Value_Slider*)w)->value()); - Fl_Window *win = (Fl_Window*)w->parent(); // get parent window - for (int i = win->children(); i--; ) { // all window children - Fl_Widget *wc = win->child(i); + int val = (int)orientation->value(); + int sze = (int)size->value(); + for (int i = window->children(); i--; ) { // all window children + Fl_Widget *wc = window->child(i); const char *l = wc->label(); if ( *l == '@' ) { // all children with '@' if ( *(++l) == '@' ) { // ascii legend? l++; - while (isdigit(*l)) { l++; } - if (val == 0) { sprintf(buf, "@@%s", l); } - else { sprintf(buf, "@@%d%s", val, l); } + while (isdigit(*l)||*l=='+'||*l=='-') { l++; } + if (val&&sze) sprintf(buf, "@@%+d%d%s", sze, val, l); + else if (val) sprintf(buf, "@@%d%s", val, l); + else if (sze) sprintf(buf, "@@%+d%s", sze, l); + else sprintf(buf, "@@%s", l); } else { // box with symbol - while (isdigit(*l)) { l++; } - if (val == 0) { sprintf(buf, "@%s", l); } - else { sprintf(buf, "@%d%s", val, l); } + while (isdigit(*l)||*l=='+'||*l=='-') { l++; } + if (val&&sze) sprintf(buf, "@%+d%d%s", sze, val, l); + else if (val) sprintf(buf, "@%d%s", val, l); + else if (sze) sprintf(buf, "@%+d%s", sze, l); + else sprintf(buf, "@%s", l); } free((void*)(wc->label())); wc->label(strdup(buf)); } } - win->redraw(); + window->redraw(); } void bt(const char *name) { @@ -108,17 +114,26 @@ bt("@line"); bt("@menu"); bt("@UpArrow"); bt("@DnArrow"); +bt("@search"); +bt("@FLTK"); - Fl_Value_Slider slider((int)(window->w()*.10+.5), - window->h()-40, - (int)(window->w()*.80+.5), - 16, - "Orientation"); - slider.type(FL_HORIZONTAL); - slider.range(0.0, 9.0); - slider.value(0.0); - slider.step(1); - slider.callback(slider_cb, &slider); + orientation = new Fl_Value_Slider( + (int)(window->w()*.05+.5), window->h()-40, + (int)(window->w()*.42+.5), 16, "Orientation"); + orientation->type(FL_HORIZONTAL); + orientation->range(0.0, 9.0); + orientation->value(0.0); + orientation->step(1); + orientation->callback(slider_cb, 0); + + size = new Fl_Value_Slider( + (int)(window->w()*.53+.5), window->h()-40, + (int)(window->w()*.42+.5), 16, "Size"); + size->type(FL_HORIZONTAL); + size->range(-3.0, 9.0); + size->value(0.0); + size->step(1); + size->callback(slider_cb, 0); window->resizable(window); window->show(argc,argv); @@ -126,5 +141,5 @@ bt("@DnArrow"); } // -// End of "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $". +// End of "$Id: symbols.cxx,v 1.4.2.3.2.7 2004/07/04 06:49:34 matthiaswm Exp $". //