xref: /haiku/src/apps/cortex/TransportView/TransportView.h (revision 19ae20e67e91fc09cc9fc5c0e60e21e24e7a53eb)
1*c284bb0fSMatt Madia /*
2*c284bb0fSMatt Madia  * Copyright (c) 1999-2000, Eric Moon.
3*c284bb0fSMatt Madia  * All rights reserved.
4*c284bb0fSMatt Madia  *
5*c284bb0fSMatt Madia  * Redistribution and use in source and binary forms, with or without
6*c284bb0fSMatt Madia  * modification, are permitted provided that the following conditions
7*c284bb0fSMatt Madia  * are met:
8*c284bb0fSMatt Madia  *
9*c284bb0fSMatt Madia  * 1. Redistributions of source code must retain the above copyright
10*c284bb0fSMatt Madia  *    notice, this list of conditions, and the following disclaimer.
11*c284bb0fSMatt Madia  *
12*c284bb0fSMatt Madia  * 2. Redistributions in binary form must reproduce the above copyright
13*c284bb0fSMatt Madia  *    notice, this list of conditions, and the following disclaimer in the
14*c284bb0fSMatt Madia  *    documentation and/or other materials provided with the distribution.
15*c284bb0fSMatt Madia  *
16*c284bb0fSMatt Madia  * 3. The name of the author may not be used to endorse or promote products
17*c284bb0fSMatt Madia  *    derived from this software without specific prior written permission.
18*c284bb0fSMatt Madia  *
19*c284bb0fSMatt Madia  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20*c284bb0fSMatt Madia  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21*c284bb0fSMatt Madia  * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*c284bb0fSMatt Madia  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23*c284bb0fSMatt Madia  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24*c284bb0fSMatt Madia  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25*c284bb0fSMatt Madia  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26*c284bb0fSMatt Madia  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27*c284bb0fSMatt Madia  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28*c284bb0fSMatt Madia  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*c284bb0fSMatt Madia  */
30*c284bb0fSMatt Madia 
31*c284bb0fSMatt Madia 
32a0795c6fSMarcus Overhagen // TransportView.h
33a0795c6fSMarcus Overhagen // * PURPOSE
34a0795c6fSMarcus Overhagen //   UI component (view) providing access to a selected
35a0795c6fSMarcus Overhagen //   NodeGroup's properties & transport controls.
36a0795c6fSMarcus Overhagen //
37a0795c6fSMarcus Overhagen // * HISTORY
38a0795c6fSMarcus Overhagen //   e.moon		18aug99		Begun.
39a0795c6fSMarcus Overhagen 
40a0795c6fSMarcus Overhagen #ifndef __TransportView_H__
41a0795c6fSMarcus Overhagen #define __TransportView_H__
42a0795c6fSMarcus Overhagen 
43a0795c6fSMarcus Overhagen #include <list>
44a0795c6fSMarcus Overhagen 
45a0795c6fSMarcus Overhagen #include <View.h>
46a0795c6fSMarcus Overhagen #include <PopUpMenu.h>
47a0795c6fSMarcus Overhagen 
48a0795c6fSMarcus Overhagen class BButton;
49f6e4cbb9SAxel Dörfler class BInvoker;
50a0795c6fSMarcus Overhagen class BStringView;
51a0795c6fSMarcus Overhagen class BTextControl;
52a0795c6fSMarcus Overhagen class BMenuField;
53a0795c6fSMarcus Overhagen class BMenu;
54a0795c6fSMarcus Overhagen 
55a0795c6fSMarcus Overhagen #include "cortex_defs.h"
56a0795c6fSMarcus Overhagen __BEGIN_CORTEX_NAMESPACE
57a0795c6fSMarcus Overhagen 
58a0795c6fSMarcus Overhagen class NodeManager;
59a0795c6fSMarcus Overhagen class NodeGroup;
60a0795c6fSMarcus Overhagen 
61a0795c6fSMarcus Overhagen class NumericValControl;
62a0795c6fSMarcus Overhagen 
63a0795c6fSMarcus Overhagen class _GroupInfoView;
64a0795c6fSMarcus Overhagen class TransportWindow;
65a0795c6fSMarcus Overhagen 
66a0795c6fSMarcus Overhagen class TransportView :
67a0795c6fSMarcus Overhagen 	public	BView {
68a0795c6fSMarcus Overhagen 	typedef	BView _inherited;
69a0795c6fSMarcus Overhagen 
70a0795c6fSMarcus Overhagen 	enum message_t {
71a0795c6fSMarcus Overhagen 		// _value: string
72a0795c6fSMarcus Overhagen 		M_SET_NAME					= TransportView_message_base
73a0795c6fSMarcus Overhagen 	};
74a0795c6fSMarcus Overhagen 
75a0795c6fSMarcus Overhagen public:											// *** ctors/dtor
76a0795c6fSMarcus Overhagen 	virtual ~TransportView(); //nyi
77a0795c6fSMarcus Overhagen 
78a0795c6fSMarcus Overhagen 	TransportView(
79a0795c6fSMarcus Overhagen 		NodeManager*						nodeManager,
80a0795c6fSMarcus Overhagen 		const char*							name); //nyi
81a0795c6fSMarcus Overhagen 
82a0795c6fSMarcus Overhagen public:											// *** BView
83a0795c6fSMarcus Overhagen 	virtual void AttachedToWindow();
84a0795c6fSMarcus Overhagen 	virtual void AllAttached();
85a0795c6fSMarcus Overhagen 	virtual void DetachedFromWindow();
86a0795c6fSMarcus Overhagen 	virtual void FrameResized(
87a0795c6fSMarcus Overhagen 		float										width,
88a0795c6fSMarcus Overhagen 		float										height);
89a0795c6fSMarcus Overhagen 	virtual void KeyDown(
90a0795c6fSMarcus Overhagen 		const char*							bytes,
91a0795c6fSMarcus Overhagen 		int32										count);
92a0795c6fSMarcus Overhagen 	virtual void MouseDown(
93a0795c6fSMarcus Overhagen 		BPoint									where);
94a0795c6fSMarcus Overhagen 
95a0795c6fSMarcus Overhagen public:											// *** BHandler
96a0795c6fSMarcus Overhagen 	virtual void MessageReceived(
97a0795c6fSMarcus Overhagen 		BMessage*								message); //nyi
98a0795c6fSMarcus Overhagen 
99a0795c6fSMarcus Overhagen private:										// *** BHandler impl.
100a0795c6fSMarcus Overhagen 	void _handleSelectGroup(
101a0795c6fSMarcus Overhagen 		BMessage*								message);
102a0795c6fSMarcus Overhagen 
103a0795c6fSMarcus Overhagen protected:									// *** internal operations
104a0795c6fSMarcus Overhagen 
105a0795c6fSMarcus Overhagen 	// select the given group; initialize controls
106a0795c6fSMarcus Overhagen 	// (if 0, gray out all controls)
107a0795c6fSMarcus Overhagen 	void _selectGroup(
108a0795c6fSMarcus Overhagen 		uint32									groupID);
109a0795c6fSMarcus Overhagen 
110a0795c6fSMarcus Overhagen 	void _observeGroup();
111a0795c6fSMarcus Overhagen 	void _releaseGroup();
112a0795c6fSMarcus Overhagen 
113a0795c6fSMarcus Overhagen 	void _initTimeSources();
114a0795c6fSMarcus Overhagen 
115a0795c6fSMarcus Overhagen protected:									// *** controls
116a0795c6fSMarcus Overhagen 
117a0795c6fSMarcus Overhagen 	void _constructControls(); //nyi
118a0795c6fSMarcus Overhagen 
119a0795c6fSMarcus Overhagen 	void _disableControls();
120a0795c6fSMarcus Overhagen 	void _enableControls();
121a0795c6fSMarcus Overhagen 
122a0795c6fSMarcus Overhagen 	void _updateTransportButtons();
123a0795c6fSMarcus Overhagen 	void _updateTimeSource();
124a0795c6fSMarcus Overhagen 	void _updateRunMode();
125a0795c6fSMarcus Overhagen 
126a0795c6fSMarcus Overhagen 	// convert a position control's value to bigtime_t
127a0795c6fSMarcus Overhagen 	// [e.moon 11oct99]
128a0795c6fSMarcus Overhagen 	bigtime_t _scalePosition(
129a0795c6fSMarcus Overhagen 		double									value);
130a0795c6fSMarcus Overhagen 
131a0795c6fSMarcus Overhagen 	void _populateRunModeMenu(
132a0795c6fSMarcus Overhagen 		BMenu*									menu);
133a0795c6fSMarcus Overhagen 	void _populateTimeSourceMenu(
134a0795c6fSMarcus Overhagen 		BMenu*									menu);
135a0795c6fSMarcus Overhagen 
136a0795c6fSMarcus Overhagen 	// add the given invoker to be retargeted to this
137a0795c6fSMarcus Overhagen 	// view (used for controls whose messages need a bit more
138a0795c6fSMarcus Overhagen 	// processing before being forwarded to the NodeGroup.)
139a0795c6fSMarcus Overhagen 	void _addLocalTarget(
140a0795c6fSMarcus Overhagen 		BInvoker*								invoker);
141a0795c6fSMarcus Overhagen 
142a0795c6fSMarcus Overhagen 	void _addGroupTarget(
143a0795c6fSMarcus Overhagen 		BInvoker*								invoker);
144a0795c6fSMarcus Overhagen 
145a0795c6fSMarcus Overhagen 	void _refreshTransportSettings();
146a0795c6fSMarcus Overhagen 
147a0795c6fSMarcus Overhagen 	// [e.moon 2dec99]
148a0795c6fSMarcus Overhagen 	void _timeSourceCreated(
149a0795c6fSMarcus Overhagen 		BMessage*								message); //nyi
150a0795c6fSMarcus Overhagen 	void _timeSourceDeleted(
151a0795c6fSMarcus Overhagen 		BMessage*								message); //nyi
152a0795c6fSMarcus Overhagen 
153a0795c6fSMarcus Overhagen protected:									// *** layout
154a0795c6fSMarcus Overhagen 
155a0795c6fSMarcus Overhagen 	void _initLayout();
156a0795c6fSMarcus Overhagen 	void _updateLayout();
157a0795c6fSMarcus Overhagen 
158a0795c6fSMarcus Overhagen private:
15923e67806SIthamar R. Adema 	friend class _GroupInfoView;
16023e67806SIthamar R. Adema 	friend class TransportWindow;
161a0795c6fSMarcus Overhagen 
162a0795c6fSMarcus Overhagen 	// logical
163a0795c6fSMarcus Overhagen 	NodeManager*							m_manager;
164a0795c6fSMarcus Overhagen 	NodeGroup*								m_group;
165a0795c6fSMarcus Overhagen 
166a0795c6fSMarcus Overhagen 	// controls
167a0795c6fSMarcus Overhagen 	_GroupInfoView*						m_infoView;
168a0795c6fSMarcus Overhagen 	BMenuField*								m_runModeView;
169a0795c6fSMarcus Overhagen 	BMenuField*								m_timeSourceView;
170a0795c6fSMarcus Overhagen 
171a0795c6fSMarcus Overhagen 	BStringView*							m_fromLabel;
172a0795c6fSMarcus Overhagen 	NumericValControl*				m_regionStartView;
173a0795c6fSMarcus Overhagen 	BStringView*							m_toLabel;
174a0795c6fSMarcus Overhagen 	NumericValControl*				m_regionEndView;
175a0795c6fSMarcus Overhagen 
176a0795c6fSMarcus Overhagen 	BButton*									m_startButton;
177a0795c6fSMarcus Overhagen 	BButton*									m_stopButton;
178a0795c6fSMarcus Overhagen 	BButton*									m_prerollButton;
179a0795c6fSMarcus Overhagen 
18023e67806SIthamar R. Adema 	typedef std::list<BInvoker*>		target_set;
181a0795c6fSMarcus Overhagen 	target_set								m_localTargets;
182a0795c6fSMarcus Overhagen 	target_set								m_groupTargets;
183a0795c6fSMarcus Overhagen 
184a0795c6fSMarcus Overhagen 	// layout
185a0795c6fSMarcus Overhagen 	class _layout_state;
186a0795c6fSMarcus Overhagen 	_layout_state*						m_layout;
187a0795c6fSMarcus Overhagen };
188a0795c6fSMarcus Overhagen 
189a0795c6fSMarcus Overhagen __END_CORTEX_NAMESPACE
190a0795c6fSMarcus Overhagen #endif /*__TransportView_H__*/
191