removed wxApp::DoInit(); added wxApp::CreateMessageOutput(); fixed wxMsgOutput memory leak
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -91,7 +91,7 @@ All (GUI):
|
||||
- wxGridCellAttrProvider class API changed, you will need to update your code
|
||||
if you derived any classes from it
|
||||
|
||||
- wxImage::ComputeHistogram()'s signature changed to
|
||||
- wxImage::ComputeHistogram()'s signature changed to
|
||||
unsigned long ComputeHistogram(wxImageHistogram&) const
|
||||
|
||||
- wxEvtHandler cannot be copied/assigned any longer - this never worked but
|
||||
@@ -120,8 +120,11 @@ wxMSW:
|
||||
where <toolkit> is of the form (msw|univ)[dll][u][d]. You'll need to update
|
||||
the include path in your make/project files appropriately. Furthermore,
|
||||
xpm.lib is no longer used by wxMSW, it was superseded by the wxXPMDecoder
|
||||
class. You'll need to remove all references to xpm.lib from your
|
||||
make/project files.
|
||||
class. You'll need to remove all references to xpm.lib from your
|
||||
make/project files. Finally, the library names have changed as well and now
|
||||
use the following consistent naming convention: wxmsw[u][d][ver].(lib|dll)
|
||||
where 'u' appears for Unicode version, 'd' -- for the debug one and version
|
||||
is only present for the DLLs builds.
|
||||
|
||||
- child frames appear in the taskbar by default now, use wxFRAME_NO_TASKBAR
|
||||
style to avoid it
|
||||
@@ -226,12 +229,12 @@ All (GUI):
|
||||
- Added wxMouseCaptureChangedEvent
|
||||
- Added custom character filtering to wxTextValidator
|
||||
- wxTreeCtrl now supports incremental keyboard search
|
||||
- wxMessageOutput class added
|
||||
- wxHelpProvider::RemoveHelp added and called from ~wxWindowBase
|
||||
so that erroneous help strings are no longer found as the hash
|
||||
table fills up
|
||||
- updated libpng from 1.0.3 to 1.2.4
|
||||
- Added wxView::OnClosingDocument so the application can do
|
||||
cleanup.
|
||||
- Added wxView::OnClosingDocument so the application can do cleanup.
|
||||
- generic wxListCtrl renamed to wxGenericListCtrl, wxImageList
|
||||
renamed to wxGenericImageList, so they can be used on wxMSW
|
||||
(Rene Rivera).
|
||||
@@ -280,7 +283,7 @@ wxGTK:
|
||||
- wxButton now honours wxBU_EXACTFIT
|
||||
- wxStaticBox now honours wxALIGN_XXX styles
|
||||
- added support for non alphanumeric simple character accelerators ('-', '=')
|
||||
- new behaviour for wxWindow::Refresh() as it now produces a delayed refresh.
|
||||
- new behaviour for wxWindow::Refresh() as it now produces a delayed refresh.
|
||||
Call the new wxWindow::Update() to force an immediate update
|
||||
- support for more SGI hardware (12-bit mode among others)
|
||||
- fixed wxDC::Blit() to honour source DC's logical coordinates
|
||||
|
@@ -43,16 +43,15 @@ class WXDLLEXPORT wxCmdLineParser;
|
||||
#include "wx/window.h" // for wxTopLevelWindows
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
#if wxUSE_LOG
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
#include "wx/icon.h"
|
||||
#endif
|
||||
|
||||
#include "wx/build.h"
|
||||
|
||||
class WXDLLEXPORT wxLog;
|
||||
class WXDLLEXPORT wxMessageOutput;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -72,9 +71,9 @@ class WXDLLEXPORT wxDisplayModeInfo
|
||||
{
|
||||
public:
|
||||
wxDisplayModeInfo() : m_ok(FALSE) {}
|
||||
wxDisplayModeInfo(unsigned width, unsigned height, unsigned depth)
|
||||
wxDisplayModeInfo(unsigned width, unsigned height, unsigned depth)
|
||||
: m_width(width), m_height(height), m_depth(depth), m_ok(TRUE) {}
|
||||
|
||||
|
||||
unsigned GetWidth() const { return m_width; }
|
||||
unsigned GetHeight() const { return m_height; }
|
||||
unsigned GetDepth() const { return m_depth; }
|
||||
@@ -93,7 +92,7 @@ private:
|
||||
class WXDLLEXPORT wxAppBase : public wxEvtHandler
|
||||
{
|
||||
DECLARE_NO_COPY_CLASS(wxAppBase)
|
||||
|
||||
|
||||
public:
|
||||
wxAppBase();
|
||||
virtual ~wxAppBase();
|
||||
@@ -108,10 +107,6 @@ public:
|
||||
// Override: always in GUI application, rarely in console ones.
|
||||
virtual bool OnInit();
|
||||
|
||||
// initializes wxMessageOutput; other responsibilities
|
||||
// may be added later
|
||||
virtual void DoInit();
|
||||
|
||||
#if wxUSE_GUI
|
||||
// a platform-dependent version of OnInit(): the code here is likely to
|
||||
// depend on the toolkit. default version does nothing.
|
||||
@@ -282,22 +277,21 @@ public:
|
||||
// user-defined class (default implementation creates a wxLogGui
|
||||
// object) - this log object is used by default by all wxLogXXX()
|
||||
// functions.
|
||||
virtual wxLog *CreateLogTarget()
|
||||
#if wxUSE_GUI && wxUSE_LOGGUI && !defined(__WXMICROWIN__)
|
||||
{ return new wxLogGui; }
|
||||
#else // !GUI
|
||||
{ return new wxLogStderr; }
|
||||
#endif // wxUSE_GUI
|
||||
virtual wxLog *CreateLogTarget();
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// similar to CreateLogTarget() but for the global wxMessageOutput
|
||||
// object
|
||||
virtual wxMessageOutput *CreateMessageOutput();
|
||||
|
||||
#if wxUSE_GUI
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
// get the standard icon used by wxWin dialogs - this allows the user
|
||||
// to customize the standard dialogs. The 'which' parameter is one of
|
||||
// wxICON_XXX values
|
||||
virtual wxIcon GetStdIcon(int WXUNUSED(which)) const { return wxNullIcon; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get display mode that is used use. This is only used in framebuffer wxWin ports
|
||||
// (such as wxMGL).
|
||||
@@ -389,7 +383,7 @@ protected:
|
||||
wxString m_vendorName, // vendor name (ACME Inc)
|
||||
m_appName, // app name
|
||||
m_className; // class name
|
||||
|
||||
|
||||
#if wxUSE_GUI
|
||||
// the main top level window - may be NULL
|
||||
wxWindow *m_topWindow;
|
||||
|
@@ -32,6 +32,9 @@
|
||||
#include "wx/app.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/list.h"
|
||||
#if wxUSE_LOG
|
||||
#include "wx/log.h"
|
||||
#endif // wxUSE_LOG
|
||||
#if wxUSE_GUI
|
||||
#include "wx/msgdlg.h"
|
||||
#endif // wxUSE_GUI
|
||||
@@ -153,9 +156,49 @@ int wxAppBase::OnExit()
|
||||
delete wxTheme::Set(NULL);
|
||||
#endif // __WXUNIVERSAL__
|
||||
|
||||
// use Set(NULL) and not Get() to avoid creating a message output object on
|
||||
// demand when we just want to delete it
|
||||
delete wxMessageOutput::Set(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// customization hooks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LOG
|
||||
|
||||
wxLog *wxAppBase::CreateLogTarget()
|
||||
{
|
||||
#if wxUSE_GUI && wxUSE_LOGGUI && !defined(__WXMICROWIN__)
|
||||
return new wxLogGui;
|
||||
#else // !GUI
|
||||
return new wxLogStderr;
|
||||
#endif // wxUSE_GUI
|
||||
}
|
||||
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
wxMessageOutput *wxAppBase::CreateMessageOutput()
|
||||
{
|
||||
// The standard way of printing help on command line arguments (app --help)
|
||||
// is (according to common practice):
|
||||
// - console apps: to stderr (on any platform)
|
||||
// - GUI apps: stderr on Unix platforms (!)
|
||||
// message box under Windows and others
|
||||
#if wxUSE_GUI && !defined(__UNIX__)
|
||||
// wxMessageOutputMessageBox doesn't work under Motif
|
||||
#ifdef __WXMOTIF__
|
||||
return new wxMessageOutputLog;
|
||||
#else
|
||||
return new wxMessageOutputMessageBox;
|
||||
#endif
|
||||
#else // !wxUSE_GUI || __UNIX__
|
||||
return new wxMessageOutputStderr;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxAppBase
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -217,34 +260,12 @@ int wxAppBase::FilterEvent(wxEvent& WXUNUSED(event))
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxAppBase::DoInit()
|
||||
{
|
||||
if (wxMessageOutput::Get())
|
||||
return;
|
||||
|
||||
// NB: The standard way of printing help on command line arguments (app --help)
|
||||
// is (according to common practice):
|
||||
// - console apps: to stderr (on any platform)
|
||||
// - GUI apps: stderr on Unix platforms (!)
|
||||
// message box under Windows and others
|
||||
#if wxUSE_GUI && !defined(__UNIX__)
|
||||
#ifdef __WXMOTIF__
|
||||
wxMessageOutput::Set(new wxMessageOutputLog);
|
||||
#else
|
||||
wxMessageOutput::Set(new wxMessageOutputMessageBox);
|
||||
#endif
|
||||
#else
|
||||
wxMessageOutput::Set(new wxMessageOutputStderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// cmd line parsing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxAppBase::OnInit()
|
||||
{
|
||||
DoInit();
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
wxCmdLineParser parser(argc, argv);
|
||||
|
||||
|
@@ -50,16 +50,11 @@ wxMessageOutput* wxMessageOutput::ms_msgOut = 0;
|
||||
|
||||
wxMessageOutput* wxMessageOutput::Get()
|
||||
{
|
||||
// FIXME this is an hack
|
||||
static bool inGet = FALSE;
|
||||
|
||||
if(!ms_msgOut && wxTheApp && !inGet)
|
||||
if ( !ms_msgOut && wxTheApp )
|
||||
{
|
||||
inGet = TRUE;
|
||||
wxTheApp->DoInit();
|
||||
ms_msgOut = wxTheApp->CreateMessageOutput();
|
||||
}
|
||||
|
||||
inGet = FALSE;
|
||||
return ms_msgOut;
|
||||
}
|
||||
|
||||
@@ -115,15 +110,15 @@ void wxMessageOutputMessageBox::Printf(const wxChar* format, ...)
|
||||
|
||||
void wxMessageOutputLog::Printf(const wxChar* format, ...)
|
||||
{
|
||||
wxString out;
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
wxString out;
|
||||
|
||||
out.PrintfV(format, args);
|
||||
va_end(args);
|
||||
|
||||
out.Replace(wxT("\t"),wxT(" "));
|
||||
// under Motif, wxMessageDialog needs a parent window, so we use
|
||||
// wxLog, which is better than nothing
|
||||
|
||||
::wxLogMessage(wxT("%s"), out.c_str());
|
||||
}
|
||||
|
Reference in New Issue
Block a user