Fix for numericsort(), and drawing of some box types.

git-svn-id: file:///fltk/svn/fltk/trunk@107 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-12-02 15:47:30 +00:00
parent 849e11623e
commit 92402e682a
5 changed files with 39 additions and 32 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Widget_Type.cxx,v 1.9 1998/11/25 16:59:05 mike Exp $" // "$Id: Fl_Widget_Type.cxx,v 1.10 1998/12/02 15:47:28 mike Exp $"
// //
// Widget type code for the Fast Light Tool Kit (FLTK). // Widget type code for the Fast Light Tool Kit (FLTK).
// //
@ -1151,7 +1151,7 @@ void selection_changed(Fl_Type *p) {
// test to see if user named a function, or typed in code: // test to see if user named a function, or typed in code:
int is_name(const char *c) { int is_name(const char *c) {
for (; *c; c++) if (ispunct(*c) && *c!='_') return 0; for (; *c; c++) if (ispunct(*c) && *c!='_' && *c!=':') return 0;
return 1; return 1;
} }
@ -1701,5 +1701,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
} }
// //
// End of "$Id: Fl_Widget_Type.cxx,v 1.9 1998/11/25 16:59:05 mike Exp $". // End of "$Id: Fl_Widget_Type.cxx,v 1.10 1998/12/02 15:47:28 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Scroll.cxx,v 1.5 1998/11/18 18:38:32 mike Exp $" // "$Id: Fl_Scroll.cxx,v 1.6 1998/12/02 15:47:29 mike Exp $"
// //
// Scroll widget for the Fast Light Tool Kit (FLTK). // Scroll widget for the Fast Light Tool Kit (FLTK).
// //
@ -153,12 +153,12 @@ void Fl_Scroll::draw() {
scrollbar.resize(scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W, scrollbar.resize(scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
Y, scrollbar.w(), H); Y, scrollbar.w(), H);
scrollbar.value(oldy = yposition_ = (Y-t), H, t, b-t); scrollbar.value(oldy = yposition_ = (Y-t), H, 0, b-t);
hscrollbar.resize(X, hscrollbar.resize(X,
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H, scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
W, hscrollbar.h()); W, hscrollbar.h());
hscrollbar.value(oldx = xposition_ = (X-l), W, l, r-l); hscrollbar.value(oldx = xposition_ = (X-l), W, 0, r-l);
// draw the scrollbars: // draw the scrollbars:
if (d & FL_DAMAGE_ALL) { if (d & FL_DAMAGE_ALL) {
@ -231,5 +231,5 @@ int Fl_Scroll::handle(int event) {
} }
// //
// End of "$Id: Fl_Scroll.cxx,v 1.5 1998/11/18 18:38:32 mike Exp $". // End of "$Id: Fl_Scroll.cxx,v 1.6 1998/12/02 15:47:29 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_win32.cxx,v 1.17 1998/11/08 17:02:39 mike Exp $" // "$Id: Fl_win32.cxx,v 1.18 1998/12/02 15:47:29 mike Exp $"
// //
// WIN32-specific code for the Fast Light Tool Kit (FLTK). // WIN32-specific code for the Fast Light Tool Kit (FLTK).
// //
@ -813,5 +813,5 @@ void Fl_Window::flush() {
} }
// //
// End of "$Id: Fl_win32.cxx,v 1.17 1998/11/08 17:02:39 mike Exp $". // End of "$Id: Fl_win32.cxx,v 1.18 1998/12/02 15:47:29 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fl_boxtype.cxx,v 1.5 1998/11/08 15:05:46 mike Exp $" // "$Id: fl_boxtype.cxx,v 1.6 1998/12/02 15:47:30 mike Exp $"
// //
// Box drawing code for the Fast Light Tool Kit (FLTK). // Box drawing code for the Fast Light Tool Kit (FLTK).
// //
@ -120,9 +120,9 @@ void fl_up_frame(int x, int y, int w, int h, Fl_Color) {
fl_frame2("HHWW",x,y,w,h); fl_frame2("HHWW",x,y,w,h);
#else #else
#if BORDER_WIDTH == 2 #if BORDER_WIDTH == 2
fl_frame2("AAUWMMSS",x,y,w,h); fl_frame2("AAUWMMTT",x,y,w,h);
#else #else
fl_frame("AAAAWUJJUSNN",x,y,w,h); fl_frame("AAAAWUJJUTNN",x,y,w,h);
#endif #endif
#endif #endif
} }
@ -142,7 +142,7 @@ void fl_down_frame(int x, int y, int w, int h, Fl_Color) {
#if BORDER_WIDTH == 2 #if BORDER_WIDTH == 2
fl_frame2("UWMMPPAA",x,y,w,h); fl_frame2("UWMMPPAA",x,y,w,h);
#else #else
fl_frame("NNSUJJUWAAAA",x,y,w,h); fl_frame("NNTUJJUWAAAA",x,y,w,h);
#endif #endif
#endif #endif
} }
@ -282,5 +282,5 @@ const {
} }
// //
// End of "$Id: fl_boxtype.cxx,v 1.5 1998/11/08 15:05:46 mike Exp $". // End of "$Id: fl_boxtype.cxx,v 1.6 1998/12/02 15:47:30 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
/* /*
* "$Id: numericsort.c,v 1.7 1998/11/09 16:25:59 mike Exp $" * "$Id: numericsort.c,v 1.8 1998/12/02 15:47:30 mike Exp $"
* *
* Numeric sorting routine for the Fast Light Tool Kit (FLTK). * Numeric sorting routine for the Fast Light Tool Kit (FLTK).
* *
@ -56,26 +56,33 @@ extern "C"
int numericsort(struct dirent **A, struct dirent **B) { int numericsort(struct dirent **A, struct dirent **B) {
const char* a = (*A)->d_name; const char* a = (*A)->d_name;
const char* b = (*B)->d_name; const char* b = (*B)->d_name;
int ret = 0;
for (;;) { for (;;) {
if (isdigit(*a) && isdigit(*b)) { if (isdigit(*a) && isdigit(*b)) {
int anum = 0, bnum = 0; int diff,magdiff;
while (*a == '0') a++;
while (isdigit(*a)) anum = anum * 10 + *a++ - '0'; while (*b == '0') b++;
while (isdigit(*b)) bnum = bnum * 10 + *b++ - '0'; while (isdigit(*a) && *a == *b) {a++; b++;}
diff = (isdigit(*a) && isdigit(*b)) ? *a - *b : 0;
if (anum < bnum) return (-1); magdiff = 0;
else if (anum > bnum) return (1); while (isdigit(*a)) {magdiff++; a++;}
} else if (tolower(*a) < tolower(*b)) return (-1); while (isdigit(*b)) {magdiff--; b++;}
else if (tolower(*a) > tolower(*b)) return (1); if (magdiff) {ret = magdiff; break;} /* compare # of significant digits*/
else { if (diff) {ret = diff; break;} /* compare first non-zero digit */
if (*a == '\0') return (0); } else {
a++; #if 1
b++; if ((ret = tolower(*a)-tolower(*b))) break; /* compare case-insensitve */
#else
if ((ret = *a-*b)) break; /* compare case-sensitive */
#endif
if (!*a) break;
a++; b++;
} }
} }
if (!ret) return 0;
else return (ret < 0) ? -1 : 1;
} }
/* /*
* End of "$Id: numericsort.c,v 1.7 1998/11/09 16:25:59 mike Exp $". * End of "$Id: numericsort.c,v 1.8 1998/12/02 15:47:30 mike Exp $".
*/ */