Logo Search packages:      
Sourcecode: dasher version File versions


// DasherView.h
// Copyright (c) 2001-2004 David Ward

#ifndef __DasherView_h_
#define __DasherView_h_

#include "DasherScreen.h"
#include "DasherModel.h"
#include "LanguageModel.h"

// CDasherView is an abstract view class
// The implentation must provide several functions - defined here as pure virtual functions
// See the CDasherViewSquare class for an example

namespace Dasher {class CDasherView;}
class Dasher::CDasherView
      CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, CLanguageModel* LanguageModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight, bool ColourMode=0);
      virtual ~CDasherView() {}           
      void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation);
      // renders Dasher
      inline void Render();
      // translates the screen coordinates to Dasher coordinates and calls
      // dashermodel.TapOnDisplay
      virtual void TapOnDisplay(screenint mousex, screenint mousey, unsigned long Time)=0;
      // translates the screen coordinates to Dasher coordinates and calls
      // dashermodel.GoTo
      virtual void GoTo(screenint mousex, screenint mousey)=0;
      virtual void ChangeScreen(CDasherScreen* NewScreen)
            // DJW - removed floating point stuff
            //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth();

      virtual void DrawGoTo(screenint mousex, screenint mousey)=0;
      virtual void DrawMouse(screenint mousex, screenint mousey)=0;
      virtual void DrawMouseLine(screenint mousex, screenint mousey)=0;
      virtual void DrawKeyboard()=0;

      // Return references to the model and the screen:
      CDasherModel& DasherModel() {return m_DasherModel;}
      const CDasherModel& DasherModel() const {return m_DasherModel;}
      CDasherScreen& Screen() {return *m_Screen;}

      void Display() {m_Screen->Display();}

      // Toggle advanced colour mode
      void SetColourMode(bool colourmode) {ColourMode=colourmode;}

      // Toggle keyboard control mode
      void SetKeyControl(bool keyboardcontrol) {KeyControl=keyboardcontrol;}

    int GetOneButton() const;
    void SetOneButton(int Value);
    int GetAutoOffset();
    void ResetSum();
    void ResetSumCounter();
    void ResetYAutoOffset();
    int CDasherView::onebutton;
    bool AutoCalibrate;

      // Orientation of Dasher Screen
      inline void MapScreen(screenint* DrawX, screenint* DrawY);
      inline void UnMapScreen(screenint* DrawX, screenint* DrawY);

      // Keyboard control is on
      bool KeyControl;

      // Orientation of Dasher Screen
      Dasher::Opts::ScreenOrientations ScreenOrientation;

      // Advanced colour mode
      bool ColourMode;

      // DJW20040818 - perhaps these are DasherSquare-specific ?
    int ySum, ySumCounter, yFilterTimescale, ySigBiasPixels, ySigBiasPercentage, yAutoOffset;
      CDasherScreen* m_Screen;      // provides the graphics (text, lines, rectangles):
      CDasherModel& m_DasherModel; // Model view represents

      CLanguageModel* m_LanguageModel;
      // Pure virtuals to implement
      virtual void Crosshair(myint sx)=0; // Tells m_Screen to draw a crosshair - or other static decoration
      virtual int RenderNode(const symbol Character, const int Color, Opts::ColorSchemes ColorScheme,
            myint y1, myint y2, int& mostleft, bool& force, bool text, std::string displaytext)=0;
      // Responsible for all the Render_node calls
      int RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text);
      // Displays some nodes inside one parent node. Used to group capital letters, accents, punctuation etc.
      void RenderGroups(CDasherNode* Render, myint y1, myint y2, bool text);

#include "DasherView.inl"

#endif /* #ifndef __DasherView_h_ */

Generated by  Doxygen 1.6.0   Back to index