]> git.saurik.com Git - wxWidgets.git/commitdiff
Various wxMotif changes including size optimisation and debugging operator fix.
authorJulian Smart <julian@anthemion.co.uk>
Wed, 25 Nov 1998 21:42:56 +0000 (21:42 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 25 Nov 1998 21:42:56 +0000 (21:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

31 files changed:
distrib/msw/generic.rsp
docs/motif/changes.txt
docs/msw/install.txt
include/wx/generic/tabg.h
include/wx/memory.h
include/wx/motif/notebook.h
include/wx/motif/setup.h
include/wx/motif/toolbar.h
include/wx/msw/setup.h
include/wx/object.h
include/wx/stubs/setup.h
samples/memcheck/memcheck.cpp
src/common/gdicmn.cpp
src/common/log.cpp
src/common/memory.cpp
src/common/parser.y
src/common/string.cpp
src/cygnus.bat
src/generic/helpext.cpp
src/generic/tabg.cpp
src/make.env
src/motif/dcclient.cpp
src/motif/dcscreen.cpp
src/motif/frame.cpp
src/motif/makefile.unx
src/motif/mdi.cpp
src/motif/menu.cpp
src/motif/notebook.cpp
src/motif/toolbar.cpp
src/motif/utilsexc.cpp
src/motif/window.cpp

index 1e57c7435f405d406cf554ca0ce2b51647a09780..c9381aa6a51a1b6f26980a7eb8139527c0de9dd4 100644 (file)
@@ -53,6 +53,7 @@ src/zlib/*.3
 src/zlib/*.mms
 
 include/wx/*.h
+include/wx/*.cpp
 include/wx/protocol/*.h
 include/wx/*.cpp
 include/wx/wx_setup.vms
index 4ada41c3b984abfbff8f49b75b875b2873b2e308..b8494394f0b14689c61a61887f882722c09f353f 100644 (file)
@@ -34,3 +34,22 @@ More recently:
   tidied up in wxApp so that events are filtered through ProcessXEvent.
 - wxWindow::GetUpdateRegion should now work.
 
+25/11/98
+--------
+
+- Reimplemented MDI using wxNotebook instead of the MDI widgets, which
+  were too buggy (probably not design for dynamic addition/removal of
+  child frames).
+- Some improvements to the wxNotebook implementation.
+- wxToolBar now uses a bulletin board instead of a form, in an attempt
+  to make it possible to add ordinary wxControls to a toolbar.
+- Cured problem with not being able to use global memory operators,
+  by defining two more global operators, so that the delete will match
+  the debugging implementation.
+- Added wxUSE_DEBUG_NEW_ALWAYS so we can distinguish between using
+  global memory operators (usually OK) and #defining new to be
+  WXDEBUG_NEW (sometimes it might not be OK).
+- Added time.cpp to makefile; set wxUSE_DATETIME to 1.
+- Added a parent-existance check to popup menu code to make it not crash.
+- Added some optimization in wxWindow::SetSize to produce less flicker.
+  It remains to be seen whether this produces any resize bugs.
\ No newline at end of file
index 8e6b0a689261ffdd04327d1fc07fae0a2488b68f..5f6609cb81209b95c9f9af0923c34bb67d815bbe 100644 (file)
@@ -57,15 +57,15 @@ Borland C++ 4.5/5.0 compilation
    NOTE: only a few samples have up-to-date makefiles, e.g.
    minimal, docview, mdi. The utils makefile does not yet work.
 
-Gnu-Win32 b19/Mingw32 compilation
+Gnu-Win32 b19/b20/Mingw32 compilation
 ---------------------------------
 
-wxWindows 2.0 supports Gnu-Win32 b19, Mingw32, and Mingw32/EGCS.
+wxWindows 2.0 supports Gnu-Win32/Cygwin b19, b20, Mingw32, and Mingw32/EGCS.
 
 Thanks are due to Keith Garry Boyce (garp@opustel.com) and Cygnus for making
 it all possible.
 
-From wxWindows 2.0 beta 9, both Gnu-Win32 b19 and Mingw32 (the minimal
+From wxWindows 2.0 beta 9, both Gnu-Win32 and Mingw32 (the minimal
 distribution of Gnu-Win32) can be used with the same makefiles.
 
 Here are the steps required:
@@ -116,8 +116,6 @@ Gotchas:
 - install.exe doesn't have built-in decompression because lzexpand.lib
   isn't available with Gnu-Win32. However, you can use it with external
   decompression utilities.
-- Doesn't compile socket-related files due to a syntax error in
-  GnuWin32's Sockets.h.
 - Doesn't compile src/msw/ole files, so no drag and drop.
 
 References:
index 3b246de2d59157a2ddef4c4e00dc16e09d17861c..c5c468a241432c53d8707bb5efed1475611486fd 100644 (file)
@@ -120,6 +120,9 @@ public:
   
   void ClearTabs(bool deleteTabs = TRUE);
 
+  bool SetTabText(int id, const wxString& label);
+  wxString GetTabText(int id) const;
+
   // Layout tabs (optional, e.g. if resizing window)
   void Layout(void);
 
index 6216211d2544f89118b7dc677f466d56e5cda7aa..1f2b25d19dfa8357df94bac99ebd074589bfa2c4 100644 (file)
@@ -53,6 +53,10 @@ void wxDebugFree(void * buf, bool isVect = FALSE);
 #undef new
 #endif
 
+// Added JACS 25/11/98: needed for some compilers
+void * operator new (size_t size);
+void * operator new[] (size_t size);
+
 void * operator new (size_t size, char * fileName, int lineNum);
 void operator delete (void * buf);
 
index 0615edef40590a8f38235b5dd2ff28fead69bdbf..37d6439d27c80bb07655914d8c52cf9dc246fde0 100644 (file)
@@ -201,6 +201,10 @@ public:
   virtual void ChangeForegroundColour();
   virtual wxRect GetAvailableClientSize();
 
+  // Implementation: calculate the layout of the view rect
+  // and resize the children if required
+  bool RefreshLayout(bool force = TRUE);
+
 protected:
   // common part of all ctors
   void Init();
index 8b9f9762e54ce46a7fdd77b8a1f1fe53856298b8..8be474306562ce1bcce22954f67b9074ddbe6b01 100644 (file)
@@ -76,7 +76,7 @@
                                   // NOW MANDATORY: don't change.
 #define wxUSE_MEMORY_TRACING      1
                                   // If 1, enables debugging versions of wxObject::new and
-                                  // wxObject::delete *IF* WXDEBUG is also defined.
+                                  // wxObject::delete *IF* __WXDEBUG__ is also defined.
                                   // WARNING: this code may not work with all architectures, especially
                                   // if alignment is an issue.
 #define wxUSE_DEBUG_CONTEXT       1
                                   // since you may well need to output
                                   // an error log in a production
                                   // version (or non-debugging beta)
-#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
+
+#define wxUSE_GLOBAL_MEMORY_OPERATORS 1
                                   // In debug mode, cause new and delete to be redefined globally.
                                   // If this causes problems (e.g. link errors), set this to 0.
-                                  // In wxMotif, causes an 'all bets are off'
-                                  // memory error (generated by wxWindows)
+
+#define wxUSE_DEBUG_NEW_ALWAYS 1
+                                  // In debug mode, causes new to be defined to
+                                  // be WXDEBUG_NEW (see object.h).
+                                  // If this causes problems (e.g. link errors), set this to 0.
 
 #define REMOVE_UNUSED_ARG 1
                                   // Set this to 0 if your compiler can't cope
 #define wxUSE_GADGETS       0
                                   // Use gadgets where possible
 
-#define wxUSE_MDI_WIDGETS   1
-                                  // Use Scott Sadler's MDI widgets (buggy).
-                                  // If 0, uses normal frames.
-                 
-
+#define wxUSE_TIMEDATE      1
+                                  // Use time and date
 /*
  * Finer detail
  *
index 590b417b4f5bc5e8063191957ec22a15225e88d5..f93c142d219564883c2ee9390cd233df7221bfcc 100644 (file)
@@ -75,6 +75,10 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
   int FindIndexForWidget(WXWidget w);
   WXWidget FindWidgetForIndex(int index);
 
+  WXWidget GetTopWidget() const;
+  WXWidget GetClientWidget() const;
+  WXWidget GetMainWidget() const;
+
 protected:
   // List of widgets in the toolbar, indexed by tool index
   wxList    m_widgets;
index 5aacae2c3c060a33b1eb763202a7a0bd565b7d66..f4846c3d61c5dacf90a186002e7e9128e24c3449 100644 (file)
 #define wxUSE_DYNAMIC_CLASSES     1
                                   // If 1, enables provision of run-time type information.
                                   // NOW MANDATORY: don't change.
-#define wxUSE_MEMORY_TRACING      0
+#define wxUSE_MEMORY_TRACING      1
                                   // If 1, enables debugging versions of wxObject::new and
                                   // wxObject::delete *IF* __WXDEBUG__ is also defined.
                                   // WARNING: this code may not work with all architectures, especially
                                   // if alignment is an issue.
-#define wxUSE_DEBUG_CONTEXT       0
+#define wxUSE_DEBUG_CONTEXT       1
                                   // If 1, enables wxDebugContext, for
                                   // writing error messages to file, etc. 
                                   // If __WXDEBUG__ is not defined, will still use
                                   // since you may well need to output
                                   // an error log in a production
                                   // version (or non-debugging beta)
-#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
+#define wxUSE_GLOBAL_MEMORY_OPERATORS 1
                                   // In debug mode, cause new and delete to be redefined globally.
                                   // If this causes problems (e.g. link errors), set this to 0.
 
+#define wxUSE_DEBUG_NEW_ALWAYS 1
+                                  // In debug mode, causes new to be defined to
+                                  // be WXDEBUG_NEW (see object.h).
+                                  // If this causes problems (e.g. link errors), set this to 0.
+
 // GnuWin32 (b19) can't copy with these operators.
 #ifdef __GNUWIN32__
 #undef wxUSE_GLOBAL_MEMORY_OPERATORS 1
index 4dd391fb06c4b401f626b0abb27eb557ca2e55d0..2791952dcb5a6aa7370017362ce1a23eda69a073 100644 (file)
@@ -246,11 +246,19 @@ private:
     int m_count;
 };
 
-#if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS
-// JACS: not necessary now that new can be defined globally
-//#ifndef WXDEBUG_NEW
-//#define WXDEBUG_NEW new(__FILE__,__LINE__)
-//#endif
+#ifdef __WXDEBUG__
+#ifndef WXDEBUG_NEW
+#define WXDEBUG_NEW new(__FILE__,__LINE__)
+#endif
+#else
+#define WXDEBUG_NEW new
+#endif
+
+// Redefine new to be the debugging version. This doesn't
+// work with all compilers, in which case you need to
+// use WXDEBUG_NEW explicitly if you wish to use the debugging version.
+
+#if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS && wxUSE_DEBUG_NEW_ALWAYS
 #define new new(__FILE__,__LINE__)
 #endif
 
index 7f86b00cf27f665827b48ccf2da89b1140130f0c..8029a0d6a897efa41aa50cb57ec9114d68c1be0f 100644 (file)
                                   // In debug mode, cause new and delete to be redefined globally.
                                   // If this causes problems (e.g. link errors), set this to 0.
 
+#define wxUSE_DEBUG_NEW_ALWAYS 1
+                                  // In debug mode, causes new to be defined to
+                                  // be WXDEBUG_NEW (see object.h).
+                                  // If this causes problems (e.g. link errors), set this to 0.
+
 #define REMOVE_UNUSED_ARG 1
                                   // Set this to 0 if your compiler can't cope
                                   // with omission of prototype parameters.
index 65d1cbf2359982cf8b710febccc843a71052dc26..ee9b073b48f9db0ebad6d4d058327dc991a77b80 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "wx/date.h"
 
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
 #include "mondrian.xpm"
 #endif
 
 #error This program must be compiled in debug mode.
 #endif
 
+// Normally, new is automatically defined to be the
+// debugging version. If not, this does it.
+#if !defined(new) && defined(WXDEBUG_NEW)
+#define new WXDEBUG_NEW
+#endif
+
 // Define a new application type
 class MyApp: public wxApp
 { public:
@@ -59,11 +65,7 @@ bool MyApp::OnInit(void)
   MyFrame *frame = new MyFrame((wxFrame *) NULL);
 
   // Give it an icon
-#ifdef __WXMSW__
-  frame->SetIcon(wxIcon("mondrian"));
-#else
-  frame->SetIcon(wxIcon(mondrian_xpm));
-#endif
+  frame->SetIcon(wxICON(mondrian));
 
   // Make a menubar
   wxMenu *file_menu = new wxMenu;
@@ -82,7 +84,6 @@ bool MyApp::OnInit(void)
   frame->Show(TRUE);
 
   wxDebugContext::SetCheckpoint();
-//  wxDebugContext::SetFile("debug.log");
 
   wxString *thing = new wxString;
   wxDate* date = new wxDate;
index 57c72604d3b9627c6859b5fdc4285a5adad17d33..642c03c3ea7bd18f8236e65c2b3f2e9a6d81a16e 100644 (file)
@@ -449,8 +449,7 @@ wxBitmapList::wxBitmapList ()
 
 wxBitmapList::~wxBitmapList ()
 {
-#ifdef __WXMSW__
-
+#if defined(__WXMSW__) || defined(__WXMOTIF__)
   wxNode *node = First ();
   while (node)
     {
@@ -466,7 +465,7 @@ wxBitmapList::~wxBitmapList ()
 // Pen and Brush lists
 wxPenList::~wxPenList ()
 {
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXMOTIF__)
   wxNode *node = First ();
   while (node)
     {
@@ -514,7 +513,7 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
 
 wxBrushList::~wxBrushList ()
 {
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXMOTIF__)
   wxNode *node = First ();
   while (node)
     {
index 6a4bf7bf0d07ecb9f2b8794a73f15a96f5a62487..3fbaa26c99a269bef04556716885aa87c6ad9b40 100644 (file)
@@ -338,8 +338,11 @@ void wxLog::DoLog(wxLogLevel level, const char *szString)
     case wxLOG_Trace:
     case wxLOG_Debug:
       #ifdef __WXDEBUG__
-        DoLogString(str << (level == wxLOG_Trace ? _("Trace") : _("Debug"))
-                        << ": " << szString);
+      //        DoLogString(str << (level == wxLOG_Trace ? _("Trace") : _("Debug"))
+      //                        << ": " << szString);
+      // JACS: we don't really want to prefix with 'Debug'. It's just extra
+      // verbiage.
+              DoLogString(szString);
       #endif
 
       break;
@@ -506,10 +509,14 @@ void wxLogGui::DoLog(wxLogLevel level, const char *szString)
               OutputDebugString(strTime + szString + "\n\r");
           #else  
             // send them to stderr
+    /*
             fprintf(stderr, "%s %s: %s\n",
                     strTime.c_str(),
                     level == wxLOG_Trace ? _("Trace") : _("Debug"),
                     szString);
+     */
+            fprintf(stderr, "%s\n",
+                    szString);
             fflush(stderr);
           #endif
         }
index 37bf42aa41c54528d2358a5fe2c045eb146e42df..8f9b0d0ac3d9355974ea2966e008d993303ee124 100644 (file)
@@ -951,6 +951,25 @@ void * operator new (size_t size, char * fileName, int lineNum)
 #endif
 }
 
