xref: /haiku/src/apps/cortex/RouteApp/RouteWindow.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 // RouteWindow.h
2 // e.moon 14may99
3 //
4 // PURPOSE
5 //   Window class containing a MediaRoutingView for
6 //   inspection & manipulation of Media Kit nodes.
7 //
8 // HISTORY
9 //   14may99		e.moon		Created from routeApp.cpp
10 //	 21may00		c.lenz		added StatusView to the window
11 
12 #ifndef __ROUTEWINDOW_H__
13 #define __ROUTEWINDOW_H__
14 
15 #include <list>
16 
17 #include <Node.h>
18 #include <ScrollBar.h>
19 #include <Window.h>
20 
21 #include "IStateArchivable.h"
22 
23 #include "cortex_defs.h"
24 
25 class BMenu;
26 
27 __BEGIN_CORTEX_NAMESPACE
28 
29 class MediaRoutingView;
30 class StatusView;
31 class RouteAppNodeManager;
32 class DormantNodeWindow;
33 class TransportWindow;
34 
35 class RouteWindow :
36 	public		BWindow,
37 	public		IStateArchivable {
38 
39 	typedef	BWindow _inherited;
40 
41 public:													// messages
42 	enum message_t {
43 		M_TOGGLE_TRANSPORT_WINDOW		=RouteWindow_message_base,
44 
45 		// nodeID: int32
46 		M_SHOW_NODE_INSPECTOR,
47 
48 		// groupID: int32
49 		M_REFRESH_TRANSPORT_SETTINGS,
50 
51 		// [e.moon 17nov99]
52 		M_TOGGLE_PULLING_PALETTES,
53 
54 		// [e.moon 29nov99]
55 		M_TOGGLE_DORMANT_NODE_WINDOW,
56 
57 		// [e.moon 1dec99]
58 		M_TOGGLE_GROUP_ROLLING
59 	};
60 
61 public:													// ctor/dtor
62 	virtual ~RouteWindow();
63 	RouteWindow(
64 		RouteAppNodeManager*			manager);
65 
66 public:													// palette-window operations
67 
68 	// enable/disable palette position-locking (when the main
69 	// window is moved, all palettes follow)
70 	bool isPullPalettes() const;
71 	void setPullPalettes(
72 		bool												enabled);
73 
74 	// [e.moon 2dec99] force window & palettes on-screen
75 	void constrainToScreen();
76 
77 public:													// BWindow impl
78 
79 	// [e.moon 17nov99] 'palette-pulling' impl
80 	virtual void FrameMoved(
81 		BPoint											point);
82 
83 	// [c.lenz 1mar2000] added for better Zoom() support
84 	virtual void FrameResized(
85 		float											width,
86 		float											height);
87 
88 	bool QuitRequested();
89 
90 	// [c.lenz 1mar2000] resize to MediaRoutingView's preferred size
91 	virtual void Zoom(
92 		BPoint											origin,
93 		float											width,
94 		float											height);
95 
96 public:													// BHandler impl
97 	void MessageReceived(
98 		BMessage*										message);
99 
100 public:												// *** IStateArchivable
101 
102 	status_t importState(
103 		const BMessage*						archive);
104 
105 	status_t exportState(
106 		BMessage*									archive) const;
107 
108 private:												// implementation
109 	friend class RouteApp;
110 
111 	// resizes the window to fit in the current screen rect
112 	void _constrainToScreen();
113 
114 	void _toggleTransportWindow();
115 
116 	void _handleGroupSelected(
117 		BMessage*										message);
118 
119 	// [c.lenz 21may00]
120 	void _handleShowErrorMessage(
121 		BMessage*										message);
122 
123 	// [e.moon 17nov99]
124 	void _togglePullPalettes();
125 
126 	void _toggleDormantNodeWindow();
127 
128 	// refresh the transport window for the given group, if any
129 	void _refreshTransportSettings(
130 		BMessage*										message);
131 
132 	void _closePalettes();
133 
134 	// [e.moon 17nov99] move all palette windows by the
135 	// specified amounts
136 	void _movePalettesBy(
137 		float												xDelta,
138 		float												yDelta);
139 
140 	// [e.moon 1dec99] toggle group playback
141 	void _toggleGroupRolling();
142 
143 private:												// members
144 	MediaRoutingView*							m_routingView;
145 	BScrollBar*										m_hScrollBar;
146 	BScrollBar*										m_vScrollBar;
147 
148 	StatusView*										m_statusView;
149 
150 	BMenuItem*										m_transportWindowItem;
151 	BRect													m_transportWindowFrame;
152 	TransportWindow*							m_transportWindow;
153 //	list<InspectorWindow*>				m_nodeInspectorWindows;
154 
155 	BMenuItem*										m_dormantNodeWindowItem;
156 	BRect													m_dormantNodeWindowFrame;
157 	DormantNodeWindow*						m_dormantNodeWindow;
158 
159 //	BPoint												m_nodeInspectorBasePosition;
160 
161 	// all items in this menu control the routing view
162 	BMenu*												m_viewMenu;
163 
164 	// cached window position [e.moon 17nov99]
165 	BMenuItem*										m_pullPalettesItem;
166 	BPoint												m_lastFramePosition;
167 
168 	// ID of currently selected group [e.moon 1dec99]
169 	uint32												m_selectedGroupID;
170 
171 	BRect												m_manualSize;
172 
173 	// true if window was zoomed to MediaRoutingView's preferred size
174 	// [c.lenz 1mar2000]
175 	bool												m_zoomed;
176 
177 	// true if a resize operation resulted from a call to Zoom()
178 	// [c.lenz 1mar2000]
179 	bool												m_zooming;
180 
181 
182 private:												// constants
183 	static const BRect						s_initFrame;
184 	static const char* const			s_windowName;
185 };
186 
187 __END_CORTEX_NAMESPACE
188 #endif /* __ROUTEWINDOW_H__ */
189