00001
00002
00004
00005
00006
00008
00009 #ifndef __DasherModel_h__
00010 #define __DasherModel_h__
00011
00012 #include <iostream>
00013 #include "MSVC_Unannoy.h"
00014 #include "DashEdit.h"
00015 #include "DasherNode.h"
00016 #include "LanguageModel.h"
00017 #include "NoClones.h"
00018 #include <math.h>
00019 #include "DasherTypes.h"
00020 #include "FrameRate.h"
00021 #include <vector>
00022
00023
00024
00025
00026
00027
00028 namespace Dasher {class CDasherModel;}
00029 class Dasher::CDasherModel : private NoClones
00030 {
00031 public:
00032
00033 CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions);
00034 ~CDasherModel();
00035
00036
00037 void NewFrame(unsigned long Time) {m_fr.NewFrame(Time);}
00038 const double Framerate () {return m_fr.Framerate();}
00039
00040
00041 void SetBitrate(double TargetRate) {m_fr.SetBitrate(TargetRate);}
00042 void SetMaxBitrate(double MaxRate) {m_fr.SetMaxBitrate(MaxRate);}
00043
00044
00045 const myint Rootmin() const {return m_Rootmin;}
00046 const myint Rootmax() const {return m_Rootmax;}
00047 const myint DasherOX() const {return m_DasherOX;}
00048 CDasherNode* Root() const {return m_Root;}
00049 int Normalization() const {return m_languagemodel->normalization();}
00050 myint DasherY() const {return m_DasherY;}
00051 bool Dimensions() const {return m_Dimensions;}
00052
00053 void Dump() const;
00054 void Flush(const myint smousex,const myint smousey);
00055
00056
00057 void Set_dimensions(bool dimensions) {m_Dimensions=dimensions;}
00058
00059 void Tap_on_display(myint,myint, unsigned long Time);
00060 void Start();
00061 void Make_root(int whichchild);
00062 void Reparent_root(int lower, int upper);
00063 void Reset_framerate(unsigned long Time) {m_fr.Reset(Time);}
00064
00065 CAlphabet* m_alphabet;
00066
00067 CAlphabet* GetAlphabet() { return m_alphabet; }
00068 private:
00069
00070
00071 std::vector<CDasherNode*> oldroots;
00072
00073
00074 myint m_Rootmin,m_Rootmax;
00075
00076
00077 myint m_DasherY;
00078
00079
00080 myint m_DasherOX;
00081
00082
00083 myint m_DasherOY;
00084
00085
00086 bool m_Dimensions;
00087
00088 CDashEditbox* m_editbox;
00089 CLanguageModel* m_languagemodel;
00090 CLanguageModel::CNodeContext* LearnContext;
00091 CFrameRate m_fr;
00092
00093
00094
00095 double m_dAddProb;
00096
00097 CDasherNode* Get_node_under_mouse(myint smousex,myint smousey);
00098 CDasherNode* Get_node_under_crosshair();
00099 CDasherNode* m_Root;
00100 void Get_new_root_coords(myint mousex,myint mousey);
00101 void Get_string_under_mouse(const myint smousex,const myint smousey,std::vector<symbol> &str);
00102 void Update(CDasherNode* node,CDasherNode* under,int safe);
00103
00104
00105
00106
00107
00108 };
00109
00110
00111 #endif