summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherInterface.h
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherInterface.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherInterface.h170
1 files changed, 170 insertions, 0 deletions
diff --git a/inputmethods/dasher/DasherInterface.h b/inputmethods/dasher/DasherInterface.h
new file mode 100644
index 0000000..6338801
--- a/dev/null
+++ b/inputmethods/dasher/DasherInterface.h
@@ -0,0 +1,170 @@
1// DasherInterface.h
2//
3/////////////////////////////////////////////////////////////////////////////
4//
5// Copyright (c) 2002 Iain Murray
6//
7/////////////////////////////////////////////////////////////////////////////
8
9
10
11#ifndef __DasherInterface_h__
12#define __DasherInterface_h__
13
14// TODO - there is a list of things to be configurable in my notes
15// Check that everything that is not self-contained within the GUI is covered.
16
17#include "MSVC_Unannoy.h"
18#include "NoClones.h"
19
20#include "DasherWidgetInterface.h"
21#include "DasherAppInterface.h"
22#include "DasherSettingsInterface.h"
23
24#include "DasherScreen.h"
25#include "Alphabet.h"
26#include "AlphIO.h"
27#include "LanguageModel.h"
28#include "DasherModel.h"
29#include "DashEdit.h"
30#include "DasherView.h"
31
32#include "MSVC_Unannoy.h"
33#include <map>
34
35namespace Dasher {class CDasherInterface;}
36class Dasher::CDasherInterface : private NoClones,
37 public CDasherWidgetInterface, public CDasherAppInterface, public CDasherSettingsInterface
38{
39public:
40 CDasherInterface();
41 ~CDasherInterface();
42
43 //! Tell the core which CSettingsStore should be used
44 void SetSettingsStore(CSettingsStore* SettingsStore);
45
46 //! Tell the core which CDasherSettingsInterface should be used
47 //
48 //! Provide a pointer to an instance of CDasherSettingsInterface in
49 //! order to allow for platform dependent configuration of certain
50 //! options
51 void SetSettingsUI(CDasherSettingsInterface* SettingsUI);
52
53 //! Set the path for user specific configuration and files
54 void SetUserLocation(std::string UserLocation);
55
56 //! Set the path for system-wide configuration and files
57 void SetSystemLocation(std::string SystemLocation);
58
59 // Widget Interface
60 // -----------------------------------------------------
61 void Start();
62
63 void TapOn(int MouseX, int MouseY, unsigned long Time); // Times in milliseconds
64 void PauseAt(int MouseX, int MouseY); // are required to make
65 void Unpause(unsigned long Time); // Dasher run at the
66 void Redraw(); // correct speed.
67
68 void ChangeScreen(); // The widgets need to tell the engine when they have been
69 void ChangeEdit(); // affected by external interaction
70
71 unsigned int GetNumberSymbols(); // These are needed so widgets know
72 const std::string& GetDisplayText(symbol Symbol); // how to render the alphabet. All
73 const std::string& GetEditText(symbol Symbol); // strings are encoded in UTF-8
74 int GetTextColour(symbol Symbol); // the foreground colour of the text
75 Opts::ScreenOrientations GetAlphabetOrientation();
76 Opts::AlphabetTypes GetAlphabetType();
77 const std::string& GetTrainFile();
78
79 // App Interface
80 // -----------------------------------------------------
81
82 // std::map<int, std::string>& GetAlphabets(); // map<key, value> int is a UID string can change. Store UID in preferences. Display string to user.
83 // std::vector<std::string>& GetAlphabets();
84 // std::vector<std::string>& GetLangModels();
85 // std::vector<std::string>& GetViews();
86
87 void ChangeScreen(CDasherScreen* NewScreen); // We may change the widgets Dasher uses
88 void ChangeEdit(CDashEditbox* NewEdit); // at run time.
89
90 void Train(std::string* TrainString, bool IsMore); // Training by string segments or file
91 void TrainFile(std::string Filename); // all training data must be in UTF-8.
92
93 void GetFontSizes(std::vector<int> *FontSizes);
94
95 double GetCurCPM(); // App may want to display characters per minute
96 double GetCurFPS(); // or frames per second.
97
98 // Customize alphabet
99 void GetAlphabets(std::vector< std::string >* AlphabetList);
100 const CAlphIO::AlphInfo& GetInfo(const std::string& AlphID);
101 void SetInfo(const CAlphIO::AlphInfo& NewInfo);
102 void DeleteAlphabet(const std::string& AlphID);
103
104 // Settings Interface (options saved between sessions)
105 // -----------------------------------------------------
106
107 void ChangeAlphabet(const std::string& NewAlphabetID);
108 void ChangeMaxBitRate(double NewMaxBitRate);
109 void ChangeLanguageModel(unsigned int NewLanguageModelID);
110 void ChangeView(unsigned int NewViewID);
111 void ChangeOrientation(Opts::ScreenOrientations Orientation);
112 void SetFileEncoding(Opts::FileEncodingFormats Encoding);
113 // TODO Color customization.
114
115 void ShowToolbar(bool Value);
116 void ShowToolbarText(bool Value);
117 void ShowToolbarLargeIcons(bool Value);
118 void ShowSpeedSlider(bool Value);
119 void FixLayout(bool Value);
120 void TimeStampNewFiles(bool Value);
121 void CopyAllOnStop(bool Value);
122 void DrawMouse(bool Value);
123 void StartOnSpace(bool Value);
124 void StartOnLeft(bool Value);
125 void KeyControl(bool Value);
126 void WindowPause(bool Value);
127 void SetEditFont(std::string Name, long Size);
128 void SetDasherFont(std::string Name);
129 void SetDasherFontSize(FontSize fontsize);
130 void SetDasherDimensions(bool Value);
131
132private:
133 CAlphabet* m_Alphabet;
134 CLanguageModel* m_LanguageModel;
135 CDasherModel* m_DasherModel;
136 CDashEditbox* m_DashEditbox;
137 CDasherScreen* m_DasherScreen;
138 CDasherView* m_DasherView;
139 CSettingsStore* m_SettingsStore;
140 CDasherSettingsInterface* m_SettingsUI;
141 CAlphIO* m_AlphIO;
142
143 CLanguageModel::CNodeContext* TrainContext;
144
145 std::string AlphabetID;
146 int LanguageModelID;
147 int ViewID;
148 double m_MaxBitRate;
149 bool m_CopyAllOnStop;
150 bool m_DrawMouse;
151 bool m_DrawKeyboard;
152 bool m_StartSpace;
153 bool m_StartLeft;
154 bool m_KeyControl;
155 bool m_Dimensions;
156 bool m_WindowPause;
157 Opts::ScreenOrientations m_Orientation;
158 std::string m_UserLocation;
159 std::string m_SystemLocation;
160 std::string m_TrainFile;
161 std::string m_DasherFont;
162 std::string m_EditFont;
163 int m_EditFontSize;
164 static const std::string EmptyString;
165
166 void CreateDasherModel();
167};
168
169
170#endif /* #ifndef __DasherInterface_h__ */