1 // CUSTOM_APP.H : write a short description here.
2 
3 // Copyright (C) 2006 Tommi Hassinen.
4 
5 // This package is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 
10 // This package is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 
15 // You should have received a copy of the GNU General Public License
16 // along with this package; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 /*################################################################################################*/
20 
21 //#include "config.h"
22 
23 #ifndef CUSTOM_APP_H
24 #define CUSTOM_APP_H
25 
26 class custom_app;
27 
28 class ogl_camera;	// liboglappth/ogl_camera.h
29 class color_mode;	// libghemical/model.h
30 
31 #include <oglappth/base_app.h>
32 
33 #include "project.h"
34 #include "oglview_wcl.h"
35 
36 #include <vector>
37 using namespace std;
38 
39 /*################################################################################################*/
40 
41 class custom_app :
42 	public base_app
43 {
44 	public:
45 
46 	enum mtool
47 	{
48 		mtDraw,
49 		mtErase,
50 		mtSelect,
51 		mtZoom,
52 		mtClipping,
53 		mtTranslateXY,
54 		mtTranslateZ,
55 		mtOrbitXY,
56 		mtOrbitZ,
57 		mtRotateXY,
58 		mtRotateZ,
59 		mtMeasure
60 	};
61 
62 	enum select_mode { smAtom, smResidue, smChain, smMolecule };
63 
64 	protected:
65 
66 	static project * prj;	// SetNewProject() must access this...
67 
68 	static mtool current_mouse_tool;
69 	static select_mode current_select_mode;
70 
71 // friends...
72 // ^^^^^^^^^^
73 	friend class project;
74 
75 	friend class gtk_project;
76 
77 	friend class w32_project;
78 	friend class w32_tb_button;
79 
80 	public:
81 
82 	custom_app(void);
83 	virtual ~custom_app(void);
84 
85 	protected:
86 
87 	virtual void SetNewProject(void);
88 
89 	public:
90 
91 	static custom_app * GetAppC(void);
92 	static project * GetPrj(void);
93 
94 	static mtool GetCurrentMouseTool(void);
95 	static select_mode GetCurrentSelectMode(void);
96 
97 	virtual void Message(const char *) = 0;
98 	virtual void WarningMessage(const char *) = 0;
99 	virtual void ErrorMessage(const char *) = 0;
100 
101 	virtual bool Question(const char *) = 0;
102 	virtual void PrintToLog(const char *) = 0;
103 
104 	// camera/light-related methods (shared with base_app):
105 	// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106 
107 	void AddCamera(ogl_camera *);			// virtual
108 	bool RemoveCamera(ogl_camera *);		// virtual
109 
110 	bool AddGlobalLight(ogl_light *);		// virtual
111 	bool AddLocalLight(ogl_light *, ogl_camera *);	// virtual
112 	bool RemoveLight(ogl_dummy_object *);		// virtual
113 
114 	bool SelectLight(const ogl_dummy_object *);
115 
116 	// here is the former project_view stuff...
117 	// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 
119 	virtual void UpdateAllWindowTitles(void) = 0;
120 
121 	protected:
122 
123 	virtual void CameraAdded(custom_camera *) = 0;
124 	virtual void CameraRemoved(custom_camera *) = 0;
125 
126 	virtual void LightAdded(ogl_light *) = 0;
127 	virtual void LightRemoved(ogl_light *) = 0;
128 
129 	virtual void GraphicsClientAdded(oglview_wcl *) = 0;
130 	virtual void GraphicsClientRemoved(oglview_wcl *) = 0;
131 
132 	virtual void PlottingClientAdded(base_wcl *) = 0;
133 	virtual void PlottingClientRemoved(base_wcl *) = 0;
134 
135 	virtual void ObjectAdded(ogl_smart_object *) = 0;
136 	virtual void ObjectRemoved(ogl_smart_object *) = 0;
137 
138 	virtual void BuildChainsView() = 0;
139 	virtual void ClearChainsView() = 0;
140 
141 	virtual void AtomAdded(atom *) = 0;
142 	virtual void AtomUpdateItem(atom *) = 0;	///< updates the properties of an existing object.
143 	virtual void AtomRemoved(atom *) = 0;
144 
145 	virtual void BondAdded(bond *) = 0;
146 	virtual void BondUpdateItem(bond *) = 0;	///< updates the properties of an existing object.
147 	virtual void BondRemoved(bond *) = 0;
148 };
149 
150 /*################################################################################################*/
151 
152 #endif	// CUSTOM_APP_H
153 
154 // eof
155