]> git.sesse.net Git - vlc/blob - plugins/win32/disc.cpp
* New icons for the toolbar buttons
[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 "disc.h"\r
35 #include "win32_common.h"\r
36 \r
37 //---------------------------------------------------------------------------\r
38 //#pragma package(smart_init)\r
39 #pragma link "CSPIN"\r
40 #pragma resource "*.dfm"\r
41 \r
42 extern  struct intf_thread_s *p_intfGlobal;\r
43 \r
44 //---------------------------------------------------------------------------\r
45 __fastcall TDiscDlg::TDiscDlg( TComponent* Owner )\r
46         : TForm( Owner )\r
47 {\r
48     /* Simulate a click to get the correct device name */\r
49     RadioGroupTypeClick( RadioGroupType );\r
50 }\r
51 //---------------------------------------------------------------------------\r
52 void __fastcall TDiscDlg::FormShow( TObject *Sender )\r
53 {\r
54     p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = true;\r
55     p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = true;\r
56 }\r
57 //---------------------------------------------------------------------------\r
58 void __fastcall TDiscDlg::FormHide( TObject *Sender )\r
59 {\r
60     p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = false;\r
61     p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = false;\r
62 }\r
63 //---------------------------------------------------------------------------\r
64 void __fastcall TDiscDlg::BitBtnCancelClick( TObject *Sender )\r
65 {\r
66     Hide();\r
67 }\r
68 //---------------------------------------------------------------------------\r
69 void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender )\r
70 {\r
71     AnsiString  Device, Source, Method, Title, Chapter;\r
72     int         i_end = p_main->p_playlist->i_size;\r
73 \r
74     Hide();\r
75 \r
76     Device = EditDevice->Text;\r
77 \r
78     /* Check which method was activated */\r
79     if( RadioGroupType->ItemIndex == 0 )\r
80     {\r
81         Method = "dvd";\r
82     }\r
83     else\r
84     {\r
85         Method = "vcd";\r
86     }\r
87 \r
88     /* Select title and chapter */\r
89     Title.sprintf( "%d", SpinEditTitle->Value );\r
90     Chapter.sprintf( "%d", SpinEditChapter->Value );\r
91 \r
92     /* Build source name and add it to playlist */\r
93     Source = Method + ":" + Device + "@" + Title + "," + Chapter;\r
94     intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, Source.c_str() );\r
95 \r
96     /* update the display */\r
97     p_intfGlobal->p_sys->p_playlist->UpdateGrid( p_main->p_playlist );\r
98 \r
99     /* stop current item, select added item */\r
100     if( p_input_bank->pp_input[0] != NULL )\r
101     {\r
102         p_input_bank->pp_input[0]->b_eof = 1;\r
103     }\r
104 \r
105     intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );\r
106 }\r
107 //---------------------------------------------------------------------------\r
108 void __fastcall TDiscDlg::RadioGroupTypeClick( TObject *Sender )\r
109 {\r
110     TRadioGroup *RadioGroupType = (TRadioGroup *)Sender;\r
111     char *psz_device;\r
112 \r
113     if( RadioGroupType->ItemIndex == 0 )\r
114     {\r
115         psz_device = config_GetPszVariable( "dvd" );\r
116     }\r
117     else\r
118     {\r
119         psz_device = config_GetPszVariable( "vcd" );\r
120     }\r
121 \r
122     if( psz_device )\r
123     {\r
124         EditDevice->Text = psz_device;\r
125         free( psz_device );\r
126     }\r
127 }\r
128 //---------------------------------------------------------------------------\r
129 \r