[dasher] Carry on excision of Factories, renaming Create{, Local}Factories



commit a37475db00fcc00c0b418d7d7eb243c76a035f7d
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Thu May 14 17:38:39 2009 +0100

    Carry on excision of Factories, renaming Create{,Local}Factories
    to CreateModules. Class' CreateModules is "Local" and usually calls
    DasherInterfaceBase::CreateModules to load the defaults if it wants
    to override it.
---
 ChangeLog                              |    7 +++++++
 Src/DasherCore/DasherInterfaceBase.cpp |    5 ++---
 Src/DasherCore/DasherInterfaceBase.h   |   16 +++++++---------
 Src/Gtk2/DasherControl.cpp             |    3 ++-
 Src/Gtk2/DasherControl.h               |    2 +-
 Src/MacOSX/COSXDasherControl.mm        |    3 ++-
 Src/MacOSX/TODO                        |    2 +-
 Src/Win32/Dasher.cpp                   |    4 +++-
 Src/Win32/Dasher.h                     |    2 +-
 9 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index adcff0a..3678cea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-14  Alan Lawrence <acl33 inf phy cam ac uk>
+
+	* Carry on excision of Factories, renaming Create{,Local}Factories
+	to CreateModules. Class' CreateModules is "Local" and usually calls
+	DasherInterfaceBase::CreateModules to load the defaults if it wants
+	to override it.
+
 2009-05-14  Patrick Welche  <prlw1 cam ac uk>
 
 	* configure.ac, main.cc: Dasher no longer depends directly
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index 8700845..20a9c4e 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -159,8 +159,7 @@ void CDasherInterfaceBase::Realize() {
   m_pUserLog = NULL;
 #endif
 
-  CreateFactories();
-  CreateLocalFactories();
+  CreateModules();
 
   CreateInput();
   CreateInputFilter();
@@ -936,7 +935,7 @@ void CDasherInterfaceBase::SetDefaultInputMethod(CDasherModule *pModule) {
     m_oModuleManager.SetDefaultInputMethod(pModule);
 }
 
-void CDasherInterfaceBase::CreateFactories() {
+void CDasherInterfaceBase::CreateModules() {
   SetDefaultInputMethod(
     RegisterModule(new CDefaultFilter(m_pEventHandler, m_pSettingsStore, this, m_pDasherModel,3, _("Normal Control")))
   );
diff --git a/Src/DasherCore/DasherInterfaceBase.h b/Src/DasherCore/DasherInterfaceBase.h
index a615505..2321abf 100644
--- a/Src/DasherCore/DasherInterfaceBase.h
+++ b/Src/DasherCore/DasherInterfaceBase.h
@@ -393,6 +393,12 @@ protected:
   ///
 
   void OnUIRealised();
+	
+  ///
+  /// Creates a default set of modules. Override in subclasses to create any
+  /// extra/different modules specific to the platform (eg input device drivers)
+  ///	
+  virtual void CreateModules();
 
   /// @}
 
@@ -475,13 +481,6 @@ protected:
   virtual void SetupUI() = 0;
 
   ///
-  /// Create any module factories which are specific to the platform
-  /// (eg input device drivers)
-  ///
-
-  virtual void CreateLocalFactories() = 0;
-
-  ///
   /// Create settings store object, which will be platform dependent
   /// TODO: Can this not be done just by selecting which settings
   /// store implementation to instantiate?
@@ -524,8 +523,7 @@ protected:
   /// Provide a new CDasherInput input device object.
 
   void CreateInput();
-
-  void CreateFactories();
+	
   void CreateInputFilter();
 
   void CreateModel(int iOffset);
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index c76920f..fcd26c8 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -45,7 +45,8 @@ CDasherControl::CDasherControl(GtkVBox *pVBox, GtkDasherControl *pDasherControl)
   //  m_pKeyboardHelper->Grab(GetBoolParameter(BP_GLOBAL_KEYBOARD));
 }
 
-void CDasherControl::CreateLocalFactories() {
+void CDasherControl::CreateModules() {
+  CDasherInterfaceBase::CreateModules(); //create default set first
   // Create locally cached copies of the mouse input objects, as we
   // need to pass coordinates to them from the timer callback
   m_pMouseInput =
diff --git a/Src/Gtk2/DasherControl.h b/Src/Gtk2/DasherControl.h
index 584abe2..7a3ab37 100644
--- a/Src/Gtk2/DasherControl.h
+++ b/Src/Gtk2/DasherControl.h
@@ -133,7 +133,7 @@ private:
   virtual void ScanAlphabetFiles(std::vector<std::string> &vFileList);
   virtual void ScanColourFiles(std::vector<std::string> &vFileList);
   virtual void SetupPaths();
-  virtual void CreateLocalFactories();
+  virtual void CreateModules();
   virtual void SetupUI();
   virtual void CreateSettingsStore();
   virtual int GetFileSize(const std::string &strFileName);
diff --git a/Src/MacOSX/COSXDasherControl.mm b/Src/MacOSX/COSXDasherControl.mm
index 54356ea..3b29147 100644
--- a/Src/MacOSX/COSXDasherControl.mm
+++ b/Src/MacOSX/COSXDasherControl.mm
@@ -38,7 +38,8 @@ COSXDasherControl::COSXDasherControl(DasherApp *aDasherApp) {
   
 }
 
-void COSXDasherControl::CreateLocalFactories() {
+void COSXDasherControl::CreateModules() {
+  CDasherInterfaceBase::CreateModules();
   // Create locally cached copies of the mouse input objects, as we
   // need to pass coordinates to them from the timer callback
   m_pMouseInput =
diff --git a/Src/MacOSX/TODO b/Src/MacOSX/TODO
index 6e24caf..566f37d 100644
--- a/Src/MacOSX/TODO
+++ b/Src/MacOSX/TODO
@@ -14,7 +14,7 @@ under 'Platform dependent utility functions'. The GTK implementation of these is
 
 Having created the custom UI component derived from CDasherInterfaceBase, embed it in the rest of the user interface as normal. Communication into the core is mainly through setting parameters (eg CDasherInterfaceBase::SetBoolParameter), which should cause instantaneous changes to Dasher's state. See Parameters.h for a list of all parameters (some of which are obsolete I'm afraid). Outbound messages are passed through CDasherInterfaceBase::ExternalEventHandler, which receives event objects which are either directly passed to a callback, or translated into platform dependent messages as would be used to eg notify an application that a menu item had been selected.
 
-User input is now via child classes of CDasherInput, which allows a selection of drivers. See mouse_input.h for an example - it's fairly simple. These are instantiated through factory objects, which are created in CDasherInterfaceBase::CreateLocalFactories. The objects themselves are singletons which have a reference in the interface used to update the current coordinates. You'll need to do reference counting here.
+User input is now via child classes of CDasherInput, which allows a selection of drivers. See mouse_input.h for an example - it's fairly simple. These are instantiated in (subclasses ofCDasherInterfaceBase)::CreateModules. The objects themselves are singletons which have a reference in the interface used to update the current coordinates. You'll need to do reference counting here.
 
 
 
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index 6834ea9..8a80f23 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -49,7 +49,9 @@ CDasher::~CDasher(void) {
   delete m_pCanvas;
 }
 
-void CDasher::CreateLocalFactories() {
+void CDasher::CreateModules() {
+  //create default set first.
+  CDasherInterfaceBase::CreateModules();
 #ifndef _WIN32_WCE
   RegisterModule(new CSocketInput(m_pEventHandler, m_pSettingsStore));
   RegisterModule(new CBTSocketInput(m_pEventHandler, m_pSettingsStore));
diff --git a/Src/Win32/Dasher.h b/Src/Win32/Dasher.h
index 5b10f49..d8100a9 100644
--- a/Src/Win32/Dasher.h
+++ b/Src/Win32/Dasher.h
@@ -56,7 +56,7 @@ private:
   virtual void ScanColourFiles(std::vector<std::string> &vFileList);
   virtual void SetupPaths();
   virtual void SetupUI();
-  virtual void CreateLocalFactories();
+  virtual void CreateModules();
   virtual void StartTimer();
   virtual void ShutdownTimer();
   void CreateSettingsStore();



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