replace more __WXDEBUG__ occurrences with wxDEBUG_LEVEL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-03-22 12:53:48 +00:00
parent b16f24dd05
commit 4b6a582bef
68 changed files with 243 additions and 487 deletions

View File

@ -14,7 +14,8 @@
// used like this:
// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
// to turn on memory leak checks for programs compiled with Microsoft Visual
// C++ (5.0+). The macro will expand to nothing under other compilers.
// C++ (5.0+). The macro will not be defined under other compilers or if it
// can't be used with MSVC for whatever reason.
#ifndef _MSW_MSVCRT_H_
#define _MSW_MSVCRT_H_
@ -22,7 +23,7 @@
// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
// builds
#undef wxUSE_VC_CRTDBG
#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
&& !defined(UNDER_CE)
// it doesn't combine well with wxWin own memory debugging methods
#if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
@ -31,11 +32,6 @@
#endif
#ifdef wxUSE_VC_CRTDBG
// VC++ uses this macro as debug/release mode indicator
#ifndef _DEBUG
#define _DEBUG
#endif
// Need to undef new if including crtdbg.h which may redefine new itself
#ifdef new
#undef new

View File

@ -76,12 +76,8 @@ protected:
unsigned wxDisplayFactoryMacOSX::GetCount()
{
CGDisplayCount count;
#ifdef __WXDEBUG__
CGDisplayErr err =
#endif
CGGetActiveDisplayList(0, NULL, &count);
wxASSERT(err == CGDisplayNoErr);
CGDisplayErr err = CGGetActiveDisplayList(0, NULL, &count);
wxCHECK_MSG( err != CGDisplayNoErr, 0, "CGGetActiveDisplayList() failed" );
return count;
}
@ -126,12 +122,9 @@ wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n)
CGDisplayCount theCount = GetCount();
CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount];
#ifdef __WXDEBUG__
CGDisplayErr err =
#endif
CGGetActiveDisplayList(theCount, theIDs, &theCount);
CGDisplayErr err = CGGetActiveDisplayList(theCount, theIDs, &theCount);
wxCHECK_MSG( err != CGDisplayNoErr, NULL, "CGGetActiveDisplayList() failed" );
wxASSERT( err == CGDisplayNoErr );
wxASSERT( n < theCount );
wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(n, theIDs[n]);

View File

@ -74,7 +74,6 @@ struct wxCmdLineOption
int fl)
{
// wxCMD_LINE_USAGE_TEXT uses only description, shortName and longName is empty
#ifdef __WXDEBUG__
if ( k != wxCMD_LINE_USAGE_TEXT )
{
wxASSERT_MSG
@ -95,8 +94,6 @@ struct wxCmdLineOption
wxT("Long option contains invalid characters")
);
}
#endif // __WXDEBUG__
kind = k;
@ -450,7 +447,7 @@ void wxCmdLineParser::AddParam(const wxString& desc,
{
// do some consistency checks: a required parameter can't follow an
// optional one and nothing should follow a parameter with MULTIPLE flag
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
if ( !m_data->m_paramDesc.IsEmpty() )
{
wxCmdLineParam& param = m_data->m_paramDesc.Last();
@ -464,7 +461,7 @@ void wxCmdLineParser::AddParam(const wxString& desc,
_T("a required parameter can't follow an optional one") );
}
}
#endif // Debug
#endif // wxDEBUG_LEVEL
wxCmdLineParam *param = new wxCmdLineParam(desc, type, flags);

View File

@ -308,14 +308,15 @@ static const long MILLISECONDS_PER_DAY = 86400000l;
// (i.e. JDN(Jan 1, 1970) = 2440587.5)
static const long EPOCH_JDN = 2440587l;
// used only in asserts
#ifdef __WXDEBUG__
// these values are only used in asserts so don't define them if asserts are
// disabled to avoid warnings about unused static variables
#if wxDEBUG_LEVEL
// the date of JDN -0.5 (as we don't work with fractional parts, this is the
// reference date for us) is Nov 24, 4714BC
static const int JDN_0_YEAR = -4713;
static const int JDN_0_MONTH = wxDateTime::Nov;
static const int JDN_0_DAY = 24;
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
// the constants used for JDN calculations
static const long JDN_OFFSET = 32046l;
@ -350,8 +351,8 @@ wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown;
// private functions
// ----------------------------------------------------------------------------
// debugger helper: shows what the date really is
#ifdef __WXDEBUG__
// debugger helper: this function can be called from a debugger to show what
// the date really is
extern const char *wxDumpDate(const wxDateTime* dt)
{
static char buf[128];
@ -363,7 +364,6 @@ extern const char *wxDumpDate(const wxDateTime* dt)
return buf;
}
#endif // Debug
// get the number of days in the given month of the given year
static inline

View File

@ -472,9 +472,8 @@ void wxFileName::Assign(const wxString& fullpathOrig,
wxString volume, path, name, ext;
bool hasExt;
// do some consistency checks in debug mode: the name should be really just
// the filename and the path should be really just a path
#ifdef __WXDEBUG__
// do some consistency checks: the name should be really just the filename
// and the path should be really just a path
wxString volDummy, pathDummy, nameDummy, extDummy;
SplitPath(fullname, &volDummy, &pathDummy, &name, &ext, &hasExt, format);
@ -487,12 +486,6 @@ void wxFileName::Assign(const wxString& fullpathOrig,
wxASSERT_MSG( nameDummy.empty() && extDummy.empty(),
_T("the path shouldn't contain file name nor extension") );
#else // !__WXDEBUG__
SplitPath(fullname, NULL /* no volume */, NULL /* no path */,
&name, &ext, &hasExt, format);
SplitPath(fullpath, &volume, &path, NULL, NULL, format);
#endif // __WXDEBUG__/!__WXDEBUG__
Assign(volume, path, name, ext, hasExt, format);
}

View File

@ -45,6 +45,32 @@
#include "wx/tokenzr.h"
// debugger helper: this function can be called from a debugger to show what
// the date really is
extern const char *wxDumpFont(const wxFont *font)
{
static char buf[256];
const wxFontWeight weight = font->GetWeight();
wxString s;
s.Printf(wxS("%s-%s-%s-%d-%d"),
font->GetFaceName(),
weight == wxFONTWEIGHT_NORMAL
? _T("normal")
: weight == wxFONTWEIGHT_BOLD
? _T("bold")
: _T("light"),
font->GetStyle() == wxFONTSTYLE_NORMAL
? _T("regular")
: _T("italic"),
font->GetPointSize(),
font->GetEncoding());
wxStrlcpy(buf, s, WXSIZEOF(buf));
return buf;
}
// ============================================================================
// implementation
// ============================================================================

View File

@ -245,7 +245,6 @@ char wxFTP::SendCommand(const wxString& command)
return 0;
}
#ifdef __WXDEBUG__
// don't show the passwords in the logs (even in debug ones)
wxString cmd, password;
if ( command.Upper().StartsWith(_T("PASS "), &password) )
@ -258,7 +257,6 @@ char wxFTP::SendCommand(const wxString& command)
}
LogRequest(cmd);
#endif // __WXDEBUG__
m_lastError = wxPROTO_NOERR;
return GetResult();

View File

