Diffstat (limited to 'inputmethods/dasher/DasherView.inl') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/dasher/DasherView.inl | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/inputmethods/dasher/DasherView.inl b/inputmethods/dasher/DasherView.inl new file mode 100644 index 0000000..fbb0c16 --- a/dev/null +++ b/inputmethods/dasher/DasherView.inl @@ -0,0 +1,75 @@ +// DasherView.inl +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2001-2002 David Ward +// +///////////////////////////////////////////////////////////////////////////// + + +inline void Dasher::CDasherView::Render() +{ + m_Screen->Blank(); + + // Render nodes to screen object (should use off screen buffer) + RecursiveRender(m_DasherModel.Root(), m_DasherModel.Rootmin(), m_DasherModel.Rootmax(), 2, false); + RecursiveRender(m_DasherModel.Root(), m_DasherModel.Rootmin(), m_DasherModel.Rootmax(), 2, true); + Crosshair(m_DasherModel.DasherOX()); // add crosshair +// m_Screen->Display(); // copy from buffer to screen +} + +inline void Dasher::CDasherView::MapScreen(int* DrawX, int* DrawY) +{ + using namespace Dasher::Opts; + + switch (ScreenOrientation) { + case (LeftToRight): + break; + case (RightToLeft): + *DrawX = m_Screen->GetWidth() - *DrawX; + break; + case (TopToBottom): { + int Swapper = ( *DrawX * m_Screen->GetHeight()) / m_Screen->GetWidth(); + *DrawX = (*DrawY * m_Screen->GetWidth()) / m_Screen->GetHeight(); + *DrawY = Swapper; + break; + } + case (BottomToTop): { + // Note rotation by 90 degrees not reversible like others + int Swapper = m_Screen->GetHeight() - ( *DrawX * m_Screen->GetHeight()) / m_Screen->GetWidth(); + *DrawX = (*DrawY * m_Screen->GetWidth()) / m_Screen->GetHeight(); + *DrawY = Swapper; + break; + } + default: + break; + } +} + + +inline void Dasher::CDasherView::UnMapScreen(int* MouseX, int* MouseY) +{ + using namespace Dasher::Opts; + + switch (ScreenOrientation) { + case (LeftToRight): + break; + case (RightToLeft): + *MouseX = m_Screen->GetWidth() - *MouseX; + break; + case (TopToBottom): { + int Swapper = (*MouseX * m_Screen->GetHeight()) / m_Screen->GetWidth(); + *MouseX = (*MouseY *m_Screen->GetWidth()) / m_Screen->GetHeight();; + *MouseY = Swapper; + break; + } + case (BottomToTop): { + int Swapper = (*MouseX * m_Screen->GetHeight()) / m_Screen->GetWidth(); + *MouseX = ((m_Screen->GetHeight() - *MouseY) * m_Screen->GetWidth()) / m_Screen->GetHeight(); + *MouseY = Swapper; + break; + } + default: + break; + } +} |