]> git.sesse.net Git - vlc/blob - plugins/win32/disc.cpp
* Added a win32 interface plugin, developed with Borland C++ Builder.
[vlc] / plugins / win32 / disc.cpp
1 /*****************************************************************************\r
2  * disc.cpp: "Open disc" dialog box.\r
3  *****************************************************************************\r
4  * Copyright (C) 2002 VideoLAN\r
5  *\r
6  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
7  *\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
12  * \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
17  *\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
22 \r
23 #include <vcl.h>\r
24 #pragma hdrstop\r
25 \r
26 #include <videolan/vlc.h>\r
27 \r
28 #include "stream_control.h"\r
29 #include "input_ext-intf.h"\r
30 \r
31 #include "interface.h"\r
32 #include "intf_playlist.h"\r
33 \r
34 #include "win32_common.h"\r
35 \r
36 #include "disc.h"\r
37 //---------------------------------------------------------------------------\r
38 //#pragma package(smart_init)\r
39 #pragma resource "*.dfm"\r
40 \r
41 extern  struct intf_thread_s *p_intfGlobal;\r
42 \r
43 //---------------------------------------------------------------------------\r
44 __fastcall TDiscDlg::TDiscDlg( TComponent* Owner )\r
45         : TForm( Owner )\r
46 {\r
47     char *psz_dvd_device = config_GetPszVariable( "dvd_device" );\r
48     char *psz_vcd_device = config_GetPszVariable( "vcd_device" );\r
49 \r
50     if( psz_dvd_device )\r
51     {\r
52         EditDevice->Text.sprintf( "%s", psz_dvd_device );\r
53         free( psz_dvd_device );\r
54     }\r
55 \r
56     if( psz_vcd_device )\r
57     {\r
58         EditDevice->Text.sprintf( "%s", psz_vcd_device );\r
59         free( psz_vcd_device );\r
60     }\r
61 }\r
62 //---------------------------------------------------------------------------\r
63 void __fastcall TDiscDlg::FormShow( TObject *Sender )\r
64 {\r
65     p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = true;\r
66     p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = true;\r
67 }\r
68 //---------------------------------------------------------------------------\r
69 void __fastcall TDiscDlg::FormHide( TObject *Sender )\r
70 {\r
71     p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = false;\r
72     p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = false;\r
73 }\r
74 //---------------------------------------------------------------------------\r
75 void __fastcall TDiscDlg::BitBtnCancelClick( TObject *Sender )\r
76 {\r
77     Hide();\r
78 }\r
79 //---------------------------------------------------------------------------\r
80 void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender )\r
81 {\r
82     AnsiString  Device, Source, Method, Title, Chapter;\r
83     int         i_end = p_main->p_playlist->i_size;\r
84 \r
85     Hide();\r
86 \r
87     Device = EditDevice->Text;\r
88 \r
89     /* Check which method was activated */\r
90     if( RadioGroupType->ItemIndex == 0 )\r
91     {\r
92         Method = "dvd";\r
93     }\r
94     else\r
95     {\r
96         Method = "vcd";\r
97     }\r
98     \r
99     /* Select title and chapter */\r
100     Title.sprintf( "%d", UpDownTitle->Position );\r
101     Chapter.sprintf( "%d", UpDownChapter->Position );\r
102 \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
106 \r
107     /* update the display */\r
108     p_intfGlobal->p_sys->p_playlist->UpdateGrid( p_main->p_playlist );\r
109 \r
110     /* stop current item, select added item */\r
111     if( p_input_bank->pp_input[0] != NULL )\r
112     {\r
113         p_input_bank->pp_input[0]->b_eof = 1;\r
114     }\r
115 \r
116     intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );\r
117 }\r
118 //---------------------------------------------------------------------------\r
119 \r