diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /test/colbrowser.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'test/colbrowser.cxx')
| -rw-r--r-- | test/colbrowser.cxx | 92 |
1 files changed, 43 insertions, 49 deletions
diff --git a/test/colbrowser.cxx b/test/colbrowser.cxx index ccec8d60c..bcd1506d7 100644 --- a/test/colbrowser.cxx +++ b/test/colbrowser.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // X Color Browser demo program for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2019 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // @@ -37,7 +35,7 @@ #define MAX_RGB 3000 #define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3)) -#define FL_INDIANRED ((Fl_Color)(164)) +#define FL_INDIANRED ((Fl_Color)(164)) static Fl_Double_Window *cl; @@ -59,9 +57,9 @@ static RGBdb rgbdb[MAX_RGB]; int main(int argc, char *argv[]) { Fl::args(argc, argv); - + create_form_cl(); - + #ifdef __APPLE__ // Bundled apps do not set the current directory strcpy(dbname, argv[0]); @@ -71,19 +69,19 @@ int main(int argc, char *argv[]) #else strcpy(dbname, "rgb.txt"); #endif - + if (load_browser(dbname)) dbobj->label(dbname); else dbobj->label("None"); dbobj->redraw(); - + cl->size_range(cl->w(),cl->h(),2*cl->w(),2*cl->h()); - + cl->label("RGB Browser"); cl->free_position(); cl->show(argc,argv); - + return Fl::run(); } @@ -102,7 +100,7 @@ static void set_entry(int i) static void br_cb(Fl_Widget *ob, long) { int r = ((Fl_Browser *)ob)->value(); - + if (r <= 0) return; set_entry(r - 1); @@ -113,21 +111,21 @@ static int read_entry(FILE * fp, int *r, int *g, int *b, char *name) { int n; char buf[512], *p; - + if (!fgets(buf, sizeof(buf) - 1, fp)) return 0; - + if(buf[0] == '!') { if (fgets(buf,sizeof(buf)-1,fp)==0) { /* ignore */ } } - + if(sscanf(buf, " %d %d %d %n", r, g, b, &n) < 3) return 0; - + p = buf + n; - + /* squeeze out all spaces */ while (*p) { @@ -136,7 +134,7 @@ static int read_entry(FILE * fp, int *r, int *g, int *b, char *name) p++; } *name = 0; - + return (feof(fp) || ferror(fp)) ? 0 : 1; } @@ -152,15 +150,15 @@ static int load_browser(char *fname) fl_alert("%s\n%s\n%s","Load", fname, "Can't open"); return 0; } - + /* read the items */ - + for (; db < dbs && read_entry(fp, &r, &g, &b, name);) { db->r = r; db->g = g; db->b = b; - + /* unique the entries on the fly */ if (lr != r || lg != g || lb != b) { @@ -173,19 +171,19 @@ static int load_browser(char *fname) } } fclose(fp); - + if (db < dbs) - db->r = 1000; /* sentinel */ + db->r = 1000; /* sentinel */ else { db--; db->r = 1000; } - + colbr->topline(1); colbr->select(1,1); set_entry(0); - + return 1; } @@ -195,14 +193,14 @@ static int search_entry(int r, int g, int b) RGBdb *db = rgbdb; int i, j, diffr, diffg, diffb; unsigned int diff, mindiff; - + mindiff = (unsigned int)~0; for (i = j = 0; db->r < 256; db++, i++) { diffr = r - db->r; diffg = g - db->g; diffb = b - db->b; - + #ifdef FL_LINEAR diff = unsigned(3.0 * (FL_abs(r - db->r)) + (5.9 * FL_abs(g - db->g)) + @@ -212,14 +210,14 @@ static int search_entry(int r, int g, int b) 5.9 * (diffg *diffg) + 1.1 * (diffb *diffb)); #endif - + if (mindiff > diff) { mindiff = diff; j = i; } } - + return j; } @@ -228,11 +226,11 @@ static void search_rgb(Fl_Widget *, long) { int r, g, b, i; int top = colbr->topline(); - + r = int(rs->value()); g = int(gs->value()); b = int(bs->value()); - + // fl_freeze_form(cl); Fl::set_color(FL_FREE_COL4, r, g, b); rescol->redraw(); @@ -250,10 +248,10 @@ static void db_cb(Fl_Widget * ob, long) { const char *p = fl_input("Enter New Database Name", dbname); char buf[512]; - + if (!p || strcmp(p, dbname) == 0) return; - + strcpy(buf, p); if (load_browser(buf)) strcpy(dbname, buf); @@ -272,33 +270,33 @@ static void create_form_cl(void) { if (cl) return; - + cl = new Fl_Double_Window(400,385); cl->box(FL_UP_BOX); cl->color(FL_INDIANRED, FL_GRAY); - + Fl_Box *title = new Fl_Box(40, 10, 300, 30, "Color Browser"); title->box(FL_NO_BOX); title->labelcolor(FL_RED); title->labelsize(32); title->labelfont(FL_HELVETICA_BOLD); title->labeltype(FL_SHADOW_LABEL); - + dbobj = new Fl_Button(40, 50, 300, 25, ""); dbobj->type(FL_NORMAL_BUTTON); dbobj->box(FL_BORDER_BOX); dbobj->color(FL_INDIANRED,FL_INDIANRED); dbobj->callback(db_cb, 0); - + colbr = new Fl_Hold_Browser(10, 90, 280, 240, ""); - colbr->textfont(FL_COURIER); + colbr->textfont(FL_COURIER); colbr->callback(br_cb, 0); colbr->box(FL_DOWN_BOX); - + rescol = new Fl_Box(300, 90, 90, 35, ""); rescol->color(FL_FREE_COL4, FL_FREE_COL4); rescol->box(FL_BORDER_BOX); - + rs = new Fl_Value_Slider(300, 130, 30, 200, ""); rs->type(FL_VERT_FILL_SLIDER); rs->color(FL_INDIANRED, FL_RED); @@ -306,7 +304,7 @@ static void create_form_cl(void) rs->precision(0); rs->callback(search_rgb, 0); rs->when(FL_WHEN_RELEASE); - + gs = new Fl_Value_Slider(330, 130, 30, 200, ""); gs->type(FL_VERT_FILL_SLIDER); gs->color(FL_INDIANRED, FL_GREEN); @@ -314,7 +312,7 @@ static void create_form_cl(void) gs->precision(0); gs->callback(search_rgb, 1); gs->when(FL_WHEN_RELEASE); - + bs = new Fl_Value_Slider(360, 130, 30, 200, ""); bs->type(FL_VERT_FILL_SLIDER); bs->color(FL_INDIANRED, FL_BLUE); @@ -322,15 +320,11 @@ static void create_form_cl(void) bs->precision(0); bs->callback(search_rgb, 2); bs->when(FL_WHEN_RELEASE); - + Fl_Button *done = new Fl_Button(160, 345, 80, 30, "Done"); done->type(FL_NORMAL_BUTTON); done->callback(done_cb, 0); - + cl->end(); cl->resizable(cl); } - -// -// End of "$Id$". -// |