+// Added JACS 25/11/98
+void * operator new (size_t size)
+{
+#ifdef NO_DEBUG_ALLOCATION
+  return malloc(size);
+#else
+  return wxDebugAlloc(size, NULL, 0, FALSE);
+#endif
+}
+
+void * operator new[] (size_t size)
+{
+#ifdef NO_DEBUG_ALLOCATION
+  return malloc(size);
+#else
+  return wxDebugAlloc(size, NULL, 0, FALSE, TRUE);
+#endif
+}
+
 #if !( defined (_MSC_VER) && (_MSC_VER <= 1020) )
 void * operator new[] (size_t size, char * fileName, int lineNum)
 {
index 3973c3948c6b6dd98ffa9f2188e536137025d330..c834a77e534a10a844d3c956d817e87ac8c2b3f5 100644 (file)
@@ -162,7 +162,7 @@ void yyerror(char *s)
 #ifndef yywrap
 #define yywrap() 1
 #endif
-#else if !defined(__alpha) && !defined(__ultrix)
+#else if !defined(__alpha___) && !defined(__ultrix)
 int yywrap() { return 1; }
 #endif
 #endif
index e4ff09bf0f02605e9a9ac1ef3b14329870a5eeb8..15976eb5e148c872ec53e27c52ee6158825f1518 100644 (file)
@@ -941,7 +941,7 @@ int wxString::Printf(const char *pszFormat, ...)
 
 int wxString::PrintfV(const char* pszFormat, va_list argptr)
 {
-#ifdef __BORLANDC__
+#if defined(__BORLANDC__) || defined(__GNUWIN32__)
   static char s_szScratch[1024];
 
   int iLen = vsprintf(s_szScratch, pszFormat, argptr);
index 4cf2cf09cf3ea47d7fcd0555c5762905f78026f0..d6411976659b8c61927e8a3efda335850542b988 100644 (file)
@@ -1,15 +1,10 @@
-rem Cygnus Gnu-Win32 environment variables
-rem Assumes that compiler and wxWindows are installed on the g: drive.
-rem
-set WXWIN=d:\wx2
-path C:\WINDOWS;C:\WINDOWS\COMMAND;g:\gnuwin32\b19\H-i386-cygwin32\bin;g:\gnuwin32\b19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404;c:\bin;g:\gnuwin32\b19\tcl\bin
-set GCC_EXEC_PREFIX=G:\gnuwin32\b19\H-i386-cygwin32\lib\gcc-lib\
-set RCINCLUDE=%WXWIN\include
-set CPLUS_INCLUDE_PATH=/g/gnuwin32/b19/h-i386-cygwin32/i386-cygwin32/include:/g/gnuwin32/b19/include/g++:/g/gnuwin32/b19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-970404/include:/d/wx2/include:/g/gnuwin32/b19/include/g++
-set MAKE_MODE=unix
-mount G: /g
-mount D: /d
-
+@ECHO OFF
+SET MAKE_MODE=UNIX
+rem SET PATH=g:\GNUWIN32\B20\CYGWIN~1\H-I586~1\BIN;%PATH%
+PATH C:\WINDOWS;C:\WINDOWS\command;g:\GNUWIN32\B20\CYGWIN~1\H-I586~1\BIN;d:\wx\utils\tex2rtf\bin;g:\ast\astex;g:\ast\emtex\bin;g:\cvs;c:\bin
+set BISON_SIMPLE=g:\gnuwin32\b20\cygwin-b20\share\bison.simple
+set BISON_HAIRY=g:\gnuwin32\b20\cygwin-b20\share\bison.hairy
+rem bash
 rem 4DOS users only...
 unalias make
 alias makegnu make -f makefile.g95
index 60933b44d60b8bafad333b1fef463fddf25336e2..a785361d421b481afcd2cae3ded002e5b77ec33c 100644 (file)
@@ -105,7 +105,7 @@ wxExtHelpController::Initialize(const wxString& file)
 
   
 bool
-wxExtHelpController::LoadFile(const wxString& ifile = "")
+wxExtHelpController::LoadFile(const wxString& ifile)
 {
    wxString mapFile, file, url, doc;
    int id,i,len;
@@ -118,7 +118,9 @@ wxExtHelpController::LoadFile(const wxString& ifile = "")
       file = ifile;
       if(! wxIsAbsolutePath(file))
       {
-         file = wxGetWorkingDirectory();
+         char* f = wxGetWorkingDirectory();
+         file = f;
+         delete[] f; // wxGetWorkingDirectory returns new memory
          file << WXEXTHELP_SEPARATOR << ifile;
       }
       else
index cc6a601bc51c95ee5f43030cbe147fcf3c9156b8..cd9f9355df503e8f5dfc300777def77e0301cb01 100644 (file)
@@ -207,7 +207,12 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
   dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
 
   int textX = (int)(tabX + (GetWidth() - textWidth)/2.0);
+  if (textX < (tabX + 2))
+    textX = (tabX + 2);
+
+  dc.SetClippingRegion(tabX, tabY, GetWidth(), GetHeight());
   dc.DrawText(GetLabel(), textX, textY);
+  dc.DestroyClippingRegion();
 
   if (m_isSelected)
   {
@@ -615,6 +620,7 @@ bool wxTabView::RemoveTab(int id)
           m_tabSelection = -1;
         delete tab;
         delete tabNode;
+        m_noTabs --;
 
         // The layout has changed
         Layout();
@@ -626,6 +632,24 @@ bool wxTabView::RemoveTab(int id)
   }
   return FALSE;
 }
+
+bool wxTabView::SetTabText(int id, const wxString& label)
+{
+    wxTabControl* control = FindTabControlForId(id);
+    if (!control)
+      return FALSE;
+    control->SetLabel(label);
+    return TRUE;
+}
+
+wxString wxTabView::GetTabText(int id) const
+{
+    wxTabControl* control = FindTabControlForId(id);
+    if (!control)
+      return wxEmptyString;
+    else
+      return control->GetLabel();
+}
   
 // Returns the total height of the tabs component -- this may be several
 // times the height of a tab, if there are several tab layers (rows).
@@ -674,6 +698,7 @@ void wxTabView::ClearTabs(bool deleteTabs)
     delete layerNode;
     layerNode = nextLayerNode;
   }
+  m_noTabs = 0;
 }
 
 
