Move the rest of the image file formats (except for XBM and XPM) to
the fltk_images library; saves about 16k in the FLTK core library on my Intel system. Fix a memory leak bug in most of the fl_set_fonts*.cxx implementations; as a result, the Fl_Fontdesc structure now has a fontname member to old the human-readable font name. Lots of fixes for shadowed variables, etc. Use snprintf, strlcpy, and strlcat in more places. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2566 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
27a54dc22b
commit
a6b935289e
10
CHANGES
10
CHANGES
@ -1,6 +1,16 @@
|
||||
CHANGES IN FLTK 1.1.0
|
||||
|
||||
- Documentation updates.
|
||||
- More snprintf/strlcpy/strlcat changes where needed.
|
||||
- Fl::get_font_name() would leak 128 bytes.
|
||||
- Eliminated most of the "shadowed" variables to avoid
|
||||
potential problems with using the wrong copy of "foo"
|
||||
in a class method.
|
||||
- Moved Fl_BMP_Image, Fl_GIF_Image, and Fl_PNM_Image to
|
||||
the fltk_images library, so the only image formats
|
||||
that are supported by the core library are XBM and XPM
|
||||
files. This reduces the size of the FLTK core library
|
||||
by about 16k...
|
||||
- The Fl_Text_Display::resize() method was incorrectly
|
||||
flagged as protected.
|
||||
- Fixed some memory/initialization bugs in
|
||||
|
8
FL/Fl.H
8
FL/Fl.H
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.H,v 1.8.2.11.2.19 2002/07/30 14:57:02 easysw Exp $"
|
||||
// "$Id: Fl.H,v 1.8.2.11.2.20 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Main header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -69,7 +69,7 @@ public: // should be private!
|
||||
static int compose_state;
|
||||
static int visible_focus_;
|
||||
static int dnd_text_ops_;
|
||||
static void damage(int x) {damage_ = x;}
|
||||
static void damage(int d) {damage_ = d;}
|
||||
|
||||
static void (*idle)();
|
||||
|
||||
@ -237,7 +237,7 @@ public:
|
||||
static int event_button2() {return e_state&FL_BUTTON2;}
|
||||
static int event_button3() {return e_state&FL_BUTTON3;}
|
||||
static void set_idle(void (*cb)()) {idle = cb;}
|
||||
static void grab(Fl_Window&w) {grab(&w);}
|
||||
static void grab(Fl_Window&win) {grab(&win);}
|
||||
static void release() {grab(0);}
|
||||
|
||||
// Visible focus methods...
|
||||
@ -258,5 +258,5 @@ public:
|
||||
#endif // !Fl_H
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.H,v 1.8.2.11.2.19 2002/07/30 14:57:02 easysw Exp $".
|
||||
// End of "$Id: Fl.H,v 1.8.2.11.2.20 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Adjuster.H,v 1.5.2.3.2.1 2002/01/01 15:11:27 easysw Exp $"
|
||||
// "$Id: Fl_Adjuster.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -41,13 +41,13 @@ protected:
|
||||
FL_EXPORT int handle(int);
|
||||
FL_EXPORT void value_damage();
|
||||
public:
|
||||
FL_EXPORT Fl_Adjuster(int x,int y,int w,int h,const char *l=0);
|
||||
FL_EXPORT void soft(int x) {soft_ = x;}
|
||||
FL_EXPORT Fl_Adjuster(int X,int Y,int W,int H,const char *l=0);
|
||||
FL_EXPORT void soft(int s) {soft_ = s;}
|
||||
FL_EXPORT int soft() const {return soft_;}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Adjuster.H,v 1.5.2.3.2.1 2002/01/01 15:11:27 easysw Exp $".
|
||||
// End of "$Id: Fl_Adjuster.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
12
FL/Fl_Box.H
12
FL/Fl_Box.H
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Box.H,v 1.5.2.4.2.2 2002/04/12 20:16:07 easysw Exp $"
|
||||
// "$Id: Fl_Box.H,v 1.5.2.4.2.3 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Box header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -34,10 +34,10 @@ class Fl_Box : public Fl_Widget {
|
||||
protected:
|
||||
FL_EXPORT void draw();
|
||||
public:
|
||||
FL_EXPORT Fl_Box(int x, int y, int w, int h, const char *l=0)
|
||||
: Fl_Widget(x,y,w,h,l) {}
|
||||
FL_EXPORT Fl_Box(Fl_Boxtype b, int x, int y, int w, int h, const char *l)
|
||||
: Fl_Widget(x,y,w,h,l) {box(b);}
|
||||
FL_EXPORT Fl_Box(int X, int Y, int W, int H, const char *l=0)
|
||||
: Fl_Widget(X,Y,W,H,l) {}
|
||||
FL_EXPORT Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Widget(X,Y,W,H,l) {box(b);}
|
||||
|
||||
virtual FL_EXPORT int handle(int);
|
||||
};
|
||||
@ -45,5 +45,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Box.H,v 1.5.2.4.2.2 2002/04/12 20:16:07 easysw Exp $".
|
||||
// End of "$Id: Fl_Box.H,v 1.5.2.4.2.3 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $"
|
||||
// "$Id: Fl_Menu_.H,v 1.7.2.4.2.3 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Menu base class header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -65,7 +65,7 @@ public:
|
||||
FL_EXPORT void replace(int,const char *);
|
||||
FL_EXPORT void remove(int);
|
||||
void shortcut(int i, int s) {menu_[i].shortcut(s);}
|
||||
void mode(int i,int x) {menu_[i].flags = x;}
|
||||
void mode(int i,int fl) {menu_[i].flags = fl;}
|
||||
int mode(int i) const {return menu_[i].flags;}
|
||||
|
||||
const Fl_Menu_Item *mvalue() const {return value_;}
|
||||
@ -93,5 +93,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu_.H,v 1.7.2.4.2.3 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.1 2002/01/01 15:11:27 easysw Exp $"
|
||||
// "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Menu bar header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -33,12 +33,12 @@ protected:
|
||||
FL_EXPORT void draw();
|
||||
public:
|
||||
FL_EXPORT int handle(int);
|
||||
Fl_Menu_Bar(int x,int y,int w,int h,const char *l=0)
|
||||
: Fl_Menu_(x,y,w,h,l) {}
|
||||
Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
|
||||
: Fl_Menu_(X,Y,W,H,l) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.1 2002/01/01 15:11:27 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.8 2002/08/05 17:50:23 easysw Exp $"
|
||||
// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Pixmap header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -50,10 +50,10 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
|
||||
Fl_Offscreen id; // for internal use
|
||||
Fl_Bitmask mask; // for internal use (mask bitmap)
|
||||
|
||||
explicit Fl_Pixmap(char * const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
|
||||
explicit Fl_Pixmap(uchar* const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
|
||||
explicit Fl_Pixmap(const char * const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
|
||||
explicit Fl_Pixmap(const uchar* const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
|
||||
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
virtual ~Fl_Pixmap();
|
||||
virtual Fl_Image *copy(int W, int H);
|
||||
Fl_Image *copy() { return copy(w(), h()); }
|
||||
@ -69,5 +69,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.8 2002/08/05 17:50:23 easysw Exp $".
|
||||
// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Return_Button.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $"
|
||||
// "$Id: Fl_Return_Button.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Return button header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -32,12 +32,12 @@ protected:
|
||||
FL_EXPORT void draw();
|
||||
public:
|
||||
FL_EXPORT int handle(int);
|
||||
Fl_Return_Button(int x,int y,int w,int h,const char *l=0)
|
||||
: Fl_Button(x,y,w,h,l) {}
|
||||
Fl_Return_Button(int X, int Y, int W, int H,const char *l=0)
|
||||
: Fl_Button(X,Y,W,H,l) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Return_Button.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $".
|
||||
// End of "$Id: Fl_Return_Button.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.1 2002/01/01 15:11:28 easysw Exp $"
|
||||
// "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Scroll bar header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -43,8 +43,8 @@ public:
|
||||
FL_EXPORT int handle(int);
|
||||
|
||||
int value() {return int(Fl_Slider::value());}
|
||||
int value(int position, int size, int top, int total) {
|
||||
return scrollvalue(position, size, top, total);
|
||||
int value(int p, int s, int top, int total) {
|
||||
return scrollvalue(p, s, top, total);
|
||||
}
|
||||
int linesize() const {return linesize_;}
|
||||
void linesize(int i) {linesize_ = i;}
|
||||
@ -54,5 +54,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.1 2002/01/01 15:11:28 easysw Exp $".
|
||||
// End of "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Value_Input.H,v 1.5.2.3.2.2 2002/01/01 15:11:28 easysw Exp $"
|
||||
// "$Id: Fl_Value_Input.H,v 1.5.2.3.2.3 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Value input header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -42,7 +42,7 @@ public:
|
||||
FL_EXPORT void resize(int,int,int,int);
|
||||
FL_EXPORT Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
|
||||
|
||||
void soft(char x) {soft_ = x;}
|
||||
void soft(char s) {soft_ = s;}
|
||||
char soft() const {return soft_;}
|
||||
|
||||
Fl_Font textfont() const {return input.textfont();}
|
||||
@ -59,5 +59,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Value_Input.H,v 1.5.2.3.2.2 2002/01/01 15:11:28 easysw Exp $".
|
||||
// End of "$Id: Fl_Value_Input.H,v 1.5.2.3.2.3 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $"
|
||||
// "$Id: Fl_Widget.H,v 1.6.2.4.2.16 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Widget header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -103,7 +103,7 @@ public:
|
||||
FL_EXPORT virtual void draw() = 0;
|
||||
FL_EXPORT virtual int handle(int);
|
||||
Fl_Group* parent() const {return parent_;}
|
||||
void parent(Fl_Group* w) {parent_ = w;} // for hacks only, Fl_Group::add()
|
||||
void parent(Fl_Group* p) {parent_ = p;} // for hacks only, Fl_Group::add()
|
||||
|
||||
uchar type() const {return type_;}
|
||||
void type(uchar t) {type_ = t;}
|
||||
@ -195,7 +195,7 @@ public:
|
||||
FL_EXPORT void damage(uchar c);
|
||||
FL_EXPORT void damage(uchar c,int,int,int,int);
|
||||
FL_EXPORT void draw_label(int, int, int, int, Fl_Align) const;
|
||||
void measure_label(int& x, int& y) {label_.measure(x,y);}
|
||||
void measure_label(int& xx, int& yy) {label_.measure(xx,yy);}
|
||||
|
||||
FL_EXPORT Fl_Window* window() const ;
|
||||
|
||||
@ -212,5 +212,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $".
|
||||
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.16 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
10
FL/x.H
10
FL/x.H
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: x.H,v 1.10.2.8.2.9 2002/04/15 12:19:01 easysw Exp $"
|
||||
// "$Id: x.H,v 1.10.2.8.2.10 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// X11 header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -114,15 +114,15 @@ public:
|
||||
char wait_for_expose;
|
||||
char backbuffer_bad; // used for XDBE
|
||||
static FL_EXPORT Fl_X* first;
|
||||
static FL_EXPORT Fl_X* i(const Fl_Window* w) {return w->i;}
|
||||
static FL_EXPORT Fl_X* i(const Fl_Window* wi) {return wi->i;}
|
||||
FL_EXPORT void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
||||
FL_EXPORT void sendxjunk();
|
||||
static FL_EXPORT void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
||||
static FL_EXPORT Fl_X* set_xid(Fl_Window*, Window);
|
||||
// kludges to get around protection:
|
||||
FL_EXPORT void flush() {w->flush();}
|
||||
static FL_EXPORT void x(Fl_Window* w, int X) {w->x(X);}
|
||||
static FL_EXPORT void y(Fl_Window* w, int Y) {w->y(Y);}
|
||||
static FL_EXPORT void x(Fl_Window* wi, int X) {wi->x(X);}
|
||||
static FL_EXPORT void y(Fl_Window* wi, int Y) {wi->y(Y);}
|
||||
};
|
||||
|
||||
// convert xid <-> Fl_Window:
|
||||
@ -138,5 +138,5 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: x.H,v 1.10.2.8.2.9 2002/04/15 12:19:01 easysw Exp $".
|
||||
// End of "$Id: x.H,v 1.10.2.8.2.10 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,7 +1,7 @@
|
||||
dnl -*- sh -*-
|
||||
dnl the "configure" script is made from this by running GNU "autoconf"
|
||||
dnl
|
||||
dnl "$Id: configure.in,v 1.33.2.31.2.82 2002/08/05 17:50:21 easysw Exp $"
|
||||
dnl "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $"
|
||||
dnl
|
||||
dnl Configuration script for the Fast Light Tool Kit (FLTK).
|
||||
dnl
|
||||
@ -615,7 +615,7 @@ if test -n "$GCC"; then
|
||||
CXX="$CC"
|
||||
|
||||
# Show all warnings when compiling...
|
||||
OPTIM="-Wall $OPTIM"
|
||||
OPTIM="-Wall -Wshadow -Wconversion -Winline $OPTIM"
|
||||
|
||||
# Set the default compiler optimizations...
|
||||
if test -z "$DEBUGFLAG"; then
|
||||
@ -782,5 +782,5 @@ dnl Make sure the fltk-config script is executable...
|
||||
chmod +x fltk-config
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: configure.in,v 1.33.2.31.2.82 2002/08/05 17:50:21 easysw Exp $".
|
||||
dnl End of "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $".
|
||||
dnl
|
||||
|
240
src/Fl.cxx
240
src/Fl.cxx
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.cxx,v 1.24.2.41.2.43 2002/07/23 15:07:33 easysw Exp $"
|
||||
// "$Id: Fl.cxx,v 1.24.2.41.2.44 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -73,10 +73,10 @@ Fl::version() {
|
||||
// the given rectangle.
|
||||
//
|
||||
|
||||
int Fl::event_inside(int x,int y,int w,int h) /*const*/ {
|
||||
int mx = e_x - x;
|
||||
int my = e_y - y;
|
||||
return (mx >= 0 && mx < w && my >= 0 && my < h);
|
||||
int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
|
||||
int mx = e_x - xx;
|
||||
int my = e_y - yy;
|
||||
return (mx >= 0 && mx < ww && my >= 0 && my < hh);
|
||||
}
|
||||
|
||||
int Fl::event_inside(const Fl_Widget *o) /*const*/ {
|
||||
@ -135,19 +135,19 @@ static void elapse_timeouts() {
|
||||
// time interval:
|
||||
static double missed_timeout_by;
|
||||
|
||||
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *arg) {
|
||||
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
||||
elapse_timeouts();
|
||||
repeat_timeout(time, cb, arg);
|
||||
repeat_timeout(time, cb, argp);
|
||||
}
|
||||
|
||||
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *arg) {
|
||||
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
||||
time += missed_timeout_by; if (time < -.05) time = 0;
|
||||
Timeout* t = free_timeout;
|
||||
if (t) free_timeout = t->next;
|
||||
else t = new Timeout;
|
||||
t->time = time;
|
||||
t->cb = cb;
|
||||
t->arg = arg;
|
||||
t->arg = argp;
|
||||
// insert-sort the new timeout:
|
||||
Timeout** p = &first_timeout;
|
||||
while (*p && (*p)->time <= time) p = &((*p)->next);
|
||||
@ -155,18 +155,18 @@ void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *arg) {
|
||||
*p = t;
|
||||
}
|
||||
|
||||
int Fl::has_timeout(Fl_Timeout_Handler cb, void *arg) {
|
||||
int Fl::has_timeout(Fl_Timeout_Handler cb, void *argp) {
|
||||
for (Timeout* t = first_timeout; t; t = t->next)
|
||||
if (t->cb == cb && t->arg == arg) return 1;
|
||||
if (t->cb == cb && t->arg == argp) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Fl::remove_timeout(Fl_Timeout_Handler cb, void *arg) {
|
||||
void Fl::remove_timeout(Fl_Timeout_Handler cb, void *argp) {
|
||||
// This version removes all matching timeouts, not just the first one.
|
||||
// This may change in the future.
|
||||
for (Timeout** p = &first_timeout; *p;) {
|
||||
Timeout* t = *p;
|
||||
if (t->cb == cb && (t->arg == arg || !arg)) {
|
||||
if (t->cb == cb && (t->arg == argp || !argp)) {
|
||||
*p = t->next;
|
||||
t->next = free_timeout;
|
||||
free_timeout = t;
|
||||
@ -191,21 +191,21 @@ struct Check {
|
||||
};
|
||||
static Check* first_check, *next_check, *free_check;
|
||||
|
||||
void Fl::add_check(Fl_Timeout_Handler cb, void *arg) {
|
||||
void Fl::add_check(Fl_Timeout_Handler cb, void *argp) {
|
||||
Check* t = free_check;
|
||||
if (t) free_check = t->next;
|
||||
else t = new Check;
|
||||
t->cb = cb;
|
||||
t->arg = arg;
|
||||
t->arg = argp;
|
||||
t->next = first_check;
|
||||
if (next_check == first_check) next_check = t;
|
||||
first_check = t;
|
||||
}
|
||||
|
||||
void Fl::remove_check(Fl_Timeout_Handler cb, void *arg) {
|
||||
void Fl::remove_check(Fl_Timeout_Handler cb, void *argp) {
|
||||
for (Check** p = &first_check; *p;) {
|
||||
Check* t = *p;
|
||||
if (t->cb == cb && t->arg == arg) {
|
||||
if (t->cb == cb && t->arg == argp) {
|
||||
if (next_check == t) next_check = t->next;
|
||||
*p = t->next;
|
||||
t->next = free_check;
|
||||
@ -235,12 +235,12 @@ double Fl::wait(double time_to_wait) {
|
||||
missed_timeout_by = t->time;
|
||||
// We must remove timeout from array before doing the callback:
|
||||
void (*cb)(void*) = t->cb;
|
||||
void *arg = t->arg;
|
||||
void *argp = t->arg;
|
||||
first_timeout = t->next;
|
||||
t->next = free_timeout;
|
||||
free_timeout = t;
|
||||
// Now it is safe for the callback to do add_timeout:
|
||||
cb(arg);
|
||||
cb(argp);
|
||||
}
|
||||
} else {
|
||||
reset_clock = 1; // we are not going to check the clock
|
||||
@ -249,9 +249,9 @@ double Fl::wait(double time_to_wait) {
|
||||
// from inside them without causing an infinite loop:
|
||||
if (next_check == first_check) {
|
||||
while (next_check) {
|
||||
Check* check = next_check;
|
||||
next_check = check->next;
|
||||
(check->cb)(check->arg);
|
||||
Check* checkp = next_check;
|
||||
next_check = checkp->next;
|
||||
(checkp->cb)(checkp->arg);
|
||||
}
|
||||
next_check = first_check;
|
||||
}
|
||||
@ -329,13 +329,13 @@ Fl_Window* fl_find(Window xid) {
|
||||
}
|
||||
|
||||
Fl_Window* Fl::first_window() {
|
||||
Fl_X* x = Fl_X::first;
|
||||
return x ? x->w : 0;
|
||||
Fl_X* i = Fl_X::first;
|
||||
return i ? i->w : 0;
|
||||
}
|
||||
|
||||
Fl_Window* Fl::next_window(const Fl_Window* w) {
|
||||
Fl_X* x = Fl_X::i(w)->next;
|
||||
return x ? x->w : 0;
|
||||
Fl_Window* Fl::next_window(const Fl_Window* window) {
|
||||
Fl_X* i = Fl_X::i(window)->next;
|
||||
return i ? i->w : 0;
|
||||
}
|
||||
|
||||
void Fl::first_window(Fl_Window* window) {
|
||||
@ -344,19 +344,19 @@ void Fl::first_window(Fl_Window* window) {
|
||||
}
|
||||
|
||||
void Fl::redraw() {
|
||||
for (Fl_X* x = Fl_X::first; x; x = x->next) x->w->redraw();
|
||||
for (Fl_X* i = Fl_X::first; i; i = i->next) i->w->redraw();
|
||||
}
|
||||
|
||||
void Fl::flush() {
|
||||
if (damage()) {
|
||||
damage_ = 0;
|
||||
for (Fl_X* x = Fl_X::first; x; x = x->next) {
|
||||
if (x->wait_for_expose) {damage_ = 1; continue;}
|
||||
Fl_Window* w = x->w;
|
||||
if (!w->visible_r()) continue;
|
||||
if (w->damage()) {x->flush(); w->clear_damage();}
|
||||
for (Fl_X* i = Fl_X::first; i; i = i->next) {
|
||||
if (i->wait_for_expose) {damage_ = 1; continue;}
|
||||
Fl_Window* wi = i->w;
|
||||
if (!wi->visible_r()) continue;
|
||||
if (wi->damage()) {i->flush(); wi->clear_damage();}
|
||||
// destroy damage regions for windows that don't use them:
|
||||
if (x->region) {XDestroyRegion(x->region); x->region = 0;}
|
||||
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,18 +383,18 @@ struct handler_link {
|
||||
|
||||
static handler_link *handlers = 0;
|
||||
|
||||
void Fl::add_handler(int (*h)(int)) {
|
||||
void Fl::add_handler(int (*ha)(int)) {
|
||||
handler_link *l = new handler_link;
|
||||
l->handle = h;
|
||||
l->handle = ha;
|
||||
l->next = handlers;
|
||||
handlers = l;
|
||||
}
|
||||
|
||||
void Fl::remove_handler(int (*h)(int)) {
|
||||
void Fl::remove_handler(int (*ha)(int)) {
|
||||
handler_link *l, *p;
|
||||
|
||||
// Search for the handler in the list...
|
||||
for (l = handlers, p = 0; l && l->handle != h; p = l, l = l->next);
|
||||
for (l = handlers, p = 0; l && l->handle != ha; p = l, l = l->next);
|
||||
|
||||
if (l) {
|
||||
// Found it, so remove it from the list...
|
||||
@ -408,9 +408,9 @@ void Fl::remove_handler(int (*h)(int)) {
|
||||
|
||||
int (*fl_local_grab)(int); // used by fl_dnd.cxx
|
||||
|
||||
static int send_handlers(int event) {
|
||||
for (const handler_link *h = handlers; h; h = h->next)
|
||||
if (h->handle(event)) return 1;
|
||||
static int send_handlers(int e) {
|
||||
for (const handler_link *hl = handlers; hl; hl = hl->next)
|
||||
if (hl->handle(e)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -550,18 +550,18 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Fl::handle(int event, Fl_Window* window)
|
||||
int Fl::handle(int e, Fl_Window* window)
|
||||
{
|
||||
e_number = event;
|
||||
if (fl_local_grab) return fl_local_grab(event);
|
||||
e_number = e;
|
||||
if (fl_local_grab) return fl_local_grab(e);
|
||||
|
||||
Fl_Widget* w = window;
|
||||
Fl_Widget* wi = window;
|
||||
|
||||
switch (event) {
|
||||
switch (e) {
|
||||
|
||||
case FL_CLOSE:
|
||||
if (grab() || modal() && window != modal()) return 0;
|
||||
w->do_callback();
|
||||
wi->do_callback();
|
||||
return 1;
|
||||
|
||||
case FL_SHOW:
|
||||
@ -574,10 +574,10 @@ int Fl::handle(int event, Fl_Window* window)
|
||||
|
||||
case FL_PUSH:
|
||||
Fl_Tooltip::enter((Fl_Widget*)0);
|
||||
if (grab()) w = grab();
|
||||
else if (modal() && w != modal()) return 0;
|
||||
pushed_ = w;
|
||||
if (send(event, w, window)) return 1;
|
||||
if (grab()) wi = grab();
|
||||
else if (modal() && wi != modal()) return 0;
|
||||
pushed_ = wi;
|
||||
if (send(e, wi, window)) return 1;
|
||||
// raise windows that are clicked on:
|
||||
window->show();
|
||||
return 1;
|
||||
@ -594,32 +594,32 @@ int Fl::handle(int event, Fl_Window* window)
|
||||
return 1;
|
||||
|
||||
case FL_DND_RELEASE:
|
||||
w = belowmouse();
|
||||
wi = belowmouse();
|
||||
break;
|
||||
|
||||
case FL_MOVE:
|
||||
case FL_DRAG:
|
||||
fl_xmousewin = window; // this should already be set, but just in case.
|
||||
if (pushed()) {
|
||||
w = pushed();
|
||||
if (grab()) w = grab();
|
||||
e_number = event = FL_DRAG;
|
||||
wi = pushed();
|
||||
if (grab()) wi = grab();
|
||||
e_number = e = FL_DRAG;
|
||||
break;
|
||||
}
|
||||
if (modal() && w != modal()) w = 0;
|
||||
if (grab()) w = grab();
|
||||
if (modal() && wi != modal()) wi = 0;
|
||||
if (grab()) wi = grab();
|
||||
{Fl_Widget* pbm = belowmouse();
|
||||
int ret = (w && send(event, w, window));
|
||||
int ret = (wi && send(e, wi, window));
|
||||
if (pbm != belowmouse()) Fl_Tooltip::enter(belowmouse());
|
||||
return ret;}
|
||||
|
||||
case FL_RELEASE: {
|
||||
if (pushed()) {
|
||||
w = pushed();
|
||||
wi = pushed();
|
||||
pushed_ = 0; // must be zero before callback is done!
|
||||
}
|
||||
if (grab()) w = grab();
|
||||
int r = send(event, w, window);
|
||||
if (grab()) wi = grab();
|
||||
int r = send(e, wi, window);
|
||||
fl_fix_focus();
|
||||
return r;}
|
||||
|
||||
@ -636,8 +636,8 @@ int Fl::handle(int event, Fl_Window* window)
|
||||
fl_xfocus = window; // this should not happen! But maybe it does:
|
||||
|
||||
// Try it as keystroke, sending it to focus and all parents:
|
||||
for (w = grab() ? grab() : focus(); w; w = w->parent())
|
||||
if (send(FL_KEYBOARD, w, window)) return 1;
|
||||
for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
|
||||
if (send(FL_KEYBOARD, wi, window)) return 1;
|
||||
|
||||
// recursive call to try shortcut:
|
||||
if (handle(FL_SHORTCUT, window)) return 1;
|
||||
@ -647,22 +647,22 @@ int Fl::handle(int event, Fl_Window* window)
|
||||
{char* c = (char*)event_text(); // cast away const
|
||||
if (!isalpha(*c)) return 0;
|
||||
*c = isupper(*c) ? tolower(*c) : toupper(*c);}
|
||||
e_number = event = FL_SHORTCUT;
|
||||
e_number = e = FL_SHORTCUT;
|
||||
|
||||
case FL_SHORTCUT:
|
||||
if (grab()) {w = grab(); break;} // send it to grab window
|
||||
if (grab()) {wi = grab(); break;} // send it to grab window
|
||||
|
||||
// Try it as shortcut, sending to mouse widget and all parents:
|
||||
w = belowmouse(); if (!w) {w = modal(); if (!w) w = window;}
|
||||
for (; w; w = w->parent()) if (send(FL_SHORTCUT, w, window)) return 1;
|
||||
wi = belowmouse(); if (!wi) {wi = modal(); if (!wi) wi = window;}
|
||||
for (; wi; wi = wi->parent()) if (send(FL_SHORTCUT, wi, window)) return 1;
|
||||
|
||||
// try using add_handle() functions:
|
||||
if (send_handlers(FL_SHORTCUT)) return 1;
|
||||
|
||||
// make Escape key close windows:
|
||||
if (event_key()==FL_Escape) {
|
||||
w = modal(); if (!w) w = window;
|
||||
w->do_callback();
|
||||
wi = modal(); if (!wi) wi = window;
|
||||
wi->do_callback();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -682,17 +682,17 @@ int Fl::handle(int event, Fl_Window* window)
|
||||
fl_xfocus = window; // this should not happen! But maybe it does:
|
||||
|
||||
// Try it as keystroke, sending it to focus and all parents:
|
||||
for (w = grab() ? grab() : focus(); w; w = w->parent())
|
||||
if (send(FL_MOUSEWHEEL, w, window)) return 1;
|
||||
for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
|
||||
if (send(FL_MOUSEWHEEL, wi, window)) return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (w && send(event, w, window)) {
|
||||
if (wi && send(e, wi, window)) {
|
||||
dnd_flag = 0;
|
||||
return 1;
|
||||
}
|
||||
dnd_flag = 0;
|
||||
return send_handlers(event);
|
||||
return send_handlers(e);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@ -708,10 +708,10 @@ void Fl_Window::hide() {
|
||||
if (!shown()) return;
|
||||
|
||||
// remove from the list of windows:
|
||||
Fl_X* x = i;
|
||||
Fl_X* ip = i;
|
||||
Fl_X** pp = &Fl_X::first;
|
||||
for (; *pp != x; pp = &(*pp)->next) if (!*pp) return;
|
||||
*pp = x->next;
|
||||
for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
|
||||
*pp = ip->next;
|
||||
|
||||
#ifdef __APPLE__
|
||||
// remove all childwindow links
|
||||
@ -725,20 +725,20 @@ void Fl_Window::hide() {
|
||||
i = 0;
|
||||
|
||||
// recursively remove any subwindows:
|
||||
for (Fl_X *w = Fl_X::first; w;) {
|
||||
Fl_Window* W = w->w;
|
||||
for (Fl_X *wi = Fl_X::first; wi;) {
|
||||
Fl_Window* W = wi->w;
|
||||
if (W->window() == this) {
|
||||
W->hide();
|
||||
W->set_visible();
|
||||
w = Fl_X::first;
|
||||
} else w = w->next;
|
||||
wi = Fl_X::first;
|
||||
} else wi = wi->next;
|
||||
}
|
||||
|
||||
if (this == Fl::modal_) { // we are closing the modal window, find next one:
|
||||
Fl_Window* w;
|
||||
for (w = Fl::first_window(); w; w = Fl::next_window(w))
|
||||
if (w->modal()) break;
|
||||
Fl::modal_ = w;
|
||||
Fl_Window* W;
|
||||
for (W = Fl::first_window(); W; W = Fl::next_window(W))
|
||||
if (W->modal()) break;
|
||||
Fl::modal_ = W;
|
||||
}
|
||||
|
||||
// Make sure no events are sent to this window:
|
||||
@ -746,31 +746,31 @@ void Fl_Window::hide() {
|
||||
handle(FL_HIDE);
|
||||
|
||||
#ifdef WIN32
|
||||
if (x->private_dc) ReleaseDC(x->xid,x->private_dc);
|
||||
if (x->xid == fl_window && fl_gc) {
|
||||
if (ip->private_dc) ReleaseDC(ip->xid,ip->private_dc);
|
||||
if (ip->xid == fl_window && fl_gc) {
|
||||
ReleaseDC(fl_window, fl_gc);
|
||||
fl_window = (HWND)-1;
|
||||
fl_gc = 0;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
if ( x->xid == fl_window )
|
||||
if ( ip->xid == fl_window )
|
||||
fl_window = 0;
|
||||
#else
|
||||
if (x->region) XDestroyRegion(x->region);
|
||||
if (ip->region) XDestroyRegion(ip->region);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
if ( !parent() ) // don't destroy shared windows!
|
||||
{
|
||||
//+ RemoveTrackingHandler( dndTrackingHandler, x->xid );
|
||||
//+ RemoveReceiveHandler( dndReceiveHandler, x->xid );
|
||||
XDestroyWindow(fl_display, x->xid);
|
||||
//+ RemoveTrackingHandler( dndTrackingHandler, ip->xid );
|
||||
//+ RemoveReceiveHandler( dndReceiveHandler, ip->xid );
|
||||
XDestroyWindow(fl_display, ip->xid);
|
||||
}
|
||||
#else
|
||||
# if USE_XFT
|
||||
fl_destroy_xft_draw(x->xid);
|
||||
fl_destroy_xft_draw(ip->xid);
|
||||
# endif
|
||||
XDestroyWindow(fl_display, x->xid);
|
||||
XDestroyWindow(fl_display, ip->xid);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
@ -778,7 +778,7 @@ void Fl_Window::hide() {
|
||||
if (non_modal() && Fl::first_window() && Fl::first_window()->shown())
|
||||
Fl::first_window()->show();
|
||||
#endif
|
||||
delete x;
|
||||
delete ip;
|
||||
|
||||
// Hide any visible tooltips...
|
||||
//Fl_Tooltip::enter(0);
|
||||
@ -796,9 +796,9 @@ Fl_Window::~Fl_Window() {
|
||||
// Fl_Window::show() or Fl_Window::hide() is called, or in response to
|
||||
// iconize/deiconize events from the system.
|
||||
|
||||
int Fl_Window::handle(int event)
|
||||
int Fl_Window::handle(int ev)
|
||||
{
|
||||
if (parent()) switch (event) {
|
||||
if (parent()) switch (ev) {
|
||||
case FL_SHOW:
|
||||
if (!shown()) show();
|
||||
else XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
|
||||
@ -821,7 +821,7 @@ int Fl_Window::handle(int event)
|
||||
break;
|
||||
}
|
||||
|
||||
return Fl_Group::handle(event);
|
||||
return Fl_Group::handle(ev);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@ -862,58 +862,58 @@ void Fl_Widget::redraw() {
|
||||
label_.measure(W, H);
|
||||
|
||||
if (align() & FL_ALIGN_BOTTOM) {
|
||||
window()->damage(FL_DAMAGE_ALL, x(), y() + h(), w(), H);
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H);
|
||||
} else if (align() & FL_ALIGN_TOP) {
|
||||
window()->damage(FL_DAMAGE_ALL, x(), y() - H, w(), H);
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H);
|
||||
} else if (align() & FL_ALIGN_LEFT) {
|
||||
window()->damage(FL_DAMAGE_ALL, x() - W, y(), W, h());
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h());
|
||||
} else if (align() & FL_ALIGN_RIGHT) {
|
||||
window()->damage(FL_DAMAGE_ALL, x() + w(), y(), W, h());
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Widget::damage(uchar flags) {
|
||||
void Fl_Widget::damage(uchar fl) {
|
||||
if (type() < FL_WINDOW) {
|
||||
// damage only the rectangle covered by a child widget:
|
||||
damage(flags, x(), y(), w(), h());
|
||||
damage(fl, x(), y(), w(), h());
|
||||
} else {
|
||||
// damage entire window by deleting the region:
|
||||
Fl_X* i = Fl_X::i((Fl_Window*)this);
|
||||
if (!i) return; // window not mapped, so ignore it
|
||||
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
|
||||
damage_ |= flags;
|
||||
damage_ |= fl;
|
||||
Fl::damage(FL_DAMAGE_CHILD);
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
||||
Fl_Widget* window = this;
|
||||
void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
|
||||
Fl_Widget* wi = this;
|
||||
// mark all parent widgets between this and window with FL_DAMAGE_CHILD:
|
||||
while (window->type() < FL_WINDOW) {
|
||||
window->damage_ |= flags;
|
||||
window = window->parent();
|
||||
if (!window) return;
|
||||
flags = FL_DAMAGE_CHILD;
|
||||
while (wi->type() < FL_WINDOW) {
|
||||
wi->damage_ |= fl;
|
||||
wi = wi->parent();
|
||||
if (!wi) return;
|
||||
fl = FL_DAMAGE_CHILD;
|
||||
}
|
||||
Fl_X* i = Fl_X::i((Fl_Window*)window);
|
||||
Fl_X* i = Fl_X::i((Fl_Window*)wi);
|
||||
if (!i) return; // window not mapped, so ignore it
|
||||
|
||||
if (X<=0 && Y<=0 && W>=window->w() && H>=window->h()) {
|
||||
if (X<=0 && Y<=0 && W>=wi->w() && H>=wi->h()) {
|
||||
// if damage covers entire window delete region:
|
||||
window->damage(flags);
|
||||
wi->damage(fl);
|
||||
return;
|
||||
}
|
||||
|
||||
// clip the damage to the window and quit if none:
|
||||
if (X < 0) {W += X; X = 0;}
|
||||
if (Y < 0) {H += Y; Y = 0;}
|
||||
if (W > window->w()-X) W = window->w()-X;
|
||||
if (H > window->h()-Y) H = window->h()-Y;
|
||||
if (W > wi->w()-X) W = wi->w()-X;
|
||||
if (H > wi->h()-Y) H = wi->h()-Y;
|
||||
if (W <= 0 || H <= 0) return;
|
||||
|
||||
if (window->damage()) {
|
||||
if (wi->damage()) {
|
||||
// if we already have damage we must merge with existing region:
|
||||
if (i->region) {
|
||||
#ifdef WIN32
|
||||
@ -931,12 +931,12 @@ void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
||||
XUnionRectWithRegion(&R, i->region, i->region);
|
||||
#endif
|
||||
}
|
||||
window->damage_ |= flags;
|
||||
wi->damage_ |= fl;
|
||||
} else {
|
||||
// create a new region:
|
||||
if (i->region) XDestroyRegion(i->region);
|
||||
i->region = XRectangleRegion(X,Y,W,H);
|
||||
window->damage_ = flags;
|
||||
wi->damage_ = fl;
|
||||
}
|
||||
Fl::damage(FL_DAMAGE_CHILD);
|
||||
}
|
||||
@ -949,5 +949,5 @@ void Fl_Window::flush() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.43 2002/07/23 15:07:33 easysw Exp $".
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.44 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.7 2002/05/24 14:19:19 easysw Exp $"
|
||||
// "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.8 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Adjuster widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -155,8 +155,8 @@ int Fl_Adjuster::handle(int event) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Fl_Adjuster::Fl_Adjuster(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Valuator(x, y, w, h, l) {
|
||||
Fl_Adjuster::Fl_Adjuster(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Valuator(X, Y, W, H, l) {
|
||||
box(FL_UP_BOX);
|
||||
step(1, 10000);
|
||||
selection_color(FL_BLACK);
|
||||
@ -165,5 +165,5 @@ Fl_Adjuster::Fl_Adjuster(int x, int y, int w, int h, const char* l)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.7 2002/05/24 14:19:19 easysw Exp $".
|
||||
// End of "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.8 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_BMP_Image.cxx,v 1.1.2.8 2002/07/26 14:22:02 easysw Exp $"
|
||||
// "$Id: Fl_BMP_Image.cxx,v 1.1.2.9 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Fl_BMP_Image routines.
|
||||
//
|
||||
@ -72,7 +72,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
colors_used, // Number of colors used
|
||||
x, y, // Looping vars
|
||||
color, // Color of RLE pixel
|
||||
count, // Number of times to repeat
|
||||
repcount, // Number of times to repeat
|
||||
temp, // Temporary color
|
||||
align; // Alignment bytes
|
||||
long offbits; // Offset to image data
|
||||
@ -111,7 +111,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
compression = BI_RGB;
|
||||
colors_used = 0;
|
||||
|
||||
count = info_size - 12;
|
||||
repcount = info_size - 12;
|
||||
} else {
|
||||
// New BMP header...
|
||||
w(read_long(fp));
|
||||
@ -125,16 +125,16 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
colors_used = read_dword(fp);
|
||||
read_dword(fp);
|
||||
|
||||
count = info_size - 40;
|
||||
repcount = info_size - 40;
|
||||
}
|
||||
|
||||
// printf("w() = %d, h() = %d, depth = %d, compression = %d, colors_used = %d, count = %d\n",
|
||||
// w(), h(), depth, compression, colors_used, count);
|
||||
// printf("w() = %d, h() = %d, depth = %d, compression = %d, colors_used = %d, repcount = %d\n",
|
||||
// w(), h(), depth, compression, colors_used, repcount);
|
||||
|
||||
// Skip remaining header bytes...
|
||||
while (count > 0) {
|
||||
while (repcount > 0) {
|
||||
getc(fp);
|
||||
count --;
|
||||
repcount --;
|
||||
}
|
||||
|
||||
// Check header data...
|
||||
@ -147,9 +147,9 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
if (colors_used == 0 && depth <= 8)
|
||||
colors_used = 1 << depth;
|
||||
|
||||
for (count = 0; count < colors_used; count ++) {
|
||||
for (repcount = 0; repcount < colors_used; repcount ++) {
|
||||
// Read BGR color...
|
||||
fread(colormap[count], 1, 3, fp);
|
||||
fread(colormap[repcount], 1, 3, fp);
|
||||
|
||||
// Skip pad byte for new BMP files...
|
||||
if (info_size > 12) getc(fp);
|
||||
@ -164,7 +164,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
|
||||
// Read the image data...
|
||||
color = 0;
|
||||
count = 0;
|
||||
repcount = 0;
|
||||
align = 0;
|
||||
byte = 0;
|
||||
temp = 0;
|
||||
@ -202,10 +202,10 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
|
||||
case 4 : // 16-color
|
||||
for (x = w(), bit = 0xf0; x > 0; x --) {
|
||||
// Get a new count as needed...
|
||||
if (count == 0) {
|
||||
// Get a new repcount as needed...
|
||||
if (repcount == 0) {
|
||||
if (compression != BI_RLE4) {
|
||||
count = 2;
|
||||
repcount = 2;
|
||||
color = -1;
|
||||
} else {
|
||||
while (align > 0) {
|
||||
@ -213,22 +213,22 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
getc(fp);
|
||||
}
|
||||
|
||||
if ((count = getc(fp)) == 0) {
|
||||
if ((count = getc(fp)) == 0) {
|
||||
if ((repcount = getc(fp)) == 0) {
|
||||
if ((repcount = getc(fp)) == 0) {
|
||||
// End of line...
|
||||
x ++;
|
||||
continue;
|
||||
} else if (count == 1) {
|
||||
} else if (repcount == 1) {
|
||||
// End of image...
|
||||
break;
|
||||
} else if (count == 2) {
|
||||
} else if (repcount == 2) {
|
||||
// Delta...
|
||||
count = getc(fp) * getc(fp) * w();
|
||||
repcount = getc(fp) * getc(fp) * w();
|
||||
color = 0;
|
||||
} else {
|
||||
// Absolute...
|
||||
color = -1;
|
||||
align = ((4 - (count & 3)) / 2) & 1;
|
||||
align = ((4 - (repcount & 3)) / 2) & 1;
|
||||
}
|
||||
} else {
|
||||
color = getc(fp);
|
||||
@ -237,7 +237,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
}
|
||||
|
||||
// Get a new color as needed...
|
||||
count --;
|
||||
repcount --;
|
||||
|
||||
// Get the next color byte as needed...
|
||||
if (color < 0) color = getc(fp);
|
||||
@ -269,34 +269,34 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
|
||||
case 8 : // 256-color
|
||||
for (x = w(); x > 0; x --) {
|
||||
// Get a new count as needed...
|
||||
// Get a new repcount as needed...
|
||||
if (compression != BI_RLE8) {
|
||||
count = 1;
|
||||
repcount = 1;
|
||||
color = -1;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
if (repcount == 0) {
|
||||
while (align > 0) {
|
||||
align --;
|
||||
getc(fp);
|
||||
}
|
||||
|
||||
if ((count = getc(fp)) == 0) {
|
||||
if ((count = getc(fp)) == 0) {
|
||||
if ((repcount = getc(fp)) == 0) {
|
||||
if ((repcount = getc(fp)) == 0) {
|
||||
// End of line...
|
||||
x ++;
|
||||
continue;
|
||||
} else if (count == 1) {
|
||||
} else if (repcount == 1) {
|
||||
// End of image...
|
||||
break;
|
||||
} else if (count == 2) {
|
||||
} else if (repcount == 2) {
|
||||
// Delta...
|
||||
count = getc(fp) * getc(fp) * w();
|
||||
repcount = getc(fp) * getc(fp) * w();
|
||||
color = 0;
|
||||
} else {
|
||||
// Absolute...
|
||||
color = -1;
|
||||
align = (2 - (count & 1)) & 1;
|
||||
align = (2 - (repcount & 1)) & 1;
|
||||
}
|
||||
} else {
|
||||
color = getc(fp);
|
||||
@ -307,7 +307,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
|
||||
if (color < 0) temp = getc(fp);
|
||||
else temp = color;
|
||||
|
||||
count --;
|
||||
repcount --;
|
||||
|
||||
// Copy the color value...
|
||||
*ptr++ = colormap[temp][2];
|
||||
@ -393,5 +393,5 @@ read_long(FILE *fp) { // I - File to read from
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.8 2002/07/26 14:22:02 easysw Exp $".
|
||||
// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.9 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.16 2002/08/05 17:50:24 easysw Exp $"
|
||||
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.17 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -395,8 +395,8 @@ void Fl_Bitmap::uncache() {
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Bitmap::label(Fl_Widget* w) {
|
||||
w->image(this);
|
||||
void Fl_Bitmap::label(Fl_Widget* widget) {
|
||||
widget->image(this);
|
||||
}
|
||||
|
||||
void Fl_Bitmap::label(Fl_Menu_Item* m) {
|
||||
@ -473,5 +473,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.16 2002/08/05 17:50:24 easysw Exp $".
|
||||
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.17 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.5 2002/04/11 11:52:41 easysw Exp $"
|
||||
// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.6 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Browser widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -161,13 +161,13 @@ void Fl_Browser::insert(int line, FL_BLINE* t) {
|
||||
redraw_line(t);
|
||||
}
|
||||
|
||||
void Fl_Browser::insert(int line, const char* newtext, void* data) {
|
||||
void Fl_Browser::insert(int line, const char* newtext, void* d) {
|
||||
int l = strlen(newtext);
|
||||
FL_BLINE* t = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
|
||||
t->length = l;
|
||||
t->flags = 0;
|
||||
strcpy(t->txt, newtext);
|
||||
t->data = data;
|
||||
t->data = d;
|
||||
insert(line, t);
|
||||
}
|
||||
|
||||
@ -198,9 +198,9 @@ void Fl_Browser::text(int line, const char* newtext) {
|
||||
redraw_line(t);
|
||||
}
|
||||
|
||||
void Fl_Browser::data(int line, void* data) {
|
||||
void Fl_Browser::data(int line, void* d) {
|
||||
if (line < 1 || line > lines) return;
|
||||
find_line(line)->data = data;
|
||||
find_line(line)->data = d;
|
||||
}
|
||||
|
||||
int Fl_Browser::item_height(void* lv) const {
|
||||
@ -212,27 +212,27 @@ int Fl_Browser::item_height(void* lv) const {
|
||||
if (!l->txt[0]) {
|
||||
// For blank lines set the height to exactly 1 line!
|
||||
fl_font(textfont(), textsize());
|
||||
int h = fl_height();
|
||||
if (h > hmax) hmax = h;
|
||||
int hh = fl_height();
|
||||
if (hh > hmax) hmax = hh;
|
||||
}
|
||||
else {
|
||||
// do each column separately as they may all set different fonts:
|
||||
for (char* str = l->txt; *str; str++) {
|
||||
Fl_Font font = textfont(); // default font
|
||||
int size = textsize(); // default size
|
||||
int tsize = textsize(); // default size
|
||||
while (*str==format_char()) {
|
||||
str++;
|
||||
switch (*str++) {
|
||||
case 'l': case 'L': size = 24; break;
|
||||
case 'm': case 'M': size = 18; break;
|
||||
case 's': size = 11; break;
|
||||
case 'l': case 'L': tsize = 24; break;
|
||||
case 'm': case 'M': tsize = 18; break;
|
||||
case 's': tsize = 11; break;
|
||||
case 'b': font = (Fl_Font)(font|FL_BOLD); break;
|
||||
case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
|
||||
case 'f': case 't': font = FL_COURIER; break;
|
||||
case 'B':
|
||||
case 'C': strtol(str, &str, 10); break;// skip a color number
|
||||
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
|
||||
case 'S': size = strtol(str,&str,10); break;
|
||||
case 'S': tsize = strtol(str,&str,10); break;
|
||||
case 0: case '@': str--;
|
||||
case '.': goto END_FORMAT;
|
||||
}
|
||||
@ -241,8 +241,8 @@ int Fl_Browser::item_height(void* lv) const {
|
||||
char* ptr = str;
|
||||
for(;*str && (*str!=column_char()); str++) ;
|
||||
if (ptr < str) {
|
||||
fl_font(font, size); int h = fl_height();
|
||||
if (h > hmax) hmax = h;
|
||||
fl_font(font, tsize); int hh = fl_height();
|
||||
if (hh > hmax) hmax = hh;
|
||||
}
|
||||
if (!*str) str --;
|
||||
}
|
||||
@ -254,34 +254,34 @@ int Fl_Browser::item_height(void* lv) const {
|
||||
int Fl_Browser::item_width(void* v) const {
|
||||
char* str = ((FL_BLINE*)v)->txt;
|
||||
const int* i = column_widths();
|
||||
int w = 0;
|
||||
int ww = 0;
|
||||
|
||||
while (*i) { // add up all tab-seperated fields
|
||||
char* e;
|
||||
for (e = str; *e && *e != column_char(); e++);
|
||||
if (!*e) break; // last one occupied by text
|
||||
str = e+1;
|
||||
w += *i++;
|
||||
ww += *i++;
|
||||
}
|
||||
|
||||
// OK, we gotta parse the string and find the string width...
|
||||
int size = textsize();
|
||||
int tsize = textsize();
|
||||
Fl_Font font = textfont();
|
||||
int done = 0;
|
||||
|
||||
while (*str == format_char_ && str[1] && str[1] != format_char_) {
|
||||
str ++;
|
||||
switch (*str++) {
|
||||
case 'l': case 'L': size = 24; break;
|
||||
case 'm': case 'M': size = 18; break;
|
||||
case 's': size = 11; break;
|
||||
case 'l': case 'L': tsize = 24; break;
|
||||
case 'm': case 'M': tsize = 18; break;
|
||||
case 's': tsize = 11; break;
|
||||
case 'b': font = (Fl_Font)(font|FL_BOLD); break;
|
||||
case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
|
||||
case 'f': case 't': font = FL_COURIER; break;
|
||||
case 'B':
|
||||
case 'C': strtol(str, &str, 10); break;// skip a color number
|
||||
case 'F': font = (Fl_Font)strtol(str, &str, 10); break;
|
||||
case 'S': size = strtol(str, &str, 10); break;
|
||||
case 'S': tsize = strtol(str, &str, 10); break;
|
||||
case '.':
|
||||
done = 1;
|
||||
case '@':
|
||||
@ -296,8 +296,8 @@ int Fl_Browser::item_width(void* v) const {
|
||||
if (*str == format_char_ && str[1])
|
||||
str ++;
|
||||
|
||||
fl_font(font, size);
|
||||
return w + int(fl_width(str)) + 6;
|
||||
fl_font(font, tsize);
|
||||
return ww + int(fl_width(str)) + 6;
|
||||
}
|
||||
|
||||
int Fl_Browser::full_height() const {
|
||||
@ -308,36 +308,36 @@ int Fl_Browser::incr_height() const {
|
||||
return textsize()+2;
|
||||
}
|
||||
|
||||
void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
|
||||
void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
|
||||
char* str = ((FL_BLINE*)v)->txt;
|
||||
const int* i = column_widths();
|
||||
|
||||
while (w > 6) { // do each tab-seperated field
|
||||
int w1 = w; // width for this field
|
||||
while (W > 6) { // do each tab-seperated field
|
||||
int w1 = W; // width for this field
|
||||
char* e = 0; // pointer to end of field or null if none
|
||||
if (*i) { // find end of field and temporarily replace with 0
|
||||
for (e = str; *e && *e != column_char(); e++);
|
||||
if (*e) {*e = 0; w1 = *i++;} else e = 0;
|
||||
}
|
||||
int size = textsize();
|
||||
int tsize = textsize();
|
||||
Fl_Font font = textfont();
|
||||
Fl_Color lcol = textcolor();
|
||||
Fl_Align align = FL_ALIGN_LEFT;
|
||||
Fl_Align talign = FL_ALIGN_LEFT;
|
||||
// check for all the @-lines recognized by XForms:
|
||||
while (*str == format_char() && *++str && *str != format_char()) {
|
||||
switch (*str++) {
|
||||
case 'l': case 'L': size = 24; break;
|
||||
case 'm': case 'M': size = 18; break;
|
||||
case 's': size = 11; break;
|
||||
case 'l': case 'L': tsize = 24; break;
|
||||
case 'm': case 'M': tsize = 18; break;
|
||||
case 's': tsize = 11; break;
|
||||
case 'b': font = (Fl_Font)(font|FL_BOLD); break;
|
||||
case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
|
||||
case 'f': case 't': font = FL_COURIER; break;
|
||||
case 'c': align = FL_ALIGN_CENTER; break;
|
||||
case 'r': align = FL_ALIGN_RIGHT; break;
|
||||
case 'c': talign = FL_ALIGN_CENTER; break;
|
||||
case 'r': talign = FL_ALIGN_RIGHT; break;
|
||||
case 'B':
|
||||
if (!(((FL_BLINE*)v)->flags & SELECTED)) {
|
||||
fl_color((Fl_Color)strtol(str, &str, 10));
|
||||
fl_rectf(x, y, w1, h);
|
||||
fl_rectf(X, Y, w1, H);
|
||||
} else strtol(str, &str, 10);
|
||||
break;
|
||||
case 'C':
|
||||
@ -350,18 +350,18 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
|
||||
lcol = FL_INACTIVE_COLOR;
|
||||
break;
|
||||
case 'S':
|
||||
size = strtol(str, &str, 10);
|
||||
tsize = strtol(str, &str, 10);
|
||||
break;
|
||||
case '-':
|
||||
fl_color(FL_DARK3);
|
||||
fl_line(x+3, y+h/2, x+w1-3, y+h/2);
|
||||
fl_line(X+3, Y+H/2, X+w1-3, Y+H/2);
|
||||
fl_color(FL_LIGHT3);
|
||||
fl_line(x+3, y+h/2+1, x+w1-3, y+h/2+1);
|
||||
fl_line(X+3, Y+H/2+1, X+w1-3, Y+H/2+1);
|
||||
break;
|
||||
case 'u':
|
||||
case '_':
|
||||
fl_color(lcol);
|
||||
fl_line(x+3, y+h-1, x+w1-3, y+h-1);
|
||||
fl_line(X+3, Y+H-1, X+w1-3, Y+H-1);
|
||||
break;
|
||||
case '.':
|
||||
goto BREAK;
|
||||
@ -370,24 +370,24 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
|
||||
}
|
||||
}
|
||||
BREAK:
|
||||
fl_font(font, size);
|
||||
fl_font(font, tsize);
|
||||
if (((FL_BLINE*)v)->flags & SELECTED)
|
||||
lcol = fl_contrast(lcol, selection_color());
|
||||
if (!active_r()) lcol = fl_inactive(lcol);
|
||||
fl_color(lcol);
|
||||
fl_draw(str, x+3, y, w1-6, h, e ? Fl_Align(align|FL_ALIGN_CLIP) : align, 0, 0);
|
||||
fl_draw(str, X+3, Y, w1-6, H, e ? Fl_Align(talign|FL_ALIGN_CLIP) : talign, 0, 0);
|
||||
if (!e) break; // no more fields...
|
||||
*e = column_char(); // put the seperator back
|
||||
x += w1;
|
||||
w -= w1;
|
||||
X += w1;
|
||||
W -= w1;
|
||||
str = e+1;
|
||||
}
|
||||
}
|
||||
|
||||
static const int no_columns[1] = {0};
|
||||
|
||||
Fl_Browser::Fl_Browser(int x, int y, int w, int h, const char*l)
|
||||
: Fl_Browser_(x, y, w, h, l) {
|
||||
Fl_Browser::Fl_Browser(int X, int Y, int W, int H, const char*l)
|
||||
: Fl_Browser_(X, Y, W, H, l) {
|
||||
column_widths_ = no_columns;
|
||||
lines = 0;
|
||||
full_height_ = 0;
|
||||
@ -427,9 +427,9 @@ int Fl_Browser::topline() const {
|
||||
|
||||
void Fl_Browser::clear() {
|
||||
for (FL_BLINE* l = first; l;) {
|
||||
FL_BLINE* h = l->next;
|
||||
FL_BLINE* n = l->next;
|
||||
free(l);
|
||||
l = h;
|
||||
l = n;
|
||||
}
|
||||
full_height_ = 0;
|
||||
first = 0;
|
||||
@ -437,8 +437,8 @@ void Fl_Browser::clear() {
|
||||
new_list();
|
||||
}
|
||||
|
||||
void Fl_Browser::add(const char* newtext, void* data) {
|
||||
insert(lines+1, newtext, data);
|
||||
void Fl_Browser::add(const char* newtext, void* d) {
|
||||
insert(lines+1, newtext, d);
|
||||
//Fl_Browser_::display(last);
|
||||
}
|
||||
|
||||
@ -452,9 +452,9 @@ void* Fl_Browser::data(int line) const {
|
||||
return find_line(line)->data;
|
||||
}
|
||||
|
||||
int Fl_Browser::select(int line, int value) {
|
||||
int Fl_Browser::select(int line, int v) {
|
||||
if (line < 1 || line > lines) return 0;
|
||||
return Fl_Browser_::select(find_line(line), value);
|
||||
return Fl_Browser_::select(find_line(line), v);
|
||||
}
|
||||
|
||||
int Fl_Browser::selected(int line) const {
|
||||
@ -480,9 +480,9 @@ void Fl_Browser::hide(int line) {
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Browser::display(int line, int value) {
|
||||
void Fl_Browser::display(int line, int v) {
|
||||
if (line < 1 || line > lines) return;
|
||||
if (value) show(line); else hide(line);
|
||||
if (v) show(line); else hide(line);
|
||||
}
|
||||
|
||||
int Fl_Browser::visible(int line) const {
|
||||
@ -495,5 +495,5 @@ int Fl_Browser::value() const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.5 2002/04/11 11:52:41 easysw Exp $".
|
||||
// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.6 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.13 2002/07/18 15:43:48 easysw Exp $"
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.14 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -119,9 +119,9 @@ void Fl_Browser_::update_top() {
|
||||
if (position_ != real_position_) {
|
||||
void* l;
|
||||
int ly;
|
||||
int y = position_;
|
||||
int yy = position_;
|
||||
// start from either head or current position, whichever is closer:
|
||||
if (!top_ || y <= (real_position_/2)) {
|
||||
if (!top_ || yy <= (real_position_/2)) {
|
||||
l = item_first();
|
||||
ly = 0;
|
||||
} else {
|
||||
@ -133,35 +133,35 @@ void Fl_Browser_::update_top() {
|
||||
offset_ = 0;
|
||||
real_position_ = 0;
|
||||
} else {
|
||||
int h = item_quick_height(l);
|
||||
int hh = item_quick_height(l);
|
||||
// step through list until we find line containing this point:
|
||||
while (ly > y) {
|
||||
while (ly > yy) {
|
||||
void* l1 = item_prev(l);
|
||||
if (!l1) {ly = 0; break;} // hit the top
|
||||
l = l1;
|
||||
h = item_quick_height(l);
|
||||
ly -= h;
|
||||
hh = item_quick_height(l);
|
||||
ly -= hh;
|
||||
}
|
||||
while ((ly+h) <= y) {
|
||||
while ((ly+hh) <= yy) {
|
||||
void* l1 = item_next(l);
|
||||
if (!l1) {y = ly+h-1; break;}
|
||||
if (!l1) {yy = ly+hh-1; break;}
|
||||
l = l1;
|
||||
ly += h;
|
||||
h = item_quick_height(l);
|
||||
ly += hh;
|
||||
hh = item_quick_height(l);
|
||||
}
|
||||
// top item must *really* be visible, use slow height:
|
||||
for (;;) {
|
||||
h = item_height(l);
|
||||
if ((ly+h) > y) break; // it is big enough to see
|
||||
hh = item_height(l);
|
||||
if ((ly+hh) > yy) break; // it is big enough to see
|
||||
// go up to top of previous item:
|
||||
void* l1 = item_prev(l);
|
||||
if (!l1) {ly = y = 0; break;} // hit the top
|
||||
l = l1; y = position_ = ly = ly-item_quick_height(l);
|
||||
if (!l1) {ly = yy = 0; break;} // hit the top
|
||||
l = l1; yy = position_ = ly = ly-item_quick_height(l);
|
||||
}
|
||||
// use it:
|
||||
top_ = l;
|
||||
offset_ = y-ly;
|
||||
real_position_ = y;
|
||||
offset_ = yy-ly;
|
||||
real_position_ = yy;
|
||||
}
|
||||
damage(FL_DAMAGE_SCROLL);
|
||||
}
|
||||
@ -169,26 +169,26 @@ void Fl_Browser_::update_top() {
|
||||
|
||||
// Change position(), top() will update when update_top() is called
|
||||
// (probably by draw() or handle()):
|
||||
void Fl_Browser_::position(int y) {
|
||||
if (y < 0) y = 0;
|
||||
if (y == position_) return;
|
||||
position_ = y;
|
||||
if (y != real_position_) redraw_lines();
|
||||
void Fl_Browser_::position(int yy) {
|
||||
if (yy < 0) yy = 0;
|
||||
if (yy == position_) return;
|
||||
position_ = yy;
|
||||
if (yy != real_position_) redraw_lines();
|
||||
}
|
||||
|
||||
void Fl_Browser_::hposition(int x) {
|
||||
if (x < 0) x = 0;
|
||||
if (x == hposition_) return;
|
||||
hposition_ = x;
|
||||
if (x != real_hposition_) redraw_lines();
|
||||
void Fl_Browser_::hposition(int xx) {
|
||||
if (xx < 0) xx = 0;
|
||||
if (xx == hposition_) return;
|
||||
hposition_ = xx;
|
||||
if (xx != real_hposition_) redraw_lines();
|
||||
}
|
||||
|
||||
// Tell whether item is currently displayed:
|
||||
int Fl_Browser_::displayed(void* x) const {
|
||||
int Fl_Browser_::displayed(void* p) const {
|
||||
int X, Y, W, H; bbox(X, Y, W, H);
|
||||
int yy = H+offset_;
|
||||
for (void* l = top_; l && yy > 0; l = item_next(l)) {
|
||||
if (l == x) return 1;
|
||||
if (l == p) return 1;
|
||||
yy -= item_height(l);
|
||||
}
|
||||
return 0;
|
||||
@ -196,11 +196,11 @@ int Fl_Browser_::displayed(void* x) const {
|
||||
|
||||
// Ensure this item is displayed:
|
||||
// Messy because we have no idea if it is before top or after bottom:
|
||||
void Fl_Browser_::display(void* x) {
|
||||
void Fl_Browser_::display(void* p) {
|
||||
|
||||
// First special case - want to display first item in the list?
|
||||
update_top();
|
||||
if (x == item_first()) {position(0); return;}
|
||||
if (p == item_first()) {position(0); return;}
|
||||
|
||||
int X, Y, W, H, Yp; bbox(X, Y, W, H);
|
||||
void* l = top_;
|
||||
@ -208,11 +208,11 @@ void Fl_Browser_::display(void* x) {
|
||||
int h1;
|
||||
|
||||
// 2nd special case - want to display item already displayed at top of browser?
|
||||
if (l == x) {position(real_position_+Y); return;} // scroll up a bit
|
||||
if (l == p) {position(real_position_+Y); return;} // scroll up a bit
|
||||
|
||||
// 3rd special case - want to display item just above top of browser?
|
||||
void* lp = item_prev(l);
|
||||
if (lp == x) {position(real_position_+Y-item_quick_height(lp)); return;}
|
||||
if (lp == p) {position(real_position_+Y-item_quick_height(lp)); return;}
|
||||
|
||||
#ifdef DISPLAY_SEARCH_BOTH_WAYS_AT_ONCE
|
||||
// search for item. We search both up and down the list at the same time,
|
||||
@ -221,7 +221,7 @@ void Fl_Browser_::display(void* x) {
|
||||
while (l || lp) {
|
||||
if (l) {
|
||||
h1 = item_quick_height(l);
|
||||
if (l == x) {
|
||||
if (l == p) {
|
||||
if (Y <= H) { // it is visible or right at bottom
|
||||
Y = Y+h1-H; // find where bottom edge is
|
||||
if (Y > 0) position(real_position_+Y); // scroll down a bit
|
||||
@ -236,7 +236,7 @@ void Fl_Browser_::display(void* x) {
|
||||
if (lp) {
|
||||
h1 = item_quick_height(lp);
|
||||
Yp -= h1;
|
||||
if (lp == x) {
|
||||
if (lp == p) {
|
||||
if ((Yp + h1) >= 0) position(real_position_+Yp);
|
||||
else position(real_position_+Yp-(H-h1)/2);
|
||||
return;
|
||||
@ -250,7 +250,7 @@ void Fl_Browser_::display(void* x) {
|
||||
l = top_;
|
||||
for (; l; l = item_next(l)) {
|
||||
h1 = item_quick_height(l);
|
||||
if (l == x) {
|
||||
if (l == p) {
|
||||
if (Y <= H) { // it is visible or right at bottom
|
||||
Y = Y+h1-H; // find where bottom edge is
|
||||
if (Y > 0) position(real_position_+Y); // scroll down a bit
|
||||
@ -267,7 +267,7 @@ void Fl_Browser_::display(void* x) {
|
||||
for (; l; l = item_prev(l)) {
|
||||
h1 = item_quick_height(l);
|
||||
Y -= h1;
|
||||
if (l == x) {
|
||||
if (l == p) {
|
||||
if ((Y + h1) >= 0) position(real_position_+Y);
|
||||
else position(real_position_+Y-(H-h1)/2);
|
||||
return;
|
||||
@ -363,8 +363,8 @@ J1:
|
||||
if (l == selection_ && Fl::focus() == this) {
|
||||
draw_focus(FL_NO_BOX, X, yy+Y+1, W, hh);
|
||||
}
|
||||
int w = item_width(l);
|
||||
if (w > max_width) {max_width = w; max_width_item = l;}
|
||||
int ww = item_width(l);
|
||||
if (ww > max_width) {max_width = ww; max_width_item = l;}
|
||||
}
|
||||
yy += hh;
|
||||
}
|
||||
@ -650,7 +650,7 @@ int Fl_Browser_::handle(int event) {
|
||||
position(p);
|
||||
} else if (my > (Y+H) && my > py) {
|
||||
int p = real_position_+my-(Y+H);
|
||||
int h = full_height()-H; if (p > h) p = h;
|
||||
int hh = full_height()-H; if (p > hh) p = hh;
|
||||
if (p<0) p = 0;
|
||||
position(p);
|
||||
}
|
||||
@ -701,8 +701,8 @@ int Fl_Browser_::handle(int event) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Fl_Browser_::Fl_Browser_(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Group(x, y, w, h, l),
|
||||
Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Group(X, Y, W, H, l),
|
||||
scrollbar(0, 0, 0, 0, 0), // they will be resized by draw()
|
||||
hscrollbar(0, 0, 0, 0, 0)
|
||||
{
|
||||
@ -755,5 +755,5 @@ void Fl_Browser_::item_select(void*, int) {}
|
||||
int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.13 2002/07/18 15:43:48 easysw Exp $".
|
||||
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.14 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Button.cxx,v 1.4.2.6.2.15 2002/06/02 17:52:36 easysw Exp $"
|
||||
// "$Id: Fl_Button.cxx,v 1.4.2.6.2.16 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Button widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -135,8 +135,8 @@ int Fl_Button::handle(int event) {
|
||||
}
|
||||
}
|
||||
|
||||
Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l)
|
||||
: Fl_Widget(x,y,w,h,l) {
|
||||
Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Widget(X,Y,W,H,l) {
|
||||
box(FL_UP_BOX);
|
||||
down_box(FL_NO_BOX);
|
||||
value_ = oldval = 0;
|
||||
@ -145,5 +145,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.15 2002/06/02 17:52:36 easysw Exp $".
|
||||
// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.16 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.8 2002/06/09 18:18:50 spitzak Exp $"
|
||||
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.9 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -63,11 +63,11 @@ static void draw_barchart(int x,int y,int w,int h,
|
||||
int i;
|
||||
/* Draw the bars */
|
||||
for (i=0; i<numb; i++) {
|
||||
int h = (int)rint(entries[i].val*incr);
|
||||
if (h < 0)
|
||||
fl_rectbound(x+i*bwidth,zeroh,bwidth+1,-h+1, (Fl_Color)entries[i].col);
|
||||
else if (h > 0)
|
||||
fl_rectbound(x+i*bwidth,zeroh-h,bwidth+1,h+1,(Fl_Color)entries[i].col);
|
||||
int hh = (int)rint(entries[i].val*incr);
|
||||
if (hh < 0)
|
||||
fl_rectbound(x+i*bwidth,zeroh,bwidth+1,-hh+1, (Fl_Color)entries[i].col);
|
||||
else if (hh > 0)
|
||||
fl_rectbound(x+i*bwidth,zeroh-hh,bwidth+1,hh+1,(Fl_Color)entries[i].col);
|
||||
}
|
||||
/* Draw the labels */
|
||||
fl_color(textcolor);
|
||||
@ -109,11 +109,11 @@ static void draw_horbarchart(int x,int y,int w,int h,
|
||||
if (min == 0.0 && max == 0.0) return; /* Nothing else to draw */
|
||||
/* Draw the bars */
|
||||
for (i=0; i<numb; i++) {
|
||||
int w = (int)rint(entries[i].val*incr);
|
||||
if (w > 0)
|
||||
fl_rectbound(zeroh,y+i*bwidth,w+1,bwidth+1, (Fl_Color)entries[i].col);
|
||||
else if (w < 0)
|
||||
fl_rectbound(zeroh+w,y+i*bwidth,-w+1,bwidth+1,(Fl_Color)entries[i].col);
|
||||
int ww = (int)rint(entries[i].val*incr);
|
||||
if (ww > 0)
|
||||
fl_rectbound(zeroh,y+i*bwidth,ww+1,bwidth+1, (Fl_Color)entries[i].col);
|
||||
else if (ww < 0)
|
||||
fl_rectbound(zeroh+w,y+i*bwidth,-ww+1,bwidth+1,(Fl_Color)entries[i].col);
|
||||
}
|
||||
/* Draw the labels */
|
||||
fl_color(textcolor);
|
||||
@ -141,26 +141,26 @@ static void draw_linechart(int type, int x,int y,int w,int h,
|
||||
for (i=0; i<numb; i++) {
|
||||
int x0 = x + (int)rint((i-.5)*bwidth);
|
||||
int x1 = x + (int)rint((i+.5)*bwidth);
|
||||
int y0 = i ? zeroh - (int)rint(entries[i-1].val*incr) : 0;
|
||||
int y1 = zeroh - (int)rint(entries[i].val*incr);
|
||||
int yy0 = i ? zeroh - (int)rint(entries[i-1].val*incr) : 0;
|
||||
int yy1 = zeroh - (int)rint(entries[i].val*incr);
|
||||
if (type == FL_SPIKE_CHART) {
|
||||
fl_color((Fl_Color)entries[i].col);
|
||||
fl_line(x1, zeroh, x1, y1);
|
||||
fl_line(x1, zeroh, x1, yy1);
|
||||
} else if (type == FL_LINE_CHART && i != 0) {
|
||||
fl_color((Fl_Color)entries[i-1].col);
|
||||
fl_line(x0,y0,x1,y1);
|
||||
fl_line(x0,yy0,x1,yy1);
|
||||
} else if (type == FL_FILLED_CHART && i != 0) {
|
||||
fl_color((Fl_Color)entries[i-1].col);
|
||||
if ((entries[i-1].val>0.0)!=(entries[i].val>0.0)) {
|
||||
double ttt = entries[i-1].val/(entries[i-1].val-entries[i].val);
|
||||
int xt = x + (int)rint((i-.5+ttt)*bwidth);
|
||||
fl_polygon(x0,zeroh, x0,y0, xt,zeroh);
|
||||
fl_polygon(xt,zeroh, x1,y1, x1,zeroh);
|
||||
fl_polygon(x0,zeroh, x0,yy0, xt,zeroh);
|
||||
fl_polygon(xt,zeroh, x1,yy1, x1,zeroh);
|
||||
} else {
|
||||
fl_polygon(x0,zeroh, x0,y0, x1,y1, x1,zeroh);
|
||||
fl_polygon(x0,zeroh, x0,yy0, x1,yy1, x1,zeroh);
|
||||
}
|
||||
fl_color(textcolor);
|
||||
fl_line(x0,y0,x1,y1);
|
||||
fl_line(x0,yy0,x1,yy1);
|
||||
}
|
||||
}
|
||||
/* Draw base line */
|
||||
@ -283,8 +283,8 @@ void Fl_Chart::draw() {
|
||||
#define FL_CHART_LCOL FL_LCOL
|
||||
#define FL_CHART_ALIGN FL_ALIGN_BOTTOM
|
||||
|
||||
Fl_Chart::Fl_Chart(int x,int y,int w,int h,const char *l) :
|
||||
Fl_Widget(x,y,w,h,l) {
|
||||
Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *l) :
|
||||
Fl_Widget(X,Y,W,H,l) {
|
||||
box(FL_BORDER_BOX);
|
||||
align(FL_ALIGN_BOTTOM);
|
||||
numb = 0;
|
||||
@ -325,36 +325,36 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Fl_Chart::insert(int index, double val, const char *str, unsigned col) {
|
||||
void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
|
||||
int i;
|
||||
if (index < 1 || index > numb+1) return;
|
||||
if (ind < 1 || ind > numb+1) return;
|
||||
/* Allocate more entries if required */
|
||||
if (numb >= sizenumb) {
|
||||
sizenumb += FL_CHART_MAX;
|
||||
entries = (FL_CHART_ENTRY *)realloc(entries, sizeof(FL_CHART_ENTRY) * (sizenumb + 1));
|
||||
}
|
||||
// Shift entries as needed
|
||||
for (i=numb; i >= index; i--) entries[i] = entries[i-1];
|
||||
for (i=numb; i >= ind; i--) entries[i] = entries[i-1];
|
||||
if (numb < maxnumb || maxnumb == 0) numb++;
|
||||
/* Fill in the new entry */
|
||||
entries[index-1].val = float(val);
|
||||
entries[index-1].col = col;
|
||||
entries[ind-1].val = float(val);
|
||||
entries[ind-1].col = col;
|
||||
if (str) {
|
||||
strlcpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1);
|
||||
strlcpy(entries[ind-1].str,str,FL_CHART_LABEL_MAX+1);
|
||||
} else {
|
||||
entries[index-1].str[0] = 0;
|
||||
entries[ind-1].str[0] = 0;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Fl_Chart::replace(int index,double val, const char *str, unsigned col) {
|
||||
if (index < 1 || index > numb) return;
|
||||
entries[index-1].val = float(val);
|
||||
entries[index-1].col = col;
|
||||
void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
|
||||
if (ind < 1 || ind > numb) return;
|
||||
entries[ind-1].val = float(val);
|
||||
entries[ind-1].col = col;
|
||||
if (str) {
|
||||
strlcpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1);
|
||||
strlcpy(entries[ind-1].str,str,FL_CHART_LABEL_MAX+1);
|
||||
} else {
|
||||
entries[index-1].str[0] = 0;
|
||||
entries[ind-1].str[0] = 0;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
@ -380,5 +380,5 @@ void Fl_Chart::maxsize(int m) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.8 2002/06/09 18:18:50 spitzak Exp $".
|
||||
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.9 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Check_Browser.cxx,v 1.1.2.4 2002/04/11 11:52:41 easysw Exp $"
|
||||
// "$Id: Fl_Check_Browser.cxx,v 1.1.2.5 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -82,8 +82,8 @@ int Fl_Check_Browser::lineno(cb_item *p0) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Fl_Check_Browser::Fl_Check_Browser(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Browser_(x, y, w, h, l) {
|
||||
Fl_Check_Browser::Fl_Check_Browser(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Browser_(X, Y, W, H, l) {
|
||||
type(FL_SELECT_BROWSER);
|
||||
when(FL_WHEN_NEVER);
|
||||
first = last = 0;
|
||||
@ -114,27 +114,27 @@ int Fl_Check_Browser::item_width(void *v) const {
|
||||
return int(fl_width(((cb_item *)v)->text)) + CHECK_SIZE + 8;
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::item_draw(void *v, int x, int y, int, int) const {
|
||||
void Fl_Check_Browser::item_draw(void *v, int X, int Y, int, int) const {
|
||||
cb_item *i = (cb_item *)v;
|
||||
char *s = i->text;
|
||||
int size = textsize();
|
||||
int tsize = textsize();
|
||||
Fl_Color col = textcolor();
|
||||
int cy = y + (size + 1 - CHECK_SIZE) / 2;
|
||||
x += 2;
|
||||
int cy = Y + (tsize + 1 - CHECK_SIZE) / 2;
|
||||
X += 2;
|
||||
|
||||
fl_color(FL_BLACK);
|
||||
fl_loop(x, cy, x, cy + CHECK_SIZE,
|
||||
x + CHECK_SIZE, cy + CHECK_SIZE, x + CHECK_SIZE, cy);
|
||||
fl_loop(X, cy, X, cy + CHECK_SIZE,
|
||||
X + CHECK_SIZE, cy + CHECK_SIZE, X + CHECK_SIZE, cy);
|
||||
if (i->checked) {
|
||||
fl_line(x, cy, x + CHECK_SIZE, cy + CHECK_SIZE);
|
||||
fl_line(x, cy + CHECK_SIZE, x + CHECK_SIZE, cy);
|
||||
fl_line(X, cy, X + CHECK_SIZE, cy + CHECK_SIZE);
|
||||
fl_line(X, cy + CHECK_SIZE, X + CHECK_SIZE, cy);
|
||||
}
|
||||
fl_font(textfont(), size);
|
||||
fl_font(textfont(), tsize);
|
||||
if (i->selected) {
|
||||
col = fl_contrast(col, selection_color());
|
||||
}
|
||||
fl_color(col);
|
||||
fl_draw(s, x + CHECK_SIZE + 8, y + size - 1);
|
||||
fl_draw(s, X + CHECK_SIZE + 8, Y + tsize - 1);
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::item_select(void *v, int state) {
|
||||
@ -259,5 +259,5 @@ void Fl_Check_Browser::check_none() {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Check_Browser.cxx,v 1.1.2.4 2002/04/11 11:52:41 easysw Exp $".
|
||||
// End of "$Id: Fl_Check_Browser.cxx,v 1.1.2.5 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Check_Button.cxx,v 1.4.2.3.2.3 2002/01/01 15:11:30 easysw Exp $"
|
||||
// "$Id: Fl_Check_Button.cxx,v 1.4.2.3.2.4 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Check button widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -30,8 +30,8 @@
|
||||
// diamond is smaller than the widget size and can be surchecked by
|
||||
// another box type, for compatability with Forms.
|
||||
|
||||
Fl_Check_Button::Fl_Check_Button(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Light_Button(x, y, w, h, l) {
|
||||
Fl_Check_Button::Fl_Check_Button(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Light_Button(X, Y, W, H, l) {
|
||||
box(FL_NO_BOX);
|
||||
down_box(FL_DOWN_BOX);
|
||||
selection_color(FL_BLACK);
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.10 2002/07/09 17:18:45 easysw Exp $"
|
||||
// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.11 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Choice widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -74,8 +74,8 @@ void Fl_Choice::draw() {
|
||||
draw_label();
|
||||
}
|
||||
|
||||
Fl_Choice::Fl_Choice(int x,int y,int w,int h, const char *l)
|
||||
: Fl_Menu_(x,y,w,h,l) {
|
||||
Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Menu_(X,Y,W,H,l) {
|
||||
align(FL_ALIGN_LEFT);
|
||||
when(FL_WHEN_RELEASE);
|
||||
textfont(FL_HELVETICA);
|
||||
@ -129,5 +129,5 @@ int Fl_Choice::handle(int e) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.10 2002/07/09 17:18:45 easysw Exp $".
|
||||
// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.11 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Clock.cxx,v 1.8.2.4.2.1 2002/01/01 15:11:30 easysw Exp $"
|
||||
// "$Id: Fl_Clock.cxx,v 1.8.2.4.2.2 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Clock widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -68,11 +68,11 @@ static void rect(double x, double y, double w, double h) {
|
||||
fl_end_polygon();
|
||||
}
|
||||
|
||||
void Fl_Clock_Output::draw(int x, int y, int w, int h) {
|
||||
draw_box(box(), x, y, w, h, type()==FL_ROUND_CLOCK ? FL_GRAY : color());
|
||||
void Fl_Clock_Output::draw(int X, int Y, int W, int H) {
|
||||
draw_box(box(), X, Y, W, H, type()==FL_ROUND_CLOCK ? FL_GRAY : color());
|
||||
fl_push_matrix();
|
||||
fl_translate(x+w/2.0-.5, y+h/2.0-.5);
|
||||
fl_scale((w-1)/28.0, (h-1)/28.0);
|
||||
fl_translate(X+W/2.0-.5, Y+H/2.0-.5);
|
||||
fl_scale((W-1)/28.0, (H-1)/28.0);
|
||||
if (type() == FL_ROUND_CLOCK) {
|
||||
fl_color(color());
|
||||
fl_begin_polygon(); fl_circle(0,0,14); fl_end_polygon();
|
||||
@ -104,9 +104,9 @@ void Fl_Clock_Output::draw() {
|
||||
draw_label();
|
||||
}
|
||||
|
||||
void Fl_Clock_Output::value(int h, int m, int s) {
|
||||
if (h!=hour_ || m!=minute_ || s!=second_) {
|
||||
hour_ = h; minute_ = m; second_ = s;
|
||||
void Fl_Clock_Output::value(int H, int m, int s) {
|
||||
if (H!=hour_ || m!=minute_ || s!=second_) {
|
||||
hour_ = H; minute_ = m; second_ = s;
|
||||
damage(FL_DAMAGE_CHILD);
|
||||
}
|
||||
}
|
||||
@ -117,8 +117,8 @@ void Fl_Clock_Output::value(ulong v) {
|
||||
value(timeofday->tm_hour, timeofday->tm_min, timeofday->tm_sec);
|
||||
}
|
||||
|
||||
Fl_Clock_Output::Fl_Clock_Output(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Widget(x, y, w, h, l) {
|
||||
Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Widget(X, Y, W, H, l) {
|
||||
box(FL_UP_BOX);
|
||||
selection_color(fl_gray_ramp(5));
|
||||
align(FL_ALIGN_BOTTOM);
|
||||
@ -130,11 +130,11 @@ Fl_Clock_Output::Fl_Clock_Output(int x, int y, int w, int h, const char *l)
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
Fl_Clock::Fl_Clock(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Clock_Output(x, y, w, h, l) {}
|
||||
Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Clock_Output(X, Y, W, H, l) {}
|
||||
|
||||
Fl_Clock::Fl_Clock(uchar t, int x, int y, int w, int h, const char *l)
|
||||
: Fl_Clock_Output(x, y, w, h, l) {
|
||||
Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Clock_Output(X, Y, W, H, l) {
|
||||
type(t);
|
||||
box(t==FL_ROUND_CLOCK ? FL_NO_BOX : FL_UP_BOX);
|
||||
}
|
||||
@ -170,5 +170,5 @@ Fl_Clock::~Fl_Clock() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Clock.cxx,v 1.8.2.4.2.1 2002/01/01 15:11:30 easysw Exp $".
|
||||
// End of "$Id: Fl_Clock.cxx,v 1.8.2.4.2.2 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.4 2002/04/11 10:46:19 easysw Exp $"
|
||||
// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.5 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Color chooser for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -46,9 +46,9 @@
|
||||
#define UPDATE_HUE_BOX 1
|
||||
|
||||
void Fl_Color_Chooser::hsv2rgb(
|
||||
double H, double S, double V, double& r, double& g, double& b) {
|
||||
double H, double S, double V, double& R, double& G, double& B) {
|
||||
if (S < 5.0e-6) {
|
||||
r = g = b = V;
|
||||
R = G = B = V;
|
||||
} else {
|
||||
int i = (int)H;
|
||||
double f = H - (float)i;
|
||||
@ -56,27 +56,27 @@ void Fl_Color_Chooser::hsv2rgb(
|
||||
double p2 = V*(1.0-S*f);
|
||||
double p3 = V*(1.0-S*(1.0-f));
|
||||
switch (i) {
|
||||
case 0: r = V; g = p3; b = p1; break;
|
||||
case 1: r = p2; g = V; b = p1; break;
|
||||
case 2: r = p1; g = V; b = p3; break;
|
||||
case 3: r = p1; g = p2; b = V; break;
|
||||
case 4: r = p3; g = p1; b = V; break;
|
||||
case 5: r = V; g = p1; b = p2; break;
|
||||
case 0: R = V; G = p3; B = p1; break;
|
||||
case 1: R = p2; G = V; B = p1; break;
|
||||
case 2: R = p1; G = V; B = p3; break;
|
||||
case 3: R = p1; G = p2; B = V; break;
|
||||
case 4: R = p3; G = p1; B = V; break;
|
||||
case 5: R = V; G = p1; B = p2; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Color_Chooser::rgb2hsv(
|
||||
double r, double g, double b, double& H, double& S, double& V) {
|
||||
double maxv = r > g ? r : g; if (b > maxv) maxv = b;
|
||||
double R, double G, double B, double& H, double& S, double& V) {
|
||||
double maxv = R > G ? R : G; if (B > maxv) maxv = B;
|
||||
V = maxv;
|
||||
if (maxv>0) {
|
||||
double minv = r < g ? r : g; if (b < minv) minv = b;
|
||||
double minv = R < G ? R : G; if (B < minv) minv = B;
|
||||
S = 1.0 - double(minv)/maxv;
|
||||
if (maxv > minv) {
|
||||
if (maxv == r) {H = (g-b)/double(maxv-minv); if (H<0) H += 6.0;}
|
||||
else if (maxv == g) H = 2.0+(b-r)/double(maxv-minv);
|
||||
else H = 4.0+(r-g)/double(maxv-minv);
|
||||
if (maxv == R) {H = (G-B)/double(maxv-minv); if (H<0) H += 6.0;}
|
||||
else if (maxv == G) H = 2.0+(B-R)/double(maxv-minv);
|
||||
else H = 4.0+(R-G)/double(maxv-minv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,13 +117,13 @@ void Fl_Color_Chooser::set_valuators() {
|
||||
}
|
||||
}
|
||||
|
||||
int Fl_Color_Chooser::rgb(double r, double g, double b) {
|
||||
if (r == r_ && g == g_ && b == b_) return 0;
|
||||
r_ = r; g_ = g; b_ = b;
|
||||
int Fl_Color_Chooser::rgb(double R, double G, double B) {
|
||||
if (R == r_ && G == g_ && B == b_) return 0;
|
||||
r_ = R; g_ = G; b_ = B;
|
||||
double ph = hue_;
|
||||
double ps = saturation_;
|
||||
double pv = value_;
|
||||
rgb2hsv(r,g,b,hue_,saturation_,value_);
|
||||
rgb2hsv(R,G,B,hue_,saturation_,value_);
|
||||
set_valuators();
|
||||
if (value_ != pv) {
|
||||
#ifdef UPDATE_HUE_BOX
|
||||
@ -137,15 +137,15 @@ int Fl_Color_Chooser::rgb(double r, double g, double b) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Fl_Color_Chooser::hsv(double h, double s, double v) {
|
||||
h = fmod(h,6.0); if (h < 0.0) h += 6.0;
|
||||
if (s < 0.0) s = 0.0; else if (s > 1.0) s = 1.0;
|
||||
if (v < 0.0) v = 0.0; else if (v > 1.0) v = 1.0;
|
||||
if (h == hue_ && s == saturation_ && v == value_) return 0;
|
||||
int Fl_Color_Chooser::hsv(double H, double S, double V) {
|
||||
H = fmod(H,6.0); if (H < 0.0) H += 6.0;
|
||||
if (S < 0.0) S = 0.0; else if (S > 1.0) S = 1.0;
|
||||
if (V < 0.0) V = 0.0; else if (V > 1.0) V = 1.0;
|
||||
if (H == hue_ && S == saturation_ && V == value_) return 0;
|
||||
double ph = hue_;
|
||||
double ps = saturation_;
|
||||
double pv = value_;
|
||||
hue_ = h; saturation_ = s; value_ = v;
|
||||
hue_ = H; saturation_ = S; value_ = V;
|
||||
if (value_ != pv) {
|
||||
#ifdef UPDATE_HUE_BOX
|
||||
huebox.damage(FL_DAMAGE_SCROLL);
|
||||
@ -155,7 +155,7 @@ int Fl_Color_Chooser::hsv(double h, double s, double v) {
|
||||
huebox.damage(FL_DAMAGE_EXPOSE);
|
||||
valuebox.damage(FL_DAMAGE_SCROLL);
|
||||
}
|
||||
hsv2rgb(h,s,v,r_,g_,b_);
|
||||
hsv2rgb(H,S,V,r_,g_,b_);
|
||||
set_valuators();
|
||||
return 1;
|
||||
}
|
||||
@ -272,11 +272,11 @@ int Flcc_HueBox::handle_key(int key) {
|
||||
void Flcc_HueBox::draw() {
|
||||
if (damage()&FL_DAMAGE_ALL) draw_box();
|
||||
int x1 = x()+Fl::box_dx(box());
|
||||
int y1 = y()+Fl::box_dy(box());
|
||||
int yy1 = y()+Fl::box_dy(box());
|
||||
int w1 = w()-Fl::box_dw(box());
|
||||
int h1 = h()-Fl::box_dh(box());
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1+px,y1+py,6,6);
|
||||
fl_draw_image(generate_image, this, x1, y1, w1, h1);
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1+px,yy1+py,6,6);
|
||||
fl_draw_image(generate_image, this, x1, yy1, w1, h1);
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
|
||||
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
||||
#ifdef CIRCLE
|
||||
@ -289,7 +289,7 @@ void Flcc_HueBox::draw() {
|
||||
if (X < 0) X = 0; else if (X > w1-6) X = w1-6;
|
||||
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
|
||||
// fl_color(c->value()>.75 ? FL_BLACK : FL_WHITE);
|
||||
draw_box(FL_UP_BOX,x1+X,y1+Y,6,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
|
||||
draw_box(FL_UP_BOX,x1+X,yy1+Y,6,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
|
||||
px = X; py = Y;
|
||||
}
|
||||
|
||||
@ -342,15 +342,15 @@ void Flcc_ValueBox::draw() {
|
||||
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
||||
c->hsv2rgb(c->hue(),c->saturation(),1.0,tr,tg,tb);
|
||||
int x1 = x()+Fl::box_dx(box());
|
||||
int y1 = y()+Fl::box_dy(box());
|
||||
int yy1 = y()+Fl::box_dy(box());
|
||||
int w1 = w()-Fl::box_dw(box());
|
||||
int h1 = h()-Fl::box_dh(box());
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1,y1+py,w1,6);
|
||||
fl_draw_image(generate_vimage, this, x1, y1, w1, h1);
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1,yy1+py,w1,6);
|
||||
fl_draw_image(generate_vimage, this, x1, yy1, w1, h1);
|
||||
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
|
||||
int Y = int((1-c->value()) * (h1-6));
|
||||
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
|
||||
draw_box(FL_UP_BOX,x1,y1+Y,w1,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
|
||||
draw_box(FL_UP_BOX,x1,yy1+Y,w1,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
|
||||
py = Y;
|
||||
}
|
||||
|
||||
@ -383,19 +383,19 @@ int Flcc_ValueBox::handle_key(int key) {
|
||||
|
||||
void Fl_Color_Chooser::rgb_cb(Fl_Widget* o, void*) {
|
||||
Fl_Color_Chooser* c = (Fl_Color_Chooser*)(o->parent());
|
||||
double r = c->rvalue.value();
|
||||
double g = c->gvalue.value();
|
||||
double b = c->bvalue.value();
|
||||
double R = c->rvalue.value();
|
||||
double G = c->gvalue.value();
|
||||
double B = c->bvalue.value();
|
||||
if (c->mode() == M_HSV) {
|
||||
if (c->hsv(r,g,b)) c->do_callback();
|
||||
if (c->hsv(R,G,B)) c->do_callback();
|
||||
return;
|
||||
}
|
||||
if (c->mode() != M_RGB) {
|
||||
r = r/255;
|
||||
g = g/255;
|
||||
b = b/255;
|
||||
R = R/255;
|
||||
G = G/255;
|
||||
B = B/255;
|
||||
}
|
||||
if (c->rgb(r,g,b)) c->do_callback();
|
||||
if (c->rgb(R,G,B)) c->do_callback();
|
||||
}
|
||||
|
||||
void Fl_Color_Chooser::mode_cb(Fl_Widget* o, void*) {
|
||||
@ -521,5 +521,5 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.4 2002/04/11 10:46:19 easysw Exp $".
|
||||
// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.5 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.9 2002/05/24 14:19:19 easysw Exp $"
|
||||
// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.10 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Counter widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -173,8 +173,8 @@ Fl_Counter::~Fl_Counter() {
|
||||
Fl::remove_timeout(repeat_callback, this);
|
||||
}
|
||||
|
||||
Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Valuator(x, y, w, h, l) {
|
||||
Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Valuator(X, Y, W, H, l) {
|
||||
box(FL_UP_BOX);
|
||||
selection_color(FL_INACTIVE_COLOR); // was FL_BLUE
|
||||
align(FL_ALIGN_BOTTOM);
|
||||
@ -188,5 +188,5 @@ Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.9 2002/05/24 14:19:19 easysw Exp $".
|
||||
// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.10 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Dial.cxx,v 1.12.2.3.2.3 2002/05/12 11:12:56 easysw Exp $"
|
||||
// "$Id: Fl_Dial.cxx,v 1.12.2.3.2.4 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Circular dial widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -31,34 +31,34 @@
|
||||
|
||||
// All angles are measured with 0 to the right and counter-clockwise
|
||||
|
||||
void Fl_Dial::draw(int x, int y, int w, int h) {
|
||||
if (damage()&FL_DAMAGE_ALL) draw_box(box(), x, y, w, h, color());
|
||||
x += Fl::box_dx(box());
|
||||
y += Fl::box_dy(box());
|
||||
w -= Fl::box_dw(box());
|
||||
h -= Fl::box_dh(box());
|
||||
void Fl_Dial::draw(int X, int Y, int W, int H) {
|
||||
if (damage()&FL_DAMAGE_ALL) draw_box(box(), X, Y, W, H, color());
|
||||
X += Fl::box_dx(box());
|
||||
Y += Fl::box_dy(box());
|
||||
W -= Fl::box_dw(box());
|
||||
H -= Fl::box_dh(box());
|
||||
double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
|
||||
if (type() == FL_FILL_DIAL) {
|
||||
// foo: draw this nicely in certain round box types
|
||||
int foo = (box() > _FL_ROUND_UP_BOX && Fl::box_dx(box()));
|
||||
if (foo) {x--; y--; w+=2; h+=2;}
|
||||
if (foo) {X--; Y--; W+=2; H+=2;}
|
||||
fl_color(color());
|
||||
fl_pie(x, y, w-1, h-1, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle);
|
||||
fl_pie(X, Y, W-1, H-1, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle);
|
||||
fl_color(selection_color());
|
||||
fl_pie(x, y, w-1, h-1, 270-angle, 270-a1);
|
||||
fl_pie(X, Y, W-1, H-1, 270-angle, 270-a1);
|
||||
if (foo) {
|
||||
fl_color(FL_FOREGROUND_COLOR);
|
||||
fl_arc(x, y, w, h, 0, 360);
|
||||
fl_arc(X, Y, W, H, 0, 360);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!(damage()&FL_DAMAGE_ALL)) {
|
||||
fl_color(color());
|
||||
fl_pie(x+1, y+1, w-2, h-2, 0, 360);
|
||||
fl_pie(X+1, Y+1, W-2, H-2, 0, 360);
|
||||
}
|
||||
fl_push_matrix();
|
||||
fl_translate(x+w/2-.5, y+h/2-.5);
|
||||
fl_scale(w-1, h-1);
|
||||
fl_translate(X+W/2-.5, Y+H/2-.5);
|
||||
fl_scale(W-1, H-1);
|
||||
fl_rotate(45-angle);
|
||||
fl_color(selection_color());
|
||||
if (type()) { // FL_LINE_DIAL
|
||||
@ -88,13 +88,13 @@ void Fl_Dial::draw() {
|
||||
draw_label();
|
||||
}
|
||||
|
||||
int Fl_Dial::handle(int event, int x, int y, int w, int h) {
|
||||
int Fl_Dial::handle(int event, int X, int Y, int W, int H) {
|
||||
switch (event) {
|
||||
case FL_PUSH:
|
||||
handle_push();
|
||||
case FL_DRAG: {
|
||||
int mx = Fl::event_x()-x-w/2;
|
||||
int my = Fl::event_y()-y-h/2;
|
||||
int mx = Fl::event_x()-X-W/2;
|
||||
int my = Fl::event_y()-Y-H/2;
|
||||
if (!mx && !my) return 1;
|
||||
double angle = 270-atan2((float)-my, (float)mx)*180/M_PI;
|
||||
double oldangle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
|
||||
@ -125,8 +125,8 @@ int Fl_Dial::handle(int e) {
|
||||
return handle(e, x(), y(), w(), h());
|
||||
}
|
||||
|
||||
Fl_Dial::Fl_Dial(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Valuator(x, y, w, h, l) {
|
||||
Fl_Dial::Fl_Dial(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Valuator(X, Y, W, H, l) {
|
||||
box(FL_OVAL_BOX);
|
||||
selection_color(FL_INACTIVE_COLOR); // was 37
|
||||
a1 = 45;
|
||||
@ -134,5 +134,5 @@ Fl_Dial::Fl_Dial(int x, int y, int w, int h, const char* l)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Dial.cxx,v 1.12.2.3.2.3 2002/05/12 11:12:56 easysw Exp $".
|
||||
// End of "$Id: Fl_Dial.cxx,v 1.12.2.3.2.4 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_File_Browser.cxx,v 1.1.2.20 2002/07/17 15:23:58 easysw Exp $"
|
||||
// "$Id: Fl_File_Browser.cxx,v 1.1.2.21 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Fl_File_Browser routines.
|
||||
//
|
||||
@ -115,7 +115,7 @@ int // O - Height in pixels
|
||||
Fl_File_Browser::item_height(void *p) const // I - List item data
|
||||
{
|
||||
FL_BLINE *line; // Pointer to line
|
||||
char *text; // Pointer into text
|
||||
char *t; // Pointer into text
|
||||
int height; // Width of line
|
||||
int textheight; // Height of text
|
||||
|
||||
@ -131,8 +131,8 @@ Fl_File_Browser::item_height(void *p) const // I - List item data
|
||||
line = (FL_BLINE *)p;
|
||||
|
||||
if (line != NULL)
|
||||
for (text = line->txt; *text != '\0'; text ++)
|
||||
if (*text == '\n')
|
||||
for (t = line->txt; *t != '\0'; t ++)
|
||||
if (*t == '\n')
|
||||
height += textheight;
|
||||
|
||||
// If we have enabled icons then add space for them...
|
||||
@ -156,7 +156,7 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
|
||||
{
|
||||
int i; // Looping var
|
||||
FL_BLINE *line; // Pointer to line
|
||||
char *text, // Pointer into text
|
||||
char *t, // Pointer into text
|
||||
*ptr, // Pointer into fragment
|
||||
fragment[10240]; // Fragment of text
|
||||
int width, // Width of line
|
||||
@ -185,8 +185,8 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
|
||||
tempwidth = 0;
|
||||
column = 0;
|
||||
|
||||
for (text = line->txt, ptr = fragment; *text != '\0'; text ++)
|
||||
if (*text == '\n')
|
||||
for (t = line->txt, ptr = fragment; *t != '\0'; t ++)
|
||||
if (*t == '\n')
|
||||
{
|
||||
// Newline - nul terminate this fragment and get the width...
|
||||
*ptr = '\0';
|
||||
@ -202,7 +202,7 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
|
||||
tempwidth = 0;
|
||||
column = 0;
|
||||
}
|
||||
else if (*text == column_char())
|
||||
else if (*t == column_char())
|
||||
{
|
||||
// Advance to the next column...
|
||||
column ++;
|
||||
@ -220,7 +220,7 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
|
||||
ptr = fragment;
|
||||
}
|
||||
else
|
||||
*ptr++ = *text;
|
||||
*ptr++ = *t;
|
||||
|
||||
if (ptr > fragment)
|
||||
{
|
||||
@ -253,15 +253,15 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
|
||||
|
||||
void
|
||||
Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
int x, // I - Upper-lefthand X coordinate
|
||||
int y, // I - Upper-lefthand Y coordinate
|
||||
int w, // I - Width of item
|
||||
int h) const// I - Height of item
|
||||
int X, // I - Upper-lefthand X coordinate
|
||||
int Y, // I - Upper-lefthand Y coordinate
|
||||
int W, // I - Width of item
|
||||
int H) const// I - Height of item
|
||||
{
|
||||
int i; // Looping var
|
||||
FL_BLINE *line; // Pointer to line
|
||||
Fl_Color c; // Text color
|
||||
char *text, // Pointer into text
|
||||
char *t, // Pointer into text
|
||||
*ptr, // Pointer into fragment
|
||||
fragment[10240]; // Fragment of text
|
||||
int width, // Width of line
|
||||
@ -288,31 +288,31 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
if (Fl_File_Icon::first() == NULL)
|
||||
{
|
||||
// No icons, just draw the text...
|
||||
x ++;
|
||||
w -= 2;
|
||||
X ++;
|
||||
W -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw the icon if it is set...
|
||||
if (line->data)
|
||||
((Fl_File_Icon *)line->data)->draw(x, y, iconsize_, iconsize_,
|
||||
((Fl_File_Icon *)line->data)->draw(X, Y, iconsize_, iconsize_,
|
||||
(line->flags & SELECTED) ? FL_YELLOW :
|
||||
FL_LIGHT2,
|
||||
active_r());
|
||||
|
||||
// Draw the text offset to the right...
|
||||
x += iconsize_ + 9;
|
||||
w -= iconsize_ - 10;
|
||||
X += iconsize_ + 9;
|
||||
W -= iconsize_ - 10;
|
||||
|
||||
// Center the text vertically...
|
||||
height = fl_height();
|
||||
|
||||
for (text = line->txt; *text != '\0'; text ++)
|
||||
if (*text == '\n')
|
||||
for (t = line->txt; *t != '\0'; t ++)
|
||||
if (*t == '\n')
|
||||
height += fl_height();
|
||||
|
||||
if (height < iconsize_)
|
||||
y += (iconsize_ - height) / 2;
|
||||
Y += (iconsize_ - height) / 2;
|
||||
}
|
||||
|
||||
// Draw the text...
|
||||
@ -326,27 +326,27 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
else
|
||||
fl_color(fl_inactive(c));
|
||||
|
||||
for (text = line->txt, ptr = fragment; *text != '\0'; text ++)
|
||||
if (*text == '\n')
|
||||
for (t = line->txt, ptr = fragment; *t != '\0'; t ++)
|
||||
if (*t == '\n')
|
||||
{
|
||||
// Newline - nul terminate this fragment and draw it...
|
||||
*ptr = '\0';
|
||||
|
||||
fl_draw(fragment, x + width, y, w - width, fl_height(),
|
||||
fl_draw(fragment, X + width, Y, W - width, fl_height(),
|
||||
(Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_CLIP), 0, 0);
|
||||
|
||||
// Point back to the start of the fragment...
|
||||
ptr = fragment;
|
||||
width = 0;
|
||||
y += fl_height();
|
||||
Y += fl_height();
|
||||
column = 0;
|
||||
}
|
||||
else if (*text == column_char())
|
||||
else if (*t == column_char())
|
||||
{
|
||||
// Tab - nul terminate this fragment and draw it...
|
||||
*ptr = '\0';
|
||||
|
||||
int cW = w - width; // Clip width...
|
||||
int cW = W - width; // Clip width...
|
||||
|
||||
if (columns)
|
||||
{
|
||||
@ -357,7 +357,7 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
cW = columns[i];
|
||||
}
|
||||
|
||||
fl_draw(fragment, x + width, y, cW, fl_height(),
|
||||
fl_draw(fragment, X + width, Y, cW, fl_height(),
|
||||
(Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_CLIP), 0, 0);
|
||||
|
||||
// Advance to the next column...
|
||||
@ -373,14 +373,14 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
ptr = fragment;
|
||||
}
|
||||
else
|
||||
*ptr++ = *text;
|
||||
*ptr++ = *t;
|
||||
|
||||
if (ptr > fragment)
|
||||
{
|
||||
// Nul terminate this fragment and draw it...
|
||||
*ptr = '\0';
|
||||
|
||||
fl_draw(fragment, x + width, y, w - width, fl_height(),
|
||||
fl_draw(fragment, X + width, Y, W - width, fl_height(),
|
||||
(Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_CLIP), 0, 0);
|
||||
}
|
||||
}
|
||||
@ -390,12 +390,12 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
// 'Fl_File_Browser::Fl_File_Browser()' - Create a Fl_File_Browser widget.
|
||||
//
|
||||
|
||||
Fl_File_Browser::Fl_File_Browser(int x, // I - Upper-lefthand X coordinate
|
||||
int y, // I - Upper-lefthand Y coordinate
|
||||
int w, // I - Width in pixels
|
||||
int h, // I - Height in pixels
|
||||
Fl_File_Browser::Fl_File_Browser(int X, // I - Upper-lefthand X coordinate
|
||||
int Y, // I - Upper-lefthand Y coordinate
|
||||
int W, // I - Width in pixels
|
||||
int H, // I - Height in pixels
|
||||
const char *l) // I - Label text
|
||||
: Fl_Browser(x, y, w, h, l)
|
||||
: Fl_Browser(X, Y, W, H, l)
|
||||
{
|
||||
// Initialize the filter pattern, current directory, and icon size...
|
||||
pattern_ = "*";
|
||||
@ -645,5 +645,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.20 2002/07/17 15:23:58 easysw Exp $".
|
||||
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.21 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.22 2002/08/05 17:50:25 easysw Exp $"
|
||||
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.23 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// More Fl_File_Chooser routines.
|
||||
//
|
||||
@ -110,7 +110,7 @@ int // O - Number of selected files
|
||||
Fl_File_Chooser::count()
|
||||
{
|
||||
int i; // Looping var
|
||||
int count; // Number of selected files
|
||||
int fcount; // Number of selected files
|
||||
const char *filename; // Filename in input field or list
|
||||
char pathname[1024]; // Full path to file
|
||||
|
||||
@ -126,7 +126,7 @@ Fl_File_Chooser::count()
|
||||
return (strcmp(filename, directory_) != 0);
|
||||
}
|
||||
|
||||
for (i = 1, count = 0; i <= fileList->size(); i ++)
|
||||
for (i = 1, fcount = 0; i <= fileList->size(); i ++)
|
||||
if (fileList->selected(i))
|
||||
{
|
||||
// See if this file is a directory...
|
||||
@ -137,10 +137,10 @@ Fl_File_Chooser::count()
|
||||
strlcpy(pathname, filename, sizeof(pathname));
|
||||
|
||||
if (!fl_filename_isdir(pathname))
|
||||
count ++;
|
||||
fcount ++;
|
||||
}
|
||||
|
||||
return (count);
|
||||
return (fcount);
|
||||
}
|
||||
|
||||
|
||||
@ -209,19 +209,19 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
|
||||
void
|
||||
Fl_File_Chooser::favoritesButtonCB()
|
||||
{
|
||||
int value; // Current selection
|
||||
int v; // Current selection
|
||||
char pathname[1024], // Pathname
|
||||
menuname[2048]; // Menu name
|
||||
|
||||
|
||||
value = favoritesButton->value();
|
||||
v = favoritesButton->value();
|
||||
|
||||
if (!value) {
|
||||
if (!v) {
|
||||
// Add current directory to favorites...
|
||||
if (getenv("HOME")) value = favoritesButton->size() - 5;
|
||||
else value = favoritesButton->size() - 4;
|
||||
if (getenv("HOME")) v = favoritesButton->size() - 5;
|
||||
else v = favoritesButton->size() - 4;
|
||||
|
||||
sprintf(menuname, "favorite%02d", value);
|
||||
sprintf(menuname, "favorite%02d", v);
|
||||
|
||||
prefs_.set(menuname, directory_);
|
||||
|
||||
@ -231,14 +231,14 @@ Fl_File_Chooser::favoritesButtonCB()
|
||||
if (favoritesButton->size() > 104) {
|
||||
((Fl_Menu_Item *)favoritesButton->menu())[0].deactivate();
|
||||
}
|
||||
} else if (value == 1) {
|
||||
} else if (v == 1) {
|
||||
// Manage favorites...
|
||||
favoritesCB(0);
|
||||
} else if (value == 2) {
|
||||
} else if (v == 2) {
|
||||
// Filesystems/My Computer
|
||||
directory("");
|
||||
} else {
|
||||
unquote_pathname(pathname, favoritesButton->text(value), sizeof(pathname));
|
||||
unquote_pathname(pathname, favoritesButton->text(v), sizeof(pathname));
|
||||
directory(pathname);
|
||||
}
|
||||
}
|
||||
@ -986,7 +986,7 @@ const char * // O - Filename or NULL
|
||||
Fl_File_Chooser::value(int f) // I - File number
|
||||
{
|
||||
int i; // Looping var
|
||||
int count; // Number of selected files
|
||||
int fcount; // Number of selected files
|
||||
const char *name; // Current filename
|
||||
char *slash; // Trailing slash, if any
|
||||
static char pathname[1024]; // Filename + directory
|
||||
@ -1006,7 +1006,7 @@ Fl_File_Chooser::value(int f) // I - File number
|
||||
} else return name;
|
||||
}
|
||||
|
||||
for (i = 1, count = 0; i <= fileList->size(); i ++)
|
||||
for (i = 1, fcount = 0; i <= fileList->size(); i ++)
|
||||
if (fileList->selected(i)) {
|
||||
// See if this file is a directory...
|
||||
name = fileList->text(i);
|
||||
@ -1019,8 +1019,8 @@ Fl_File_Chooser::value(int f) // I - File number
|
||||
|
||||
if (!fl_filename_isdir(pathname)) {
|
||||
// Nope, see if this this is "the one"...
|
||||
count ++;
|
||||
if (count == f) return (pathname);
|
||||
fcount ++;
|
||||
if (fcount == f) return (pathname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1036,7 +1036,7 @@ void
|
||||
Fl_File_Chooser::value(const char *filename) // I - Filename + directory
|
||||
{
|
||||
int i, // Looping var
|
||||
count; // Number of items in list
|
||||
fcount; // Number of items in list
|
||||
char *slash; // Directory separator
|
||||
char pathname[1024]; // Local copy of filename
|
||||
|
||||
@ -1081,12 +1081,12 @@ Fl_File_Chooser::value(const char *filename) // I - Filename + directory
|
||||
okButton->activate();
|
||||
|
||||
// Then find the file in the file list and select it...
|
||||
count = fileList->size();
|
||||
fcount = fileList->size();
|
||||
|
||||
fileList->deselect(0);
|
||||
fileList->redraw();
|
||||
|
||||
for (i = 1; i <= count; i ++)
|
||||
for (i = 1; i <= fcount; i ++)
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
if (strcasecmp(fileList->text(i), slash) == 0) {
|
||||
#else
|
||||
@ -1143,5 +1143,5 @@ unquote_pathname(char *dst, // O - Destination string
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.22 2002/08/05 17:50:25 easysw Exp $".
|
||||
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.23 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_File_Icon2.cxx,v 1.1.2.15 2002/06/28 21:04:36 easysw Exp $"
|
||||
// "$Id: Fl_File_Icon2.cxx,v 1.1.2.16 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Fl_File_Icon system icon routines.
|
||||
//
|
||||
@ -777,9 +777,7 @@ load_kde_icons(const char *directory) // I - Directory to load
|
||||
{
|
||||
if (entries[i]->d_name[0] != '.')
|
||||
{
|
||||
strcpy(full, directory);
|
||||
strcat(full,"/");
|
||||
strcat(full, entries[i]->d_name);
|
||||
snprintf(full, sizeof(full), "%s/%s", directory, entries[i]->d_name);
|
||||
|
||||
if (fl_filename_isdir(full))
|
||||
load_kde_icons(full);
|
||||
@ -820,11 +818,11 @@ load_kde_mimelnk(const char *filename)
|
||||
while (fgets(tmp, sizeof(tmp), fp))
|
||||
{
|
||||
if ((val = get_kde_val(tmp, "Icon")) != NULL)
|
||||
strcpy(iconfilename, val);
|
||||
strlcpy(iconfilename, val, sizeof(iconfilename));
|
||||
else if ((val = get_kde_val(tmp, "MimeType")) != NULL)
|
||||
strcpy(mimetype, val);
|
||||
strlcpy(mimetype, val, sizeof(mimetype));
|
||||
else if ((val = get_kde_val(tmp, "Patterns")) != NULL)
|
||||
strcpy(pattern, val);
|
||||
strlcpy(pattern, val, sizeof(pattern));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@ -902,7 +900,7 @@ kde_to_fltk_pattern(const char *kdepattern)
|
||||
|
||||
pattern = (char *)malloc(strlen(kdepattern) + 3);
|
||||
strcpy(pattern, "{");
|
||||
strcat(pattern, kdepattern);
|
||||
strcpy(pattern + 1, kdepattern);
|
||||
|
||||
if (pattern[strlen(pattern) - 1] == ';')
|
||||
pattern[strlen(pattern) - 1] = '\0';
|
||||
@ -944,5 +942,5 @@ get_kde_val(char *str,
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.15 2002/06/28 21:04:36 easysw Exp $".
|
||||
// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.16 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_File_Input.cxx,v 1.1.2.5 2002/07/30 18:40:50 easysw Exp $"
|
||||
// "$Id: Fl_File_Input.cxx,v 1.1.2.6 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// File_Input header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -49,8 +49,8 @@
|
||||
// 'Fl_File_Input::Fl_File_Input()' - Create a Fl_File_Input widget.
|
||||
//
|
||||
|
||||
Fl_File_Input::Fl_File_Input(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Input(x, y, w, h, l) {
|
||||
Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Input(X, Y, W, H, l) {
|
||||
buttons_[0] = 0;
|
||||
errorcolor_ = FL_RED;
|
||||
ok_entry_ = 1;
|
||||
@ -270,5 +270,5 @@ Fl_File_Input::handle_button(int event) // I - Event
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.5 2002/07/30 18:40:50 easysw Exp $".
|
||||
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.6 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Font.H,v 1.6.2.3.2.2 2002/03/06 18:11:01 easysw Exp $"
|
||||
// "$Id: Fl_Font.H,v 1.6.2.3.2.3 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Font definitions for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -75,6 +75,7 @@ extern FL_EXPORT Fl_FontSize *fl_fontsize; // the currently selected one
|
||||
|
||||
struct Fl_Fontdesc {
|
||||
const char *name;
|
||||
char fontname[128]; // "Pretty" font name
|
||||
Fl_FontSize *first; // linked list of sizes of this style
|
||||
# ifndef WIN32
|
||||
char **xlist; // matched X font names
|
||||
@ -93,5 +94,5 @@ FL_EXPORT char *fl_find_fontsize(char *name);
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Font.H,v 1.6.2.3.2.2 2002/03/06 18:11:01 easysw Exp $".
|
||||
// End of "$Id: Fl_Font.H,v 1.6.2.3.2.3 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.17 2002/07/30 18:40:50 easysw Exp $"
|
||||
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.18 2002/08/09 01:09:48 easysw Exp $"
|
||||
//
|
||||
// Group widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -484,35 +484,35 @@ void Fl_Group::resize(int X, int Y, int W, int H) {
|
||||
for (int i=children_; i--;) {
|
||||
Fl_Widget* o = *a++;
|
||||
#if 1
|
||||
int X = *p++;
|
||||
if (X >= IR) X += dw;
|
||||
else if (X > IX) X = IX+((X-IX)*(IR+dw-IX)+(IR-IX)/2)/(IR-IX);
|
||||
int XX = *p++;
|
||||
if (XX >= IR) XX += dw;
|
||||
else if (XX > IX) XX = IX+((XX-IX)*(IR+dw-IX)+(IR-IX)/2)/(IR-IX);
|
||||
int R = *p++;
|
||||
if (R >= IR) R += dw;
|
||||
else if (R > IX) R = IX+((R-IX)*(IR+dw-IX)+(IR-IX)/2)/(IR-IX);
|
||||
|
||||
int Y = *p++;
|
||||
if (Y >= IB) Y += dh;
|
||||
else if (Y > IY) Y = IY+((Y-IY)*(IB+dh-IY)+(IB-IY)/2)/(IB-IY);
|
||||
int YY = *p++;
|
||||
if (YY >= IB) YY += dh;
|
||||
else if (YY > IY) YY = IY+((YY-IY)*(IB+dh-IY)+(IB-IY)/2)/(IB-IY);
|
||||
int B = *p++;
|
||||
if (B >= IB) B += dh;
|
||||
else if (B > IY) B = IY+((B-IY)*(IB+dh-IY)+(IB-IY)/2)/(IB-IY);
|
||||
#else // much simpler code from Francois Ostiguy:
|
||||
int X = *p++;
|
||||
if (X >= IR) X += dw;
|
||||
else if (X > IX) X = X + dw * (X-IX)/(IR-IX);
|
||||
int XX = *p++;
|
||||
if (XX >= IR) XX += dw;
|
||||
else if (XX > IX) XX += dw * (XX-IX)/(IR-IX);
|
||||
int R = *p++;
|
||||
if (R >= IR) R += dw;
|
||||
else if (R > IX) R = R + dw * (R-IX)/(IR-IX);
|
||||
|
||||
int Y = *p++;
|
||||
if (Y >= IB) Y += dh;
|
||||
else if (Y > IY) Y = Y + dh*(Y-IY)/(IB-IY);
|
||||
int YY = *p++;
|
||||
if (YY >= IB) YY += dh;
|
||||
else if (YY > IY) YY = YY + dh*(YY-IY)/(IB-IY);
|
||||
int B = *p++;
|
||||
if (B >= IB) B += dh;
|
||||
else if (B > IY) B = B + dh*(B-IY)/(IB-IY);
|
||||
#endif
|
||||
o->resize(X+dx, Y+dy, R-X, B-Y);
|
||||
o->resize(XX+dx, YY+dy, R-XX, B-YY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,57 +535,57 @@ void Fl_Group::draw() {
|
||||
}
|
||||
|
||||
// Draw a child only if it needs it:
|
||||
void Fl_Group::update_child(Fl_Widget& w) const {
|
||||
if (w.damage() && w.visible() && w.type() < FL_WINDOW &&
|
||||
fl_not_clipped(w.x(), w.y(), w.w(), w.h())) {
|
||||
w.draw();
|
||||
w.clear_damage();
|
||||
void Fl_Group::update_child(Fl_Widget& widget) const {
|
||||
if (widget.damage() && widget.visible() && widget.type() < FL_WINDOW &&
|
||||
fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
|
||||
widget.draw();
|
||||
widget.clear_damage();
|
||||
}
|
||||
}
|
||||
|
||||
// Force a child to redraw:
|
||||
void Fl_Group::draw_child(Fl_Widget& w) const {
|
||||
if (w.visible() && w.type() < FL_WINDOW &&
|
||||
fl_not_clipped(w.x(), w.y(), w.w(), w.h())) {
|
||||
w.clear_damage(FL_DAMAGE_ALL);
|
||||
w.draw();
|
||||
w.clear_damage();
|
||||
void Fl_Group::draw_child(Fl_Widget& widget) const {
|
||||
if (widget.visible() && widget.type() < FL_WINDOW &&
|
||||
fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
|
||||
widget.clear_damage(FL_DAMAGE_ALL);
|
||||
widget.draw();
|
||||
widget.clear_damage();
|
||||
}
|
||||
}
|
||||
|
||||
extern char fl_draw_shortcut;
|
||||
|
||||
// Parents normally call this to draw outside labels:
|
||||
void Fl_Group::draw_outside_label(const Fl_Widget& w) const {
|
||||
if (!w.visible()) return;
|
||||
void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
|
||||
if (!widget.visible()) return;
|
||||
// skip any labels that are inside the widget:
|
||||
if (!(w.align()&15) || (w.align() & FL_ALIGN_INSIDE)) return;
|
||||
if (!(widget.align()&15) || (widget.align() & FL_ALIGN_INSIDE)) return;
|
||||
// invent a box that is outside the widget:
|
||||
int align = w.align();
|
||||
int X = w.x();
|
||||
int Y = w.y();
|
||||
int W = w.w();
|
||||
int H = w.h();
|
||||
if (align & FL_ALIGN_TOP) {
|
||||
align ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
|
||||
int a = widget.align();
|
||||
int X = widget.x();
|
||||
int Y = widget.y();
|
||||
int W = widget.w();
|
||||
int H = widget.h();
|
||||
if (a & FL_ALIGN_TOP) {
|
||||
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
|
||||
Y = y();
|
||||
H = w.y()-Y;
|
||||
} else if (align & FL_ALIGN_BOTTOM) {
|
||||
align ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
|
||||
H = widget.y()-Y;
|
||||
} else if (a & FL_ALIGN_BOTTOM) {
|
||||
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
|
||||
Y = Y+H;
|
||||
H = y()+h()-Y;
|
||||
} else if (align & FL_ALIGN_LEFT) {
|
||||
align ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
|
||||
} else if (a & FL_ALIGN_LEFT) {
|
||||
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
|
||||
X = x();
|
||||
W = w.x()-X-3;
|
||||
} else if (align & FL_ALIGN_RIGHT) {
|
||||
align ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
|
||||
W = widget.x()-X-3;
|
||||
} else if (a & FL_ALIGN_RIGHT) {
|
||||
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
|
||||
X = X+W+3;
|
||||
W = x()+this->w()-X;
|
||||
}
|
||||
w.draw_label(X,Y,W,H,(Fl_Align)align);
|
||||
widget.draw_label(X,Y,W,H,(Fl_Align)a);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.17 2002/07/30 18:40:50 easysw Exp $".
|
||||
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.18 2002/08/09 01:09:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Help_View.cxx,v 1.1.2.37 2002/07/18 15:27:21 easysw Exp $"
|
||||
// "$Id: Fl_Help_View.cxx,v 1.1.2.38 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Fl_Help_View widget routines.
|
||||
//
|
||||
@ -322,7 +322,7 @@ Fl_Help_View::draw()
|
||||
attr[1024]; // Attribute buffer
|
||||
int xx, yy, ww, hh; // Current positions and sizes
|
||||
int line; // Current line
|
||||
unsigned char font, size; // Current font and size
|
||||
unsigned char font, fsize; // Current font and size
|
||||
int head, pre, // Flags for text
|
||||
needspace; // Do we need whitespace?
|
||||
Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
|
||||
@ -371,7 +371,7 @@ Fl_Help_View::draw()
|
||||
head = 0;
|
||||
needspace = 0;
|
||||
|
||||
initfont(font, size);
|
||||
initfont(font, fsize);
|
||||
|
||||
for (ptr = block->start, s = buf; ptr < block->end;)
|
||||
{
|
||||
@ -399,8 +399,8 @@ Fl_Help_View::draw()
|
||||
fl_draw(buf, xx + x() - leftline_, yy + y());
|
||||
|
||||
xx += ww;
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
needspace = 0;
|
||||
}
|
||||
@ -419,7 +419,7 @@ Fl_Help_View::draw()
|
||||
line ++;
|
||||
xx = block->line[line];
|
||||
yy += hh;
|
||||
hh = size + 2;
|
||||
hh = fsize + 2;
|
||||
}
|
||||
else if (*ptr == '\t')
|
||||
{
|
||||
@ -430,8 +430,8 @@ Fl_Help_View::draw()
|
||||
else
|
||||
*s++ = ' ';
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
@ -515,27 +515,27 @@ Fl_Help_View::draw()
|
||||
if (tolower(buf[0]) == 'h')
|
||||
{
|
||||
font = FL_HELVETICA_BOLD;
|
||||
size = textsize_ + '7' - buf[1];
|
||||
fsize = textsize_ + '7' - buf[1];
|
||||
}
|
||||
else if (strcasecmp(buf, "DT") == 0)
|
||||
{
|
||||
font = textfont_ | FL_ITALIC;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
else if (strcasecmp(buf, "PRE") == 0)
|
||||
{
|
||||
font = FL_COURIER;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
pre = 1;
|
||||
}
|
||||
|
||||
if (strcasecmp(buf, "LI") == 0)
|
||||
{
|
||||
fl_font(FL_SYMBOL, size);
|
||||
fl_draw("\267", xx - size + x() - leftline_, yy + y());
|
||||
fl_font(FL_SYMBOL, fsize);
|
||||
fl_draw("\267", xx - fsize + x() - leftline_, yy + y());
|
||||
}
|
||||
|
||||
pushfont(font, size);
|
||||
pushfont(font, fsize);
|
||||
}
|
||||
else if (strcasecmp(buf, "A") == 0 &&
|
||||
get_attr(attrs, "HREF", attr, sizeof(attr)) != NULL)
|
||||
@ -544,21 +544,21 @@ Fl_Help_View::draw()
|
||||
fl_color(textcolor_);
|
||||
else if (strcasecmp(buf, "B") == 0 ||
|
||||
strcasecmp(buf, "STRONG") == 0)
|
||||
pushfont(font |= FL_BOLD, size);
|
||||
pushfont(font |= FL_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "TD") == 0 ||
|
||||
strcasecmp(buf, "TH") == 0)
|
||||
{
|
||||
int tx, ty, tw, th;
|
||||
|
||||
if (tolower(buf[1]) == 'h')
|
||||
pushfont(font |= FL_BOLD, size);
|
||||
pushfont(font |= FL_BOLD, fsize);
|
||||
else
|
||||
pushfont(font = textfont_, size);
|
||||
pushfont(font = textfont_, fsize);
|
||||
|
||||
tx = block->x - 4 - leftline_;
|
||||
ty = block->y - topline_ - size - 3;
|
||||
ty = block->y - topline_ - fsize - 3;
|
||||
tw = block->w - block->x + 7;
|
||||
th = block->h + size - 5;
|
||||
th = block->h + fsize - 5;
|
||||
|
||||
if (tx < 0)
|
||||
{
|
||||
@ -587,14 +587,14 @@ Fl_Help_View::draw()
|
||||
}
|
||||
else if (strcasecmp(buf, "I") == 0 ||
|
||||
strcasecmp(buf, "EM") == 0)
|
||||
pushfont(font |= FL_ITALIC, size);
|
||||
pushfont(font |= FL_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "CODE") == 0 ||
|
||||
strcasecmp(buf, "TT") == 0)
|
||||
pushfont(font = FL_COURIER, size);
|
||||
pushfont(font = FL_COURIER, fsize);
|
||||
else if (strcasecmp(buf, "KBD") == 0)
|
||||
pushfont(font = FL_COURIER_BOLD, size);
|
||||
pushfont(font = FL_COURIER_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "VAR") == 0)
|
||||
pushfont(font = FL_COURIER_ITALIC, size);
|
||||
pushfont(font = FL_COURIER_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "/HEAD") == 0)
|
||||
head = 0;
|
||||
else if (strcasecmp(buf, "/H1") == 0 ||
|
||||
@ -611,10 +611,10 @@ Fl_Help_View::draw()
|
||||
strcasecmp(buf, "/TT") == 0 ||
|
||||
strcasecmp(buf, "/KBD") == 0 ||
|
||||
strcasecmp(buf, "/VAR") == 0)
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
else if (strcasecmp(buf, "/PRE") == 0)
|
||||
{
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
pre = 0;
|
||||
}
|
||||
else if (strcasecmp(buf, "IMG") == 0)
|
||||
@ -678,7 +678,7 @@ Fl_Help_View::draw()
|
||||
line ++;
|
||||
xx = block->line[line];
|
||||
yy += hh;
|
||||
hh = size + 2;
|
||||
hh = fsize + 2;
|
||||
needspace = 0;
|
||||
|
||||
ptr ++;
|
||||
@ -713,15 +713,15 @@ Fl_Help_View::draw()
|
||||
ptr = strchr(ptr, ';') + 1;
|
||||
}
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*s++ = *ptr++;
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -774,13 +774,13 @@ Fl_Help_View::format()
|
||||
attr[1024], // Attribute buffer
|
||||
wattr[1024], // Width attribute buffer
|
||||
hattr[1024], // Height attribute buffer
|
||||
link[1024]; // Link destination
|
||||
linkdest[1024]; // Link destination
|
||||
int xx, yy, ww, hh; // Size of current text fragment
|
||||
int line; // Current line in block
|
||||
int links; // Links for current line
|
||||
unsigned char font, size; // Current font and size
|
||||
unsigned char font, fsize; // Current font and size
|
||||
unsigned char border; // Draw border?
|
||||
int align, // Current alignment
|
||||
int talign, // Current alignment
|
||||
newalign, // New alignment
|
||||
head, // In the <HEAD> section?
|
||||
pre, // <PRE> text?
|
||||
@ -816,12 +816,12 @@ Fl_Help_View::format()
|
||||
return;
|
||||
|
||||
// Setup for formatting...
|
||||
initfont(font, size);
|
||||
initfont(font, fsize);
|
||||
|
||||
line = 0;
|
||||
links = 0;
|
||||
xx = 4;
|
||||
yy = size + 2;
|
||||
yy = fsize + 2;
|
||||
ww = 0;
|
||||
column = 0;
|
||||
border = 0;
|
||||
@ -830,10 +830,10 @@ Fl_Help_View::format()
|
||||
row = 0;
|
||||
head = 0;
|
||||
pre = 0;
|
||||
align = LEFT;
|
||||
talign = LEFT;
|
||||
newalign = LEFT;
|
||||
needspace = 0;
|
||||
link[0] = '\0';
|
||||
linkdest[0] = '\0';
|
||||
|
||||
for (ptr = value_, s = buf; *ptr;)
|
||||
{
|
||||
@ -867,24 +867,24 @@ Fl_Help_View::format()
|
||||
hh = 0;
|
||||
}
|
||||
|
||||
if (link[0])
|
||||
add_link(link, xx, yy - size, ww, size);
|
||||
if (linkdest[0])
|
||||
add_link(linkdest, xx, yy - fsize, ww, fsize);
|
||||
|
||||
xx += ww;
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
needspace = 0;
|
||||
}
|
||||
else if (pre)
|
||||
{
|
||||
// Add a link as needed...
|
||||
if (link[0])
|
||||
add_link(link, xx, yy - hh, ww, hh);
|
||||
if (linkdest[0])
|
||||
add_link(linkdest, xx, yy - hh, ww, hh);
|
||||
|
||||
xx += ww;
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
// Handle preformatted text...
|
||||
while (isspace(*ptr))
|
||||
@ -897,13 +897,13 @@ Fl_Help_View::format()
|
||||
xx = block->x;
|
||||
yy += hh;
|
||||
block->h += hh;
|
||||
hh = size + 2;
|
||||
hh = fsize + 2;
|
||||
}
|
||||
else
|
||||
xx += (int)fl_width(' ');
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
@ -965,13 +965,13 @@ Fl_Help_View::format()
|
||||
else if (strcasecmp(buf, "A") == 0)
|
||||
{
|
||||
if (get_attr(attrs, "NAME", attr, sizeof(attr)) != NULL)
|
||||
add_target(attr, yy - size - 2);
|
||||
add_target(attr, yy - fsize - 2);
|
||||
|
||||
if (get_attr(attrs, "HREF", attr, sizeof(attr)) != NULL)
|
||||
strlcpy(link, attr, sizeof(link));
|
||||
strlcpy(linkdest, attr, sizeof(linkdest));
|
||||
}
|
||||
else if (strcasecmp(buf, "/A") == 0)
|
||||
link[0] = '\0';
|
||||
linkdest[0] = '\0';
|
||||
else if (strcasecmp(buf, "BODY") == 0)
|
||||
{
|
||||
bgcolor_ = get_color(get_attr(attrs, "BGCOLOR", attr, sizeof(attr)),
|
||||
@ -1016,8 +1016,8 @@ Fl_Help_View::format()
|
||||
strcasecmp(buf, "OL") == 0 ||
|
||||
strcasecmp(buf, "DL") == 0)
|
||||
{
|
||||
block->h += size + 2;
|
||||
xx += 4 * size;
|
||||
block->h += fsize + 2;
|
||||
xx += 4 * fsize;
|
||||
}
|
||||
else if (strcasecmp(buf, "TABLE") == 0)
|
||||
{
|
||||
@ -1028,7 +1028,7 @@ Fl_Help_View::format()
|
||||
|
||||
tc = rc = get_color(get_attr(attrs, "BGCOLOR", attr, sizeof(attr)), bgcolor_);
|
||||
|
||||
block->h += size + 2;
|
||||
block->h += fsize + 2;
|
||||
|
||||
format_table(&table_width, columns, start);
|
||||
|
||||
@ -1044,26 +1044,26 @@ Fl_Help_View::format()
|
||||
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
|
||||
{
|
||||
font = FL_HELVETICA_BOLD;
|
||||
size = textsize_ + '7' - buf[1];
|
||||
fsize = textsize_ + '7' - buf[1];
|
||||
}
|
||||
else if (strcasecmp(buf, "DT") == 0)
|
||||
{
|
||||
font = textfont_ | FL_ITALIC;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
else if (strcasecmp(buf, "PRE") == 0)
|
||||
{
|
||||
font = FL_COURIER;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
pre = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
font = textfont_;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
|
||||
pushfont(font, size);
|
||||
pushfont(font, fsize);
|
||||
|
||||
yy = block->y + block->h;
|
||||
hh = 0;
|
||||
@ -1072,11 +1072,11 @@ Fl_Help_View::format()
|
||||
strcasecmp(buf, "DD") == 0 ||
|
||||
strcasecmp(buf, "DT") == 0 ||
|
||||
strcasecmp(buf, "P") == 0)
|
||||
yy += size + 2;
|
||||
yy += fsize + 2;
|
||||
else if (strcasecmp(buf, "HR") == 0)
|
||||
{
|
||||
hh += 2 * size;
|
||||
yy += size;
|
||||
hh += 2 * fsize;
|
||||
yy += fsize;
|
||||
}
|
||||
|
||||
if (row)
|
||||
@ -1088,9 +1088,9 @@ Fl_Help_View::format()
|
||||
line = 0;
|
||||
|
||||
if (strcasecmp(buf, "CENTER") == 0)
|
||||
newalign = align = CENTER;
|
||||
newalign = talign = CENTER;
|
||||
else
|
||||
newalign = get_align(attrs, align);
|
||||
newalign = get_align(attrs, talign);
|
||||
}
|
||||
else if (strcasecmp(buf, "/CENTER") == 0 ||
|
||||
strcasecmp(buf, "/P") == 0 ||
|
||||
@ -1114,20 +1114,20 @@ Fl_Help_View::format()
|
||||
strcasecmp(buf, "/OL") == 0 ||
|
||||
strcasecmp(buf, "/DL") == 0)
|
||||
{
|
||||
xx -= 4 * size;
|
||||
block->h += size + 2;
|
||||
xx -= 4 * fsize;
|
||||
block->h += fsize + 2;
|
||||
}
|
||||
else if (strcasecmp(buf, "/TABLE") == 0)
|
||||
block->h += size + 2;
|
||||
block->h += fsize + 2;
|
||||
else if (strcasecmp(buf, "/PRE") == 0)
|
||||
{
|
||||
pre = 0;
|
||||
hh = 0;
|
||||
}
|
||||
else if (strcasecmp(buf, "/CENTER") == 0)
|
||||
align = LEFT;
|
||||
talign = LEFT;
|
||||
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
|
||||
while (isspace(*ptr))
|
||||
ptr ++;
|
||||
@ -1136,7 +1136,7 @@ Fl_Help_View::format()
|
||||
yy += hh;
|
||||
|
||||
if (tolower(buf[2]) == 'l')
|
||||
yy += size + 2;
|
||||
yy += fsize + 2;
|
||||
|
||||
if (row)
|
||||
block = add_block(ptr, xx, yy, block->w, 0);
|
||||
@ -1146,7 +1146,7 @@ Fl_Help_View::format()
|
||||
needspace = 0;
|
||||
hh = 0;
|
||||
line = 0;
|
||||
newalign = align;
|
||||
newalign = talign;
|
||||
}
|
||||
else if (strcasecmp(buf, "TR") == 0)
|
||||
{
|
||||
@ -1233,9 +1233,9 @@ Fl_Help_View::format()
|
||||
else
|
||||
font = textfont_;
|
||||
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
|
||||
xx = blocks_[row].x + size + 3;
|
||||
xx = blocks_[row].x + fsize + 3;
|
||||
for (i = 0; i < column; i ++)
|
||||
xx += columns[i] + 6;
|
||||
|
||||
@ -1253,7 +1253,7 @@ Fl_Help_View::format()
|
||||
block --;
|
||||
}
|
||||
|
||||
pushfont(font, size);
|
||||
pushfont(font, fsize);
|
||||
|
||||
yy = blocks_[row].y;
|
||||
hh = 0;
|
||||
@ -1272,21 +1272,21 @@ Fl_Help_View::format()
|
||||
else if ((strcasecmp(buf, "/TD") == 0 ||
|
||||
strcasecmp(buf, "/TH") == 0) && row)
|
||||
{
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
}
|
||||
else if (strcasecmp(buf, "B") == 0 ||
|
||||
strcasecmp(buf, "STRONG") == 0)
|
||||
pushfont(font |= FL_BOLD, size);
|
||||
pushfont(font |= FL_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "I") == 0 ||
|
||||
strcasecmp(buf, "EM") == 0)
|
||||
pushfont(font |= FL_ITALIC, size);
|
||||
pushfont(font |= FL_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "CODE") == 0 ||
|
||||
strcasecmp(buf, "TT") == 0)
|
||||
pushfont(font = FL_COURIER, size);
|
||||
pushfont(font = FL_COURIER, fsize);
|
||||
else if (strcasecmp(buf, "KBD") == 0)
|
||||
pushfont(font = FL_COURIER_BOLD, size);
|
||||
pushfont(font = FL_COURIER_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "VAR") == 0)
|
||||
pushfont(font = FL_COURIER_ITALIC, size);
|
||||
pushfont(font = FL_COURIER_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "/B") == 0 ||
|
||||
strcasecmp(buf, "/STRONG") == 0 ||
|
||||
strcasecmp(buf, "/I") == 0 ||
|
||||
@ -1295,7 +1295,7 @@ Fl_Help_View::format()
|
||||
strcasecmp(buf, "/TT") == 0 ||
|
||||
strcasecmp(buf, "/KBD") == 0 ||
|
||||
strcasecmp(buf, "/VAR") == 0)
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
else if (strcasecmp(buf, "IMG") == 0)
|
||||
{
|
||||
Fl_Shared_Image *img = 0;
|
||||
@ -1334,8 +1334,8 @@ Fl_Help_View::format()
|
||||
hh = 0;
|
||||
}
|
||||
|
||||
if (link[0])
|
||||
add_link(link, xx, yy - height, ww, height);
|
||||
if (linkdest[0])
|
||||
add_link(linkdest, xx, yy - height, ww, height);
|
||||
|
||||
xx += ww;
|
||||
if ((height + 2) > hh)
|
||||
@ -1346,8 +1346,8 @@ Fl_Help_View::format()
|
||||
}
|
||||
else if (*ptr == '\n' && pre)
|
||||
{
|
||||
if (link[0])
|
||||
add_link(link, xx, yy - hh, ww, hh);
|
||||
if (linkdest[0])
|
||||
add_link(linkdest, xx, yy - hh, ww, hh);
|
||||
|
||||
if (xx > hsize_) {
|
||||
hsize_ = xx;
|
||||
@ -1381,8 +1381,8 @@ Fl_Help_View::format()
|
||||
ptr = strchr(ptr, ';') + 1;
|
||||
}
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1391,8 +1391,8 @@ Fl_Help_View::format()
|
||||
else
|
||||
ptr ++;
|
||||
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1422,12 +1422,12 @@ Fl_Help_View::format()
|
||||
hh = 0;
|
||||
}
|
||||
|
||||
if (link[0])
|
||||
add_link(link, xx, yy - size, ww, size);
|
||||
if (linkdest[0])
|
||||
add_link(linkdest, xx, yy - fsize, ww, fsize);
|
||||
|
||||
xx += ww;
|
||||
if ((size + 2) > hh)
|
||||
hh = size + 2;
|
||||
if ((fsize + 2) > hh)
|
||||
hh = fsize + 2;
|
||||
|
||||
needspace = 0;
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
*attrs, // Pointer to attributes
|
||||
*start; // Start of element
|
||||
int minwidths[MAX_COLUMNS]; // Minimum widths for each column
|
||||
unsigned char font, size; // Current font and size
|
||||
unsigned char font, fsize; // Current font and size
|
||||
|
||||
|
||||
// Clear widths...
|
||||
@ -1585,32 +1585,32 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
|
||||
{
|
||||
font = FL_HELVETICA_BOLD;
|
||||
size = textsize_ + '7' - buf[1];
|
||||
fsize = textsize_ + '7' - buf[1];
|
||||
}
|
||||
else if (strcasecmp(buf, "DT") == 0)
|
||||
{
|
||||
font = textfont_ | FL_ITALIC;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
else if (strcasecmp(buf, "PRE") == 0)
|
||||
{
|
||||
font = FL_COURIER;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
pre = 1;
|
||||
}
|
||||
else if (strcasecmp(buf, "LI") == 0)
|
||||
{
|
||||
width += 4 * size;
|
||||
width += 4 * fsize;
|
||||
font = textfont_;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
else
|
||||
{
|
||||
font = textfont_;
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
}
|
||||
|
||||
pushfont(font, size);
|
||||
pushfont(font, fsize);
|
||||
}
|
||||
else if (strcasecmp(buf, "/CENTER") == 0 ||
|
||||
strcasecmp(buf, "/P") == 0 ||
|
||||
@ -1628,7 +1628,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
width = 0;
|
||||
needspace = 0;
|
||||
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
}
|
||||
else if (strcasecmp(buf, "TR") == 0 || strcasecmp(buf, "/TR") == 0 ||
|
||||
strcasecmp(buf, "/TABLE") == 0)
|
||||
@ -1703,9 +1703,9 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
else
|
||||
font = textfont_;
|
||||
|
||||
size = textsize_;
|
||||
fsize = textsize_;
|
||||
|
||||
pushfont(font, size);
|
||||
pushfont(font, fsize);
|
||||
|
||||
if (get_attr(attrs, "WIDTH", attr, sizeof(attr)) != NULL)
|
||||
max_width = get_length(attr);
|
||||
@ -1718,21 +1718,21 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
strcasecmp(buf, "/TH") == 0)
|
||||
{
|
||||
incell = 0;
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
}
|
||||
else if (strcasecmp(buf, "B") == 0 ||
|
||||
strcasecmp(buf, "STRONG") == 0)
|
||||
pushfont(font |= FL_BOLD, size);
|
||||
pushfont(font |= FL_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "I") == 0 ||
|
||||
strcasecmp(buf, "EM") == 0)
|
||||
pushfont(font |= FL_ITALIC, size);
|
||||
pushfont(font |= FL_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "CODE") == 0 ||
|
||||
strcasecmp(buf, "TT") == 0)
|
||||
pushfont(font = FL_COURIER, size);
|
||||
pushfont(font = FL_COURIER, fsize);
|
||||
else if (strcasecmp(buf, "KBD") == 0)
|
||||
pushfont(font = FL_COURIER_BOLD, size);
|
||||
pushfont(font = FL_COURIER_BOLD, fsize);
|
||||
else if (strcasecmp(buf, "VAR") == 0)
|
||||
pushfont(font = FL_COURIER_ITALIC, size);
|
||||
pushfont(font = FL_COURIER_ITALIC, fsize);
|
||||
else if (strcasecmp(buf, "/B") == 0 ||
|
||||
strcasecmp(buf, "/STRONG") == 0 ||
|
||||
strcasecmp(buf, "/I") == 0 ||
|
||||
@ -1741,7 +1741,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
|
||||
strcasecmp(buf, "/TT") == 0 ||
|
||||
strcasecmp(buf, "/KBD") == 0 ||
|
||||
strcasecmp(buf, "/VAR") == 0)
|
||||
popfont(font, size);
|
||||
popfont(font, fsize);
|
||||
else if (strcasecmp(buf, "IMG") == 0 && incell)
|
||||
{
|
||||
Fl_Shared_Image *img = 0;
|
||||
@ -2042,18 +2042,24 @@ Fl_Help_View::get_image(const char *name, int W, int H) {
|
||||
// See if the image can be found...
|
||||
if (strchr(directory_, ':') != NULL && strchr(name, ':') == NULL) {
|
||||
if (name[0] == '/') {
|
||||
strcpy(temp, directory_);
|
||||
if ((tempptr = strrchr(strchr(directory_, ':') + 3, '/')) != NULL) strcpy(tempptr, name);
|
||||
else strcat(temp, name);
|
||||
} else sprintf(temp, "%s/%s", directory_, name);
|
||||
strlcpy(temp, directory_, sizeof(temp));
|
||||
|
||||
if ((tempptr = strrchr(strchr(directory_, ':') + 3, '/')) != NULL) {
|
||||
strlcpy(tempptr, name, sizeof(temp) - (tempptr - temp));
|
||||
} else {
|
||||
strlcat(temp, name, sizeof(temp));
|
||||
}
|
||||
} else {
|
||||
snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
|
||||
}
|
||||
|
||||
if (link_) localname = (*link_)(this, temp);
|
||||
else localname = temp;
|
||||
} else if (name[0] != '/' && strchr(name, ':') == NULL) {
|
||||
if (directory_[0]) sprintf(temp, "%s/%s", directory_, name);
|
||||
if (directory_[0]) snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
|
||||
else {
|
||||
getcwd(dir, sizeof(dir));
|
||||
sprintf(temp, "file:%s/%s", dir, name);
|
||||
snprintf(temp, sizeof(temp), "file:%s/%s", dir, name);
|
||||
}
|
||||
|
||||
if (link_) localname = (*link_)(this, temp);
|
||||
@ -2103,7 +2109,7 @@ Fl_Help_View::handle(int event) // I - Event to handle
|
||||
{
|
||||
int i; // Looping var
|
||||
int xx, yy; // Adjusted mouse position
|
||||
Fl_Help_Link *link; // Current link
|
||||
Fl_Help_Link *linkp; // Current link
|
||||
char target[32]; // Current target
|
||||
|
||||
|
||||
@ -2126,9 +2132,9 @@ Fl_Help_View::handle(int event) // I - Event to handle
|
||||
}
|
||||
|
||||
// Handle mouse clicks on links...
|
||||
for (i = nlinks_, link = links_; i > 0; i --, link ++)
|
||||
if (xx >= link->x && xx < link->w &&
|
||||
yy >= link->y && yy < link->h)
|
||||
for (i = nlinks_, linkp = links_; i > 0; i --, linkp ++)
|
||||
if (xx >= linkp->x && xx < linkp->w &&
|
||||
yy >= linkp->y && yy < linkp->h)
|
||||
break;
|
||||
|
||||
if (!i)
|
||||
@ -2145,11 +2151,11 @@ Fl_Help_View::handle(int event) // I - Event to handle
|
||||
{
|
||||
fl_cursor(FL_CURSOR_DEFAULT);
|
||||
|
||||
strlcpy(target, link->name, sizeof(target));
|
||||
strlcpy(target, linkp->name, sizeof(target));
|
||||
|
||||
set_changed();
|
||||
|
||||
if (strcmp(link->filename, filename_) != 0 && link->filename[0])
|
||||
if (strcmp(linkp->filename, filename_) != 0 && linkp->filename[0])
|
||||
{
|
||||
char dir[1024]; // Current directory
|
||||
char temp[1024], // Temporary filename
|
||||
@ -2157,34 +2163,35 @@ Fl_Help_View::handle(int event) // I - Event to handle
|
||||
|
||||
|
||||
if (strchr(directory_, ':') != NULL &&
|
||||
strchr(link->filename, ':') == NULL)
|
||||
strchr(linkp->filename, ':') == NULL)
|
||||
{
|
||||
if (link->filename[0] == '/')
|
||||
if (linkp->filename[0] == '/')
|
||||
{
|
||||
strcpy(temp, directory_);
|
||||
strlcpy(temp, directory_, sizeof(temp));
|
||||
if ((tempptr = strrchr(strchr(directory_, ':') + 3, '/')) != NULL)
|
||||
strcpy(tempptr, link->filename);
|
||||
strlcpy(tempptr, linkp->filename, sizeof(temp));
|
||||
else
|
||||
strcat(temp, link->filename);
|
||||
strlcat(temp, linkp->filename, sizeof(temp));
|
||||
}
|
||||
else
|
||||
sprintf(temp, "%s/%s", directory_, link->filename);
|
||||
snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
|
||||
}
|
||||
else if (link->filename[0] != '/' && strchr(link->filename, ':') == NULL)
|
||||
else if (linkp->filename[0] != '/' && strchr(linkp->filename, ':') == NULL)
|
||||
{
|
||||
if (directory_[0])
|
||||
sprintf(temp, "%s/%s", directory_, link->filename);
|
||||
snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
|
||||
else
|
||||
{
|
||||
getcwd(dir, sizeof(dir));
|
||||
sprintf(temp, "file:%s/%s", dir, link->filename);
|
||||
snprintf(temp, sizeof(temp), "file:%s/%s", dir, linkp->filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
strcpy(temp, link->filename);
|
||||
strlcpy(temp, linkp->filename, sizeof(temp));
|
||||
|
||||
if (link->name[0])
|
||||
sprintf(temp + strlen(temp), "#%s", link->name);
|
||||
if (linkp->name[0])
|
||||
snprintf(temp + strlen(temp), sizeof(temp) - strlen(temp), "#%s",
|
||||
linkp->name);
|
||||
|
||||
load(temp);
|
||||
}
|
||||
@ -2641,5 +2648,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.37 2002/07/18 15:27:21 easysw Exp $".
|
||||
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.38 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.22 2002/08/05 17:50:25 easysw Exp $"
|
||||
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.23 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Image drawing code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -67,8 +67,8 @@ void Fl_Image::color_average(Fl_Color, float) {
|
||||
void Fl_Image::desaturate() {
|
||||
}
|
||||
|
||||
void Fl_Image::label(Fl_Widget* w) {
|
||||
w->image(this);
|
||||
void Fl_Image::label(Fl_Widget* widget) {
|
||||
widget->image(this);
|
||||
}
|
||||
|
||||
void Fl_Image::label(Fl_Menu_Item* m) {
|
||||
@ -380,8 +380,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fl_RGB_Image::label(Fl_Widget* w) {
|
||||
w->image(this);
|
||||
void Fl_RGB_Image::label(Fl_Widget* widget) {
|
||||
widget->image(this);
|
||||
}
|
||||
|
||||
void Fl_RGB_Image::label(Fl_Menu_Item* m) {
|
||||
@ -391,5 +391,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.22 2002/08/05 17:50:25 easysw Exp $".
|
||||
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.23 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Input.cxx,v 1.10.2.15.2.12 2002/07/20 05:56:44 easysw Exp $"
|
||||
// "$Id: Fl_Input.cxx,v 1.10.2.15.2.13 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Input widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -388,10 +388,10 @@ int Fl_Input::handle(int event) {
|
||||
w()-Fl::box_dw(b), h()-Fl::box_dh(b));
|
||||
}
|
||||
|
||||
Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Input_(x, y, w, h, l) {
|
||||
Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l)
|
||||
: Fl_Input_(X, Y, W, H, l) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.12 2002/07/20 05:56:44 easysw Exp $".
|
||||
// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.13 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.19 2002/07/30 18:40:50 easysw Exp $"
|
||||
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.20 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Common input widget routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -749,8 +749,8 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
||||
|
||||
/*------------------------------*/
|
||||
|
||||
Fl_Input_::Fl_Input_(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Widget(x, y, w, h, l) {
|
||||
Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Widget(X, Y, W, H, l) {
|
||||
box(FL_DOWN_BOX);
|
||||
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
|
||||
align(FL_ALIGN_LEFT);
|
||||
@ -848,5 +848,5 @@ Fl_Input_::~Fl_Input_() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.19 2002/07/30 18:40:50 easysw Exp $".
|
||||
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.20 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.19 2002/07/24 12:16:57 easysw Exp $"
|
||||
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.20 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Lighted button widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -134,13 +134,13 @@ int Fl_Light_Button::handle(int event) {
|
||||
}
|
||||
}
|
||||
|
||||
Fl_Light_Button::Fl_Light_Button(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Button(x, y, w, h, l) {
|
||||
Fl_Light_Button::Fl_Light_Button(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Button(X, Y, W, H, l) {
|
||||
type(FL_TOGGLE_BUTTON);
|
||||
selection_color(FL_YELLOW);
|
||||
align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.19 2002/07/24 12:16:57 easysw Exp $".
|
||||
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.20 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
218
src/Fl_Menu.cxx
218
src/Fl_Menu.cxx
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.16 2002/07/24 12:16:57 easysw Exp $"
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.17 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Menu code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -266,8 +266,8 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
|
||||
if (t) Wtitle = t->measure(&Htitle, button) + 12;
|
||||
int W = 0;
|
||||
if (m) for (; m->text; m = m->next()) {
|
||||
int h; int w1 = m->measure(&h, button);
|
||||
if (h+LEADING>itemheight) itemheight = h+LEADING;
|
||||
int hh; int w1 = m->measure(&hh, button);
|
||||
if (hh+LEADING>itemheight) itemheight = hh+LEADING;
|
||||
if (m->flags&(FL_SUBMENU|FL_SUBMENU_POINTER)) w1 += 14;
|
||||
if (w1 > W) W = w1;
|
||||
if (m->shortcut_) {
|
||||
@ -324,42 +324,41 @@ void menuwindow::autoscroll(int n) {
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int erase) {
|
||||
void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int eraseit) {
|
||||
if (!m) return; // this happens if -1 is selected item and redrawn
|
||||
|
||||
int BW = Fl::box_dx(box());
|
||||
int x = BW;
|
||||
int W = this->w();
|
||||
int w = W-2*BW-1;
|
||||
int y = BW+1+n*itemheight;
|
||||
int h = itemheight - LEADING;
|
||||
int xx = BW;
|
||||
int W = w();
|
||||
int ww = W-2*BW-1;
|
||||
int yy = BW+1+n*itemheight;
|
||||
int hh = itemheight - LEADING;
|
||||
|
||||
if (erase && n != selected) {
|
||||
if (eraseit && n != selected) {
|
||||
fl_color(button && !Fl::scheme() ? button->color() : FL_GRAY);
|
||||
fl_rectf(x+1, y-(LEADING-2)/2, w-2, h+(LEADING-2));
|
||||
fl_rectf(xx+1, yy-(LEADING-2)/2, ww-2, hh+(LEADING-2));
|
||||
}
|
||||
|
||||
m->draw(x, y, w, h, button, n==selected);
|
||||
m->draw(xx, yy, ww, hh, button, n==selected);
|
||||
|
||||
// the shortcuts and arrows assumme fl_color() was left set by draw():
|
||||
if (m->submenu()) {
|
||||
int sz = (h-5)&-2;
|
||||
int y1 = y+(h-sz)/2;
|
||||
int x1 = x+w-sz-3;
|
||||
int sz = (hh-5)&-2;
|
||||
int y1 = yy+(hh-sz)/2;
|
||||
int x1 = xx+ww-sz-3;
|
||||
fl_polygon(x1, y1, x1, y1+sz, x1+sz, y1+sz/2);
|
||||
} else if (m->shortcut_) {
|
||||
Fl_Font f = button ? button->textfont() : FL_HELVETICA;
|
||||
fl_font(f, button ? button->textsize() : FL_NORMAL_SIZE);
|
||||
fl_draw(fl_shortcut_label(m->shortcut_), x, y, w-3, h, FL_ALIGN_RIGHT);
|
||||
fl_draw(fl_shortcut_label(m->shortcut_), xx, yy, ww-3, hh, FL_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
if (m->flags & FL_MENU_DIVIDER) {
|
||||
fl_color(FL_DARK3);
|
||||
fl_xyline(BW-1, y+h+(LEADING-2)/2, W-2*BW+2);
|
||||
fl_xyline(BW-1, yy+hh+(LEADING-2)/2, W-2*BW+2);
|
||||
fl_color(FL_LIGHT3);
|
||||
fl_xyline(BW-1, y+h+((LEADING-2)/2+1), W-2*BW+2);
|
||||
fl_xyline(BW-1, yy+hh+((LEADING-2)/2+1), W-2*BW+2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void menutitle::draw() {
|
||||
@ -367,7 +366,6 @@ void menutitle::draw() {
|
||||
}
|
||||
|
||||
void menuwindow::draw() {
|
||||
|
||||
if (damage() != FL_DAMAGE_CHILD) { // complete redraw
|
||||
fl_draw_box(box(), 0, 0, w(), h(), color());
|
||||
if (menu) {
|
||||
@ -395,12 +393,12 @@ int menuwindow::find_selected(int mx, int my) {
|
||||
my -= y();
|
||||
if (my < 0 || my >= h()) return -1;
|
||||
if (!itemheight) { // menubar
|
||||
int x = 3; int n = 0;
|
||||
int xx = 3; int n = 0;
|
||||
const Fl_Menu_Item* m = menu;
|
||||
for (; ; m = m->next(), n++) {
|
||||
if (!m->text) return -1;
|
||||
x += m->measure(0, button) + 16;
|
||||
if (x > mx) break;
|
||||
xx += m->measure(0, button) + 16;
|
||||
if (xx > mx) break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@ -413,9 +411,9 @@ int menuwindow::find_selected(int mx, int my) {
|
||||
// return horizontal position for item n in a menubar:
|
||||
int menuwindow::titlex(int n) {
|
||||
const Fl_Menu_Item* m;
|
||||
int x = 3;
|
||||
for (m=menu; n--; m = m->next()) x += m->measure(0, button) + 16;
|
||||
return x;
|
||||
int xx = 3;
|
||||
for (m=menu; n--; m = m->next()) xx += m->measure(0, button) + 16;
|
||||
return xx;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@ -458,16 +456,16 @@ static inline void setitem(const Fl_Menu_Item* i, int m, int n) {
|
||||
}
|
||||
|
||||
static void setitem(int m, int n) {
|
||||
menustate &p = *(::p);
|
||||
p.current_item = (n >= 0) ? p.p[m]->menu->next(n) : 0;
|
||||
p.menu_number = m;
|
||||
p.item_number = n;
|
||||
menustate &pp = *p;
|
||||
pp.current_item = (n >= 0) ? pp.p[m]->menu->next(n) : 0;
|
||||
pp.menu_number = m;
|
||||
pp.item_number = n;
|
||||
}
|
||||
|
||||
static int forward(int menu) { // go to next item in menu menu if possible
|
||||
menustate &p = *(::p);
|
||||
menuwindow &m = *(p.p[menu]);
|
||||
int item = (menu == p.menu_number) ? p.item_number : m.selected;
|
||||
menustate &pp = *p;
|
||||
menuwindow &m = *(pp.p[menu]);
|
||||
int item = (menu == pp.menu_number) ? pp.item_number : m.selected;
|
||||
while (++item < m.numitems) {
|
||||
const Fl_Menu_Item* m1 = m.menu->next(item);
|
||||
if (m1->activevisible()) {setitem(m1, menu, item); return 1;}
|
||||
@ -476,9 +474,9 @@ static int forward(int menu) { // go to next item in menu menu if possible
|
||||
}
|
||||
|
||||
static int backward(int menu) { // previous item in menu menu if possible
|
||||
menustate &p = *(::p);
|
||||
menuwindow &m = *(p.p[menu]);
|
||||
int item = (menu == p.menu_number) ? p.item_number : m.selected;
|
||||
menustate &pp = *p;
|
||||
menuwindow &m = *(pp.p[menu]);
|
||||
int item = (menu == pp.menu_number) ? pp.item_number : m.selected;
|
||||
if (item < 0) item = m.numitems;
|
||||
while (--item >= 0) {
|
||||
const Fl_Menu_Item* m1 = m.menu->next(item);
|
||||
@ -488,7 +486,7 @@ static int backward(int menu) { // previous item in menu menu if possible
|
||||
}
|
||||
|
||||
int menuwindow::handle(int e) {
|
||||
menustate &p = *(::p);
|
||||
menustate &pp = *p;
|
||||
switch (e) {
|
||||
case FL_KEYBOARD:
|
||||
switch (Fl::event_key()) {
|
||||
@ -497,44 +495,44 @@ int menuwindow::handle(int e) {
|
||||
case FL_BackSpace:
|
||||
case 0xFE20: // backtab
|
||||
BACKTAB:
|
||||
if (!backward(p.menu_number)) {p.item_number = -1;backward(p.menu_number);}
|
||||
if (!backward(pp.menu_number)) {pp.item_number = -1;backward(pp.menu_number);}
|
||||
return 1;
|
||||
case FL_Up:
|
||||
if (p.menubar && p.menu_number == 0) ;
|
||||
else if (backward(p.menu_number));
|
||||
else if (p.menubar && p.menu_number==1) setitem(0, p.p[0]->selected);
|
||||
if (pp.menubar && pp.menu_number == 0) ;
|
||||
else if (backward(pp.menu_number));
|
||||
else if (pp.menubar && pp.menu_number==1) setitem(0, pp.p[0]->selected);
|
||||
return 1;
|
||||
case FL_Down:
|
||||
if (p.menu_number || !p.menubar) forward(p.menu_number);
|
||||
else if (p.menu_number < p.nummenus-1) forward(p.menu_number+1);
|
||||
if (pp.menu_number || !pp.menubar) forward(pp.menu_number);
|
||||
else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
|
||||
return 1;
|
||||
case FL_Right:
|
||||
if (p.menubar && (p.menu_number<=0 || p.menu_number==1 && p.nummenus==2))
|
||||
if (pp.menubar && (pp.menu_number<=0 || pp.menu_number==1 && pp.nummenus==2))
|
||||
forward(0);
|
||||
else if (p.menu_number < p.nummenus-1) forward(p.menu_number+1);
|
||||
else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
|
||||
return 1;
|
||||
case FL_Left:
|
||||
if (p.menubar && p.menu_number<=1) backward(0);
|
||||
else if (p.menu_number>0)
|
||||
setitem(p.menu_number-1, p.p[p.menu_number-1]->selected);
|
||||
if (pp.menubar && pp.menu_number<=1) backward(0);
|
||||
else if (pp.menu_number>0)
|
||||
setitem(pp.menu_number-1, pp.p[pp.menu_number-1]->selected);
|
||||
return 1;
|
||||
case FL_Enter:
|
||||
case ' ':
|
||||
p.state = DONE_STATE;
|
||||
pp.state = DONE_STATE;
|
||||
return 1;
|
||||
case FL_Escape:
|
||||
setitem(0, -1, 0);
|
||||
p.state = DONE_STATE;
|
||||
pp.state = DONE_STATE;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case FL_SHORTCUT: {
|
||||
for (int mymenu = p.nummenus; mymenu--;) {
|
||||
menuwindow &mw = *(p.p[mymenu]);
|
||||
for (int mymenu = pp.nummenus; mymenu--;) {
|
||||
menuwindow &mw = *(pp.p[mymenu]);
|
||||
int item; const Fl_Menu_Item* m = mw.menu->find_shortcut(&item);
|
||||
if (m) {
|
||||
setitem(m, mymenu, item);
|
||||
if (!m->submenu()) p.state = DONE_STATE;
|
||||
if (!m->submenu()) pp.state = DONE_STATE;
|
||||
return 1;
|
||||
}
|
||||
}} break;
|
||||
@ -545,36 +543,36 @@ int menuwindow::handle(int e) {
|
||||
int mx = Fl::event_x_root();
|
||||
int my = Fl::event_y_root();
|
||||
int item=0; int mymenu;
|
||||
for (mymenu = p.nummenus-1; ; mymenu--) {
|
||||
item = p.p[mymenu]->find_selected(mx, my);
|
||||
for (mymenu = pp.nummenus-1; ; mymenu--) {
|
||||
item = pp.p[mymenu]->find_selected(mx, my);
|
||||
if (item >= 0) break;
|
||||
if (mymenu <= 0) break;
|
||||
}
|
||||
setitem(mymenu, item);
|
||||
if (e == FL_PUSH) {
|
||||
if (p.current_item && p.current_item->submenu() // this is a menu title
|
||||
&& item != p.p[mymenu]->selected // and it is not already on
|
||||
&& !p.current_item->callback_) // and it does not have a callback
|
||||
p.state = MENU_PUSH_STATE;
|
||||
if (pp.current_item && pp.current_item->submenu() // this is a menu title
|
||||
&& item != pp.p[mymenu]->selected // and it is not already on
|
||||
&& !pp.current_item->callback_) // and it does not have a callback
|
||||
pp.state = MENU_PUSH_STATE;
|
||||
else
|
||||
p.state = PUSH_STATE;
|
||||
pp.state = PUSH_STATE;
|
||||
}} return 1;
|
||||
case FL_RELEASE:
|
||||
// do nothing if they try to pick inactive items
|
||||
if (p.current_item && !p.current_item->activevisible()) return 1;
|
||||
if (pp.current_item && !pp.current_item->activevisible()) return 1;
|
||||
// Mouse must either be held down/dragged some, or this must be
|
||||
// the second click (not the one that popped up the menu):
|
||||
if (!Fl::event_is_click() || p.state == PUSH_STATE ||
|
||||
p.menubar && p.current_item && !p.current_item->submenu() // button
|
||||
if (!Fl::event_is_click() || pp.state == PUSH_STATE ||
|
||||
pp.menubar && pp.current_item && !pp.current_item->submenu() // button
|
||||
) {
|
||||
#if 0 // makes the check/radio items leave the menu up
|
||||
const Fl_Menu_Item* m = p.current_item;
|
||||
const Fl_Menu_Item* m = pp.current_item;
|
||||
if (m && button && (m->flags & (FL_MENU_TOGGLE|FL_MENU_RADIO))) {
|
||||
((Fl_Menu_*)button)->picked(m);
|
||||
p.p[p.menu_number]->redraw();
|
||||
pp.p[pp.menu_number]->redraw();
|
||||
} else
|
||||
#endif
|
||||
p.state = DONE_STATE;
|
||||
pp.state = DONE_STATE;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -602,11 +600,11 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
|
||||
}
|
||||
menuwindow mw(this, X, Y, W, H, initial_item, t, menubar);
|
||||
Fl::grab(mw);
|
||||
menustate p; ::p = &p;
|
||||
p.p[0] = &mw;
|
||||
p.nummenus = 1;
|
||||
p.menubar = menubar;
|
||||
p.state = INITIAL_STATE;
|
||||
menustate pp; p = &pp;
|
||||
pp.p[0] = &mw;
|
||||
pp.nummenus = 1;
|
||||
pp.menubar = menubar;
|
||||
pp.state = INITIAL_STATE;
|
||||
|
||||
menuwindow* fakemenu = 0; // kludge for buttons in menubar
|
||||
|
||||
@ -616,50 +614,50 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
|
||||
goto STARTUP;
|
||||
}
|
||||
|
||||
p.current_item = 0; p.menu_number = 0; p.item_number = -1;
|
||||
pp.current_item = 0; pp.menu_number = 0; pp.item_number = -1;
|
||||
if (menubar) mw.handle(FL_DRAG); // find the initial menu
|
||||
initial_item = p.current_item;
|
||||
initial_item = pp.current_item;
|
||||
if (initial_item) goto STARTUP;
|
||||
|
||||
// the main loop, runs until p.state goes to DONE_STATE:
|
||||
for (;;) {
|
||||
|
||||
// make sure all the menus are shown:
|
||||
{for (int k = menubar; k < p.nummenus; k++)
|
||||
if (!p.p[k]->shown()) {
|
||||
if (p.p[k]->title) p.p[k]->title->show();
|
||||
p.p[k]->show();
|
||||
{for (int k = menubar; k < pp.nummenus; k++)
|
||||
if (!pp.p[k]->shown()) {
|
||||
if (pp.p[k]->title) pp.p[k]->title->show();
|
||||
pp.p[k]->show();
|
||||
}
|
||||
}
|
||||
|
||||
// get events:
|
||||
{const Fl_Menu_Item* oldi = p.current_item;
|
||||
{const Fl_Menu_Item* oldi = pp.current_item;
|
||||
Fl::wait();
|
||||
if (p.state == DONE_STATE) break; // done.
|
||||
if (p.current_item == oldi) continue;}
|
||||
if (pp.state == DONE_STATE) break; // done.
|
||||
if (pp.current_item == oldi) continue;}
|
||||
// only do rest if item changes:
|
||||
|
||||
delete fakemenu; fakemenu = 0; // turn off "menubar button"
|
||||
|
||||
if (!p.current_item) { // pointing at nothing
|
||||
if (!pp.current_item) { // pointing at nothing
|
||||
// turn off selection in deepest menu, but don't erase other menus:
|
||||
p.p[p.nummenus-1]->set_selected(-1);
|
||||
pp.p[pp.nummenus-1]->set_selected(-1);
|
||||
continue;
|
||||
}
|
||||
|
||||
delete fakemenu; fakemenu = 0;
|
||||
initial_item = 0; // stop the startup code
|
||||
p.p[p.menu_number]->autoscroll(p.item_number);
|
||||
pp.p[pp.menu_number]->autoscroll(pp.item_number);
|
||||
|
||||
STARTUP:
|
||||
menuwindow& cw = *p.p[p.menu_number];
|
||||
const Fl_Menu_Item* m = p.current_item;
|
||||
menuwindow& cw = *pp.p[pp.menu_number];
|
||||
const Fl_Menu_Item* m = pp.current_item;
|
||||
if (!m->activevisible()) { // pointing at inactive item
|
||||
cw.set_selected(-1);
|
||||
initial_item = 0; // turn off startup code
|
||||
continue;
|
||||
}
|
||||
cw.set_selected(p.item_number);
|
||||
cw.set_selected(pp.item_number);
|
||||
|
||||
if (m==initial_item) initial_item=0; // stop the startup code if item found
|
||||
if (m->submenu()) {
|
||||
@ -669,57 +667,57 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
|
||||
else menutable = (Fl_Menu_Item*)(m)->user_data_;
|
||||
// figure out where new menu goes:
|
||||
int nX, nY;
|
||||
if (!p.menu_number && p.menubar) { // menu off a menubar:
|
||||
nX = cw.x() + cw.titlex(p.item_number);
|
||||
if (!pp.menu_number && pp.menubar) { // menu off a menubar:
|
||||
nX = cw.x() + cw.titlex(pp.item_number);
|
||||
nY = cw.y() + cw.h();
|
||||
initial_item = 0;
|
||||
} else {
|
||||
nX = cw.x() + cw.w();
|
||||
nY = cw.y() + p.item_number * cw.itemheight;
|
||||
nY = cw.y() + pp.item_number * cw.itemheight;
|
||||
title = 0;
|
||||
}
|
||||
if (initial_item) { // bring up submenu containing initial item:
|
||||
menuwindow* n = new menuwindow(menutable,X,Y,W,H,initial_item,title);
|
||||
p.p[p.nummenus++] = n;
|
||||
pp.p[pp.nummenus++] = n;
|
||||
// move all earlier menus to line up with this new one:
|
||||
if (n->selected>=0) {
|
||||
int dy = n->y()-nY;
|
||||
int dx = n->x()-nX;
|
||||
for (int menu = 0; menu <= p.menu_number; menu++) {
|
||||
menuwindow* t = p.p[menu];
|
||||
int nx = t->x()+dx; if (nx < 0) {nx = 0; dx = -t->x();}
|
||||
int ny = t->y()+dy; if (ny < 0) {ny = 0; dy = -t->y();}
|
||||
t->position(nx, ny);
|
||||
for (int menu = 0; menu <= pp.menu_number; menu++) {
|
||||
menuwindow* tt = pp.p[menu];
|
||||
int nx = tt->x()+dx; if (nx < 0) {nx = 0; dx = -tt->x();}
|
||||
int ny = tt->y()+dy; if (ny < 0) {ny = 0; dy = -tt->y();}
|
||||
tt->position(nx, ny);
|
||||
}
|
||||
setitem(p.nummenus-1, n->selected);
|
||||
setitem(pp.nummenus-1, n->selected);
|
||||
goto STARTUP;
|
||||
}
|
||||
} else if (p.nummenus > p.menu_number+1 &&
|
||||
p.p[p.menu_number+1]->menu == menutable) {
|
||||
} else if (pp.nummenus > pp.menu_number+1 &&
|
||||
pp.p[pp.menu_number+1]->menu == menutable) {
|
||||
// the menu is already up:
|
||||
while (p.nummenus > p.menu_number+2) delete p.p[--p.nummenus];
|
||||
p.p[p.nummenus-1]->set_selected(-1);
|
||||
while (pp.nummenus > pp.menu_number+2) delete pp.p[--pp.nummenus];
|
||||
pp.p[pp.nummenus-1]->set_selected(-1);
|
||||
} else {
|
||||
// delete all the old menus and create new one:
|
||||
while (p.nummenus > p.menu_number+1) delete p.p[--p.nummenus];
|
||||
p.p[p.nummenus++]= new menuwindow(menutable, nX, nY,
|
||||
while (pp.nummenus > pp.menu_number+1) delete pp.p[--pp.nummenus];
|
||||
pp.p[pp.nummenus++]= new menuwindow(menutable, nX, nY,
|
||||
title?1:0, 0, 0, title, 0, menubar);
|
||||
}
|
||||
} else { // !m->submenu():
|
||||
while (p.nummenus > p.menu_number+1) delete p.p[--p.nummenus];
|
||||
if (!p.menu_number && p.menubar) {
|
||||
while (pp.nummenus > pp.menu_number+1) delete pp.p[--pp.nummenus];
|
||||
if (!pp.menu_number && pp.menubar) {
|
||||
// kludge so "menubar buttons" turn "on" by using menu title:
|
||||
fakemenu = new menuwindow(0,
|
||||
cw.x()+cw.titlex(p.item_number),
|
||||
cw.x()+cw.titlex(pp.item_number),
|
||||
cw.y()+cw.h(), 0, 0,
|
||||
0, m, 0, 1);
|
||||
fakemenu->title->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
const Fl_Menu_Item* m = p.current_item;
|
||||
const Fl_Menu_Item* m = pp.current_item;
|
||||
delete fakemenu;
|
||||
while (p.nummenus>1) delete p.p[--p.nummenus];
|
||||
while (pp.nummenus>1) delete pp.p[--pp.nummenus];
|
||||
mw.hide();
|
||||
Fl::release();
|
||||
return m;
|
||||
@ -730,12 +728,12 @@ Fl_Menu_Item::popup(
|
||||
int X, int Y,
|
||||
const char* title,
|
||||
const Fl_Menu_Item* picked,
|
||||
const Fl_Menu_* button
|
||||
const Fl_Menu_* but
|
||||
) const
|
||||
{
|
||||
static Fl_Menu_Item dummy; // static so it is all zeros
|
||||
dummy.text = title;
|
||||
return pulldown(X, Y, 0, 0, picked, button, title ? &dummy : 0);
|
||||
return pulldown(X, Y, 0, 0, picked, but, title ? &dummy : 0);
|
||||
}
|
||||
|
||||
// Search only the top level menu for a shortcut. Either &x in the
|
||||
@ -776,5 +774,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.16 2002/07/24 12:16:57 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.17 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.3 2002/04/11 11:52:41 easysw Exp $"
|
||||
// "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.4 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Common menu code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -112,43 +112,21 @@ void Fl_Menu_::menu(const Fl_Menu_Item* m) {
|
||||
value_ = menu_ = (Fl_Menu_Item*)m;
|
||||
}
|
||||
|
||||
#if 1
|
||||
// this version is ok with new Fl_Menu_add code with fl_menu_array_owner:
|
||||
|
||||
void Fl_Menu_::copy(const Fl_Menu_Item* m, void* user_data) {
|
||||
void Fl_Menu_::copy(const Fl_Menu_Item* m, void* ud) {
|
||||
int n = m->size();
|
||||
Fl_Menu_Item* newMenu = new Fl_Menu_Item[n];
|
||||
memcpy(newMenu, m, n*sizeof(Fl_Menu_Item));
|
||||
menu(newMenu);
|
||||
alloc = 1; // make destructor free array, but not strings
|
||||
// for convienence, provide way to change all the user data pointers:
|
||||
if (user_data) for (; n--;) {
|
||||
if (newMenu->callback_) newMenu->user_data_ = user_data;
|
||||
if (ud) for (; n--;) {
|
||||
if (newMenu->callback_) newMenu->user_data_ = ud;
|
||||
newMenu++;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
// This is Guillaume Nodet's fixed version for the older Fl_Menu_add
|
||||
// that enlarged the array at powers of 2:
|
||||
|
||||
void Fl_Menu_::copy(const Fl_Menu_Item* m, void* user_data) {
|
||||
int i, s = m->size(), n=s;
|
||||
for (i=0; n; n>>=1, i++);
|
||||
n = 1 << i;
|
||||
Fl_Menu_Item* newMenu = new Fl_Menu_Item[n];
|
||||
memcpy(newMenu, m, s*sizeof(Fl_Menu_Item));
|
||||
memset(newMenu+s, 0, (n-s)*sizeof(Fl_Menu_Item));
|
||||
menu(newMenu);
|
||||
alloc = 1; // make destructor free it
|
||||
// for convienence, provide way to change all the user data pointers:
|
||||
if (user_data) for (; s--;) {
|
||||
if (newMenu->callback_) newMenu->user_data_ = user_data;
|
||||
newMenu++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Fl_Menu_::~Fl_Menu_() {
|
||||
clear();
|
||||
}
|
||||
@ -172,5 +150,5 @@ void Fl_Menu_::clear() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.3 2002/04/11 11:52:41 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.4 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu_add.cxx,v 1.9.2.13.2.3 2002/06/06 14:04:53 easysw Exp $"
|
||||
// "$Id: Fl_Menu_add.cxx,v 1.9.2.13.2.4 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Menu utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -99,7 +99,7 @@ static int compare(const char* a, const char* b) {
|
||||
// now add submenu titles directly by setting SUBMENU in the flags):
|
||||
int Fl_Menu_Item::add(
|
||||
const char *mytext,
|
||||
int shortcut,
|
||||
int sc,
|
||||
Fl_Callback *cb,
|
||||
void *data,
|
||||
int myflags
|
||||
@ -110,7 +110,7 @@ int Fl_Menu_Item::add(
|
||||
char *q;
|
||||
char buf[1024];
|
||||
|
||||
int size = array==local_array ? local_array_size : array->size();
|
||||
int msize = array==local_array ? local_array_size : array->size();
|
||||
int flags1 = 0;
|
||||
const char* item;
|
||||
|
||||
@ -138,10 +138,10 @@ int Fl_Menu_Item::add(
|
||||
|
||||
if (!m->text) { /* create a new menu */
|
||||
int n = m-array;
|
||||
array = insert(array, size, n, item, FL_SUBMENU|flags1);
|
||||
size++;
|
||||
array = insert(array, size, n+1, 0, 0);
|
||||
size++;
|
||||
array = insert(array, msize, n, item, FL_SUBMENU|flags1);
|
||||
msize++;
|
||||
array = insert(array, msize, n+1, 0, 0);
|
||||
msize++;
|
||||
m = array+n;
|
||||
}
|
||||
m++; /* go into the submenu */
|
||||
@ -154,22 +154,22 @@ int Fl_Menu_Item::add(
|
||||
|
||||
if (!m->text) { /* add a new menu item */
|
||||
int n = m-array;
|
||||
array = insert(array, size, n, item, myflags|flags1);
|
||||
size++;
|
||||
array = insert(array, msize, n, item, myflags|flags1);
|
||||
msize++;
|
||||
if (myflags & FL_SUBMENU) { // add submenu delimiter
|
||||
array = insert(array, size, n+1, 0, 0);
|
||||
size++;
|
||||
array = insert(array, msize, n+1, 0, 0);
|
||||
msize++;
|
||||
}
|
||||
m = array+n;
|
||||
}
|
||||
|
||||
/* fill it in */
|
||||
m->shortcut_ = shortcut;
|
||||
m->shortcut_ = sc;
|
||||
m->callback_ = cb;
|
||||
m->user_data_ = data;
|
||||
m->flags = myflags|flags1;
|
||||
|
||||
if (array == local_array) local_array_size = size;
|
||||
if (array == local_array) local_array_size = msize;
|
||||
return m-array;
|
||||
}
|
||||
|
||||
@ -222,14 +222,14 @@ int Fl_Menu_::add(const char *str) {
|
||||
char buf[128];
|
||||
int r = 0;
|
||||
while (*str) {
|
||||
int shortcut = 0;
|
||||
int sc = 0;
|
||||
char *c;
|
||||
for (c = buf; *str && *str != '|'; str++) {
|
||||
if (*str == '\t') {*c++ = 0; shortcut = fl_old_shortcut(str);}
|
||||
if (*str == '\t') {*c++ = 0; sc = fl_old_shortcut(str);}
|
||||
else *c++ = *str;
|
||||
}
|
||||
*c = 0;
|
||||
r = add(buf, shortcut, 0, 0, 0);
|
||||
r = add(buf, sc, 0, 0, 0);
|
||||
if (*str) str++;
|
||||
}
|
||||
return r;
|
||||
@ -262,5 +262,5 @@ void Fl_Menu_::remove(int i) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu_add.cxx,v 1.9.2.13.2.3 2002/06/06 14:04:53 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu_add.cxx,v 1.9.2.13.2.4 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Pack.cxx,v 1.6.2.4.2.2 2002/01/01 15:11:31 easysw Exp $"
|
||||
// "$Id: Fl_Pack.cxx,v 1.6.2.4.2.3 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Packing widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -32,8 +32,8 @@
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
Fl_Pack::Fl_Pack(int x,int y,int w ,int h,const char *l)
|
||||
: Fl_Group(x, y, w, h, l) {
|
||||
Fl_Pack::Fl_Pack(int X, int Y, int W, int H,const char *l)
|
||||
: Fl_Group(X, Y, W, H, l) {
|
||||
resizable(0);
|
||||
spacing_ = 0;
|
||||
// type(VERTICAL); // already set like this
|
||||
@ -132,5 +132,5 @@ void Fl_Pack::draw() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Pack.cxx,v 1.6.2.4.2.2 2002/01/01 15:11:31 easysw Exp $".
|
||||
// End of "$Id: Fl_Pack.cxx,v 1.6.2.4.2.3 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.20 2002/08/05 17:50:25 easysw Exp $"
|
||||
// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.21 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -162,8 +162,8 @@ void Fl_Pixmap::uncache() {
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Pixmap::label(Fl_Widget* w) {
|
||||
w->image(this);
|
||||
void Fl_Pixmap::label(Fl_Widget* widget) {
|
||||
widget->image(this);
|
||||
}
|
||||
|
||||
void Fl_Pixmap::label(Fl_Menu_Item* m) {
|
||||
@ -460,5 +460,5 @@ void Fl_Pixmap::desaturate() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.20 2002/08/05 17:50:25 easysw Exp $".
|
||||
// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.21 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:31 easysw Exp $"
|
||||
// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.2 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Positioner widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -36,14 +36,14 @@ static double flinear(double val, double smin, double smax, double gmin, double
|
||||
else return gmin + (gmax - gmin) * (val - smin) / (smax - smin);
|
||||
}
|
||||
|
||||
void Fl_Positioner::draw(int x, int y, int w, int h) {
|
||||
int x1 = x + 4;
|
||||
int y1 = y + 4;
|
||||
int w1 = w - 2 * 4;
|
||||
int h1 = h - 2 * 4;
|
||||
void Fl_Positioner::draw(int X, int Y, int W, int H) {
|
||||
int x1 = X + 4;
|
||||
int y1 = Y + 4;
|
||||
int w1 = W - 2 * 4;
|
||||
int h1 = H - 2 * 4;
|
||||
int xx = int(flinear(xvalue(), xmin, xmax, x1, x1+w1-1)+.5);
|
||||
int yy = int(flinear(yvalue(), ymin, ymax, y1, y1+h1-1)+.5);
|
||||
draw_box(box(), x, y, w, h, color());
|
||||
draw_box(box(), X, Y, W, H, color());
|
||||
fl_color(selection_color());
|
||||
fl_xyline(x1, yy, x1+w1);
|
||||
fl_yxline(xx, y1, y1+h1);
|
||||
@ -70,24 +70,24 @@ int Fl_Positioner::yvalue(double Y) {
|
||||
return(value(xvalue_, Y));
|
||||
}
|
||||
|
||||
int Fl_Positioner::handle(int event, int x, int y, int w, int h) {
|
||||
int Fl_Positioner::handle(int event, int X, int Y, int W, int H) {
|
||||
switch (event) {
|
||||
case FL_PUSH:
|
||||
case FL_DRAG:
|
||||
case FL_RELEASE: {
|
||||
double x1 = x + 4;
|
||||
double y1 = y + 4;
|
||||
double w1 = w - 2 * 4;
|
||||
double h1 = h - 2 * 4;
|
||||
double X = flinear(Fl::event_x(), x1, x1+w1-1.0, xmin, xmax);
|
||||
if (xstep_) X = int(X/xstep_+0.5) * xstep_;
|
||||
if (X < xmin) X = xmin;
|
||||
if (X > xmax) X = xmax;
|
||||
double Y = flinear(Fl::event_y(), y1, y1+h1-1.0, ymin, ymax);
|
||||
if (ystep_) Y = int(Y/ystep_+0.5) * ystep_;
|
||||
if (Y < ymin) Y = ymin;
|
||||
if (Y > ymax) Y = ymax;
|
||||
if (value(X, Y)) set_changed();}
|
||||
double x1 = X + 4;
|
||||
double y1 = Y + 4;
|
||||
double w1 = W - 2 * 4;
|
||||
double h1 = H - 2 * 4;
|
||||
double xx = flinear(Fl::event_x(), x1, x1+w1-1.0, xmin, xmax);
|
||||
if (xstep_) xx = int(xx/xstep_+0.5) * xstep_;
|
||||
if (xx < xmin) xx = xmin;
|
||||
if (xx > xmax) xx = xmax;
|
||||
double yy = flinear(Fl::event_y(), y1, y1+h1-1.0, ymin, ymax);
|
||||
if (ystep_) yy = int(yy/ystep_+0.5) * ystep_;
|
||||
if (yy < ymin) yy = ymin;
|
||||
if (yy > ymax) yy = ymax;
|
||||
if (value(xx, yy)) set_changed();}
|
||||
if (!(when() & FL_WHEN_CHANGED ||
|
||||
when() & FL_WHEN_RELEASE && event == FL_RELEASE)) return 1;
|
||||
if (changed() || when()&FL_WHEN_NOT_CHANGED) {
|
||||
@ -102,8 +102,8 @@ int Fl_Positioner::handle(int e) {
|
||||
return handle(e, x(), y(), w(), h());
|
||||
}
|
||||
|
||||
Fl_Positioner::Fl_Positioner(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Widget(x, y, w, h, l) {
|
||||
Fl_Positioner::Fl_Positioner(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Widget(X, Y, W, H, l) {
|
||||
box(FL_DOWN_BOX);
|
||||
selection_color(FL_RED);
|
||||
align(FL_ALIGN_BOTTOM);
|
||||
@ -129,5 +129,5 @@ void Fl_Positioner::ybounds(double a, double b) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:31 easysw Exp $".
|
||||
// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.2 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Preferences.cxx,v 1.1.2.17 2002/07/01 20:14:08 easysw Exp $"
|
||||
// "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Preferences methods for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -392,9 +392,9 @@ char Fl_Preferences::get( const char *key, void *data, const void *defaultValue,
|
||||
const char *v = node->get( key );
|
||||
if ( v )
|
||||
{
|
||||
int size;
|
||||
void *w = decodeHex( v, size );
|
||||
memmove( data, w, size>maxSize?maxSize:size );
|
||||
int dsize;
|
||||
void *w = decodeHex( v, dsize );
|
||||
memmove( data, w, dsize>maxSize?maxSize:dsize );
|
||||
free( w );
|
||||
return 1;
|
||||
}
|
||||
@ -414,8 +414,8 @@ char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue
|
||||
const char *v = node->get( key );
|
||||
if ( v )
|
||||
{
|
||||
int size;
|
||||
data = decodeHex( v, size );
|
||||
int dsize;
|
||||
data = decodeHex( v, dsize );
|
||||
return 1;
|
||||
}
|
||||
if ( defaultValue )
|
||||
@ -432,11 +432,11 @@ char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue
|
||||
/**
|
||||
* set an entry (name/value pair)
|
||||
*/
|
||||
char Fl_Preferences::set( const char *key, const void *data, int size )
|
||||
char Fl_Preferences::set( const char *key, const void *data, int dsize )
|
||||
{
|
||||
char *buffer = (char*)malloc( size*2+1 ), *d = buffer;;
|
||||
char *buffer = (char*)malloc( dsize*2+1 ), *d = buffer;;
|
||||
unsigned char *s = (unsigned char*)data;
|
||||
for ( ; size>0; size-- )
|
||||
for ( ; dsize>0; dsize-- )
|
||||
{
|
||||
static char lu[] = "0123456789abcdef";
|
||||
unsigned char v = *s++;
|
||||
@ -889,7 +889,9 @@ void Fl_Preferences::Node::set( const char *name, const char *value )
|
||||
// create or set a value (or annotation) from a single line in the file buffer
|
||||
void Fl_Preferences::Node::set( const char *line )
|
||||
{
|
||||
char dirty = dirty_; // hmm. If we assume that we always read yhis file in the beginning, we can handle the dirty flag 'quick and dirty'
|
||||
// hmm. If we assume that we always read this file in the beginning,
|
||||
// we can handle the dirty flag 'quick and dirty'
|
||||
char dirt = dirty_;
|
||||
if ( line[0]==';' || line[0]==0 || line[0]=='#' )
|
||||
{
|
||||
set( line, 0 );
|
||||
@ -905,7 +907,7 @@ void Fl_Preferences::Node::set( const char *line )
|
||||
else
|
||||
set( line, "" );
|
||||
}
|
||||
dirty_ = dirty;
|
||||
dirty_ = dirt;
|
||||
}
|
||||
|
||||
// add more data to an existing entry
|
||||
@ -1052,5 +1054,5 @@ char Fl_Preferences::Node::remove()
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.17 2002/07/01 20:14:08 easysw Exp $".
|
||||
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Progress.cxx,v 1.1.2.5 2002/04/11 10:46:19 easysw Exp $"
|
||||
// "$Id: Fl_Progress.cxx,v 1.1.2.6 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Progress bar widget routines.
|
||||
//
|
||||
@ -92,8 +92,8 @@ void Fl_Progress::draw()
|
||||
// 'Fl_Progress::Fl_Progress()' - Construct a Fl_Progress widget.
|
||||
//
|
||||
|
||||
Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l)
|
||||
: Fl_Widget(x, y, w, h, l)
|
||||
Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* l)
|
||||
: Fl_Widget(X, Y, W, H, l)
|
||||
{
|
||||
align(FL_ALIGN_INSIDE);
|
||||
box(FL_DOWN_BOX);
|
||||
@ -105,5 +105,5 @@ Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Progress.cxx,v 1.1.2.5 2002/04/11 10:46:19 easysw Exp $".
|
||||
// End of "$Id: Fl_Progress.cxx,v 1.1.2.6 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.15 2002/07/14 21:25:39 easysw Exp $"
|
||||
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.16 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Shared image code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -29,11 +29,6 @@
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <FL/Fl_BMP_Image.H>
|
||||
#include <FL/Fl_GIF_Image.H>
|
||||
#include <FL/Fl_JPEG_Image.H>
|
||||
#include <FL/Fl_PNG_Image.H>
|
||||
#include <FL/Fl_PNM_Image.H>
|
||||
#include <FL/Fl_XBM_Image.H>
|
||||
#include <FL/Fl_XPM_Image.H>
|
||||
|
||||
@ -234,14 +229,7 @@ Fl_Shared_Image::reload() {
|
||||
}
|
||||
|
||||
// Load the image as appropriate...
|
||||
if (memcmp(header, "GIF87a", 6) == 0 ||
|
||||
memcmp(header, "GIF89a", 6) == 0)
|
||||
img = new Fl_GIF_Image(name_);
|
||||
else if (memcmp(header, "BM", 2) == 0) // BMP file
|
||||
img = new Fl_BMP_Image(name_);
|
||||
else if (header[0] == 'P' && header[1] >= '1' && header[1] <= '6') // Portable anymap
|
||||
img = new Fl_PNM_Image(name_);
|
||||
else if (memcmp(header, "#define", 7) == 0) // XBM file
|
||||
if (memcmp(header, "#define", 7) == 0) // XBM file
|
||||
img = new Fl_XBM_Image(name_);
|
||||
else if (memcmp(header, "/* XPM */", 9) == 0) // XPM file
|
||||
img = new Fl_XPM_Image(name_);
|
||||
@ -467,5 +455,5 @@ Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.15 2002/07/14 21:25:39 easysw Exp $".
|
||||
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.16 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.9 2002/08/05 17:50:25 easysw Exp $"
|
||||
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.10 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// Copyright 2001-2002 by Bill Spitzak and others.
|
||||
// Original code Copyright Mark Edel. Permission to distribute under
|
||||
@ -1967,7 +1967,7 @@ int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar,
|
||||
int *foundPos ) {
|
||||
int pos, gapLen = mGapEnd - mGapStart;
|
||||
|
||||
if (pos < 0 || pos >= mLength) {
|
||||
if (startPos < 0 || startPos >= mLength) {
|
||||
*foundPos = mLength;
|
||||
return 0;
|
||||
}
|
||||
@ -2003,11 +2003,11 @@ int Fl_Text_Buffer::findchar_backward( int startPos, char searchChar,
|
||||
int *foundPos ) {
|
||||
int pos, gapLen = mGapEnd - mGapStart;
|
||||
|
||||
if ( startPos == 0 ) {
|
||||
if ( startPos <= 0 || startPos >= mLength ) {
|
||||
*foundPos = 0;
|
||||
return 0;
|
||||
}
|
||||
pos = startPos == 0 ? 0 : startPos - 1;
|
||||
pos = startPos - 1;
|
||||
while ( pos >= mGapStart ) {
|
||||
if ( mBuf[ pos + gapLen ] == searchChar ) {
|
||||
*foundPos = pos;
|
||||
@ -2289,5 +2289,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.9 2002/08/05 17:50:25 easysw Exp $".
|
||||
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.10 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
12
src/Makefile
12
src/Makefile
@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: Makefile,v 1.18.2.14.2.46 2002/07/14 17:03:31 easysw Exp $"
|
||||
# "$Id: Makefile,v 1.18.2.14.2.47 2002/08/09 01:09:49 easysw Exp $"
|
||||
#
|
||||
# Library makefile for the Fast Light Tool Kit (FLTK).
|
||||
#
|
||||
@ -27,7 +27,6 @@ CPPFILES = \
|
||||
Fl.cxx \
|
||||
Fl_Adjuster.cxx \
|
||||
Fl_Bitmap.cxx \
|
||||
Fl_BMP_Image.cxx \
|
||||
Fl_Browser.cxx \
|
||||
Fl_Browser_.cxx \
|
||||
Fl_Browser_load.cxx \
|
||||
@ -47,7 +46,6 @@ CPPFILES = \
|
||||
Fl_File_Chooser2.cxx \
|
||||
Fl_File_Icon.cxx \
|
||||
Fl_File_Input.cxx \
|
||||
Fl_GIF_Image.cxx \
|
||||
Fl_Group.cxx \
|
||||
Fl_Help_Dialog.cxx \
|
||||
Fl_Help_View.cxx \
|
||||
@ -66,7 +64,6 @@ CPPFILES = \
|
||||
Fl_Overlay_Window.cxx \
|
||||
Fl_Pack.cxx \
|
||||
Fl_Pixmap.cxx \
|
||||
Fl_PNM_Image.cxx \
|
||||
Fl_Positioner.cxx \
|
||||
Fl_Preferences.cxx \
|
||||
Fl_Progress.cxx \
|
||||
@ -170,9 +167,12 @@ GLCPPFILES = \
|
||||
|
||||
IMGCPPFILES = \
|
||||
fl_images_core.cxx \
|
||||
Fl_BMP_Image.cxx \
|
||||
Fl_File_Icon2.cxx \
|
||||
Fl_GIF_Image.cxx \
|
||||
Fl_JPEG_Image.cxx \
|
||||
Fl_PNG_Image.cxx
|
||||
Fl_PNG_Image.cxx \
|
||||
Fl_PNM_Image.cxx
|
||||
|
||||
CFILES = fl_call_main.c flstring.c scandir.c numericsort.c vsnprintf.c
|
||||
|
||||
@ -565,5 +565,5 @@ uninstall:
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: Makefile,v 1.18.2.14.2.46 2002/07/14 17:03:31 easysw Exp $".
|
||||
# End of "$Id: Makefile,v 1.18.2.14.2.47 2002/08/09 01:09:49 easysw Exp $".
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_images_core.cxx,v 1.1.2.2 2002/06/29 00:10:04 matthiaswm Exp $"
|
||||
// "$Id: fl_images_core.cxx,v 1.1.2.3 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// FLTK images library core.
|
||||
//
|
||||
@ -33,8 +33,11 @@
|
||||
//
|
||||
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <FL/Fl_BMP_Image.H>
|
||||
#include <FL/Fl_GIF_Image.H>
|
||||
#include <FL/Fl_JPEG_Image.H>
|
||||
#include <FL/Fl_PNG_Image.H>
|
||||
#include <FL/Fl_PNM_Image.H>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "flstring.h"
|
||||
@ -65,20 +68,28 @@ Fl_Image * // O - Image, if found
|
||||
fl_check_images(const char *name, // I - Filename
|
||||
uchar *header, // I - Header data from file
|
||||
int headerlen) { // I - Amount of data
|
||||
if (memcmp(header, "GIF87a", 6) == 0 ||
|
||||
memcmp(header, "GIF89a", 6) == 0) // GIF file
|
||||
return new Fl_GIF_Image(name);
|
||||
|
||||
if (memcmp(header, "BM", 2) == 0) // BMP file
|
||||
return new Fl_BMP_Image(name);
|
||||
|
||||
if (header[0] == 'P' && header[1] >= '1' && header[1] <= '6')
|
||||
// Portable anymap
|
||||
return new Fl_PNM_Image(name);
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
if (memcmp(header, "\211PNG", 4) == 0) // PNG header
|
||||
if (memcmp(header, "\211PNG", 4) == 0)// PNG file
|
||||
return new Fl_PNG_Image(name);
|
||||
#else
|
||||
header = header; name = name; headerlen = headerlen; // avoid warnings
|
||||
#endif // HAVE_LIBPNG
|
||||
|
||||
#ifdef HAVE_LIBJPEG
|
||||
if (memcmp(header, "\377\330\377", 3) == 0 && // Start-of-Image
|
||||
if (memcmp(header, "\377\330\377", 3) == 0 &&
|
||||
// Start-of-Image
|
||||
header[3] >= 0xe0 && header[3] <= 0xef)
|
||||
// APPn
|
||||
// APPn for JPEG file
|
||||
return new Fl_JPEG_Image(name);
|
||||
#else
|
||||
header = header; name = name; headerlen = headerlen; // avoid warnings
|
||||
#endif // HAVE_LIBJPEG
|
||||
|
||||
return 0;
|
||||
@ -86,5 +97,5 @@ fl_check_images(const char *name, // I - Filename
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: fl_images_core.cxx,v 1.1.2.2 2002/06/29 00:10:04 matthiaswm Exp $".
|
||||
// End of "$Id: fl_images_core.cxx,v 1.1.2.3 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $"
|
||||
// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.7 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// MacOS font utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -30,7 +30,9 @@
|
||||
|
||||
// turn a stored font name into a pretty name:
|
||||
const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
const char* p = fl_fonts[fnum].name;
|
||||
Fl_Fontdesc *f = fl_fonts + fnum;
|
||||
if (!f->fontname[0]) {
|
||||
const char* p = f->name;
|
||||
if (!p || !*p) {if (ap) *ap = 0; return "";}
|
||||
int type;
|
||||
switch (*p) {
|
||||
@ -41,11 +43,11 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
}
|
||||
if (ap) *ap = type;
|
||||
if (!type) return p+1;
|
||||
static char *buffer; if (!buffer) buffer = new char[128];
|
||||
strcpy(buffer, p+1);
|
||||
if (type & FL_BOLD) strcat(buffer, " bold");
|
||||
if (type & FL_ITALIC) strcat(buffer, " italic");
|
||||
return buffer;
|
||||
strlcpy(f->fontname, p+1, sizeof(f->fontname));
|
||||
if (type & FL_BOLD) strlcat(f->fontname, " bold", sizeof(f->fontname));
|
||||
if (type & FL_ITALIC) strlcat(f->fontname, " italic", sizeof(f->fontname));
|
||||
}
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
static int fl_free_font = FL_FREE_FONT;
|
||||
@ -154,5 +156,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.6 2002/05/16 12:47:43 easysw Exp $".
|
||||
// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.7 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.7 2002/06/29 00:10:04 matthiaswm Exp $"
|
||||
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.8 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -30,7 +30,9 @@
|
||||
|
||||
// turn a stored font name into a pretty name:
|
||||
const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
const char* p = fl_fonts[fnum].name;
|
||||
Fl_Fontdesc *f = fl_fonts + fnum;
|
||||
if (!f->fontname[0]) {
|
||||
const char* p = f->name;
|
||||
if (!p || !*p) {if (ap) *ap = 0; return "";}
|
||||
int type;
|
||||
switch (*p) {
|
||||
@ -41,11 +43,11 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
}
|
||||
if (ap) *ap = type;
|
||||
if (!type) return p+1;
|
||||
static char *buffer; if (!buffer) buffer = new char[128];
|
||||
strcpy(buffer, p+1);
|
||||
if (type & FL_BOLD) strcat(buffer, " bold");
|
||||
if (type & FL_ITALIC) strcat(buffer, " italic");
|
||||
return buffer;
|
||||
strlcpy(f->fontname, p+1, sizeof(f->fontname));
|
||||
if (type & FL_BOLD) strlcat(f->fontname, " bold", sizeof(f->fontname));
|
||||
if (type & FL_ITALIC) strlcat(f->fontname, " italic", sizeof(f->fontname));
|
||||
}
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
static int fl_free_font = FL_FREE_FONT;
|
||||
@ -135,5 +137,5 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.7 2002/06/29 00:10:04 matthiaswm Exp $".
|
||||
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.8 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_set_fonts_x.cxx,v 1.1.2.3 2002/05/16 12:47:43 easysw Exp $"
|
||||
// "$Id: fl_set_fonts_x.cxx,v 1.1.2.4 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// X11 font utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -81,13 +81,14 @@ static int use_registry(const char *p) {
|
||||
|
||||
// turn a stored (with *'s) X font name into a pretty name:
|
||||
const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
const char* p = fl_fonts[fnum].name;
|
||||
Fl_Fontdesc *f = fl_fonts + fnum;
|
||||
if (!f->fontname[0]) {
|
||||
const char* p = f->name;
|
||||
if (!p) {
|
||||
if (ap) *ap = 0;
|
||||
return "";
|
||||
}
|
||||
static char *buffer; if (!buffer) buffer = new char[128];
|
||||
char *o = buffer;
|
||||
char *o = f->fontname;
|
||||
|
||||
if (*p != '-') { // non-standard font, just replace * with spaces:
|
||||
if (ap) {
|
||||
@ -100,12 +101,12 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
if (*p == '*' || *p == ' ' || *p == '-') {
|
||||
do p++; while (*p == '*' || *p == ' ' || *p == '-');
|
||||
if (!*p) break;
|
||||
*o++ = ' ';
|
||||
if (o < (f->fontname + sizeof(f->fontname) - 1)) *o++ = ' ';
|
||||
}
|
||||
*o++ = *p;
|
||||
if (o < (f->fontname + sizeof(f->fontname) - 1)) *o++ = *p;
|
||||
}
|
||||
*o = 0;
|
||||
return buffer;
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
// get the family:
|
||||
@ -115,9 +116,14 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
return p;
|
||||
}
|
||||
const char *e = fl_font_word(x,1);
|
||||
if ((e - x) < (sizeof(f->fontname) - 1)) {
|
||||
// MRS: we want strncpy here, not strlcpy...
|
||||
strncpy(o,x,e-x);
|
||||
o += e-x;
|
||||
} else {
|
||||
strlcpy(f->fontname,x,sizeof(f->fontname));
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
// collect all the attribute words:
|
||||
int type = 0;
|
||||
@ -126,10 +132,15 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
if (*e) e++; x = e; e = fl_font_word(x,1);
|
||||
int t = attribute(n,x);
|
||||
if (t < 0) {
|
||||
*o++ = ' ';
|
||||
if (o < (f->fontname + sizeof(f->fontname) - 1) *o++ = ' ';
|
||||
if ((e - x) < (sizeof(f->fontname) - (o - f->fontname) - 1)) {
|
||||
// MRS: we want strncpy here, not strlcpy...
|
||||
strncpy(o,x,e-x);
|
||||
o += e-x;
|
||||
} else {
|
||||
strlcpy(o,x,sizeof(f->fontname) - (o - f->fontname) - 1);
|
||||
return f->fontname;
|
||||
}
|
||||
} else type |= t;
|
||||
}
|
||||
|
||||
@ -138,12 +149,13 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
if (*x) {x++; *o++ = '('; while (*x) *o++ = *x++; *o++ = ')';}
|
||||
|
||||
*o = 0;
|
||||
if (type & FL_BOLD) {strcpy(o, " bold"); o += 5;}
|
||||
if (type & FL_ITALIC) {strcpy(o, " italic"); o += 7;}
|
||||
if (type & FL_BOLD) strlcat(f->fontname, " bold", sizeof(f->fontname));
|
||||
if (type & FL_ITALIC) strlcat(f->fontname, " italic", sizeof(f->fontname));
|
||||
|
||||
if (ap) *ap = type;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@ -330,5 +342,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_set_fonts_x.cxx,v 1.1.2.3 2002/05/16 12:47:43 easysw Exp $".
|
||||
// End of "$Id: fl_set_fonts_x.cxx,v 1.1.2.4 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_set_fonts_xft.cxx,v 1.1.2.1 2002/03/06 18:11:01 easysw Exp $"
|
||||
// "$Id: fl_set_fonts_xft.cxx,v 1.1.2.2 2002/08/09 01:09:49 easysw Exp $"
|
||||
//
|
||||
// More font utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -32,7 +32,9 @@
|
||||
|
||||
// turn a stored font name into a pretty name:
|
||||
const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
const char* p = fl_fonts[fnum].name;
|
||||
Fl_Fontdesc *f = fl_fonts + fnum;
|
||||
if (!f->fontname[0]) {
|
||||
const char* p = f->name;
|
||||
int type;
|
||||
switch (p[0]) {
|
||||
case 'B': type = FL_BOLD; break;
|
||||
@ -42,11 +44,11 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
}
|
||||
if (ap) {*ap = type; return p+1;}
|
||||
if (!type) {return p+1;}
|
||||
static char *buffer = new char[128];
|
||||
strcpy(buffer, p+1);
|
||||
if (type & FL_BOLD) strcat(buffer, " bold");
|
||||
if (type & FL_ITALIC) strcat(buffer, " italic");
|
||||
return buffer;
|
||||
strlcpy(f->fontname, p+1, sizeof(f->fontname));
|
||||
if (type & FL_BOLD) strlcat(f->fontname, " bold", sizeof(f->fontname));
|
||||
if (type & FL_ITALIC) strlcat(f->fontname, " italic", sizeof(f->fontname));
|
||||
}
|
||||
return f->fontname;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -116,5 +118,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_set_fonts_xft.cxx,v 1.1.2.1 2002/03/06 18:11:01 easysw Exp $".
|
||||
// End of "$Id: fl_set_fonts_xft.cxx,v 1.1.2.2 2002/08/09 01:09:49 easysw Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user