1998-10-20 17:25:25 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
// Symbol test program for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// Copyright 1998-2005 by Bill Spitzak and others.
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.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>
|
|
|
|
#include <FL/Fl_Single_Window.H>
|
|
|
|
#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
|
|
|
|
|
|
|
Fl_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
|
|
|
|
2002-05-24 18:19:19 +04:00
|
|
|
void slider_cb(Fl_Widget *w, 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) {
|
2002-05-13 09:05:11 +04:00
|
|
|
window = new Fl_Single_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();
|
|
|
|
}
|
1998-10-20 17:25:25 +04:00
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|