lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH 3/5] Move wxApp implementation from lmi_wx_lib to executabl


From: Václav Slavík
Subject: [lmi] [PATCH 3/5] Move wxApp implementation from lmi_wx_lib to executable.
Date: Tue, 18 Feb 2014 18:14:50 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hi,

this one make further small changes that could conflict with unrelated
future changes made on the trunk:

Move wxApp implementation from lmi_wx_lib to executable.

This makes it possible to derive a testing-only app with some tweaks.
There was one use of wxGetApp() in LMI code, which had to be replaced
with wxApp::GetInstance().
---
 main_wx.cpp  | 3 +++
 skeleton.cpp | 3 ---
 skeleton.hpp | 2 --
 view_ex.cpp  | 7 +++++--
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/main_wx.cpp b/main_wx.cpp
index 453bf2b..3f2e875 100644
--- a/main_wx.cpp
+++ b/main_wx.cpp
@@ -47,6 +47,9 @@
 
 #include <wx/defs.h> // for wx_dependent_objects in workhorse.make
 
+IMPLEMENT_APP_NO_MAIN(Skeleton)
+IMPLEMENT_WX_THEME_SUPPORT
+
 #ifndef LMI_MSW
 int main(int argc, char* argv[])
 #else // LMI_MSW defined.
diff --git a/skeleton.cpp b/skeleton.cpp
index dd46ed5..7d64dfd 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -107,9 +107,6 @@
 #   include <gtk/gtk.h>
 #endif
 
-IMPLEMENT_APP_NO_MAIN(Skeleton)
-IMPLEMENT_WX_THEME_SUPPORT
-
 // Where a builtin wxID_X identifier exists, use it as such, even if
 // it's used as the 'name=' attribute of an entity in an '.xrc' file.
 // For example, write 'wxID_SAVE' here, not 'XRCID("wxID_SAVE")'.
diff --git a/skeleton.hpp b/skeleton.hpp
index 11b144e..9598305 100644
--- a/skeleton.hpp
+++ b/skeleton.hpp
@@ -128,7 +128,5 @@ class Skeleton
     DECLARE_EVENT_TABLE()
 };
 
-DECLARE_APP(Skeleton)
-
 #endif // skeleton_hpp
 
diff --git a/view_ex.cpp b/view_ex.cpp
index f506117..a30fcc0 100644
--- a/view_ex.cpp
+++ b/view_ex.cpp
@@ -48,7 +48,7 @@
 #include "alert.hpp"
 #include "assert_lmi.hpp"
 #include "docmanager_ex.hpp"
-#include "skeleton.hpp" // wxGetApp()
+#include "skeleton.hpp" // Skeleton::CreateChildFrame()
 #include "safely_dereference_as.hpp"
 #include "wx_new.hpp"
 
@@ -152,7 +152,10 @@ bool ViewEx::OnClose(bool delete_window)
 //
 bool ViewEx::OnCreate(wxDocument* doc, long int)
 {
-    wxGetApp().CreateChildFrame(doc, this);
+    Skeleton* app = dynamic_cast<Skeleton*>(wxApp::GetInstance());
+    LMI_ASSERT(app);
+    app->CreateChildFrame(doc, this);
+
     DocManager().AssociateFileHistoryWithFileMenu(FrameWindow().GetMenuBar());
     GetFrame()->SetLabel("Loading document...");
 
-- 
1.8.5.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]