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 double GetCurCPM(); // App may want to display characters per minute 00093 double GetCurFPS(); // or frames per second. 00094 00095 // Customize alphabet 00096 void GetAlphabets(std::vector< std::string >* AlphabetList); 00097 const CAlphIO::AlphInfo& GetInfo(const std::string& AlphID); 00098 void SetInfo(const CAlphIO::AlphInfo& NewInfo); 00099 void DeleteAlphabet(const std::string& AlphID); 00100 00101 // Settings Interface (options saved between sessions) 00102 // ----------------------------------------------------- 00103 00104 void ChangeAlphabet(const std::string& NewAlphabetID); 00105 void ChangeMaxBitRate(double NewMaxBitRate); 00106 void ChangeLanguageModel(unsigned int NewLanguageModelID); 00107 void ChangeView(unsigned int NewViewID); 00108 void ChangeOrientation(Opts::ScreenOrientations Orientation); 00109 void SetFileEncoding(Opts::FileEncodingFormats Encoding); 00110 // TODO Color customization. 00111 00112 void ShowToolbar(bool Value); 00113 void ShowToolbarText(bool Value); 00114 void ShowToolbarLargeIcons(bool Value); 00115 void ShowSpeedSlider(bool Value); 00116 void FixLayout(bool Value); 00117 void TimeStampNewFiles(bool Value); 00118 void CopyAllOnStop(bool Value); 00119 void SetEditFont(std::string Name, long Size); 00120 void SetDasherFont(std::string Name); 00121 void SetDasherFontSize(FontSize fontsize); 00122 void SetDimensions(long dimensions); 00123 00124 private: 00125 CAlphabet* m_Alphabet; 00126 CLanguageModel* m_LanguageModel; 00127 CDasherModel* m_DasherModel; 00128 CDashEditbox* m_DashEditbox; 00129 CDasherScreen* m_DasherScreen; 00130 CDasherView* m_DasherView; 00131 CSettingsStore* m_SettingsStore; 00132 CDasherSettingsInterface* m_SettingsUI; 00133 CAlphIO* m_AlphIO; 00134 00135 CLanguageModel::CNodeContext* TrainContext; 00136 00137 std::string AlphabetID; 00138 int LanguageModelID; 00139 int ViewID; 00140 double m_MaxBitRate; 00141 bool m_CopyAllOnStop; 00142 Opts::ScreenOrientations m_Orientation; 00143 std::string m_UserLocation; 00144 std::string m_SystemLocation; 00145 std::string m_TrainFile; 00146 std::string m_DasherFont; 00147 std::string m_EditFont; 00148 int m_EditFontSize; 00149 static const std::string EmptyString; 00150 00151 void CreateDasherModel(); 00152 }; 00153 00154 00155 #endif /* #ifndef __DasherInterface_h__ */
1.3-rc3