1 /*****************************************************************************
\r
2 * mainframe.cpp: Win32 interface plugin for vlc
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2002 VideoLAN
\r
6 * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
\r
8 * This program is free software; you can redistribute it and/or modify
\r
9 * it under the terms of the GNU General Public License as published by
\r
10 * the Free Software Foundation; either version 2 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU General Public License
\r
19 * along with this program; if not, write to the Free Software
\r
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
21 *****************************************************************************/
\r
26 #include <videolan/vlc.h>
\r
28 #include "stream_control.h"
\r
29 #include "input_ext-intf.h"
\r
32 #include "video_output.h"
\r
34 #include "interface.h"
\r
35 #include "intf_playlist.h"
\r
36 #include "intf_eject.h"
\r
38 #include "mainframe.h"
\r
40 #include "control.h"
\r
42 #include "network.h"
\r
44 #include "preferences.h"
\r
45 #include "messages.h"
\r
46 #include "playlist.h"
\r
47 #include "win32_common.h"
\r
49 #include "netutils.h"
\r
51 //---------------------------------------------------------------------------
\r
52 //#pragma package(smart_init)
\r
53 #pragma resource "*.dfm"
\r
55 extern struct intf_thread_s *p_intfGlobal;
\r
56 extern int Win32Manage( intf_thread_t *p_intf );
\r
58 //---------------------------------------------------------------------------
\r
59 __fastcall TMainFrameDlg::TMainFrameDlg( TComponent* Owner )
\r
62 Application->ShowHint = true;
\r
63 Application->OnHint = DisplayHint;
\r
65 TimerManage->Interval = INTF_IDLE_SLEEP / 1000;
\r
67 TrackBar->Max = SLIDER_MAX_VALUE;
\r
69 /* default height */
\r
70 ClientHeight = 37 + ToolBar->Height;
\r
72 StringListPref = new TStringList();
\r
74 //---------------------------------------------------------------------------
\r
75 __fastcall TMainFrameDlg::~TMainFrameDlg()
\r
77 delete StringListPref;
\r
79 //---------------------------------------------------------------------------
\r
82 /*****************************************************************************
\r
84 ****************************************************************************/
\r
85 void __fastcall TMainFrameDlg::TimerManageTimer( TObject *Sender )
\r
87 Win32Manage( p_intfGlobal );
\r
89 //---------------------------------------------------------------------------
\r
90 void __fastcall TMainFrameDlg::DisplayHint( TObject *Sender )
\r
92 StatusBar->SimpleText = GetLongHint( Application->Hint );
\r
94 //---------------------------------------------------------------------------
\r
95 void __fastcall TMainFrameDlg::TrackBarChange( TObject *Sender )
\r
97 /* This function displays the current date related to the position in
\r
98 * the stream. It is called whenever the slider changes its value.
\r
99 * The lock has to be taken before the function is called */
\r
101 // vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
103 if( p_input_bank->pp_input[0] != NULL )
\r
105 #define p_area p_input_bank->pp_input[0]->stream.p_selected_area
\r
106 char psz_time[ OFFSETTOTIME_MAX_SIZE ];
\r
107 off_t Value = TrackBar->Position;
\r
109 GroupBoxSlider->Caption =
\r
110 input_OffsetToTime( p_input_bank->pp_input[0], psz_time,
\r
111 ( p_area->i_size * Value ) / (off_t)SLIDER_MAX_VALUE );
\r
115 // vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
117 //---------------------------------------------------------------------------
\r
118 void __fastcall TMainFrameDlg::FormClose( TObject *Sender,
\r
119 TCloseAction &Action )
\r
121 intf_thread_t *p_intf = p_intfGlobal;
\r
123 vlc_mutex_lock( &p_intf->change_lock );
\r
125 vlc_mutex_unlock( &p_intf->change_lock );
\r
127 /* we don't destroy the form immediatly */
\r
130 //---------------------------------------------------------------------------
\r
133 /*****************************************************************************
\r
135 ****************************************************************************/
\r
136 void __fastcall TMainFrameDlg::MenuOpenFileClick( TObject *Sender )
\r
138 int i_end = p_main->p_playlist->i_size;
\r
139 AnsiString FileName;
\r
140 if( OpenDialog1->Execute() )
\r
142 /* add the new file to the interface playlist */
\r
143 FileName = OpenDialog1->FileName;
\r
144 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
\r
145 (char*)FileName.c_str() );
\r
147 /* update the plugin display */
\r
148 p_intfGlobal->p_sys->p_playlist->UpdateGrid( p_main->p_playlist );
\r
150 /* end current item, select added item */
\r
151 if( p_input_bank->pp_input[0] != NULL )
\r
153 p_input_bank->pp_input[0]->b_eof = 1;
\r
156 intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
\r
159 //---------------------------------------------------------------------------
\r
160 void __fastcall TMainFrameDlg::MenuOpenDiscClick( TObject *Sender )
\r
162 TDiscDlg *p_disc = p_intfGlobal->p_sys->p_disc;
\r
163 if( p_disc == NULL )
\r
165 p_disc = new TDiscDlg( this );
\r
166 p_intfGlobal->p_sys->p_disc = p_disc;
\r
170 //---------------------------------------------------------------------------
\r
171 void __fastcall TMainFrameDlg::MenuNetworkStreamClick( TObject *Sender )
\r
173 TNetworkDlg *p_network = p_intfGlobal->p_sys->p_network;
\r
174 if( p_network == NULL )
\r
176 p_network = new TNetworkDlg( this );
\r
177 p_intfGlobal->p_sys->p_network = p_network;
\r
181 //---------------------------------------------------------------------------
\r
182 void __fastcall TMainFrameDlg::MenuExitClick( TObject *Sender )
\r
186 //---------------------------------------------------------------------------
\r
187 void __fastcall TMainFrameDlg::MenuFullscreenClick( TObject *Sender )
\r
189 if( p_vout_bank->i_count )
\r
191 vlc_mutex_lock( &p_vout_bank->pp_vout[0]->change_lock );
\r
193 p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
\r
195 vlc_mutex_unlock( &p_vout_bank->pp_vout[0]->change_lock );
\r
198 //---------------------------------------------------------------------------
\r
199 void __fastcall TMainFrameDlg::MenuPlaylistClick( TObject *Sender )
\r
201 TPlaylistDlg *p_playlist = p_intfGlobal->p_sys->p_playlist;
\r
202 if( p_playlist->Visible )
\r
204 p_playlist->Hide();
\r
208 p_playlist->UpdateGrid( p_main->p_playlist );
\r
209 p_playlist->Show();
\r
212 //---------------------------------------------------------------------------
\r
213 void __fastcall TMainFrameDlg::MenuMessagesClick( TObject *Sender )
\r
215 p_intfGlobal->p_sys->p_messages->Show();
\r
217 //---------------------------------------------------------------------------
\r
218 void __fastcall TMainFrameDlg::MenuPreferencesClick( TObject *Sender )
\r
220 CreatePreferences( "main" );
\r
222 //---------------------------------------------------------------------------
\r
223 void __fastcall TMainFrameDlg::MenuAboutClick( TObject *Sender )
\r
225 p_intfGlobal->p_sys->p_about = new TAboutDlg( this );
\r
226 p_intfGlobal->p_sys->p_about->ShowModal();
\r
227 delete p_intfGlobal->p_sys->p_about;
\r
229 //---------------------------------------------------------------------------
\r
232 /*****************************************************************************
\r
233 * Toolbar callbacks
\r
234 ****************************************************************************/
\r
235 void __fastcall TMainFrameDlg::ToolButtonFileClick( TObject *Sender )
\r
237 MenuOpenFileClick( Sender );
\r
239 //---------------------------------------------------------------------------
\r
240 void __fastcall TMainFrameDlg::ToolButtonDiscClick( TObject *Sender )
\r
242 MenuOpenDiscClick( Sender );
\r
244 //---------------------------------------------------------------------------
\r
245 void __fastcall TMainFrameDlg::ToolButtonNetClick( TObject *Sender )
\r
247 MenuNetworkStreamClick( Sender );
\r
249 //---------------------------------------------------------------------------
\r
250 void __fastcall TMainFrameDlg::ToolButtonPlaylistClick( TObject *Sender )
\r
252 MenuPlaylistClick( Sender );
\r
254 //---------------------------------------------------------------------------
\r
255 void __fastcall TMainFrameDlg::ToolButtonBackClick( TObject *Sender )
\r
257 ControlBack( Sender );
\r
259 //---------------------------------------------------------------------------
\r
260 void __fastcall TMainFrameDlg::ToolButtonStopClick( TObject *Sender )
\r
262 ControlStop( Sender );
\r
264 //---------------------------------------------------------------------------
\r
265 void __fastcall TMainFrameDlg::ToolButtonPlayClick( TObject *Sender )
\r
267 ControlPlay( Sender );
\r
269 //---------------------------------------------------------------------------
\r
270 void __fastcall TMainFrameDlg::ToolButtonPauseClick( TObject *Sender )
\r
272 ControlPause( Sender );
\r
274 //---------------------------------------------------------------------------
\r
275 void __fastcall TMainFrameDlg::ToolButtonSlowClick( TObject *Sender )
\r
277 ControlSlow( Sender );
\r
279 //---------------------------------------------------------------------------
\r
280 void __fastcall TMainFrameDlg::ToolButtonFastClick( TObject *Sender )
\r
282 ControlFast( Sender );
\r
284 //---------------------------------------------------------------------------
\r
285 void __fastcall TMainFrameDlg::ToolButtonPrevClick( TObject *Sender )
\r
287 p_intfGlobal->p_sys->p_playlist->Previous();
\r
289 //---------------------------------------------------------------------------
\r
290 void __fastcall TMainFrameDlg::ToolButtonNextClick( TObject *Sender )
\r
292 p_intfGlobal->p_sys->p_playlist->Next();
\r
294 //---------------------------------------------------------------------------
\r
295 void __fastcall TMainFrameDlg::ToolButtonEjectClick( TObject *Sender )
\r
297 AnsiString Device = "";
\r
300 * Get the active input
\r
301 * Determine whether we can eject a media, ie it's a VCD or DVD
\r
302 * If it's neither a VCD nor a DVD, then return
\r
305 if( p_main->p_playlist->current.psz_name != NULL )
\r
307 if( strncmp( p_main->p_playlist->current.psz_name, "dvd", 3 )
\r
308 || strncmp( p_main->p_playlist->current.psz_name, "vcd", 3 ) )
\r
310 /* Determine the device name by omitting the first 4 characters
\r
311 * and keeping 3 characters */
\r
312 Device = strdup( ( p_main->p_playlist->current.psz_name + 4 ) );
\r
313 Device = Device.SubString( 1, 2 );
\r
322 /* If there's a stream playing, we aren't allowed to eject ! */
\r
323 if( p_input_bank->pp_input[0] == NULL )
\r
325 intf_WarnMsg( 4, "intf: ejecting %s", Device.c_str() );
\r
327 intf_Eject( Device.c_str() );
\r
330 //--------------------------------------------------------------------------
\r
333 /*****************************************************************************
\r
335 ****************************************************************************/
\r
336 void __fastcall TMainFrameDlg::PopupCloseClick( TObject *Sender )
\r
338 /* We do nothing, we just need a click on a menu item
\r
339 * to close the popup. Don't ask me why... */
\r
342 //---------------------------------------------------------------------------
\r
343 void __fastcall TMainFrameDlg::PopupPlayClick( TObject *Sender )
\r
345 ToolButtonPlayClick( Sender );
\r
347 //---------------------------------------------------------------------------
\r
348 void __fastcall TMainFrameDlg::PopupPauseClick( TObject *Sender )
\r
350 ToolButtonPauseClick( Sender );
\r
352 //---------------------------------------------------------------------------
\r
353 void __fastcall TMainFrameDlg::PopupStopClick( TObject *Sender )
\r
355 ToolButtonStopClick( Sender );
\r
357 //---------------------------------------------------------------------------
\r
358 void __fastcall TMainFrameDlg::PopupBackClick( TObject *Sender )
\r
360 ToolButtonBackClick( Sender );
\r
362 //---------------------------------------------------------------------------
\r
363 void __fastcall TMainFrameDlg::PopupSlowClick( TObject *Sender )
\r
365 ToolButtonSlowClick( Sender );
\r
367 //---------------------------------------------------------------------------
\r
368 void __fastcall TMainFrameDlg::PopupFastClick( TObject *Sender )
\r
370 ToolButtonFastClick( Sender );
\r
372 //---------------------------------------------------------------------------
\r
373 void __fastcall TMainFrameDlg::PopupToggleInterfaceClick( TObject *Sender )
\r
375 this->BringToFront();
\r
377 //---------------------------------------------------------------------------
\r
378 void __fastcall TMainFrameDlg::PopupFullscreenClick( TObject *Sender )
\r
380 MenuFullscreenClick( Sender );
\r
382 //---------------------------------------------------------------------------
\r
383 void __fastcall TMainFrameDlg::PopupNextClick( TObject *Sender )
\r
385 ToolButtonNextClick( Sender );
\r
387 //---------------------------------------------------------------------------
\r
388 void __fastcall TMainFrameDlg::PopupPrevClick( TObject *Sender )
\r
390 ToolButtonPrevClick( Sender );
\r
392 //---------------------------------------------------------------------------
\r
393 void __fastcall TMainFrameDlg::PopupJumpClick( TObject *Sender )
\r
397 //---------------------------------------------------------------------------
\r
398 void __fastcall TMainFrameDlg::PopupPlaylistClick( TObject *Sender )
\r
400 MenuPlaylistClick( Sender );
\r
402 //---------------------------------------------------------------------------
\r
403 void __fastcall TMainFrameDlg::PopupPreferencesClick( TObject *Sender )
\r
405 MenuPreferencesClick( Sender );
\r
407 //---------------------------------------------------------------------------
\r
408 void __fastcall TMainFrameDlg::PopupExitClick( TObject *Sender )
\r
410 MenuExitClick( Sender );
\r
412 //---------------------------------------------------------------------------
\r
413 void __fastcall TMainFrameDlg::PopupOpenFileClick( TObject *Sender )
\r
415 MenuOpenFileClick( Sender );
\r
417 //---------------------------------------------------------------------------
\r
418 void __fastcall TMainFrameDlg::PopupOpenDiscClick( TObject *Sender )
\r
420 MenuOpenDiscClick( Sender );
\r
422 //---------------------------------------------------------------------------
\r
423 void __fastcall TMainFrameDlg::PopupNetworkStreamClick( TObject *Sender )
\r
425 MenuNetworkStreamClick( Sender );
\r
427 //---------------------------------------------------------------------------
\r
430 /*****************************************************************************
\r
431 * Callbacks for DVD/VCD navigation
\r
432 ****************************************************************************/
\r
433 void __fastcall TMainFrameDlg::ButtonTitlePrevClick( TObject *Sender )
\r
435 intf_thread_t * p_intf;
\r
436 input_area_t * p_area;
\r
439 p_intf = p_intfGlobal;
\r
440 i_id = p_input_bank->pp_input[0]->stream.p_selected_area->i_id - 1;
\r
442 /* Disallow area 0 since it is used for video_ts.vob */
\r
445 p_area = p_input_bank->pp_input[0]->stream.pp_areas[i_id];
\r
446 input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
\r
448 input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
\r
450 p_intf->p_sys->b_title_update = 1;
\r
451 vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
452 SetupMenus( p_intf );
\r
453 vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
456 //---------------------------------------------------------------------------
\r
457 void __fastcall TMainFrameDlg::ButtonTitleNextClick( TObject *Sender )
\r
459 intf_thread_t * p_intf;
\r
460 input_area_t * p_area;
\r
463 p_intf = p_intfGlobal;
\r
464 i_id = p_input_bank->pp_input[0]->stream.p_selected_area->i_id + 1;
\r
466 if( i_id < p_input_bank->pp_input[0]->stream.i_area_nb )
\r
468 p_area = p_input_bank->pp_input[0]->stream.pp_areas[i_id];
\r
469 input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
\r
471 input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
\r
473 p_intf->p_sys->b_title_update = 1;
\r
474 vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
475 SetupMenus( p_intf );
\r
476 vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
479 //---------------------------------------------------------------------------
\r
480 void __fastcall TMainFrameDlg::ButtonChapterPrevClick( TObject *Sender )
\r
482 intf_thread_t * p_intf = p_intfGlobal;
\r
483 input_area_t * p_area;
\r
485 p_area = p_input_bank->pp_input[0]->stream.p_selected_area;
\r
487 if( p_area->i_part > 0 )
\r
490 input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
\r
492 input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
\r
494 p_intf->p_sys->b_chapter_update = 1;
\r
495 vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
496 SetupMenus( p_intf );
\r
497 vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
500 //---------------------------------------------------------------------------
\r
501 void __fastcall TMainFrameDlg::ButtonChapterNextClick( TObject *Sender )
\r
503 intf_thread_t * p_intf = p_intfGlobal;
\r
504 input_area_t * p_area;
\r
506 p_area = p_input_bank->pp_input[0]->stream.p_selected_area;
\r
508 if( p_area->i_part < p_area->i_part_nb )
\r
511 input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
\r
513 input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
\r
515 p_intf->p_sys->b_chapter_update = 1;
\r
516 vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
517 SetupMenus( p_intf );
\r
518 vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
\r
521 //---------------------------------------------------------------------------
\r
524 /*****************************************************************************
\r
525 * Callback for the 'go!' button
\r
526 ****************************************************************************/
\r
527 void __fastcall TMainFrameDlg::ButtonGoClick( TObject *Sender )
\r
529 intf_thread_t *p_intf = p_intfGlobal;
\r
532 i_channel = UpDownChannel->Position;
\r
533 intf_WarnMsg( 3, "intf info: joining channel %d", i_channel );
\r
535 vlc_mutex_lock( &p_intf->change_lock );
\r
536 if( p_input_bank->pp_input[0] != NULL )
\r
538 /* end playing item */
\r
539 p_input_bank->pp_input[0]->b_eof = 1;
\r
541 /* update playlist */
\r
542 vlc_mutex_lock( &p_main->p_playlist->change_lock );
\r
544 p_main->p_playlist->i_index--;
\r
545 p_main->p_playlist->b_stopped = 1;
\r
547 vlc_mutex_unlock( &p_main->p_playlist->change_lock );
\r
549 /* FIXME: ugly hack to close input and outputs */
\r
550 p_intf->pf_manage( p_intf );
\r
553 network_ChannelJoin( i_channel );
\r
556 p_main->p_playlist->b_stopped = 0;
\r
557 p_intf->pf_manage( p_intf );
\r
559 vlc_mutex_unlock( &p_intf->change_lock );
\r
561 // input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
\r
563 //---------------------------------------------------------------------------
\r
566 /*****************************************************************************
\r
567 * ModeManage: actualise the aspect of the interface whenever the input
\r
569 *****************************************************************************
\r
570 * The lock has to be taken before you call the function.
\r
571 *****************************************************************************/
\r
572 void __fastcall TMainFrameDlg::ModeManage()
\r
574 intf_thread_t * p_intf = p_intfGlobal;
\r
575 TGroupBox * ActiveGB;
\r
579 /* hide all boxes */
\r
580 GroupBoxFile->Visible = false;
\r
581 GroupBoxNetwork->Visible = false;
\r
582 GroupBoxDisc->Visible = false;
\r
585 GroupBoxSlider->Hide();
\r
587 /* controls unavailable */
\r
590 /* show the box related to current input mode */
\r
591 if( p_input_bank->pp_input[0] != NULL )
\r
593 switch( p_input_bank->pp_input[0]->stream.i_method & 0xf0 )
\r
595 case INPUT_METHOD_FILE:
\r
596 GroupBoxFile->Visible = true;
\r
597 ActiveGB = GroupBoxFile;
\r
598 LabelFileName->Caption = p_input_bank->pp_input[0]->psz_source;
\r
600 case INPUT_METHOD_DISC:
\r
601 GroupBoxDisc->Visible = true;
\r
602 ActiveGB = GroupBoxDisc;
\r
604 case INPUT_METHOD_NETWORK:
\r
605 GroupBoxNetwork->Visible = true;
\r
606 ActiveGB = GroupBoxNetwork;
\r
607 LabelServer->Caption = p_input_bank->pp_input[0]->psz_source;
\r
608 if( config_GetIntVariable( "network_channel" ) )
\r
610 LabelChannel->Visible = true;
\r
614 LabelChannel->Visible = false;
\r
618 intf_WarnMsg( 3, "intf: can't determine input method" );
\r
619 GroupBoxFile->Visible = true;
\r
620 ActiveGB = GroupBoxFile;
\r
621 LabelFileName->Caption = p_input_bank->pp_input[0]->psz_source;
\r
625 i_Height = StatusBar->Height + ActiveGB->Height + ToolBar->Height + 47;
\r
627 /* initialize and show slider for seekable streams */
\r
628 if( p_input_bank->pp_input[0]->stream.b_seekable )
\r
630 TrackBar->Position = p_intf->p_sys->OldValue = 0;
\r
631 GroupBoxSlider->Show();
\r
632 i_Height += GroupBoxSlider->Height;
\r
635 /* control buttons for free pace streams */
\r
636 b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
\r
638 /* get ready for menu regeneration */
\r
639 p_intf->p_sys->b_program_update = 1;
\r
640 p_intf->p_sys->b_title_update = 1;
\r
641 p_intf->p_sys->b_chapter_update = 1;
\r
642 p_intf->p_sys->b_audio_update = 1;
\r
643 p_intf->p_sys->b_spu_update = 1;
\r
644 p_intf->p_sys->i_part = 0;
\r
646 p_input_bank->pp_input[0]->stream.b_changed = 0;
\r
647 intf_WarnMsg( 3, "intf: stream has changed, refreshing interface" );
\r
651 i_Height = StatusBar->Height + ToolBar->Height + 47;
\r
653 if( config_GetIntVariable( "network_channel" ) )
\r
655 GroupBoxNetwork->Visible = true;
\r
656 LabelChannel->Visible = true;
\r
657 i_Height += GroupBoxNetwork->Height;
\r
661 /* unsensitize menus */
\r
662 MenuProgram->Enabled = false;
\r
663 MenuTitle->Enabled = false;
\r
664 MenuChapter->Enabled = false;
\r
665 MenuAudio->Enabled = false;
\r
666 MenuSubtitles->Enabled = false;
\r
667 PopupNavigation->Enabled = false;
\r
668 PopupAudio->Enabled = false;
\r
669 PopupSubtitles->Enabled = false;
\r
673 /* resize main window */
\r
674 this->Height = i_Height;
\r
676 /* set control items */
\r
677 ToolButtonBack->Enabled = false;
\r
678 ToolButtonStop->Enabled = true;
\r
679 ToolButtonEject->Enabled = !b_control;
\r
680 ToolButtonPause->Enabled = b_control;
\r
681 ToolButtonSlow->Enabled = b_control;
\r
682 ToolButtonFast->Enabled = b_control;
\r
683 PopupBack->Enabled = false;
\r
684 PopupPause->Enabled = b_control;
\r
685 PopupSlow->Enabled = b_control;
\r
686 PopupFast->Enabled = b_control;
\r
688 //---------------------------------------------------------------------------
\r
691 /*****************************************************************************
\r
692 * CreateConfig: create a configuration dialog and save it for further use
\r
693 *****************************************************************************
\r
694 * Check if the dialog box is already opened, if so this will save us
\r
695 * quite a bit of work. (the interface will be destroyed when you actually
\r
696 * close the main window, but remember that it is only hidden if you
\r
697 * clicked on the action buttons). This trick also allows us not to
\r
698 * duplicate identical dialog windows.
\r
699 *****************************************************************************/
\r
700 void __fastcall TMainFrameDlg::CreatePreferences( AnsiString Name )
\r
702 TPreferencesDlg *Preferences;
\r
703 int i_index, i_pos;
\r
705 i_index = StringListPref->IndexOf( Name );
\r
706 if( i_index != -1 )
\r
708 /* config dialog already exists */
\r
709 Preferences = (TPreferencesDlg *)StringListPref->Objects[i_index];
\r
713 /* create the config dialog */
\r
714 Preferences = new TPreferencesDlg( this );
\r
715 Preferences->CreateConfigDialog( Name.c_str() );
\r
718 i_pos = StringListPref->Add( Name );
\r
719 StringListPref->Objects[i_pos] = Preferences;
\r
722 /* display the dialog */
\r
723 Preferences->Show();
\r
725 //---------------------------------------------------------------------------
\r