1 /*****************************************************************************
\r
2 * disc.cpp: "Open disc" dialog box.
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2002 VideoLAN
\r
6 * Authors: Olivier Teuliere <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
31 #include "interface.h"
\r
32 #include "intf_playlist.h"
\r
34 #include "win32_common.h"
\r
37 //---------------------------------------------------------------------------
\r
38 //#pragma package(smart_init)
\r
39 #pragma resource "*.dfm"
\r
41 extern struct intf_thread_s *p_intfGlobal;
\r
43 //---------------------------------------------------------------------------
\r
44 __fastcall TDiscDlg::TDiscDlg( TComponent* Owner )
\r
47 char *psz_dvd_device = config_GetPszVariable( "dvd_device" );
\r
48 char *psz_vcd_device = config_GetPszVariable( "vcd_device" );
\r
50 if( psz_dvd_device )
\r
52 EditDevice->Text.sprintf( "%s", psz_dvd_device );
\r
53 free( psz_dvd_device );
\r
56 if( psz_vcd_device )
\r
58 EditDevice->Text.sprintf( "%s", psz_vcd_device );
\r
59 free( psz_vcd_device );
\r
62 //---------------------------------------------------------------------------
\r
63 void __fastcall TDiscDlg::FormShow( TObject *Sender )
\r
65 p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = true;
\r
66 p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = true;
\r
68 //---------------------------------------------------------------------------
\r
69 void __fastcall TDiscDlg::FormHide( TObject *Sender )
\r
71 p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = false;
\r
72 p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = false;
\r
74 //---------------------------------------------------------------------------
\r
75 void __fastcall TDiscDlg::BitBtnCancelClick( TObject *Sender )
\r
79 //---------------------------------------------------------------------------
\r
80 void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender )
\r
82 AnsiString Device, Source, Method, Title, Chapter;
\r
83 int i_end = p_main->p_playlist->i_size;
\r
87 Device = EditDevice->Text;
\r
89 /* Check which method was activated */
\r
90 if( RadioGroupType->ItemIndex == 0 )
\r
99 /* Select title and chapter */
\r
100 Title.sprintf( "%d", UpDownTitle->Position );
\r
101 Chapter.sprintf( "%d", UpDownChapter->Position );
\r
103 /* Build source name and add it to playlist */
\r
104 Source = Method + ":" + Device + "@" + Title + "," + Chapter;
\r
105 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, Source.c_str() );
\r
107 /* update the display */
\r
108 p_intfGlobal->p_sys->p_playlist->UpdateGrid( p_main->p_playlist );
\r
110 /* stop current item, select added item */
\r
111 if( p_input_bank->pp_input[0] != NULL )
\r
113 p_input_bank->pp_input[0]->b_eof = 1;
\r
116 intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
\r
118 //---------------------------------------------------------------------------
\r