summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherInterface.cpp
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherInterface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherInterface.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/inputmethods/dasher/DasherInterface.cpp b/inputmethods/dasher/DasherInterface.cpp
index bb5b85e..4699687 100644
--- a/inputmethods/dasher/DasherInterface.cpp
+++ b/inputmethods/dasher/DasherInterface.cpp
@@ -1,80 +1,97 @@
1// DasherInterface.cpp 1// DasherInterface.cpp
2// 2//
3///////////////////////////////////////////////////////////////////////////// 3/////////////////////////////////////////////////////////////////////////////
4// 4//
5// Copyright (c) 2002 Iain Murray 5// Copyright (c) 2002 Iain Murray
6// 6//
7///////////////////////////////////////////////////////////////////////////// 7/////////////////////////////////////////////////////////////////////////////
8 8
9 9
10 10
11#include "DasherInterface.h" 11#include "DasherInterface.h"
12//#include "EnglishAlphabet.h" 12//#include "EnglishAlphabet.h"
13#include "CustomAlphabet.h" 13#include "CustomAlphabet.h"
14#include "DasherViewSquare.h" 14#include "DasherViewSquare.h"
15#include "PPMLanguageModel.h" 15#include "PPMLanguageModel.h"
16#include <iostream> 16#include <iostream>
17namespace { 17namespace {
18 #include "stdio.h" 18 #include "stdio.h"
19} 19}
20using namespace Dasher; 20using namespace Dasher;
21using namespace std; 21using namespace std;
22 22
23 23
24const string CDasherInterface::EmptyString = ""; 24const string CDasherInterface::EmptyString = "";
25 25
26 26
27CDasherInterface::CDasherInterface() 27CDasherInterface::CDasherInterface()
28 : m_DashEditbox(0), m_DasherScreen(0), m_LanguageModel(0), TrainContext(0), m_Alphabet(0), 28 : m_Alphabet(0),
29 m_DasherModel(0), m_DasherView(0), AlphabetID(""), LanguageModelID(-1), ViewID(-1), 29 m_LanguageModel(0),
30 m_MaxBitRate(-1), m_Orientation(Opts::LeftToRight), m_SettingsStore(0), m_SettingsUI(0), 30 m_DasherModel(0),
31 m_UserLocation("usr_"), m_SystemLocation("sys_"), m_AlphIO(0), m_TrainFile(""), 31 m_DashEditbox(0),
32 m_DasherFont(""), m_EditFont(""), m_EditFontSize(0), m_DrawKeyboard(false) 32 m_DasherScreen(0),
33 m_DasherView(0),
34 m_SettingsStore(0),
35 m_SettingsUI(0),
36 m_AlphIO(0),
37 TrainContext(0),
38 AlphabetID(""),
39 LanguageModelID(-1),
40 ViewID(-1),
41 m_MaxBitRate(-1),
42 m_DrawKeyboard(false),
43 m_Orientation(Opts::LeftToRight),
44 m_UserLocation("usr_"),
45 m_SystemLocation("sys_"),
46 m_TrainFile(""),
47 m_DasherFont(""),
48 m_EditFont(""),
49 m_EditFontSize(0)
33{ 50{
34} 51}
35 52
36 53
37CDasherInterface::~CDasherInterface() 54CDasherInterface::~CDasherInterface()
38{ 55{
39 if (m_LanguageModel) 56 if (m_LanguageModel)
40 m_LanguageModel->ReleaseNodeContext(TrainContext); 57 m_LanguageModel->ReleaseNodeContext(TrainContext);
41 delete m_DasherModel; // The order of some of these deletions matters 58 delete m_DasherModel; // The order of some of these deletions matters
42 delete m_LanguageModel; // eg DasherModel has a pointer to LanguageModel. 59 delete m_LanguageModel; // eg DasherModel has a pointer to LanguageModel.
43 delete m_Alphabet; // DM baulks if LM is deleted before it is. 60 delete m_Alphabet; // DM baulks if LM is deleted before it is.
44 delete m_DasherView; 61 delete m_DasherView;
45 // Do NOT delete Edit box or Screen. This class did not create them. 62 // Do NOT delete Edit box or Screen. This class did not create them.
46} 63}
47 64
48 65
49void CDasherInterface::SetSettingsStore(CSettingsStore* SettingsStore) 66void CDasherInterface::SetSettingsStore(CSettingsStore* SettingsStore)
50{ 67{
51 delete m_SettingsStore; 68 delete m_SettingsStore;
52 m_SettingsStore = SettingsStore; 69 m_SettingsStore = SettingsStore;
53 this->SettingsDefaults(m_SettingsStore); 70 this->SettingsDefaults(m_SettingsStore);
54} 71}
55 72
56 73
57void CDasherInterface::SetSettingsUI(CDasherSettingsInterface* SettingsUI) 74void CDasherInterface::SetSettingsUI(CDasherSettingsInterface* SettingsUI)
58{ 75{
59 delete m_SettingsUI; 76 delete m_SettingsUI;
60 m_SettingsUI = SettingsUI; 77 m_SettingsUI = SettingsUI;
61 //this->SettingsDefaults(m_SettingsStore); 78 //this->SettingsDefaults(m_SettingsStore);
62 m_SettingsUI->SettingsDefaults(m_SettingsStore); 79 m_SettingsUI->SettingsDefaults(m_SettingsStore);
63} 80}
64 81
65 82
66void CDasherInterface::SetUserLocation(std::string UserLocation) 83void CDasherInterface::SetUserLocation(std::string UserLocation)
67{ 84{
68 // Nothing clever updates. (At the moment) it is assumed that 85 // Nothing clever updates. (At the moment) it is assumed that
69 // this is set before anything much happens and that it does 86 // this is set before anything much happens and that it does
70 // not require changing. 87 // not require changing.
71 m_UserLocation = UserLocation; 88 m_UserLocation = UserLocation;
72 if (m_Alphabet!=0) 89 if (m_Alphabet!=0)
73 m_TrainFile = m_UserLocation + m_Alphabet->GetTrainingFile(); 90 m_TrainFile = m_UserLocation + m_Alphabet->GetTrainingFile();
74} 91}
75 92
76 93
77void CDasherInterface::SetSystemLocation(std::string SystemLocation) 94void CDasherInterface::SetSystemLocation(std::string SystemLocation)
78{ 95{
79 // Nothing clever updates. (At the moment) it is assumed that 96 // Nothing clever updates. (At the moment) it is assumed that
80 // this is set before anything much happens and that it does 97 // this is set before anything much happens and that it does