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
// 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) {
@@ -931,12 +931,12 @@ void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
@ -165,5 +165,5 @@ Fl_Adjuster::Fl_Adjuster(int x, int y, int w, int h, const char* l)
@@ -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 $".
@ -350,18 +350,18 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
@@ -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'.':
gotoBREAK;
@ -370,24 +370,24 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
@@ -370,24 +370,24 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
@ -130,11 +130,11 @@ Fl_Clock_Output::Fl_Clock_Output(int x, int y, int w, int h, const char *l)
@@ -130,11 +130,11 @@ Fl_Clock_Output::Fl_Clock_Output(int x, int y, int w, int h, const char *l)
@ -188,5 +188,5 @@ Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
@@ -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 $".
@ -125,8 +125,8 @@ int Fl_Dial::handle(int e) {
@@ -125,8 +125,8 @@ int Fl_Dial::handle(int e) {
returnhandle(e,x(),y(),w(),h());
}
Fl_Dial::Fl_Dial(intx,inty,intw,inth,constchar*l)
:Fl_Valuator(x,y,w,h,l){
Fl_Dial::Fl_Dial(intX,intY,intW,intH,constchar*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)
@@ -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 $".
@ -115,7 +115,7 @@ int // O - Height in pixels
@@ -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
intheight;// Width of line
inttextheight;// Height of text
@ -131,8 +131,8 @@ Fl_File_Browser::item_height(void *p) const // I - List item data
@@ -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
@@ -156,7 +156,7 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
{
inti;// 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
intwidth,// Width of line
@ -185,8 +185,8 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
@@ -185,8 +185,8 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
// 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
@@ -202,7 +202,7 @@ Fl_File_Browser::item_width(void *p) const // I - List item data
tempwidth=0;
column=0;
}
elseif(*text==column_char())
elseif(*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
@@ -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
@@ -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
intx,// I - Upper-lefthand X coordinate
inty,// I - Upper-lefthand Y coordinate
intw,// I - Width of item
inth)const// I - Height of item
intX,// I - Upper-lefthand X coordinate
intY,// I - Upper-lefthand Y coordinate
intW,// I - Width of item
intH)const// I - Height of item
{
inti;// Looping var
FL_BLINE*line;// Pointer to line
Fl_Colorc;// Text color
char*text,// Pointer into text
char*t,// Pointer into text
*ptr,// Pointer into fragment
fragment[10240];// Fragment of text
intwidth,// Width of line
@ -288,31 +288,31 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
@@ -288,31 +288,31 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
@ -326,27 +326,27 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
@@ -326,27 +326,27 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
// 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;
}
elseif(*text==column_char())
elseif(*t==column_char())
{
// Tab - nul terminate this fragment and draw it...
*ptr='\0';
intcW=w-width;// Clip width...
intcW=W-width;// Clip width...
if(columns)
{
@ -357,7 +357,7 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
@@ -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
@@ -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
@@ -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(intx,// I - Upper-lefthand X coordinate
inty,// I - Upper-lefthand Y coordinate
intw,// I - Width in pixels
inth,// I - Height in pixels
Fl_File_Browser::Fl_File_Browser(intX,// I - Upper-lefthand X coordinate
intY,// I - Upper-lefthand Y coordinate
intW,// I - Width in pixels
intH,// I - Height in pixels
constchar*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...
@ -209,19 +209,19 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
@@ -209,19 +209,19 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
// Font definitions for the Fast Light Tool Kit (FLTK).
//
@ -75,6 +75,7 @@ extern FL_EXPORT Fl_FontSize *fl_fontsize; // the currently selected one
@@ -75,6 +75,7 @@ extern FL_EXPORT Fl_FontSize *fl_fontsize; // the currently selected one
structFl_Fontdesc{
constchar*name;
charfontname[128];// "Pretty" font name
Fl_FontSize*first;// linked list of sizes of this style
@ -380,8 +380,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -380,8 +380,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
#endif
}
voidFl_RGB_Image::label(Fl_Widget*w){
w->image(this);
voidFl_RGB_Image::label(Fl_Widget*widget){
widget->image(this);
}
voidFl_RGB_Image::label(Fl_Menu_Item*m){
@ -391,5 +391,5 @@ 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 $".
// 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) {
@@ -749,8 +749,8 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
@ -266,8 +266,8 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
@@ -266,8 +266,8 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
@ -458,16 +456,16 @@ static inline void setitem(const Fl_Menu_Item* i, int m, int n) {
@@ -458,16 +456,16 @@ static inline void setitem(const Fl_Menu_Item* i, int m, int n) {
}
staticvoidsetitem(intm,intn){
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;
}
staticintforward(intmenu){// go to next item in menu menu if possible
@ -476,9 +474,9 @@ static int forward(int menu) { // go to next item in menu menu if possible
@@ -476,9 +474,9 @@ static int forward(int menu) { // go to next item in menu menu if possible
}
staticintbackward(intmenu){// previous item in menu menu if possible
@ -488,7 +486,7 @@ static int backward(int menu) { // previous item in menu menu if possible
@@ -488,7 +486,7 @@ static int backward(int menu) { // previous item in menu menu if possible
}
intmenuwindow::handle(inte){
menustate&p=*(::p);
menustate&pp=*p;
switch(e){
caseFL_KEYBOARD:
switch(Fl::event_key()){
@ -497,44 +495,44 @@ int menuwindow::handle(int e) {
@@ -497,44 +495,44 @@ int menuwindow::handle(int e) {
@ -105,5 +105,5 @@ Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l)
@@ -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 $".
// 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,
@@ -1967,7 +1967,7 @@ int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar,
int*foundPos){
intpos,gapLen=mGapEnd-mGapStart;
if(pos<0||pos>=mLength){
if(startPos<0||startPos>=mLength){
*foundPos=mLength;
return0;
}
@ -2003,11 +2003,11 @@ int Fl_Text_Buffer::findchar_backward( int startPos, char searchChar,
@@ -2003,11 +2003,11 @@ int Fl_Text_Buffer::findchar_backward( int startPos, char searchChar,
int*foundPos){
intpos,gapLen=mGapEnd-mGapStart;
if(startPos==0){
if(startPos<=0||startPos>=mLength){
*foundPos=0;
return0;
}
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) {
@@ -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 $".