From 083f7497d34a1df453b92ab411aace3fc4ace927 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 2 Apr 2003 11:10:37 +0000 Subject: [PATCH] Applied some of patch [ 688466 ] MSVC7 build & bug fixes by Darren Whobrey git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/fl/dyntbar.h | 2 +- contrib/src/fl/barhintspl.cpp | 3 +++ contrib/src/fl/dyntbar.cpp | 2 +- docs/changes.txt | 15 ++++++++++++--- include/wx/defs.h | 6 ++++++ include/wx/filesys.h | 2 +- include/wx/hashmap.h | 8 ++++---- include/wx/notebook.h | 2 +- include/wx/string.h | 2 +- include/wx/wx.h | 2 +- src/common/event.cpp | 9 +++++++++ src/common/filefn.cpp | 2 +- src/common/string.cpp | 2 +- src/generic/dirctrlg.cpp | 6 +++--- src/generic/dirdlgg.cpp | 4 ++-- src/generic/filedlgg.cpp | 4 ++-- src/msw/app.cpp | 5 +++-- utils/emulator/src/emulator.cpp | 2 +- 18 files changed, 53 insertions(+), 25 deletions(-) diff --git a/contrib/include/wx/fl/dyntbar.h b/contrib/include/wx/fl/dyntbar.h index 25a1593ca6..3e38cb439a 100644 --- a/contrib/include/wx/fl/dyntbar.h +++ b/contrib/include/wx/fl/dyntbar.h @@ -199,7 +199,7 @@ public: // Enables or disables the given tool. - virtual void EnableTool(const int toolIndex, const bool enable = TRUE); + virtual void EnableTool(int toolIndex, bool enable = TRUE); // Responds to size events, calling Layout. diff --git a/contrib/src/fl/barhintspl.cpp b/contrib/src/fl/barhintspl.cpp index 241a98dea4..d6cd83ac77 100644 --- a/contrib/src/fl/barhintspl.cpp +++ b/contrib/src/fl/barhintspl.cpp @@ -512,6 +512,9 @@ void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event ) if ( i == 0 ) { mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE ); + // Notify bar child window of close event: + if(mpClickedBar->mpBarWnd!=NULL) + mpClickedBar->mpBarWnd->Close(); } else { diff --git a/contrib/src/fl/dyntbar.cpp b/contrib/src/fl/dyntbar.cpp index fe526de12e..4d66fcdda0 100644 --- a/contrib/src/fl/dyntbar.cpp +++ b/contrib/src/fl/dyntbar.cpp @@ -492,7 +492,7 @@ void wxDynamicToolBar::SetLayout( LayoutManagerBase* pLayout ) Layout(); } -void wxDynamicToolBar::EnableTool(const int toolIndex, const bool enable ) +void wxDynamicToolBar::EnableTool(int toolIndex, bool enable ) { wxDynToolInfo* pInfo = GetToolInfo( toolIndex ); diff --git a/docs/changes.txt b/docs/changes.txt index 328513bbda..255f1f36d7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -45,7 +45,6 @@ All GUI ports: - WXR resources can now be used in Unicode builds - it is now possible to use several wxFileHistory objects in the same menu by giving them different base IDs (Dimitri Schoolwerth) - - changed to type-safe wxSizerItemList for wxSizer child items Deprecated: wxSizer::Remove( wxWindow* ) @@ -64,8 +63,12 @@ All GUI ports: wxListBase::operator wxList&() - use typesafe lists instead - Added wxTLW::SetShape with implementations for wxMSW and wxGTK (so - far). - + far) +- FL: rmoved const from EnableTool parameters +- FL: signal child window when toolbar is closed +- In various places, changed tests for pathsep on last char of string to call + wxEndsWithPathSeparator(s) +- Added to defs.h a couple of macros (wxPtrToULong & wxULongToPtr) Unix: @@ -97,6 +100,12 @@ wxMSW: - fixed calling wxFrame::Maximize(FALSE) before the window is shown - all libraries built with makefile.g95 have a _min or _cyg suffix (for MinGW and Cygwin) +- When using DLL, wxLocalFSHandler was not being exported - added + WXEXPORTDLL +- A wxEvtHandler object was not removed from wxPendingEvents on deletion. + wxPendingEventsLocker was being deleted in App before all wxEvtHandler + objects have been destroyed resulting in stale handler/lock + ptrs; fixed wxMotif: diff --git a/include/wx/defs.h b/include/wx/defs.h index e86ebff8d7..536c6d9697 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -794,6 +794,12 @@ typedef float wxFloat32 ; #define wxUINT64_SWAP_ON_BE(val) (val) #endif +// Macros to convert from unsigned long to void pointer. +// High order truncation occurs if the respective type is not large enough. +#define WXPTRULONGSLICE (((wxBYTE_ORDER==wxBIG_ENDIAN)&&(sizeof(void*)==8)&&(sizeof(unsigned long)<8))?1:0) +#define wxPtrToULong(p) (((unsigned long*)(&(p)))[WXPTRULONGSLICE]) +#define wxULongToPtr(p,n) (p=NULL,wxPtrToULong(p)=(unsigned long)(n),p) + // ---------------------------------------------------------------------------- // Geometric flags // ---------------------------------------------------------------------------- diff --git a/include/wx/filesys.h b/include/wx/filesys.h index 7c1b69e77f..5c69a5da7c 100644 --- a/include/wx/filesys.h +++ b/include/wx/filesys.h @@ -241,7 +241,7 @@ special characters : */ -class wxLocalFSHandler : public wxFileSystemHandler +class WXDLLEXPORT wxLocalFSHandler : public wxFileSystemHandler { public: virtual bool CanOpen(const wxString& location); diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index 6142c84e84..e774c0a193 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -179,7 +179,7 @@ public: \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ const key_equal& k_eq = key_equal(), \ const key_extractor& k_ex = key_extractor() ) \ - : m_tableBuckets( GetNextPrime( sz ) ), \ + : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ m_items( 0 ), \ m_hasher( hfun ), \ m_equals( k_eq ), \ @@ -252,7 +252,7 @@ public: \ delete *node; \ (*node) = temp; \ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ - ResizeTable( GetPreviousPrime( m_tableBuckets ) - 1 ); \ + ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ return 1; \ } \ \ @@ -324,7 +324,7 @@ protected: \ \ void ResizeTable( size_t newSize ) \ { \ - newSize = GetNextPrime( newSize ); \ + newSize = GetNextPrime( (unsigned long)newSize ); \ Node** srcTable = m_table; \ size_t srcBuckets = m_tableBuckets; \ m_table = (Node**)AllocTable( newSize ); \ @@ -441,7 +441,7 @@ public: // TODO: this might not work well on architectures with 64 bit pointers but // 32 bit longs, we should use % ULONG_MAX there - unsigned long operator()( const void* k ) const { return (unsigned long)k; } + unsigned long operator()( const void* k ) const { return (unsigned long)wxPtrToULong(k); } wxPointerHash& operator=(const wxPointerHash&) { return *this; } }; diff --git a/include/wx/notebook.h b/include/wx/notebook.h index eb2b8af14e..8c18691b7c 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -67,7 +67,7 @@ public: // --------- // get number of pages in the dialog - int GetPageCount() const { return m_pages.GetCount(); } + int GetPageCount() const { return (int) m_pages.GetCount(); } // get the panel which represents the given page wxNotebookPage *GetPage(int nPage) { return m_pages[nPage]; } diff --git a/include/wx/string.h b/include/wx/string.h index 521b7ca966..b4a6fa1df7 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -258,7 +258,7 @@ private: bool AssignCopy(size_t, const wxChar *); // append a (sub)string - bool ConcatSelf(int nLen, const wxChar *src); + bool ConcatSelf(size_t nLen, const wxChar *src); // functions called before writing to the string: they copy it if there // are other references to our data (should be the only owner when writing) diff --git a/include/wx/wx.h b/include/wx/wx.h index 233ebcd16e..4da515ebec 100644 --- a/include/wx/wx.h +++ b/include/wx/wx.h @@ -77,7 +77,7 @@ #include "wx/choicdlg.h" #include "wx/textdlg.h" #include "wx/filedlg.h" - +#include "wx/treectrl.h" #include "wx/validate.h" // always include, even if !wxUSE_VALIDATORS #if wxUSE_VALIDATORS diff --git a/src/common/event.cpp b/src/common/event.cpp index 7f36cc628b..b2dc2e82f4 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -656,6 +656,15 @@ wxEvtHandler::~wxEvtHandler() # if !defined(__VISAGECPP__) delete m_eventsLocker; # endif + + // Remove us from wxPendingEvents if necessary. + if(wxPendingEventsLocker) + wxENTER_CRIT_SECT(*wxPendingEventsLocker); + if ( wxPendingEvents ) { + wxPendingEvents->DeleteObject(this); + } + if(wxPendingEventsLocker) + wxLEAVE_CRIT_SECT(*wxPendingEventsLocker); #endif // we only delete object data, not untyped diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index d05fb1ecc3..f6d5b9d69f 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1406,7 +1406,7 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) wxSplitPath(spec, &gs_dirPath, NULL, NULL); if ( gs_dirPath.IsEmpty() ) gs_dirPath = wxT("."); - if ( gs_dirPath.Last() != wxFILE_SEP_PATH ) + if ( !wxEndsWithPathSeparator(gs_dirPath ) ) gs_dirPath << wxFILE_SEP_PATH; if (gs_dir) diff --git a/src/common/string.cpp b/src/common/string.cpp index 9d16b5302a..791c5ce049 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -608,7 +608,7 @@ wxString& wxString::operator=(const wchar_t *pwz) // --------------------------------------------------------------------------- // add something to this string -bool wxString::ConcatSelf(int nSrcLen, const wxChar *pszSrcData) +bool wxString::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData) { STATISTICS_ADD(SummandLength, nSrcLen); diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 09f07715ee..01a5ef666b 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -939,7 +939,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) { wxString eachFilename(dirs[i]); path = dirName; - if (path.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(path)) path += wxString(wxFILE_SEP_PATH); path += eachFilename; @@ -966,7 +966,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) { wxString eachFilename(filenames[i]); path = dirName; - if (path.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(path)) path += wxString(wxFILE_SEP_PATH); path += eachFilename; //path = dirName + wxString(wxT("/")) + eachFilename; @@ -1010,7 +1010,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& if (data && !data->m_path.IsEmpty()) { wxString childPath(data->m_path); - if (childPath.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(childPath)) childPath += wxString(wxFILE_SEP_PATH); // In MSW and PM, case is not significant diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index b73214e6b7..107967f521 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -273,7 +273,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) wxString new_name( _("NewName") ); wxString path( data->m_path ); - if (path.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(path)) path += wxFILE_SEP_PATH; path += new_name; if (wxFileExists(path)) @@ -287,7 +287,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) new_name += num; path = data->m_path; - if (path.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(path)) path += wxFILE_SEP_PATH; path += new_name; i++; diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index de20355225..bc5c9f174e 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -856,7 +856,7 @@ void wxFileCtrl::GoToParentDir() if (!IsTopMostDir(m_dirName)) { size_t len = m_dirName.Len(); - if (m_dirName[len-1] == wxFILE_SEP_PATH) + if (wxEndsWithPathSeparator(m_dirName)) m_dirName.Remove( len-1, 1 ); wxString fname( wxFileNameFromPath(m_dirName) ); m_dirName = wxPathOnly( m_dirName ); @@ -1038,7 +1038,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, } size_t len = m_dir.Len(); - if ((len > 1) && (m_dir[len-1] == wxFILE_SEP_PATH)) + if ((len > 1) && (wxEndsWithPathSeparator(m_dir))) m_dir.Remove( len-1, 1 ); m_path = m_dir; diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 94b3dfb59f..390b846cc3 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -560,13 +560,14 @@ void wxApp::CleanUp() #endif delete wxWinHandleHash; + wxWinHandleHash = NULL; // Set to null in case anything later tries to ref it. - // GL: I'm annoyed ... I don't know where to put this and I don't want to - // create a module for that as it's part of the core. delete wxPendingEvents; + wxPendingEvents = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later. #if wxUSE_THREADS delete wxPendingEventsLocker; + wxPendingEventsLocker = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later. // If we don't do the following, we get an apparent memory leak #if wxUSE_VALIDATORS ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp index 785bc8bda7..672287a256 100644 --- a/utils/emulator/src/emulator.cpp +++ b/utils/emulator/src/emulator.cpp @@ -578,7 +578,7 @@ wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin { // Is it a relative path? wxString currentDir(cwd); - if (currentDir.Last() != wxFILE_SEP_PATH) + if (!wxEndsWithPathSeparator(currentDir)) currentDir += wxFILE_SEP_PATH; str = currentDir + argv0; -- 2.47.2