@ -37,20 +37,22 @@
#include "wx/scopedptr.h"
#include "wx/except.h"
#if defined(__WXMSW__) && defined(__WXDEBUG__)
#if defined(__WXMSW__)
#include "wx/msw/msvcrt.h"
static struct EnableMemLeakChecking
{
EnableMemLeakChecking()
#ifdef wxCrtSetDbgFlag
static struct EnableMemLeakChecking
{
// do check for memory leaks on program exit (another useful flag
// is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free deallocated
// memory which may be used to simulate low-memory condition)
wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
}
} gs_enableLeakChecks;
#endif // __WXMSW__ && __WXDEBUG__
EnableMemLeakChecking()
{
// check for memory leaks on program exit (another useful flag
// is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free deallocated
// memory which may be used to simulate low-memory condition)
wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
}
} gs_enableLeakChecks;
#endif // wxCrtSetDbgFlag
#endif // __WXMSW__
// ----------------------------------------------------------------------------
// private classes

View File

@ -105,34 +105,6 @@ static const size_t LEN_FULL = LEN_LANG + 1 + LEN_SUBLANG; // 1 for '_'
// global functions
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
// small class to suppress the translation erros until exit from current scope
class NoTransErr
{
public:
NoTransErr() { ms_suppressCount++; }
~NoTransErr() { ms_suppressCount--; }
static bool Suppress() { return ms_suppressCount > 0; }
private:
static size_t ms_suppressCount;
};
size_t NoTransErr::ms_suppressCount = 0;
#else // !Debug
class NoTransErr
{
public:
NoTransErr() { }
~NoTransErr() { }
};
#endif // Debug/!Debug
static wxLocale *wxSetLocale(wxLocale *pLocale);
namespace
@ -1210,16 +1182,8 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName,
<< GetFullSearchPath(ExtractLang(szDirPrefix));
}
// don't give translation errors here because the wxstd catalog might
// not yet be loaded (and it's normal)
//
// (we're using an object because we have several return paths)
NoTransErr noTransErr;
wxLogVerbose(_("looking for catalog '%s' in path '%s'."),
szName, searchPath.c_str());
wxLogTrace(TRACE_I18N, wxS("Looking for \"%s.mo\" in \"%s\""),
szName, searchPath.c_str());
wxLogTrace(TRACE_I18N, wxS("Looking for \"%s.mo\" in search path \"%s\""),
szName, searchPath);
wxFileName fn(szName);
fn.SetExt(wxS("mo"));
@ -2442,18 +2406,11 @@ const wxString& wxLocale::GetString(const wxString& origString,
if ( trans == NULL )
{
#ifdef __WXDEBUG__
if ( !NoTransErr::Suppress() )
{
NoTransErr noTransErr;
wxLogTrace(TRACE_I18N,
wxS("string \"%s\"[%ld] not found in %slocale '%s'."),
origString, (long)n,
wxString::Format(wxS("domain '%s' "), domain).c_str(),
m_strLocale.c_str());
}
#endif // __WXDEBUG__
wxLogTrace(TRACE_I18N,
wxS("string \"%s\"[%ld] not found in %slocale '%s'."),
origString, (long)n,
wxString::Format(wxS("domain '%s' "), domain).c_str(),
m_strLocale.c_str());
if (n == size_t(-1))
return GetUntranslatedString(origString);

View File

@ -16,7 +16,7 @@
#pragma hdrstop
#endif
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT
#include "wx/memory.h"
@ -46,7 +46,7 @@
#include <stdarg.h>
#include <string.h>
#if wxUSE_THREADS && defined(__WXDEBUG__)
#if wxUSE_THREADS
#define USE_THREADSAFE_MEMORY_ALLOCATION 1
#else
#define USE_THREADSAFE_MEMORY_ALLOCATION 0
@ -575,18 +575,13 @@ void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from)
*/
bool wxDebugContext::PrintList (void)
{
#ifdef __WXDEBUG__
TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : NULL));
return true;
#else
return false;
#endif
}
bool wxDebugContext::Dump(void)
{
#ifdef __WXDEBUG__
{
const wxChar* appName = wxT("application");
wxString appNameStr;
@ -608,12 +603,8 @@ bool wxDebugContext::Dump(void)
OutputDumpLine(wxEmptyString);
return true;
#else
return false;
#endif
}
#ifdef __WXDEBUG__
struct wxDebugStatsStruct
{
long instanceCount;
@ -638,11 +629,9 @@ static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugSt
st->next = head;
return st;
}
#endif
bool wxDebugContext::PrintStatistics(bool detailed)
{
#ifdef __WXDEBUG__
{
const wxChar* appName = wxT("application");
wxString appNameStr;
@ -729,10 +718,6 @@ bool wxDebugContext::PrintStatistics(bool detailed)
OutputDumpLine(wxEmptyString);
return true;
#else
(void)detailed;
return false;
#endif
}
bool wxDebugContext::PrintClasses(void)
@ -902,7 +887,6 @@ static MemoryCriticalSection memLocker;
#endif // USE_THREADSAFE_MEMORY_ALLOCATION
#ifdef __WXDEBUG__
#if !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)))
#if wxUSE_GLOBAL_MEMORY_OPERATORS
void * operator new (size_t size, wxChar * fileName, int lineNum)
@ -1049,8 +1033,6 @@ void wxDebugFree(void * buf, bool WXUNUSED(isVect) )
free((char *)st);
}
#endif // __WXDEBUG__
// Trace: send output to the current debugging stream
void wxTrace(const wxChar * ...)
{
@ -1167,4 +1149,4 @@ void wxDebugContextDumpDelayCounter::DoDump()
// least one cleanup counter object
static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_One;
#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
#endif // wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT

View File

@ -26,14 +26,14 @@
#include <string.h>
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
#if wxUSE_DEBUG_CONTEXT
#if defined(__VISAGECPP__)
#define DEBUG_PRINTF(NAME) { static int raz=0; \
printf( #NAME " %i\n",raz); fflush(stdout); raz++; }
#else
#define DEBUG_PRINTF(NAME)
#endif
#endif // __WXDEBUG__ || wxUSE_DEBUG_CONTEXT
#endif // wxUSE_DEBUG_CONTEXT
// we must disable optimizations for VC.NET because otherwise its too eager
// linker discards wxClassInfo objects in release build thus breaking many,
@ -103,7 +103,7 @@ bool wxObject::IsKindOf(const wxClassInfo *info) const
return (thisInfo) ? thisInfo->IsKindOf(info) : false ;
}
#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING && defined( new )
#if wxUSE_MEMORY_TRACING && defined( new )
#undef new
#endif
@ -225,11 +225,11 @@ void wxClassInfo::Register()
sm_classTable = classTable;
}
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
// reentrance guard - see note above
static int entry = 0;
wxASSERT_MSG(++entry == 1, _T("wxClassInfo::Register() reentrance"));
#endif
#endif // wxDEBUG_LEVEL
// Using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you
// link any object module twice mistakenly, or link twice against wx shared
@ -246,9 +246,9 @@ void wxClassInfo::Register()
sm_classTable->Put(m_className, (wxObject *)this);
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
--entry;
#endif
#endif // wxDEBUG_LEVEL
}
void wxClassInfo::Unregister()
@ -266,7 +266,7 @@ void wxClassInfo::Unregister()
wxObject *wxCreateDynamicObject(const wxString& name)
{
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
#if wxUSE_DEBUG_CONTEXT
DEBUG_PRINTF(wxObject *wxCreateDynamicObject)
#endif
@ -338,7 +338,7 @@ void wxObjectRefData::DecRef()
void wxObject::Ref(const wxObject& clone)
{
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
#if wxUSE_DEBUG_CONTEXT
DEBUG_PRINTF(wxObject::Ref)
#endif

View File

@ -1813,7 +1813,7 @@ DoAdjustForGrowables(int delta,
void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz)
{
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
// by the time this function is called, the sizer should be already fully
// initialized and hence the number of its columns and rows is known and we
// can check that all indices in m_growableCols/Rows are valid (see also
@ -1841,7 +1841,7 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz)
}
}
}
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
if ( (m_flexDirection & wxHORIZONTAL) || (m_growMode != wxFLEX_GROWMODE_NONE) )

