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