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