View File

@ -105,7 +105,7 @@ static wxStrCacheInitializer gs_stringCacheInit;
// gdb seems to be unable to display thread-local variables correctly, at least
// not my 6.4.98 version under amd64, so provide this debugging helper to do it
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
struct wxStrCacheDumper
{
@ -130,7 +130,7 @@ struct wxStrCacheDumper
void wxDumpStrCache() { wxStrCacheDumper::ShowAll(); }
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
#ifdef wxPROFILE_STRING_CACHE

View File

@ -272,7 +272,7 @@ wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
// mask to extract lead byte's value ('x' bits above), by sequence's length:
static const unsigned char s_leadValueMask[4] = { 0x7F, 0x1F, 0x0F, 0x07 };
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
// mask and value of lead byte's most significant bits, by length:
static const unsigned char s_leadMarkerMask[4] = { 0x80, 0xE0, 0xF0, 0xF8 };
static const unsigned char s_leadMarkerVal[4] = { 0x00, 0xC0, 0xE0, 0xF0 };

View File

@ -76,7 +76,7 @@ void wxTextValidator::SetStyle(long style)
{
m_validatorStyle = style;
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
int check;
check = (int)HasFlag(wxFILTER_ALPHA) + (int)HasFlag(wxFILTER_ALPHANUMERIC) +
(int)HasFlag(wxFILTER_DIGITS) + (int)HasFlag(wxFILTER_NUMERIC);
@ -93,7 +93,7 @@ void wxTextValidator::SetStyle(long style)
(int)HasFlag(wxFILTER_EXCLUDE_LIST) + (int)HasFlag(wxFILTER_EXCLUDE_CHAR_LIST);
wxASSERT_MSG(check <= 1,
"Using both an include/exclude list may lead to unexpected results");
#endif
#endif // wxDEBUG_LEVEL
}
bool wxTextValidator::Copy(const wxTextValidator& val)

View File

@ -1152,19 +1152,22 @@ void wxWindowBase::PushEventHandler(wxEvtHandler *handlerToPush)
SetEventHandler(handlerToPush);
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
// final checks of the operations done above:
wxASSERT_MSG( handlerToPush->GetPreviousHandler() == NULL,
"the first handler of the wxWindow stack should have no previous handlers set" );
"the first handler of the wxWindow stack should "
"have no previous handlers set" );
wxASSERT_MSG( handlerToPush->GetNextHandler() != NULL,
"the first handler of the wxWindow stack should have non-NULL next handler" );
"the first handler of the wxWindow stack should "
"have non-NULL next handler" );
wxEvtHandler* pLast = handlerToPush;
while (pLast && pLast != this)
while ( pLast && pLast != this )
pLast = pLast->GetNextHandler();
wxASSERT_MSG( pLast->GetNextHandler() == NULL,
"the last handler of the wxWindow stack should have this window as next handler" );
#endif
"the last handler of the wxWindow stack should "
"have this window as next handler" );
#endif // wxDEBUG_LEVEL
}
wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)

View File

@ -125,7 +125,7 @@ static inline wxUint16 CrackUint16(const char *m)
//
static wxFileOffset QuietSeek(wxInputStream& stream, wxFileOffset pos)
{
#if defined(__WXDEBUG__) && wxUSE_LOG
#if wxUSE_LOG
wxLogLevel level = wxLog::GetLogLevel();
wxLog::SetLogLevel(wxLOG_Debug - 1);
wxFileOffset result = stream.SeekI(pos);

View File

@ -301,16 +301,12 @@ void wxNonOwnedWindow::HandleQueuedPaintRequests()
// blit the entire back buffer to front soon
m_isPainting = true;
#ifdef __WXDEBUG__
int requestsCount = 0;
#endif
wxRect request;
while ( m_toPaint->GetNext(request) )
{
#ifdef __WXDEBUG__
requestsCount++;
#endif
wxRect clipped(request);
clipped.Intersect(winRect);
if ( clipped.IsEmpty() )

View File

@ -214,11 +214,6 @@ wxSize wxWizardSizer::CalcMin()
wxSize wxWizardSizer::GetMaxChildSize()
{
#if !defined(__WXDEBUG__)
if ( m_childSize.IsFullySpecified() )
return m_childSize;
#endif
wxSize maxOfMin;
for ( wxSizerItemList::compatibility_iterator childNode = m_children.GetFirst();
@ -230,21 +225,6 @@ wxSize wxWizardSizer::GetMaxChildSize()
maxOfMin.IncTo(SiblingSize(child));
}
// No longer applicable since we may change sizes when size adaptation is done
#if 0
#ifdef __WXDEBUG__
if ( m_childSize.IsFullySpecified() && m_childSize != maxOfMin )
{
wxFAIL_MSG( _T("Size changed in wxWizard::GetPageAreaSizer()")
_T("after RunWizard().\n")
_T("Did you forget to call GetSizer()->Fit(this) ")
_T("for some page?")) ;
return m_childSize;
}
#endif // __WXDEBUG__
#endif
if ( m_owner->m_started )
{
m_childSize = maxOfMin;

View File

@ -144,14 +144,12 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
}
}
#ifdef __WXDEBUG__
// it's not really a format, of course, but we can reuse its GetId() method
// to format this atom as string
wxDataFormat clip(selection_data->selection);
wxLogTrace( TRACE_CLIPBOARD,
wxT("Received available formats for clipboard %s"),
clip.GetId().c_str() );
#endif // __WXDEBUG__
// the atoms we received, holding a list of targets (= formats)
const GdkAtom * const atoms = (GdkAtom *)selection_data->data;
@ -283,7 +281,6 @@ selection_handler( GtkWidget *WXUNUSED(widget),
wxDataFormat format( selection_data->target );
#ifdef __WXDEBUG__
wxLogTrace(TRACE_CLIPBOARD,
_T("clipboard data in format %s, GtkSelectionData is target=%s type=%s selection=%s timestamp=%u"),
format.GetId().c_str(),
@ -292,7 +289,6 @@ selection_handler( GtkWidget *WXUNUSED(widget),
wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->selection))).c_str(),
GPOINTER_TO_UINT( signal_data )
);
#endif // __WXDEBUG__
if ( !data->IsSupportedFormat( format ) )
return;
@ -387,14 +383,12 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget),
}
}
#ifdef __WXDEBUG__
// it's not really a format, of course, but we can reuse its GetId() method
// to format this atom as string
wxDataFormat clip(selection_data->selection);
wxLogTrace( TRACE_CLIPBOARD,
wxT("Received available formats for clipboard %s"),
clip.GetId().c_str() );
#endif // __WXDEBUG__
// the atoms we received, holding a list of targets (= formats)
const GdkAtom * const atoms = (GdkAtom *)selection_data->data;

View File

