+ stackTrace = dump.GetStackTrace();
+
+ // don't show more than maxLines or we could get a dialog too tall to be
+ // shown on screen: 20 should be ok everywhere as even with 15 pixel high
+ // characters it is still only 300 pixels...
+ static const int maxLines = 20;
+ const int count = stackTrace.Freq(wxT('\n'));
+ for ( int i = 0; i < count - maxLines; i++ )
+ stackTrace = stackTrace.BeforeLast(wxT('\n'));
+
+ return stackTrace;
+}
+#endif // wxUSE_STACKWALKER
+
+// show the assert modal dialog
+static
+void ShowAssertDialog(const wxChar *szFile,
+ int nLine,
+ const wxChar *szCond,
+ const wxChar *szMsg,
+ wxAppTraits *traits)
+{
+ // this variable can be set to true to suppress "assert failure" messages
+ static bool s_bNoAsserts = false;
+
+ wxString msg;
+ msg.reserve(2048);
+
+ // make life easier for people using VC++ IDE by using this format: like
+ // this, clicking on the message will take us immediately to the place of
+ // the failed assert
+ msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
+
+ if ( szMsg )
+ {
+ msg << _T(": ") << szMsg;
+ }
+ else // no message given
+ {
+ msg << _T('.');
+ }
+
+#if wxUSE_STACKWALKER
+ const wxString stackTrace = GetAssertStackTrace();