From 90e8eb7a4501562728d016eddc31225e7a4bd7fc Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 19 Oct 1998 21:00:26 +0000 Subject: [PATCH] More changes from Bill Spitzak. git-svn-id: file:///fltk/svn/fltk/trunk@20 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Browser.H | 2 +- FL/win32.H | 1 + FL/x.H | 1 + fluid/Fl_Function_Type.cxx | 12 ++--- fluid/Fl_Widget_Type.cxx | 3 +- fluid/Fl_Window_Type.cxx | 1 - fluid/about_panel.cxx | 3 +- fluid/alignment_panel.cxx | 3 +- fluid/fluid.cxx | 1 - fluid/widget_panel.cxx | 5 +- src/Fl.cxx | 17 ++++--- src/Fl_Menu.cxx | 13 +++-- src/Fl_win32.cxx | 101 +++++++++++++++++-------------------- src/Fl_x.cxx | 39 +++++++------- src/fl_cursor.cxx | 4 +- src/fl_draw.cxx | 11 ++-- src/fl_file_chooser.cxx | 16 +++--- test/checkers.cxx | 1 + test/style_ui.C | 18 +++---- test/style_ui.H | 4 +- 20 files changed, 119 insertions(+), 137 deletions(-) diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index aaf2975d5..e8f98c786 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -74,7 +74,7 @@ public: char column_char() const {return column_char_;} void column_char(char c) {column_char_ = c;} const int* column_widths() const {return column_widths_;} - void column_widths(const int* l) { column_widths_=l; } + void column_widths(const int* l) {column_widths_ = l;} int displayed(int n) const {return Fl_Browser_::displayed(find_line(n));} diff --git a/FL/win32.H b/FL/win32.H index dbb812a34..7ca32ea36 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -44,6 +44,7 @@ public: Fl_Window* w; Region region; Fl_X *next; + int wait_for_expose; HDC private_dc; // used for OpenGL HCURSOR cursor; static Fl_X* first; diff --git a/FL/x.H b/FL/x.H index 3e6c2c01f..bd1bcd462 100644 --- a/FL/x.H +++ b/FL/x.H @@ -68,6 +68,7 @@ public: Fl_Window *w; Region region; Fl_X *next; + int wait_for_expose; static Fl_X* first; static Fl_X* i(const Fl_Window* w) {return w->i;} void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 32926e1ca..21bdb5b37 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -66,8 +66,6 @@ const char *c_check(const char *c, int type) { class Fl_Function_Type : public Fl_Type { const char* return_type; - const char* actual_return_type; - const char* star; char public_, constructor, havewidgets; public: Fl_Type *make(); @@ -168,21 +166,21 @@ void Fl_Function_Type::write_code1() { Fl_Type *child; const char* widget_type = 0; for (child = next; child && child->level > level; child = child->next) - if (child->is_widget() && child->level == level+1) { + if (child->is_widget()) { havewidgets = 1; widget_type = subclassname(child); + break; } write_c("\n"); if (ismain()) write_c("int main(int argc, char **argv) {\n"); else { const char* t = return_type; - star = ""; + const char* star = ""; if (!t) { if (havewidgets) {t = widget_type; star = "*";} else t = "void"; } - actual_return_type=t; const char* k = class_name(); if (k) { write_public(public_); @@ -202,7 +200,7 @@ void Fl_Function_Type::write_code1() { write_c("%s%s %s {\n", t, star, name()); } } - if (havewidgets) write_c(" Fl_Window* w;\n"); + if (havewidgets) write_c(" %s* w;\n", widget_type); indentation += 2; } @@ -211,7 +209,7 @@ void Fl_Function_Type::write_code2() { if (havewidgets) write_c(" w->show(argc, argv);\n"); write_c(" return Fl::run();\n"); } else if (havewidgets && !constructor) - write_c(" return (%s%s)w;\n", actual_return_type, star); + write_c(" return w;\n"); write_c("}\n"); indentation = 0; } diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index c979799ac..96c22acea 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1267,7 +1267,7 @@ void Fl_Widget_Type::write_code1() { if (varused) write_c("{ %s* o = ", t); if (name()) write_c("%s = ", name()); if (is_window()) { - write_c("new %s(%d, %d", t, o->w(), o->h()); + write_c("w = new %s(%d, %d", t, o->w(), o->h()); // prevent type() code from being emitted: ((Fl_Widget_Type*)factory)->o->type(o->type()); } else { @@ -1279,7 +1279,6 @@ void Fl_Widget_Type::write_code1() { } write_c(");\n"); indentation += 2; - if (is_window()) write_c("%sw = o;\n", indent()); if (varused) write_widget_code(); } diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index cc3f94942..714ec4b30 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -53,7 +53,6 @@ void header_input_cb(Fl_Input* i, void*) { } void code_input_cb(Fl_Input* i, void*) { code_file_name = i->value(); - printf("code file name set to %s\n", code_file_name); } void include_H_from_C_button_cb(Fl_Light_Button* b, void*) { diff --git a/fluid/about_panel.cxx b/fluid/about_panel.cxx index 78b48a6bb..a880d39dd 100644 --- a/fluid/about_panel.cxx +++ b/fluid/about_panel.cxx @@ -19,8 +19,7 @@ static void cb_OK(Fl_Return_Button* o, void*) { Fl_Window* make_about_panel(const char *copyright) { Fl_Window* w; - { Fl_Window* o = about_panel = new Fl_Window(309, 221, "about fluid"); - w = o; + { Fl_Window* o = about_panel = w = new Fl_Window(309, 221, "about fluid"); o->box(FL_UP_BOX); o->color(97); o->selection_color(47); diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx index bb5691ab7..b5ab1f91d 100644 --- a/fluid/alignment_panel.cxx +++ b/fluid/alignment_panel.cxx @@ -22,8 +22,7 @@ Fl_Light_Button *include_H_from_C_button; Fl_Window* make_alignment_window() { Fl_Window* w; - { Fl_Window* o = alignment_window = new Fl_Window(210, 310, "fluid Preferences"); - w = o; + { Fl_Window* o = alignment_window = w = new Fl_Window(210, 310, "fluid Preferences"); { Fl_Box* o = new Fl_Box(10, 20, 190, 100, "ALIGNMENT:"); o->box(FL_ENGRAVED_FRAME); o->labelsize(10); diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 3ad9e827c..384eb5104 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -365,7 +365,6 @@ int main(int argc,char **argv) { } const char *c = argv[i]; make_main_window(); - include_H_from_C=1; if (c) set_filename(c); if (!compile_only) { Fl::visual((Fl_Mode)(FL_DOUBLE|FL_INDEX)); diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 46e74066a..23ee01e19 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -5,9 +5,8 @@ Fl_Input *v_input[4]; Fl_Window* make_widget_panel() { - Fl_Window* w; - { Fl_Window* o = new Fl_Window(370, 480); - w = o; + Fl_Window *w; + { Fl_Window* o = w = new Fl_Window(370, 480); w->hotspot(o); { Fl_Input* o = new Fl_Input(90, 10, 210, 20, "name:"); o->box(FL_THIN_UP_BOX); diff --git a/src/Fl.cxx b/src/Fl.cxx index 25923607e..a0755b6eb 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -122,7 +122,7 @@ void Fl::flush() { if (damage()) { damage_ = 0; for (Fl_X* x = Fl_X::first; x; x = x->next) { - if (x->w->damage() && x->w->visible()) { + if (!x->wait_for_expose && x->w->damage() && x->w->visible()) { x->flush(); x->w->clear_damage(); } @@ -415,10 +415,10 @@ int Fl::handle(int event, Fl_Window* window) fl_xmousewin = window; fl_fix_focus(); } if (Fl::pushed()) { + w = Fl::pushed(); + event = FL_DRAG; Fl::e_x += mouse_dx; Fl::e_y += mouse_dy; - event = FL_DRAG; - w = Fl::pushed(); } else if (Fl::grab()) w = Fl::grab(); else if (Fl::modal() && w != Fl::modal()) @@ -426,11 +426,11 @@ int Fl::handle(int event, Fl_Window* window) break; case FL_RELEASE: { - if (Fl::pushed_) { + if (Fl::pushed()) { + w = Fl::pushed(); + Fl::pushed_ = 0; // must be zero before callback is done! Fl::e_x += mouse_dx; Fl::e_y += mouse_dy; - w = Fl::pushed_; - Fl::pushed_ = 0; // must be zero before callback is done! } int r = w->handle(event); fl_fix_focus(); @@ -527,8 +527,9 @@ void Fl_Window::hide() { #ifdef WIN32 if (x->private_dc) ReleaseDC(x->xid,x->private_dc); if (x->xid == fl_window) fl_GetDC(0); // releases dc belonging to window -#endif +#else if (x->region) XDestroyRegion(x->region); +#endif XDestroyWindow(fl_display, x->xid); delete x; @@ -584,5 +585,5 @@ void fl_throw_focus(Fl_Widget *o) { } // -// End of "$Id: Fl.cxx,v 1.4 1998/10/19 20:45:34 mike Exp $". +// End of "$Id: Fl.cxx,v 1.5 1998/10/19 21:00:20 mike Exp $". // diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index afee88cf0..36cc84557 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -147,7 +147,7 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m, b = m ? m->box() : FL_UP_BOX; } else { r = (Fl_Color)(FL_COLOR_CUBE-1); // white - b = FL_THIN_UP_BOX; + //b = FL_THIN_UP_BOX; } } else { l.color = contrast((Fl_Color)labelcolor_, r); @@ -359,7 +359,7 @@ int menuwindow::find_selected(int mx, int my) { if (!menu || !menu->text) return -1; mx -= x(); my -= y(); - if (my <= 0 || my >= h()) return -1; + if (my < 0 || my >= h()) return -1; if (!itemheight) { // menubar int x = BW; int i = 0; const Fl_Menu_Item* m = menu; @@ -370,11 +370,10 @@ int menuwindow::find_selected(int mx, int my) { } return i; } - if (mx <= 0 || mx >= w()) return -1; - my -= h()-(BOTTOM + numitems*itemheight - LEADING + 2); - if (my <= 0) return -1; - int i = my/itemheight; + if (mx < 0 || mx >= w()) return -1; + int i = (my-(TOP-1))/itemheight; if (i>=numitems) i = numitems-1; + else if (i < 0) i = 0; return i; } @@ -712,5 +711,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const { } // -// End of "$Id: Fl_Menu.cxx,v 1.3 1998/10/19 20:45:51 mike Exp $". +// End of "$Id: Fl_Menu.cxx,v 1.4 1998/10/19 21:00:20 mike Exp $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 5d9febede..604520031 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -164,29 +164,29 @@ static int mouse_event(Fl_Window *window, int what, int button, // convert a MSWindows VK_x to an Fltk (X) Keysym: // See also the inverse converter in Fl_get_key_win32.C // This table is in numeric order by VK: -static const struct {unsigned short vk, fltk;} vktab[] = { +static const struct {unsigned short vk, fltk, extended;} vktab[] = { {VK_BACK, FL_BackSpace}, {VK_TAB, FL_Tab}, {VK_CLEAR, FL_KP+'5'}, - {VK_RETURN, FL_Enter}, - {VK_SHIFT, FL_Shift_L}, - {VK_CONTROL, FL_Control_L}, - {VK_MENU, FL_Alt_L}, + {VK_RETURN, FL_Enter, FL_KP_Enter}, + {VK_SHIFT, FL_Shift_L, FL_Shift_R}, + {VK_CONTROL, FL_Control_L, FL_Control_R}, + {VK_MENU, FL_Alt_L, FL_Alt_R}, {VK_PAUSE, FL_Pause}, {VK_CAPITAL, FL_Caps_Lock}, {VK_ESCAPE, FL_Escape}, {VK_SPACE, ' '}, - {VK_PRIOR, FL_KP+'9'}, - {VK_NEXT, FL_KP+'3'}, - {VK_END, FL_KP+'1'}, - {VK_HOME, FL_KP+'7'}, - {VK_LEFT, FL_KP+'4'}, - {VK_UP, FL_KP+'8'}, - {VK_RIGHT, FL_KP+'6'}, - {VK_DOWN, FL_KP+'2'}, + {VK_PRIOR, FL_KP+'9', FL_Page_Up}, + {VK_NEXT, FL_KP+'3', FL_Page_Down}, + {VK_END, FL_KP+'1', FL_End}, + {VK_HOME, FL_KP+'7', FL_Home}, + {VK_LEFT, FL_KP+'4', FL_Left}, + {VK_UP, FL_KP+'8', FL_Up}, + {VK_RIGHT, FL_KP+'6', FL_Right}, + {VK_DOWN, FL_KP+'2', FL_Down}, {VK_SNAPSHOT, FL_Print}, // does not work on NT - {VK_INSERT, FL_KP+'0'}, - {VK_DELETE, FL_KP+'.'}, + {VK_INSERT, FL_KP+'0', FL_Insert}, + {VK_DELETE, FL_KP+'.', FL_Delete}, {VK_LWIN, FL_Meta_L}, {VK_RWIN, FL_Meta_R}, {VK_APPS, FL_Menu}, @@ -211,35 +211,19 @@ static const struct {unsigned short vk, fltk;} vktab[] = { }; static int ms2fltk(int vk, int extended) { static unsigned short vklut[256]; + static unsigned short extendedlut[256]; if (!vklut[1]) { // init the table unsigned int i; for (i = 0; i < 256; i++) vklut[i] = tolower(i); for (i=VK_F1; i<=VK_F16; i++) vklut[i] = i+(FL_F-(VK_F1-1)); for (i=VK_NUMPAD0; i<=VK_NUMPAD9; i++) vklut[i] = i+(FL_KP+'0'-VK_NUMPAD0); - for (i = 0; i < sizeof(vktab)/sizeof(*vktab); i++) + for (i = 0; i < sizeof(vktab)/sizeof(*vktab); i++) { vklut[vktab[i].vk] = vktab[i].fltk; + extendedlut[vktab[i].vk] = vktab[i].extended; } - if (extended) - { - //this is lame, have to check the vk code to make it faster - switch (vk) { - case VK_INSERT: return FL_Insert; - case VK_DELETE: return FL_Delete; - case VK_END: return FL_End; - case VK_DOWN: return FL_Down; - case VK_NEXT: return FL_Page_Down; - case VK_LEFT: return FL_Left; - case VK_RIGHT: return FL_Right; - case VK_HOME: return FL_Home; - case VK_UP: return FL_Up; - case VK_PRIOR: return FL_Page_Up; - case VK_SHIFT: return FL_Shift_R; - case VK_CONTROL : return FL_Control_R; - case VK_MENU: return FL_Alt_R; - case VK_RETURN: return FL_KP_Enter; + for (i = 0; i < 256; i++) if (!extendedlut[i]) extendedlut[i] = vklut[i]; } - } - return vklut[vk]; + return extended ? extendedlut[vk] : vklut[vk]; } #if USE_COLORMAP @@ -275,6 +259,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar // "exposure alert", like the X event. Fl_X *i = Fl_X::i(window); + i->wait_for_expose = 0; + // if region == entire window we should delete i->region, else if (window->damage()) { if (i->region) { InvalidateRgn(hWnd,i->region,FALSE); @@ -336,19 +322,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar goto STUPID_MICROSOFT; } // otherwise use it as a 0-character key... - // otherwise use it as a 0-character key... case WM_DEADCHAR: case WM_SYSDEADCHAR: - buffer[0] = 0; - Fl::e_text = buffer; - Fl::e_length = 0; - goto GETSTATE; case WM_CHAR: case WM_SYSCHAR: - buffer[0] = char(wParam); - Fl::e_text = buffer; - Fl::e_length = 1; - GETSTATE: {ulong state = Fl::e_state & 0xff000000; // keep the mouse button state // if GetKeyState is expensive we might want to comment some of these out: if (GetKeyState(VK_SHIFT)&~1) state |= FL_SHIFT; @@ -363,6 +340,17 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK; Fl::e_state = state;} if (lParam & (1<<31)) goto DEFAULT; // ignore up events after fixing shift + if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { + buffer[0] = char(wParam); + Fl::e_length = 1; + } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { + buffer[0] = Fl::e_keysym-FL_KP; + Fl::e_length = 1; + } else { + buffer[0] = 0; + Fl::e_length = 0; + } + Fl::e_text = buffer; // for (int i = lParam&0xff; i--;) while (window->parent()) window = window->window(); if (Fl::handle(FL_KEYBOARD,window)) return 0; @@ -426,14 +414,17 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar //////////////////////////////////////////////////////////////// void Fl_Window::resize(int X,int Y,int W,int H) { - int resize_from_program = 1; - if (this == resize_bug_fix) { - resize_from_program = 0; - resize_bug_fix = 0; - } - if (X==x() && Y==y() && W==w() && H==h()) return; + int is_a_resize = (W != w() || H != h()); + int resize_from_program = (this != resize_bug_fix); + if (!resize_from_program) resize_bug_fix = 0; if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION); - if (W != w() || H != h()) Fl_Group::resize(X,Y,W,H); else {x(X); y(Y);} + else if (!is_a_resize) return; + if (is_a_resize) { + Fl_Group::resize(X,Y,W,H); + if (shown()) {redraw(); i->wait_for_expose = 1;} + } else { + x(X); y(Y); + } if (resize_from_program && shown()) { if (border() && !parent()) { X -= GetSystemMetrics(SM_CXFRAME); @@ -442,7 +433,6 @@ void Fl_Window::resize(int X,int Y,int W,int H) { H += 2*GetSystemMetrics(SM_CYFRAME)+GetSystemMetrics(SM_CYCAPTION); } MoveWindow(i->xid, X, Y, W, H, TRUE); - //if (!parent()) redraw(); } } @@ -455,7 +445,6 @@ int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR Fl_X* Fl_X::make(Fl_Window* w) { Fl_Group::current(0); // get rid of very common user bug: forgot end() - w->clear_damage(); // wait for expose events static char* class_name; if (!class_name) { // create a single WNDCLASS used for everything: @@ -555,8 +544,10 @@ Fl_X* Fl_X::make(Fl_Window* w) { // use w->xclass() to set the icon... + x->wait_for_expose = 1; w->set_visible(); w->handle(FL_SHOW); // get child windows to appear + w->redraw(); // force draw to happen // If we've captured the mouse, we dont want do activate any // other windows from the code, or we loose the capture. ShowWindow(x->xid, fl_show_iconic ? SW_SHOWMINNOACTIVE : @@ -737,5 +728,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl_win32.cxx,v 1.8 1998/10/19 20:46:19 mike Exp $". +// End of "$Id: Fl_win32.cxx,v 1.9 1998/10/19 21:00:21 mike Exp $". // diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 29599e1d6..030e0a2b2 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -340,11 +340,12 @@ int fl_handle(const XEvent& xevent) break; case Expose: - case GraphicsExpose: -#if 1 // try to keep windows on top even if WM_TRANSIENT_FOR does not work: + Fl_X::i(window)->wait_for_expose = 0; + // try to keep windows on top even if WM_TRANSIENT_FOR does not work: if (Fl::first_window()->non_modal() && window != Fl::first_window()) Fl::first_window()->show(); -#endif + + case GraphicsExpose: window->damage(FL_DAMAGE_EXPOSE, xevent.xexpose.x, xevent.xexpose.y, xevent.xexpose.width, xevent.xexpose.height); return 1; @@ -413,8 +414,8 @@ int fl_handle(const XEvent& xevent) // ascii characters. This won't work on non-PC layout keyboards, // but are there any of those left?? buffer[0] = "7486293150."[keysym-0xff95]; - len = 1; keysym = FL_KP+buffer[0]; + len = 1; } buffer[len] = 0; Fl::e_keysym = int(keysym); @@ -466,23 +467,23 @@ int fl_handle(const XEvent& xevent) //////////////////////////////////////////////////////////////// void Fl_Window::resize(int X,int Y,int W,int H) { - if (resize_bug_fix == this) - resize_bug_fix = 0; - else if (shown()) { - // tell X window manager to change window size: - if (!(flags()&FL_FORCE_POSITION) && X == x() && Y == y()) - XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1); - else if (W != w() || H != h()) + int is_a_resize = (W != w() || H != h()); + int resize_from_program = (this != resize_bug_fix); + if (!resize_from_program) resize_bug_fix = 0; + if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION); + else if (!is_a_resize) return; + if (is_a_resize) { + Fl_Group::resize(X,Y,W,H); + if (shown()) {redraw(); i->wait_for_expose = 1;} + } else { + x(X); y(Y); + } + if (resize_from_program && shown()) { + if (is_a_resize) XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1); else XMoveWindow(fl_display, i->xid, X, Y); } - if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION); - if (W != w() || H != h()) Fl_Group::resize(X,Y,W,H); else {x(X); y(Y);} - // Notice that this does *not* set any redraw bits. I assumme - // I will receive damage for the whole window from X. I think - // that "ForgetGravity" forces the expose event for the entire - // window, but this may not be true on some implementations. } //////////////////////////////////////////////////////////////// @@ -497,9 +498,11 @@ Fl_X* Fl_X::set_xid(Fl_Window* w, Window xid) { x->setwindow(w); x->next = Fl_X::first; x->region = 0; + x->wait_for_expose = 1; Fl_X::first = x; w->set_visible(); w->handle(FL_SHOW); // get child windows to appear + w->redraw(); fl_fix_focus(); // if this is modal we must fix focus now return x; } @@ -804,5 +807,5 @@ void Fl_Window::flush() { #endif // -// End of "$Id: Fl_x.cxx,v 1.5 1998/10/19 20:46:20 mike Exp $". +// End of "$Id: Fl_x.cxx,v 1.6 1998/10/19 21:00:22 mike Exp $". // diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx index 01ca6a8ae..6254cc919 100644 --- a/src/fl_cursor.cxx +++ b/src/fl_cursor.cxx @@ -84,7 +84,7 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { #define CURSORSIZE 16 #define HOTXY 7 -static struct TableEntry { +struct TableEntry { uchar bits[CURSORSIZE*CURSORSIZE/8]; uchar mask[CURSORSIZE*CURSORSIZE/8]; Cursor cursor; @@ -167,5 +167,5 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { #endif // -// End of "$Id: fl_cursor.cxx,v 1.3 1998/10/19 20:46:31 mike Exp $". +// End of "$Id: fl_cursor.cxx,v 1.4 1998/10/19 21:00:22 mike Exp $". // diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 5215b5f17..1693adc79 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -117,12 +117,6 @@ void fl_draw( Fl_Align align, void (*callthis)(const char*,int,int,int) ) { - if (!str || !*str) return; - - // clip: - if (w && h && !fl_not_clipped(x, y, w, h)) return; - if (align & FL_ALIGN_CLIP) fl_clip(x, y, w, h); - const char* p; const char* e; char buf[MAXBUF]; @@ -171,6 +165,9 @@ void fl_draw( const char* str, // the (multi-line) string int x, int y, int w, int h, // bounding box Fl_Align align) { + if (!str || !*str) return; + if (w && h && !fl_not_clipped(x, y, w, h)) return; + if (align & FL_ALIGN_CLIP) fl_clip(x, y, w, h); fl_draw(str, x, y, w, h, align, fl_draw); } @@ -196,5 +193,5 @@ void fl_measure(const char* str, int& w, int& h) { } // -// End of "$Id: fl_draw.cxx,v 1.2 1998/10/19 20:46:33 mike Exp $". +// End of "$Id: fl_draw.cxx,v 1.3 1998/10/19 21:00:23 mike Exp $". // diff --git a/src/fl_file_chooser.cxx b/src/fl_file_chooser.cxx index 70760e07a..005160c32 100644 --- a/src/fl_file_chooser.cxx +++ b/src/fl_file_chooser.cxx @@ -336,18 +336,16 @@ void FCB::set(const char* buf) { } void FCB::draw() { - if (message) { + if (!message) { + Fl_Browser_::draw(); + if (full_height() > 0) return; + message = "No matching files"; + } Fl_Boxtype b = box(); if (!b) b = Fl_Input_::default_box(); draw_box(b,color()); fl_color(FL_INACTIVE_COLOR); + fl_font(textfont(), textsize(), default_font(), default_size()); fl_draw(message, x()+7, y()+3, w(), h()-3, FL_ALIGN_TOP_LEFT); - } else { - Fl_Browser_::draw(); - if (full_height()<=0) { - message = "No matching files"; - draw(); - } - } } void FCB::clear_prev() { @@ -613,5 +611,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname) } // -// End of "$Id: fl_file_chooser.cxx,v 1.2 1998/10/19 20:46:37 mike Exp $". +// End of "$Id: fl_file_chooser.cxx,v 1.3 1998/10/19 21:00:24 mike Exp $". // diff --git a/test/checkers.cxx b/test/checkers.cxx index 56a313d10..fd48f56d0 100644 --- a/test/checkers.cxx +++ b/test/checkers.cxx @@ -1143,6 +1143,7 @@ int Board::handle(int e) { void quit_cb(Fl_Widget*, void*) {exit(0);} int FLTKmain(int argc, char** argv) { + Fl::visual(FL_DOUBLE|FL_INDEX); Board b(BOARDSIZE,BOARDSIZE); b.callback(quit_cb); b.show(argc,argv); diff --git a/test/style_ui.C b/test/style_ui.C index 65d52b883..657ca7014 100644 --- a/test/style_ui.C +++ b/test/style_ui.C @@ -2,7 +2,7 @@ #include "style_ui.H" -Fl_Window *style_panel; +Fl_Double_Window *style_panel; static void cb_OK(Fl_Return_Button* o, void*) { o->window()->hide(); @@ -46,10 +46,10 @@ static void cb_click(Fl_Button*, void*) { } static Fl_Menu_Item* font_menu(); -void show_style_panel() { - Fl_Window *w; +Fl_Double_Window* show_style_panel() { + Fl_Double_Window* w; if (!style_panel) { - { Fl_Window* o = style_panel = w = new Fl_Double_Window(335, 425, "style"); + { Fl_Double_Window* o = style_panel = w = new Fl_Double_Window(335, 425, "style"); { Fl_Choice* o = new Fl_Choice(60, 155, 220, 25, "labels:"); o->callback((Fl_Callback*)font_cb, (void*)(0)); o->menu(font_menu()); @@ -147,11 +147,12 @@ void show_style_panel() { } } style_panel->show(); + return w; } int main(int argc, char **argv) { - Fl_Window *w; - { Fl_Window* o = w = new Fl_Double_Window(445, 435); + Fl_Double_Window* w; + { Fl_Double_Window* o = w = new Fl_Double_Window(445, 435); { Fl_Group* o = new Fl_Group(270, 35, 140, 75, "Packed buttons:"); o->align(4); { Fl_Button* o = new Fl_Button(270, 35, 35, 25, "A"); @@ -196,10 +197,7 @@ int main(int argc, char **argv) { o->labeltype(FL_ENGRAVED_LABEL); o->align(4); } - { Fl_Counter* o = new Fl_Counter(20, 120, 170, 25, "counter"); - o->minimum(-1e+06); - o->maximum(1e+06); - } + new Fl_Counter(20, 120, 170, 25, "counter"); { Fl_Adjuster* o = new Fl_Adjuster(80, 40, 25, 75, "adjuster:"); o->labeltype(FL_SYMBOL_LABEL); o->align(4); diff --git a/test/style_ui.H b/test/style_ui.H index 78a9f55d7..4d245ee3d 100644 --- a/test/style_ui.H +++ b/test/style_ui.H @@ -22,6 +22,6 @@ extern void font_cb(Fl_Choice*, long); extern void font_size_cb(Fl_Value_Input*, long); extern void scrollbar_thickness_cb(Fl_Value_Slider*, void*); extern void text_box_thickness_cb(Fl_Value_Slider*, void*); -extern Fl_Window *style_panel; -void show_style_panel(); +extern Fl_Double_Window *style_panel; +Fl_Double_Window* show_style_panel(); extern Fl_Menu_Item menu_[];