@@ -761,6 +786,10 @@ void wxTabView::Layout(void)
 // Draw all tabs
 void wxTabView::Draw(wxDC& dc)
 {
+        // Don't draw anything if there are no tabs.
+        if (GetNumberOfTabs() == 0)
+          return;
+
        // Draw top margin area (beneath tabs and above view area)
        if (GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR)
        {
index b07e47c570d24215a9c268fb89c8bdbde0f39d50..571f7303868550b4b13da868d221c20c322ccd0d 100644 (file)
@@ -35,7 +35,7 @@ GUISUFFIX   = _stubs
 ########################## Compiler flags #############################
 
 # Misc options
-OPTIONS     = -D__WXDEBUG__ # -DDEBUG='$(DEBUG)' # -DWXDEBUG
+OPTIONS     = -D__WXDEBUG__
 COPTIONS    =
 DEBUGFLAGS  = -ggdb
 INCLUDE     =
index fe588047341f11102df201cb3b223035ca08a532..cb48e8250e38495f97d8f64b85ea3a799eda7f1d 100644 (file)
@@ -1522,7 +1522,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
     {
       Pixmap myStipple;
 
-      oldStipple = NULL;    // For later reset!!
+      oldStipple = (wxBitmap*) NULL;    // For later reset!!
 
       switch (m_currentFill)
       {
index 050acdcd5e433323ded0385c25536bd9ec7a4c08..ac4344498e89d4c4864cf6af54753ab01a2959f8 100644 (file)
@@ -73,7 +73,7 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
   return StartDrawingOnTop(& rect);
 }
 
-bool wxScreenDC::StartDrawingOnTop(wxRect* rect = NULL)
+bool wxScreenDC::StartDrawingOnTop(wxRect* rect)
 {
   if (sm_overlayWindow)
     return FALSE;
index f0b7089297d082f5660eceb7d60267f6f06cf6b9..c95fc09b97353c153d3e030a58e63afa943d7cd5 100644 (file)
@@ -479,10 +479,12 @@ void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (!(height == -1 && width == -1))
   {
     PreResize();
+ /* JACS: not sure if this is necessary
     wxSizeEvent sizeEvent(wxSize(width, height), GetId());
     sizeEvent.SetEventObject(this);
 
     GetEventHandler()->ProcessEvent(sizeEvent);
+  */
   }
 }
 
@@ -553,13 +555,10 @@ void wxFrame::SetIcon(const wxIcon& icon)
   if (!m_frameShell)
     return;
 
-  // TODO
-  /*
   if (!icon.Ok() || !icon.GetPixmap())
     return;
 
-  XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon->.GetPixmap(), NULL);
-  */
+  XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL);
 }
 
 wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
index fcaa095e9e57cc6f293ad81c343bfb61c84a86bd..e43f53516ecdaa81854f32d00c78b2fc3498c300 100644 (file)
@@ -46,6 +46,7 @@ LIB_CPP_SRC=\
  ../common/textfile.cpp \
  ../common/tbarbase.cpp \
  ../common/tbarsmpl.cpp \
+ ../common/time.cpp \
  ../common/timercmn.cpp \
  ../common/utilscmn.cpp \
  ../common/wincmn.cpp \
index 902714acc2be109b296048a1c6107d5021efef3f..a2076eaf310dd9113073d11494e2b4f6f0f05dcf 100644 (file)
@@ -550,7 +550,10 @@ void wxMDIChildFrame::SetIcon(const wxIcon& icon)
 void wxMDIChildFrame::SetTitle(const wxString& title)
 {
     m_title = title;
-    // TODO: set parent frame title
+    wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
+    int pageNo = clientWindow->FindPagePosition(this);
+    if (pageNo > -1)
+        clientWindow->SetPageText(pageNo, title);
 }
 
 // MDI operations
@@ -623,7 +626,19 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
   //    m_windowParent = parent;
     //    m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
 
-    return wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
+    bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
+    if (success)
+    {
+        wxFont font(10, wxSWISS, wxNORMAL, wxNORMAL);
+        wxFont selFont(10, wxSWISS, wxNORMAL, wxBOLD);
+        GetTabView()->SetTabFont(font);
+        GetTabView()->SetSelectedTabFont(selFont);
+        GetTabView()->SetTabSize(120, 18);
+        GetTabView()->SetTabSelectionHeight(20);
+        return TRUE;
+    }
+    else
+      return FALSE;
 }
 
 void wxMDIClientWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
