summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherModel.cpp
Side-by-side diff
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
@@ -4,33 +4,33 @@
//
// Copyright (c) 2001-2002 David Ward
//
/////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "DasherModel.h"
using namespace Dasher;
using namespace std;
//////////////////////////////////////////////////////////////////////
// CDasherModel
//////////////////////////////////////////////////////////////////////
CDasherModel::CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions)
- : m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0), m_Dimensions(Dimensions)
+ : m_Dimensions(Dimensions), m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0)
{
LearnContext = m_languagemodel->GetRootNodeContext();
// various settings
int iShift = 12;
m_DasherY = 1<<iShift;
m_DasherOY = m_DasherY/2;
m_DasherOX = m_DasherY/2;
m_dAddProb = 0.003;
}
CDasherModel::~CDasherModel()
{
m_languagemodel->ReleaseNodeContext(LearnContext);
delete m_Root; // which will also delete all the whole structure
@@ -92,33 +92,33 @@ CDasherNode * CDasherModel::Get_node_under_mouse(myint Mousex,myint Mousey)
{
return m_Root->Get_node_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey);
}
/////////////////////////////////////////////////////////////////////////////
void CDasherModel::Get_string_under_mouse(const myint Mousex,const myint Mousey, vector<symbol> &str)
{
m_Root->Get_string_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey,str);
return;
}
/////////////////////////////////////////////////////////////////////////////
-void CDasherModel::Flush(const myint Mousex,const myint Mousey)
+void CDasherModel::Flush(const myint ,const myint )
{
vector<symbol> vtUnder;
Get_string_under_mouse(m_DasherOX,m_DasherOY,vtUnder);
unsigned int i;
for (i=0;i<vtUnder.size();i++) {
if (vtUnder[i]==0)
continue;
m_editbox->flush(vtUnder[i]);
}
}
/////////////////////////////////////////////////////////////////////////////
void CDasherModel::Update(CDasherNode *node,CDasherNode *under_mouse,int iSafe)
// go through the Dasher nodes, delete ones who have expired
// decrease the time left for nodes which arent safe
@@ -171,33 +171,33 @@ void CDasherModel::Start()
m_languagemodel->ReleaseNodeContext(LearnContext);
LearnContext = m_languagemodel->CloneNodeContext(therootcontext);
}
m_Root=new CDasherNode(0,0,0,0,Opts::Nodes1,0,Normalization(),m_languagemodel);
m_Root->Push_Node(therootcontext);
m_languagemodel->ReleaseNodeContext(therootcontext);
// ppmmodel->dump();
// dump();
}
/////////////////////////////////////////////////////////////////////////////
void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey)
{
- int cappedrate=0;
+ // int cappedrate=0;
double dRx=1.0,dRxnew=1.0;
double dRxnew2;
int iSteps=m_fr.Steps();
if (Mousex<m_DasherOX) {
// rx=1.0001*Ixmap[mx]/Ixmap[cx];
if (Mousex<=0)
Mousex=1;
dRx=1.0*m_DasherOX/Mousex;
dRxnew=pow(dRx,1.0/iSteps); // or exp(log(rx)/steps) - i think the replacement is faster
dRxnew2=1+(dRx-1)/iSteps;
//+(rx-1)*(rx-1)*(1.0/fr.steps()-1.0)/2/fr.steps();
@@ -230,33 +230,33 @@ void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey)
myint miDistance=m_DasherY/2-Mousey;
miDistance=myint(miDistance*(dRxnew-1)/(dRx-1));
myint miNewrootzoom=Mousey+miDistance;
myint newRootmax=miNewrootzoom+myint(below*dRxnew);
myint newRootmin=miNewrootzoom-myint(above*dRxnew);
if (newRootmin<m_DasherY/2 && newRootmax>m_DasherY/2 && newRootmax<LLONG_MAX && newRootmin>LLONG_MIN) {
m_Rootmax=newRootmax;
m_Rootmin=newRootmin;
}
}
/////////////////////////////////////////////////////////////////////////////
-void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long Time)
+void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long )
// work out the next viewpoint, opens some new nodes
{
// works out next viewpoint
Get_new_root_coords(miMousex,miMousey);
// opens up new nodes
// push node under mouse
CDasherNode *under_mouse=Get_node_under_mouse(miMousex,miMousey);
under_mouse->Push_Node();
if (Framerate() > 4) {
// push node under mouse but with x coord on RHS
CDasherNode *right=Get_node_under_mouse(50,miMousey);
right->Push_Node();