]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/debugrpt/debugrpt.cpp
Remove the unused code instead of commenting it out.
[wxWidgets.git] / samples / debugrpt / debugrpt.cpp
index 1125ff6cfa797cd6c7b8591ea43417199e4d95ca..7a1f9c83a35ad5cdf4cda737a220b647281cfbbd 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2005-01-20
 // RCS-ID:      $Id$
 // Copyright:   (c) 2005 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// License:     wxWindows licence
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ----------------------------------------------------------------------------
@@ -35,7 +35,7 @@
     #error "This sample can't be built without wxUSE_ON_FATAL_EXCEPTION"
 #endif // wxUSE_ON_FATAL_EXCEPTION
 
-#if !defined(__WXMSW__) && !defined(__WXPM__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
     #include "../sample.xpm"
 #endif
 
@@ -51,9 +51,9 @@ class MyDebugReport : public wxDebugReportUpload
 public:
     MyDebugReport() : wxDebugReportUpload
                        (
-                        _T("http://your.url.here/"),
-                        _T("report:file"),
-                        _T("action")
+                        wxT("http://your.url.here/"),
+                        wxT("report:file"),
+                        wxT("action")
                        )
     {
     }
@@ -66,19 +66,19 @@ protected:
     {
         if ( reply.IsEmpty() )
         {
-            wxLogError(_T("Didn't receive the expected server reply."));
+            wxLogError(wxT("Didn't receive the expected server reply."));
             return false;
         }
 
-        wxString s(_T("Server replied:\n"));
+        wxString s(wxT("Server replied:\n"));
 
         const size_t count = reply.GetCount();
         for ( size_t n = 0; n < count; n++ )
         {
-            s << _T('\t') << reply[n] << _T('\n');
+            s << wxT('\t') << reply[n] << wxT('\n');
         }
 
-        wxLogMessage(_T("%s"), s.c_str());
+        wxLogMessage(wxT("%s"), s.c_str());
 
         return true;
     }
@@ -97,12 +97,12 @@ public:
     {
         if ( !wxDebugReportCompress::DoProcess() )
             return false;
-        wxMailMessage msg(GetReportName() + _T(" crash report"),
-                          _T("vadim@wxwindows.org"),
+        wxMailMessage msg(GetReportName() + wxT(" crash report"),
+                          wxT("vadim@wxwindows.org"),
                           wxEmptyString, // mail body
                           wxEmptyString, // from address
                           GetCompressedFileName(),
-                          _T("crashreport.zip"));
+                          wxT("crashreport.zip"));
 
         return wxEmail::Send(msg);
     }
@@ -115,7 +115,7 @@ public:
 // ----------------------------------------------------------------------------
 
 // just some functions to get a slightly deeper stack trace
-static void bar(const wxChar *p)
+static void bar(const char *p)
 {
     char *pc = 0;
     *pc = *p;
@@ -131,9 +131,9 @@ void baz(const wxString& s)
 void foo(int n)
 {
     if ( n % 2 )
-        baz(wxT("odd"));
+        baz("odd");
     else
-        bar(wxT("even"));
+        bar("even");
 }
 
 // ----------------------------------------------------------------------------
@@ -169,7 +169,7 @@ private:
     // number of lines drawn in OnPaint()
     int m_numLines;
 
-    DECLARE_NO_COPY_CLASS(MyFrame)
+    wxDECLARE_NO_COPY_CLASS(MyFrame);
     DECLARE_EVENT_TABLE()
 };
 
@@ -204,7 +204,7 @@ public:
 private:
     bool m_uploadReport;
 
-    DECLARE_NO_COPY_CLASS(MyApp)
+    wxDECLARE_NO_COPY_CLASS(MyApp);
 };
 
 IMPLEMENT_APP(MyApp)
@@ -229,33 +229,34 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 END_EVENT_TABLE()
 
 MyFrame::MyFrame()
