From: Julian Smart Date: Mon, 28 Dec 1998 21:32:10 +0000 (+0000) Subject: Fixes to wxMotif scrolling and colours (wxTreeCtrl/wxListCtrl now seem to work X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/88150e6073673c304d285906e0d718374a5abe93 Fixes to wxMotif scrolling and colours (wxTreeCtrl/wxListCtrl now seem to work well, ta-ra!); fixes to thread.cpp since constants were changed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/cw.rsp b/distrib/msw/cw.rsp index c04d82f724..db34f13bbe 100644 --- a/distrib/msw/cw.rsp +++ b/distrib/msw/cw.rsp @@ -42,7 +42,7 @@ samples/mfc/make_cw.mcp samples/minimal/make_cw.mcp -samples/minimal/make_cw.mcp +samples/minifram/make_cw.mcp samples/nativdlg/make_cw.mcp diff --git a/distrib/msw/vc.rsp b/distrib/msw/vc.rsp index e06f706c04..630b084712 100644 --- a/distrib/msw/vc.rsp +++ b/distrib/msw/vc.rsp @@ -64,8 +64,8 @@ samples/mfc/MfcVC.dsw samples/minimal/MinimalVC.dsp samples/minimal/MinimalVC.dsw -samples/minimal/MiniframVC.dsp -samples/minimal/MiniframVC.dsw +samples/minifram/MiniframVC.dsp +samples/minifram/MiniframVC.dsw samples/nativdlg/NativdlgVC.dsp samples/nativdlg/NativdlgVC.dsw diff --git a/distrib/msw/zipdist.bat b/distrib/msw/zipdist.bat index d345f552a7..d8c4e4deda 100755 --- a/distrib/msw/zipdist.bat +++ b/distrib/msw/zipdist.bat @@ -14,6 +14,7 @@ erase %dest\wx200*.zip cd %src echo Zipping... + zip32 -@ %dest\wx200gen.zip < %src\distrib\msw\generic.rsp zip32 -@ %dest\wx200msw.zip < %src\distrib\msw\msw.rsp zip32 -@ %dest\wx200gtk.zip < %src\distrib\msw\gtk.rsp @@ -28,6 +29,7 @@ zip32 -@ %dest\wx200wrd.zip < %src\distrib\msw\wx_word.rsp rem VC++ project files zip32 -@ %dest\wx200vc.zip < %src\distrib\msw\vc.rsp + rem CodeWarrior project files zip32 -@ %dest\wx200cw.zip < %src\distrib\msw\cw.rsp diff --git a/docs/motif/changes.txt b/docs/motif/changes.txt index 0ea2595216..3c9df41c3f 100644 --- a/docs/motif/changes.txt +++ b/docs/motif/changes.txt @@ -89,4 +89,14 @@ More recently: - Fixed a bug in wxStaticBox. - Controls sample runs, though wxRadioBox doesn't appear and the notebook flickers for a while. -- Cured wxTreeCtrl bug: now works pretty well! \ No newline at end of file +- Cured wxTreeCtrl bug: now works pretty well! + +28/12/98 +-------- + +- Cured scrolling problem: scrollbars now show/hide themselves + without (permanently) resizing the window. +- Removed some commented-out lines in wxScrolledWindow::AdjustScrollbars + that disabled scrollbar paging. +- Set background colour of drawing area in wxWindow, so e.g. wxListCtrl + colours correctly. \ No newline at end of file diff --git a/docs/motif/todo.txt b/docs/motif/todo.txt index ee35bec834..63254e2da6 100644 --- a/docs/motif/todo.txt +++ b/docs/motif/todo.txt @@ -1,7 +1,7 @@ wxMotif TODO ------------ -Updated: 12/11/98 +Updated: 28/12/98 -------------------------------o------------------------- @@ -40,33 +40,10 @@ High Priority - wxSpinButton -- Tidy dialogs such as the colour and font selectors. - -- Use generic wxTreeCtrl, wxListCtrl: debug and enhance these. - We're close to having these working: mostly scrolling to work out. - -- Find out why modal dialogs give a grab warning. - -- wxSystemSettings. Eventually, should have control panel-like utility - to change colours/fonts but meanwhile should maybe read them - from a file. - -- wxThread (hopefully, similar to wxGTK) - -- wxGrid: scrollbars don't hide; problem with cell selection. - -- MDI: seems to be broken for a more complex application I'm testing. - Frame decorations don't draw properly, and a child window doesn't - process events properly. So probably we should have an alternative - implementation that uses tabs, a la wxGTK. The system menu could - be implemented using a pop-up menu that applies to the currently - active window. - -- Controls in a wxToolBar don't work. Probably due to form layout - problems; the workaround is to use a separate panel for controls. - - Miscellaneous events. +- Thread classes (copy wxGTK's). + - Write makefiles for all samples and utilities. - Create some samples for testing. @@ -75,14 +52,11 @@ Low Priority ------------ - Better makefile system that can put objects in different dirs. - Use wxGTK config system? It's really complex to debug and - doesn't offer a way of compiling apps outside the wxWin - hierarchy. - Extra wxBitmap formats: PNG, BMP. Could use old wxWin 1.68 wxImage code (derived from XV) for BMP/GIF but it's very bloated. However, when implemented as extra bitmap handlers, the code won't be linked - unless needed. + unless needed. Update: see if wxImage can handle these formats. - Print/preview framework in print.cpp (see wxGTK). @@ -107,10 +81,6 @@ Low Priority - add the driver code to src/motif/helphtml.cpp (a frame, toolbar, history list). -- Optimize screen refresh for non-native widgets, e.g. wxWindow - created with Create(), using technique in flicker patch for 1.68 - (see JACS for latest patch). - - Copy and paste, drag and drop. Use a standard X drag and drop standard - see http://www.cco.caltech.edu/~jafl/xdnd/ or use Motif drag and drop as described here: @@ -130,19 +100,11 @@ Low Priority - Reimplement combobox using Lesstif's widget (avoiding GPL'ed widget currently used). -- Write generic wxDirDialog (directory selector) - -- Use native Motif dialogs for wxMessageBox - - Miscellaneous classes e.g. wxJoystick (identical to GTK's one for Linux) - Blit scaling -- Could eventually alter the MDI widgets to be more Windows-like - -- currently it's half-hearted (menus are on children, whereas - they should replace the main parent frame menu). - - Get ODBC classes and sample working. - Work out why wxTextCtrl doesn't work as a stream buffer under diff --git a/include/wx/motif/window.h b/include/wx/motif/window.h index f4a6a05f4c..daa7e42b93 100644 --- a/include/wx/motif/window.h +++ b/include/wx/motif/window.h @@ -275,6 +275,10 @@ public: virtual void SetScrollbar(int orient, int pos, int thumbVisible, int range, bool refresh = TRUE); + // Helper functions for Motif + void CreateScrollbar(int orientation); + void DestroyScrollbar(int orientation); + virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); virtual int GetScrollPos(int orient) const; virtual int GetScrollRange(int orient) const; @@ -686,5 +690,19 @@ wxWindow* WXDLLEXPORT wxGetActiveWindow(); WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows; +// A little class to switch off size optimization while an instance of the object +// exists +class WXDLLEXPORT wxNoOptimize: public wxObject +{ +public: + wxNoOptimize(); + ~wxNoOptimize(); + + static bool CanOptimize(); + +protected: + static int m_count; +}; + #endif // _WX_WINDOW_H_ diff --git a/include/wx/string.h b/include/wx/string.h index ea62d6781b..f9f731380f 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -73,6 +73,8 @@ */ // --------------------------------------------------------------------------- +WXDLLEXPORT_DATA(extern const char*) wxEmptyString; + /// checks whether the passed in pointer is NULL and if the string is empty inline bool WXDLLEXPORT IsEmpty(const char *p) { return !p || !*p; } diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 7faaef5d31..277e3e01ba 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -469,22 +469,13 @@ void wxSocketBase::Discard() bool wxSocketBase::GetPeer(wxSockAddress& addr_man) const { struct sockaddr my_addr; -#ifdef __WXMSW__ int len_addr = sizeof(my_addr); -#else - size_t len_addr = sizeof(my_addr); -#endif if (m_fd < 0) return FALSE; if (getpeername(m_fd, (struct sockaddr *)&my_addr, -#ifdef __WXMSW__ - &len_addr) -#else - (socklen_t *)&len_addr) -#endif - < 0) + &len_addr) < 0) return FALSE; addr_man.Disassemble(&my_addr, len_addr); @@ -494,22 +485,13 @@ bool wxSocketBase::GetPeer(wxSockAddress& addr_man) const bool wxSocketBase::GetLocal(wxSockAddress& addr_man) const { struct sockaddr my_addr; -#ifdef __WXMSW__ int len_addr = sizeof(my_addr); -#else - size_t len_addr = sizeof(my_addr); -#endif if (m_fd < 0) return FALSE; if (getsockname(m_fd, (struct sockaddr *)&my_addr, -#ifdef __WXMSW__ - &len_addr) -#else - (socklen_t *)&len_addr) -#endif - < 0) + &len_addr) < 0) return FALSE; diff --git a/src/generic/scrolwin.cpp b/src/generic/scrolwin.cpp index 4b99809f81..4bb0b3a77c 100644 --- a/src/generic/scrolwin.cpp +++ b/src/generic/scrolwin.cpp @@ -121,7 +121,6 @@ void wxScrolledWindow::OnScroll(wxScrollEvent& event) int nScrollInc = CalcScrollInc(event); if (nScrollInc == 0) return; - // TODO: should we store the scroll position here as well as in wxWindow? if (orient == wxHORIZONTAL) { int newPos = m_xScrollPosition + nScrollInc; @@ -133,19 +132,6 @@ void wxScrolledWindow::OnScroll(wxScrollEvent& event) SetScrollPos(wxVERTICAL, newPos, TRUE ); } -/* - // TODO We need to multiply the ScrollWindow amount by the scaling - // factor, but how do we know what this is in wxWin 2.0??? - float scaleX = 1.0; - float scaleY = 1.0; - - if ( this->IsKindOf(CLASSINFO(wxCanvas)) ) - { - wxDC* dc = ((wxCanvas *)this)->GetDC(); - dc->GetUserScale(&scaleX, &scaleY); - } -*/ - if (orient == wxHORIZONTAL) { m_xScrollPosition += nScrollInc; @@ -234,6 +220,7 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) break; } } + if (orient == wxHORIZONTAL) { if (m_xScrollPixelsPerLine > 0) { @@ -295,7 +282,8 @@ void wxScrolledWindow::AdjustScrollbars(void) m_xScrollPosition = wxMax( 0, m_xScrollPosition ); SetScrollbar(wxHORIZONTAL, m_xScrollPosition, noPagePositions, m_xScrollLines); -// SetScrollPageSize(wxHORIZONTAL, noPagePositions); + // The amount by which we scroll when paging + SetScrollPageSize(wxHORIZONTAL, noPagePositions); } else { @@ -316,7 +304,8 @@ void wxScrolledWindow::AdjustScrollbars(void) m_yScrollPosition = wxMax( 0, m_yScrollPosition ); SetScrollbar(wxVERTICAL, m_yScrollPosition, noPagePositions, m_yScrollLines); -// SetScrollPageSize(wxVERTICAL, noPagePositions); + // The amount by which we scroll when paging + SetScrollPageSize(wxVERTICAL, noPagePositions); } else { diff --git a/src/make_cw.mcp b/src/make_cw.mcp index d4a10e5ef1..66a5ba2c46 100644 Binary files a/src/make_cw.mcp and b/src/make_cw.mcp differ diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 6862e9a03a..84e727db65 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -515,7 +515,8 @@ void wxDialog::EndModal(int retCode) SetReturnCode(retCode); - XtRemoveGrab((Widget) m_mainWidget); + // Strangely, we don't seem to need this now. + // XtRemoveGrab((Widget) m_mainWidget); Show(FALSE); diff --git a/src/motif/thread.cpp b/src/motif/thread.cpp index ca3833153a..e12b45e63b 100644 --- a/src/motif/thread.cpp +++ b/src/motif/thread.cpp @@ -57,14 +57,14 @@ wxMutexError wxMutex::Lock() { // TODO m_locked++; - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::TryLock() { // TODO m_locked++; - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::Unlock() @@ -73,7 +73,7 @@ wxMutexError wxMutex::Unlock() m_locked--; // TODO - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } class wxConditionInternal { @@ -134,25 +134,25 @@ public: wxThreadError wxThread::Create() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Destroy() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Pause() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Resume() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } void wxThread::Exit(void *status) @@ -193,11 +193,13 @@ unsigned long wxThread::GetID() const return 0; } +/* wxThread *wxThread::GetThreadFromID(unsigned long id) { // TODO return NULL; } +*/ bool wxThread::IsAlive() const { diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 545f469e13..87495d12b7 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -368,6 +368,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, m_scrolledWindow = (WXWidget) XtVaCreateManagedWidget ("scrolledWindow", xmScrolledWindowWidgetClass, m_borderWidget ? (Widget) m_borderWidget : parentWidget, + XmNresizePolicy, XmRESIZE_NONE, XmNspacing, 0, XmNscrollingPolicy, XmAPPLICATION_DEFINED, // XmNscrollBarDisplayPolicy, XmAS_NEEDED, @@ -420,8 +421,40 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, XtAddEventHandler ((Widget) m_drawingArea, PointerMotionHintMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask, False, (XtEventHandler) wxCanvasEnterLeave, (XtPointer) this); + // Scrolled widget needs to have its colour changed or we get + // a little blue square where the scrollbars abutt + wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE); + DoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE); + + XmScrolledWindowSetAreas ((Widget) m_scrolledWindow, (Widget) 0, (Widget) 0, (Widget) m_drawingArea); + + /* + if (m_hScrollBar) + XtRealizeWidget ((Widget) m_hScrollBar); + if (m_vScrollBar) + XtRealizeWidget ((Widget) m_vScrollBar); + */ + + // Without this, the cursor may not be restored properly + // (e.g. in splitter sample). + SetCursor(*wxSTANDARD_CURSOR); + SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + SetSize(pos.x, pos.y, size.x, size.y); + + return TRUE; +} + +// Helper function +void wxWindow::CreateScrollbar(int orientation) +{ + if (!m_drawingArea) + return; + + XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_NONE, NULL); + // Add scrollbars if required - if (m_windowStyle & wxHSCROLL) + if (orientation == wxHORIZONTAL) { Widget hScrollBar = XtVaCreateManagedWidget ("hsb", xmScrollBarWidgetClass, (Widget) m_scrolledWindow, @@ -446,9 +479,16 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE); + XtRealizeWidget(hScrollBar); + + XtVaSetValues((Widget) m_scrolledWindow, + XmNhorizontalScrollBar, (Widget) m_hScrollBar, + NULL); + m_hScroll = TRUE; } - if (m_windowStyle & wxVSCROLL) + + if (orientation == wxVERTICAL) { Widget vScrollBar = XtVaCreateManagedWidget ("vsb", xmScrollBarWidgetClass, (Widget) m_scrolledWindow, @@ -472,29 +512,54 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE); + XtRealizeWidget(vScrollBar); + + XtVaSetValues((Widget) m_scrolledWindow, + XmNverticalScrollBar, (Widget) m_vScrollBar, + NULL); + m_vScroll = TRUE; } - // Scrolled widget needs to have its colour changed or we get - // a little blue square where the scrollbars abutt - wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); - DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE); + XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_ANY, NULL); +} +void wxWindow::DestroyScrollbar(int orientation) +{ + if (!m_drawingArea) + return; - if (m_hScrollBar || m_vScrollBar) - XmScrolledWindowSetAreas ((Widget) m_scrolledWindow, (Widget) m_hScrollBar, (Widget) m_vScrollBar, (Widget) m_drawingArea); + XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_NONE, NULL); + // Add scrollbars if required + if (orientation == wxHORIZONTAL) + { + if (m_hScrollBar) + { + XtDestroyWidget((Widget) m_hScrollBar); + } + m_hScrollBar = (WXWidget) 0; + m_hScroll = FALSE; - if (m_hScrollBar) - XtRealizeWidget ((Widget) m_hScrollBar); - if (m_vScrollBar) - XtRealizeWidget ((Widget) m_vScrollBar); + XtVaSetValues((Widget) m_scrolledWindow, + XmNhorizontalScrollBar, (Widget) 0, + NULL); - // Without this, the cursor may not be restored properly - // (e.g. in splitter sample). - SetCursor(*wxSTANDARD_CURSOR); - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - SetSize(pos.x, pos.y, size.x, size.y); + } - return TRUE; + if (orientation == wxVERTICAL) + { + if (m_vScrollBar) + { + XtDestroyWidget((Widget) m_vScrollBar); + } + m_vScrollBar = (WXWidget) 0; + m_vScroll = TRUE; + + XtVaSetValues((Widget) m_scrolledWindow, + XmNverticalScrollBar, (Widget) 0, + NULL); + + } + XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_ANY, NULL); } void wxWindow::SetFocus() @@ -693,6 +758,11 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) else if (width == oldW && height == oldH) useOldSize = TRUE; + if (!wxNoOptimize::CanOptimize()) + { + useOldSize = FALSE; useOldPos = FALSE; + } + if (useOldPos && useOldSize) return; @@ -1166,9 +1236,8 @@ void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible, int range, bool WXUNUSED(refresh)) { - Widget scrollBar = (Widget) ((orient == wxHORIZONTAL) ? m_hScrollBar : m_vScrollBar ); - if (!scrollBar) - return; + int oldW, oldH; + GetSize(& oldW, & oldH); if (range == 0) range = 1; @@ -1178,77 +1247,66 @@ void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible, if (thumbVisible > range) thumbVisible = range; - XtVaSetValues(scrollBar, - XmNvalue, pos, - XmNminimum, 0, - XmNmaximum, range, - XmNsliderSize, thumbVisible, - NULL); + // Save the old state to see if it changed + WXWidget oldScrollBar = ((orient == wxHORIZONTAL) ? m_hScrollBar : m_vScrollBar ); if (orient == wxHORIZONTAL) - m_scrollPosX = pos; - else - m_scrollPosY = pos; - - // See notes below. If the scrollbars didn't leave a ghost presence, - // this would be OK. -#if 0 - if (range == thumbVisible) { - XtUnmanageChild(scrollBar); - if (orient == wxHORIZONTAL) - XtVaSetValues((Widget) m_scrolledWindow, - XmNhorizontalScrollBar, (Widget) 0, - NULL); + if (thumbVisible == range) + { + if (m_hScrollBar) + DestroyScrollbar(wxHORIZONTAL); + } else - XtVaSetValues((Widget) m_scrolledWindow, - XmNverticalScrollBar, (Widget) 0, - NULL); + { + if (!m_hScrollBar) + CreateScrollbar(wxHORIZONTAL); + } } - else + if (orient == wxVERTICAL) { - XtManageChild(scrollBar); - if (orient == wxHORIZONTAL) - XtVaSetValues((Widget) m_scrolledWindow, - XmNhorizontalScrollBar, (Widget) m_hScrollBar, - NULL); + if (thumbVisible == range) + { + if (m_vScrollBar) + DestroyScrollbar(wxVERTICAL); + } else - XtVaSetValues((Widget) m_scrolledWindow, - XmNverticalScrollBar, (Widget) m_vScrollBar, - NULL); + { + if (!m_vScrollBar) + CreateScrollbar(wxVERTICAL); + } } -#else - // Either both scrollbars are on, or they are off, - // otherwise you get a gap where one scrollbar - // isn't shown. TODO: try to eliminate this problem. - if ((GetScrollThumb(wxHORIZONTAL) >= GetScrollRange(wxHORIZONTAL)) && - (GetScrollThumb(wxVERTICAL) >= GetScrollRange(wxVERTICAL))) + WXWidget newScrollBar = ((orient == wxHORIZONTAL) ? m_hScrollBar : m_vScrollBar ); + + if (oldScrollBar != newScrollBar) { - if (m_hScrollBar) - XtUnmanageChild((Widget) m_hScrollBar); - if (m_vScrollBar) - XtUnmanageChild((Widget) m_vScrollBar); - XtVaSetValues((Widget) m_scrolledWindow, - XmNhorizontalScrollBar, (Widget) 0, - XmNverticalScrollBar, (Widget) 0, - NULL); - // XmScrolledWindowSetAreas((Widget) m_scrolledWindow, - // (Widget) 0, (Widget) 0, (Widget) m_drawingArea); + // This is important! Without it, scrollbars misbehave + // badly. + XtUnrealizeWidget((Widget) m_scrolledWindow); + XmScrolledWindowSetAreas ((Widget) m_scrolledWindow, (Widget) m_hScrollBar, (Widget) m_vScrollBar, (Widget) m_drawingArea); + XtRealizeWidget((Widget) m_scrolledWindow); + XtManageChild((Widget) m_scrolledWindow); } + + if (newScrollBar) + XtVaSetValues((Widget) newScrollBar, + XmNvalue, pos, + XmNminimum, 0, + XmNmaximum, range, + XmNsliderSize, thumbVisible, + NULL); + + if (orient == wxHORIZONTAL) + m_scrollPosX = pos; else - { - if (m_hScrollBar) - XtManageChild((Widget) m_hScrollBar); - if (m_vScrollBar) - XtManageChild((Widget) m_vScrollBar); - XtVaSetValues((Widget) m_scrolledWindow, - XmNhorizontalScrollBar, (Widget) m_hScrollBar, - XmNverticalScrollBar, (Widget) m_vScrollBar, - NULL); - // XmScrolledWindowSetAreas((Widget) m_scrolledWindow, - // (Widget) m_hScrollBar, (Widget) m_vScrollBar, (Widget) m_drawingArea); - } -#endif + m_scrollPosY = pos; + + int newW, newH; + GetSize(& newW, & newH); + + // Adjusting scrollbars can resize the canvas accidentally + if (newW != oldW || newH != oldH) + SetSize(-1, -1, oldW, oldH); } // Does a physical scroll @@ -2644,6 +2702,11 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags) else if (w == oldW && h == oldH) useOldSize = TRUE; + if (!wxNoOptimize::CanOptimize()) + { + useOldSize = FALSE; useOldPos = FALSE; + } + if (useOldPos && useOldSize) return; @@ -2704,7 +2767,7 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags) w -= (spacing + wsbar); - XtVaSetValues ((Widget) m_drawingArea, XmNwidth, w, NULL); + // XtVaSetValues ((Widget) m_drawingArea, XmNwidth, w, NULL); } if (h > -1) { @@ -2735,7 +2798,8 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags) h -= (spacing + wsbar); - XtVaSetValues ((Widget) m_drawingArea, XmNheight, h, NULL); + // XtVaSetValues ((Widget) m_drawingArea, XmNheight, h, NULL); + } } @@ -3202,12 +3266,16 @@ void wxWindow::ChangeBackgroundColour() { if (GetMainWidget()) DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour); + if (m_scrolledWindow && (GetMainWidget() != m_scrolledWindow)) + DoChangeBackgroundColour(m_scrolledWindow, m_backgroundColour); } void wxWindow::ChangeForegroundColour() { if (GetMainWidget()) DoChangeForegroundColour(GetMainWidget(), m_foregroundColour); + if (m_scrolledWindow && (GetMainWidget() != m_scrolledWindow)) + DoChangeForegroundColour(m_scrolledWindow, m_foregroundColour); } // Change a widget's foreground and background colours. @@ -3370,3 +3438,24 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event) return FALSE; } +/* + * wxNoOptimize: switch off size optimization + */ + +int wxNoOptimize::m_count = 0; + +wxNoOptimize::wxNoOptimize() +{ + m_count ++; +} + +wxNoOptimize::~wxNoOptimize() +{ + m_count --; +} + +bool wxNoOptimize::CanOptimize() +{ + return (m_count == 0); +} + diff --git a/src/stubs/thread.cpp b/src/stubs/thread.cpp index ca3833153a..e12b45e63b 100644 --- a/src/stubs/thread.cpp +++ b/src/stubs/thread.cpp @@ -57,14 +57,14 @@ wxMutexError wxMutex::Lock() { // TODO m_locked++; - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::TryLock() { // TODO m_locked++; - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::Unlock() @@ -73,7 +73,7 @@ wxMutexError wxMutex::Unlock() m_locked--; // TODO - return MUTEX_NO_ERROR; + return wxMUTEX_NO_ERROR; } class wxConditionInternal { @@ -134,25 +134,25 @@ public: wxThreadError wxThread::Create() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Destroy() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Pause() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } wxThreadError wxThread::Resume() { // TODO - return THREAD_NO_ERROR; + return wxTHREAD_NO_ERROR; } void wxThread::Exit(void *status) @@ -193,11 +193,13 @@ unsigned long wxThread::GetID() const return 0; } +/* wxThread *wxThread::GetThreadFromID(unsigned long id) { // TODO return NULL; } +*/ bool wxThread::IsAlive() const {