author | mickeyl <mickeyl> | 2003-09-27 11:29:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-09-27 11:29:26 (UTC) |
commit | 651b6c612db4e809c506973996f2580c4158ac3a (patch) (unidiff) | |
tree | 8c8edc86e4b206dd4542a6b556ad1a319d6698ab /inputmethods/dasher/DasherView.cpp | |
parent | d1a11b45e805fe7771ea05944757d767c3c4c8ea (diff) | |
download | opie-651b6c612db4e809c506973996f2580c4158ac3a.zip opie-651b6c612db4e809c506973996f2580c4158ac3a.tar.gz opie-651b6c612db4e809c506973996f2580c4158ac3a.tar.bz2 |
merge dasher which has been introduced in BRANCH first (wtf?) into HEAD
Diffstat (limited to 'inputmethods/dasher/DasherView.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/dasher/DasherView.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/inputmethods/dasher/DasherView.cpp b/inputmethods/dasher/DasherView.cpp new file mode 100644 index 0000000..3b8cb64 --- a/dev/null +++ b/inputmethods/dasher/DasherView.cpp | |||
@@ -0,0 +1,93 @@ | |||
1 | // DasherView.cpp | ||
2 | // | ||
3 | ///////////////////////////////////////////////////////////////////////////// | ||
4 | // | ||
5 | // Copyright (c) 2001-2002 David Ward | ||
6 | // | ||
7 | ///////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | #include "DasherView.h" | ||
10 | using namespace Dasher; | ||
11 | |||
12 | |||
13 | CDasherView::CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Opts::ScreenOrientations Orientation) | ||
14 | : m_Screen(DasherScreen), m_DasherModel(DasherModel), ScreenOrientation(Orientation), ColourMode(false) | ||
15 | { | ||
16 | //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth(); | ||
17 | } | ||
18 | |||
19 | |||
20 | void CDasherView::ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation) | ||
21 | { | ||
22 | ScreenOrientation = Orientation; | ||
23 | Render(); | ||
24 | } | ||
25 | |||
26 | |||
27 | void CDasherView::FlushAt(int mousex,int mousey) | ||
28 | { | ||
29 | m_DasherModel.Flush(0,0); | ||
30 | } | ||
31 | |||
32 | int CDasherView::RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text) | ||
33 | { | ||
34 | symbol CurChar = Render->Symbol(); | ||
35 | int Color; | ||
36 | |||
37 | if (ColourMode==true) { | ||
38 | Color = Render->Colour(); | ||
39 | } else { | ||
40 | Color = Render->Phase()%3; | ||
41 | } | ||
42 | |||
43 | if (RenderNode(Render->Symbol(), Color, Render->Cscheme(), y1, y2, mostleft, Render->m_bForce, text)) | ||
44 | RenderGroups(Render, y1, y2, text); | ||
45 | else | ||
46 | Render->Kill(); | ||
47 | |||
48 | CDasherNode** const Children=Render->Children(); | ||
49 | if (!Children) | ||
50 | return 0; | ||
51 | int norm=DasherModel().Normalization(); | ||
52 | for (unsigned int i=1; i<Render->Chars(); i++) { | ||
53 | if (Children[i]->Alive()) { | ||
54 | myint Range=y2-y1; | ||
55 | myint newy1=y1+(Range*Children[i]->Lbnd())/norm; | ||
56 | myint newy2=y1+(Range*Children[i]->Hbnd())/norm; | ||
57 | RecursiveRender(Children[i], newy1, newy2, mostleft, text); | ||
58 | } | ||
59 | } | ||
60 | return 1; | ||
61 | |||
62 | |||
63 | } | ||
64 | |||
65 | |||
66 | void CDasherView::RenderGroups(CDasherNode* Render, myint y1, myint y2, bool text) | ||
67 | { | ||
68 | CDasherNode** Children = Render->Children(); | ||
69 | if (!Children) | ||
70 | return; | ||
71 | int current=0; | ||
72 | int lower=0; | ||
73 | int upper=0; | ||
74 | myint range=y2-y1; | ||
75 | for (unsigned int i=1; i<Render->Chars(); i++) { | ||
76 | int g=Children[i]->Group(); | ||
77 | if (g!=current) { | ||
78 | lower=upper; | ||
79 | upper=i; | ||
80 | |||
81 | if (current!=0) { | ||
82 | myint lbnd=Children[lower]->Lbnd(); | ||
83 | myint hbnd=Children[upper]->Lbnd(); | ||
84 | myint newy1=y1+(range*lbnd)/m_DasherModel.Normalization(); | ||
85 | myint newy2=y1+(range*hbnd)/m_DasherModel.Normalization(); | ||
86 | int mostleft; | ||
87 | bool force; | ||
88 | RenderNode(0,current-1,Opts::Groups,newy1,newy2,mostleft,force,text); | ||
89 | } | ||
90 | current=g; | ||
91 | } | ||
92 | } | ||
93 | } | ||