From 825182635768d61ffd86c3c806230e64a64412b3 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Sun, 19 Dec 1999 05:32:34 +0000 Subject: [PATCH] Stuff that didn't get into 1.0.7: Fix for Borland or other platforms where GLint != int. Fixed browser scrollbars so they work if browser is inside a scroll (it did not update their position to match where they were drawn) Fl_Output (and non-focused Fl_Input) now scroll in response to position() calls from the program to show the position. In addition I cleaned up the horizontal scrolling of Fl_Input to be less screwy, it now never scrolls if the text actually fits in the widget. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@959 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Browser_.cxx | 14 +++++++++++--- src/Fl_Gl_Window.cxx | 6 +++--- src/Fl_Input_.cxx | 29 ++++++++++++++--------------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index 844069629..43932579b 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Browser_.cxx,v 1.10.2.6 1999/11/16 14:44:43 mike Exp $" +// "$Id: Fl_Browser_.cxx,v 1.10.2.7 1999/12/19 05:32:33 bill Exp $" // // Base Browser widget class for the Fast Light Tool Kit (FLTK). // @@ -88,11 +88,19 @@ int Fl_Browser_::leftedge() const { return X; } -// the scrollbars are resized & placed by draw(), since each one's size +// The scrollbars may be moved again by draw(), since each one's size // depends on whether the other is visible or not. This skips over // Fl_Group::resize since it moves the scrollbars uselessly. void Fl_Browser_::resize(int X, int Y, int W, int H) { Fl_Widget::resize(X, Y, W, H); + // move the scrollbars so they can respond to events: + bbox(X,Y,W,H); + scrollbar.resize( + scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar_width_ : X+W, + Y, scrollbar_width_, H); + hscrollbar.resize( + X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollbar_width_ : Y+H, + W, scrollbar_width_); } // Cause minimal update to redraw the given item: @@ -668,5 +676,5 @@ void Fl_Browser_::item_select(void*, int) {} int Fl_Browser_::item_selected(void* l) const {return l==selection_;} // -// End of "$Id: Fl_Browser_.cxx,v 1.10.2.6 1999/11/16 14:44:43 mike Exp $". +// End of "$Id: Fl_Browser_.cxx,v 1.10.2.7 1999/12/19 05:32:33 bill Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index f10f10f71..9f4648910 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.12.2.4 1999/10/14 04:56:08 bill Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.5 1999/12/19 05:32:34 bill Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -150,7 +150,7 @@ void Fl_Gl_Window::make_current() { } void Fl_Gl_Window::ortho() { - int p[2]; + GLint p[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, p); glLoadIdentity(); glViewport(w()-p[0], h()-p[1], p[0], p[1]); @@ -316,5 +316,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.4 1999/10/14 04:56:08 bill Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.5 1999/12/19 05:32:34 bill Exp $". // diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 6791b4b36..09aa14688 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input_.cxx,v 1.21.2.2 1999/10/30 20:21:30 bill Exp $" +// "$Id: Fl_Input_.cxx,v 1.21.2.3 1999/12/19 05:32:34 bill Exp $" // // Common input widget routines for the Fast Light Tool Kit (FLTK). // @@ -197,19 +197,18 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { curx = int(expandpos(p, value()+position(), buf, 0)+.5); if (Fl::focus()==this && !was_up_down) up_down_pos = curx; cury = lines*height; - if (Fl::focus()==this) { - int fullw = int(expandpos(p, e, buf, 0)); - if (curx > xscroll_+W-20) { - xscroll_ = curx+20-W; - if (xscroll_ > fullw-W+2) xscroll_ = fullw-W+2; - mu_p = 0; erase_cursor_only = 0; - } - if (curx < xscroll_+20 && xscroll_) { - if (fullw > W-2) xscroll_ = curx-20; - else xscroll_ = 0; - mu_p = 0; erase_cursor_only = 0; - } - if (xscroll_ < 0) xscroll_ = 0; + int newscroll = xscroll_; + if (expandpos(p, e, buf, 0) < W-1) { + newscroll = 0; + } else if (curx > newscroll+W-20) { + newscroll = curx+20-W; + } else if (curx < newscroll+20) { + newscroll = curx-20; + } + if (newscroll < 0) newscroll = 0; + if (newscroll != xscroll_) { + xscroll_ = newscroll; + mu_p = 0; erase_cursor_only = 0; } } lines++; @@ -745,5 +744,5 @@ Fl_Input_::~Fl_Input_() { } // -// End of "$Id: Fl_Input_.cxx,v 1.21.2.2 1999/10/30 20:21:30 bill Exp $". +// End of "$Id: Fl_Input_.cxx,v 1.21.2.3 1999/12/19 05:32:34 bill Exp $". //