@ -26,12 +26,12 @@
#include "wx/gtk/private/timer.h"
#include "wx/evtloop.h"
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
#include "wx/gtk/assertdlg_gtk.h"
#if wxUSE_STACKWALKER
#include "wx/stackwalk.h"
#endif // wxUSE_STACKWALKER
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
#include <stdarg.h>
#include <string.h>
@ -328,9 +328,7 @@ void wxGUIAppTraits::SetLocale()
}
#endif
#ifdef __WXDEBUG__
#if wxUSE_STACKWALKER
#if wxDEBUG_LEVEL && wxUSE_STACKWALKER
// private helper class
class StackDump : public wxStackWalker
@ -379,13 +377,15 @@ extern "C"
}
}
#endif // wxUSE_STACKWALKER
#endif // wxDEBUG_LEVEL && wxUSE_STACKWALKER
bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
{
// under GTK2 we prefer to use a dialog widget written using directly GTK+;
// in fact we cannot use a dialog written using wxWidgets: it would need
// the wxWidgets idle processing to work correctly!
#if wxDEBUG_LEVEL
// under GTK2 we prefer to use a dialog widget written using directly in
// GTK+ as use a dialog written using wxWidgets would need the wxWidgets
// idle processing to work correctly which might not be the case when
// assert happens
GtkWidget *dialog = gtk_assert_dialog_new();
gtk_assert_dialog_set_message(GTK_ASSERT_DIALOG(dialog), msg.mb_str());
@ -426,10 +426,13 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
gtk_widget_destroy(dialog);
return returnCode;
#else // !wxDEBUG_LEVEL
// this function is never called in this case
wxUnusedVar(msg);
return false;
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
}
#endif // __WXDEBUG__
wxString wxGUIAppTraits::GetDesktopEnvironment() const
{
wxString de = wxSystemOptions::GetOption(_T("gtk.desktop"));

View File

@ -92,12 +92,10 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
g_free(atom_name);
}
#ifdef __WXDEBUG__
wxDataFormat clip( selection_data->selection );
wxLogTrace( TRACE_CLIPBOARD,
wxT("selection received for targets, clipboard %s"),
clip.GetId().c_str() );
#endif // __WXDEBUG__
// the atoms we received, holding a list of targets (= formats)
GdkAtom *atoms = (GdkAtom *)selection_data->data;
@ -266,7 +264,6 @@ selection_handler( GtkWidget *WXUNUSED(widget),
wxDataFormat format( selection_data->target );
#ifdef __WXDEBUG__
wxLogTrace(TRACE_CLIPBOARD,
_T("clipboard data in format %s, GtkSelectionData is target=%s type=%s selection=%s timestamp=%u"),
format.GetId().c_str(),
@ -275,7 +272,6 @@ selection_handler( GtkWidget *WXUNUSED(widget),
wxString::FromAscii(gdk_atom_name(selection_data->selection)).c_str(),
GPOINTER_TO_UINT( signal_data )
);
#endif
if (!data->IsSupportedFormat( format )) return;

View File

@ -97,26 +97,6 @@ public:
// and this one also modifies all the other font data fields
void SetNativeFontInfo(const wxNativeFontInfo& info);
// debugger helper: shows what the font really is
//
// VZ: I need this as my gdb either shows wildly wrong values or crashes
// when I ask it to "p fontRefData" :-(
#if defined(__WXDEBUG__)
void Dump() const
{
wxPrintf(_T("%s-%s-%s-%d-%d\n"),
m_faceName.c_str(),
m_weight == wxFONTWEIGHT_NORMAL
? _T("normal")
: m_weight == wxFONTWEIGHT_BOLD
? _T("bold")
: _T("light"),
m_style == wxFONTSTYLE_NORMAL ? _T("regular") : _T("italic"),
m_pointSize,
m_encoding);
}
#endif // Debug
protected:
// common part of all ctors
void Init(int pointSize,

View File

@ -430,15 +430,13 @@ int wxNotebook::DoSetSelection( size_t page, int flags )
m_selection = page;
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
#ifdef __WXDEBUG__
if ( !(flags & SetSelection_SendEvent) )
{
// gtk_notebook_set_current_page will emit the switch-page signal which will be
// caught by our gtk_notebook_page_change_callback which should have reset the
// flag to false:
wxASSERT(!m_skipNextPageChangeEvent);
}
#endif // __WXDEBUG__
// gtk_notebook_set_current_page is supposed to emit the switch-page signal
// which should be caught by our gtk_notebook_page_change_callback which
// should have reset the flag to false, check it:
wxASSERT_LEVEL_2(
(flags & SetSelection_SendEvent) || !m_skipNextPageChangeEvent,
"internal error in selection events generation"
);
wxNotebookPage *client = GetPage(page);
if ( client )

View File

@ -49,7 +49,7 @@
#include "wx/fontutil.h"
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
#include "wx/thread.h"
#endif
@ -236,16 +236,13 @@ extern bool g_mainThreadLocked;
// debug
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxUSE_THREADS
# define DEBUG_MAIN_THREAD if (wxThread::IsMain() && g_mainThreadLocked) printf("gui reentrance");
# define DEBUG_MAIN_THREAD \
wxASSERT_MSG( !g_mainThreadLocked || !wxThread::IsMain(), \
"GUI reentrancy detected" )
#else
# define DEBUG_MAIN_THREAD
#endif
#else
#define DEBUG_MAIN_THREAD
#endif // Debug
// the trace mask used for the focus debugging messages
#define TRACE_FOCUS _T("focus")

View File

@ -202,13 +202,12 @@ bool wxApp::OnInitGui()
if ( !wxAppBase::OnInitGui() )
return false;
#ifdef __WXDEBUG__
// MGL redirects stdout and stderr to physical console, so lets redirect
// it to file in debug build. Do it only when WXSTDERR environment variable is set
// it to file if WXSTDERR environment variable is set to be able to see
// wxLogDebug() output
wxString redirect;
if ( wxGetEnv(wxT("WXSTDERR"), &redirect) )
freopen(redirect.mb_str(), "wt", stderr);
#endif // __WXDEBUG__
wxLog *oldLog = wxLog::SetActiveTarget(new wxLogGui);
if ( oldLog ) delete oldLog;

View File

@ -1139,7 +1139,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
return;
}
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
// FIXME_MGL -- debugging stuff, to be removed!
static int debugPaintEvents = -1;
if ( debugPaintEvents == -1 )
@ -1150,7 +1150,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
dc->fillRect(-1000,-1000,2000,2000);
wxMilliSleep(50);
}
#endif
#endif // wxDEBUG_LEVEL >= 2
MGLRegion clip;
dc->getClipRegion(clip);

View File

@ -68,7 +68,6 @@ wxHashTable *wxWidgetHashTable = NULL;
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
#ifdef __WXDEBUG__
extern "C"
{
typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
@ -86,7 +85,6 @@ static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
}
}
#endif // __WXDEBUG__
bool wxApp::Initialize(int& argc_, wxChar **argv_)
{
@ -251,10 +249,8 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_)
}
m_initialDisplay = (WXDisplay*) dpy;
#ifdef __WXDEBUG__
// install the X error handler
gs_pfnXErrorHandler = XSetErrorHandler(wxXErrorHandler);
#endif // __WXDEBUG__
// Add general resize proc
XtActionsRec rec;

View File

@ -88,10 +88,9 @@ void wxFileSelOk(Widget WXUNUSED(fs), XtPointer WXUNUSED(client_data), XmFileSel
static wxString ParseWildCard( const wxString& wild )
{
#ifdef __WXDEBUG__
static const wxChar* msg =
_T("Motif file dialog does not understand this ")
_T("wildcard syntax");
#if wxDEBUG_LEVEL
static const char *msg =
"Motif file dialog does not understand this wildcard syntax";
#endif
wxArrayString wildDescriptions, wildFilters;

View File

@ -375,7 +375,6 @@ void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
}
}
#ifdef __WXDEBUG__
wxString wxGetXEventName(XEvent& event)
{
#if wxUSE_NANOX
@ -401,7 +400,6 @@ wxString wxGetXEventName(XEvent& event)
return str;
#endif
}
#endif
// ----------------------------------------------------------------------------
// accelerators