-       : wxFrame(NULL, wxID_ANY, _T("wxWidgets Debug Report Sample"))
+       : wxFrame(NULL, wxID_ANY, wxT("wxWidgets Debug Report Sample"),
+                 wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE)
 {
     m_numLines = 10;
 
     SetIcon(wxICON(sample));
 
     wxMenu *menuFile = new wxMenu;
-    menuFile->Append(DebugRpt_Quit, _T("E&xit\tAlt-X"));
+    menuFile->Append(DebugRpt_Quit, wxT("E&xit\tAlt-X"));
 
     wxMenu *menuReport = new wxMenu;
-    menuReport->Append(DebugRpt_Crash, _T("Report for &crash\tCtrl-C"),
-                       _T("Provoke a crash inside the program and create report for it"));
-    menuReport->Append(DebugRpt_Current, _T("Report for c&urrent context\tCtrl-U"),
-                       _T("Create report for the current program context"));
-    menuReport->Append(DebugRpt_Paint, _T("Report for &paint handler\tCtrl-P"),
-                       _T("Provoke a repeatable crash in wxEVT_PAINT handler"));
+    menuReport->Append(DebugRpt_Crash, wxT("Report for &crash\tCtrl-C"),
+                       wxT("Provoke a crash inside the program and create report for it"));
+    menuReport->Append(DebugRpt_Current, wxT("Report for c&urrent context\tCtrl-U"),
+                       wxT("Create report for the current program context"));
+    menuReport->Append(DebugRpt_Paint, wxT("Report for &paint handler\tCtrl-P"),
+                       wxT("Provoke a repeatable crash in wxEVT_PAINT handler"));
     menuReport->AppendSeparator();
-    menuReport->AppendCheckItem(DebugRpt_Upload, _T("Up&load debug report"),
-                       _T("You need to configure a web server accepting debug report uploads to use this function"));
+    menuReport->AppendCheckItem(DebugRpt_Upload, wxT("Up&load debug report"),
+                       wxT("You need to configure a web server accepting debug report uploads to use this function"));
 
     wxMenu *menuHelp = new wxMenu;
-    menuHelp->Append(DebugRpt_About, _T("&About...\tF1"));
+    menuHelp->Append(DebugRpt_About, wxT("&About\tF1"));
 
     wxMenuBar *mbar = new wxMenuBar();
-    mbar->Append(menuFile, _T("&File"));
-    mbar->Append(menuReport, _T("&Report"));
-    mbar->Append(menuHelp, _T("&Help"));
+    mbar->Append(menuFile, wxT("&File"));
+    mbar->Append(menuReport, wxT("&Report"));
+    mbar->Append(menuHelp, wxT("&Help"));
     SetMenuBar(mbar);
 
     CreateStatusBar();
@@ -300,8 +301,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     wxMessageBox
     (
-        _T("wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>"),
-        _T("wxWidgets Debug Report Sample"),
+        wxT("wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>"),
+        wxT("wxWidgets Debug Report Sample"),
         wxOK | wxICON_INFORMATION,
         this
     );
@@ -321,7 +322,7 @@ void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
 
 MyApp::MyApp()
 {
-    // user needs to explicitely enable this
+    // user needs to explicitly enable this
     m_uploadReport = false;
 
     // call this to tell the library to call our OnFatalException()
@@ -355,23 +356,23 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
     // you can also call report->AddFile(...) with your own log files, files
     // created using wxRegKey::Export() and so on, here we just add a test
     // file containing the date of the crash
-    wxFileName fn(report->GetDirectory(), _T("timestamp.my"));
-    wxFFile file(fn.GetFullPath(), _T("w"));
+    wxFileName fn(report->GetDirectory(), wxT("timestamp.my"));
+    wxFFile file(fn.GetFullPath(), wxT("w"));
     if ( file.IsOpened() )
     {
         wxDateTime dt = wxDateTime::Now();
-        file.Write(dt.FormatISODate() + _T(' ') + dt.FormatISOTime());
+        file.Write(dt.FormatISODate() + wxT(' ') + dt.FormatISOTime());
         file.Close();
     }
 
-    report->AddFile(fn.GetFullName(), _T("timestamp of this report"));
+    report->AddFile(fn.GetFullName(), wxT("timestamp of this report"));
 
     // can also add an existing file directly, it will be copied
     // automatically
 #ifdef __WXMSW__
-    report->AddFile(_T("c:\\autoexec.bat"), _T("DOS startup file"));
+    report->AddFile(wxT("c:\\autoexec.bat"), wxT("DOS startup file"));
 #else
-    report->AddFile(_T("/etc/motd"), _T("Message of the day"));
+    report->AddFile(wxT("/etc/motd"), wxT("Message of the day"));
 #endif
 
     // calling Show() is not mandatory, but is more polite
@@ -381,11 +382,11 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
         {
             if ( m_uploadReport )
             {
-                wxLogMessage(_T("Report successfully uploaded."));
+                wxLogMessage(wxT("Report successfully uploaded."));
             }
             else
             {
-                wxLogMessage(_T("Report generated in \"%s\"."),
+                wxLogMessage(wxT("Report generated in \"%s\"."),
                              report->GetCompressedFileName().c_str());
                 report->Reset();
             }