2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
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.
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.
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.
32 // InfoWindowManager.cpp
34 #include "InfoWindowManager.h"
36 #include "AppNodeInfoView.h"
37 #include "ConnectionInfoView.h"
38 #include "DormantNodeInfoView.h"
39 #include "EndPointInfoView.h"
40 #include "FileNodeInfoView.h"
41 #include "LiveNodeInfoView.h"
42 #include "InfoWindow.h"
44 #include "AddOnHostProtocol.h"
45 #include "Connection.h"
49 #include <Application.h>
53 #include <MediaAddOn.h>
54 #include <MediaRoster.h>
58 __USE_CORTEX_NAMESPACE
61 #define D_ACCESS(x) //PRINT (x)
62 #define D_ALLOC(x) //PRINT (x)
63 #define D_INTERNAL(x) //PRINT (x)
64 #define D_MESSAGE(x) //PRINT (x)
65 #define D_WINDOW(x) //PRINT (x)
67 // -------------------------------------------------------- //
69 // -------------------------------------------------------- //
71 // used to remember window for live nodes
72 struct live_node_window
{
74 public: // *** ctor/dtor
83 public: // *** data members
90 // used to remember windows for dormant nodes
91 struct dormant_node_window
{
93 public: // *** ctor/dtor
96 const dormant_node_info
&info
,
102 public: // *** data members
104 const dormant_node_info info
;
109 // used to remember windows for connections
110 struct connection_window
{
112 public: // *** ctor/dtor
115 const media_source
&source
,
116 const media_destination
&destination
,
119 destination(destination
),
123 public: // *** data members
127 media_destination destination
;
132 // used to remember windows for media_inputs
133 struct input_window
{
135 public: // *** ctor/dtor
138 const media_destination
&destination
,
140 : destination(destination
),
144 public: // *** data members
146 media_destination destination
;
151 // used to remember windows for media_outputs
152 struct output_window
{
154 public: // *** ctor/dtor
157 const media_source
&source
,
163 public: // *** data members
170 // -------------------------------------------------------- //
171 // static member init
172 // -------------------------------------------------------- //
174 const BPoint
InfoWindowManager::M_DEFAULT_OFFSET
= BPoint(20.0, 20.0);
175 const BPoint
InfoWindowManager::M_INIT_POSITION
= BPoint(90.0, 90.0);
177 InfoWindowManager
*InfoWindowManager::s_instance
= 0;
179 // -------------------------------------------------------- //
181 // -------------------------------------------------------- //
184 InfoWindowManager::InfoWindowManager()
185 : BLooper("InfoWindowManager",
187 m_liveNodeWindows(0),
188 m_dormantNodeWindows(0),
189 m_connectionWindows(0),
192 m_nextWindowPosition(M_INIT_POSITION
) {
193 D_ALLOC(("InfoWindowManager::InfoWindowManager()\n"));
197 BMediaRoster
*roster
= BMediaRoster::CurrentRoster();
199 roster
->StartWatching(BMessenger(0, this),
200 B_MEDIA_CONNECTION_BROKEN
);
204 InfoWindowManager::~InfoWindowManager() {
205 D_ALLOC(("InfoWindowManager::~InfoWindowManager()\n"));
207 BMediaRoster
*roster
= BMediaRoster::CurrentRoster();
209 roster
->StopWatching(BMessenger(0, this),
210 B_MEDIA_CONNECTION_BROKEN
);
213 if (m_liveNodeWindows
) {
214 while (m_liveNodeWindows
->CountItems() > 0) {
215 live_node_window
*entry
= static_cast<live_node_window
*>
216 (m_liveNodeWindows
->ItemAt(0));
217 if (entry
&& entry
->window
) {
218 remove_observer(this, entry
->ref
);
219 BMessenger
messenger(0, entry
->window
);
220 messenger
.SendMessage(B_QUIT_REQUESTED
);
222 m_liveNodeWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
225 delete m_liveNodeWindows
;
226 m_liveNodeWindows
= 0;
229 if (m_dormantNodeWindows
) {
230 while (m_dormantNodeWindows
->CountItems() > 0) {
231 dormant_node_window
*entry
= static_cast<dormant_node_window
*>
232 (m_dormantNodeWindows
->ItemAt(0));
233 if (entry
&& entry
->window
) {
234 BMessenger
messenger(0, entry
->window
);
235 messenger
.SendMessage(B_QUIT_REQUESTED
);
237 m_dormantNodeWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
240 delete m_dormantNodeWindows
;
241 m_dormantNodeWindows
= 0;
244 if (m_connectionWindows
) {
245 while (m_connectionWindows
->CountItems() > 0) {
246 connection_window
*entry
= static_cast<connection_window
*>
247 (m_connectionWindows
->ItemAt(0));
248 if (entry
&& entry
->window
) {
249 BMessenger
messenger(0, entry
->window
);
250 messenger
.SendMessage(B_QUIT_REQUESTED
);
252 m_connectionWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
255 delete m_connectionWindows
;
256 m_connectionWindows
= 0;
259 if (m_inputWindows
) {
260 while (m_inputWindows
->CountItems() > 0) {
261 input_window
*entry
= static_cast<input_window
*>
262 (m_inputWindows
->ItemAt(0));
263 if (entry
&& entry
->window
) {
264 BMessenger
messenger(0, entry
->window
);
265 messenger
.SendMessage(B_QUIT_REQUESTED
);
267 m_inputWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
270 delete m_inputWindows
;
274 if (m_outputWindows
) {
275 while (m_outputWindows
->CountItems() > 0) {
276 output_window
*entry
= static_cast<output_window
*>
277 (m_outputWindows
->ItemAt(0));
278 if (entry
&& entry
->window
) {
279 BMessenger
messenger(0, entry
->window
);
280 messenger
.SendMessage(B_QUIT_REQUESTED
);
282 m_outputWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
285 delete m_outputWindows
;
290 // -------------------------------------------------------- //
291 // *** singleton access
292 // -------------------------------------------------------- //
295 InfoWindowManager
*InfoWindowManager::Instance() {
296 D_ACCESS(("InfoWindowManager::Instance()\n"));
299 D_ACCESS((" -> create instance\n"));
300 s_instance
= new InfoWindowManager();
307 void InfoWindowManager::shutDown() {
308 D_WINDOW(("InfoWindowManager::shutDown()\n"));
317 // -------------------------------------------------------- //
319 // -------------------------------------------------------- //
321 status_t
InfoWindowManager::openWindowFor(
322 const NodeRef
*ref
) {
323 D_WINDOW(("InfoWindowManager::openWindowFor(live_node)\n"));
325 // make absolutely sure we're locked
327 debugger("The looper must be locked !");
330 // make sure the ref is valid
336 if (_findWindowFor(ref
->id(), &window
)) {
337 // window for this node already exists, activate it
338 window
->SetWorkspaces(B_CURRENT_WORKSPACE
);
343 BRect frame
= InfoView::M_DEFAULT_FRAME
;
344 frame
.OffsetTo(m_nextWindowPosition
);
345 m_nextWindowPosition
+= M_DEFAULT_OFFSET
;
346 window
= new InfoWindow(frame
);
348 if (_addWindowFor(ref
, window
)) {
349 // find the correct InfoView sub-class
350 BMediaRoster
*roster
= BMediaRoster::CurrentRoster();
351 dormant_node_info dormantNodeInfo
;
352 if (ref
->kind() & B_FILE_INTERFACE
)
354 window
->AddChild(new FileNodeInfoView(ref
));
356 else if (roster
->GetDormantNodeFor(ref
->node(), &dormantNodeInfo
) != B_OK
) {
359 if ((get_port_info(ref
->node().port
, &portInfo
) == B_OK
)
360 && (be_roster
->GetRunningAppInfo(portInfo
.team
, &appInfo
) == B_OK
)) {
361 app_info thisAppInfo
;
362 if ((be_app
->GetAppInfo(&thisAppInfo
) != B_OK
)
363 || ((strcmp(appInfo
.signature
, thisAppInfo
.signature
) != 0)
364 && (strcmp(appInfo
.signature
, addon_host::g_appSignature
) != 0))) {
365 window
->AddChild(new AppNodeInfoView(ref
));
368 window
->AddChild(new LiveNodeInfoView(ref
));
372 window
->AddChild(new LiveNodeInfoView(ref
));
376 window
->AddChild(new LiveNodeInfoView(ref
));
378 // display the window
388 status_t
InfoWindowManager::openWindowFor(
389 const dormant_node_info
&info
) {
390 D_WINDOW(("InfoWindowManager::openWindowFor(dormant_node)\n"));
392 // make absolutely sure we're locked
394 debugger("The looper must be locked !");
398 if (_findWindowFor(info
, &window
)) {
399 // window for this node already exists, activate it
400 window
->SetWorkspaces(B_CURRENT_WORKSPACE
);
405 BRect frame
= InfoView::M_DEFAULT_FRAME
;
406 frame
.OffsetTo(m_nextWindowPosition
);
407 m_nextWindowPosition
+= M_DEFAULT_OFFSET
;
408 window
= new InfoWindow(frame
);
410 if (_addWindowFor(info
, window
)) {
411 window
->AddChild(new DormantNodeInfoView(info
));
421 status_t
InfoWindowManager::openWindowFor(
422 const Connection
&connection
) {
423 D_WINDOW(("InfoWindowManager::openWindowFor(connection)\n"));
425 // make absolutely sure we're locked
427 debugger("The looper must be locked !");
431 if (_findWindowFor(connection
.source(), connection
.destination(), &window
)) {
432 // window for this node already exists, activate it
433 window
->SetWorkspaces(B_CURRENT_WORKSPACE
);
438 BRect frame
= InfoView::M_DEFAULT_FRAME
;
439 frame
.OffsetTo(m_nextWindowPosition
);
440 m_nextWindowPosition
+= M_DEFAULT_OFFSET
;
441 window
= new InfoWindow(frame
);
443 if (_addWindowFor(connection
, window
)) {
444 window
->AddChild(new ConnectionInfoView(connection
));
454 status_t
InfoWindowManager::openWindowFor(
455 const media_input
&input
) {
456 D_WINDOW(("InfoWindowManager::openWindowFor(input)\n"));
458 // make absolutely sure we're locked
460 debugger("The looper must be locked !");
464 if (_findWindowFor(input
.destination
, &window
)) {
465 // window for this node already exists, activate it
466 window
->SetWorkspaces(B_CURRENT_WORKSPACE
);
471 BRect frame
= InfoView::M_DEFAULT_FRAME
;
472 frame
.OffsetTo(m_nextWindowPosition
);
473 m_nextWindowPosition
+= M_DEFAULT_OFFSET
;
474 window
= new InfoWindow(frame
);
476 if (_addWindowFor(input
, window
)) {
477 window
->AddChild(new EndPointInfoView(input
));
487 status_t
InfoWindowManager::openWindowFor(
488 const media_output
&output
) {
489 D_WINDOW(("InfoWindowManager::openWindowFor(output)\n"));
491 // make absolutely sure we're locked
493 debugger("The looper must be locked !");
497 if (_findWindowFor(output
.source
, &window
)) {
498 // window for this node already exists, activate it
499 window
->SetWorkspaces(B_CURRENT_WORKSPACE
);
504 BRect frame
= InfoView::M_DEFAULT_FRAME
;
505 frame
.OffsetTo(m_nextWindowPosition
);
506 m_nextWindowPosition
+= M_DEFAULT_OFFSET
;
507 window
= new BWindow(frame
, "", B_DOCUMENT_WINDOW
, 0);
509 if (_addWindowFor(output
, window
)) {
510 window
->AddChild(new EndPointInfoView(output
));
520 // -------------------------------------------------------- //
522 // -------------------------------------------------------- //
524 void InfoWindowManager::MessageReceived(
526 D_MESSAGE(("InfoWindowManager::MessageReceived()\n"));
528 switch (message
->what
) {
529 case M_LIVE_NODE_WINDOW_CLOSED
: {
530 D_MESSAGE((" -> M_LIVE_NODE_WINDOW_CLOSED\n"));
532 if (message
->FindInt32("nodeID", &nodeID
) != B_OK
) {
535 _removeWindowFor(nodeID
);
538 case M_DORMANT_NODE_WINDOW_CLOSED
: {
539 D_MESSAGE((" -> M_DORMANT_NODE_WINDOW_CLOSED\n"));
540 dormant_node_info info
;
541 if (message
->FindInt32("addOnID", &info
.addon
) != B_OK
) {
544 if (message
->FindInt32("flavorID", &info
.flavor_id
) != B_OK
) {
547 _removeWindowFor(info
);
550 case M_CONNECTION_WINDOW_CLOSED
: {
551 D_MESSAGE((" -> M_CONNECTION_WINDOW_CLOSED\n"));
553 if (message
->FindInt32("source_port", &source
.port
) != B_OK
) {
556 if (message
->FindInt32("source_id", &source
.id
) != B_OK
) {
559 media_destination destination
;
560 if (message
->FindInt32("destination_port", &destination
.port
) != B_OK
) {
563 if (message
->FindInt32("destination_id", &destination
.id
) != B_OK
) {
566 _removeWindowFor(source
, destination
);
569 case M_INPUT_WINDOW_CLOSED
: {
570 D_MESSAGE((" -> M_INPUT_WINDOW_CLOSED\n"));
571 media_destination destination
;
572 if (message
->FindInt32("destination_port", &destination
.port
) != B_OK
) {
575 if (message
->FindInt32("destination_id", &destination
.id
) != B_OK
) {
578 _removeWindowFor(destination
);
581 case M_OUTPUT_WINDOW_CLOSED
: {
582 D_MESSAGE((" -> M_OUTPUT_WINDOW_CLOSED\n"));
584 if (message
->FindInt32("source_port", &source
.port
) != B_OK
) {
587 if (message
->FindInt32("source_id", &source
.id
) != B_OK
) {
590 _removeWindowFor(source
);
593 case NodeRef::M_RELEASED
: {
594 D_MESSAGE((" -> NodeRef::M_RELEASED\n"));
596 if (message
->FindInt32("nodeID", &nodeID
) != B_OK
) {
600 if (_findWindowFor(nodeID
, &window
)) {
603 _removeWindowFor(nodeID
);
607 case B_MEDIA_CONNECTION_BROKEN
: {
608 D_MESSAGE((" -> B_MEDIA_CONNECTION_BROKEN\n"));
611 if (message
->FindData("source", B_RAW_TYPE
, &data
, &dataSize
) != B_OK
) {
614 const media_source source
= *reinterpret_cast<const media_source
*>(data
);
615 if (message
->FindData("destination", B_RAW_TYPE
, &data
, &dataSize
) != B_OK
) {
618 const media_destination destination
= *reinterpret_cast<const media_destination
*>(data
);
620 if (_findWindowFor(source
, destination
, &window
)) {
623 _removeWindowFor(source
, destination
);
628 BLooper::MessageReceived(message
);
633 // -------------------------------------------------------- //
634 // *** internal operations
635 // -------------------------------------------------------- //
637 bool InfoWindowManager::_addWindowFor(
640 D_INTERNAL(("InfoWindowManager::_addWindowFor(live_node)\n"));
642 if (!m_liveNodeWindows
) {
643 m_liveNodeWindows
= new BList();
646 live_node_window
*entry
= new live_node_window(ref
, window
);
647 if (m_liveNodeWindows
->AddItem(reinterpret_cast<void *>(entry
))) {
648 add_observer(this, entry
->ref
);
655 bool InfoWindowManager::_findWindowFor(
657 BWindow
**outWindow
) {
658 D_INTERNAL(("InfoWindowManager::_findWindowFor(live_node)\n"));
660 if (!m_liveNodeWindows
) {
664 for (int32 i
= 0; i
< m_liveNodeWindows
->CountItems(); i
++) {
665 live_node_window
*entry
= static_cast<live_node_window
*>
666 (m_liveNodeWindows
->ItemAt(i
));
667 if (entry
->ref
->id() == nodeID
) {
668 *outWindow
= entry
->window
;
676 void InfoWindowManager::_removeWindowFor(
678 D_INTERNAL(("InfoWindowManager::_removeWindowFor(live_node)\n"));
680 if (!m_liveNodeWindows
) {
684 for (int32 i
= 0; i
< m_liveNodeWindows
->CountItems(); i
++) {
685 live_node_window
*entry
= static_cast<live_node_window
*>
686 (m_liveNodeWindows
->ItemAt(i
));
687 if (entry
->ref
->id() == nodeID
) {
688 m_liveNodeWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
689 remove_observer(this, entry
->ref
);
694 if (m_liveNodeWindows
->CountItems() <= 0) {
695 delete m_liveNodeWindows
;
696 m_liveNodeWindows
= 0;
700 bool InfoWindowManager::_addWindowFor(
701 const dormant_node_info
&info
,
703 D_INTERNAL(("InfoWindowManager::_addWindowFor(dormant_node)\n"));
705 if (!m_dormantNodeWindows
) {
706 m_dormantNodeWindows
= new BList();
709 dormant_node_window
*entry
= new dormant_node_window(info
, window
);
710 return m_dormantNodeWindows
->AddItem(reinterpret_cast<void *>(entry
));
713 bool InfoWindowManager::_findWindowFor(
714 const dormant_node_info
&info
,
715 BWindow
**outWindow
) {
716 D_INTERNAL(("InfoWindowManager::_findWindowFor(dormant_node)\n"));
718 if (!m_dormantNodeWindows
) {
722 for (int32 i
= 0; i
< m_dormantNodeWindows
->CountItems(); i
++) {
723 dormant_node_window
*entry
= static_cast<dormant_node_window
*>
724 (m_dormantNodeWindows
->ItemAt(i
));
725 if ((entry
->info
.addon
== info
.addon
)
726 && (entry
->info
.flavor_id
== info
.flavor_id
)) {
727 *outWindow
= entry
->window
;
735 void InfoWindowManager::_removeWindowFor(
736 const dormant_node_info
&info
) {
737 D_INTERNAL(("InfoWindowManager::_removeWindowFor(dormant_node)\n"));
739 if (!m_dormantNodeWindows
) {
743 for (int32 i
= 0; i
< m_dormantNodeWindows
->CountItems(); i
++) {
744 dormant_node_window
*entry
= static_cast<dormant_node_window
*>
745 (m_dormantNodeWindows
->ItemAt(i
));
746 if ((entry
->info
.addon
== info
.addon
)
747 && (entry
->info
.flavor_id
== info
.flavor_id
)) {
748 m_dormantNodeWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
753 if (m_dormantNodeWindows
->CountItems() >= 0) {
754 delete m_dormantNodeWindows
;
755 m_dormantNodeWindows
= 0;
759 bool InfoWindowManager::_addWindowFor(
760 const Connection
&connection
,
762 D_INTERNAL(("InfoWindowManager::_addWindowFor(connection)\n"));
764 if (!m_connectionWindows
) {
765 m_connectionWindows
= new BList();
768 connection_window
*entry
= new connection_window(connection
.source(),
769 connection
.destination(),
771 return m_connectionWindows
->AddItem(reinterpret_cast<void *>(entry
));
774 bool InfoWindowManager::_findWindowFor(
775 const media_source
&source
,
776 const media_destination
&destination
,
777 BWindow
**outWindow
) {
778 D_INTERNAL(("InfoWindowManager::_findWindowFor(connection)\n"));
780 if (!m_connectionWindows
) {
784 for (int32 i
= 0; i
< m_connectionWindows
->CountItems(); i
++) {
785 connection_window
*entry
= static_cast<connection_window
*>
786 (m_connectionWindows
->ItemAt(i
));
787 if ((entry
->source
== source
)
788 && (entry
->destination
== destination
)) {
789 *outWindow
= entry
->window
;
797 void InfoWindowManager::_removeWindowFor(
798 const media_source
&source
,
799 const media_destination
&destination
) {
800 D_INTERNAL(("InfoWindowManager::_removeWindowFor(connection)\n"));
802 if (!m_connectionWindows
) {
806 for (int32 i
= 0; i
< m_connectionWindows
->CountItems(); i
++) {
807 connection_window
*entry
= static_cast<connection_window
*>
808 (m_connectionWindows
->ItemAt(i
));
809 if ((entry
->source
== source
)
810 && (entry
->destination
== destination
)) {
811 m_connectionWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
816 if (m_connectionWindows
->CountItems() >= 0) {
817 delete m_connectionWindows
;
818 m_connectionWindows
= 0;
822 bool InfoWindowManager::_addWindowFor(
823 const media_input
&input
,
825 D_INTERNAL(("InfoWindowManager::_addWindowFor(input)\n"));
827 if (!m_inputWindows
) {
828 m_inputWindows
= new BList();
831 input_window
*entry
= new input_window(input
.destination
, window
);
832 return m_inputWindows
->AddItem(reinterpret_cast<void *>(entry
));
835 bool InfoWindowManager::_findWindowFor(
836 const media_destination
&destination
,
837 BWindow
**outWindow
) {
838 D_INTERNAL(("InfoWindowManager::_findWindowFor(input)\n"));
840 if (!m_inputWindows
) {
844 for (int32 i
= 0; i
< m_inputWindows
->CountItems(); i
++) {
845 input_window
*entry
= static_cast<input_window
*>
846 (m_inputWindows
->ItemAt(i
));
847 if (entry
->destination
== destination
) {
848 *outWindow
= entry
->window
;
856 void InfoWindowManager::_removeWindowFor(
857 const media_destination
&destination
) {
858 D_INTERNAL(("InfoWindowManager::_removeWindowFor(input)\n"));
860 if (!m_inputWindows
) {
864 for (int32 i
= 0; i
< m_inputWindows
->CountItems(); i
++) {
865 input_window
*entry
= static_cast<input_window
*>
866 (m_inputWindows
->ItemAt(i
));
867 if (entry
->destination
== destination
) {
868 m_inputWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
873 if (m_inputWindows
->CountItems() >= 0) {
874 delete m_inputWindows
;
879 bool InfoWindowManager::_addWindowFor(
880 const media_output
&output
,
882 D_INTERNAL(("InfoWindowManager::_addWindowFor(output)\n"));
884 if (!m_outputWindows
) {
885 m_outputWindows
= new BList();
888 output_window
*entry
= new output_window(output
.source
, window
);
889 return m_outputWindows
->AddItem(reinterpret_cast<void *>(entry
));
892 bool InfoWindowManager::_findWindowFor(
893 const media_source
&source
,
894 BWindow
**outWindow
) {
895 D_INTERNAL(("InfoWindowManager::_findWindowFor(output)\n"));
897 if (!m_outputWindows
) {
901 for (int32 i
= 0; i
< m_outputWindows
->CountItems(); i
++) {
902 output_window
*entry
= static_cast<output_window
*>
903 (m_outputWindows
->ItemAt(i
));
904 if (entry
->source
== source
) {
905 *outWindow
= entry
->window
;
913 void InfoWindowManager::_removeWindowFor(
914 const media_source
&source
) {
915 D_INTERNAL(("InfoWindowManager::_removeWindowFor(output)\n"));
917 if (!m_outputWindows
) {
921 for (int32 i
= 0; i
< m_outputWindows
->CountItems(); i
++) {
922 output_window
*entry
= static_cast<output_window
*>
923 (m_outputWindows
->ItemAt(i
));
924 if (entry
->source
== source
) {
925 m_outputWindows
->RemoveItem(reinterpret_cast<void *>(entry
));
930 if (m_outputWindows
->CountItems() >= 0) {
931 delete m_outputWindows
;
936 // END -- InfoWindowManager.cpp --