View File

@ -230,7 +230,7 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& dt)
wxDateTime wxCalendarCtrl::GetDate() const
{
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
SYSTEMTIME st;
if ( !MonthCal_GetCurSel(GetHwnd(), &st) )
{
@ -242,7 +242,7 @@ wxDateTime wxCalendarCtrl::GetDate() const
wxDateTime dt(st);
wxASSERT_MSG( dt == m_date, "mismatch between data and control" );
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
return m_date;
}

View File

@ -770,7 +770,7 @@ bool wxClipboard::GetData( wxDataObject& data )
// enumerate all explicit formats on the clipboard.
// note that this does not include implicit / synthetic (automatically
// converted) formats.
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
// get the format enumerator
IEnumFORMATETC *pEnumFormatEtc = NULL;
hr = pDataObject->EnumFormatEtc(DATADIR_GET, &pEnumFormatEtc);
@ -803,7 +803,7 @@ bool wxClipboard::GetData( wxDataObject& data )
pEnumFormatEtc->Release();
}
#endif // Debug
#endif // wxDEBUG_LEVEL >= 2
STGMEDIUM medium;
// stop at the first valid format found on the clipboard

View File

@ -143,13 +143,11 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
if ( !m_hWnd )
{
#ifdef __WXDEBUG__
wxLogLastError(wxString::Format
(
_T("CreateWindowEx(\"%s\", flags=%08lx, ex=%08lx)"),
classname, style, exstyle
));
#endif // __WXDEBUG__
return false;
}

View File

@ -205,7 +205,7 @@ void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
wxDateTime wxDatePickerCtrl::GetValue() const
{
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
wxDateTime dt;
SYSTEMTIME st;
if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
@ -216,7 +216,7 @@ wxDateTime wxDatePickerCtrl::GetValue() const
wxASSERT_MSG( m_date.IsValid() == dt.IsValid() &&
(!dt.IsValid() || dt == m_date),
_T("bug in wxDatePickerCtrl: m_date not in sync") );
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
return m_date;
}

View File

@ -457,12 +457,10 @@ void wxMSWDCImpl::SelectOldObjects(WXHDC dc)
if (m_oldBitmap)
{
::SelectObject((HDC) dc, (HBITMAP) m_oldBitmap);
#ifdef __WXDEBUG__
if (m_selectedBitmap.IsOk())
{
m_selectedBitmap.SetSelectedInto(NULL);
}
#endif
}
m_oldBitmap = 0;
if (m_oldPen)

View File

@ -223,7 +223,7 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
return;
}
#endif // __WXDEBUG__
#endif // wxHAS_PAINT_DEBUG
m_window = window;

View File

@ -106,9 +106,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
::SelectObject(GetHdc(), (HBITMAP) m_oldBitmap);
if ( m_selectedBitmap.Ok() )
{
#ifdef __WXDEBUG__
m_selectedBitmap.SetSelectedInto(NULL);
#endif
m_selectedBitmap = wxNullBitmap;
}
}
@ -123,9 +121,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
if ( !hBmp )
return;
#ifdef __WXDEBUG__
m_selectedBitmap.SetSelectedInto(GetOwner());
#endif
hBmp = (WXHBITMAP)::SelectObject(GetHdc(), (HBITMAP)hBmp);
if ( !hBmp )

View File

@ -1269,7 +1269,6 @@ static DWORD wxRasMonitorThread(wxRasThreadData *data)
// fall through
case WAIT_FAILED:
#ifdef __WXDEBUG__
// using wxLogLastError() from here is dangerous: we risk to
// deadlock the main thread if wxLog sends output to GUI
DWORD err = GetLastError();
@ -1280,7 +1279,6 @@ static DWORD wxRasMonitorThread(wxRasThreadData *data)
err,
wxSysErrorMsg(err)
);
#endif // __WXDEBUG__
// no sense in continuing, who knows if the handles we're
// waiting for even exist yet...

View File

@ -112,17 +112,12 @@ int wxFontDialog::ShowModal()
}
else
{
// common dialog failed - why?
#ifdef __WXDEBUG__
DWORD dwErr = CommDlgExtendedError();
if ( dwErr != 0 )
{
// this msg is only for developers
wxLogError(wxT("Common dialog failed with error code %0lx."),
dwErr);
wxLogError(_("Common dialog failed with error code %0lx."), dwErr);
}
//else: it was just cancelled
#endif
return wxID_CANCEL;
}

View File

@ -402,15 +402,15 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
wstyle |= LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
size_t nModes = 0;
#define MAP_MODE_STYLE(wx, ms) \
if ( style & (wx) ) { wstyle |= (ms); nModes++; }
#else // !__WXDEBUG__
#else // !wxDEBUG_LEVEL
#define MAP_MODE_STYLE(wx, ms) \
if ( style & (wx) ) wstyle |= (ms);
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
MAP_MODE_STYLE(wxLC_ICON, LVS_ICON)
MAP_MODE_STYLE(wxLC_SMALL_ICON, LVS_SMALLICON)

View File

@ -1424,11 +1424,9 @@ void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
(WPARAM)hmenuFrame,
(LPARAM)hmenuWindow) )
{
#ifdef __WXDEBUG__
DWORD err = ::GetLastError();
if ( err )
wxLogApiError(_T("SendMessage(WM_MDISETMENU)"), err);
#endif // __WXDEBUG__
}
}

View File