@@ -670,9 +685,11 @@ void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
             oldChild->GetEventHandler()->ProcessEvent(event);
         }
     }
-    wxMDIChildFrame* activeChild = (wxMDIChildFrame*) GetPage(event.GetSelection());
-    if (activeChild)
+    if (event.GetSelection() != -1)
     {
+      wxMDIChildFrame* activeChild = (wxMDIChildFrame*) GetPage(event.GetSelection());
+      if (activeChild)
+      {
         wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
         event.SetEventObject( activeChild );
         activeChild->GetEventHandler()->ProcessEvent(event);
@@ -682,6 +699,7 @@ void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
             activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
             activeChild->GetMDIParentFrame()->SetChildMenuBar(activeChild);
         }
+      }
     }
     event.Skip();
 }
index 91df050e492c511598c84aa7c0b142de369166e3..1eb8e5a3c950d351dbb60ddf310f810b1c9fdd6a 100644 (file)
@@ -832,8 +832,11 @@ int PostDeletionOfMenu( XtPointer* clientData )
   wxMenu *menu = (wxMenu *)clientData;
 
   if (menu->GetMainWidget()) {
-    wxList& list = menu->GetParent()->GetItems();
-    list.DeleteObject(menu);
+    if (menu->GetParent())
+    {
+      wxList& list = menu->GetParent()->GetItems();
+      list.DeleteObject(menu);
+    }
     menu->DestroyMenu(TRUE);
   }
   /* Mark as no longer popped up */
