diff --git a/CHANGES b/CHANGES index 6c631d611..684b4d96b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ CHANGES IN FLTK 1.1.0 + - FLTK convenience dialogs put the buttons in the wrong + order. + - Fl_BMP_Image didn't load 4-bit BMP files properly. - Minor tweeks to the WIN32 DLL support. - Fl_Text_Display::resize() could go into an infinite loop if the buffer is emptied. diff --git a/FL/fl_ask.H b/FL/fl_ask.H index 2a8293477..57fa9b96e 100644 --- a/FL/fl_ask.H +++ b/FL/fl_ask.H @@ -1,5 +1,5 @@ // -// "$Id: fl_ask.H,v 1.7.2.4.2.4 2002/03/23 15:35:08 easysw Exp $" +// "$Id: fl_ask.H,v 1.7.2.4.2.5 2002/08/30 16:58:16 easysw Exp $" // // Standard dialog header file for the Fast Light Tool Kit (FLTK). // @@ -58,9 +58,10 @@ extern FL_EXPORT const char* fl_no; extern FL_EXPORT const char* fl_yes; extern FL_EXPORT const char* fl_ok; extern FL_EXPORT const char* fl_cancel; +extern FL_EXPORT const char* fl_close; #endif // -// End of "$Id: fl_ask.H,v 1.7.2.4.2.4 2002/03/23 15:35:08 easysw Exp $". +// End of "$Id: fl_ask.H,v 1.7.2.4.2.5 2002/08/30 16:58:16 easysw Exp $". // diff --git a/src/Fl_BMP_Image.cxx b/src/Fl_BMP_Image.cxx index dc5e1f485..e10450a00 100644 --- a/src/Fl_BMP_Image.cxx +++ b/src/Fl_BMP_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_BMP_Image.cxx,v 1.1.2.9 2002/08/09 01:09:48 easysw Exp $" +// "$Id: Fl_BMP_Image.cxx,v 1.1.2.10 2002/08/30 16:58:16 easysw Exp $" // // Fl_BMP_Image routines. // @@ -239,24 +239,27 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read // Get a new color as needed... repcount --; - // Get the next color byte as needed... - if (color < 0) color = getc(fp); - // Extract the next pixel... if (bit == 0xf0) { - temp = (color >> 4) & 15; + // Get the next color byte as needed... + if (color < 0) temp = getc(fp); + else temp = color; + + // Copy the color value... + *ptr++ = colormap[(temp >> 4) & 15][2]; + *ptr++ = colormap[(temp >> 4) & 15][1]; + *ptr++ = colormap[(temp >> 4) & 15][0]; + bit = 0x0f; } else { - temp = color & 15; bit = 0xf0; + + // Copy the color value... + *ptr++ = colormap[temp & 15][2]; + *ptr++ = colormap[temp & 15][1]; + *ptr++ = colormap[temp & 15][0]; } -// printf("temp = %d\n", temp); - - // Copy the color value... - *ptr++ = colormap[temp][2]; - *ptr++ = colormap[temp][1]; - *ptr++ = colormap[temp][0]; } if (!compression) { @@ -393,5 +396,5 @@ read_long(FILE *fp) { // I - File to read from // -// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.9 2002/08/09 01:09:48 easysw Exp $". +// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.10 2002/08/30 16:58:16 easysw Exp $". // diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index 8ca8c9e21..927b1281d 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -173,7 +173,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char } { Fl_Group* o = new Fl_Group(0, 275, 480, 95); { Fl_Group* o = new Fl_Group(10, 275, 470, 20); - { Fl_Check_Button* o = previewButton = new Fl_Check_Button(405, 275, 75, 20, "Preview"); + { Fl_Check_Button* o = previewButton = new Fl_Check_Button(10, 275, 170, 20, "Preview"); o->down_box(FL_DOWN_BOX); o->value(1); o->shortcut(0x80070); @@ -246,16 +246,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char } callback_ = 0; data_ = 0; -directory_[0] = '\0'; -window->size_range(window->w(), window->h(), Fl::w(), Fl::h()); -type(t); -filter(p); -update_favorites(); -value(d); -type(t); -int e; -prefs_.get("preview", e, 1); -preview(e); +directory_[0] = ' } Fl_File_Chooser::~Fl_File_Chooser() { diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl index 4211ebb3a..fc52325d1 100644 --- a/src/Fl_File_Chooser.fl +++ b/src/Fl_File_Chooser.fl @@ -52,7 +52,7 @@ window->hide();} open code0 {favoritesButton->label(favorites_label);} } {} Fl_Button newButton { - callback {newdir();} selected + callback {newdir();} tooltip {Create a new directory.} image {new.xbm} xywh {455 10 25 25} labelsize 8 code0 {\#include } } @@ -79,8 +79,8 @@ window->hide();} open } { Fl_Check_Button previewButton { label Preview - callback {preview(previewButton->value());} - xywh {405 275 75 20} down_box DOWN_BOX shortcut 0x80070 value 1 + callback {preview(previewButton->value());} selected + xywh {10 275 170 20} down_box DOWN_BOX shortcut 0x80070 value 1 code0 {previewButton->label(preview_label);} } Fl_Box {} { @@ -166,16 +166,7 @@ window->hide();} } code {callback_ = 0; data_ = 0; -directory_[0] = '\0'; -window->size_range(window->w(), window->h(), Fl::w(), Fl::h()); -type(t); -filter(p); -update_favorites(); -value(d); -type(t); -int e; -prefs_.get("preview", e, 1); -preview(e);} {} +directory_[0] = '} {} } Function {~Fl_File_Chooser()} {open } { diff --git a/src/Fl_Help_Dialog.cxx b/src/Fl_Help_Dialog.cxx index 2d1645555..b2e9844c2 100644 --- a/src/Fl_Help_Dialog.cxx +++ b/src/Fl_Help_Dialog.cxx @@ -2,6 +2,7 @@ #include "../FL/Fl_Help_Dialog.H" #include "flstring.h" +#include inline void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) { if (view_->changed()) @@ -118,6 +119,7 @@ Fl_Help_Dialog::Fl_Help_Dialog() { } { Fl_Button* o = new Fl_Button(425, 350, 95, 25, "Close"); o->callback((Fl_Callback*)cb_Close); + o->label(fl_close); } { Fl_Button* o = back_ = new Fl_Button(365, 350, 25, 25, "@<-"); o->tooltip("Show the previous help page."); diff --git a/src/Fl_Help_Dialog.fl b/src/Fl_Help_Dialog.fl index 99b676eef..e948ed08e 100644 --- a/src/Fl_Help_Dialog.fl +++ b/src/Fl_Help_Dialog.fl @@ -2,7 +2,9 @@ version 1.0100 header_name {../FL/Fl_Help_Dialog.H} code_name {.cxx} -decl {\#include "flstring.h"} {selected +decl {\#include "flstring.h"} {} + +decl {\#include } {selected } class Fl_Help_Dialog {open @@ -15,8 +17,7 @@ class Fl_Help_Dialog {open } { Fl_Window window_ { label {Help Dialog} open - private xywh {470 380 530 385} type Double resizable - visible + private xywh {470 380 530 385} type Double resizable visible } { Fl_Group view_ { callback {if (view_->changed()) @@ -56,6 +57,7 @@ else if (view_->filename()) label Close callback {window_->hide();} xywh {425 350 95 25} + code0 {o->label(fl_close);} } Fl_Button back_ { label {@<-} diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 87e8b1427..f3c25dbfa 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_ask.cxx,v 1.8.2.8.2.9 2002/06/06 14:22:05 easysw Exp $" +// "$Id: fl_ask.cxx,v 1.8.2.8.2.10 2002/08/30 16:58:16 easysw Exp $" // // Standard dialog functions for the Fast Light Tool Kit (FLTK). // @@ -72,7 +72,8 @@ static Fl_Window *makeform() { o->color(FL_WHITE); o->labelcolor(FL_BLUE); } - (button[0] = new Fl_Button(310, 70, 90, 23))->shortcut("^["); + button[0] = new Fl_Button(310, 70, 90, 23); + button[0]->shortcut("^["); button[0]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP); button[1] = new Fl_Return_Button(210, 70, 90, 23); button[1]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP); @@ -149,11 +150,15 @@ void resizeform() { icon->labelsize(icon_size - 10); input->resize(20 + icon_size, 10 + message_h, message_w, 25); - for (x = w, i = 2; i >= 0; i --) + for (x = w, i = 0; i < 3; i ++) if (button_w[i]) { x -= button_w[i]; button[i]->resize(x, h - 10 - max_h, button_w[i] - 10, max_h); + +// printf("button %d (%s) is %dx%d+%d,%d\n", i, button[i]->label(), +// button[i]->w(), button[i]->h(), +// button[i]->x(), button[i]->y()); } } @@ -206,6 +211,7 @@ const char* fl_no = "No"; const char* fl_yes= "Yes"; const char* fl_ok = "OK"; const char* fl_cancel= "Cancel"; +const char* fl_close= "Close"; // fltk functions: void fl_beep(int type) { @@ -311,10 +317,6 @@ static const char* input_innards(const char* fmt, va_list ap, input->show(); input->value(defstr); -#ifdef WIN32 - MessageBeep(MB_ICONQUESTION); -#endif // WIN32 - int r = innards(fmt, ap, fl_cancel, fl_ok, 0); input->hide(); message->position(60,25); @@ -342,5 +344,5 @@ const char *fl_password(const char *fmt, const char *defstr, ...) { } // -// End of "$Id: fl_ask.cxx,v 1.8.2.8.2.9 2002/06/06 14:22:05 easysw Exp $". +// End of "$Id: fl_ask.cxx,v 1.8.2.8.2.10 2002/08/30 16:58:16 easysw Exp $". // diff --git a/test/ask.cxx b/test/ask.cxx index 8de2c3c35..8ad5a5aab 100644 --- a/test/ask.cxx +++ b/test/ask.cxx @@ -1,5 +1,5 @@ // -// "$Id: ask.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $" +// "$Id: ask.cxx,v 1.4.2.3.2.2 2002/08/30 16:58:16 easysw Exp $" // // Standard dialog test program for the Fast Light Tool Kit (FLTK). // @@ -38,48 +38,26 @@ #include #include -int get_string(char*buffer) { - Fl_Window window(320,75); - Fl_Input input(60, 10, 250, 25, "Input:"); - input.value(buffer); - Fl_Button cancel(60, 40, 80, 25, "cancel"); - Fl_Return_Button ok(150, 40, 80, 25, "OK"); - window.hotspot(&cancel); // you must position modal windows - window.end(); - window.set_modal(); - window.show(); - for (;;) { - Fl::wait(); - Fl_Widget *o; - while ((o = Fl::readqueue())) { - if (o == &ok) { - strcpy(buffer,input.value()); - return 1; - } else if (o == &cancel || o == &window) { - return 0; - } - } - } -} - -void rename_me(Fl_Widget*o) { - if (get_string((char*)(o->label()))) o->redraw(); -} - -#if 1 #include #include +void rename_me(Fl_Widget*o) { + const char *input = fl_input("Input:", o->label()); + + if (input) { + o->label(input); + o->redraw(); + } +} + void window_callback(Fl_Widget*, void*) { if (!fl_ask("Are you sure you want to quit?")) return; exit(0); } -#endif int main(int argc, char **argv) { char buffer[128] = "test text"; -#if 1 // this is a test to make sure automatic destructors work. Pop up // the question dialog several times and make sure it don't crash. @@ -93,22 +71,8 @@ int main(int argc, char **argv) { window.callback(window_callback); return Fl::run(); - -#else -// This is the demo as written in the documentation, it only creates -// the popup window once: - - if (get_string(buffer)) { - puts(buffer); - } else { - puts("cancel"); - } - return 0; - -#endif - } // -// End of "$Id: ask.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: ask.cxx,v 1.4.2.3.2.2 2002/08/30 16:58:16 easysw Exp $". //