@ -1480,7 +1480,7 @@ public:
wxTimer* m_pTimer;
wxSize m_bestSize;
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
wxDynamicLibrary m_dllQuartz;
LPAMGETERRORTEXT m_lpAMGetErrorText;
wxString GetErrorString(HRESULT hrdsv);
@ -1942,7 +1942,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend)
//---------------------------------------------------------------------------
// Usual debugging macros
//---------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
#define MAX_ERROR_TEXT_LEN 160
// Get the error string for Active Movie
@ -2213,7 +2213,7 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
{
// First get the AMGetErrorText procedure in
// debug mode for more meaningful messages
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
if ( m_dllQuartz.Load(_T("quartz.dll"), wxDL_VERBATIM) )
{
m_lpAMGetErrorText = (LPAMGETERRORTEXT)
@ -2778,7 +2778,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend, wxMediaBackend)
// Usual debugging macros for MCI returns
//---------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
#define wxMCIVERIFY(arg) \
{ \
DWORD nRet; \

View File

@ -1478,11 +1478,12 @@ public:
#endif
wxSize m_bestSize; // Cached size
#ifdef __WXDEBUG__ // Stuff for getting useful debugging strings
// Stuff for getting useful debugging strings
#if wxDEBUG_LEVEL
wxDynamicLibrary m_dllQuartz;
LPAMGETERRORTEXT m_lpAMGetErrorText;
wxString GetErrorString(HRESULT hrdsv);
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
wxEvtHandler* m_evthandler;
friend class wxAMMediaEvtHandler;
@ -1527,7 +1528,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend)
//---------------------------------------------------------------------------
// Usual debugging macros
//---------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
#define MAX_ERROR_TEXT_LEN 160
// Get the error string for Active Movie
@ -1614,13 +1615,13 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
{
// First get the AMGetErrorText procedure in debug
// mode for more meaningful messages
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
if ( m_dllQuartz.Load(_T("quartz.dll"), wxDL_VERBATIM) )
{
m_lpAMGetErrorText = (LPAMGETERRORTEXT)
m_dllQuartz.GetSymbolAorW(wxT("AMGetErrorText"));
}
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL

View File

@ -904,13 +904,9 @@ wxActiveXContainer::~wxActiveXContainer()
}
// VZ: we might want to really report an error instead of just asserting here
#ifdef __WXDEBUG__
#define CHECK_HR(hr) \
wxASSERT_MSG( SUCCEEDED(hr), \
#define CHECK_HR(hr) \
wxASSERT_LEVEL_2_MSG( SUCCEEDED(hr), \
wxString::Format("HRESULT = %X", (unsigned)(hr)) )
#else
#define CHECK_HR(hr) wxUnusedVar(hr)
#endif
//---------------------------------------------------------------------------
// wxActiveXContainer::CreateActiveX

View File

@ -61,11 +61,11 @@
// functions
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
static const wxChar *GetTymedName(DWORD tymed);
#else // !Debug
#else // !wxDEBUG_LEVEL
#define GetTymedName(tymed) wxEmptyString
#endif // Debug/!Debug
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
// ----------------------------------------------------------------------------
// wxIEnumFORMATETC interface implementation
@ -719,7 +719,7 @@ void* wxDataObject::SetSizeInBuffer( void* buffer, size_t size,
return p;
}
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
const wxChar *wxDataObject::GetFormatName(wxDataFormat format)
{
@ -764,7 +764,7 @@ const wxChar *wxDataObject::GetFormatName(wxDataFormat format)
#endif // VC++
}
#endif // Debug
#endif // wxDEBUG_LEVEL
// ----------------------------------------------------------------------------
// wxBitmapDataObject supports CF_DIB format
@ -1264,7 +1264,7 @@ void wxURLDataObject::SetURL(const wxString& url)
// private functions
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
static const wxChar *GetTymedName(DWORD tymed)
{
@ -1305,12 +1305,10 @@ void wxDataObject::SetAutoDelete()
{
}
#ifdef __WXDEBUG__
const wxChar *wxDataObject::GetFormatName(wxDataFormat WXUNUSED(format))
{
return NULL;
}
#endif // __WXDEBUG__
#endif // wxUSE_DATAOBJ

View File

@ -130,7 +130,7 @@ wxBasicString::~wxBasicString()
// Debug support
// ----------------------------------------------------------------------------
#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ > 1000) ) || defined(__MWERKS__) )
#if wxDEBUG_LEVEL && ( ( defined(__VISUALC__) && (__VISUALC__ > 1000) ) || defined(__MWERKS__) )
static wxString GetIidName(REFIID riid)
{
// an association between symbolic name and numeric value of an IID
@ -258,31 +258,10 @@ void wxLogRelease(const wxChar *szInterface, ULONG cRef)
wxLogTrace(wxTRACE_OleCalls, wxT("After %s::Release: m_cRef = %d"), szInterface, cRef - 1);
}
#elif defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ <= 1000)
#endif // wxDEBUG_LEVEL
// For VC++ 4
void wxLogQueryInterface(const char *szInterface, REFIID riid)
{
wxLogTrace("%s::QueryInterface", szInterface);
}
#endif // wxUSE_DRAG_AND_DROP
void wxLogAddRef(const char *szInterface, ULONG cRef)
{
wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface, cRef + 1);
}
#endif // __CYGWIN10__
void wxLogRelease(const char *szInterface, ULONG cRef)
{
wxLogTrace("After %s::Release: m_cRef = %d", szInterface, cRef - 1);
}
#endif // __WXDEBUG__
#endif
// wxUSE_DRAG_AND_DROP
#endif
// __CYGWIN10__
#endif
// wxUSE_OLE
#endif // wxUSE_OLE

View File

@ -20,7 +20,7 @@
#pragma hdrstop
#endif
#if wxUSE_OLE && ( wxUSE_DRAG_AND_DROP || (defined(__WXDEBUG__) && wxUSE_DATAOBJ) )
#if wxUSE_OLE && (wxUSE_DRAG_AND_DROP || wxUSE_DATAOBJ)
#ifndef WX_PRECOMP
#include "wx/msw/wrapwin.h"

View File

@ -373,11 +373,9 @@ bool wxPenRefData::Alloc()
default:
lb.lbStyle = BS_SOLID;
#ifdef __WXDEBUG__
// this should be unnecessary (it's unused) but suppresses the
// Purify messages about uninitialized memory read
lb.lbHatch = 0;
#endif
break;
}

View File

@ -46,7 +46,6 @@
// wxWindowsPrintNativeData
//----------------------------------------------------------------------------
#ifdef __WXDEBUG__
static wxString wxGetPrintDlgError()
{
DWORD err = CommDlgExtendedError();
@ -79,7 +78,6 @@ static wxString wxGetPrintDlgError()
}
return msg;
}
#endif // __WXDEBUG__
static HGLOBAL
wxCreateDevNames(const wxString& driverName,
@ -366,11 +364,7 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
pd.hDevMode = NULL;
pd.hDevNames = NULL;
#ifdef __WXDEBUG__
wxString str(wxT("Printing error: "));
str += wxGetPrintDlgError();
wxLogDebug(str);
#endif // __WXDEBUG__
wxLogDebug(wxT("Printing error: ") + wxGetPrintDlgError());
}
else
{

View File

@ -250,8 +250,8 @@ wxString wxStandardPaths::GetAppDir()
{
wxFileName fn(wxGetFullModuleName());
// allow running the apps directly from build directory in debug builds
#ifdef __WXDEBUG__
// allow running the apps directly from build directory in MSVC debug builds
#ifdef _DEBUG
wxString lastdir;
if ( fn.GetDirCount() )
{
@ -260,7 +260,7 @@ wxString wxStandardPaths::GetAppDir()
if ( lastdir.Matches(_T("debug*")) || lastdir.Matches(_T("vc*msw*")) )
fn.RemoveLastDir();
}
#endif // __WXDEBUG__
#endif // _DEBUG
return fn.GetPath();
}

View File

@ -222,9 +222,9 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
const wxChar *wxGetMessageName(int message);
#endif //__WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
void wxRemoveHandleAssociation(wxWindowMSW *win);
extern void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win);
@ -638,13 +638,12 @@ void wxWindowMSW::SetFocus()
HWND hWnd = GetHwnd();
wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#if !defined(__WXWINCE__)
::SetLastError(0);
#endif
if ( !::SetFocus(hWnd) )
{
#if defined(__WXDEBUG__) && !defined(__WXMICROWIN__)
// was there really an error?
DWORD dwRes = ::GetLastError();
if ( dwRes )
@ -655,7 +654,6 @@ void wxWindowMSW::SetFocus()
wxLogApiError(_T("SetFocus"), dwRes);
}
}
#endif // Debug
}
}
@ -2655,12 +2653,13 @@ wxWindowCreationHook::~wxWindowCreationHook()
// Main window proc
LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// trace all messages - useful for the debugging
#ifdef __WXDEBUG__
// trace all messages: useful for the debugging but noticeably slows down
// the code so don't do it by default
#if wxDEBUG_LEVEL >= 2
wxLogTrace(wxTraceMessages,
wxT("Processing %s(hWnd=%p, wParam=%08lx, lParam=%08lx)"),
wxGetMessageName(message), hWnd, (long)wParam, lParam);
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
wxWindowMSW *wnd = wxFindWinFromHandle(hWnd);
@ -3512,10 +3511,10 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
if ( !processed )
{
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
wxGetMessageName(message));
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
rc.result = MSWDefWindowProc(message, wParam, lParam);
}
@ -3539,20 +3538,24 @@ void wxAssociateWinWithHandle(HWND hwnd, wxWindowMSW *win)
wxCHECK_RET( hwnd != (HWND)NULL,
wxT("attempt to add a NULL hwnd to window list ignored") );
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
WindowHandles::const_iterator i = gs_windowHandles.find(hwnd);
if ( i != gs_windowHandles.end() )
{
if ( i->second != win )
{
wxLogDebug(wxT("HWND %p already associated with another window (%s)"),
hwnd, win->GetClassInfo()->GetClassName());
wxFAIL_MSG(
wxString::Format(
wxT("HWND %p already associated with another window (%s)"),
hwnd, win->GetClassInfo()->GetClassName()
)
);
}
//else: this actually happens currently because we associate the window
// with its HWND during creation (if we create it) and also when
// SubclassWin() is called later, this is ok
}
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL
gs_windowHandles[hwnd] = (wxWindow *)win;
}
@ -6357,7 +6360,7 @@ void wxSetKeyboardHook(bool doIt)
#endif // !__WXMICROWIN__
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL > =2
const wxChar *wxGetMessageName(int message)
{
switch ( message )
@ -6826,7 +6829,7 @@ const wxChar *wxGetMessageName(int message)
return s_szBuf.c_str();
}
}
#endif //__WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win)
{

View File

@ -235,9 +235,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
// Some people may wish to use this, but
// probably it shouldn't be here by default.
#ifdef __WXDEBUG__
// wxRedirectIOToConsole();
#endif
wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100);