index fd0e099d656d5aa9391c30208726a90a09ac98b6..00729a08ed246c47cdffa0236175e6f2c80a7671 100644 (file)
@@ -141,7 +141,6 @@ int wxNotebook::SetSelection(int nPage)
     wxNotebookPage* pPage = GetPage(nPage);
 
     m_tabView->SetTabSelection((int) (long) pPage);
-    //    ChangePage(m_nSelection, nPage);
 
     // TODO
     return 0;
@@ -161,7 +160,14 @@ bool wxNotebook::SetPageText(int nPage, const wxString& strText)
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
 
-    // TODO
+    wxNotebookPage* page = GetPage(nPage);
+    if (page)
+    {
+        m_tabView->SetTabText((int) (long) page, strText);
+        Refresh();
+        return TRUE;
+    }
+
     return FALSE;
 }
 
@@ -169,8 +175,11 @@ wxString wxNotebook::GetPageText(int nPage) const
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
 
-    // TODO
-    return wxString("");
+    wxNotebookPage* page = ((wxNotebook*)this)->GetPage(nPage);
+    if (page)
+        return m_tabView->GetTabText((int) (long) page);
+    else
+        return wxEmptyString;
 }
 
 int wxNotebook::GetPageImage(int nPage) const
@@ -221,13 +230,16 @@ bool wxNotebook::DeletePage(int nPage)
       m_nSelection = -1;
       m_tabView->SetTabSelection(-1, FALSE);
     }
-    else if (m_nSelection > 0)
+    else if (m_nSelection > -1)
     {
       m_nSelection = -1;
       m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
-      ChangePage(-1, 0);
+      if (m_nSelection != 0)
+        ChangePage(-1, 0);
     }
 
+    RefreshLayout(FALSE);
+
     return TRUE;
 }
 
