crystalview.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalview.h 
00006  *
00007  * Copyright (C) 2002-2004 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
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 The distance of the back plane delimiting the volume active in the OpenGL representation to the viewer.
00179 */
00180         gdouble m_far;
00184         Matrix m_Euler;
00188         unsigned m_nGLList;
00189         //background color
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 } //namespace gcu
00222 
00223 #endif //CRYSTAL_VIEW_H

Generated on Tue Aug 15 10:47:35 2006 for The Gnome Chemistry Utils by  doxygen 1.4.7