]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/docview/docview.cpp
Run MBConvTestCase::LibcTests() only for MSVC and not other Windows compilers.
[wxWidgets.git] / samples / docview / docview.cpp
index c3faa822f0ac6e9c10bf1f5d03828a094efa9a2b..d69c597feb47b7f9bf1ef4d63ce3d90141a1412e 100644 (file)
@@ -7,7 +7,7 @@
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Julian Smart
 //              (c) 2008 Vadim Zeitlin
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 /*
@@ -148,6 +148,8 @@ bool MyApp::OnInit()
     if ( !wxApp::OnInit() )
         return false;
 
+    ::wxInitAllImageHandlers();
+
     SetAppName("DocView Sample");
 
     //// Create a document manager
@@ -157,7 +159,7 @@ bool MyApp::OnInit()
     new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
                       "Drawing Doc", "Drawing View",
                       CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
-#ifdef __WXMAC__ && wxOSX_USE_CARBON
+#if defined( __WXMAC__ )  && wxOSX_USE_CARBON
     wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA');
 #endif
 
@@ -173,9 +175,13 @@ bool MyApp::OnInit()
         new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
                           "Text Doc", "Text View",
                           CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
-#ifdef __WXMAC__ && wxOSX_USE_CARBON
+#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
         wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA');
 #endif
+        // Create a template relating image documents to their views
+        new wxDocTemplate(docManager, "Image", "*.png;*.jpg", "", "png;jpg",
+                          "Image Doc", "Image View",
+                          CLASSINFO(ImageDocument), CLASSINFO(ImageView));
     }
 
     // create the main frame window
@@ -216,6 +222,7 @@ bool MyApp::OnInit()
     {
         m_canvas = new MyCanvas(NULL, frame);
         m_menuEdit = CreateDrawingEditMenu();
+        docManager->CreateNewDocument();
     }
 
     CreateMenuBarForFrame(frame, menuFile, m_menuEdit);
@@ -240,6 +247,7 @@ void MyApp::AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting)
     menu->Append(wxID_CLOSE);
     menu->Append(wxID_SAVE);
     menu->Append(wxID_SAVEAS);
+    menu->Append(wxID_REVERT, _("Re&vert..."));
 
     if ( supportsPrinting )
     {