Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

DasherInterface.h

Go to the documentation of this file.
00001 // DasherInterface.h
00002 //
00004 //
00005 // Copyright (c) 2002 Iain Murray
00006 //
00008 
00009 
00010 
00011 #ifndef __DasherInterface_h__
00012 #define __DasherInterface_h__
00013 
00014 // TODO - there is a list of things to be configurable in my notes
00015 // Check that everything that is not self-contained within the GUI is covered.
00016 
00017 #include "../Common/MSVC_Unannoy.h"
00018 #include "../Common/NoClones.h"
00019 
00020 #include "DasherWidgetInterface.h"
00021 #include "DasherAppInterface.h"
00022 #include "DasherSettingsInterface.h"
00023 
00024 #include "DasherScreen.h"
00025 #include "Alphabet.h"
00026 #include "AlphIO.h"
00027 #include "LanguageModel.h"
00028 #include "DasherModel.h"
00029 #include "DashEdit.h"
00030 #include "DasherView.h"
00031 
00032 #include "../Common/MSVC_Unannoy.h"
00033 #include <map>
00034 
00035 namespace Dasher {class CDasherInterface;}
00036 class Dasher::CDasherInterface : private NoClones,
00037         public CDasherWidgetInterface, public CDasherAppInterface, public CDasherSettingsInterface
00038 {
00039 public:
00040         CDasherInterface();
00041         ~CDasherInterface();
00042 
00044         void SetSettingsStore(CSettingsStore* SettingsStore);
00045 
00047         //
00051         void SetSettingsUI(CDasherSettingsInterface* SettingsUI);
00052         
00054         void SetUserLocation(std::string UserLocation);
00055 
00057         void SetSystemLocation(std::string SystemLocation);
00058         
00059         // Widget Interface
00060         // -----------------------------------------------------
00061         void Start();
00062         
00063         void TapOn(int MouseX, int MouseY, unsigned long Time); // Times in milliseconds
00064         void PauseAt(int MouseX, int MouseY);                   // are required to make
00065         void Unpause(unsigned long Time);                       // Dasher run at the
00066         void Redraw();                                          // correct speed.
00067         
00068         void ChangeScreen(); // The widgets need to tell the engine when they have been
00069         void ChangeEdit();   // affected by external interaction
00070         
00071         unsigned int GetNumberSymbols();           // These are needed so widgets know
00072         const std::string& GetDisplayText(symbol Symbol); // how to render the alphabet. All
00073         const std::string& GetEditText(symbol Symbol);    // strings are encoded in UTF-8
00074         Opts::ScreenOrientations GetAlphabetOrientation();
00075         Opts::AlphabetTypes GetAlphabetType();
00076         const std::string& GetTrainFile();
00077         
00078         // App Interface
00079         // -----------------------------------------------------
00080         
00081         // std::map<int, std::string>& GetAlphabets(); // map<key, value> int is a UID string can change. Store UID in preferences. Display string to user.
00082         // std::vector<std::string>& GetAlphabets();
00083         // std::vector<std::string>& GetLangModels();
00084         // std::vector<std::string>& GetViews();
00085         
00086         void ChangeScreen(CDasherScreen* NewScreen); // We may change the widgets Dasher uses
00087         void ChangeEdit(CDashEditbox* NewEdit);      // at run time.
00088         
00089         void Train(std::string* TrainString, bool IsMore); // Training by string segments or file
00090         void TrainFile(std::string Filename);              // all training data must be in UTF-8.
00091 
00092         void GetFontSizes(std::vector<int> *FontSizes);
00093         
00094         double GetCurCPM(); // App may want to display characters per minute
00095         double GetCurFPS(); // or frames per second.
00096         
00097         // Customize alphabet
00098         void GetAlphabets(std::vector< std::string >* AlphabetList);
00099         const CAlphIO::AlphInfo& GetInfo(const std::string& AlphID);
00100         void SetInfo(const CAlphIO::AlphInfo& NewInfo);
00101         void DeleteAlphabet(const std::string& AlphID);
00102         
00103         // Settings Interface (options saved between sessions)
00104         // -----------------------------------------------------
00105         
00106         void ChangeAlphabet(const std::string& NewAlphabetID);
00107         void ChangeMaxBitRate(double NewMaxBitRate);
00108         void ChangeLanguageModel(unsigned int NewLanguageModelID);
00109         void ChangeView(unsigned int NewViewID);
00110         void ChangeOrientation(Opts::ScreenOrientations Orientation);
00111         void SetFileEncoding(Opts::FileEncodingFormats Encoding);
00112         // TODO Color customization.
00113         
00114         void ShowToolbar(bool Value);
00115         void ShowToolbarText(bool Value);
00116         void ShowToolbarLargeIcons(bool Value);
00117         void ShowSpeedSlider(bool Value);
00118         void FixLayout(bool Value);
00119         void TimeStampNewFiles(bool Value);
00120         void CopyAllOnStop(bool Value);
00121         void DrawMouse(bool Value);
00122         void StartOnSpace(bool Value);
00123         void StartOnLeft(bool Value);
00124         void SetEditFont(std::string Name, long Size);
00125         void SetDasherFont(std::string Name);
00126         void SetDasherFontSize(FontSize fontsize);
00127         void SetDasherDimensions(bool Value);
00128 
00129 private:
00130         CAlphabet* m_Alphabet;
00131         CLanguageModel* m_LanguageModel;
00132         CDasherModel* m_DasherModel;
00133         CDashEditbox* m_DashEditbox;
00134         CDasherScreen* m_DasherScreen;
00135         CDasherView* m_DasherView;
00136         CSettingsStore* m_SettingsStore;
00137         CDasherSettingsInterface* m_SettingsUI;
00138         CAlphIO* m_AlphIO;
00139         
00140         CLanguageModel::CNodeContext* TrainContext;
00141         
00142         std::string AlphabetID;
00143         int LanguageModelID;
00144         int ViewID;
00145         double m_MaxBitRate;
00146         bool m_CopyAllOnStop;
00147         bool m_DrawMouse;
00148         bool m_StartSpace;
00149         bool m_StartLeft;
00150         bool m_Dimensions;
00151         Opts::ScreenOrientations m_Orientation;
00152         std::string m_UserLocation;
00153         std::string m_SystemLocation;
00154         std::string m_TrainFile;
00155         std::string m_DasherFont;
00156         std::string m_EditFont;
00157         int m_EditFontSize;
00158         static const std::string EmptyString;
00159         
00160         void CreateDasherModel();
00161 };
00162 
00163 
00164 #endif /* #ifndef __DasherInterface_h__ */

Generated on Fri Mar 14 15:47:09 2003 for Dasher by doxygen1.3-rc3