@@ -245,11 +257,8 @@ bool wxNotebook::RemovePage(int nPage)
 {
     wxCHECK( IS_VALID_PAGE(nPage), FALSE );
 
-    if (m_nSelection != -1)
-    {
-        m_aPages[m_nSelection]->Show(FALSE);
-        m_aPages[m_nSelection]->Lower();
-    }
+    m_aPages[nPage]->Show(FALSE);
+    //    m_aPages[nPage]->Lower();
 
     wxNotebookPage* pPage = GetPage(nPage);
     m_tabView->RemoveTab((int) (long) pPage);
@@ -259,15 +268,30 @@ bool wxNotebook::RemovePage(int nPage)
     if (m_aPages.GetCount() == 0)
     {
       m_nSelection = -1;
-      m_tabView->SetTabSelection(-1, FALSE);
+      m_tabView->SetTabSelection(-1, TRUE);
     }
-    else if (m_nSelection > 0)
+    else if (m_nSelection > -1)
     {
-      m_nSelection = -1;
-      m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
-      ChangePage(-1, 0);
+      // Only change the selection if the page we
+      // deleted was the selection.
+      if (nPage == m_nSelection)
+      {
+         m_nSelection = -1;
+         // Select the first tab. Generates a ChangePage.
+         m_tabView->SetTabSelection((int) (long) GetPage(0), TRUE);
+      }
+      else
+      {
+       // We must adjust which tab we think is selected.
+        // If greater than the page we deleted, it must be moved down
+        // a notch.
+        if (m_nSelection > nPage)
+          m_nSelection -- ;
+      }
     }
 
+    RefreshLayout(FALSE);
+
     return TRUE;
 }
 
@@ -343,6 +367,8 @@ bool wxNotebook::InsertPage(int nPage,
     if ( m_nSelection == -1 )
       ChangePage(-1, 0);
 
+    RefreshLayout(FALSE);
+
     return TRUE;
 }
 
@@ -360,8 +386,20 @@ void wxNotebook::OnSize(wxSizeEvent& event)
         s_bFirstTime = FALSE;
     }
 
+    RefreshLayout();
+
+    // Processing continues to next OnSize
+    event.Skip();
+}
+
+// Implementation: calculate the layout of the view rect
+// and resize the children if required
+bool wxNotebook::RefreshLayout(bool force)
+{
     if (m_tabView)
     {
+        wxRect oldRect = m_tabView->GetViewRect();
+
         int cw, ch;
         GetClientSize(& cw, & ch);
 
@@ -388,13 +426,9 @@ void wxNotebook::OnSize(wxSizeEvent& event)
         m_tabView->SetViewRect(rect);
 
         m_tabView->Layout();
-       /*
-        // emulate page change (it's esp. important to do it first time because
-        // otherwise our page would stay invisible)
-        int nSel = m_nSelection;
-        m_nSelection = -1;
-        SetSelection(nSel);
-       */
+
+        if (!force && (rect == oldRect))
+          return FALSE;
 
         // fit the notebook page to the tab control's display area
 
@@ -411,16 +445,17 @@ void wxNotebook::OnSize(wxSizeEvent& event)
         }
         Refresh();
     }
