1 #pragma once
2 
3 #include <list>
4 #include "icamera.h"
5 #include "gtkutil/widget.h"
6 
7 #include "CamWnd.h"
8 #include "CameraObserver.h"
9 
10 /* greebo: This is the gateway class to access the currently active CamWindow
11  *
12  * This class provides an interface for creating and deleting CamWnd instances
13  * as well as some methods that are passed to the currently active CamWnd, like
14  * resetCameraAngles() or lookThroughSelected().
15  *
16  * The active CamWnd class is referenced by the _camWnd member pointer. */
17 
18 class GlobalCameraManager
19 {
20 
21 		// The currently active camera window
22 		CamWnd* _camWnd;
23 
24 		CameraModel* _cameraModel;
25 
26 		ToggleShown _cameraShown;
27 
28 		// The connected callbacks (get invoked when movedNotify() is called)
29 		CameraObserverList _cameraObservers;
30 
31 	public:
32 
33 		// Constructor
34 		GlobalCameraManager ();
35 
36 		void construct();
37 
38 		// Creates a new CamWnd class and returns the according pointer
39 		CamWnd* newCamWnd ();
40 
41 		// Specifies the parent window of the given CamWnd
42 		void setParent (CamWnd* camwnd, GtkWindow* parent);
43 
44 		// Frees the created CamWnd class
45 		void deleteCamWnd (CamWnd* camWnd);
46 
47 		// Retrieves/Sets the pointer to the current CamWnd
48 		CamWnd* getCamWnd ();
49 		void setCamWnd (CamWnd* camWnd);
50 
51 		// Resets the camera angles of the currently active Camera
52 		void resetCameraAngles ();
53 
54 		// Increases/decreases the far clip plane distance (passes the call to CamWnd)
55 		void cubicScaleIn ();
56 		void cubicScaleOut ();
57 
58 		// Change the floor up/down, passes the call on to the CamWnd class
59 		void changeFloorUp ();
60 		void changeFloorDown ();
61 
62 		/* greebo: Tries to get a CameraModel from the most recently selected instance
63 		 * Note: Currently NO instances are supporting the InstanceTypeCast onto a
64 		 * CameraModel, so actually these functions don't do anything. I'll leave them
65 		 * where they are, they should work in principle... */
66 		void lookThroughSelected ();
67 		void lookThroughCamera ();
68 
69 		void update ();
70 
71 		// Add a "CameraMoved" callback to the signal member
72 		void addCameraObserver (CameraObserver* observer);
73 		void removeCameraObserver(CameraObserver* observer);
74 
75 		// Notify the attached "CameraMoved" callbacks
76 		void movedNotify ();
77 
78 		void destroy ();
79 
80 		// Movement commands (the calls are passed on to the Camera class)
81 		void moveForwardDiscrete ();
82 		void moveBackDiscrete ();
83 		void moveUpDiscrete ();
84 		void moveDownDiscrete ();
85 		void moveLeftDiscrete ();
86 		void moveRightDiscrete ();
87 		void rotateLeftDiscrete ();
88 		void rotateRightDiscrete ();
89 		void pitchUpDiscrete ();
90 		void pitchDownDiscrete ();
91 
92 	private:
93 		void freelookMoveForwardKeyUp();
94 		void freelookMoveForwardKeyDown();
95 
96 		void freelookMoveBackKeyUp();
97 		void freelookMoveBackKeyDown();
98 
99 		void freelookMoveLeftKeyUp();
100 		void freelookMoveLeftKeyDown();
101 
102 		void freelookMoveRightKeyUp();
103 		void freelookMoveRightKeyDown();
104 
105 		void freelookMoveUpKeyUp();
106 		void freelookMoveUpKeyDown();
107 
108 		void freelookMoveDownKeyUp();
109 		void freelookMoveDownKeyDown();
110 
111 }; // class GlobalCameraManager
112 
113 // The accessor function that contains the static instance of the GlobalCameraManager class
114 GlobalCameraManager& GlobalCamera ();
115