Eliminate all compiler warnings (string constants, const'ness, hiding of

class members, empty fl_call_main.c)

Update pixmap functions to accept const * const * or * const * pointers.
(confused? :)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1429 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-04-13 19:07:40 +00:00
parent bb86f132eb
commit b8a8c98f04
13 changed files with 199 additions and 172 deletions

16
CHANGES
View File

@ -4,6 +4,21 @@ CHANGES SINCE FLTK 1.0.10
DLL". You'll need to change your project settings to DLL". You'll need to change your project settings to
use this as well or you'll get errors. use this as well or you'll get errors.
- Added new const const pointer versions of pixmap
functions to eliminate an annoying pointer warning
message that was generated by the Sun and other C++
compilers.
- Eliminated all "var hides class::var" warnings.
- Eliminated all "string literal converted to char *"
warnings.
- Fl_has_idle only tested N-1 callbacks and missed one.
- Restored WM_SYNCPAINT handling under WIN32; this fixed
a refresh bug under some versions of Windows.
- Check for OpenGL headers before checking to see if - Check for OpenGL headers before checking to see if
OpenGL is supported. This should eliminate compile OpenGL is supported. This should eliminate compile
errors due to missing non-FLTK header files... errors due to missing non-FLTK header files...
@ -11,7 +26,6 @@ CHANGES SINCE FLTK 1.0.10
- Add -D_INCLUDE_POSIX_SOURCE option when compiling with - Add -D_INCLUDE_POSIX_SOURCE option when compiling with
the HP compilers. the HP compilers.
- Replaced remaining _WIN32 symbols with WIN32 - Replaced remaining _WIN32 symbols with WIN32
- Removed reference to unused GL/glu.h header file, which is missing on - Removed reference to unused GL/glu.h header file, which is missing on

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Pixmap.H,v 1.6.2.3 2001/01/22 15:13:37 easysw Exp $" // "$Id: Fl_Pixmap.H,v 1.6.2.4 2001/04/13 19:07:39 easysw Exp $"
// //
// Pixmap header file for the Fast Light Tool Kit (FLTK). // Pixmap header file for the Fast Light Tool Kit (FLTK).
// //
@ -30,12 +30,12 @@ class Fl_Widget;
struct Fl_Menu_Item; struct Fl_Menu_Item;
struct Fl_Pixmap { struct Fl_Pixmap {
/*const*/ char * const * data; const char * const * data;
int w, h; // set by first draw... int w, h; // set by first draw...
ulong id; // for internal use (the pixmap) ulong id; // for internal use (the pixmap)
ulong mask; // for internal use (mask bitmap) ulong mask; // for internal use (mask bitmap)
Fl_Pixmap(/*const*/char * const * d) : data(d), w(-1), h(0), id(0),mask(0) {} Fl_Pixmap(const char * const * d) : data(d), w(-1), h(0), id(0),mask(0) {}
Fl_Pixmap(/*const*/uchar* const * d) : data((char**)d), w(-1), h(0), id(0),mask(0) {} Fl_Pixmap(const uchar* const * d) : data((char**)d), w(-1), h(0), id(0),mask(0) {}
FL_EXPORT ~Fl_Pixmap(); FL_EXPORT ~Fl_Pixmap();
FL_EXPORT void label(Fl_Widget*); FL_EXPORT void label(Fl_Widget*);
FL_EXPORT void label(Fl_Menu_Item*); FL_EXPORT void label(Fl_Menu_Item*);
@ -46,5 +46,5 @@ struct Fl_Pixmap {
#endif #endif
// //
// End of "$Id: Fl_Pixmap.H,v 1.6.2.3 2001/01/22 15:13:37 easysw Exp $". // End of "$Id: Fl_Pixmap.H,v 1.6.2.4 2001/04/13 19:07:39 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fl_draw.H,v 1.9.2.5 2001/01/22 15:13:38 easysw Exp $" // "$Id: fl_draw.H,v 1.9.2.6 2001/04/13 19:07:40 easysw Exp $"
// //
// Portable drawing function header file for the Fast Light Tool Kit (FLTK). // Portable drawing function header file for the Fast Light Tool Kit (FLTK).
// //
@ -163,6 +163,8 @@ FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
// pixmaps: // pixmaps:
FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY); FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h); FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
FL_EXPORT int fl_draw_pixmap(const char* const* data, int x,int y,Fl_Color=FL_GRAY);
FL_EXPORT int fl_measure_pixmap(const char* const* data, int &w, int &h);
// other: // other:
extern FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy, extern FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
@ -179,5 +181,5 @@ FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scal
#endif #endif
// //
// End of "$Id: fl_draw.H,v 1.9.2.5 2001/01/22 15:13:38 easysw Exp $". // End of "$Id: fl_draw.H,v 1.9.2.6 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Window_Type.cxx,v 1.13.2.9 2001/01/22 15:13:38 easysw Exp $" // "$Id: Fl_Window_Type.cxx,v 1.13.2.10 2001/04/13 19:07:40 easysw Exp $"
// //
// Window type code for the Fast Light Tool Kit (FLTK). // Window type code for the Fast Light Tool Kit (FLTK).
// //
@ -211,21 +211,21 @@ Fl_Type *Fl_Window_Type::make() {
fl_message("Please select a function"); fl_message("Please select a function");
return 0; return 0;
} }
Fl_Window_Type *o = new Fl_Window_Type(); Fl_Window_Type *myo = new Fl_Window_Type();
if (!this->o) {// template widget if (!this->o) {// template widget
this->o = new Fl_Window(100,100); this->o = new Fl_Window(100,100);
Fl_Group::current(0); Fl_Group::current(0);
} }
o->factory = this; myo->factory = this;
o->drag = 0; myo->drag = 0;
o->numselected = 0; myo->numselected = 0;
Overlay_Window *w = new Overlay_Window(100,100); Overlay_Window *w = new Overlay_Window(100,100);
w->window = o; w->window = myo;
o->o = w; myo->o = w;
o->add(p); myo->add(p);
o->modal = 0; myo->modal = 0;
o->non_modal = 0; myo->non_modal = 0;
return o; return myo;
} }
void Fl_Window_Type::add_child(Fl_Type* cc, Fl_Type* before) { void Fl_Window_Type::add_child(Fl_Type* cc, Fl_Type* before) {
@ -356,42 +356,42 @@ void Overlay_Window::resize(int X,int Y,int W,int H) {
// calculate actual move by moving mouse position (mx,my) to // calculate actual move by moving mouse position (mx,my) to
// nearest multiple of gridsize, and snap to original position // nearest multiple of gridsize, and snap to original position
void Fl_Window_Type::newdx() { void Fl_Window_Type::newdx() {
int dx, dy; int mydx, mydy;
if (Fl::event_state(FL_ALT)) { if (Fl::event_state(FL_ALT)) {
dx = mx-x1; mydx = mx-x1;
dy = my-y1; mydy = my-y1;
} else { } else {
int dx0 = mx-x1; int dx0 = mx-x1;
int ix = (drag&RIGHT) ? br : bx; int ix = (drag&RIGHT) ? br : bx;
dx = gridx ? ((ix+dx0+gridx/2)/gridx)*gridx - ix : dx0; mydx = gridx ? ((ix+dx0+gridx/2)/gridx)*gridx - ix : dx0;
if (dx0 > snap) { if (dx0 > snap) {
if (dx < 0) dx = 0; if (mydx < 0) mydx = 0;
} else if (dx0 < -snap) { } else if (dx0 < -snap) {
if (dx > 0) dx = 0; if (mydx > 0) mydx = 0;
} else } else
dx = 0; mydx = 0;
int dy0 = my-y1; int dy0 = my-y1;
int iy = (drag&BOTTOM) ? by : bt; int iy = (drag&BOTTOM) ? by : bt;
dy = gridy ? ((iy+dy0+gridy/2)/gridy)*gridy - iy : dy0; mydy = gridy ? ((iy+dy0+gridy/2)/gridy)*gridy - iy : dy0;
if (dy0 > snap) { if (dy0 > snap) {
if (dy < 0) dy = 0; if (mydy < 0) mydy = 0;
} else if (dy0 < -snap) { } else if (dy0 < -snap) {
if (dy > 0) dy = 0; if (mydy > 0) mydy = 0;
} else } else
dy = 0; mydy = 0;
} }
if (this->dx != dx || this->dy != dy) { if (dx != mydx || dy != mydy) {
this->dx = dx; this->dy = dy; dx = mydx; dy = mydy;
((Overlay_Window *)(this->o))->redraw_overlay(); ((Overlay_Window *)o)->redraw_overlay();
} }
} }
// Move a widget according to dx and dy calculated above // Move a widget according to dx and dy calculated above
void Fl_Window_Type::newposition(Fl_Widget_Type *o,int &X,int &Y,int &R,int &T) { void Fl_Window_Type::newposition(Fl_Widget_Type *myo,int &X,int &Y,int &R,int &T) {
X = o->o->x(); X = myo->o->x();
Y = o->o->y(); Y = myo->o->y();
R = X+o->o->w(); R = X+myo->o->w();
T = Y+o->o->h(); T = Y+myo->o->h();
if (!drag) return; if (!drag) return;
if (drag&DRAG) { if (drag&DRAG) {
X += dx; X += dx;
@ -415,11 +415,11 @@ void Fl_Window_Type::draw_overlay() {
for (Fl_Type *q=next; q && q->level>level; q=q->next) for (Fl_Type *q=next; q && q->level>level; q=q->next)
if (q->selected && q->is_widget() && !q->is_menu_item()) { if (q->selected && q->is_widget() && !q->is_menu_item()) {
numselected++; numselected++;
Fl_Widget_Type* o = (Fl_Widget_Type*)q; Fl_Widget_Type* myo = (Fl_Widget_Type*)q;
if (o->o->x() < bx) bx = o->o->x(); if (myo->o->x() < bx) bx = myo->o->x();
if (o->o->y() < by) by = o->o->y(); if (myo->o->y() < by) by = myo->o->y();
if (o->o->x()+o->o->w() > br) br = o->o->x()+o->o->w(); if (myo->o->x()+myo->o->w() > br) br = myo->o->x()+myo->o->w();
if (o->o->y()+o->o->h() > bt) bt = o->o->y()+o->o->h(); if (myo->o->y()+myo->o->h() > bt) bt = myo->o->y()+myo->o->h();
} }
recalc = 0; recalc = 0;
} }
@ -432,25 +432,25 @@ void Fl_Window_Type::draw_overlay() {
if (overlays_invisible && !drag) return; if (overlays_invisible && !drag) return;
if (selected) fl_rect(0,0,o->w(),o->h()); if (selected) fl_rect(0,0,o->w(),o->h());
if (!numselected) return; if (!numselected) return;
int bx,by,br,bt; int mybx,myby,mybr,mybt;
bx = o->w(); by = o->h(); br = 0; bt = 0; mybx = o->w(); myby = o->h(); mybr = 0; mybt = 0;
for (Fl_Type *q=next; q && q->level>level; q = q->next) for (Fl_Type *q=next; q && q->level>level; q = q->next)
if (q->selected && q->is_widget() && !q->is_menu_item()) { if (q->selected && q->is_widget() && !q->is_menu_item()) {
Fl_Widget_Type* o = (Fl_Widget_Type*)q; Fl_Widget_Type* myo = (Fl_Widget_Type*)q;
int x,y,r,t; int x,y,r,t;
newposition(o,x,y,r,t); newposition(myo,x,y,r,t);
fl_rect(x,y,r-x,t-y); fl_rect(x,y,r-x,t-y);
if (x < bx) bx = x; if (x < mybx) mybx = x;
if (y < by) by = y; if (y < myby) myby = y;
if (r > br) br = r; if (r > mybr) mybr = r;
if (t > bt) bt = t; if (t > mybt) mybt = t;
} }
if (selected) return; if (selected) return;
if (numselected>1) fl_rect(bx,by,br-bx,bt-by); if (numselected>1) fl_rect(mybx,myby,mybr-mybx,mybt-myby);
fl_rectf(bx,by,5,5); fl_rectf(mybx,myby,5,5);
fl_rectf(br-5,by,5,5); fl_rectf(mybr-5,myby,5,5);
fl_rectf(br-5,bt-5,5,5); fl_rectf(mybr-5,mybt-5,5,5);
fl_rectf(bx,bt-5,5,5); fl_rectf(mybx,mybt-5,5,5);
} }
// Calculate new bounding box of selected widgets: // Calculate new bounding box of selected widgets:
@ -490,18 +490,18 @@ void Fl_Window_Type::moveallchildren()
Fl_Type *i; Fl_Type *i;
for (i=next; i && i->level>level;) { for (i=next; i && i->level>level;) {
if (i->selected && i->is_widget() && !i->is_menu_item()) { if (i->selected && i->is_widget() && !i->is_menu_item()) {
Fl_Widget_Type* o = (Fl_Widget_Type*)i; Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
int x,y,r,t; int x,y,r,t;
newposition(o,x,y,r,t); newposition(myo,x,y,r,t);
o->o->resize(x,y,r-x,t-y); myo->o->resize(x,y,r-x,t-y);
// move all the children, whether selected or not: // move all the children, whether selected or not:
Fl_Type* p; Fl_Type* p;
for (p = o->next; p && p->level>o->level; p = p->next) for (p = myo->next; p && p->level>myo->level; p = p->next)
if (p->is_widget() && !p->is_menu_item()) { if (p->is_widget() && !p->is_menu_item()) {
Fl_Widget_Type* o = (Fl_Widget_Type*)p; Fl_Widget_Type* myo2 = (Fl_Widget_Type*)p;
int x,y,r,t; int x,y,r,t;
newposition(o,x,y,r,t); newposition(myo2,x,y,r,t);
o->o->resize(x,y,r-x,t-y); myo2->o->resize(x,y,r-x,t-y);
} }
i = p; i = p;
} else { } else {
@ -527,9 +527,9 @@ int Fl_Window_Type::handle(int event) {
// test for popup menu: // test for popup menu:
if (Fl::event_button() >= 3) { if (Fl::event_button() >= 3) {
in_this_only = this; // modifies how some menu items work. in_this_only = this; // modifies how some menu items work.
static const Fl_Menu_Item* prev; static const Fl_Menu_Item* myprev;
const Fl_Menu_Item* m = New_Menu->popup(mx,my,"New",prev); const Fl_Menu_Item* m = New_Menu->popup(mx,my,"New",myprev);
if (m && m->callback()) {prev = m; m->do_callback(this->o);} if (m && m->callback()) {myprev = m; m->do_callback(this->o);}
in_this_only = 0; in_this_only = 0;
return 1; return 1;
} }
@ -537,10 +537,10 @@ int Fl_Window_Type::handle(int event) {
selection = this; selection = this;
{for (Fl_Type* i=next; i && i->level>level; i=i->next) {for (Fl_Type* i=next; i && i->level>level; i=i->next)
if (i->is_widget() && !i->is_menu_item()) { if (i->is_widget() && !i->is_menu_item()) {
Fl_Widget_Type* o = (Fl_Widget_Type*)i; Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
for (Fl_Widget *o1 = o->o; o1; o1 = o1->parent()) for (Fl_Widget *o1 = myo->o; o1; o1 = o1->parent())
if (!o1->visible()) goto CONTINUE2; if (!o1->visible()) goto CONTINUE2;
if (Fl::event_inside(o->o)) selection = o; if (Fl::event_inside(myo->o)) selection = myo;
CONTINUE2:; CONTINUE2:;
}} }}
// see if user grabs edges of selected region: // see if user grabs edges of selected region:
@ -600,14 +600,14 @@ int Fl_Window_Type::handle(int event) {
// select everything in box: // select everything in box:
for (Fl_Type*i=next; i&&i->level>level; i=i->next) for (Fl_Type*i=next; i&&i->level>level; i=i->next)
if (i->is_widget() && !i->is_menu_item()) { if (i->is_widget() && !i->is_menu_item()) {
Fl_Widget_Type* o = (Fl_Widget_Type*)i; Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
for (Fl_Widget *o1 = o->o; o1; o1 = o1->parent()) for (Fl_Widget *o1 = myo->o; o1; o1 = o1->parent())
if (!o1->visible()) goto CONTINUE; if (!o1->visible()) goto CONTINUE;
if (Fl::event_inside(o->o)) selection = o; if (Fl::event_inside(myo->o)) selection = myo;
if (o->o->x()>=x1 && o->o->y()>y1 && if (myo->o->x()>=x1 && myo->o->y()>y1 &&
o->o->x()+o->o->w()<mx && o->o->y()+o->o->h()<my) { myo->o->x()+myo->o->w()<mx && myo->o->y()+myo->o->h()<my) {
n++; n++;
select(o, toggle ? !o->selected : 1); select(myo, toggle ? !myo->selected : 1);
} }
CONTINUE:; CONTINUE:;
} }
@ -752,5 +752,5 @@ int Fl_Window_Type::read_fdesign(const char* name, const char* value) {
} }
// //
// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.9 2001/01/22 15:13:38 easysw Exp $". // End of "$Id: Fl_Window_Type.cxx,v 1.13.2.10 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fluid_Image.cxx,v 1.7.2.7 2001/01/22 15:13:38 easysw Exp $" // "$Id: Fluid_Image.cxx,v 1.7.2.8 2001/04/13 19:07:40 easysw Exp $"
// //
// Pixmap label support for the Fast Light Tool Kit (FLTK). // Pixmap label support for the Fast Light Tool Kit (FLTK).
// //
@ -112,9 +112,9 @@ pixmap_image::pixmap_image(const char *name, FILE *f) : Fluid_Image(name) {
int i = 0; int i = 0;
while (fgets(buffer,MAXSIZE+20,f)) { while (fgets(buffer,MAXSIZE+20,f)) {
if (buffer[0] != '\"') continue; if (buffer[0] != '\"') continue;
char *p = buffer; char *myp = buffer;
char *q = buffer+1; char *q = buffer+1;
while (*q != '\"' && p < buffer+MAXSIZE) { while (*q != '\"' && myp < buffer+MAXSIZE) {
if (*q == '\\') switch (*++q) { if (*q == '\\') switch (*++q) {
case '\n': case '\n':
fgets(q,(buffer+MAXSIZE+20)-q,f); break; fgets(q,(buffer+MAXSIZE+20)-q,f); break;
@ -129,7 +129,7 @@ pixmap_image::pixmap_image(const char *name, FILE *f) : Fluid_Image(name) {
n = (n<<4)+d; n = (n<<4)+d;
q++; q++;
} }
*p++ = n; *myp++ = n;
} break; } break;
default: { default: {
int c = *q++; int c = *q++;
@ -142,13 +142,13 @@ pixmap_image::pixmap_image(const char *name, FILE *f) : Fluid_Image(name) {
q++; q++;
} }
} }
*p++ = c; *myp++ = c;
} break; } break;
} else { } else {
*p++ = *q++; *myp++ = *q++;
} }
} }
*p++ = 0; *myp++ = 0;
if (i >= malloc_size) { if (i >= malloc_size) {
malloc_size = 2*malloc_size; malloc_size = 2*malloc_size;
if (data == local_data) { if (data == local_data) {
@ -161,9 +161,9 @@ pixmap_image::pixmap_image(const char *name, FILE *f) : Fluid_Image(name) {
length = (int*)realloc(length, malloc_size*sizeof(int)); length = (int*)realloc(length, malloc_size*sizeof(int));
} }
} }
data[i] = new char[p-buffer]; data[i] = new char[myp-buffer];
memcpy(data[i], buffer,p-buffer); memcpy(data[i], buffer,myp-buffer);
length[i] = p-buffer-1; length[i] = myp-buffer-1;
i++; i++;
} }
@ -436,5 +436,5 @@ Fluid_Image *ui_find_image(const char *oldname) {
} }
// //
// End of "$Id: Fluid_Image.cxx,v 1.7.2.7 2001/01/22 15:13:38 easysw Exp $". // End of "$Id: Fluid_Image.cxx,v 1.7.2.8 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: factory.cxx,v 1.4.2.10 2001/02/12 15:12:14 easysw Exp $" // "$Id: factory.cxx,v 1.4.2.11 2001/04/13 19:07:40 easysw Exp $"
// //
// Widget factory code for the Fast Light Tool Kit (FLTK). // Widget factory code for the Fast Light Tool Kit (FLTK).
// //
@ -202,13 +202,13 @@ public:
static Fl_Browser_Type Fl_Browser_type; static Fl_Browser_Type Fl_Browser_type;
int Fl_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Browser *o = (Fl_Browser*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Browser *myo = (Fl_Browser*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -233,13 +233,13 @@ public:
static Fl_Counter_Type Fl_Counter_type; static Fl_Counter_Type Fl_Counter_type;
int Fl_Counter_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Counter_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Counter *o = (Fl_Counter*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Counter *myo = (Fl_Counter*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -260,22 +260,22 @@ class Fl_Input_Type : public Fl_Widget_Type {
public: public:
virtual const char *type_name() {return "Fl_Input";} virtual const char *type_name() {return "Fl_Input";}
Fl_Widget *widget(int x,int y,int w,int h) { Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Input *o = new Fl_Input(x,y,w,h,"input:"); Fl_Input *myo = new Fl_Input(x,y,w,h,"input:");
o->value("Text Input"); myo->value("Text Input");
return o; return myo;
} }
Fl_Widget_Type *_make() {return new Fl_Input_Type();} Fl_Widget_Type *_make() {return new Fl_Input_Type();}
}; };
static Fl_Input_Type Fl_Input_type; static Fl_Input_Type Fl_Input_type;
int Fl_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Input_ *o = (Fl_Input_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Input_ *myo = (Fl_Input_*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -390,9 +390,9 @@ class Fl_Output_Type : public Fl_Input_Type {
public: public:
virtual const char *type_name() {return "Fl_Output";} virtual const char *type_name() {return "Fl_Output";}
Fl_Widget *widget(int x,int y,int w,int h) { Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Output *o = new Fl_Output(x,y,w,h,"output:"); Fl_Output *myo = new Fl_Output(x,y,w,h,"output:");
o->value("Text Output"); myo->value("Text Output");
return o; return myo;
} }
Fl_Widget_Type *_make() {return new Fl_Output_Type();} Fl_Widget_Type *_make() {return new Fl_Output_Type();}
}; };
@ -407,21 +407,21 @@ public:
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c); int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
int is_valuator() const {return 1;} int is_valuator() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) { Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Value_Input *o = new Fl_Value_Input(x,y,w,h,"value:"); Fl_Value_Input *myo = new Fl_Value_Input(x,y,w,h,"value:");
return o; return myo;
} }
Fl_Widget_Type *_make() {return new Fl_Value_Input_Type();} Fl_Widget_Type *_make() {return new Fl_Value_Input_Type();}
}; };
static Fl_Value_Input_Type Fl_Value_Input_type; static Fl_Value_Input_Type Fl_Value_Input_type;
int Fl_Value_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Value_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Value_Input *o = (Fl_Value_Input*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Value_Input *myo = (Fl_Value_Input*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -435,21 +435,21 @@ public:
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c); int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
int is_valuator() const {return 1;} int is_valuator() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) { Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Value_Output *o = new Fl_Value_Output(x,y,w,h,"value:"); Fl_Value_Output *myo = new Fl_Value_Output(x,y,w,h,"value:");
return o; return myo;
} }
Fl_Widget_Type *_make() {return new Fl_Value_Output_Type();} Fl_Widget_Type *_make() {return new Fl_Value_Output_Type();}
}; };
static Fl_Value_Output_Type Fl_Value_Output_type; static Fl_Value_Output_Type Fl_Value_Output_type;
int Fl_Value_Output_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Value_Output_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Value_Output *o = (Fl_Value_Output*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Value_Output *myo = (Fl_Value_Output*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -468,13 +468,13 @@ public:
static Fl_Value_Slider_Type Fl_Value_Slider_type; static Fl_Value_Slider_Type Fl_Value_Slider_type;
int Fl_Value_Slider_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { int Fl_Value_Slider_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
Fl_Value_Slider *o = (Fl_Value_Slider*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); Fl_Value_Slider *myo = (Fl_Value_Slider*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
switch (w) { switch (w) {
case 4: case 4:
case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
case 1: o->textfont(f); break; case 1: myo->textfont(f); break;
case 2: o->textsize(s); break; case 2: myo->textsize(s); break;
case 3: o->textcolor(c); break; case 3: myo->textcolor(c); break;
} }
return 1; return 1;
} }
@ -727,5 +727,5 @@ int lookup_symbol(const char *name, int &v, int numberok) {
} }
// //
// End of "$Id: factory.cxx,v 1.4.2.10 2001/02/12 15:12:14 easysw Exp $". // End of "$Id: factory.cxx,v 1.4.2.11 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
/* /*
* "$Id: fl_call_main.c,v 1.1.2.9 2001/03/15 22:39:56 easysw Exp $" * "$Id: fl_call_main.c,v 1.1.2.10 2001/04/13 19:07:40 easysw Exp $"
* *
* Copyright 1998-2001 by Bill Spitzak and others. * Copyright 1998-2001 by Bill Spitzak and others.
* *
@ -79,9 +79,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
return main(__argc, __argv); return main(__argc, __argv);
} }
#else
/* This code to prevent "empty translation unit" or similar warnings... */
static void dummy(void) {}
#endif #endif
/* /*
* End of "$Id: fl_call_main.c,v 1.1.2.9 2001/03/15 22:39:56 easysw Exp $". * End of "$Id: fl_call_main.c,v 1.1.2.10 2001/04/13 19:07:40 easysw Exp $".
*/ */

View File

@ -1,5 +1,5 @@
// //
// "$Id: fl_draw_pixmap.cxx,v 1.4.2.7 2001/01/22 15:13:40 easysw Exp $" // "$Id: fl_draw_pixmap.cxx,v 1.4.2.8 2001/04/13 19:07:40 easysw Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@ -43,7 +43,11 @@
static int ncolors, chars_per_pixel; static int ncolors, chars_per_pixel;
int fl_measure_pixmap(/*const*/char * const *data, int &w, int &h) { int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h) {
return fl_measure_pixmap((const char*const*)data,w,h);
}
int fl_measure_pixmap(const char * const *data, int &w, int &h) {
int i = sscanf(data[0],"%d %d %d %d",&w,&h,&ncolors,&chars_per_pixel); int i = sscanf(data[0],"%d %d %d %d",&w,&h,&ncolors,&chars_per_pixel);
if (i<4 || w<=0 || h<=0 || if (i<4 || w<=0 || h<=0 ||
chars_per_pixel!=1 && chars_per_pixel!=2) return w=0; chars_per_pixel!=1 && chars_per_pixel!=2) return w=0;
@ -134,7 +138,11 @@ extern int fl_parse_color(const char*, uchar&, uchar&, uchar&);
uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here
int fl_draw_pixmap(/*const*/char*const* di, int x, int y, Fl_Color bg) { int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color bg) {
return fl_draw_pixmap((const char*const*)data,x,y,bg);
}
int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
pixmap_data d; pixmap_data d;
if (!fl_measure_pixmap(di, d.w, d.h)) return 0; if (!fl_measure_pixmap(di, d.w, d.h)) return 0;
const uchar*const* data = (const uchar*const*)(di+1); const uchar*const* data = (const uchar*const*)(di+1);
@ -264,5 +272,5 @@ int fl_draw_pixmap(/*const*/char*const* di, int x, int y, Fl_Color bg) {
} }
// //
// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.7 2001/01/22 15:13:40 easysw Exp $". // End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: checkers.cxx,v 1.9.2.6 2001/01/22 15:13:41 easysw Exp $" // "$Id: checkers.cxx,v 1.9.2.7 2001/04/13 19:07:40 easysw Exp $"
// //
// Checkers game for the Fast Light Tool Kit (FLTK). // Checkers game for the Fast Light Tool Kit (FLTK).
// //
@ -966,8 +966,8 @@ void Board::draw() {
fl_rectf(x*BOXSIZE,0,BORDER,h()); fl_rectf(x*BOXSIZE,0,BORDER,h());
fl_rectf(0,x*BOXSIZE,w(),BORDER); fl_rectf(0,x*BOXSIZE,w(),BORDER);
} }
for (int i = 5; i < 40; i++) if (i != erase_this) { for (int j = 5; j < 40; j++) if (j != erase_this) {
draw_piece(b[i], squarex(i), squarey(i)); draw_piece(b[j], squarex(j), squarey(j));
} }
if (showlegal) { if (showlegal) {
fl_color(FL_WHITE); fl_color(FL_WHITE);
@ -1004,13 +1004,13 @@ void Board::draw() {
} }
// drag the piece on square i to dx dy, or undo drag if i is zero: // drag the piece on square i to dx dy, or undo drag if i is zero:
void Board::drag_piece(int i, int dx, int dy) { void Board::drag_piece(int j, int dx, int dy) {
dy = (dy&-2) | dx&1; // make halftone shadows line up dy = (dy&-2) | dx&1; // make halftone shadows line up
if (i != erase_this) drop_piece(erase_this); // should not happen if (j != erase_this) drop_piece(erase_this); // should not happen
if (!erase_this) { // pick up old piece if (!erase_this) { // pick up old piece
dragx = squarex(i); dragy = squarey(i); dragx = squarex(j); dragy = squarey(j);
erase_this = i; erase_this = j;
dragging = b[i]; dragging = b[j];
} }
if (dx != dragx || dy != dragy) { if (dx != dragx || dy != dragy) {
damage(FL_DAMAGE_ALL, dragx, dragy, ISIZE, ISIZE); damage(FL_DAMAGE_ALL, dragx, dragy, ISIZE, ISIZE);
@ -1021,12 +1021,12 @@ void Board::drag_piece(int i, int dx, int dy) {
} }
// drop currently dragged piece on square i // drop currently dragged piece on square i
void Board::drop_piece(int i) { void Board::drop_piece(int j) {
if (!erase_this) return; // should not happen! if (!erase_this) return; // should not happen!
erase_this = 0; erase_this = 0;
dragging = 0; dragging = 0;
int x = squarex(i); int x = squarex(j);
int y = squarey(i); int y = squarey(j);
if (x != dragx || y != dragy) { if (x != dragx || y != dragy) {
damage(4, dragx, dragy, ISIZE, ISIZE); damage(4, dragx, dragy, ISIZE, ISIZE);
damage(4, x, y, ISIZE, ISIZE); damage(4, x, y, ISIZE, ISIZE);
@ -1045,9 +1045,9 @@ void Board::animate(node* move, int backwards) {
int x2 = squarex(t); int x2 = squarex(t);
int y2 = squarey(t); int y2 = squarey(t);
const int STEPS=35; const int STEPS=35;
for (int i=0; i<STEPS; i++) { for (int j=0; j<STEPS; j++) {
int x = x1+(x2-x1)*i/STEPS; int x = x1+(x2-x1)*j/STEPS;
int y = y1+(y2-y1)*i/STEPS; int y = y1+(y2-y1)*j/STEPS;
drag_piece(move->from,x,y); drag_piece(move->from,x,y);
Fl::flush(); Fl::flush();
} }
@ -1365,5 +1365,5 @@ int main(int argc, char **argv) {
} }
// //
// End of "$Id: checkers.cxx,v 1.9.2.6 2001/01/22 15:13:41 easysw Exp $". // End of "$Id: checkers.cxx,v 1.9.2.7 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: colbrowser.cxx,v 1.5.2.3 2001/01/22 15:13:41 easysw Exp $" // "$Id: colbrowser.cxx,v 1.5.2.4 2001/04/13 19:07:40 easysw Exp $"
// //
// Forms test program for the Fast Light Tool Kit (FLTK). // Forms test program for the Fast Light Tool Kit (FLTK).
// //
@ -44,15 +44,15 @@ static int load_browser(char *);
/* the RGB data file does not have a standard location on unix. */ /* the RGB data file does not have a standard location on unix. */
#ifdef __VMS #ifdef __VMS
static char *rgbfile = "SYS$MANAGER:DECW$RGB.DAT"; static const char *rgbfile = "SYS$MANAGER:DECW$RGB.DAT";
#else #else
#ifdef __EMX__ /* OS2 */ #ifdef __EMX__ /* OS2 */
static char *rgbfile = "/XFree86/lib/X11/rgb.txt"; static const char *rgbfile = "/XFree86/lib/X11/rgb.txt";
#else #else
#ifdef __FreeBSD__ #ifdef __FreeBSD__
static char *rgbfile = "/usr/X11R6/lib/X11/rgb.txt"; static const char *rgbfile = "/usr/X11R6/lib/X11/rgb.txt";
#else #else
static char *rgbfile = "/usr/lib/X11/rgb.txt"; static const char *rgbfile = "/usr/lib/X11/rgb.txt";
#endif #endif
#endif #endif
#endif #endif
@ -340,5 +340,5 @@ create_form_cl(void)
} }
// //
// End of "$Id: colbrowser.cxx,v 1.5.2.3 2001/01/22 15:13:41 easysw Exp $". // End of "$Id: colbrowser.cxx,v 1.5.2.4 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: forms.cxx,v 1.4.2.3 2001/01/22 15:13:41 easysw Exp $" // "$Id: forms.cxx,v 1.4.2.4 2001/04/13 19:07:40 easysw Exp $"
// //
// Another forms demo for the Fast Light Tool Kit (FLTK). // Another forms demo for the Fast Light Tool Kit (FLTK).
// //
@ -34,7 +34,7 @@
static int border = 1; // changed from FL_TRANSIENT for fltk static int border = 1; // changed from FL_TRANSIENT for fltk
// (this is so the close box and Esc work to close the window) // (this is so the close box and Esc work to close the window)
typedef struct { int val; char *name; } VN_struct; typedef struct { int val; const char *name; } VN_struct;
#define VN(a) {a,#a} #define VN(a) {a,#a}
// static VN_struct gmode[] = // static VN_struct gmode[] =
@ -165,7 +165,7 @@ create_the_forms (void)
/*************** Main Routine ***********************/ /*************** Main Routine ***********************/
char *browserlines[] = { const char *browserlines[] = {
" ", "@C1@c@l@bObjects Demo", " ", " ", "@C1@c@l@bObjects Demo", " ",
"This demo shows you all", "objects that currently", "This demo shows you all", "objects that currently",
"exist in the Forms Library.", " ", "exist in the Forms Library.", " ",
@ -184,7 +184,7 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
FL_COLOR c = FL_BLACK; FL_COLOR c = FL_BLACK;
char **p; const char **p;
VN_struct *vn; VN_struct *vn;
fl_initialize(&argc, argv, "FormDemo", 0, 0); fl_initialize(&argc, argv, "FormDemo", 0, 0);
@ -229,5 +229,5 @@ main (int argc, char *argv[])
} }
// //
// End of "$Id: forms.cxx,v 1.4.2.3 2001/01/22 15:13:41 easysw Exp $". // End of "$Id: forms.cxx,v 1.4.2.4 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: mandelbrot.cxx,v 1.8.2.3 2001/01/22 15:13:41 easysw Exp $" // "$Id: mandelbrot.cxx,v 1.8.2.4 2001/04/13 19:07:40 easysw Exp $"
// //
// Mandelbrot set demo for the Fast Light Tool Kit (FLTK). // Mandelbrot set demo for the Fast Light Tool Kit (FLTK).
// //
@ -171,9 +171,9 @@ int Drawing_Area::handle(int event) {
} }
jbrot.d->jX = X + (ix-x()-W/2)*scale/W; jbrot.d->jX = X + (ix-x()-W/2)*scale/W;
jbrot.d->jY = Y + (H/2-iy+y())*scale/W; jbrot.d->jY = Y + (H/2-iy+y())*scale/W;
static char buffer[128]; static char s[128];
sprintf(buffer, "Julia %.7f %.7f",jbrot.d->jX,jbrot.d->jY); sprintf(s, "Julia %.7f %.7f",jbrot.d->jX,jbrot.d->jY);
jbrot.window->label(buffer); jbrot.window->label(s);
jbrot.window->show(); jbrot.window->show();
jbrot.d->new_display(); jbrot.d->new_display();
} }
@ -187,15 +187,15 @@ void Drawing_Area::new_display() {
set_idle(); set_idle();
} }
void Drawing_Area::resize(int X,int Y,int W,int H) { void Drawing_Area::resize(int XX,int YY,int WW,int HH) {
if (W != w() || H != h()) { if (WW != w() || HH != h()) {
this->W = W-6; W = WW-6;
this->H = H-8; H = HH-8;
if (buffer) {delete[] buffer; buffer = 0; new_display();} if (buffer) {delete[] buffer; buffer = 0; new_display();}
} }
Fl_Box::resize(X,Y,W,H); Fl_Box::resize(XX,YY,WW,HH);
} }
// //
// End of "$Id: mandelbrot.cxx,v 1.8.2.3 2001/01/22 15:13:41 easysw Exp $". // End of "$Id: mandelbrot.cxx,v 1.8.2.4 2001/04/13 19:07:40 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
/* XPM */ /* XPM */
static char * porsche_xpm[] = { static const char * porsche_xpm[] = {
"64 64 4 1", "64 64 4 1",
" c #background", " c #background",
". c #000000000000", ". c #000000000000",