-
-    // Processing continues to next OnSize
-    event.Skip();
+    return TRUE;
 }
 
 void wxNotebook::OnSelChange(wxNotebookEvent& event)
 {
     // is it our tab control?
     if ( event.GetEventObject() == this )
-        ChangePage(event.GetOldSelection(), event.GetSelection());
+    {
+        if (event.GetSelection() != m_nSelection)
+          ChangePage(event.GetOldSelection(), event.GetSelection());
+    }
 
     // we want to give others a chance to process this message as well
     event.Skip();
@@ -479,6 +514,7 @@ void wxNotebook::Command(wxCommandEvent& event)
 // hide the currently active panel and show the new one
 void wxNotebook::ChangePage(int nOldSel, int nSel)
 {
+  //  cout << "ChangePage: " << nOldSel << ", " << nSel << "\n";
     wxASSERT( nOldSel != nSel ); // impossible
 
     if ( nOldSel != -1 ) {
index 75c7b30d36e077ef56d1622e6f5b032f2fefcb3d..451b10f774b733d405c075514fac75003482ff0f 100644 (file)
@@ -86,7 +86,14 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     Widget parentWidget = (Widget) parent->GetClientWidget();
 
     Widget toolbar = XtVaCreateManagedWidget("toolbar",
-                xmFormWidgetClass, parentWidget,
+                    xmBulletinBoardWidgetClass, (Widget) parentWidget,
+                    XmNmarginWidth, 0,
+                    XmNmarginHeight, 0,
+                    XmNresizePolicy, XmRESIZE_NONE,
+                    NULL);
+/*
+    Widget toolbar = XtVaCreateManagedWidget("toolbar",
+                xmFormWidgetClass, (Widget) m_clientWidget,
                 XmNtraversalOn, False,
                 XmNhorizontalSpacing, 0,
                 XmNverticalSpacing, 0,
@@ -95,6 +102,7 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
                 XmNmarginWidth, 0,
                 XmNmarginHeight, 0,
                 NULL);
+*/
 
     m_mainWidget = (WXWidget) toolbar;
 
@@ -117,6 +125,200 @@ wxToolBar::~wxToolBar()
     DestroyPixmaps();
 }
 
+bool wxToolBar::CreateTools()
+{
+    if (m_tools.Number() == 0)
+        return FALSE;
+
+    // Separator spacing
+    const int separatorSize = GetToolSeparation(); // 8;
+    wxSize margins = GetToolMargins();
+    int marginX = margins.x;
+    int marginY = margins.y;
+
+    int currentX = marginX;
+    int currentY = marginY;
+
+    int buttonHeight = 0;
+
+    int currentSpacing = 0;
+
+    m_widgets.Clear();
+    Widget prevButton = (Widget) 0;
+    wxNode* node = m_tools.First();
+    while (node)
+    {
+        wxToolBarTool *tool = (wxToolBarTool *)node->Data();
+
+        if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
+            currentX += separatorSize;
+        else if (tool->m_bitmap1.Ok())
+        {
+            Widget button = (Widget) 0;
+
+            if (tool->m_isToggle)
+            {
+                button = XtVaCreateWidget("toggleButton", 
+                   xmToggleButtonWidgetClass, (Widget) m_mainWidget,
+                   XmNx, currentX, XmNy, currentY,
+                                                //                   XmNpushButtonEnabled, True,
+                   XmNmultiClick, XmMULTICLICK_KEEP,
+                   XmNlabelType, XmPIXMAP,
+                   NULL);
+                XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
+                (XtPointer) this);
+            }
+            else
+            {
+                button = XtVaCreateWidget("button", 
+                   xmPushButtonWidgetClass, (Widget) m_mainWidget,
+                   XmNx, currentX, XmNy, currentY,
+                   XmNpushButtonEnabled, True,
+                   XmNmultiClick, XmMULTICLICK_KEEP,
+                   XmNlabelType, XmPIXMAP,
+                   NULL);
+                XtAddCallback (button,
+                   XmNactivateCallback, (XtCallbackProc) wxToolButtonCallback,
+                   (XtPointer) this);
+            }
+
+            // For each button, if there is a mask, we must create
+            // a new wxBitmap that has the correct background colour
+            // for the button. Otherwise the background will just be
+            // e.g. black if a transparent XPM has been loaded.
+            wxBitmap originalBitmap = tool->m_bitmap1;
+
+            if (tool->m_bitmap1.GetMask())
+            {
+                int backgroundPixel;
+                XtVaGetValues(button, XmNbackground, &backgroundPixel,
+                             NULL);
+
+
+                wxColour col;
+                col.SetPixel(backgroundPixel);
+                
+                wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap1, col);
+
+                tool->m_bitmap1 = newBitmap;
+            }
+
+            // Create a selected/toggled bitmap. If there isn't a m_bitmap2,
+            // we need to create it (with a darker, selected background)
+            int backgroundPixel;
+            if (tool->m_isToggle)
+                XtVaGetValues(button, XmNselectColor, &backgroundPixel,
+                     NULL);
+            else
+                XtVaGetValues(button, XmNarmColor, &backgroundPixel,
+                     NULL);
+
+            wxColour col;
+            col.SetPixel(backgroundPixel);
+
+            if (tool->m_bitmap2.Ok() && tool->m_bitmap2.GetMask())
+            {
+                // Use what's there
+                wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap2, col);
+                tool->m_bitmap2 = newBitmap;
+            }
+            else
+            {
+                // Use unselected bitmap
+                if (originalBitmap.GetMask())
+                {
+                    wxBitmap newBitmap = wxCreateMaskedBitmap(originalBitmap, col);
+                    tool->m_bitmap2 = newBitmap;
+               }
+                else
+                    tool->m_bitmap2 = tool->m_bitmap1;
+            }
+
+            Pixmap pixmap = (Pixmap) tool->m_bitmap1.GetPixmap();
+            Pixmap insensPixmap = (Pixmap) tool->m_bitmap1.GetInsensPixmap();
+
+            if (tool->m_isToggle)
+            {
+                // Toggle button
+                Pixmap pixmap2 = (Pixmap) 0;
+                Pixmap insensPixmap2 = (Pixmap) 0;
+
+                // If there's a bitmap for the toggled state, use it,
+                // otherwise generate one.
+                if (tool->m_bitmap2.Ok())
+                {
+                    pixmap2 = (Pixmap) tool->m_bitmap2.GetPixmap();
+                    insensPixmap2 = (Pixmap) tool->m_bitmap2.GetInsensPixmap();
+                }
+                else
+                {
+                    pixmap2 = (Pixmap) tool->m_bitmap1.GetArmPixmap(button);
+                    insensPixmap2 = XCreateInsensitivePixmap((Display*) wxGetDisplay(), pixmap2);
+                    m_pixmaps.Append((wxObject*) insensPixmap2); // Store for later deletion
+                }
+                XtVaSetValues (button,
+                    XmNindicatorOn, False,
+                   XmNshadowThickness, 2,
+                              //                   XmNborderWidth, 0,
+                              //                   XmNspacing, 0,
+                   XmNmarginWidth, 0,
+                   XmNmarginHeight, 0,
+                    XmNfillOnSelect, True,
+                    XmNlabelPixmap, pixmap,
+                    XmNselectPixmap, pixmap2,
+                    XmNlabelInsensitivePixmap, insensPixmap,
+                    XmNselectInsensitivePixmap, insensPixmap2,
+                    XmNlabelType, XmPIXMAP,
+                    NULL);
+            }
+            else
+            {
+                Pixmap pixmap2 = (Pixmap) 0;
+
+                // If there's a bitmap for the armed state, use it,
+                // otherwise generate one.
+                if (tool->m_bitmap2.Ok())
+                {
+                    pixmap2 = (Pixmap) tool->m_bitmap2.GetPixmap();
+                }
+                else
+                {
+                    pixmap2 = (Pixmap) tool->m_bitmap1.GetArmPixmap(button);
+
+                }
+                // Normal button
+                XtVaSetValues(button,
+                   XmNlabelPixmap, pixmap,
+                   XmNlabelInsensitivePixmap, insensPixmap,
+                   XmNarmPixmap, pixmap2,
+                   NULL);
+            }
+            XtManageChild(button);
+
+            Dimension width, height;
+            XtVaGetValues(button, XmNwidth, & width, XmNheight, & height,
+                             NULL);
+            currentX += width + marginX;
+            buttonHeight = wxMax(buttonHeight, height);
+
+            XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask, 
+                       False, wxToolButtonPopupCallback, (XtPointer) this);
+            m_widgets.Append(tool->m_index, (wxObject*) button);
+
+            prevButton = button;
+            currentSpacing = 0;
+        }
+        node = node->Next();
+    }
+
+    SetSize(-1, -1, currentX, buttonHeight + 2*marginY);
+
+    return TRUE;
+}
+
+// Old version, assuming we use a form. Now we use
+// a bulletin board, so we can create controls on the toolbar.
+#if 0
 bool wxToolBar::CreateTools()
 {
     if (m_tools.Number() == 0)
@@ -296,6 +498,7 @@ bool wxToolBar::CreateTools()
 
     return TRUE;
 }
