This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tree scrolling in Linux configtool built against wxWindows 2.4.0


This patch fixes the wxRemotelyScrolledTreeCtrl class in the configtool to
behave correctly against wxWindows 2.4.0 on Linux/GTK. A small patch to
wxWindows 2.4.0 is also required (appended). Many thanks to Julian Smart for
looking at this.

John Dallaway
eCosCentric Limited

--cut here--

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/ChangeLog,v
retrieving revision 1.42
diff -u -5 -r1.42 ChangeLog
--- ChangeLog	25 Mar 2003 11:47:51 -0000	1.42
+++ ChangeLog	26 Mar 2003 11:52:48 -0000
@@ -1,5 +1,12 @@
+2003-03-26  John Dallaway  <jld at ecoscentric dot com>
+
+	* standalone/wxwin/makefile.gnu: Tidy up.
+
+	* standalone/wxwin/splittree.cpp: Fix wxRemotelyScrolledTreeCtrl for
+	wxWindows 2.4.0 on Linux/GTK. Patch contributed by Julian Smart.
+
 2003-03-25  John Dallaway  <jld at ecoscentric dot com>

 	* standalone/wxwin/symbols.h,
 	  standalone/wxwin/aboutdlg.cpp,
 	  standalone/wxwin/configtool.cpp,
Index: standalone/wxwin/makefile.gnu
===================================================================
RCS file: 
/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/makefile.gnu,v
retrieving revision 1.7
diff -u -5 -r1.7 makefile.gnu
--- standalone/wxwin/makefile.gnu	19 Mar 2003 17:39:06 -0000	1.7
+++ standalone/wxwin/makefile.gnu	26 Mar 2003 11:52:48 -0000
@@ -2,20 +2,19 @@
 # Author:     John Dallaway <jld at ecoscentric dot com>
 # Copyright:  Copyright (c) John Dallaway 2003
 
 # Usage:
 #   cd emptydir
-#   make -f /path/to/this/makefile WXDIR=/path/to/wx/installation 
ECOSSRCDIR=/path/to/ecos/tools/src OSTYPE=$OSTYPE
+#   make -f /path/to/this/makefile WXDIR=/path/to/wx/installation 
INSTALLDIR=/path/to/ecos/tools [ ECOSSRCDIR=/path/to/ecos/tools/src ] [ 
TCLDIR=/path/to/tcl/installation ] [ OSTYPE=cygwin ] [ DEBUG=1 ]
 
-TCLDIR=TCLDIR_not_defined
+INSTALLDIR=INSTALLDIR_not_defined
 WXDIR=WXDIR_not_defined
-ECOSSRCDIR=ECOSSRCDIR_not_defined
 
 CTBUILDDIR=$(shell pwd)
+ECOSSRCDIR=$(INSTALLDIR)/src
 CTDIR=$(ECOSSRCDIR)/tools/configtool/standalone/wxwin
-INSTALLDIR=$(ECOSSRCDIR)/..
-LEVEL=release
+TCLDIR=TCLDIR_use_system
 USEEXPERIMENTALCODE=1
 
 EXTRACPPFLAGS=\
   -I$(TCLDIR)/include \
   -I$(INSTALLDIR)/include \
@@ -35,14 +34,14 @@
   CPPFLAGS=`$(WXDIR)/bin/wx-config --cppflags`
   LDFLAGS=`$(WXDIR)/bin/wx-config --libs`
   EXTRAOBJECTS=
 endif
 
-ifneq "$(LEVEL)" "debug"
+ifeq "$(DEBUG)" ""
   CPPDEBUGOPTIONS=-O2
 else
-  CPPDEBUGOPTIONS=-D__WXDEBUG__ -ggdb
+  CPPDEBUGOPTIONS=-ggdb
 endif

 OBJECTS = \
  $(CTBUILDDIR)/aboutdlg.o \
  $(CTBUILDDIR)/admindlg.o \
Index: standalone/wxwin/splittree.cpp
===================================================================
RCS file: 
/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/splittree.cpp,v
retrieving revision 1.3
diff -u -5 -r1.3 splittree.cpp
--- standalone/wxwin/splittree.cpp	20 May 2002 22:19:28 -0000	1.3
+++ standalone/wxwin/splittree.cpp	26 Mar 2003 11:52:50 -0000
@@ -76,13 +76,13 @@
 END_EVENT_TABLE()
 
 wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow* parent, 
wxWindowID id, const wxPoint& pt,
                                                        const wxSize& sz, 
long style):
     wxTreeCtrl(parent, id, pt, sz, style
-#if wxVERSON_NUMBER > 2301
+#if wxVERSION_NUMBER > 2301
 	       & ~wxTR_ROW_LINES
-#endif
+#endif
 	       )
 {
     m_companionWindow = NULL;
 }

@@ -113,11 +113,14 @@
                                                bool noRefresh)
 {
     if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
     {
         wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
-        win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 0, noUnitsX, 
0, xPos, 0, noRefresh);
+        // Pass TRUE for noRefresh so that it doesn't
+        // draw part of the tree as if the scroll view is
+        // at zero vertically.
+        win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 
pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ TRUE);

         ecScrolledWindow* scrolledWindow = GetScrolledWindow();
         if (scrolledWindow)
         {
             scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 
0, yPos, noRefresh);

--wxWindows 2.4.0 patch--

diff -r -u5 ../wxGTK-2.4.0/src/gtk/scrolwin.cpp src/gtk/scrolwin.cpp
--- ../wxGTK-2.4.0/src/gtk/scrolwin.cpp	2003-01-05 11:55:09.000000000 +0000
+++ src/gtk/scrolwin.cpp	2003-03-25 20:16:01.000000000 +0000
@@ -338,12 +338,15 @@
  */
 void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int 
pixelsPerUnitY,
                                       int noUnitsX, int noUnitsY,
                                       int xPos, int yPos, bool noRefresh )
 {
-    int old_x = m_xScrollPixelsPerLine * m_xScrollPosition;
-    int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
+    int xs, ys;
+    GetViewStart (& xs, & ys);
+    
+    int old_x = m_xScrollPixelsPerLine * xs;
+    int old_y = m_yScrollPixelsPerLine * ys;

     m_xScrollPixelsPerLine = pixelsPerUnitX;
     m_yScrollPixelsPerLine = pixelsPerUnitY;

     m_hAdjust->value = m_xScrollPosition = xPos;
@@ -636,22 +639,28 @@
         *y = m_yScrollPosition;
 }

 void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int 
*yy) const
 {
+    int xs, ys;
+    GetViewStart (& xs, & ys);
+    
     if ( xx )
-        *xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
+        *xx = x - xs * m_xScrollPixelsPerLine;
     if ( yy )
-        *yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
+        *yy = y - ys * m_yScrollPixelsPerLine;
 }
 
 void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int 
*yy) const
 {
+    int xs, ys;
+    GetViewStart (& xs, & ys);
+    
     if ( xx )
-        *xx = x + m_xScrollPosition * m_xScrollPixelsPerLine;
+        *xx = x + xs * m_xScrollPixelsPerLine;
     if ( yy )
-        *yy = y + m_yScrollPosition * m_yScrollPixelsPerLine;
+        *yy = y + ys * m_yScrollPixelsPerLine;
 }
 
 int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
 {
     int pos = event.GetPosition();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]