diff options
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | documentation/common.html | 2 | ||||
| -rw-r--r-- | src/fl_symbols.cxx | 69 | ||||
| -rw-r--r-- | test/symbols.cxx | 5 |
4 files changed, 62 insertions, 15 deletions
@@ -2,6 +2,7 @@ CHANGES IN FLTK 1.1.7 - Documentation fixes (STR #648, STR #692, STR #730, STR #744, STR #745) + - Added symbols 'refresh', 'reload', 'undo', and 'redo'. - Fixed focus loss on Fl_Window:resize() - Fl::delete_widget would hang fl_wait after deleting the window (STR #679) diff --git a/documentation/common.html b/documentation/common.html index a7f17fca5..2a2421cc1 100644 --- a/documentation/common.html +++ b/documentation/common.html @@ -350,6 +350,8 @@ sign. Figure 3-4 shows the available symbols.</P> <LI>+[1-9] or -[1-9] tweaks the scaling a little bigger or smaller.</LI> + <LL>'$' flips the symbol horizontaly, '%' flips it verticaly. + <LI>[1-9] - rotates by a multiple of 45 degrees. '5' and '6' do no rotation while the others point in the direction of that key on a numeric keypad.</LI> diff --git a/src/fl_symbols.cxx b/src/fl_symbols.cxx index 02f3fe2ed..bec2a8196 100644 --- a/src/fl_symbols.cxx +++ b/src/fl_symbols.cxx @@ -113,6 +113,15 @@ int fl_draw_symbol(const char *label,int x,int y,int w,int h,Fl_Color col) { if (w < 10) {x -= (10-w)/2; w = 10;} if (h < 10) {y -= (10-h)/2; h = 10;} w = (w-1)|1; h = (h-1)|1; + char flip_x = 0, flip_y = 0; + if (*p=='$') { + flip_x = 1; + p++; + } + if (*p=='%') { + flip_y = 1; + p++; + } int rotangle; switch (*p++) { case '0': @@ -142,6 +151,8 @@ int fl_draw_symbol(const char *label,int x,int y,int w,int h,Fl_Color col) { if (equalscale) {if (w<h) h = w; else w = h;} fl_scale(0.5*w, 0.5*h); fl_rotate(rotangle/10.0); + if (flip_x) fl_scale(-1.0, 1.0); + if (flip_y) fl_scale(1.0, -1.0); } (symbols[pos].drawit)(col); fl_pop_matrix(); @@ -576,12 +587,11 @@ static void draw_fileprint(Fl_Color c) { EC; } -static void draw_recycle(Fl_Color c) { - double i, r, di=5.0, dr1=0.005, dr2=0.015; - int j; - for (j=0; j<4; j++) { - fl_rotate(180.0); - if (j&2) { +static void draw_round_arrow(Fl_Color c, float da=5.0) { + double a, r, dr1=0.005, dr2=0.015; + int i, j; + for (j=0; j<2; j++) { + if (j&1) { fl_color(c); set_outline_color(c); BC; @@ -592,15 +602,15 @@ static void draw_recycle(Fl_Color c) { vv(-0.1, 0.0); vv(-1.0, 0.0); vv(-1.0, 0.9); - for (i=135.0, r=1.0; i>=0.0; i-=di, r-=dr1) { - double a = i/180.0 * M_PI; - vv(cos(a)*r, sin(a)*r); + for (i=27, a=140.0, r=1.0; i>0; i--, a-=da, r-=dr1) { + double ar = a/180.0 * M_PI; + vv(cos(ar)*r, sin(ar)*r); } - for (i=0.0; i<=135.0; i+=di, r-=dr2) { - double a = i/180.0 * M_PI; - vv(cos(a)*r, sin(a)*r); + for (i=27; i>=0; a+=da, i--, r-=dr2) { + double ar = a/180.0 * M_PI; + vv(cos(ar)*r, sin(ar)*r); } - if (j&2) { + if (j&1) { EC; } else { ECP; @@ -608,6 +618,33 @@ static void draw_recycle(Fl_Color c) { } } +static void draw_refresh(Fl_Color c) { + draw_round_arrow(c); + fl_rotate(180.0); + draw_round_arrow(c); + fl_rotate(-180.0); +} + +static void draw_reload(Fl_Color c) { + fl_rotate(-135.0); + draw_round_arrow(c, 10); + fl_rotate(135.0); +} + +static void draw_undo(Fl_Color c) { + fl_translate(0.0, 0.2); + fl_scale(1.0, -1.0); + draw_round_arrow(c, 6); + fl_scale(1.0, -1.0); + fl_translate(0.0, -0.2); +} + +static void draw_redo(Fl_Color c) { + fl_scale(-1.0, 1.0); + draw_undo(c); + fl_scale(-1.0, 1.0); +} + static void fl_init_symbols(void) { static char beenhere; if (beenhere) return; @@ -649,7 +686,11 @@ static void fl_init_symbols(void) { fl_add_symbol("filesave", draw_filesave, 1); fl_add_symbol("filesaveas", draw_filesaveas, 1); fl_add_symbol("fileprint", draw_fileprint, 1); - fl_add_symbol("recycle", draw_recycle, 1); + + fl_add_symbol("refresh", draw_refresh, 1); + fl_add_symbol("reload", draw_reload, 1); + fl_add_symbol("undo", draw_undo, 1); + fl_add_symbol("redo", draw_redo, 1); // fl_add_symbol("file", draw_file, 1); } diff --git a/test/symbols.cxx b/test/symbols.cxx index 5b66c08d8..6450a20a3 100644 --- a/test/symbols.cxx +++ b/test/symbols.cxx @@ -126,7 +126,10 @@ bt("@fileopen"); bt("@filesave"); bt("@filesaveas"); bt("@fileprint"); -bt("@recycle"); +bt("@refresh"); +bt("@reload"); +bt("@undo"); +bt("@redo"); orientation = new Fl_Value_Slider( (int)(window->w()*.05+.5), window->h()-40, |
