~ubuntu-branches/ubuntu/karmic/fltk1.1/karmic

« back to all changes in this revision

Viewing changes to test/symbols.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-05-22 13:57:06 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050522135706-mchag24yf42lu7bu
Tags: 1.1.6-5
* Revert previous change, which seems to have been ineffective for some
  reason, in favor of commenting out the problematic Makefile rule
  altogether.  (Closes: #310151.)
* debian/control: Go back to specifying the URL as part of the
  description rather than via a non-standard field that doesn't seem to
  have caught on.  (Closes: #310240.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $"
 
2
// "$Id: symbols.cxx,v 1.4.2.3.2.8 2004/08/09 21:05:45 matthiaswm Exp $"
3
3
//
4
4
// Symbol test program for the Fast Light Tool Kit (FLTK).
5
5
//
36
36
int N = 0;
37
37
#define W 70
38
38
#define H 70
39
 
#define ROWS 5
40
 
#define COLS 5
 
39
#define ROWS 7
 
40
#define COLS 4
41
41
 
42
42
Fl_Window *window;
 
43
Fl_Value_Slider *orientation;
 
44
Fl_Value_Slider *size;
43
45
 
44
46
void slider_cb(Fl_Widget *w, void *) {
45
47
  static char buf[80];
46
 
  int val = (int)(((Fl_Value_Slider*)w)->value());
47
 
  Fl_Window *win = (Fl_Window*)w->parent();       // get parent window
48
 
  for (int i = win->children(); i--; ) {          // all window children
49
 
    Fl_Widget *wc = win->child(i);
 
48
  int val = (int)orientation->value();
 
49
  int sze = (int)size->value();
 
50
  for (int i = window->children(); i--; ) {          // all window children
 
51
    Fl_Widget *wc = window->child(i);
50
52
    const char *l = wc->label();
51
53
    if ( *l == '@' ) {                            // all children with '@'
52
54
      if ( *(++l) == '@' ) {                      // ascii legend?
53
55
        l++;
54
 
        while (isdigit(*l)) { l++; }
55
 
        if (val == 0) { sprintf(buf, "@@%s", l); }
56
 
        else          { sprintf(buf, "@@%d%s", val, l); }
 
56
        while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; }
 
57
        if (val&&sze) sprintf(buf, "@@%+d%d%s", sze, val, l);
 
58
        else if (val) sprintf(buf, "@@%d%s", val, l);
 
59
        else if (sze) sprintf(buf, "@@%+d%s", sze, l);
 
60
        else          sprintf(buf, "@@%s", l);
57
61
      } else {                                    // box with symbol
58
 
        while (isdigit(*l)) { l++; }
59
 
        if (val == 0) { sprintf(buf, "@%s", l); }
60
 
        else          { sprintf(buf, "@%d%s", val, l); }
 
62
        while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; }
 
63
        if (val&&sze) sprintf(buf, "@%+d%d%s", sze, val, l);
 
64
        else if (val) sprintf(buf, "@%d%s", val, l);
 
65
        else if (sze) sprintf(buf, "@%+d%s", sze, l);
 
66
        else          sprintf(buf, "@%s", l);
61
67
      }
62
68
      free((void*)(wc->label()));
63
69
      wc->label(strdup(buf));
64
70
    }
65
71
  }
66
 
  win->redraw();
 
72
  window->redraw();
67
73
}
68
74
 
69
75
void bt(const char *name) {
108
114
bt("@menu");
109
115
bt("@UpArrow");
110
116
bt("@DnArrow");
111
 
 
112
 
  Fl_Value_Slider slider((int)(window->w()*.10+.5),
113
 
                         window->h()-40,
114
 
                         (int)(window->w()*.80+.5),
115
 
                         16,
116
 
                         "Orientation");
117
 
  slider.type(FL_HORIZONTAL);
118
 
  slider.range(0.0, 9.0);
119
 
  slider.value(0.0);
120
 
  slider.step(1);
121
 
  slider.callback(slider_cb, &slider);
 
117
bt("@search");
 
118
bt("@FLTK");
 
119
 
 
120
  orientation = new Fl_Value_Slider(
 
121
    (int)(window->w()*.05+.5), window->h()-40,
 
122
    (int)(window->w()*.42+.5), 16, "Orientation");
 
123
  orientation->type(FL_HORIZONTAL);
 
124
  orientation->range(0.0, 9.0);
 
125
  orientation->value(0.0);
 
126
  orientation->step(1);
 
127
  orientation->callback(slider_cb, 0);
 
128
 
 
129
  size = new Fl_Value_Slider(
 
130
    (int)(window->w()*.53+.5), window->h()-40,
 
131
    (int)(window->w()*.42+.5), 16, "Size");
 
132
  size->type(FL_HORIZONTAL);
 
133
  size->range(-3.0, 9.0);
 
134
  size->value(0.0);
 
135
  size->step(1);
 
136
  size->callback(slider_cb, 0);
122
137
 
123
138
  window->resizable(window);
124
139
  window->show(argc,argv);
126
141
}
127
142
 
128
143
//
129
 
// End of "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $".
 
144
// End of "$Id: symbols.cxx,v 1.4.2.3.2.8 2004/08/09 21:05:45 matthiaswm Exp $".
130
145
//