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 "MSVC_Unannoy.h" 00018 #include "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 "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 virtual ~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 int GetTextColour(symbol Symbol); // the foreground colour of the text 00075 Opts::ScreenOrientations GetAlphabetOrientation(); 00076 Opts::AlphabetTypes GetAlphabetType(); 00077 const std::string& GetTrainFile(); 00078 00079 // App Interface 00080 // ----------------------------------------------------- 00081 00082 // std::map<int, std::string>& GetAlphabets(); // map<key, value> int is a UID string can change. Store UID in preferences. Display string to user. 00083 // std::vector<std::string>& GetAlphabets(); 00084 // std::vector<std::string>& GetLangModels(); 00085 // std::vector<std::string>& GetViews(); 00086 00087 void ChangeScreen(CDasherScreen* NewScreen); // We may change the widgets Dasher uses 00088 void ChangeEdit(CDashEditbox* NewEdit); // at run time. 00089 00090 void Train(std::string* TrainString, bool IsMore); // Training by string segments or file 00091 void TrainFile(std::string Filename); // all training data must be in UTF-8. 00092 00093 void GetFontSizes(std::vector<int> *FontSizes); 00094 00095 double GetCurCPM(); // App may want to display characters per minute 00096 double GetCurFPS(); // or frames per second. 00097 00098 // Customize alphabet 00099 void GetAlphabets(std::vector< std::string >* AlphabetList); 00100 const CAlphIO::AlphInfo& GetInfo(const std::string& AlphID); 00101 void SetInfo(const CAlphIO::AlphInfo& NewInfo); 00102 void DeleteAlphabet(const std::string& AlphID); 00103 00104 // Settings Interface (options saved between sessions) 00105 // ----------------------------------------------------- 00106 00107 void ChangeAlphabet(const std::string& NewAlphabetID); 00108 void ChangeMaxBitRate(double NewMaxBitRate); 00109 void ChangeLanguageModel(unsigned int NewLanguageModelID); 00110 void ChangeView(unsigned int NewViewID); 00111 void ChangeOrientation(Opts::ScreenOrientations Orientation); 00112 void SetFileEncoding(Opts::FileEncodingFormats Encoding); 00113 // TODO Color customization. 00114 00115 void ShowToolbar(bool Value); 00116 void ShowToolbarText(bool Value); 00117 void ShowToolbarLargeIcons(bool Value); 00118 void ShowSpeedSlider(bool Value); 00119 void FixLayout(bool Value); 00120 void TimeStampNewFiles(bool Value); 00121 void CopyAllOnStop(bool Value); 00122 void DrawMouse(bool Value); 00123 void StartOnSpace(bool Value); 00124 void StartOnLeft(bool Value); 00125 void KeyControl(bool Value); 00126 void WindowPause(bool Value); 00127 void SetEditFont(std::string Name, long Size); 00128 void SetDasherFont(std::string Name); 00129 void SetDasherFontSize(FontSize fontsize); 00130 void SetDasherDimensions(bool Value); 00131 00132 private: 00133 CAlphabet* m_Alphabet; 00134 CLanguageModel* m_LanguageModel; 00135 CDasherModel* m_DasherModel; 00136 CDashEditbox* m_DashEditbox; 00137 CDasherScreen* m_DasherScreen; 00138 CDasherView* m_DasherView; 00139 CSettingsStore* m_SettingsStore; 00140 CDasherSettingsInterface* m_SettingsUI; 00141 CAlphIO* m_AlphIO; 00142 00143 CLanguageModel::CNodeContext* TrainContext; 00144 00145 std::string AlphabetID; 00146 int LanguageModelID; 00147 int ViewID; 00148 double m_MaxBitRate; 00149 bool m_CopyAllOnStop; 00150 bool m_DrawMouse; 00151 bool m_DrawKeyboard; 00152 bool m_StartSpace; 00153 bool m_StartLeft; 00154 bool m_KeyControl; 00155 bool m_Dimensions; 00156 bool m_WindowPause; 00157 Opts::ScreenOrientations m_Orientation; 00158 std::string m_UserLocation; 00159 std::string m_SystemLocation; 00160 std::string m_TrainFile; 00161 std::string m_DasherFont; 00162 std::string m_EditFont; 00163 int m_EditFontSize; 00164 static const std::string EmptyString; 00165 00166 void CreateDasherModel(); 00167 }; 00168 00169 00170 #endif /* #ifndef __DasherInterface_h__ */
1.4.2