summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherNode.h
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherNode.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherNode.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/inputmethods/dasher/DasherNode.h b/inputmethods/dasher/DasherNode.h
index 705a9d4..fb00d47 100644
--- a/inputmethods/dasher/DasherNode.h
+++ b/inputmethods/dasher/DasherNode.h
@@ -29,99 +29,113 @@ private:
29 Opts::ColorSchemes m_ColorScheme; 29 Opts::ColorSchemes m_ColorScheme;
30 int m_iPhase; // index for coloring 30 int m_iPhase; // index for coloring
31 int m_iColour; // for the advanced colour mode 31 int m_iColour; // for the advanced colour mode
32 32
33 const symbol m_Symbol; // the character to display 33 const symbol m_Symbol; // the character to display
34 CLanguageModel *m_languagemodel; // pointer to the language model - in future, could be different for each node 34 CLanguageModel *m_languagemodel; // pointer to the language model - in future, could be different for each node
35 CDasherNode **m_Children; // pointer to array of children 35 CDasherNode **m_Children; // pointer to array of children
36 CDasherNode *m_parent; // pointer to parent - only needed to grab parent context 36 CDasherNode *m_parent; // pointer to parent - only needed to grab parent context
37 CLanguageModel::CNodeContext *m_context; 37 CLanguageModel::CNodeContext *m_context;
38public: 38public:
39 39
40 CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, Opts::ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour); 40 CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, Opts::ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour);
41 ~CDasherNode(); 41 ~CDasherNode();
42 bool m_bForce; // flag to force a node to be drawn - shouldn't be public 42 bool m_bForce; // flag to force a node to be drawn - shouldn't be public
43 43
44 // return private data members - read only 44 // return private data members - read only
45 CDasherNode ** const Children() const {return m_Children;} 45 CDasherNode ** const Children() const {return m_Children;}
46 unsigned int Lbnd() const {return m_iLbnd;} 46 unsigned int Lbnd() const {return m_iLbnd;}
47 bool Alive() {return m_bAlive;} 47 bool Alive() {return m_bAlive;}
48 bool Control() {return m_bControlChild;} 48 bool Control() {return m_bControlChild;}
49 void Kill() {m_bAlive=0;m_iAge=0;} 49 void Kill() {m_bAlive=0;m_iAge=0;}
50 unsigned int Hbnd() const {return m_iHbnd;} 50 unsigned int Hbnd() const {return m_iHbnd;}
51 unsigned int Group() const {return m_iGroup;} 51 unsigned int Group() const {return m_iGroup;}
52 unsigned int Age() const {return m_iAge;} 52 unsigned int Age() const {return m_iAge;}
53 symbol Symbol() const {return m_Symbol;} 53 symbol Symbol() const {return m_Symbol;}
54 unsigned int Chars() const {return m_iChars;} 54 unsigned int Chars() const {return m_iChars;}
55 int Phase() const {return m_iPhase;} 55 int Phase() const {return m_iPhase;}
56 Opts::ColorSchemes Cscheme() const {return m_ColorScheme;} 56 Opts::ColorSchemes Cscheme() const {return m_ColorScheme;}
57 int Colour() const {return m_iColour;} 57 int Colour() const {return m_iColour;}
58 58
59 CDasherNode* const Get_node_under(int,myint y1,myint y2,myint smousex,myint smousey); // find node under given co-ords 59 CDasherNode* const Get_node_under(int,myint y1,myint y2,myint smousex,myint smousey); // find node under given co-ords
60 void Get_string_under(const int,const myint y1,const myint y2,const myint smousex,const myint smousey,std::vector<symbol>&) const; // get string under given co-ords 60 void Get_string_under(const int,const myint y1,const myint y2,const myint smousex,const myint smousey,std::vector<symbol>&) const; // get string under given co-ords
61 void Generic_Push_Node(CLanguageModel::CNodeContext *context); 61 void Generic_Push_Node(CLanguageModel::CNodeContext *context);
62 void Push_Node(); // give birth to children 62 void Push_Node(); // give birth to children
63 void Push_Node(CLanguageModel::CNodeContext *context); // give birth to children with this context 63 void Push_Node(CLanguageModel::CNodeContext *context); // give birth to children with this context
64 void Delete_children(); 64 void Delete_children();
65 void Dump_node() const; // diagnostic 65 void Dump_node() const; // diagnostic
66}; 66};
67 67
68///////////////////////////////////////////////////////////////////////////// 68/////////////////////////////////////////////////////////////////////////////
69// Inline functions 69// Inline functions
70///////////////////////////////////////////////////////////////////////////// 70/////////////////////////////////////////////////////////////////////////////
71 71
72using namespace Dasher; 72using namespace Dasher;
73using namespace Opts; 73using namespace Opts;
74 74
75///////////////////////////////////////////////////////////////////////////// 75/////////////////////////////////////////////////////////////////////////////
76 76
77inline CDasherNode::CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour=0) 77inline CDasherNode::CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour=0) :
78 : m_parent(parent),m_Symbol(Symbol),m_iGroup(igroup),m_iLbnd(ilbnd),m_iHbnd(ihbnd),m_languagemodel(lm),m_iPhase(iphase), 78 m_iLbnd(ilbnd),
79 m_context(0), m_iAge(0), m_bAlive(1), m_Children(0), m_bForce(false), m_iChars(0), m_ColorScheme(ColorScheme), m_bControlChild(false), m_iColour(Colour) 79 m_iHbnd(ihbnd),
80 m_iGroup(igroup),
81 m_iChars(0),
82 m_iAge(0),
83 m_bAlive(1),
84 m_bControlChild(false),
85 m_ColorScheme(ColorScheme),
86 m_iPhase(iphase),
87 m_iColour(Colour),
88 m_Symbol(Symbol),
89 m_languagemodel(lm),
90 m_Children(0),
91 m_parent(parent),
92 m_context(0),
93 m_bForce(false)
80{ 94{
81 /* 95 /*
82 switch (ColorScheme) { 96 switch (ColorScheme) {
83 case Nodes1: 97 case Nodes1:
84 m_ColorScheme = Nodes2; 98 m_ColorScheme = Nodes2;
85 break; 99 break;
86 case Nodes2: 100 case Nodes2:
87 m_ColorScheme = Nodes1; 101 m_ColorScheme = Nodes1;
88 break; 102 break;
89 case Special1: 103 case Special1:
90 m_ColorScheme = Special2; 104 m_ColorScheme = Special2;
91 break; 105 break;
92 case Special2: 106 case Special2:
93 m_ColorScheme = Special1; 107 m_ColorScheme = Special1;
94 break; 108 break;
95 case default: 109 case default:
96 m_ColorScheme = ColorScheme; 110 m_ColorScheme = ColorScheme;
97 break; 111 break;
98 } 112 }
99 */ 113 */
100} 114}
101 115
102///////////////////////////////////////////////////////////////////////////// 116/////////////////////////////////////////////////////////////////////////////
103 117
104inline void CDasherNode::Delete_children() 118inline void CDasherNode::Delete_children()
105{ 119{
106 if (m_Children) { 120 if (m_Children) {
107 unsigned int i; 121 unsigned int i;
108 for (i=1;i<m_iChars;i++) 122 for (i=1;i<m_iChars;i++)
109 delete m_Children[i]; 123 delete m_Children[i];
110 delete [] m_Children; 124 delete [] m_Children;
111 } 125 }
112 m_Children=0; 126 m_Children=0;
113 127
114} 128}
115 129
116///////////////////////////////////////////////////////////////////////////// 130/////////////////////////////////////////////////////////////////////////////
117 131
118inline CDasherNode::~CDasherNode() 132inline CDasherNode::~CDasherNode()
119{ 133{
120 Delete_children(); 134 Delete_children();
121 if (m_context) 135 if (m_context)
122 m_languagemodel->ReleaseNodeContext(m_context); 136 m_languagemodel->ReleaseNodeContext(m_context);
123} 137}
124 138
125///////////////////////////////////////////////////////////////////////////// 139/////////////////////////////////////////////////////////////////////////////
126 140
127#endif /* #ifndef __DasherNode_h__ */ 141#endif /* #ifndef __DasherNode_h__ */