made definition of wxUSE_LOG_DEBUG dependent on wxDEBUG_LEVEL and added wxUSE_LOG_TRACE (currently never enabled by default); fix warnings about unused variables after these changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8a9464893a
commit
711f12ef2e
@ -40,8 +40,8 @@ public:
|
||||
wxDataFormat GetMatchingPair();
|
||||
|
||||
// implementation
|
||||
|
||||
GdkAtom GtkGetMatchingPair();
|
||||
|
||||
GdkAtom GtkGetMatchingPair(bool quiet = false);
|
||||
|
||||
void GtkRegisterWidget( GtkWidget *widget );
|
||||
void GtkUnregisterWidget( GtkWidget *widget );
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
GdkAtom GetMatchingPair();
|
||||
GdkAtom GetMatchingPair(bool quiet = false);
|
||||
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
|
@ -55,6 +55,7 @@ typedef unsigned long wxLogLevel;
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// wxUSE_LOG_DEBUG enables the debug log messages
|
||||
#ifndef wxUSE_LOG_DEBUG
|
||||
#if wxDEBUG_LEVEL
|
||||
#define wxUSE_LOG_DEBUG 1
|
||||
@ -63,6 +64,15 @@ typedef unsigned long wxLogLevel;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// wxUSE_LOG_TRACE enables the trace messages, they are disabled by default
|
||||
#ifndef wxUSE_LOG_TRACE
|
||||
#if wxDEBUG_LEVEL >= 2
|
||||
#define wxUSE_LOG_TRACE 1
|
||||
#else // wxDEBUG_LEVEL < 2
|
||||
#define wxUSE_LOG_TRACE 0
|
||||
#endif
|
||||
#endif // wxUSE_LOG_TRACE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -353,7 +363,8 @@ private:
|
||||
// "trivial" derivations of wxLog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// log everything to a buffer
|
||||
// log everything except for the debug/trace messages (which are passed to
|
||||
// wxMessageOutputDebug) to a buffer
|
||||
class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog
|
||||
{
|
||||
public:
|
||||
@ -367,10 +378,14 @@ public:
|
||||
virtual void Flush();
|
||||
|
||||
protected:
|
||||
#if wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
virtual void DoLog(wxLogLevel level, const wxString& szString, time_t t);
|
||||
virtual void DoLogString(const wxString& szString, time_t t);
|
||||
|
||||
wxSUPPRESS_DOLOG_HIDE_WARNING()
|
||||
#endif // wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
|
||||
virtual void DoLogString(const wxString& szString, time_t t);
|
||||
|
||||
wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
|
||||
|
||||
private:
|
||||
@ -626,6 +641,12 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
||||
|
||||
#else // !wxUSE_LOG
|
||||
|
||||
#undef wxUSE_LOG_DEBUG
|
||||
#define wxUSE_LOG_DEBUG 0
|
||||
|
||||
#undef wxUSE_LOG_TRACE
|
||||
#define wxUSE_LOG_TRACE 0
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
#define WX_WATCOM_ONLY_CODE( x ) x
|
||||
@ -722,14 +743,42 @@ DECLARE_LOG_FUNCTION2(SysError, long, lErrCode);
|
||||
DECLARE_LOG_FUNCTION2(SysError, unsigned long, lErrCode);
|
||||
#endif
|
||||
|
||||
// debug functions do nothing in release mode
|
||||
#if wxUSE_LOG && wxUSE_LOG_DEBUG
|
||||
|
||||
// debug functions can be completely disabled in optimized builds
|
||||
|
||||
// if these log functions are disabled, we prefer to define them as (empty)
|
||||
// variadic macros as this completely removes them and their argument
|
||||
// evaluation from the object code but if this is not supported by compiler we
|
||||
// use empty inline functions instead (defining them as nothing would result in
|
||||
// compiler warnings)
|
||||
//
|
||||
// note that making wxVLogDebug/Trace() themselves (empty inline) functions is
|
||||
// a bad idea as some compilers are stupid enough to not inline even empty
|
||||
// functions if their parameters are complicated enough, but by defining them
|
||||
// as an empty inline function we ensure that even dumbest compilers optimise
|
||||
// them away
|
||||
#ifdef __BORLANDC__
|
||||
// but Borland gives "W8019: Code has no effect" for wxLogNop() so we need
|
||||
// to define it differently for it to avoid these warnings (same problem as
|
||||
// with wxUnusedVar())
|
||||
#define wxLogNop() { }
|
||||
#else
|
||||
inline void wxLogNop() { }
|
||||
#endif
|
||||
|
||||
#if wxUSE_LOG_DEBUG
|
||||
DECLARE_LOG_FUNCTION(Debug);
|
||||
#else // !wxUSE_LOG_DEBUG
|
||||
#define wxVLogDebug(fmt, valist) wxLogNop()
|
||||
|
||||
// there is no more unconditional LogTrace: it is not different from
|
||||
// LogDebug and it creates overload ambiguities
|
||||
//DECLARE_LOG_FUNCTION(Trace);
|
||||
#ifdef HAVE_VARIADIC_MACROS
|
||||
#define wxLogDebug(fmt, ...) wxLogNop()
|
||||
#else // !HAVE_VARIADIC_MACROS
|
||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxString&))
|
||||
#endif
|
||||
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
|
||||
|
||||
#if wxUSE_LOG_TRACE
|
||||
// this version only logs the message if the mask had been added to the
|
||||
// list of masks with AddTraceMask()
|
||||
DECLARE_LOG_FUNCTION2(Trace, const wxString&, mask);
|
||||
@ -744,44 +793,18 @@ DECLARE_LOG_FUNCTION2(SysError, unsigned long, lErrCode);
|
||||
// string identifiers
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask);
|
||||
#endif // wxDEBUG_LEVEL
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
DECLARE_LOG_FUNCTION2(Trace, int, mask);
|
||||
#endif
|
||||
#else //!debug || !wxUSE_LOG
|
||||
// these functions do nothing in release builds, but don't define them as
|
||||
// nothing as it could result in different code structure in debug and
|
||||
// release and this could result in trouble when these macros are used
|
||||
// inside if/else
|
||||
//
|
||||
// note that making wxVLogDebug/Trace() themselves (empty inline) functions
|
||||
// is a bad idea as some compilers are stupid enough to not inline even
|
||||
// empty functions if their parameters are complicated enough, but by
|
||||
// defining them as an empty inline function we ensure that even dumbest
|
||||
// compilers optimise them away
|
||||
#ifdef __BORLANDC__
|
||||
// but Borland gives "W8019: Code has no effect" for wxLogNop() so we need
|
||||
// to define it differently for it to avoid these warnings (same problem as
|
||||
// with wxUnusedVar())
|
||||
#define wxLogNop() { }
|
||||
#else
|
||||
inline void wxLogNop() { }
|
||||
#endif
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
#define wxVLogDebug(fmt, valist) wxLogNop()
|
||||
#else // !wxUSE_LOG_TRACE
|
||||
#define wxVLogTrace(mask, fmt, valist) wxLogNop()
|
||||
|
||||
#ifdef HAVE_VARIADIC_MACROS
|
||||
// unlike the inline functions below, this completely removes the
|
||||
// wxLogXXX calls from the object file:
|
||||
#define wxLogDebug(fmt, ...) wxLogNop()
|
||||
#define wxLogTrace(mask, fmt, ...) wxLogNop()
|
||||
#else // !HAVE_VARIADIC_MACROS
|
||||
//inline void wxLogDebug(const wxString& fmt, ...) {}
|
||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxString&))
|
||||
//inline void wxLogTrace(wxTraceMask, const wxString& fmt, ...) {}
|
||||
//inline void wxLogTrace(const wxString&, const wxString& fmt, ...) {}
|
||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxString&))
|
||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxString&))
|
||||
#ifdef __WATCOMC__
|
||||
@ -790,7 +813,7 @@ DECLARE_LOG_FUNCTION2(SysError, unsigned long, lErrCode);
|
||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wchar_t*, const wchar_t*))
|
||||
#endif
|
||||
#endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
|
||||
#endif // debug/!debug
|
||||
#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
|
||||
|
||||
#if defined(__VISUALC__) && __VISUALC__ < 1300
|
||||
#pragma warning(default:4003)
|
||||
|
@ -260,47 +260,42 @@ void wxDoLogVerboseUtf8(const char *format, ...)
|
||||
}
|
||||
#endif // wxUSE_UNICODE_UTF8
|
||||
|
||||
// debug functions
|
||||
#ifdef __WXDEBUG__
|
||||
// ----------------------------------------------------------------------------
|
||||
// debug and trace functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LOG_DEBUG
|
||||
void wxVLogDebug(const wxString& format, va_list argptr)
|
||||
{
|
||||
if ( wxLog::IsEnabled() )
|
||||
{
|
||||
wxLog::OnLog(wxLOG_Debug,
|
||||
wxString::FormatV(format, argptr), time(NULL));
|
||||
}
|
||||
}
|
||||
|
||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION_WCHAR(level) \
|
||||
void wxDoLog##level##Wchar(const wxChar *format, ...) \
|
||||
{ \
|
||||
va_list argptr; \
|
||||
va_start(argptr, format); \
|
||||
wxVLog##level(format, argptr); \
|
||||
va_end(argptr); \
|
||||
}
|
||||
#else
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION_WCHAR(level)
|
||||
#endif
|
||||
void wxDoLogDebugWchar(const wxChar *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
wxVLogDebug(format, argptr);
|
||||
va_end(argptr);
|
||||
}
|
||||
#endif // !wxUSE_UTF8_LOCALE_ONLY
|
||||
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION_UTF8(level) \
|
||||
void wxDoLog##level##Utf8(const char *format, ...) \
|
||||
{ \
|
||||
va_list argptr; \
|
||||
va_start(argptr, format); \
|
||||
wxVLog##level(format, argptr); \
|
||||
va_end(argptr); \
|
||||
}
|
||||
#else
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION_UTF8(level)
|
||||
#endif
|
||||
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
|
||||
void wxVLog##level(const wxString& format, va_list argptr) \
|
||||
{ \
|
||||
if ( wxLog::IsEnabled() ) { \
|
||||
wxLog::OnLog(wxLOG_##level, \
|
||||
wxString::FormatV(format, argptr), time(NULL)); \
|
||||
} \
|
||||
} \
|
||||
IMPLEMENT_LOG_DEBUG_FUNCTION_WCHAR(level) \
|
||||
IMPLEMENT_LOG_DEBUG_FUNCTION_UTF8(level)
|
||||
|
||||
void wxDoLogDebugUtf8(const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
wxVLogDebug(format, argptr);
|
||||
va_end(argptr);
|
||||
}
|
||||
#endif // wxUSE_UNICODE_UTF8
|
||||
#endif // wxUSE_LOG_DEBUG
|
||||
|
||||
#if wxUSE_LOG_TRACE
|
||||
void wxVLogTrace(const wxString& mask, const wxString& format, va_list argptr)
|
||||
{
|
||||
if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
|
||||
@ -403,13 +398,8 @@ void wxDoLogVerboseUtf8(const char *format, ...)
|
||||
void wxVLogTrace(const wchar_t *mask, const wxString& format, va_list argptr)
|
||||
{ wxVLogTrace(wxString(mask), format, argptr); }
|
||||
#endif // __WATCOMC__
|
||||
#endif // wxUSE_LOG_TRACE
|
||||
|
||||
#else // release
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION(level)
|
||||
#endif
|
||||
|
||||
IMPLEMENT_LOG_DEBUG_FUNCTION(Debug)
|
||||
IMPLEMENT_LOG_DEBUG_FUNCTION(Trace)
|
||||
|
||||
// wxLogSysError: one uses the last error code, for other you must give it
|
||||
// explicitly
|
||||
@ -730,17 +720,32 @@ void wxLog::DoLog(wxLogLevel level, const wxString& szString, time_t t)
|
||||
LogString(szString, t);
|
||||
break;
|
||||
|
||||
#if wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
#if wxUSE_LOG_TRACE
|
||||
case wxLOG_Trace:
|
||||
#endif
|
||||
#if wxUSE_LOG_DEBUG
|
||||
case wxLOG_Debug:
|
||||
#ifdef __WXDEBUG__
|
||||
#endif
|
||||
{
|
||||
wxString msg = level == wxLOG_Trace ? wxS("Trace: ")
|
||||
: wxS("Debug: ");
|
||||
msg << szString;
|
||||
LogString(msg, t);
|
||||
wxString str;
|
||||
|
||||
// don't prepend "debug/trace" prefix under MSW as it goes to
|
||||
// the debug window anyhow and don't add time stamp neither as
|
||||
// debug output viewers under Windows typically add it
|
||||
// themselves anyhow
|
||||
#ifndef __WXMSW__
|
||||
TimeStamp(&str);
|
||||
|
||||
str += level == wxLOG_Trace ? wxT("Trace: ")
|
||||
: wxT("Debug: ");
|
||||
#endif // !__WXMSW__
|
||||
|
||||
str += szString;
|
||||
wxMessageOutputDebug().Output(str);
|
||||
}
|
||||
#endif // Debug
|
||||
break;
|
||||
#endif // wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
}
|
||||
}
|
||||
|
||||
@ -793,31 +798,39 @@ void wxLogBuffer::Flush()
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
|
||||
void wxLogBuffer::DoLog(wxLogLevel level, const wxString& szString, time_t t)
|
||||
{
|
||||
switch ( level )
|
||||
// don't put debug messages in the buffer, we don't want to show
|
||||
// them to the user in a msg box, log them immediately
|
||||
bool showImmediately = false;
|
||||
#if wxUSE_LOG_TRACE
|
||||
if ( level == wxLOG_Trace )
|
||||
showImmediately = true;
|
||||
#endif
|
||||
#if wxUSE_LOG_DEBUG
|
||||
if ( level == wxLOG_Debug )
|
||||
showImmediately = true;
|
||||
#endif
|
||||
|
||||
if ( showImmediately )
|
||||
{
|
||||
case wxLOG_Trace:
|
||||
case wxLOG_Debug:
|
||||
#ifdef __WXDEBUG__
|
||||
// don't put debug messages in the buffer, we don't want to show
|
||||
// them to the user in a msg box, log them immediately
|
||||
{
|
||||
wxString str;
|
||||
TimeStamp(&str);
|
||||
str += szString;
|
||||
wxString str;
|
||||
TimeStamp(&str);
|
||||
str += szString;
|
||||
|
||||
wxMessageOutputDebug dbgout;
|
||||
dbgout.Printf(wxS("%s\n"), str.c_str());
|
||||
}
|
||||
#endif // __WXDEBUG__
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLog::DoLog(level, szString, t);
|
||||
wxMessageOutputDebug dbgout;
|
||||
dbgout.Printf(wxS("%s\n"), str.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLog::DoLog(level, szString, t);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_LOG_DEBUG || wxUSE_LOG_TRACE
|
||||
|
||||
void wxLogBuffer::DoLogString(const wxString& szString, time_t WXUNUSED(t))
|
||||
{
|
||||
m_str << szString << wxS("\n");
|
||||
|
@ -3459,7 +3459,7 @@ void wxGrid::ChangeCursorMode(CursorMode mode,
|
||||
wxWindow *win,
|
||||
bool captureMouse)
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
#if wxUSE_LOG_TRACE
|
||||
static const wxChar *cursorModes[] =
|
||||
{
|
||||
_T("SELECT_CELL"),
|
||||
@ -3476,7 +3476,7 @@ void wxGrid::ChangeCursorMode(CursorMode mode,
|
||||
: win ? _T("rowLabelWin")
|
||||
: _T("gridWin"),
|
||||
cursorModes[m_cursorMode], cursorModes[mode]);
|
||||
#endif
|
||||
#endif // wxUSE_LOG_TRACE
|
||||
|
||||
if ( mode == m_cursorMode &&
|
||||
win == m_winCapture &&
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/collpane.h"
|
||||
#include "wx/arrstr.h"
|
||||
#include "wx/msgout.h"
|
||||
|
||||
#if wxUSE_THREADS
|
||||
#include "wx/thread.h"
|
||||
@ -434,32 +435,6 @@ void wxLogGui::DoLog(wxLogLevel level, const wxString& szString, time_t t)
|
||||
#endif // wxUSE_STATUSBAR
|
||||
break;
|
||||
|
||||
case wxLOG_Trace:
|
||||
case wxLOG_Debug:
|
||||
#ifdef __WXDEBUG__
|
||||
{
|
||||
wxString str;
|
||||
TimeStamp(&str);
|
||||
str += szString;
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
|
||||
// don't prepend debug/trace here: it goes to the
|
||||
// debug window anyhow
|
||||
str += wxT("\r\n");
|
||||
OutputDebugString(str.wx_str());
|
||||
#else
|
||||
// send them to stderr
|
||||
wxFprintf(stderr, wxT("[%s] %s\n"),
|
||||
level == wxLOG_Trace ? wxT("Trace")
|
||||
: wxT("Debug"),
|
||||
str.c_str());
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
break;
|
||||
|
||||
case wxLOG_FatalError:
|
||||
// show this one immediately
|
||||
wxMessageBox(szString, _("Fatal error"), wxICON_HAND);
|
||||
@ -491,6 +466,11 @@ void wxLogGui::DoLog(wxLogLevel level, const wxString& szString, time_t t)
|
||||
m_aTimes.Add((long)t);
|
||||
m_bHasMessages = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// let the base class deal with debug/trace messages as well as any
|
||||
// custom levels
|
||||
wxLog::DoLog(level, szString, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,12 +36,10 @@ extern bool g_blockEventsOnDrag;
|
||||
// the flags used for the last DoDragDrop()
|
||||
static long gs_flagsForDrag = 0;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
// the trace mask we use with wxLogTrace() - call
|
||||
// wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
|
||||
// (there are quite a few of them, so don't enable this by default)
|
||||
static const wxChar *TRACE_DND = _T("dnd");
|
||||
#endif
|
||||
#define TRACE_DND "dnd"
|
||||
|
||||
// global variables because GTK+ DnD want to have the
|
||||
// mouse event that caused it
|
||||
@ -334,9 +332,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned FALSE") );
|
||||
#endif
|
||||
|
||||
/* cancel the whole thing */
|
||||
gtk_drag_finish( context,
|
||||
@ -346,9 +342,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned true") );
|
||||
#endif
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
@ -414,9 +408,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT( "Drop target: data received event") );
|
||||
#endif
|
||||
|
||||
/* inform the wxDropTarget about the current GtkSelectionData.
|
||||
this is only valid for the duration of this call */
|
||||
@ -426,18 +418,14 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
||||
|
||||
if ( wxIsDragResultOk( drop_target->OnData( x, y, result ) ) )
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT( "Drop target: OnData returned true") );
|
||||
#endif
|
||||
|
||||
/* tell GTK that data transfer was successful */
|
||||
gtk_drag_finish( context, TRUE, FALSE, time );
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT( "Drop target: OnData returned FALSE") );
|
||||
#endif
|
||||
|
||||
/* tell GTK that data transfer was not successful */
|
||||
gtk_drag_finish( context, FALSE, FALSE, time );
|
||||
@ -468,13 +456,9 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
|
||||
{
|
||||
// GetMatchingPair() checks for m_dataObject too, no need to do it here
|
||||
|
||||
// disable the debug message from GetMatchingPair() - there are too many
|
||||
// of them otherwise
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogNull noLog;
|
||||
#endif // Debug
|
||||
|
||||
return (GtkGetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
|
||||
// disable the trace message from GetMatchingPair() by passing true to it
|
||||
// (there are just too many of them otherwise)
|
||||
return (GtkGetMatchingPair(true) != (GdkAtom) 0) ? def : wxDragNone;
|
||||
}
|
||||
|
||||
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
||||
@ -503,7 +487,7 @@ wxDataFormat wxDropTarget::GetMatchingPair()
|
||||
return wxDataFormat( GtkGetMatchingPair() );
|
||||
}
|
||||
|
||||
GdkAtom wxDropTarget::GtkGetMatchingPair()
|
||||
GdkAtom wxDropTarget::GtkGetMatchingPair(bool quiet)
|
||||
{
|
||||
if (!m_dataObject)
|
||||
return (GdkAtom) 0;
|
||||
@ -517,10 +501,11 @@ GdkAtom wxDropTarget::GtkGetMatchingPair()
|
||||
GdkAtom formatAtom = (GdkAtom)(child->data);
|
||||
wxDataFormat format( formatAtom );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop target: drag has format: %s"),
|
||||
format.GetId().c_str());
|
||||
#endif // Debug
|
||||
if ( !quiet )
|
||||
{
|
||||
wxLogTrace(TRACE_DND, wxT("Drop target: drag has format: %s"),
|
||||
format.GetId().c_str());
|
||||
}
|
||||
|
||||
if (m_dataObject->IsSupportedFormat( format ))
|
||||
return formatAtom;
|
||||
@ -613,10 +598,8 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
{
|
||||
wxDataFormat format( selection_data->target );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: format requested: %s"),
|
||||
format.GetId().c_str());
|
||||
#endif
|
||||
|
||||
drop_source->m_retValue = wxDragCancel;
|
||||
|
||||
@ -624,26 +607,20 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
|
||||
if (!data)
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: no data object") );
|
||||
#endif
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data->IsSupportedFormat(format))
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: unsupported format") );
|
||||
#endif
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->GetDataSize(format) == 0)
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: empty data") );
|
||||
#endif
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = data->GetDataSize(format);
|
||||
@ -843,10 +820,9 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
GdkAtom atom = array[i];
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom ));
|
||||
#endif
|
||||
gtk_target_list_add( target_list, atom, 0, 0 );
|
||||
wxLogTrace(TRACE_DND, wxT("Drop source: Supported atom %s"),
|
||||
gdk_atom_name( atom ));
|
||||
gtk_target_list_add( target_list, atom, 0, 0 );
|
||||
}
|
||||
delete[] array;
|
||||
|
||||
|
@ -37,13 +37,6 @@
|
||||
extern void wxapp_install_idle_handler();
|
||||
extern bool g_isIdle;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// thread system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_THREADS
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// global data
|
||||
//----------------------------------------------------------------------------
|
||||
@ -472,13 +465,8 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
|
||||
{
|
||||
// GetMatchingPair() checks for m_dataObject too, no need to do it here
|
||||
|
||||
// disable the debug message from GetMatchingPair() - there are too many
|
||||
// of them otherwise
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogNull noLog;
|
||||
#endif // Debug
|
||||
|
||||
return (GetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
|
||||
// disable the debug message from GetMatchingPair() by passing true to it
|
||||
return (GetMatchingPair(true) != (GdkAtom) 0) ? def : wxDragNone;
|
||||
}
|
||||
|
||||
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
||||
@ -515,10 +503,11 @@ GdkAtom wxDropTarget::GetMatchingPair()
|
||||
GdkAtom formatAtom = GPOINTER_TO_INT(child->data);
|
||||
wxDataFormat format( formatAtom );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogTrace(TRACE_DND, wxT("Drop target: drag has format: %s"),
|
||||
format.GetId().c_str());
|
||||
#endif // Debug
|
||||
if ( !quiet )
|
||||
{
|
||||
wxLogTrace(TRACE_DND, wxT("Drop target: drag has format: %s"),
|
||||
format.GetId().c_str());
|
||||
}
|
||||
|
||||
if (m_dataObject->IsSupportedFormat( format ))
|
||||
return formatAtom;
|
||||
|
@ -720,7 +720,7 @@ public:
|
||||
wxThreadState GetState() const { return m_state; }
|
||||
void SetState(wxThreadState state)
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
#if wxUSE_LOG_TRACE
|
||||
static const wxChar *stateNames[] =
|
||||
{
|
||||
_T("NEW"),
|
||||
@ -731,7 +731,7 @@ public:
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %p: %s => %s."),
|
||||
GetId(), stateNames[m_state], stateNames[state]);
|
||||
#endif // __WXDEBUG__
|
||||
#endif // wxUSE_LOG_TRACE
|
||||
|
||||
m_state = state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user