View File

@ -147,9 +147,7 @@ bool wxControl::OS2CreateControl( const wxChar* zClassname,
if ( !m_hWnd )
{
#ifdef __WXDEBUG__
wxLogError(wxT("Failed to create a control of class '%s'"), zClassname);
#endif // DEBUG
return false;
}

View File

@ -314,7 +314,7 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *pCanvas) :
wxFAIL_MSG( wxT("wxPaintDC may be created only in EVT_PAINT handler!") );
return;
}
#endif // __WXDEBUG__
#endif // wxHAS_PAINT_DEBUG
m_pCanvas = pCanvas;

View File

@ -732,7 +732,7 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler )
#endif
#if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
pascal static void
wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
@ -778,7 +778,7 @@ wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
#endif
}
#endif //__WXDEBUG__
#endif // wxDEBUG_LEVEL
extern "C" void macPostedEventCallback(void *WXUNUSED(unused))
{
@ -789,7 +789,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
{
// Mac-specific
#if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
#endif

View File

@ -848,7 +848,6 @@ wxThread::~wxThread()
g_numberOfThreads--;
#ifdef __WXDEBUG__
m_critsect.Enter();
// check that the thread either exited or couldn't be created
@ -861,7 +860,6 @@ wxThread::~wxThread()
}
m_critsect.Leave();
#endif
wxDELETE( m_internal ) ;
}

View File

@ -86,12 +86,9 @@ protected:
unsigned wxDisplayFactoryMacOSX::GetCount()
{
CGDisplayCount count;
#ifdef __WXDEBUG__
CGDisplayErr err =
#endif
CGGetActiveDisplayList(0, NULL, &count);
CGDisplayErr err = CGGetActiveDisplayList(0, NULL, &count);
wxASSERT(err == CGDisplayNoErr);
wxCHECK_MSG( err != CGDisplayNoErr, 0, "CGGetActiveDisplayList() failed" );
return count;
}
@ -136,12 +133,9 @@ wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n)
CGDisplayCount theCount = GetCount();
CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount];
#ifdef __WXDEBUG__
CGDisplayErr err =
#endif
CGGetActiveDisplayList(theCount, theIDs, &theCount);
CGDisplayErr err = CGGetActiveDisplayList(theCount, theIDs, &theCount);
wxCHECK_MSG( err != CGDisplayNoErr, NULL, "CGGetActiveDisplayList() failed" );
wxASSERT( err == CGDisplayNoErr );
wxASSERT( n < theCount );
wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(n, theIDs[n]);

View File

@ -55,22 +55,6 @@ struct WXDLLEXPORT wxPaintDCInfo
WX_DEFINE_OBJARRAY(wxArrayDCInfo)
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
// a global variable which we check to verify that wxPaintDC are only
// created in response to WM_PAINT message - doing this from elsewhere is a
// common programming error among wxWidgets programmers and might lead to
// very subtle and difficult to debug refresh/repaint bugs.
int g_isPainting = 0;
#endif // __WXDEBUG__
// ===========================================================================
// implementation
// ===========================================================================
@ -192,15 +176,6 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
{
wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") );
#ifdef __WXDEBUG__
if ( g_isPainting <= 0 )
{
wxFAIL_MSG( wxT("wxPaintDCImpl may be created only in EVT_PAINT handler!") );
return;
}
#endif // __WXDEBUG__
m_window = window;
// do we have a DC for this window in the cache?

View File

@ -959,14 +959,8 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
int propagatedFlags = argFlags & (wxPG_REPORT_ERROR|wxPG_PROGRAMMATIC_VALUE);
#ifdef __WXDEBUG__
bool debug_print = false;
#endif
#ifdef __WXDEBUG__
if ( debug_print )
wxLogDebug(wxT(">> %s.StringToValue('%s')"),GetLabel().c_str(),text.c_str());
#endif
wxLogTrace("propgrid",
wxT(">> %s.StringToValue('%s')"), GetLabel(), text);
wxString::const_iterator it = text.begin();
wxUniChar a;
@ -998,11 +992,9 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
wxVariant variant(child->GetValue());
wxString childName = child->GetBaseName();
#ifdef __WXDEBUG__
if ( debug_print )
wxLogDebug(wxT("token = '%s', child = %s"),
token.c_str(), childName.c_str());
#endif
wxLogTrace("propgrid",
wxT("token = '%s', child = %s"),
token, childName);
// Add only if editable or setting programmatically
if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) ||
@ -2505,12 +2497,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPGRootProperty, wxPGProperty)
wxPGRootProperty::wxPGRootProperty( const wxString& name )
: wxPGProperty()
{
#ifdef __WXDEBUG__
m_name = name;
m_label = m_name;
#else
wxUnusedVar(name);
#endif
SetParentalType(0);
m_depth = 0;
}

View File

@ -627,11 +627,10 @@ wxPropertyGrid::~wxPropertyGrid()
m_tlp->RemoveEventHandler(handler);
delete handler;
#ifdef __WXDEBUG__
if ( IsEditorsValueModified() )
::wxMessageBox(wxS("Most recent change in property editor was lost!!!\n\n(if you don't want this to happen, close your frames and dialogs using Close(false).)"),
wxS("wxPropertyGrid Debug Warning") );
#endif
wxASSERT_MSG( !IsEditorsValueModified(),
wxS("Most recent change in property editor was lost!!! ")
wxS("(if you don't want this to happen, close your frames ")
wxS("and dialogs using Close(false).)") );
#if wxPG_DOUBLE_BUFFER
if ( m_doubleBuffer )
@ -3749,16 +3748,10 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos )
m_pState->EnsureVirtualHeight();
#ifdef __WXDEBUG__
int by1 = m_pState->GetVirtualHeight();
int by2 = m_pState->GetActualVirtualHeight();
if ( by1 != by2 )
{
wxString s = wxString::Format(wxT("VirtualHeight=%i, ActualVirtualHeight=%i, should match!"), by1, by2);
wxFAIL_MSG(s.c_str());
wxLogDebug(s);
}
#endif
wxASSERT_LEVEL_2_MSG(
m_pState->GetVirtualHeight() == m_pState->GetActualVirtualHeight(),
"VirtualHeight and ActualVirtualHeight should match"
);
m_iFlags |= wxPG_FL_RECALCULATING_VIRTUAL_SIZE;

