1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
// Symbol test program for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// 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
|
|
|
|
// file is missing or damaged, see the license at:
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2001-10-27 20:38:36 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2002-05-13 09:05:11 +04:00
|
|
|
#include <ctype.h>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl.H>
|
2009-04-21 13:09:37 +04:00
|
|
|
#include <FL/Fl_Double_Window.H>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Box.H>
|
2002-05-13 09:05:11 +04:00
|
|
|
#include <FL/Fl_Value_Slider.H>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/fl_draw.H>
|
|
|
|
|
|
|
|
int N = 0;
|
2002-05-13 09:05:11 +04:00
|
|
|
#define W 70
|
|
|
|
#define H 70
|
2005-06-01 17:41:01 +04:00
|
|
|
#define ROWS 6
|
|
|
|
#define COLS 6
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2009-04-21 13:09:37 +04:00
|
|
|
Fl_Double_Window *window;
|
2004-07-04 10:49:34 +04:00
|
|
|
Fl_Value_Slider *orientation;
|
|
|
|
Fl_Value_Slider *size;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2007-05-20 04:01:06 +04:00
|
|
|
void slider_cb(Fl_Widget *, void *) {
|
2002-05-13 09:05:11 +04:00
|
|
|
static char buf[80];
|
2004-07-04 10:49:34 +04:00
|
|
|
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);
|
2005-04-11 01:53:03 +04:00
|
|
|
const char *l = (const char *)(wc->user_data());
|
|
|
|
if ( l && *l == '@' ) { // all children with '@'
|
|
|
|
l ++;
|
|
|
|
if ( wc->box() == FL_NO_BOX ) { // ascii legend?
|
2004-07-04 10:49:34 +04:00
|
|
|
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);
|
2002-05-13 09:05:11 +04:00
|
|
|
} else { // box with symbol
|
2004-07-04 10:49:34 +04:00
|
|
|
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);
|
2002-05-13 09:05:11 +04:00
|
|
|
}
|
2005-04-11 01:53:03 +04:00
|
|
|
wc->copy_label(buf);
|
2002-05-13 09:05:11 +04:00
|
|
|
}
|
|
|
|
}
|
2004-07-04 10:49:34 +04:00
|
|
|
window->redraw();
|
2002-05-13 09:05:11 +04:00
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
void bt(const char *name) {
|
|
|
|
int x = N%COLS;
|
|
|
|
int y = N/COLS;
|
2001-10-27 20:38:36 +04:00
|
|
|
char buf[255];
|
1998-10-06 22:21:25 +04:00
|
|
|
N++;
|
|
|
|
x = x*W+10;
|
|
|
|
y = y*H+10;
|
2001-10-27 20:38:36 +04:00
|
|
|
sprintf(buf, "@%s", name);
|
2005-04-11 01:53:03 +04:00
|
|
|
Fl_Box *a = new Fl_Box(x,y,W-20,H-20);
|
|
|
|
a->box(FL_NO_BOX);
|
|
|
|
a->copy_label(buf);
|
1998-10-06 22:21:25 +04:00
|
|
|
a->align(FL_ALIGN_BOTTOM);
|
|
|
|
a->labelsize(11);
|
2005-04-11 01:53:03 +04:00
|
|
|
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);
|
1998-10-06 22:21:25 +04:00
|
|
|
b->labelcolor(FL_DARK3);
|
2005-04-11 01:53:03 +04:00
|
|
|
b->user_data((void *)name);
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char ** argv) {
|
2009-04-21 13:09:37 +04:00
|
|
|
window = new Fl_Double_Window(COLS*W,ROWS*H+60);
|
1998-10-06 22:21:25 +04:00
|
|
|
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");
|
2006-06-05 15:59:09 +04:00
|
|
|
bt("@line");
|
1998-10-06 22:21:25 +04:00
|
|
|
bt("@menu");
|
|
|
|
bt("@UpArrow");
|
|
|
|
bt("@DnArrow");
|
2004-07-04 10:49:34 +04:00
|
|
|
bt("@search");
|
|
|
|
bt("@FLTK");
|
2005-04-30 07:02:04 +04:00
|
|
|
bt("@filenew");
|
|
|
|
bt("@fileopen");
|
|
|
|
bt("@filesave");
|
|
|
|
bt("@filesaveas");
|
|
|
|
bt("@fileprint");
|
2005-06-02 00:05:49 +04:00
|
|
|
bt("@refresh");
|
|
|
|
bt("@reload");
|
|
|
|
bt("@undo");
|
|
|
|
bt("@redo");
|
2002-05-13 09:05:11 +04:00
|
|
|
|
2004-07-04 10:49:34 +04:00
|
|
|
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);
|
2002-05-13 09:05:11 +04:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
window->resizable(window);
|
|
|
|
window->show(argc,argv);
|
|
|
|
return Fl::run();
|
|
|
|
}
|