1 /*****************************************************************************
2 * open.cpp : WinCE gui plugin for VLC
3 *****************************************************************************
4 * Copyright (C) 2000-2004 VideoLAN
7 * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
8 * Gildas Bazin <gbazin@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
29 #include <string.h> /* strerror() */
42 /*****************************************************************************
44 *****************************************************************************/
46 /* IDs for the controls and the menu commands */
49 Notebook_Event = 1000,
61 NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
62 NetPort1_Event, NetPort2_Event, NetPort3_Event,
63 NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
66 SubsFileSettings_Event,
69 /*****************************************************************************
71 *****************************************************************************/
73 /*****************************************************************************
75 *****************************************************************************/
76 OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
77 int _i_access_method, int _i_arg, int _i_method )
82 i_current_access_method = _i_access_method;
86 for( int i = 0; i < 4; i++ )
90 net_port_label[i] = 0;
94 net_addrs_label[i] = 0;
99 /***********************************************************************
105 Processes messages sent to the main window.
107 ***********************************************************************/
108 LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
112 INITCOMMONCONTROLSEX iccex; // INITCOMMONCONTROLSEX structure
119 shidi.dwMask = SHIDIM_FLAGS;
120 shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
121 SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN;
123 SHInitDialog( &shidi );
125 //Create the menubar.
126 memset( &mbi, 0, sizeof(SHMENUBARINFO) );
127 mbi.cbSize = sizeof(SHMENUBARINFO);
128 mbi.hwndParent = hwnd;
129 mbi.dwFlags = SHCMBF_EMPTYBAR;
130 mbi.hInstRes = hInst;
132 if( !SHCreateMenuBar( &mbi ) )
134 MessageBox( hwnd, _T("SHCreateMenuBar failed"),
135 _T("Error"), MB_OK );
141 // Get the client area rect to put the panels in
142 GetClientRect( hwnd, &rcClient );
144 /* Create MRL combobox */
145 mrl_box = CreateWindow( _T("STATIC"),
146 _FROMMB(_("Media Resource Locator (MRL)")),
147 WS_CHILD | WS_VISIBLE | SS_LEFT,
148 5, 10, rcClient.right, 15, hwnd, 0, hInst, 0 );
150 mrl_label = CreateWindow( _T("STATIC"), _FROMMB(_("Open:")),
151 WS_CHILD | WS_VISIBLE | SS_LEFT,
152 5, 10 + 15 + 10, 40, 15, hwnd, 0, hInst, 0 );
154 mrl_combo = CreateWindow( _T("COMBOBOX"), _T(""),
155 WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL |
156 CBS_SORT | WS_VSCROLL, 45, 10 + 15 + 10 - 3,
157 rcClient.right - 50 - 5, 5*15 + 6, hwnd,
160 // No tooltips for ComboBox
161 label = CreateWindow( _T("STATIC"),
162 _FROMMB(_("Alternatively, you can build an MRL "
163 "using one of the following predefined "
165 WS_CHILD | WS_VISIBLE | SS_LEFT,
166 5, 10 + 2*(15 + 10), rcClient.right - 2*5, 2*15,
169 /* Create notebook */
170 iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
171 iccex.dwSize = ICC_TAB_CLASSES;
172 InitCommonControlsEx (&iccex);
174 notebook = CreateWindowEx( 0, WC_TABCONTROL, NULL,
175 WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE,
176 5, 10 + 4*15 + 2*10, rcClient.right - 2*5,
177 rcClient.bottom - MENU_HEIGHT - 15 - 10 - 10 - (10 + 4*15 + 2*10),
178 hwnd, NULL, hInst, NULL );
180 tcItem.mask = TCIF_TEXT;
181 tcItem.pszText = _T("File");
182 TabCtrl_InsertItem( notebook, 0, &tcItem );
183 tcItem.pszText = _T("Network");
184 TabCtrl_InsertItem( notebook, 1, &tcItem );
186 switch( i_current_access_method )
189 TabCtrl_SetCurSel( notebook, 0 );
192 TabCtrl_SetCurSel( notebook, 1 );
203 EndDialog( hwnd, LOWORD( wp ) );
207 if( LOWORD(wp) == IDOK )
210 EndDialog( hwnd, LOWORD( wp ) );
213 if( HIWORD(wp) == BN_CLICKED )
215 if( (HWND)lp == net_radios[0] )
217 OnNetTypeChange( NetRadio1_Event );
218 } else if( (HWND)lp == net_radios[1] )
220 OnNetTypeChange( NetRadio2_Event );
221 } else if( (HWND)lp == net_radios[2] )
223 OnNetTypeChange( NetRadio3_Event );
224 } else if( (HWND)lp == net_radios[3] )
226 OnNetTypeChange( NetRadio4_Event );
227 } else if( (HWND)lp == subsfile_checkbox )
230 } else if( (HWND)lp == subsfile_button )
232 OnSubsFileSettings( hwnd );
233 } else if( (HWND)lp == browse_button )
235 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
240 if( HIWORD(wp) == EN_CHANGE )
242 if( (HWND)lp == net_addrs[1] )
244 OnNetPanelChange( NetAddr2_Event );
245 } else if( (HWND)lp == net_addrs[2] )
247 OnNetPanelChange( NetAddr3_Event );
248 } else if( (HWND)lp == net_addrs[3] )
250 OnNetPanelChange( NetAddr4_Event );
251 } else if( (HWND)lp == net_ports[0] )
253 OnNetPanelChange( NetPort1_Event );
254 } else if( (HWND)lp == net_ports[1] )
256 OnNetPanelChange( NetPort2_Event );
259 if( HIWORD(wp) == CBN_EDITUPDATE )
261 if ((HWND)lp == file_combo)
269 if( (((NMHDR *)lp)->code) == TCN_SELCHANGE ) OnPageChange();
279 /*****************************************************************************
281 *****************************************************************************/
282 void OpenDialog::FilePanel( HWND hwnd )
285 GetWindowRect( notebook, &rc);
287 /* Create browse file line */
288 file_combo = CreateWindow( _T("COMBOBOX"), _T(""),
289 WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL,
290 rc.left + 10, rc.top + 10 - 3, rc.right - 10 - (rc.left + 10),
291 5*15 + 6, hwnd, NULL, hInst, NULL );
293 browse_button = CreateWindow( _T("BUTTON"), _T("Browse..."),
294 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
295 rc.left + 10, rc.top + 10 + 15 + 10 - 3, 80, 15 + 6,
296 hwnd, NULL, hInst, NULL );
298 /* Create Subtitles File checkox */
299 subsfile_checkbox = CreateWindow( _T("BUTTON"), _T("Subtitle options"),
300 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
301 rc.left + 10, rc.top + 10 + 2*(15 + 10), 15, 15,
302 hwnd, NULL, hInst, NULL );
303 SendMessage( subsfile_checkbox, BM_SETCHECK, BST_UNCHECKED, 0 );
305 subsfile_label = CreateWindow( _T("STATIC"), _T("Subtitle options"),
306 WS_CHILD | WS_VISIBLE | SS_LEFT,
307 rc.left + 10 + 15 + 10, rc.top + 10 + 2*(15 + 10), 100, 15,
308 hwnd, NULL, hInst, NULL);
310 subsfile_button = CreateWindow( _T("BUTTON"), _T("Settings..."),
311 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
312 rc.right - 80 - 10, rc.top + 10 + 2*(15 + 10) - 3, 80, 15 + 6,
313 hwnd, NULL, hInst, NULL );
315 char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
316 if( psz_subsfile && *psz_subsfile )
318 SendMessage( subsfile_checkbox, BM_SETCHECK, BST_CHECKED, 0 );
319 EnableWindow( subsfile_button, TRUE );
320 string sz_subsfile = "sub-file=";
321 sz_subsfile += psz_subsfile;
322 subsfile_mrl.push_back( sz_subsfile );
324 if( psz_subsfile ) free( psz_subsfile );
327 void OpenDialog::NetPanel( HWND hwnd )
329 INITCOMMONCONTROLSEX ic;
338 static struct net_type net_type_array[] =
340 { _T("UDP/RTP"), 82 },
341 { _T("UDP/RTP Multicast"), 140 },
342 { _T("HTTP/FTP/MMS"), 90 },
347 GetWindowRect( notebook, &rc);
350 net_radios[0] = CreateWindow( _T("BUTTON"), net_type_array[0].psz_text,
351 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
352 rc.left + 5, rc.top + 10, 15, 15, hwnd, NULL, hInst, NULL );
354 net_label[0] = CreateWindow( _T("STATIC"), net_type_array[0].psz_text,
355 WS_CHILD | WS_VISIBLE | SS_LEFT,
356 rc.left + 5 + 15 + 5, rc.top + 10, net_type_array[0].length,
357 15, hwnd, NULL, hInst, NULL );
359 i_net_ports[0] = config_GetInt( p_intf, "server-port" );
361 net_port_label[0] = CreateWindow( _T("STATIC"), _T("Port"),
362 WS_CHILD | WS_VISIBLE | SS_LEFT,
363 rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,
364 hwnd, NULL, hInst, NULL );
366 _stprintf( psz_text, _T("%d"), i_net_ports[0] );
367 net_ports[0] = CreateWindow( _T("EDIT"), psz_text,
368 WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
369 rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,
370 rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6, hwnd, NULL, hInst, NULL );
372 ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
373 ic.dwICC = ICC_UPDOWN_CLASS;
374 InitCommonControlsEx(&ic);
376 hUpdown[0] = CreateUpDownControl(
377 WS_CHILD | WS_VISIBLE | WS_BORDER | UDS_ALIGNRIGHT |
378 UDS_SETBUDDYINT | UDS_NOTHOUSANDS,
379 0, 0, 0, 0, hwnd, 0, hInst,
380 net_ports[0], 16000, 0, i_net_ports[0]);
382 /* UDP/RTP Multicast row */
383 net_radios[1] = CreateWindow( _T("BUTTON"), net_type_array[1].psz_text,
384 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
385 rc.left + 5, rc.top + 10 + 15 + 10, 15, 15,
386 hwnd, NULL, hInst, NULL);
388 net_label[1] = CreateWindow( _T("STATIC"), net_type_array[1].psz_text,
389 WS_CHILD | WS_VISIBLE | SS_LEFT,
390 rc.left + 5 + 15 + 5, rc.top + 10 + 15 + 10,
391 net_type_array[1].length, 15, hwnd, NULL, hInst, NULL );
393 net_addrs_label[1] = CreateWindow( _T("STATIC"), _T("Address"),
394 WS_CHILD | WS_VISIBLE | SS_LEFT,
395 rc.left + 5 , rc.top + 10 + 2*(15 + 10), 50, 15,
396 hwnd, NULL, hInst, NULL);
398 net_addrs[1] = CreateWindow( _T("EDIT"), _T(""),
399 WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
400 rc.left + 5 + 50 + 5, rc.top + 10 + 2*(15 + 10) - 3,
401 rc.right - 5 - (rc.left + 5 + 50 + 5), 15 + 6,
402 hwnd, NULL, hInst, NULL);
404 net_port_label[1] = CreateWindow( _T("STATIC"), _T("Port"),
405 WS_CHILD | WS_VISIBLE | SS_LEFT,
406 rc.left + 5 , rc.top + 10 + 3*(15 + 10), 30, 15,
407 hwnd, NULL, hInst, NULL);
409 i_net_ports[1] = i_net_ports[0];
411 _stprintf( psz_text, _T("%d"), i_net_ports[1] );
412 net_ports[1] = CreateWindow( _T("EDIT"), psz_text,
413 WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
414 rc.left + 5 + 30 + 5, rc.top + 10 + 3*(15 + 10) - 3,
415 rc.right - 5 -(rc.left + 5 + 30 + 5), 15 + 6,
416 hwnd, NULL, hInst, NULL );
418 ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
419 ic.dwICC = ICC_UPDOWN_CLASS;
420 InitCommonControlsEx(&ic);
422 hUpdown[1] = CreateUpDownControl( WS_CHILD | WS_VISIBLE | WS_BORDER |
423 UDS_ALIGNRIGHT | UDS_SETBUDDYINT | UDS_NOTHOUSANDS,
424 0, 0, 0, 0, hwnd, 0, hInst,
425 net_ports[1], 16000, 0, i_net_ports[1] );
427 /* HTTP and RTSP rows */
428 net_radios[2] = CreateWindow( _T("BUTTON"), net_type_array[2].psz_text,
429 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
430 rc.left + 5 + 15 + 5 + net_type_array[0].length + 5,
431 rc.top + 10, 15, 15, hwnd, NULL, hInst, NULL );
433 net_label[2] = CreateWindow( _T("STATIC"), net_type_array[2].psz_text,
434 WS_CHILD | WS_VISIBLE | SS_LEFT,
435 rc.left + 5 + 15 + 5 + net_type_array[0].length + 5 + 15 + 5,
436 rc.top + 10, net_type_array[2].length, 15,
437 hwnd, NULL, hInst, NULL );
439 net_addrs_label[2] = CreateWindow( _T("STATIC"), _T("URL"),
440 WS_CHILD | WS_VISIBLE | SS_LEFT,
441 rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,
442 hwnd, NULL, hInst, NULL );
444 net_addrs[2] = CreateWindow( _T("EDIT"), _T(""),
445 WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
446 rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,
447 rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6,
448 hwnd, NULL, hInst, NULL);
450 net_radios[3] = CreateWindow( _T("BUTTON"), net_type_array[3].psz_text,
451 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
452 rc.left + 5 + 15 + 5 + net_type_array[1].length + 5,
453 rc.top + 10 + 15 + 10, 15, 15, hwnd, NULL, hInst, NULL );
455 net_label[3] = CreateWindow( _T("STATIC"), net_type_array[3].psz_text,
456 WS_CHILD | WS_VISIBLE | SS_LEFT,
457 rc.left + 5 + 15 + 5 + net_type_array[1].length + 5 + 15 + 5,
458 rc.top + 10 + 15 + 10, net_type_array[3].length, 15,
459 hwnd, NULL, hInst, NULL );
461 net_addrs_label[3] = CreateWindow( _T("STATIC"), _T("URL"),
462 WS_CHILD | WS_VISIBLE | SS_LEFT,
463 rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,
464 hwnd, NULL, hInst, NULL );
466 net_addrs[3] = CreateWindow( _T("EDIT"), _T("rtsp://"),
467 WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
468 rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,
469 rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6,
470 hwnd, NULL, hInst, NULL );
472 SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 );
475 void OpenDialog::UpdateMRL()
477 UpdateMRL( i_current_access_method );
480 void OpenDialog::UpdateMRL( int i_access_method )
482 string demux, mrltemp;
483 TCHAR psz_text[2048];
486 i_current_access_method = i_access_method;
488 switch( i_access_method )
491 GetWindowText( file_combo, psz_text, 2048 );
492 mrltemp = _TOMB(psz_text);
498 mrltemp = "udp" + demux + "://";
499 if( i_net_ports[0] !=
500 config_GetInt( p_intf, "server-port" ) )
502 sprintf( psz_tmp, "@:%d", i_net_ports[0] );
508 mrltemp = "udp" + demux + "://@";
509 Edit_GetText( net_addrs[1], psz_text, 2048 );
510 mrltemp += _TOMB(psz_text);
511 if( i_net_ports[1] != config_GetInt( p_intf, "server-port" ) )
513 sprintf( psz_tmp, ":%d", i_net_ports[1] );
520 Edit_GetText( net_addrs[2], psz_text, 2048 );
521 if( !strstr( _TOMB(psz_text), "http://" ) )
523 mrltemp = "http" + demux + "://";
525 mrltemp += _TOMB(psz_text);
530 Edit_GetText( net_addrs[3], psz_text, 2048 );
531 if( !strstr( _TOMB(psz_text), "rtsp://" ) )
533 mrltemp = "rtsp" + demux + "://";
535 mrltemp += _TOMB(psz_text);
543 SetWindowText( mrl_combo, _FROMMB(mrltemp.c_str()) );
546 void OpenDialog::OnPageChange()
548 if( TabCtrl_GetCurSel( notebook ) == 0 )
550 for( int i=0; i<4; i++ )
552 SetWindowPos( net_radios[i], HWND_BOTTOM, 0, 0, 0, 0,
553 SWP_NOMOVE | SWP_NOSIZE );
554 SetWindowPos( net_label[i], HWND_BOTTOM, 0, 0, 0, 0,
555 SWP_NOMOVE | SWP_NOSIZE );
559 SetWindowPos( file_combo, HWND_TOP, 0, 0, 0, 0,
560 SWP_NOMOVE | SWP_NOSIZE );
561 SetWindowPos( browse_button, HWND_TOP, 0, 0, 0, 0,
562 SWP_NOMOVE | SWP_NOSIZE );
563 SetWindowPos( subsfile_checkbox, HWND_TOP, 0, 0, 0, 0,
564 SWP_NOMOVE | SWP_NOSIZE );
565 SetWindowPos( subsfile_label, HWND_TOP, 0, 0, 0, 0,
566 SWP_NOMOVE | SWP_NOSIZE );
567 SetWindowPos( subsfile_button, HWND_TOP, 0, 0, 0, 0,
568 SWP_NOMOVE | SWP_NOSIZE );
570 i_current_access_method = FILE_ACCESS;
572 else if ( TabCtrl_GetCurSel( notebook ) == 1 )
574 SetWindowPos( file_combo, HWND_BOTTOM, 0, 0, 0, 0,
575 SWP_NOMOVE | SWP_NOSIZE );
576 SetWindowPos( browse_button, HWND_BOTTOM, 0, 0, 0, 0,
577 SWP_NOMOVE | SWP_NOSIZE );
578 SetWindowPos( subsfile_checkbox, HWND_BOTTOM, 0, 0, 0, 0,
579 SWP_NOMOVE | SWP_NOSIZE );
580 SetWindowPos( subsfile_label, HWND_BOTTOM, 0, 0, 0, 0,
581 SWP_NOMOVE | SWP_NOSIZE );
582 SetWindowPos( subsfile_button, HWND_BOTTOM, 0, 0, 0, 0,
583 SWP_NOMOVE | SWP_NOSIZE );
585 for( int i=0; i<4; i++ )
587 SetWindowPos( net_radios[i], HWND_TOP, 0, 0, 0, 0,
588 SWP_NOMOVE | SWP_NOSIZE );
589 SendMessage( net_radios[i], BM_SETCHECK, BST_UNCHECKED, 0 );
590 SetWindowPos( net_label[i], HWND_TOP, 0, 0, 0, 0,
591 SWP_NOMOVE | SWP_NOSIZE );
593 SetWindowPos( net_port_label[0], HWND_TOP, 0, 0, 0, 0,
594 SWP_NOMOVE | SWP_NOSIZE );
595 SetWindowPos( net_ports[0], HWND_TOP, 0, 0, 0, 0,
596 SWP_NOMOVE | SWP_NOSIZE );
597 SetWindowPos( hUpdown[0], HWND_TOP, 0, 0, 0, 0,
598 SWP_NOMOVE | SWP_NOSIZE );
600 SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 );
602 i_current_access_method = NET_ACCESS;
608 void OpenDialog::OnOk()
610 TCHAR psz_text[2048];
612 GetWindowText( mrl_combo, psz_text, 2048 );
615 char **pp_args = vlc_parse_cmdline( _TOMB(psz_text), &i_args );
617 ComboBox_AddString( mrl_combo, psz_text );
618 if( ComboBox_GetCount( mrl_combo ) > 10 )
619 ComboBox_DeleteString( mrl_combo, 0 );
620 ComboBox_SetCurSel( mrl_combo, ComboBox_GetCount( mrl_combo ) - 1 );
622 /* Update the playlist */
623 playlist_t *p_playlist =
624 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
626 if( p_playlist == NULL ) return;
628 for( int i = 0; i < i_args; i++ )
630 vlc_bool_t b_start = !i && i_open_arg;
631 playlist_item_t *p_item =
632 playlist_ItemNew( p_intf, pp_args[i], pp_args[i] );
635 while( i + 1 < i_args && pp_args[i + 1][0] == ':' )
637 playlist_ItemAddOption( p_item, pp_args[i + 1] );
641 /* Get the options from the subtitles dialog */
642 if( (SendMessage( subsfile_checkbox, BM_GETCHECK, 0, 0 ) & BST_CHECKED)
643 && subsfile_mrl.size() )
645 for( int j = 0; j < (int)subsfile_mrl.size(); j++ )
647 playlist_ItemAddOption( p_item, subsfile_mrl[j].c_str() );
651 playlist_AddItem( p_playlist, p_item,
652 PLAYLIST_APPEND, PLAYLIST_END );
656 playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
660 //TogglePlayButton( PLAYING_S );
664 free( pp_args[i_args] );
665 if( !i_args ) free( pp_args );
667 vlc_object_release( p_playlist );
670 /*****************************************************************************
671 * File panel event methods.
672 *****************************************************************************/
673 void OpenDialog::OnFilePanelChange()
675 UpdateMRL( FILE_ACCESS );
678 void OpenDialog::OnFileBrowse()
681 static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
682 TCHAR psz_file[PATH_MAX] = _T("\0");
683 TCHAR psz_tmp[PATH_MAX+2] = _T("\0");
685 memset(&ofn, 0, sizeof(OPENFILENAME));
686 ofn.lStructSize = sizeof (OPENFILENAME);
687 ofn.hwndOwner = NULL;
688 ofn.hInstance = hInst;
689 ofn.lpstrFilter = szFilter;
690 ofn.lpstrCustomFilter = NULL;
691 ofn.nMaxCustFilter = 0;
692 ofn.nFilterIndex = 1;
693 ofn.lpstrFile = psz_file;
694 ofn.nMaxFile = PATH_MAX;
695 ofn.lpstrFileTitle = NULL;
696 ofn.nMaxFileTitle = 40;
697 ofn.lpstrInitialDir = NULL;
698 ofn.lpstrTitle = _T("Open File");
701 ofn.nFileExtension = 0;
702 ofn.lpstrDefExt = NULL;
705 ofn.lpTemplateName = NULL;
706 if( GetOpenFile( &ofn ) )
708 if( _tcschr( ofn.lpstrFile, _T(' ') ) )
710 _tcscat( psz_tmp, _T("\"") );
711 _tcscat( psz_tmp, ofn.lpstrFile );
712 _tcscat( psz_tmp, _T("\"") );
714 else _tcscat( psz_tmp, ofn.lpstrFile );
716 SetWindowText( file_combo, psz_tmp );
717 ComboBox_AddString( file_combo, psz_tmp );
718 if( ComboBox_GetCount( file_combo ) > 10 )
719 ComboBox_DeleteString( file_combo, 0 );
721 UpdateMRL( FILE_ACCESS );
725 /*****************************************************************************
726 * Net panel event methods.
727 *****************************************************************************/
728 void OpenDialog::OnNetPanelChange( int event )
730 TCHAR psz_text[2048];
733 if( event >= NetPort1_Event && event <= NetPort2_Event )
735 Edit_GetText( net_ports[event - NetPort1_Event], psz_text, 2048 );
736 _stscanf( psz_text, _T("%d"), &port );
737 i_net_ports[event - NetPort1_Event] = port;
740 UpdateMRL( NET_ACCESS );
743 void OpenDialog::OnNetTypeChange( int event )
747 i_net_type = event - NetRadio1_Event;
749 if( event == NetRadio1_Event )
751 SetWindowPos( net_port_label[0], HWND_TOP, 0, 0, 0, 0,
752 SWP_NOMOVE | SWP_NOSIZE );
753 SetWindowPos( net_ports[0], HWND_TOP, 0, 0, 0, 0,
754 SWP_NOMOVE | SWP_NOSIZE );
755 SetWindowPos( hUpdown[0], HWND_TOP, 0, 0, 0, 0,
756 SWP_NOMOVE | SWP_NOSIZE );
758 else if( event == NetRadio2_Event )
760 SetWindowPos( net_addrs_label[1], HWND_TOP, 0, 0, 0, 0,
761 SWP_NOMOVE | SWP_NOSIZE );
762 SetWindowPos( net_addrs[1], HWND_TOP, 0, 0, 0, 0,
763 SWP_NOMOVE | SWP_NOSIZE );
764 SetWindowPos( net_port_label[1], HWND_TOP, 0, 0, 0, 0,
765 SWP_NOMOVE | SWP_NOSIZE );
766 SetWindowPos( net_ports[1], HWND_TOP, 0, 0, 0, 0,
767 SWP_NOMOVE | SWP_NOSIZE );
768 SetWindowPos( hUpdown[1], HWND_TOP, 0, 0, 0, 0,
769 SWP_NOMOVE | SWP_NOSIZE );
771 else if( event == NetRadio3_Event )
773 SetWindowPos( net_addrs_label[2], HWND_TOP, 0, 0, 0, 0,
774 SWP_NOMOVE | SWP_NOSIZE );
775 SetWindowPos( net_addrs[2], HWND_TOP, 0, 0, 0, 0,
776 SWP_NOMOVE | SWP_NOSIZE );
778 else if( event == NetRadio4_Event )
780 SetWindowPos( net_addrs_label[3], HWND_TOP, 0, 0, 0, 0,
781 SWP_NOMOVE | SWP_NOSIZE );
782 SetWindowPos( net_addrs[3], HWND_TOP, 0, 0, 0, 0,
783 SWP_NOMOVE | SWP_NOSIZE );
786 UpdateMRL( NET_ACCESS );
789 void OpenDialog::DisableNETCtrl()
791 for( int i=0; i<4; i++ )
793 SetWindowPos( net_port_label[i], HWND_BOTTOM, 0, 0, 0, 0,
794 SWP_NOMOVE | SWP_NOSIZE );
795 SetWindowPos( net_ports[i], HWND_BOTTOM, 0, 0, 0, 0,
796 SWP_NOMOVE | SWP_NOSIZE );
797 SetWindowPos( hUpdown[i], HWND_BOTTOM, 0, 0, 0, 0,
798 SWP_NOMOVE | SWP_NOSIZE );
799 SetWindowPos( net_addrs_label[i], HWND_BOTTOM, 0, 0, 0, 0,
800 SWP_NOMOVE | SWP_NOSIZE );
801 SetWindowPos( net_addrs[i], HWND_BOTTOM, 0, 0, 0, 0,
802 SWP_NOMOVE | SWP_NOSIZE );
805 UpdateMRL( FILE_ACCESS );
808 /*****************************************************************************
809 * Subtitles file event methods.
810 *****************************************************************************/
811 void OpenDialog::OnSubsFileEnable()
813 EnableWindow( subsfile_button, ( SendMessage( subsfile_checkbox,
814 BM_GETCHECK, 0, 0 ) & BST_CHECKED ) ? TRUE : FALSE );
817 void OpenDialog::OnSubsFileSettings( HWND hwnd )
820 /* Show/hide the open dialog */
821 SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, hInst );
822 CreateDialogBox( hwnd, subsfile_dialog );
824 subsfile_mrl.clear();
826 for( int i = 0; i < (int)subsfile_dialog->subsfile_mrl.size(); i++ )
827 subsfile_mrl.push_back( subsfile_dialog->subsfile_mrl[i] );
829 delete subsfile_dialog;