+#endif
 
 void wxToolBar::SetToolBitmapSize(const wxSize& size)
 {
@@ -428,6 +631,22 @@ WXWidget wxToolBar::FindWidgetForIndex(int index)
         return (WXWidget) node->Data();
 }
 
+WXWidget wxToolBar::GetTopWidget() const
+{
+    return m_mainWidget;
+}
+
+WXWidget wxToolBar::GetClientWidget() const
+{
+    return m_mainWidget;
+}
+
+WXWidget wxToolBar::GetMainWidget() const
+{
+    return m_mainWidget;
+}
+
+
 void wxToolButtonCallback (Widget w, XtPointer clientData,
                    XtPointer ptr)
 {
index a47a39413048fc411dbed87e7cbf2ef990d7f338..a748ea126e0d861728f1a3d62020592471a6e2a3 100644 (file)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #ifdef VMS
 /*steve*/
index 568974519d799814fad15b0f36d30f3ec2eb2bee..7863f36b76574ce4247acb2fa8d733ac221a5c26 100644 (file)
@@ -661,6 +661,27 @@ void wxWindow::GetClientSize(int *x, int *y) const
 
 void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
 {
+  // A bit of optimization to help sort out the flickers.
+  int oldX, oldY, oldW, oldH;
+  GetSize(& oldW, & oldH);
+  GetPosition(& oldX, & oldY);
+
+  bool useOldPos = FALSE;
+  bool useOldSize = FALSE;
+
+  if ((x == -1) && (x == -1) && ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0))
+    useOldPos = TRUE;
+  else if (x == oldX && y == oldY)
+    useOldPos = TRUE;
+
+  if ((width == -1) && (height == -1))
+    useOldSize = TRUE;
+  else if (width == oldW && height == oldH)
+    useOldSize = TRUE;
+
+  if (useOldPos && useOldSize)
+    return;
+
   if (m_drawingArea)
   {
     CanvasSetSize(x, y, width, height, sizeFlags);
@@ -677,22 +698,32 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
   int xx = x; int yy = y;
   AdjustForParentClientOrigin(xx, yy, sizeFlags);
 
-  if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-    XtVaSetValues(widget, XmNx, xx, NULL);
-  if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-    XtVaSetValues(widget, XmNy, yy, NULL);
-  if (width > -1)
-    XtVaSetValues(widget, XmNwidth, width, NULL);
-  if (height > -1)
-    XtVaSetValues(widget, XmNheight, height, NULL);
+  if (!useOldPos)
+  {
+    if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+      XtVaSetValues(widget, XmNx, xx, NULL);
+    if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+      XtVaSetValues(widget, XmNy, yy, NULL);
+  }
+  if (!useOldSize)
+  {
+    if (width > -1)
+      XtVaSetValues(widget, XmNwidth, width, NULL);
+    if (height > -1)
+      XtVaSetValues(widget, XmNheight, height, NULL);
+  }
 
   if (managed)
     XtManageChild(widget);
 
+  // How about this bit. Maybe we don't need to generate size events
+  // all the time -- they'll be generated when the window is sized anyway.
+  /*
   wxSizeEvent sizeEvent(wxSize(width, height), GetId());
   sizeEvent.SetEventObject(this);
   
   GetEventHandler()->ProcessEvent(sizeEvent);
+  */
 }
 
 void wxWindow::SetClientSize(int width, int height)
@@ -2504,6 +2535,27 @@ void wxWindow::DoPaint()
 // SetSize, but as per old wxCanvas (with drawing widget etc.)
 void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags)
 {
+  // A bit of optimization to help sort out the flickers.
+  int oldX, oldY, oldW, oldH;
+  GetSize(& oldW, & oldH);
+  GetPosition(& oldX, & oldY);
+
+  bool useOldPos = FALSE;
+  bool useOldSize = FALSE;
+
+  if ((x == -1) && (x == -1) && ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0))
+    useOldPos = TRUE;
+  else if (x == oldX && y == oldY)
+    useOldPos = TRUE;
+
+  if ((w == -1) && (h == -1))
+    useOldSize = TRUE;
+  else if (w == oldW && h == oldH)
+    useOldSize = TRUE;
+
+  if (useOldPos && useOldSize)
+    return;
+
   Widget drawingArea = (Widget) m_drawingArea;
   bool managed = XtIsManaged(m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow);
 
@@ -2514,19 +2566,25 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags)
   int xx = x; int yy = y;
   AdjustForParentClientOrigin(xx, yy, sizeFlags);
 
-  if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (!useOldPos)
+  {
+    if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     {
       XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
                     XmNx, xx, NULL);
     }
 
-  if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     {
       XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
                     XmNy, yy, NULL);
     }
+  }
 
-  if (w > -1)
+  if (!useOldSize)
+  {
+
+    if (w > -1)
     {
       if (m_borderWidget)
        {
@@ -2588,16 +2646,21 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags)
 
       XtVaSetValues ((Widget) m_drawingArea, XmNheight, h, NULL);
     }
+  }
+
   if (managed)
     XtManageChild (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow);
   XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_NONE, NULL);
 
+  /*
   int ww, hh;
   GetClientSize (&ww, &hh);
   wxSizeEvent sizeEvent(wxSize(ww, hh), GetId());
   sizeEvent.SetEventObject(this);
   
   GetEventHandler()->ProcessEvent(sizeEvent);
+  */
+
 }
 
 void wxWindow::CanvasSetClientSize (int w, int h)
@@ -2630,10 +2693,12 @@ void wxWindow::CanvasSetClientSize (int w, int h)
   DoRefresh ();
   */
 
+  /*
   wxSizeEvent sizeEvent(wxSize(w, h), GetId());
   sizeEvent.SetEventObject(this);
   
   GetEventHandler()->ProcessEvent(sizeEvent);
+  */
 }
 
 void wxWindow::CanvasGetClientSize (int *w, int *h) const