View File

@ -936,10 +936,6 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
wxPropertyGrid* pg = GetGrid();
#ifdef __WXDEBUG__
const bool debug = false;
#endif
unsigned int i;
unsigned int lastColumn = m_colWidths.size() - 1;
int width = m_width;
@ -949,10 +945,9 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
// Column to reduce, if needed. Take last one that exceeds minimum width.
int reduceCol = -1;
#ifdef __WXDEBUG__
if ( debug )
wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width, clientWidth);
#endif
wxLogTrace("propgrid",
wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
width, clientWidth);
//
// Check min sizes
@ -975,10 +970,9 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
for ( i=0; i<m_colWidths.size(); i++ )
colsWidth += m_colWidths[i];
#ifdef __WXDEBUG__
if ( debug )
wxLogDebug(wxT(" HasVirtualWidth: %i colsWidth: %i"),(int)pg->HasVirtualWidth(),colsWidth);
#endif
wxLogTrace("propgrid",
wxS(" HasVirtualWidth: %i colsWidth: %i"),
(int)pg->HasVirtualWidth(), colsWidth);
// Then mode-based requirement
if ( !pg->HasVirtualWidth() )
@ -989,10 +983,9 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
if ( colsWidth < width )
{
// Increase column
#ifdef __WXDEBUG__
if ( debug )
wxLogDebug(wxT(" Adjust last column to %i"), m_colWidths[lastColumn] + widthHigher);
#endif
wxLogTrace("propgrid",
wxS(" Adjust last column to %i"),
m_colWidths[lastColumn] + widthHigher);
m_colWidths[lastColumn] = m_colWidths[lastColumn] + widthHigher;
}
else if ( colsWidth > width )
@ -1000,10 +993,10 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
// Reduce column
if ( reduceCol != -1 )
{
#ifdef __WXDEBUG__
if ( debug )
wxLogDebug(wxT(" Reduce column %i (by %i)"), reduceCol, -widthHigher);
#endif
wxLogTrace("propgrid",
wxT(" Reduce column %i (by %i)"),
reduceCol, -widthHigher);
// Reduce widest column, and recheck
m_colWidths[reduceCol] = m_colWidths[reduceCol] + widthHigher;
CheckColumnWidths();
@ -1025,11 +1018,10 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
pg->RecalculateVirtualSize();
}
#ifdef __WXDEBUG__
if ( debug )
for ( i=0; i<m_colWidths.size(); i++ )
wxLogDebug(wxT("col%i: %i"),i,m_colWidths[i]);
#endif
for ( i=0; i<m_colWidths.size(); i++ )
{
wxLogTrace("propgrid", wxS("col%i: %i"), i, m_colWidths[i]);
}
// Auto center splitter
if ( !(pg->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER) &&
@ -1424,13 +1416,12 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
}
else
{
#ifdef __WXDEBUG__
if ( wxStrcmp(current->GetType(), p->GetValue().GetType()) != 0)
{
wxLogDebug(wxT("wxPropertyGridPageState::DoSetPropertyValues Warning: Setting value of property \"%s\" from variant"),
p->GetName().c_str());
}
#endif
wxASSERT_LEVEL_2_MSG(
wxStrcmp(current->GetType(), p->GetValue().GetType()) == 0,
wxString::Format(
wxS("setting value of property \"%s\" from variant"),
p->GetName().c_str())
);
p->SetValue(*current);
}

View File

@ -2854,7 +2854,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co
bool withUndo = ((flags & wxRICHTEXT_SETSTYLE_WITH_UNDO) != 0);
// bool applyMinimal = ((flags & wxRICHTEXT_SETSTYLE_OPTIMIZE) != 0);
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL
bool specifyLevel = ((flags & wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL) != 0);
#endif

View File

@ -40,11 +40,9 @@
#include "wx/univ/inphand.h"
#include "wx/univ/theme.h"
#define WXDEBUG_SCROLLBAR
#ifndef __WXDEBUG__
#undef WXDEBUG_SCROLLBAR
#endif // !__WXDEBUG__
#if wxDEBUG_LEVEL >= 2
#define WXDEBUG_SCROLLBAR
#endif
#if defined(WXDEBUG_SCROLLBAR) && defined(__WXMSW__) && !defined(__WXMICROWIN__)
#include "wx/msw/private.h"

View File

@ -149,16 +149,13 @@
#include "wx/cmdproc.h"
// turn extra wxTextCtrl-specific debugging on/off
#define WXDEBUG_TEXT
#if wxDEBUG_LEVEL >= 2
// turn extra wxTextCtrl-specific debugging on/off
#define WXDEBUG_TEXT
// turn wxTextCtrl::Replace() debugging on (slows down code a *lot*!)
#define WXDEBUG_TEXT_REPLACE
#ifndef __WXDEBUG__
#undef WXDEBUG_TEXT
#undef WXDEBUG_TEXT_REPLACE
#endif
// turn wxTextCtrl::Replace() debugging on (slows down code a *lot*!)
#define WXDEBUG_TEXT_REPLACE
#endif // wxDEBUG_LEVEL >= 2
// wxStringTokenize only needed for debug checks
#ifdef WXDEBUG_TEXT_REPLACE
@ -4765,11 +4762,11 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
}
#endif
}
#ifdef __WXDEBUG__
#if wxDEBUG_LEVEL >= 2
// Ctrl-R refreshes the control in debug mode
else if ( event.ControlDown() && event.GetKeyCode() == 'r' )
Refresh();
#endif // __WXDEBUG__
#endif // wxDEBUG_LEVEL >= 2
event.Skip();
}

View File

@ -45,11 +45,9 @@
#include "wx/caret.h"
#endif // wxUSE_CARET
// turn Refresh() debugging on/off
#define WXDEBUG_REFRESH
#ifndef __WXDEBUG__
#undef WXDEBUG_REFRESH
#if wxDEBUG_LEVEL >= 2
// turn Refresh() debugging on/off
#define WXDEBUG_REFRESH
#endif
#if defined(WXDEBUG_REFRESH) && defined(__WXMSW__) && !defined(__WXMICROWIN__)

View File

@ -1624,7 +1624,6 @@ bool wxThread::TestDestroy()
wxThread::~wxThread()
{
#ifdef __WXDEBUG__
m_critsect.Enter();
// check that the thread either exited or couldn't be created
@ -1636,7 +1635,6 @@ wxThread::~wxThread()
}
m_critsect.Leave();
#endif // __WXDEBUG__
delete m_internal;

View File

@ -1475,7 +1475,7 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits,
M_BMPHANDLERDATA->m_bpp = bpp; // mono as well?
#if __WXDEBUG__
#if wxDEBUG_LEVEL
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
@ -1483,7 +1483,7 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
wxASSERT_MSG( bpp == (int)depthRet, wxT("colour depth mismatch") );
#endif
#endif // wxDEBUG_LEVEL
XpmFreeAttributes(&xpmAttr);

View File

@ -152,11 +152,6 @@ bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toRepar
if (!WM_STATE)
WM_STATE = XInternAtom(display, "WM_STATE", False);
#ifdef __WXDEBUG__
if (!windowName.empty())
wxLogDebug(_T("Waiting for window %s"), windowName.c_str());
#endif
sm_done = false;
wxEventLoop eventLoop;