1 /*****************************************************************************
2 * InterfaceWindow.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: InterfaceWindow.cpp,v 1.20 2003/01/22 01:13:22 titer Exp $
7 * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * Tony Castley <tony@castley.net>
10 * Richard Shepherd <richard@rshepherd.demon.co.uk>
11 * Stephan Aßmus <stippi@yellowbites.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
26 *****************************************************************************/
29 #include <kernel/OS.h>
30 #include <InterfaceKit.h>
32 #include <StorageKit.h>
33 #include <SupportKit.h>
36 #include <scsiprobe_driver.h>
45 /* BeOS interface headers */
46 #include "VlcWrapper.h"
48 #include "MediaControlView.h"
49 #include "PlayListWindow.h"
50 #include "PreferencesWindow.h"
51 #include "InterfaceWindow.h"
53 #define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
56 /*****************************************************************************
58 *****************************************************************************/
60 InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
61 intf_thread_t *p_interface )
62 : BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
63 B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
64 p_intf( p_interface ),
66 fSubtitlesPanel( NULL ),
67 fLastUpdateTime( system_time() )
70 p_wrapper = p_intf->p_sys->p_wrapper;
71 p_intf->p_sys->b_dvdold = false;
73 fPlaylistIsEmpty = ( p_wrapper->PlaylistSize() < 0 );
75 fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ),
79 BScreen *p_screen = new BScreen();
80 BRect screen_rect = p_screen->Frame();
83 window_rect.Set( ( screen_rect.right - PREFS_WINDOW_WIDTH ) / 2,
84 ( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2,
85 ( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2,
86 ( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 );
87 fPreferencesWindow = new PreferencesWindow( window_rect,
92 SetName( "interface" );
93 SetTitle( VOUT_TITLE );
95 // the media control view
96 p_mediaControl = new MediaControlView( BRect( 0.0, 0.0, 250.0, 50.0 ),
98 p_mediaControl->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
99 p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
102 p_mediaControl->GetPreferredSize( &width, &height );
104 // set up the main menu
105 fMenuBar = new BMenuBar( BRect(0.0, 0.0, width, 15.0), "main menu",
106 B_FOLLOW_NONE, B_ITEMS_IN_ROW, false );
108 // make menu bar resize to correct height
109 float menuWidth, menuHeight;
110 fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
111 fMenuBar->ResizeTo( width, menuHeight ); // don't change! it's a workarround!
112 // take care of proper size for ourself
113 height += fMenuBar->Bounds().Height();
114 ResizeTo( width, height );
116 p_mediaControl->MoveTo( fMenuBar->Bounds().LeftBottom() + BPoint(0.0, 1.0) );
117 AddChild( fMenuBar );
118 AddChild( p_mediaControl );
121 BMenu* fileMenu = new BMenu( "File" );
122 fMenuBar->AddItem( fileMenu );
123 fileMenu->AddItem( new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
124 new BMessage( OPEN_FILE ), 'O') );
126 fileMenu->AddItem( new CDMenu( "Open Disc" ) );
128 fileMenu->AddItem( new BMenuItem( "Load a subtitle file" B_UTF8_ELLIPSIS,
129 new BMessage( LOAD_SUBFILE ) ) );
131 fileMenu->AddSeparatorItem();
132 fileMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
133 new BMessage( OPEN_PLAYLIST ), 'P') );
135 fileMenu->AddSeparatorItem();
136 BMenuItem* item = new BMenuItem( "About" B_UTF8_ELLIPSIS,
137 new BMessage( B_ABOUT_REQUESTED ), 'A');
138 item->SetTarget( be_app );
139 fileMenu->AddItem( item );
140 fileMenu->AddItem( new BMenuItem( "Quit", new BMessage( B_QUIT_REQUESTED ), 'Q') );
142 fLanguageMenu = new LanguageMenu("Language", AUDIO_ES, p_wrapper);
143 fSubtitlesMenu = new LanguageMenu("Subtitles", SPU_ES, p_wrapper);
145 /* Add the Audio menu */
146 fAudioMenu = new BMenu( "Audio" );
147 fMenuBar->AddItem ( fAudioMenu );
148 fAudioMenu->AddItem( fLanguageMenu );
149 fAudioMenu->AddItem( fSubtitlesMenu );
151 fPrevTitleMI = new BMenuItem( "Prev Title", new BMessage( PREV_TITLE ) );
152 fNextTitleMI = new BMenuItem( "Next Title", new BMessage( NEXT_TITLE ) );
153 fPrevChapterMI = new BMenuItem( "Prev Chapter", new BMessage( PREV_CHAPTER ) );
154 fNextChapterMI = new BMenuItem( "Next Chapter", new BMessage( NEXT_CHAPTER ) );
156 /* Add the Navigation menu */
157 fNavigationMenu = new BMenu( "Navigation" );
158 fMenuBar->AddItem( fNavigationMenu );
159 fNavigationMenu->AddItem( fPrevTitleMI );
160 fNavigationMenu->AddItem( fNextTitleMI );
161 fNavigationMenu->AddItem( fTitleMenu = new TitleMenu( "Go to Title", p_intf ) );
162 fNavigationMenu->AddSeparatorItem();
163 fNavigationMenu->AddItem( fPrevChapterMI );
164 fNavigationMenu->AddItem( fNextChapterMI );
165 fNavigationMenu->AddItem( fChapterMenu = new ChapterMenu( "Go to Chapter", p_intf ) );
167 /* Add the Speed menu */
168 fSpeedMenu = new BMenu( "Speed" );
169 fSpeedMenu->SetRadioMode( true );
170 fSpeedMenu->AddItem( fSlowerMI = new BMenuItem( "Slower", new BMessage( SLOWER_PLAY ) ) );
171 fNormalMI = new BMenuItem( "Normal", new BMessage( NORMAL_PLAY ) );
172 fNormalMI->SetMarked(true); // default to normal speed
173 fSpeedMenu->AddItem( fNormalMI );
174 fSpeedMenu->AddItem( fFasterMI = new BMenuItem( "Faster", new BMessage( FASTER_PLAY) ) );
175 fSpeedMenu->SetTargetForItems( this );
176 fMenuBar->AddItem( fSpeedMenu );
178 /* Add the Settings menu */
179 fSettingsMenu = new BMenu( "Settings" );
180 fSettingsMenu->AddItem( fPreferencesMI =
181 new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) );
182 fMenuBar->AddItem( fSettingsMenu );
184 // prepare fow showing
185 _SetMenusEnabled( false );
186 p_mediaControl->SetEnabled( false );
191 InterfaceWindow::~InterfaceWindow()
194 fPlaylistWindow->ReallyQuit();
197 /*****************************************************************************
198 * InterfaceWindow::FrameResized
199 *****************************************************************************/
201 InterfaceWindow::FrameResized(float width, float height)
204 fMenuBar->MoveTo(r.LeftTop());
205 fMenuBar->ResizeTo(r.Width(), fMenuBar->Bounds().Height());
206 r.top += fMenuBar->Bounds().Height() + 1.0;
207 p_mediaControl->MoveTo(r.LeftTop());
208 p_mediaControl->ResizeTo(r.Width(), r.Height());
211 /*****************************************************************************
212 * InterfaceWindow::MessageReceived
213 *****************************************************************************/
214 void InterfaceWindow::MessageReceived( BMessage * p_message )
216 int playback_status; // remember playback state
217 playback_status = p_wrapper->InputStatus();
219 switch( p_message->what )
221 case B_ABOUT_REQUESTED:
223 BAlert* alert = new BAlert( VOUT_TITLE,
224 "BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok");
237 fFilePanel = new BFilePanel();
238 fFilePanel->SetTarget( this );
243 if (fPlaylistWindow->Lock())
245 if (fPlaylistWindow->IsHidden())
246 fPlaylistWindow->Show();
248 fPlaylistWindow->Activate();
249 fPlaylistWindow->Unlock();
254 const char *psz_device;
255 BString type( "dvd" );
256 if( p_message->FindString( "device", &psz_device ) == B_OK )
258 BString device( psz_device );
259 p_wrapper->OpenDisc( type, device, 0, 0 );
266 if( fSubtitlesPanel )
268 fSubtitlesPanel->Show();
271 fSubtitlesPanel = new BFilePanel();
272 fSubtitlesPanel->SetTarget( this );
273 fSubtitlesPanel->SetMessage( new BMessage( SUBFILE_RECEIVED ) );
274 fSubtitlesPanel->Show();
277 case SUBFILE_RECEIVED:
280 if( p_message->FindRef( "refs", 0, &ref ) == B_OK )
283 if ( path.InitCheck() == B_OK )
284 p_wrapper->LoadSubFile( (char*)path.Path() );
290 // this currently stops playback not nicely
291 if (playback_status > UNDEF_S)
294 p_wrapper->PlaylistStop();
295 p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
300 /* starts playing in normal mode */
303 /* toggle between pause and play */
304 if (playback_status > UNDEF_S)
306 /* pause if currently playing */
307 if ( playback_status == PLAYING_S )
309 p_wrapper->PlaylistPause();
313 p_wrapper->PlaylistPlay();
318 /* Play a new file */
319 p_wrapper->PlaylistPlay();
324 /* cycle the fast playback modes */
325 if (playback_status > UNDEF_S)
327 p_wrapper->InputFaster();
332 /* cycle the slow playback modes */
333 if (playback_status > UNDEF_S)
335 p_wrapper->InputSlower();
340 /* restore speed to normal if already playing */
341 if (playback_status > UNDEF_S)
343 p_wrapper->PlaylistPlay();
348 /* handled by semaphores */
350 // volume related messages
352 /* adjust the volume */
353 if (playback_status > UNDEF_S)
355 p_wrapper->SetVolume( p_mediaControl->GetVolume() );
356 p_mediaControl->SetMuted( p_wrapper->IsMuted() );
362 if( p_wrapper->IsMuted() )
363 p_wrapper->VolumeRestore();
365 p_wrapper->VolumeMute();
366 p_mediaControl->SetMuted( p_wrapper->IsMuted() );
370 if ( playback_status > UNDEF_S )
373 if ( p_message->FindInt32( "channel", &channel ) == B_OK )
375 p_wrapper->ToggleLanguage( channel );
380 case SELECT_SUBTITLE:
381 if ( playback_status > UNDEF_S )
384 if ( p_message->FindInt32( "subtitle", &subtitle ) == B_OK )
385 p_wrapper->ToggleSubtitle( subtitle );
389 // specific navigation messages
392 p_wrapper->PrevTitle();
397 p_wrapper->NextTitle();
401 if ( playback_status > UNDEF_S )
404 if( p_message->FindInt32( "index", &index ) == B_OK )
405 p_wrapper->ToggleTitle( index );
410 p_wrapper->PrevChapter();
415 p_wrapper->NextChapter();
419 if ( playback_status > UNDEF_S )
422 if( p_message->FindInt32( "index", &index ) == B_OK )
423 p_wrapper->ToggleChapter( index );
427 p_wrapper->PlaylistPrev();
430 p_wrapper->PlaylistNext();
432 // general next/prev functionality (skips to whatever makes most sense)
434 p_wrapper->NavigatePrev();
437 p_wrapper->NavigateNext();
439 // drag'n'drop and system messages
440 case B_REFS_RECEIVED:
443 /* file(s) opened by the File menu -> append to the playlist;
444 * file(s) opened by drag & drop -> replace playlist;
445 * file(s) opened by 'shift' + drag & drop -> append */
446 bool replace = false;
447 if ( p_message->WasDropped() )
448 replace = !( modifiers() & B_SHIFT_KEY );
450 // build list of files to be played from message contents
453 for ( int i = 0; p_message->FindRef( "refs", i, &ref ) == B_OK; i++ )
456 if ( path.InitCheck() == B_OK )
459 // has the user dropped a dvd disk icon?
460 BDirectory dir( &ref );
461 if ( dir.InitCheck() == B_OK && dir.IsRootDirectory() )
463 BVolumeRoster volRoster;
465 BDirectory volumeRoot;
466 status_t status = volRoster.GetNextVolume( &vol );
467 while( status == B_NO_ERROR )
469 if( vol.GetRootDirectory( &volumeRoot ) == B_OK
470 && dir == volumeRoot )
474 bool isCDROM = false;
475 bool success = false;
478 char name[B_FILE_NAME_LENGTH];
479 if ( vol.GetName( name ) >= B_OK ) // disk is currently mounted
482 dev_t dev = vol.Device();
484 if ( fs_stat_dev( dev, &info ) == B_OK )
487 deviceName = info.device_name;
488 if ( vol.IsReadOnly() )
490 int i_dev = open( info.device_name, O_RDONLY );
494 if ( ioctl( i_dev, B_GET_GEOMETRY, &g, sizeof( g ) ) >= 0 )
495 isCDROM = ( g.device_type == B_CD );
502 if( success && isCDROM )
504 BMessage msg( OPEN_DVD );
505 msg.AddString( "device", deviceName.String() );
514 status = volRoster.GetNextVolume( &vol );
520 files.AddItem( new BString( (char*)path.Path() ) );
524 // give the list to VLC
525 p_wrapper->OpenFiles(&files, replace);
530 case OPEN_PREFERENCES:
531 if( fPreferencesWindow->Lock() )
533 if (fPreferencesWindow->IsHidden())
534 fPreferencesWindow->Show();
536 fPreferencesWindow->Activate();
537 fPreferencesWindow->Unlock();
542 BWindow::MessageReceived( p_message );
548 /*****************************************************************************
549 * InterfaceWindow::QuitRequested
550 *****************************************************************************/
551 bool InterfaceWindow::QuitRequested()
553 p_wrapper->PlaylistStop();
554 p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
561 /*****************************************************************************
562 * InterfaceWindow::updateInterface
563 *****************************************************************************/
564 void InterfaceWindow::updateInterface()
566 if( p_wrapper->HasInput() )
568 if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK )
570 p_wrapper->SetTimeAsFloat(p_mediaControl->GetSeekTo());
574 // p_mediaControl->SetEnabled( true );
575 bool hasTitles = p_wrapper->HasTitles();
576 bool hasChapters = p_wrapper->HasChapters();
577 p_mediaControl->SetStatus( p_wrapper->InputStatus(),
578 p_wrapper->InputRate() );
579 p_mediaControl->SetProgress( p_wrapper->GetTimeAsFloat() );
580 _SetMenusEnabled( true, hasChapters, hasTitles );
582 _UpdateSpeedMenu( p_wrapper->InputRate() );
584 // enable/disable skip buttons
587 p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext );
588 p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
590 if ( p_wrapper->HasAudio() )
592 p_mediaControl->SetAudioEnabled( true );
593 p_mediaControl->SetMuted( p_wrapper->IsMuted() );
595 p_mediaControl->SetAudioEnabled( false );
599 // update playlist as well
600 if ( fPlaylistWindow->Lock() )
602 fPlaylistWindow->UpdatePlaylist();
603 fPlaylistWindow->Unlock();
608 _SetMenusEnabled( false );
609 // p_mediaControl->SetEnabled( false );
612 /* always force the user-specified volume */
613 /* FIXME : I'm quite sure there is a cleaner way to do this */
614 if( p_wrapper->GetVolume() != p_mediaControl->GetVolume() )
616 p_wrapper->SetVolume( p_mediaControl->GetVolume() );
619 fLastUpdateTime = system_time();
622 /*****************************************************************************
623 * InterfaceWindow::IsStopped
624 *****************************************************************************/
626 InterfaceWindow::IsStopped() const
628 return (system_time() - fLastUpdateTime > INTERFACE_UPDATE_TIMEOUT);
631 /*****************************************************************************
632 * InterfaceWindow::_UpdatePlaylist
633 *****************************************************************************/
635 InterfaceWindow::_UpdatePlaylist()
637 if ( fPlaylistWindow->Lock() )
639 fPlaylistWindow->UpdatePlaylist( true );
640 fPlaylistWindow->Unlock();
641 p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
645 /*****************************************************************************
646 * InterfaceWindow::_SetMenusEnabled
647 *****************************************************************************/
649 InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles)
658 if (fNextChapterMI->IsEnabled() != hasChapters)
659 fNextChapterMI->SetEnabled(hasChapters);
660 if (fPrevChapterMI->IsEnabled() != hasChapters)
661 fPrevChapterMI->SetEnabled(hasChapters);
662 if (fChapterMenu->IsEnabled() != hasChapters)
663 fChapterMenu->SetEnabled(hasChapters);
664 if (fNextTitleMI->IsEnabled() != hasTitles)
665 fNextTitleMI->SetEnabled(hasTitles);
666 if (fPrevTitleMI->IsEnabled() != hasTitles)
667 fPrevTitleMI->SetEnabled(hasTitles);
668 if (fTitleMenu->IsEnabled() != hasTitles)
669 fTitleMenu->SetEnabled(hasTitles);
670 if (fAudioMenu->IsEnabled() != hasFile)
671 fAudioMenu->SetEnabled(hasFile);
672 if (fNavigationMenu->IsEnabled() != hasFile)
673 fNavigationMenu->SetEnabled(hasFile);
674 if (fLanguageMenu->IsEnabled() != hasFile)
675 fLanguageMenu->SetEnabled(hasFile);
676 if (fSubtitlesMenu->IsEnabled() != hasFile)
677 fSubtitlesMenu->SetEnabled(hasFile);
678 if (fSpeedMenu->IsEnabled() != hasFile)
679 fSpeedMenu->SetEnabled(hasFile);
684 /*****************************************************************************
685 * InterfaceWindow::_UpdateSpeedMenu
686 *****************************************************************************/
688 InterfaceWindow::_UpdateSpeedMenu( int rate )
690 if ( rate == DEFAULT_RATE )
692 if ( !fNormalMI->IsMarked() )
693 fNormalMI->SetMarked( true );
695 else if ( rate < DEFAULT_RATE )
697 if ( !fFasterMI->IsMarked() )
698 fFasterMI->SetMarked( true );
702 if ( !fSlowerMI->IsMarked() )
703 fSlowerMI->SetMarked( true );
707 /*****************************************************************************
708 * InterfaceWindow::_InputStreamChanged
709 *****************************************************************************/
711 InterfaceWindow::_InputStreamChanged()
713 // TODO: move more stuff from updateInterface() here!
715 p_wrapper->SetVolume( p_mediaControl->GetVolume() );
719 make_sure_frame_is_within_limits( BRect& frame, float minWidth, float minHeight,
720 float maxWidth, float maxHeight )
722 if ( frame.Width() < minWidth )
723 frame.right = frame.left + minWidth;
724 if ( frame.Height() < minHeight )
725 frame.bottom = frame.top + minHeight;
726 if ( frame.Width() > maxWidth )
727 frame.right = frame.left + maxWidth;
728 if ( frame.Height() > maxHeight )
729 frame.bottom = frame.top + maxHeight;
732 /*****************************************************************************
734 *****************************************************************************/
735 CDMenu::CDMenu(const char *name)
740 /*****************************************************************************
742 *****************************************************************************/
747 /*****************************************************************************
748 * CDMenu::AttachedToWindow
749 *****************************************************************************/
750 void CDMenu::AttachedToWindow(void)
753 while (BMenuItem* item = RemoveItem(0L))
756 BMenu::AttachedToWindow();
759 /*****************************************************************************
761 *****************************************************************************/
762 int CDMenu::GetCD( const char *directory )
764 BVolumeRoster *volRoster;
769 char name[B_FILE_NAME_LENGTH];
773 volRoster = new BVolumeRoster();
775 dir = new BDirectory();
776 status = volRoster->GetNextVolume(vol);
777 status = vol->GetRootDirectory(dir);
778 while (status == B_NO_ERROR)
780 mounted = vol->GetName(name);
781 if ((mounted == B_OK) && /* Disk is currently Mounted */
782 (vol->IsReadOnly()) ) /* Disk is read-only */
785 fs_stat_dev(dev, &info);
789 i_dev = open( info.device_name, O_RDONLY );
793 if( ioctl(i_dev, B_GET_GEOMETRY, &g, sizeof(g)) >= 0 )
795 if( g.device_type == B_CD ) //ensure the drive is a CD-ROM
798 msg = new BMessage( OPEN_DVD );
799 msg->AddString( "device", info.device_name );
800 BMenuItem *menu_item;
801 menu_item = new BMenuItem( name, msg );
802 AddItem( menu_item );
809 status = volRoster->GetNextVolume(vol);
814 /*****************************************************************************
815 * LanguageMenu::LanguageMenu
816 *****************************************************************************/
817 LanguageMenu::LanguageMenu( const char *name, int menu_kind,
818 VlcWrapper *p_wrapper )
822 this->p_wrapper = p_wrapper;
825 /*****************************************************************************
826 * LanguageMenu::~LanguageMenu
827 *****************************************************************************/
828 LanguageMenu::~LanguageMenu()
832 /*****************************************************************************
833 * LanguageMenu::AttachedToWindow
834 *****************************************************************************/
835 void LanguageMenu::AttachedToWindow()
838 while ( BMenuItem* item = RemoveItem( 0L ) )
841 SetRadioMode( true );
843 BMenu::AttachedToWindow();
846 /*****************************************************************************
847 * LanguageMenu::_GetChannels
848 *****************************************************************************/
849 void LanguageMenu::_GetChannels()
854 if( ( list = p_wrapper->GetChannels( kind ) ) == NULL )
857 for( int i = 0; i < list->CountItems(); i++ )
859 item = (BMenuItem*)list->ItemAt( i );
863 if( list->CountItems() > 1 )
864 AddItem( new BSeparatorItem(), 1 );
868 /*****************************************************************************
869 * TitleMenu::TitleMenu
870 *****************************************************************************/
871 TitleMenu::TitleMenu( const char *name, intf_thread_t *p_interface )
873 p_intf( p_interface )
877 /*****************************************************************************
878 * TitleMenu::~TitleMenu
879 *****************************************************************************/
880 TitleMenu::~TitleMenu()
884 /*****************************************************************************
885 * TitleMenu::AttachedToWindow
886 *****************************************************************************/
887 void TitleMenu::AttachedToWindow()
892 while( ( item = RemoveItem( 0L ) ) )
895 if( ( list = p_intf->p_sys->p_wrapper->GetTitles() ) == NULL )
898 for( int i = 0; i < list->CountItems(); i++ )
900 item = (BMenuItem*)list->ItemAt( i );
904 BMenu::AttachedToWindow();
908 /*****************************************************************************
909 * ChapterMenu::ChapterMenu
910 *****************************************************************************/
911 ChapterMenu::ChapterMenu( const char *name, intf_thread_t *p_interface )
913 p_intf( p_interface )
917 /*****************************************************************************
918 * ChapterMenu::~ChapterMenu
919 *****************************************************************************/
920 ChapterMenu::~ChapterMenu()
924 /*****************************************************************************
925 * ChapterMenu::AttachedToWindow
926 *****************************************************************************/
927 void ChapterMenu::AttachedToWindow()
932 while( ( item = RemoveItem( 0L ) ) )
935 if( ( list = p_intf->p_sys->p_wrapper->GetChapters() ) == NULL )
938 for( int i = 0; i < list->CountItems(); i++ )
940 item = (BMenuItem*)list->ItemAt( i );
944 BMenu::AttachedToWindow();