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
This commit is contained in:
Julian Smart
2003-04-02 11:10:37 +00:00
parent baf3431445
commit 083f7497d3
18 changed files with 53 additions and 25 deletions

View File

@@ -199,7 +199,7 @@ public:
// Enables or disables the given tool. // 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. // Responds to size events, calling Layout.

View File

@@ -512,6 +512,9 @@ void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event )
if ( i == 0 ) if ( i == 0 )
{ {
mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE ); mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE );
// Notify bar child window of close event:
if(mpClickedBar->mpBarWnd!=NULL)
mpClickedBar->mpBarWnd->Close();
} }
else else
{ {

View File

@@ -492,7 +492,7 @@ void wxDynamicToolBar::SetLayout( LayoutManagerBase* pLayout )
Layout(); Layout();
} }
void wxDynamicToolBar::EnableTool(const int toolIndex, const bool enable ) void wxDynamicToolBar::EnableTool(int toolIndex, bool enable )
{ {
wxDynToolInfo* pInfo = GetToolInfo( toolIndex ); wxDynToolInfo* pInfo = GetToolInfo( toolIndex );

View File

@@ -45,7 +45,6 @@ All GUI ports:
- WXR resources can now be used in Unicode builds - WXR resources can now be used in Unicode builds
- it is now possible to use several wxFileHistory objects in the same menu - it is now possible to use several wxFileHistory objects in the same menu
by giving them different base IDs (Dimitri Schoolwerth) by giving them different base IDs (Dimitri Schoolwerth)
- changed to type-safe wxSizerItemList for wxSizer child items - changed to type-safe wxSizerItemList for wxSizer child items
Deprecated: Deprecated:
wxSizer::Remove( wxWindow* ) wxSizer::Remove( wxWindow* )
@@ -64,8 +63,12 @@ All GUI ports:
wxListBase::operator wxList&() wxListBase::operator wxList&()
- use typesafe lists instead - use typesafe lists instead
- Added wxTLW::SetShape with implementations for wxMSW and wxGTK (so - 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: Unix:
@@ -97,6 +100,12 @@ wxMSW:
- fixed calling wxFrame::Maximize(FALSE) before the window is shown - fixed calling wxFrame::Maximize(FALSE) before the window is shown
- all libraries built with makefile.g95 have a _min or _cyg suffix - all libraries built with makefile.g95 have a _min or _cyg suffix
(for MinGW and Cygwin) (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: wxMotif:

View File

@@ -794,6 +794,12 @@ typedef float wxFloat32 ;
#define wxUINT64_SWAP_ON_BE(val) (val) #define wxUINT64_SWAP_ON_BE(val) (val)
#endif #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 // Geometric flags
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -241,7 +241,7 @@ special characters :
*/ */
class wxLocalFSHandler : public wxFileSystemHandler class WXDLLEXPORT wxLocalFSHandler : public wxFileSystemHandler
{ {
public: public:
virtual bool CanOpen(const wxString& location); virtual bool CanOpen(const wxString& location);

View File

@@ -179,7 +179,7 @@ public: \
CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \
const key_equal& k_eq = key_equal(), \ const key_equal& k_eq = key_equal(), \
const key_extractor& k_ex = key_extractor() ) \ const key_extractor& k_ex = key_extractor() ) \
: m_tableBuckets( GetNextPrime( sz ) ), \ : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \
m_items( 0 ), \ m_items( 0 ), \
m_hasher( hfun ), \ m_hasher( hfun ), \
m_equals( k_eq ), \ m_equals( k_eq ), \
@@ -252,7 +252,7 @@ public: \
delete *node; \ delete *node; \
(*node) = temp; \ (*node) = temp; \
if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \
ResizeTable( GetPreviousPrime( m_tableBuckets ) - 1 ); \ ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \
return 1; \ return 1; \
} \ } \
\ \
@@ -324,7 +324,7 @@ protected: \
\ \
void ResizeTable( size_t newSize ) \ void ResizeTable( size_t newSize ) \
{ \ { \
newSize = GetNextPrime( newSize ); \ newSize = GetNextPrime( (unsigned long)newSize ); \
Node** srcTable = m_table; \ Node** srcTable = m_table; \
size_t srcBuckets = m_tableBuckets; \ size_t srcBuckets = m_tableBuckets; \
m_table = (Node**)AllocTable( newSize ); \ m_table = (Node**)AllocTable( newSize ); \
@@ -441,7 +441,7 @@ public:
// TODO: this might not work well on architectures with 64 bit pointers but // TODO: this might not work well on architectures with 64 bit pointers but
// 32 bit longs, we should use % ULONG_MAX there // 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; } wxPointerHash& operator=(const wxPointerHash&) { return *this; }
}; };

View File

@@ -67,7 +67,7 @@ public:
// --------- // ---------
// get number of pages in the dialog // 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 // get the panel which represents the given page
wxNotebookPage *GetPage(int nPage) { return m_pages[nPage]; } wxNotebookPage *GetPage(int nPage) { return m_pages[nPage]; }

View File

@@ -258,7 +258,7 @@ private:
bool AssignCopy(size_t, const wxChar *); bool AssignCopy(size_t, const wxChar *);
// append a (sub)string // 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 // 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) // are other references to our data (should be the only owner when writing)

View File

@@ -77,7 +77,7 @@
#include "wx/choicdlg.h" #include "wx/choicdlg.h"
#include "wx/textdlg.h" #include "wx/textdlg.h"
#include "wx/filedlg.h" #include "wx/filedlg.h"
#include "wx/treectrl.h"
#include "wx/validate.h" // always include, even if !wxUSE_VALIDATORS #include "wx/validate.h" // always include, even if !wxUSE_VALIDATORS
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS

View File

@@ -656,6 +656,15 @@ wxEvtHandler::~wxEvtHandler()
# if !defined(__VISAGECPP__) # if !defined(__VISAGECPP__)
delete m_eventsLocker; delete m_eventsLocker;
# endif # 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 #endif
// we only delete object data, not untyped // we only delete object data, not untyped

View File

@@ -1406,7 +1406,7 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
wxSplitPath(spec, &gs_dirPath, NULL, NULL); wxSplitPath(spec, &gs_dirPath, NULL, NULL);
if ( gs_dirPath.IsEmpty() ) if ( gs_dirPath.IsEmpty() )
gs_dirPath = wxT("."); gs_dirPath = wxT(".");
if ( gs_dirPath.Last() != wxFILE_SEP_PATH ) if ( !wxEndsWithPathSeparator(gs_dirPath ) )
gs_dirPath << wxFILE_SEP_PATH; gs_dirPath << wxFILE_SEP_PATH;
if (gs_dir) if (gs_dir)

View File

@@ -608,7 +608,7 @@ wxString& wxString::operator=(const wchar_t *pwz)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// add something to this string // 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); STATISTICS_ADD(SummandLength, nSrcLen);

View File

@@ -939,7 +939,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
{ {
wxString eachFilename(dirs[i]); wxString eachFilename(dirs[i]);
path = dirName; path = dirName;
if (path.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH); path += wxString(wxFILE_SEP_PATH);
path += eachFilename; path += eachFilename;
@@ -966,7 +966,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
{ {
wxString eachFilename(filenames[i]); wxString eachFilename(filenames[i]);
path = dirName; path = dirName;
if (path.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH); path += wxString(wxFILE_SEP_PATH);
path += eachFilename; path += eachFilename;
//path = dirName + wxString(wxT("/")) + eachFilename; //path = dirName + wxString(wxT("/")) + eachFilename;
@@ -1010,7 +1010,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
if (data && !data->m_path.IsEmpty()) if (data && !data->m_path.IsEmpty())
{ {
wxString childPath(data->m_path); wxString childPath(data->m_path);
if (childPath.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(childPath))
childPath += wxString(wxFILE_SEP_PATH); childPath += wxString(wxFILE_SEP_PATH);
// In MSW and PM, case is not significant // In MSW and PM, case is not significant

View File

@@ -273,7 +273,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
wxString new_name( _("NewName") ); wxString new_name( _("NewName") );
wxString path( data->m_path ); wxString path( data->m_path );
if (path.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(path))
path += wxFILE_SEP_PATH; path += wxFILE_SEP_PATH;
path += new_name; path += new_name;
if (wxFileExists(path)) if (wxFileExists(path))
@@ -287,7 +287,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
new_name += num; new_name += num;
path = data->m_path; path = data->m_path;
if (path.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(path))
path += wxFILE_SEP_PATH; path += wxFILE_SEP_PATH;
path += new_name; path += new_name;
i++; i++;

View File

@@ -856,7 +856,7 @@ void wxFileCtrl::GoToParentDir()
if (!IsTopMostDir(m_dirName)) if (!IsTopMostDir(m_dirName))
{ {
size_t len = m_dirName.Len(); size_t len = m_dirName.Len();
if (m_dirName[len-1] == wxFILE_SEP_PATH) if (wxEndsWithPathSeparator(m_dirName))
m_dirName.Remove( len-1, 1 ); m_dirName.Remove( len-1, 1 );
wxString fname( wxFileNameFromPath(m_dirName) ); wxString fname( wxFileNameFromPath(m_dirName) );
m_dirName = wxPathOnly( m_dirName ); m_dirName = wxPathOnly( m_dirName );
@@ -1038,7 +1038,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
} }
size_t len = m_dir.Len(); 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_dir.Remove( len-1, 1 );
m_path = m_dir; m_path = m_dir;

View File

@@ -560,13 +560,14 @@ void wxApp::CleanUp()
#endif #endif
delete wxWinHandleHash; 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; delete wxPendingEvents;
wxPendingEvents = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later.
#if wxUSE_THREADS #if wxUSE_THREADS
delete wxPendingEventsLocker; 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 we don't do the following, we get an apparent memory leak
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();

View File

@@ -578,7 +578,7 @@ wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin
{ {
// Is it a relative path? // Is it a relative path?
wxString currentDir(cwd); wxString currentDir(cwd);
if (currentDir.Last() != wxFILE_SEP_PATH) if (!wxEndsWithPathSeparator(currentDir))
currentDir += wxFILE_SEP_PATH; currentDir += wxFILE_SEP_PATH;
str = currentDir + argv0; str = currentDir + argv0;