00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CRYSTAL_VIEW_H
00026 #define CRYSTAL_VIEW_H
00027
00028 #include <libxml/parser.h>
00029 #include <gcu/matrix.h>
00030 #include <list>
00031 #include <map>
00032 #include <gtk/gtkwidget.h>
00033
00034 using namespace std;
00035
00036 namespace gcu
00037 {
00038 class CrystalDoc;
00039
00045 class CrystalView
00046 {
00047 public:
00049
00054 CrystalView (CrystalDoc* pDoc);
00056
00059 virtual ~CrystalView ();
00060
00065 GtkWidget* CreateNewWidget ();
00071 void Init (GtkWidget *widget);
00077 void Reshape (GtkWidget *widget);
00083 void Draw (GtkWidget *widget);
00087 void Update ();
00093 void Update (GtkWidget *widget);
00100 bool OnPressed (GtkWidget *widget, GdkEventButton *event);
00107 void OnMotion (GtkWidget *widget, GdkEventMotion *event);
00113 void OnDestroyed (GtkWidget *widget);
00114
00120 virtual bool Load (xmlNodePtr node);
00125 virtual xmlNodePtr Save (xmlDocPtr xml);
00133 void SaveAsImage (char const *filename, char const *type, map<string, string>& options);
00134
00135 private:
00142 void Rotate (gdouble x, gdouble y);
00143
00144 protected:
00148 gdouble m_fAngle;
00152 gdouble m_fRadius;
00156 gdouble m_psi;
00160 gdouble m_theta;
00164 gdouble m_phi;
00168 gdouble m_height;
00172 gdouble m_width;
00176 gdouble m_near;
00177
00178
00179
00180 gdouble m_far;
00184 Matrix m_Euler;
00188 unsigned m_nGLList;
00189
00193 float m_fBlue;
00197 float m_fRed;
00201 float m_fGreen;
00205 float m_fAlpha;
00209 CrystalDoc* m_pDoc;
00213 GtkWidget* m_pWidget;
00214
00215 private:
00216 bool m_bInit;
00217 gdouble m_lastx, m_lasty;
00218 list<GtkWidget*> m_Widgets;
00219 };
00220
00221 }
00222
00223 #endif //CRYSTAL_VIEW_H