summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherModel.cpp
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherModel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherModel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/dasher/DasherModel.cpp b/inputmethods/dasher/DasherModel.cpp
index 0450d66..f15fa49 100644
--- a/inputmethods/dasher/DasherModel.cpp
+++ b/inputmethods/dasher/DasherModel.cpp
@@ -8,25 +8,25 @@
8 8
9#include <iostream> 9#include <iostream>
10#include "DasherModel.h" 10#include "DasherModel.h"
11 11
12using namespace Dasher; 12using namespace Dasher;
13using namespace std; 13using namespace std;
14 14
15////////////////////////////////////////////////////////////////////// 15//////////////////////////////////////////////////////////////////////
16// CDasherModel 16// CDasherModel
17////////////////////////////////////////////////////////////////////// 17//////////////////////////////////////////////////////////////////////
18 18
19CDasherModel::CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions) 19CDasherModel::CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions)
20 : m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0), m_Dimensions(Dimensions) 20 : m_Dimensions(Dimensions), m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0)
21{ 21{
22 LearnContext = m_languagemodel->GetRootNodeContext(); 22 LearnContext = m_languagemodel->GetRootNodeContext();
23 23
24 // various settings 24 // various settings
25 int iShift = 12; 25 int iShift = 12;
26 m_DasherY = 1<<iShift; 26 m_DasherY = 1<<iShift;
27 m_DasherOY = m_DasherY/2; 27 m_DasherOY = m_DasherY/2;
28 m_DasherOX = m_DasherY/2; 28 m_DasherOX = m_DasherY/2;
29 m_dAddProb = 0.003; 29 m_dAddProb = 0.003;
30} 30}
31 31
32 32
@@ -96,25 +96,25 @@ CDasherNode * CDasherModel::Get_node_under_mouse(myint Mousex,myint Mousey)
96///////////////////////////////////////////////////////////////////////////// 96/////////////////////////////////////////////////////////////////////////////
97 97
98 98
99void CDasherModel::Get_string_under_mouse(const myint Mousex,const myint Mousey, vector<symbol> &str) 99void CDasherModel::Get_string_under_mouse(const myint Mousex,const myint Mousey, vector<symbol> &str)
100{ 100{
101 m_Root->Get_string_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey,str); 101 m_Root->Get_string_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey,str);
102 return; 102 return;
103} 103}
104 104
105///////////////////////////////////////////////////////////////////////////// 105/////////////////////////////////////////////////////////////////////////////
106 106
107 107
108void CDasherModel::Flush(const myint Mousex,const myint Mousey) 108void CDasherModel::Flush(const myint ,const myint )
109{ 109{
110 vector<symbol> vtUnder; 110 vector<symbol> vtUnder;
111 Get_string_under_mouse(m_DasherOX,m_DasherOY,vtUnder); 111 Get_string_under_mouse(m_DasherOX,m_DasherOY,vtUnder);
112 unsigned int i; 112 unsigned int i;
113 for (i=0;i<vtUnder.size();i++) { 113 for (i=0;i<vtUnder.size();i++) {
114 if (vtUnder[i]==0) 114 if (vtUnder[i]==0)
115 continue; 115 continue;
116 m_editbox->flush(vtUnder[i]); 116 m_editbox->flush(vtUnder[i]);
117 } 117 }
118} 118}
119 119
120///////////////////////////////////////////////////////////////////////////// 120/////////////////////////////////////////////////////////////////////////////
@@ -175,25 +175,25 @@ void CDasherModel::Start()
175 m_Root->Push_Node(therootcontext); 175 m_Root->Push_Node(therootcontext);
176 176
177 m_languagemodel->ReleaseNodeContext(therootcontext); 177 m_languagemodel->ReleaseNodeContext(therootcontext);
178 //ppmmodel->dump(); 178 //ppmmodel->dump();
179 //dump(); 179 //dump();
180 180
181} 181}
182 182
183///////////////////////////////////////////////////////////////////////////// 183/////////////////////////////////////////////////////////////////////////////
184 184
185void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey) 185void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey)
186{ 186{
187 int cappedrate=0; 187 // int cappedrate=0;
188 double dRx=1.0,dRxnew=1.0; 188 double dRx=1.0,dRxnew=1.0;
189 double dRxnew2; 189 double dRxnew2;
190 190
191 int iSteps=m_fr.Steps(); 191 int iSteps=m_fr.Steps();
192 192
193 if (Mousex<m_DasherOX) { 193 if (Mousex<m_DasherOX) {
194 //rx=1.0001*Ixmap[mx]/Ixmap[cx]; 194 //rx=1.0001*Ixmap[mx]/Ixmap[cx];
195 if (Mousex<=0) 195 if (Mousex<=0)
196 Mousex=1; 196 Mousex=1;
197 dRx=1.0*m_DasherOX/Mousex; 197 dRx=1.0*m_DasherOX/Mousex;
198 dRxnew=pow(dRx,1.0/iSteps); // or exp(log(rx)/steps) - i think the replacement is faster 198 dRxnew=pow(dRx,1.0/iSteps); // or exp(log(rx)/steps) - i think the replacement is faster
199 199
@@ -234,25 +234,25 @@ void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey)
234 234
235 myint newRootmax=miNewrootzoom+myint(below*dRxnew); 235 myint newRootmax=miNewrootzoom+myint(below*dRxnew);
236 myint newRootmin=miNewrootzoom-myint(above*dRxnew); 236 myint newRootmin=miNewrootzoom-myint(above*dRxnew);
237 if (newRootmin<m_DasherY/2 && newRootmax>m_DasherY/2 && newRootmax<LLONG_MAX && newRootmin>LLONG_MIN) { 237 if (newRootmin<m_DasherY/2 && newRootmax>m_DasherY/2 && newRootmax<LLONG_MAX && newRootmin>LLONG_MIN) {
238 m_Rootmax=newRootmax; 238 m_Rootmax=newRootmax;
239 m_Rootmin=newRootmin; 239 m_Rootmin=newRootmin;
240 } 240 }
241 241
242} 242}
243 243
244///////////////////////////////////////////////////////////////////////////// 244/////////////////////////////////////////////////////////////////////////////
245 245
246void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long Time) 246void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long )
247 // work out the next viewpoint, opens some new nodes 247 // work out the next viewpoint, opens some new nodes
248{ 248{
249 // works out next viewpoint 249 // works out next viewpoint
250 Get_new_root_coords(miMousex,miMousey); 250 Get_new_root_coords(miMousex,miMousey);
251 251
252 // opens up new nodes 252 // opens up new nodes
253 253
254 // push node under mouse 254 // push node under mouse
255 CDasherNode *under_mouse=Get_node_under_mouse(miMousex,miMousey); 255 CDasherNode *under_mouse=Get_node_under_mouse(miMousex,miMousey);
256 under_mouse->Push_Node(); 256 under_mouse->Push_Node();
257 257
258 258