diff --git a/.clang-format b/.clang-format index 28c60bc2c..dd711b85b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ # # clang-format control file for the FLTK project. # -# Copyright 2017-2022 by Bill Spitzak and others. +# Copyright 2017-2026 by Bill Spitzak and others. # # This library is free software. Distribution and use rights are outlined in # the file "COPYING" which should have been included with this file. If this @@ -112,7 +112,9 @@ SortIncludes: false # Multiple constructor initializers must be on consecutive lines. # Note: this is NOT (always) true in current FLTK code! -BreakConstructorInitializersBeforeComma: true +BreakConstructorInitializers: BeforeColon +# or: BeforeColon, BeforeComma, AfterColon, AfterComma +# was: BreakConstructorInitializersBeforeComma: true # Constructor initializers will be indented by 2 spaces. # LLVM default: 4 @@ -125,6 +127,20 @@ ConstructorInitializerIndentWidth: 2 # LLVM default: 4 # ContinuationIndentWidth: 2 +# If a control statement (if-clause, etc.) spans multiple lines, the opening +# brace can get visibly lost and it is hard to see when the condition ends and +# the statements start. MultiLine puts the brace on the next line in this case. +# +# AfterFunction: true would be a change in style and is up for debate. +# I like it because it separates the declaration from the body. I wish there +# was a MultiLine option here as well. + +BreakBeforeBraces: Custom +BraceWrapping: + AfterControlStatement: MultiLine + AfterFunction: true + SplitEmptyFunction: false + # Most of FLTK's code uses 'void *p' as opposed to 'void* p'. # This is particularly useful in combined declarations like: # int var, var2, *pv, **pp; @@ -136,4 +152,4 @@ ConstructorInitializerIndentWidth: 2 # in function parameter lists. DerivePointerAlignment: false -PointerAlignment: Right +PointerAlignment: Left diff --git a/FL/fl_draw.H b/FL/fl_draw.H index 11375125d..742677f82 100644 --- a/FL/fl_draw.H +++ b/FL/fl_draw.H @@ -1,7 +1,7 @@ // // Portable drawing function header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2025 by Bill Spitzak and others. +// Copyright 1998-2026 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -1251,9 +1251,11 @@ FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Wi FL_EXPORT void fl_reset_spot(void); -// XForms symbols: +// Symbols (originally from XForms): FL_EXPORT int fl_draw_symbol(const char *label, int x, int y, int w, int h, Fl_Color); -FL_EXPORT int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable); +FL_EXPORT int fl_add_symbol(const char *name, void (*drawit)(Fl_Color c), int scalable); +FL_EXPORT int fl_add_symbol(const char *name, void (*draw_in_rect)(int x, int y, int w, int h, Fl_Color c), int scalable); +FL_EXPORT int fl_remove_symbol(const char *name); /** @} */ #endif diff --git a/fluid/.claude/worktrees/naughty-blackburn-008169 b/fluid/.claude/worktrees/naughty-blackburn-008169 new file mode 160000 index 000000000..d2ed9a50c --- /dev/null +++ b/fluid/.claude/worktrees/naughty-blackburn-008169 @@ -0,0 +1 @@ +Subproject commit d2ed9a50ccb4adcdc99e63d7bcac6a3cbe820385 diff --git a/src/fl_symbols.cxx b/src/fl_symbols.cxx index cfff9e3a4..7e4e9b6fc 100644 --- a/src/fl_symbols.cxx +++ b/src/fl_symbols.cxx @@ -1,7 +1,7 @@ // // Symbol drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2026 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -28,138 +28,225 @@ #include #include "flstring.h" -typedef struct { - const char *name; - void (*drawit)(Fl_Color); - char scalable; - char notempty; -} SYMBOL; +#include +#include -#define MAXSYMBOL 211 - /* Maximal number of symbols in table. Only half of them are - used. Should be prime. */ +// fl_return_arrow() is defined in src/Fl_Return_Button.cxx, +// it is not public (defined in a header) and not "exported" though. -static SYMBOL symbols[MAXSYMBOL]; /* The symbols */ -static int symbnumb = -1; /* Their number */ +extern int fl_return_arrow(int x, int y, int w, int h); -static int find(const char *name) { -// returns hash entry if it exists, or first empty slot: - int pos = name[0] ? ( - name[1] ? ( - name[2] ? 71*name[0]+31*name[1]+name[2] : 31*name[0]+name[1] - ) : - name[0] - ) : 0; - pos %= MAXSYMBOL; - int hh2 = name[0] ? ( - (name[1]) ? 51*name[0]+3*name[1] : 3*name[0] - ) : 1; - hh2 %= MAXSYMBOL; if (!hh2) hh2 = 1; - for (;;) { - if (!symbols[pos].notempty) return pos; - if (!strcmp(symbols[pos].name,name)) return pos; - pos = (pos + hh2) % MAXSYMBOL; - } -} +struct Symbol { + constexpr Symbol() : drawit(nullptr), scalable(0), call_with_rect(0) {} + constexpr Symbol(void (*drawit)(Fl_Color), int scalable) + : drawit(drawit), scalable(static_cast(scalable)), call_with_rect(0) + {} + constexpr Symbol(void (*draw_in_rect)(int, int, int, int, Fl_Color), int scalable) + : draw_in_rect(draw_in_rect), scalable(static_cast(scalable)), call_with_rect(1) + {} + union { + void (*drawit)(Fl_Color); + void (*draw_in_rect)(int x, int y, int w, int h, Fl_Color col); + }; + uint8_t scalable : 1; + uint8_t call_with_rect : 1; +}; -static void fl_init_symbols(void); +// Defined after the drawing functions so the initializer list can reference them. +static std::unordered_map& symbol_table(); -/**************** The routines seen by the user *************************/ +/* *************** The routines seen by the user ************************ */ /** - Adds a symbol to the system. - If a symbol with that name is already defined, its draw function is replaced by \p drawit. - \param[in] name name of symbol (without the "@") - \param[in] drawit function to draw symbol - \param[in] scalable set to 1 if \p drawit uses scalable vector drawing - \returns 1 on success, 0 if the maximum number of symbols has been reached. - */ -int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable) + Registers (or replaces) a named symbol drawn using complex vector drawing. + + + \p drawit is called with the matrix pushed and the origin translated to the + center of the drawing rectangle. If \p scalable is set, the matrix is also + pre-scaled so the unit square (-1,-1) to (1,1) maps onto the rectangle; + use FLTK's complex-shape drawing calls in that coordinate space. + + See \ref drawing_complex for the FLTK drawing calls that work + with the preset transform. + + \param[in] name symbol name without the leading "@" + \param[in] drawit drawing function; must not be null + \param[in] scalable 1 (default) to allow scaling and rotation, 0 to keep fixed size + \return 1 if the operation was successful (always). + + + \see fl_add_symbol(const char* name, void (* draw_in_rect)(int x, int y, int w, int h, Fl_Color c), int scalable) +*/ +int fl_add_symbol(const char* name, void (*drawit)(Fl_Color c), int scalable) { - fl_init_symbols(); - int pos; - if (symbnumb > MAXSYMBOL / 2) return 0; // table is full - pos = find(name); - if (!symbols[pos].notempty) symbnumb++; - symbols[pos].name = name; - symbols[pos].drawit = drawit; - symbols[pos].notempty = 1; - symbols[pos].scalable = scalable; + auto& t = symbol_table(); + t[name] = Symbol(drawit, scalable); return 1; } -int fl_return_arrow(int x,int y,int w,int h); +/** + Registers (or replaces) a named symbol drawn into an explicit pixel rectangle. + + + Use this variant for symbols drawn with fast lines, text, or bitmaps, where + working directly in pixel coordinates is more natural. If \p scalable is set, + the matrix is pushed and pre-scaled as with the vector variant, so the symbol + can also use complex-shape drawing calls in the (-1,-1) to (1,1) space. + + See \ref drawing_complex for the FLTK drawing calls that work + with the preset transform. + + \param[in] name symbol name without the leading "@" + \param[in] draw_in_rect drawing function; receives color and target rectangle; must not be null + \param[in] scalable 1 (default) to allow scaling and rotation, 0 to keep fixed size + \return 1 if the operation was successful (always). + + + \see fl_add_symbol(const char* name, void (* drawit)(Fl_Color c), int scalable) +*/ +int fl_add_symbol(const char* name, void (*draw_in_rect)(int x, int y, int w, int h, Fl_Color c), + int scalable) +{ + auto& t = symbol_table(); + t[name] = Symbol(draw_in_rect, scalable); + return 1; +} + +/** + Removes the symbol with name \c name from the system. + + If a symbol with that name is not defined, this function does nothing. + + \param[in] name name of symbol (without the "@") + \returns 1 on success (always). +*/ +int fl_remove_symbol(const char* name) +{ + auto& t = symbol_table(); + t.erase(name); + return 1; +} /** Draw the named symbol in the given rectangle using the given color \param[in] label name of symbol \param[in] x,y position of symbol \param[in] w,h size of symbol - \param[in] col color of symbox + \param[in] col color of symbol \returns 1 on success, 0 on failure */ -// provided for back compatibility: -int fl_draw_symbol(const char *label,int x,int y,int w,int h,Fl_Color col) { - const char *p = label; - if (*p++ != '@') return 0; - fl_init_symbols(); +int fl_draw_symbol(const char* label, int x, int y, int w, int h, Fl_Color col) +{ + const char* p = label; + if (*p++ != '@') + return 0; int equalscale = 0; - if (*p == '#') {equalscale = 1; p++;} - if (*p == '-' && p[1]>='1' && p[1]<='9') { - int n = p[1]-'0'; - x += n; y += n; w -= 2*n; h -= 2*n; + if (*p == '#') { + equalscale = 1; + p++; + } + if (*p == '-' && p[1] >= '1' && p[1] <= '9') { + int n = p[1] - '0'; + x += n; + y += n; + w -= 2 * n; + h -= 2 * n; p += 2; - } else if (*p == '+' && p[1]>='1' && p[1]<='9') { - int n = p[1]-'0'; - x -= n; y -= n; w += 2*n; h += 2*n; + } else if (*p == '+' && p[1] >= '1' && p[1] <= '9') { + int n = p[1] - '0'; + x -= n; + y -= n; + w += 2 * n; + h += 2 * n; p += 2; } - 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; + 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=='$') { + if (*p == '$') { flip_x = 1; p++; } - if (*p=='%') { + if (*p == '%') { flip_y = 1; p++; } int rotangle; switch (*p++) { - case '0': - rotangle = 1000*(p[1]-'0') + 100*(p[2]-'0') + 10*(p[3]-'0'); - p += 4; - break; - case '1': rotangle = 2250; break; - case '2': rotangle = 2700; break; - case '3': rotangle = 3150; break; - case '4': rotangle = 1800; break; - case '5': - case '6': rotangle = 0; break; - case '7': rotangle = 1350; break; - case '8': rotangle = 900; break; - case '9': rotangle = 450; break; - default: rotangle = 0; p--; break; + case '0': + rotangle = 1000 * (p[1] - '0') + 100 * (p[2] - '0') + 10 * (p[3] - '0'); + p += 4; + break; + case '1': + rotangle = 2250; + break; + case '2': + rotangle = 2700; + break; + case '3': + rotangle = 3150; + break; + case '4': + rotangle = 1800; + break; + case '5': + case '6': + rotangle = 0; + break; + case '7': + rotangle = 1350; + break; + case '8': + rotangle = 900; + break; + case '9': + rotangle = 450; + break; + default: + rotangle = 0; + p--; + break; } - int pos = find(p); - if (!symbols[pos].notempty) return 0; - if (symbols[pos].scalable == 3) { // kludge to detect return arrow - fl_return_arrow(x,y,w,h); - return 1; + auto& t = symbol_table(); + auto it = t.find(p); + if (it == t.end()) + return 0; + const Symbol& sym = it->second; + + if (sym.call_with_rect && !sym.scalable) { + sym.draw_in_rect(x, y, w, h, col); + } else { + fl_push_matrix(); + fl_translate(x + w / 2, y + h / 2); + if (sym.scalable) { + int ws = w, hs = h; + if (equalscale) { + if (ws < hs) + hs = ws; + else + ws = hs; + } + fl_scale(0.5 * ws, 0.5 * hs); + fl_rotate(rotangle / 10.0); + if (flip_x) + fl_scale(-1.0, 1.0); + if (flip_y) + fl_scale(1.0, -1.0); + } + if (sym.call_with_rect) + sym.draw_in_rect(x, y, w, h, col); + else + sym.drawit(col); + fl_pop_matrix(); } - fl_push_matrix(); - fl_translate(x+w/2,y+h/2); - if (symbols[pos].scalable) { - if (equalscale) {if (wcan_fill_non_convex_polygon()) { // draw the arrow as a 7-vertex filled polygon - BP; vv(-0.8,-0.4); vv(-0.8,0.4); vv(0.0,0.4); vv(0.0,0.8); vv(0.8,0.0); - vv(0.0,-0.8); vv(0.0,-0.4); EP; + BP; + vv(-0.8, -0.4); + vv(-0.8, 0.4); + vv(0.0, 0.4); + vv(0.0, 0.8); + vv(0.8, 0.0); + vv(0.0, -0.8); + vv(0.0, -0.4); + EP; } else { // draw the arrow as a rectangle plus a triangle - BP; vv(-0.8,-0.4); vv(-0.8,0.4); vv(0.0,0.4); vv(0.0,-0.4); EP; - BP; vv(0.0,0.8); vv(0.8,0.0); vv(0.0,-0.8); vv(0.0,-0.4); vv(0.0,0.4); EP; + BP; + vv(-0.8, -0.4); + vv(-0.8, 0.4); + vv(0.0, 0.4); + vv(0.0, -0.4); + EP; + BP; + vv(0.0, 0.8); + vv(0.8, 0.0); + vv(0.0, -0.8); + vv(0.0, -0.4); + vv(0.0, 0.4); + EP; } set_outline_color(col); - BC; vv(-0.8,-0.4); vv(-0.8,0.4); vv(0.0,0.4); vv(0.0,0.8); vv(0.8,0.0); - vv(0.0,-0.8); vv(0.0,-0.4); EC; + BC; + vv(-0.8, -0.4); + vv(-0.8, 0.4); + vv(0.0, 0.4); + vv(0.0, 0.8); + vv(0.8, 0.0); + vv(0.0, -0.8); + vv(0.0, -0.4); + EC; } static void draw_arrow1bar(Fl_Color col) { draw_arrow1(col); - rectangle(.6,-.8,.9,.8,col); + rectangle(.6, -.8, .9, .8, col); } static void draw_arrow2(Fl_Color col) { fl_color(col); - BP; vv(-0.3,0.8); vv(0.50,0.0); vv(-0.3,-0.8); EP; + BP; + vv(-0.3, 0.8); + vv(0.50, 0.0); + vv(-0.3, -0.8); + EP; set_outline_color(col); - BC; vv(-0.3,0.8); vv(0.50,0.0); vv(-0.3,-0.8); EC; + BC; + vv(-0.3, 0.8); + vv(0.50, 0.0); + vv(-0.3, -0.8); + EC; } static void draw_arrow3(Fl_Color col) { fl_color(col); - BP; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EP; - BP; vv(-0.7,0.8); vv(0.1,0.0); vv(-0.7,-0.8); EP; + BP; + vv(0.1, 0.8); + vv(0.9, 0.0); + vv(0.1, -0.8); + EP; + BP; + vv(-0.7, 0.8); + vv(0.1, 0.0); + vv(-0.7, -0.8); + EP; set_outline_color(col); - BC; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EC; - BC; vv(-0.7,0.8); vv(0.1,0.0); vv(-0.7,-0.8); EC; + BC; + vv(0.1, 0.8); + vv(0.9, 0.0); + vv(0.1, -0.8); + EC; + BC; + vv(-0.7, 0.8); + vv(0.1, 0.0); + vv(-0.7, -0.8); + EC; } static void draw_arrowbar(Fl_Color col) { fl_color(col); - BP; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EP; - BP; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EP; + BP; + vv(0.2, 0.8); + vv(0.6, 0.8); + vv(0.6, -0.8); + vv(0.2, -0.8); + EP; + BP; + vv(-0.6, 0.8); + vv(0.2, 0.0); + vv(-0.6, -0.8); + EP; set_outline_color(col); - BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC; - BC; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EC; + BC; + vv(0.2, 0.8); + vv(0.6, 0.8); + vv(0.6, -0.8); + vv(0.2, -0.8); + EC; + BC; + vv(-0.6, 0.8); + vv(0.2, 0.0); + vv(-0.6, -0.8); + EC; } static void draw_arrowbox(Fl_Color col) { fl_color(col); - BP; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EP; - BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC; + BP; + vv(-0.6, 0.8); + vv(0.2, 0.0); + vv(-0.6, -0.8); + EP; + BC; + vv(0.2, 0.8); + vv(0.6, 0.8); + vv(0.6, -0.8); + vv(0.2, -0.8); + EC; set_outline_color(col); - BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC; - BC; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EC; + BC; + vv(0.2, 0.8); + vv(0.6, 0.8); + vv(0.6, -0.8); + vv(0.2, -0.8); + EC; + BC; + vv(-0.6, 0.8); + vv(0.2, 0.0); + vv(-0.6, -0.8); + EC; } static void draw_bararrow(Fl_Color col) { fl_color(col); - BP; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EP; - BP; vv(-0.5,0.8); vv(-0.1,0.8); vv(-0.1,-0.8); vv(-0.5,-0.8); EP; + BP; + vv(0.1, 0.8); + vv(0.9, 0.0); + vv(0.1, -0.8); + EP; + BP; + vv(-0.5, 0.8); + vv(-0.1, 0.8); + vv(-0.1, -0.8); + vv(-0.5, -0.8); + EP; set_outline_color(col); - BC; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EC; - BC; vv(-0.5,0.8); vv(-0.1,0.8); vv(-0.1,-0.8); vv(-0.5,-0.8); EC; + BC; + vv(0.1, 0.8); + vv(0.9, 0.0); + vv(0.1, -0.8); + EC; + BC; + vv(-0.5, 0.8); + vv(-0.1, 0.8); + vv(-0.1, -0.8); + vv(-0.5, -0.8); + EC; } -static void draw_doublebar(Fl_Color col) { - rectangle(-0.6,-0.8,-.1,.8,col); - rectangle(.1,-0.8,.6,.8,col); +static void draw_doublebar(Fl_Color col) +{ + rectangle(-0.6, -0.8, -.1, .8, col); + rectangle(.1, -0.8, .6, .8, col); } static void draw_arrow01(Fl_Color col) - { fl_rotate(180); draw_arrow1(col); } +{ + fl_rotate(180); + draw_arrow1(col); +} static void draw_arrow02(Fl_Color col) - { fl_rotate(180); draw_arrow2(col); } +{ + fl_rotate(180); + draw_arrow2(col); +} static void draw_arrow03(Fl_Color col) - { fl_rotate(180); draw_arrow3(col); } +{ + fl_rotate(180); + draw_arrow3(col); +} static void draw_0arrowbar(Fl_Color col) - { fl_rotate(180); draw_arrowbar(col); } +{ + fl_rotate(180); + draw_arrowbar(col); +} static void draw_0arrowbox(Fl_Color col) - { fl_rotate(180); draw_arrowbox(col); } +{ + fl_rotate(180); + draw_arrowbox(col); +} static void draw_0bararrow(Fl_Color col) - { fl_rotate(180); draw_bararrow(col); } +{ + fl_rotate(180); + draw_bararrow(col); +} static void draw_doublearrow(Fl_Color col) { fl_color(col); - BP; vv(-0.35,-0.4); vv(-0.35,0.4); vv(0.35,0.4); vv(0.35,-0.4); EP; - BP; vv(0.15,0.8); vv(0.95,0.0); vv(0.15,-0.8); EP; - BP; vv(-0.15,0.8); vv(-0.95,0.0); vv(-0.15,-0.8); EP; + BP; + vv(-0.35, -0.4); + vv(-0.35, 0.4); + vv(0.35, 0.4); + vv(0.35, -0.4); + EP; + BP; + vv(0.15, 0.8); + vv(0.95, 0.0); + vv(0.15, -0.8); + EP; + BP; + vv(-0.15, 0.8); + vv(-0.95, 0.0); + vv(-0.15, -0.8); + EP; set_outline_color(col); - BC; vv(-0.15,0.4); vv(0.15,0.4); vv(0.15,0.8); vv(0.95,0.0); - vv(0.15,-0.8); vv(0.15,-0.4); vv(-0.15,-0.4); vv(-0.15,-0.8); - vv(-0.95,0.0); vv(-0.15,0.8); EC; + BC; + vv(-0.15, 0.4); + vv(0.15, 0.4); + vv(0.15, 0.8); + vv(0.95, 0.0); + vv(0.15, -0.8); + vv(0.15, -0.4); + vv(-0.15, -0.4); + vv(-0.15, -0.8); + vv(-0.95, 0.0); + vv(-0.15, 0.8); + EC; } static void draw_arrow(Fl_Color col) { fl_color(col); - BP; vv(0.65,0.1); vv(1.0,0.0); vv(0.65,-0.1); EP; - BL; vv(-1.0,0.0); vv(0.65,0.0); EL; + BP; + vv(0.65, 0.1); + vv(1.0, 0.0); + vv(0.65, -0.1); + EP; + BL; + vv(-1.0, 0.0); + vv(0.65, 0.0); + EL; set_outline_color(col); - BL; vv(-1.0,0.0); vv(0.65,0.0); EL; - BC; vv(0.65,0.1); vv(1.0,0.0); vv(0.65,-0.1); EC; + BL; + vv(-1.0, 0.0); + vv(0.65, 0.0); + EL; + BC; + vv(0.65, 0.1); + vv(1.0, 0.0); + vv(0.65, -0.1); + EC; +} + +static void draw_returnarrow(int x, int y, int w, int h, Fl_Color color) +{ + (void)color; // ignored + fl_return_arrow(x, y, w, h); } static void draw_square(Fl_Color col) - { rectangle(-1,-1,1,1,col); } +{ + rectangle(-1, -1, 1, 1, col); +} -static void draw_circle(Fl_Color col) { - fl_color(col); BP; fl_circle(0,0,1); EP; +static void draw_circle(Fl_Color col) +{ + fl_color(col); + BP; + fl_circle(0, 0, 1); + EP; set_outline_color(col); - BC; fl_circle(0,0,1); EC; + BC; + fl_circle(0, 0, 1); + EC; } static void draw_line(Fl_Color col) - { fl_color(col); BL; vv(-1.0,0.0); vv(1.0,0.0); EL; } +{ + fl_color(col); + BL; + vv(-1.0, 0.0); + vv(1.0, 0.0); + EL; +} static void draw_plus(Fl_Color col) { fl_color(col); - BP; vv(-0.9,-0.15); vv(-0.9,0.15); vv(0.9,0.15); vv(0.9,-0.15); EP; - BP; vv(-0.15,-0.9); vv(-0.15,0.9); vv(0.15,0.9); vv(0.15,-0.9); EP; + BP; + vv(-0.9, -0.15); + vv(-0.9, 0.15); + vv(0.9, 0.15); + vv(0.9, -0.15); + EP; + BP; + vv(-0.15, -0.9); + vv(-0.15, 0.9); + vv(0.15, 0.9); + vv(0.15, -0.9); + EP; set_outline_color(col); BC; - vv(-0.9,-0.15); vv(-0.9,0.15); vv(-0.15,0.15); vv(-0.15,0.9); - vv(0.15,0.9); vv(0.15,0.15); vv(0.9,0.15); vv(0.9,-0.15); - vv(0.15,-0.15); vv(0.15,-0.9); vv(-0.15,-0.9); vv(-0.15,-0.15); + vv(-0.9, -0.15); + vv(-0.9, 0.15); + vv(-0.15, 0.15); + vv(-0.15, 0.9); + vv(0.15, 0.9); + vv(0.15, 0.15); + vv(0.9, 0.15); + vv(0.9, -0.15); + vv(0.15, -0.15); + vv(0.15, -0.9); + vv(-0.15, -0.9); + vv(-0.15, -0.15); EC; } -static void draw_uparrow(Fl_Color) { +static void draw_uparrow(Fl_Color) +{ fl_color(FL_LIGHT3); - BL; vv(-.8,.8); vv(-.8,-.8); vv(.8,0); EL; + BL; + vv(-.8, .8); + vv(-.8, -.8); + vv(.8, 0); + EL; fl_color(FL_DARK3); - BL; vv(-.8,.8); vv(.8, 0); EL; + BL; + vv(-.8, .8); + vv(.8, 0); + EL; } -static void draw_downarrow(Fl_Color) { +static void draw_downarrow(Fl_Color) +{ fl_color(FL_DARK3); - BL; vv(-.8,.8); vv(-.8,-.8); vv(.8,0); EL; + BL; + vv(-.8, .8); + vv(-.8, -.8); + vv(.8, 0); + EL; fl_color(FL_LIGHT3); - BL; vv(-.8,.8); vv(.8, 0); EL; + BL; + vv(-.8, .8); + vv(.8, 0); + EL; } static void draw_menu(Fl_Color col) @@ -398,211 +788,217 @@ static void draw_menu(Fl_Color col) } // Standard UI icons... -static void draw_filenew(Fl_Color c) { +static void draw_filenew(Fl_Color c) +{ fl_color(c); BCP; - vv(-0.7, -1.0); - vv(0.1, -1.0); - vv(0.1, -0.4); - vv(0.7, -0.4); - vv(0.7, 1.0); - vv(-0.7, 1.0); + vv(-0.7, -1.0); + vv(0.1, -1.0); + vv(0.1, -0.4); + vv(0.7, -0.4); + vv(0.7, 1.0); + vv(-0.7, 1.0); ECP; fl_color(fl_lighter(c)); BP; - vv(0.1, -1.0); - vv(0.1, -0.4); - vv(0.7, -0.4); + vv(0.1, -1.0); + vv(0.1, -0.4); + vv(0.7, -0.4); EP; fl_color(fl_darker(c)); BC; - vv(-0.7, -1.0); - vv(0.1, -1.0); - vv(0.1, -0.4); - vv(0.7, -0.4); - vv(0.7, 1.0); - vv(-0.7, 1.0); + vv(-0.7, -1.0); + vv(0.1, -1.0); + vv(0.1, -0.4); + vv(0.7, -0.4); + vv(0.7, 1.0); + vv(-0.7, 1.0); EC; BL; - vv(0.1, -1.0); - vv(0.7, -0.4); + vv(0.1, -1.0); + vv(0.7, -0.4); EL; } -static void draw_fileopen(Fl_Color c) { +static void draw_fileopen(Fl_Color c) +{ fl_color(c); BP; - vv(-1.0, -0.7); - vv(-0.9, -0.8); - vv(-0.4, -0.8); - vv(-0.3, -0.7); - vv(0.6, -0.7); - vv(0.6, 0.7); - vv(-1.0, 0.7); + vv(-1.0, -0.7); + vv(-0.9, -0.8); + vv(-0.4, -0.8); + vv(-0.3, -0.7); + vv(0.6, -0.7); + vv(0.6, 0.7); + vv(-1.0, 0.7); EP; fl_color(fl_darker(c)); BC; - vv(-1.0, -0.7); - vv(-0.9, -0.8); - vv(-0.4, -0.8); - vv(-0.3, -0.7); - vv(0.6, -0.7); - vv(0.6, 0.7); - vv(-1.0, 0.7); + vv(-1.0, -0.7); + vv(-0.9, -0.8); + vv(-0.4, -0.8); + vv(-0.3, -0.7); + vv(0.6, -0.7); + vv(0.6, 0.7); + vv(-1.0, 0.7); EC; fl_color(fl_lighter(c)); BP; - vv(-1.0, 0.7); - vv(-0.6, -0.3); - vv(1.0, -0.3); - vv(0.6, 0.7); + vv(-1.0, 0.7); + vv(-0.6, -0.3); + vv(1.0, -0.3); + vv(0.6, 0.7); EP; fl_color(fl_darker(c)); BC; - vv(-1.0, 0.7); - vv(-0.6, -0.3); - vv(1.0, -0.3); - vv(0.6, 0.7); + vv(-1.0, 0.7); + vv(-0.6, -0.3); + vv(1.0, -0.3); + vv(0.6, 0.7); EC; } -static void draw_filesave(Fl_Color c) { +static void draw_filesave(Fl_Color c) +{ fl_color(c); BP; - vv(-0.9, -1.0); - vv(0.9, -1.0); - vv(1.0, -0.9); - vv(1.0, 0.9); - vv(0.9, 1.0); - vv(-0.9, 1.0); - vv(-1.0, 0.9); - vv(-1.0, -0.9); + vv(-0.9, -1.0); + vv(0.9, -1.0); + vv(1.0, -0.9); + vv(1.0, 0.9); + vv(0.9, 1.0); + vv(-0.9, 1.0); + vv(-1.0, 0.9); + vv(-1.0, -0.9); EP; fl_color(fl_lighter(c)); BP; - vv(-0.7, -1.0); - vv(0.7, -1.0); - vv(0.7, -0.4); - vv(-0.7, -0.4); + vv(-0.7, -1.0); + vv(0.7, -1.0); + vv(0.7, -0.4); + vv(-0.7, -0.4); EP; BP; - vv(-0.7, 0.0); - vv(0.7, 0.0); - vv(0.7, 1.0); - vv(-0.7, 1.0); + vv(-0.7, 0.0); + vv(0.7, 0.0); + vv(0.7, 1.0); + vv(-0.7, 1.0); EP; fl_color(c); BP; - vv(-0.5, -0.9); - vv(-0.3, -0.9); - vv(-0.3, -0.5); - vv(-0.5, -0.5); + vv(-0.5, -0.9); + vv(-0.3, -0.9); + vv(-0.3, -0.5); + vv(-0.5, -0.5); EP; fl_color(fl_darker(c)); BC; - vv(-0.9, -1.0); - vv(0.9, -1.0); - vv(1.0, -0.9); - vv(1.0, 0.9); - vv(0.9, 1.0); - vv(-0.9, 1.0); - vv(-1.0, 0.9); - vv(-1.0, -0.9); + vv(-0.9, -1.0); + vv(0.9, -1.0); + vv(1.0, -0.9); + vv(1.0, 0.9); + vv(0.9, 1.0); + vv(-0.9, 1.0); + vv(-1.0, 0.9); + vv(-1.0, -0.9); EC; } -static void draw_filesaveas(Fl_Color c) { +static void draw_filesaveas(Fl_Color c) +{ draw_filesave(c); fl_color(fl_color_average(c, FL_WHITE, 0.25f)); BP; - vv(0.6, -0.8); - vv(1.0, -0.4); - vv(0.0, 0.6); - vv(-0.4, 0.6); - vv(-0.4, 0.2); + vv(0.6, -0.8); + vv(1.0, -0.4); + vv(0.0, 0.6); + vv(-0.4, 0.6); + vv(-0.4, 0.2); EP; fl_color(fl_darker(c)); BC; - vv(0.6, -0.8); - vv(1.0, -0.4); - vv(0.0, 0.6); - vv(-0.4, 0.6); - vv(-0.4, 0.2); + vv(0.6, -0.8); + vv(1.0, -0.4); + vv(0.0, 0.6); + vv(-0.4, 0.6); + vv(-0.4, 0.2); EC; BP; - vv(-0.1, 0.6); - vv(-0.4, 0.6); - vv(-0.4, 0.3); + vv(-0.1, 0.6); + vv(-0.4, 0.6); + vv(-0.4, 0.3); EP; } -static void draw_fileprint(Fl_Color c) { +static void draw_fileprint(Fl_Color c) +{ fl_color(c); BP; - vv(-0.8, 0.0); - vv(0.8, 0.0); - vv(1.0, 0.2); - vv(1.0, 1.0); - vv(-1.0, 1.0); - vv(-1.0, 0.2); + vv(-0.8, 0.0); + vv(0.8, 0.0); + vv(1.0, 0.2); + vv(1.0, 1.0); + vv(-1.0, 1.0); + vv(-1.0, 0.2); EP; fl_color(fl_color_average(c, FL_WHITE, 0.25f)); BP; - vv(-0.6, 0.0); - vv(-0.6, -1.0); - vv(0.6, -1.0); - vv(0.6, 0.0); + vv(-0.6, 0.0); + vv(-0.6, -1.0); + vv(0.6, -1.0); + vv(0.6, 0.0); EP; fl_color(fl_lighter(c)); BP; - vv(-0.6, 0.6); - vv(0.6, 0.6); - vv(0.6, 1.0); - vv(-0.6, 1.0); + vv(-0.6, 0.6); + vv(0.6, 0.6); + vv(0.6, 1.0); + vv(-0.6, 1.0); EP; fl_color(fl_darker(c)); BC; - vv(-0.8, 0.0); - vv(-0.6, 0.0); - vv(-0.6, -1.0); - vv(0.6, -1.0); - vv(0.6, 0.0); - vv(0.8, 0.0); - vv(1.0, 0.2); - vv(1.0, 1.0); - vv(-1.0, 1.0); - vv(-1.0, 0.2); + vv(-0.8, 0.0); + vv(-0.6, 0.0); + vv(-0.6, -1.0); + vv(0.6, -1.0); + vv(0.6, 0.0); + vv(0.8, 0.0); + vv(1.0, 0.2); + vv(1.0, 1.0); + vv(-1.0, 1.0); + vv(-1.0, 0.2); EC; BC; - vv(-0.6, 0.6); - vv(0.6, 0.6); - vv(0.6, 1.0); - vv(-0.6, 1.0); + vv(-0.6, 0.6); + vv(0.6, 0.6); + vv(0.6, 1.0); + vv(-0.6, 1.0); EC; } -static void draw_round_arrow(Fl_Color c, float da=5.0) { - double a, r, dr1=0.005, dr2=0.015; +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) { + for (j = 0; j < 2; j++) { + if (j & 1) { fl_color(c); set_outline_color(c); BC; @@ -613,15 +1009,15 @@ static void draw_round_arrow(Fl_Color c, float da=5.0) { vv(-0.1, 0.0); vv(-1.0, 0.0); vv(-1.0, 0.9); - 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 = 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=27; i>=0; a+=da, i--, r-=dr2) { - double ar = a/180.0 * M_PI; - vv(cos(ar)*r, sin(ar)*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&1) { + if (j & 1) { EC; } else { ECP; @@ -629,20 +1025,23 @@ static void draw_round_arrow(Fl_Color c, float da=5.0) { } } -static void draw_refresh(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) { +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) { +static void draw_undo(Fl_Color c) +{ fl_translate(0.0, 0.2); fl_scale(1.0, -1.0); draw_round_arrow(c, 6); @@ -650,23 +1049,39 @@ static void draw_undo(Fl_Color c) { fl_translate(0.0, -0.2); } -static void draw_redo(Fl_Color c) { +static void draw_redo(Fl_Color c) +{ fl_scale(-1.0, 1.0); draw_undo(c); fl_scale(-1.0, 1.0); } -static void draw_open_box(Fl_Color col) { +static void draw_open_box(Fl_Color col) +{ fl_color(col); BCP; - vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75); - vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0); + vv(-1.0, -1.0); + vv(-0.4, -1.0); + vv(-0.4, -0.75); + vv(-0.75, -0.75); + vv(-0.75, 0.75); + vv(0.75, 0.75); + vv(0.75, 0.4); + vv(1.0, 0.4); + vv(1.0, 1.0); vv(-1.0, 1.0); ECP; set_outline_color(col); BC; - vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75); - vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0); + vv(-1.0, -1.0); + vv(-0.4, -1.0); + vv(-0.4, -0.75); + vv(-0.75, -0.75); + vv(-0.75, 0.75); + vv(0.75, 0.75); + vv(0.75, 0.4); + vv(1.0, 0.4); + vv(1.0, 1.0); vv(-1.0, 1.0); EC; } @@ -678,7 +1093,7 @@ static void draw_import(Fl_Color col) draw_open_box(col); fl_scale(-1.0, 1.0); fl_translate(-0.8, -0.3); - fl_rotate(45.0+90); + fl_rotate(45.0 + 90); draw_round_arrow(col, 3); fl_pop_matrix(); } @@ -693,55 +1108,50 @@ static void draw_export(Fl_Color col) fl_pop_matrix(); } -static void fl_init_symbols(void) { - static char beenhere; - if (beenhere) return; - beenhere = 1; - symbnumb = 0; - - fl_add_symbol("", draw_arrow1, 1); - fl_add_symbol("->", draw_arrow1, 1); - fl_add_symbol(">", draw_arrow2, 1); - fl_add_symbol(">>", draw_arrow3, 1); - fl_add_symbol(">|", draw_arrowbar, 1); - fl_add_symbol(">[]", draw_arrowbox, 1); - fl_add_symbol("|>", draw_bararrow, 1); - fl_add_symbol("<-", draw_arrow01, 1); - fl_add_symbol("<", draw_arrow02, 1); - fl_add_symbol("<<", draw_arrow03, 1); - fl_add_symbol("|<", draw_0arrowbar, 1); - fl_add_symbol("[]<", draw_0arrowbox, 1); - fl_add_symbol("<|", draw_0bararrow, 1); - fl_add_symbol("<->", draw_doublearrow, 1); - fl_add_symbol("-->", draw_arrow, 1); - fl_add_symbol("+", draw_plus, 1); - fl_add_symbol("->|", draw_arrow1bar, 1); - fl_add_symbol("arrow", draw_arrow, 1); - fl_add_symbol("returnarrow", 0, 3); - fl_add_symbol("square", draw_square, 1); - fl_add_symbol("circle", draw_circle, 1); - fl_add_symbol("line", draw_line, 1); - fl_add_symbol("plus", draw_plus, 1); - fl_add_symbol("menu", draw_menu, 1); - 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); - - fl_add_symbol("filenew", draw_filenew, 1); - fl_add_symbol("fileopen", draw_fileopen, 1); - fl_add_symbol("filesave", draw_filesave, 1); - fl_add_symbol("filesaveas", draw_filesaveas, 1); - fl_add_symbol("fileprint", draw_fileprint, 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("import", draw_import, 1); - fl_add_symbol("export", draw_export, 1); - -// fl_add_symbol("file", draw_file, 1); +// clang-format off +static std::unordered_map &symbol_table() { + static std::unordered_map t = { + { "", { draw_arrow1, 1 } }, + { "->", { draw_arrow1, 1 } }, + { ">", { draw_arrow2, 1 } }, + { ">>", { draw_arrow3, 1 } }, + { ">|", { draw_arrowbar, 1 } }, + { ">[]", { draw_arrowbox, 1 } }, + { "|>", { draw_bararrow, 1 } }, + { "<-", { draw_arrow01, 1 } }, + { "<", { draw_arrow02, 1 } }, + { "<<", { draw_arrow03, 1 } }, + { "|<", { draw_0arrowbar, 1 } }, + { "[]<", { draw_0arrowbox, 1 } }, + { "<|", { draw_0bararrow, 1 } }, + { "<->", { draw_doublearrow, 1 } }, + { "-->", { draw_arrow, 1 } }, + { "+", { draw_plus, 1 } }, + { "->|", { draw_arrow1bar, 1 } }, + { "arrow", { draw_arrow, 1 } }, + { "returnarrow", { draw_returnarrow, 0 } }, + { "square", { draw_square, 1 } }, + { "circle", { draw_circle, 1 } }, + { "line", { draw_line, 1 } }, + { "plus", { draw_plus, 1 } }, + { "menu", { draw_menu, 1 } }, + { "UpArrow", { draw_uparrow, 1 } }, + { "DnArrow", { draw_downarrow, 1 } }, + { "||", { draw_doublebar, 1 } }, + { "search", { draw_search, 1 } }, + { "FLTK", { draw_fltk, 1 } }, + { "filenew", { draw_filenew, 1 } }, + { "fileopen", { draw_fileopen, 1 } }, + { "filesave", { draw_filesave, 1 } }, + { "filesaveas", { draw_filesaveas, 1 } }, + { "fileprint", { draw_fileprint, 1 } }, + { "refresh", { draw_refresh, 1 } }, + { "reload", { draw_reload, 1 } }, + { "undo", { draw_undo, 1 } }, + { "redo", { draw_redo, 1 } }, + { "import", { draw_import, 1 } }, + { "export", { draw_export, 1 } }, + }; + return t; } +// clang-format on diff --git a/test/symbols.cxx b/test/symbols.cxx index 9c51e0fb4..1cd1f28ee 100644 --- a/test/symbols.cxx +++ b/test/symbols.cxx @@ -30,29 +30,38 @@ int N = 0; #define ROWS 6 #define COLS 7 -Fl_Double_Window *window; -Fl_Value_Slider *orientation; -Fl_Value_Slider *size; +Fl_Double_Window* window; +Fl_Value_Slider* orientation; +Fl_Value_Slider* size; -void slider_cb(Fl_Widget *, void *) { +void slider_cb(Fl_Widget*, void*) +{ static char buf[80]; 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 = (const char *)(wc->user_data()); - if ( l && *l == '@' ) { // all children with '@' - l ++; - if ( wc->box() == FL_NO_BOX ) { // ascii legend? - if (val&&sze) snprintf(buf, sizeof(buf), "@@%+d%d%s", sze, val, l); - else if (val) snprintf(buf, sizeof(buf), "@@%d%s", val, l); - else if (sze) snprintf(buf, sizeof(buf), "@@%+d%s", sze, l); - else snprintf(buf, sizeof(buf), "@@%s", l); - } else { // box with symbol - if (val&&sze) snprintf(buf, sizeof(buf), "@%+d%d%s", sze, val, l); - else if (val) snprintf(buf, sizeof(buf), "@%d%s", val, l); - else if (sze) snprintf(buf, sizeof(buf), "@%+d%s", sze, l); - else snprintf(buf, sizeof(buf), "@%s", l); + for (int i = window->children(); i--;) { // all window children + Fl_Widget* wc = window->child(i); + const char* l = (const char*)(wc->user_data()); + if (l && *l == '@') { // all children with '@' + l++; + if (wc->box() == FL_NO_BOX) { // ascii legend? + if (val && sze) + snprintf(buf, sizeof(buf), "@@%+d%d%s", sze, val, l); + else if (val) + snprintf(buf, sizeof(buf), "@@%d%s", val, l); + else if (sze) + snprintf(buf, sizeof(buf), "@@%+d%s", sze, l); + else + snprintf(buf, sizeof(buf), "@@%s", l); + } else { // box with symbol + if (val && sze) + snprintf(buf, sizeof(buf), "@%+d%d%s", sze, val, l); + else if (val) + snprintf(buf, sizeof(buf), "@%d%s", val, l); + else if (sze) + snprintf(buf, sizeof(buf), "@%+d%s", sze, l); + else + snprintf(buf, sizeof(buf), "@%s", l); } wc->copy_label(buf); } @@ -60,80 +69,80 @@ void slider_cb(Fl_Widget *, void *) { window->redraw(); } -void bt(const char *name) { - int x = N%COLS; - int y = N/COLS; +void bt(const char* name) +{ + int x = N % COLS; + int y = N / COLS; char buf[255]; N++; - x = x*W+10; - y = y*H+10; + x = x * W + 10; + y = y * H + 10; snprintf(buf, sizeof(buf), "@%s", name); - Fl_Box *a = new Fl_Box(x,y,W-20,H-20); + Fl_Box* a = new Fl_Box(x, y, W - 20, H - 20); a->box(FL_NO_BOX); a->copy_label(buf); a->align(FL_ALIGN_BOTTOM); a->labelsize(11); - a->user_data((void *)name); - Fl_Box *b = new Fl_Box(x,y,W-20,H-20); + a->user_data((void*)name); + Fl_Box* b = new Fl_Box(x, y, W - 20, H - 20); b->box(FL_UP_BOX); b->copy_label(name); b->labelcolor(FL_DARK3); - b->user_data((void *)name); + b->user_data((void*)name); } -int main(int argc, char ** argv) { - window = new Fl_Double_Window(COLS*W,ROWS*H+60); -bt("@->"); -bt("@>"); -bt("@>>"); -bt("@>|"); -bt("@>[]"); -bt("@|>"); -bt("@<-"); -bt("@<"); -bt("@<<"); -bt("@|<"); -bt("@[]<"); -bt("@<|"); -bt("@<->"); -bt("@-->"); -bt("@+"); -bt("@->|"); -bt("@||"); -bt("@arrow"); -bt("@returnarrow"); -bt("@square"); -bt("@circle"); -bt("@line"); -bt("@menu"); -bt("@UpArrow"); -bt("@DnArrow"); -bt("@search"); -bt("@FLTK"); -bt("@filenew"); -bt("@fileopen"); -bt("@filesave"); -bt("@filesaveas"); -bt("@fileprint"); -bt("@refresh"); -bt("@reload"); -bt("@undo"); -bt("@redo"); -bt("@import"); -bt("@export"); +int main(int argc, char** argv) +{ + window = new Fl_Double_Window(COLS * W, ROWS * H + 60); + bt("@->"); + bt("@>"); + bt("@>>"); + bt("@>|"); + bt("@>[]"); + bt("@|>"); + bt("@<-"); + bt("@<"); + bt("@<<"); + bt("@|<"); + bt("@[]<"); + bt("@<|"); + bt("@<->"); + bt("@-->"); + bt("@+"); + bt("@->|"); + bt("@||"); + bt("@arrow"); + bt("@returnarrow"); + bt("@square"); + bt("@circle"); + bt("@line"); + bt("@menu"); + bt("@UpArrow"); + bt("@DnArrow"); + bt("@search"); + bt("@FLTK"); + bt("@filenew"); + bt("@fileopen"); + bt("@filesave"); + bt("@filesaveas"); + bt("@fileprint"); + bt("@refresh"); + bt("@reload"); + bt("@undo"); + bt("@redo"); + bt("@import"); + bt("@export"); - orientation = new Fl_Value_Slider( - (int)(window->w()*.05+.5), window->h()-40, - (int)(window->w()*.42+.5), 16, "Orientation"); + 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 = 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); @@ -141,6 +150,6 @@ bt("@export"); size->callback(slider_cb, 0); window->resizable(window); - window->show(argc,argv); + window->show(argc, argv); return Fl::run(); }