1 /*****************************************************************************
2 * open.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2004 VideoLAN
7 * Authors: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
28 #include <errno.h> /* ENOMEM */
29 #include <string.h> /* strerror() */
34 #include <wx/combobox.h>
35 #include <wx/statline.h>
36 #include <wx/tokenzr.h>
40 #include "wxwindows.h"
41 #include "preferences_widgets.h"
44 # define wxRB_SINGLE 0
47 /*****************************************************************************
49 *****************************************************************************/
51 /* IDs for the controls and the menu commands */
54 Notebook_Event = wxID_HIGHEST,
67 NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
68 NetPort1_Event, NetPort2_Event, NetPort3_Event,
69 NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
73 SubsFileSettings_Event,
84 BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
86 EVT_BUTTON(wxID_OK, OpenDialog::OnOk)
87 EVT_BUTTON(wxID_CANCEL, OpenDialog::OnCancel)
89 EVT_NOTEBOOK_PAGE_CHANGED(Notebook_Event, OpenDialog::OnPageChange)
91 EVT_TEXT(MRL_Event, OpenDialog::OnMRLChange)
93 /* Events generated by the file panel */
94 EVT_TEXT(FileName_Event, OpenDialog::OnFilePanelChange)
95 EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse)
97 /* Events generated by the disc panel */
98 EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange)
99 EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscDeviceChange)
100 EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscPanelChange)
101 EVT_TEXT(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
102 EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
103 EVT_TEXT(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
104 EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
105 EVT_TEXT(DiscSub_Event, OpenDialog::OnDiscPanelChange)
106 EVT_SPINCTRL(DiscSub_Event, OpenDialog::OnDiscPanelChange)
108 /* Events generated by the net panel */
109 EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
110 EVT_RADIOBUTTON(NetRadio2_Event, OpenDialog::OnNetTypeChange)
111 EVT_RADIOBUTTON(NetRadio3_Event, OpenDialog::OnNetTypeChange)
112 EVT_RADIOBUTTON(NetRadio4_Event, OpenDialog::OnNetTypeChange)
113 EVT_TEXT(NetPort1_Event, OpenDialog::OnNetPanelChange)
114 EVT_SPINCTRL(NetPort1_Event, OpenDialog::OnNetPanelChange)
115 EVT_TEXT(NetPort2_Event, OpenDialog::OnNetPanelChange)
116 EVT_SPINCTRL(NetPort2_Event, OpenDialog::OnNetPanelChange)
117 EVT_TEXT(NetPort3_Event, OpenDialog::OnNetPanelChange)
118 EVT_SPINCTRL(NetPort3_Event, OpenDialog::OnNetPanelChange)
119 EVT_TEXT(NetAddr2_Event, OpenDialog::OnNetPanelChange)
120 EVT_TEXT(NetAddr3_Event, OpenDialog::OnNetPanelChange)
121 EVT_TEXT(NetAddr4_Event, OpenDialog::OnNetPanelChange)
122 EVT_CHECKBOX(NetForceIPv6_Event, OpenDialog::OnNetPanelChange)
124 /* Events generated by the subtitle file buttons */
125 EVT_CHECKBOX(SubsFileEnable_Event, OpenDialog::OnSubsFileEnable)
126 EVT_BUTTON(SubsFileSettings_Event, OpenDialog::OnSubsFileSettings)
128 /* Events generated by the stream output buttons */
129 EVT_CHECKBOX(SoutEnable_Event, OpenDialog::OnSoutEnable)
130 EVT_BUTTON(SoutSettings_Event, OpenDialog::OnSoutSettings)
132 /* Events generated by the caching button */
133 EVT_CHECKBOX(CachingEnable_Event, OpenDialog::OnCachingEnable)
134 EVT_TEXT(CachingChange_Event, OpenDialog::OnCachingChange)
135 EVT_SPINCTRL(CachingChange_Event, OpenDialog::OnCachingChange)
137 /* Hide the window when the user closes the window */
138 EVT_CLOSE(OpenDialog::OnCancel)
142 /*****************************************************************************
144 *****************************************************************************/
145 WX_DEFINE_ARRAY(ConfigControl *, ArrayOfConfigControls);
147 class AutoBuiltPanel : public wxPanel
152 AutoBuiltPanel( wxWindow *, OpenDialog *, intf_thread_t *,
155 virtual ~AutoBuiltPanel() {}
157 void UpdateAdvancedMRL();
160 ArrayOfConfigControls config_array;
161 ArrayOfConfigControls advanced_config_array;
162 wxComboBox *p_advanced_mrl_combo;
165 intf_thread_t *p_intf;
166 OpenDialog *p_open_dialog;
168 void OnAdvanced( wxCommandEvent& event );
169 wxDialog *p_advanced_dialog;
171 DECLARE_EVENT_TABLE();
174 BEGIN_EVENT_TABLE(AutoBuiltPanel, wxPanel)
175 EVT_BUTTON(AdvancedOptions_Event, AutoBuiltPanel::OnAdvanced)
178 static void AutoBuildCallback( void *p_data )
180 ((OpenDialog *)p_data)->UpdateMRL();
183 static void AutoBuildAdvancedCallback( void *p_data )
185 ((AutoBuiltPanel *)p_data)->UpdateAdvancedMRL();
188 AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
189 intf_thread_t *_p_intf,
190 const module_t *p_module )
191 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize ),
192 name( wxU(p_module->psz_object_name) ),
193 p_advanced_mrl_combo( NULL ),
194 p_intf( _p_intf ), p_open_dialog( dialog ), p_advanced_dialog( NULL )
196 wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
197 module_config_t *p_item = p_module->p_config;
198 bool b_advanced = false;
202 if( !(p_item->i_type & CONFIG_HINT) && p_item->b_advanced )
205 if( p_item->i_type & CONFIG_HINT || p_item->b_advanced )
208 ConfigControl *control =
209 CreateConfigControl( VLC_OBJECT(p_intf), p_item, this );
211 config_array.Add( control );
213 /* Don't add items that were not recognized */
214 if( control == NULL ) continue;
216 control->SetUpdateCallback( AutoBuildCallback, (void *)dialog );
218 sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
220 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
225 new wxButton( this, AdvancedOptions_Event,
226 wxU(_("Advanced options...")) );
227 sizer->Add( button, 0, wxALL, 5 );
229 /* Build the advanced dialog */
231 new wxDialog( this, -1, ((wxString)wxU(_("Advanced options"))) +
232 wxT(" (") + wxU( p_module->psz_longname ) + wxT(")"),
233 wxDefaultPosition, wxDefaultSize,
234 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
236 wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
238 /* Create MRL combobox */
239 wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
240 wxStaticBox *mrl_box =
241 new wxStaticBox( p_advanced_dialog, -1,
242 wxU(_("Advanced options")) );
243 wxStaticBoxSizer *mrl_sizer =
244 new wxStaticBoxSizer( mrl_box, wxHORIZONTAL );
245 wxStaticText *mrl_label =
246 new wxStaticText( p_advanced_dialog, -1, wxU(_("Options:")) );
247 p_advanced_mrl_combo =
248 new wxComboBox( p_advanced_dialog, MRL_Event, wxT(""),
249 wxDefaultPosition, wxDefaultSize );
250 mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
251 mrl_sizer->Add( p_advanced_mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
252 mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
253 sizer->Add( mrl_sizer_sizer, 0, wxEXPAND | wxALL, 2 );
255 /* Add advanced options to panel */
256 module_config_t *p_item = p_module->p_config;
259 if( p_item->i_type & CONFIG_HINT || !p_item->b_advanced )
262 ConfigControl *control =
263 CreateConfigControl( VLC_OBJECT(p_intf), p_item,
266 advanced_config_array.Add( control );
268 /* Don't add items that were not recognized */
269 if( control == NULL ) continue;
271 control->SetUpdateCallback( AutoBuildAdvancedCallback,
274 sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
276 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
279 wxPanel *dummy_panel = new wxPanel( p_advanced_dialog, -1 );
280 sizer->Add( dummy_panel, 1 );
281 wxStaticLine *static_line =
282 new wxStaticLine( p_advanced_dialog, wxID_OK );
283 sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
286 wxButton *ok_button =
287 new wxButton( p_advanced_dialog, wxID_OK, wxU(_("OK")) );
288 ok_button->SetDefault();
289 wxButton *cancel_button =
290 new wxButton( p_advanced_dialog, wxID_CANCEL, wxU(_("Cancel")) );
291 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
292 button_sizer->Add( ok_button, 0, wxALL, 5 );
293 button_sizer->Add( cancel_button, 0, wxALL, 5 );
294 button_sizer->Layout();
295 sizer->Add( button_sizer, 0, wxALL, 0 );
297 sizer->SetMinSize( 400, -1 );
298 p_advanced_dialog->SetSizerAndFit( sizer );
301 this->SetSizerAndFit( sizer );
304 void AutoBuiltPanel::OnAdvanced( wxCommandEvent& event )
306 if( p_advanced_dialog->ShowModal() == wxID_OK )
309 p_open_dialog->UpdateMRL();
313 void AutoBuiltPanel::UpdateAdvancedMRL()
317 for( int i = 0; i < (int)advanced_config_array.GetCount(); i++ )
319 ConfigControl *control = advanced_config_array.Item(i);
321 mrltemp += (i ? wxT(" :") : wxT(":"));
323 if( control->GetType() == CONFIG_ITEM_BOOL &&
324 !control->GetIntValue() ) mrltemp += wxT("no-");
326 mrltemp += control->GetName();
328 switch( control->GetType() )
330 case CONFIG_ITEM_STRING:
331 case CONFIG_ITEM_FILE:
332 case CONFIG_ITEM_DIRECTORY:
333 case CONFIG_ITEM_MODULE:
334 mrltemp += wxT("=\"") + control->GetPszValue() + wxT("\"");
336 case CONFIG_ITEM_INTEGER:
338 wxString::Format( wxT("=%i"), control->GetIntValue() );
340 case CONFIG_ITEM_FLOAT:
342 wxString::Format(wxT("=%f"), control->GetFloatValue());
347 p_advanced_mrl_combo->SetValue( mrltemp );
350 /*****************************************************************************
352 *****************************************************************************/
353 OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
354 int i_access_method, int i_arg ):
355 wxDialog( _p_parent, -1, wxU(_("Open...")), wxDefaultPosition,
356 wxDefaultSize, wxDEFAULT_FRAME_STYLE )
358 OpenDialog( _p_intf, _p_parent, i_access_method, i_arg, OPEN_NORMAL );
361 OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
362 int i_access_method, int i_arg, int _i_method ):
363 wxDialog( _p_parent, -1, wxU(_("Open...")), wxDefaultPosition,
364 wxDefaultSize, wxDEFAULT_FRAME_STYLE )
366 /* Initializations */
367 i_method = _i_method;
369 p_parent = _p_parent;
370 SetIcon( *p_intf->p_sys->p_icon );
372 i_disc_type_selection = 0;
376 subsfile_dialog = NULL;
377 b_disc_device_changed = false;
379 /* Create a panel to put everything in */
380 wxPanel *panel = new wxPanel( this, -1 );
381 panel->SetAutoLayout( TRUE );
383 /* Create MRL combobox */
384 wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
385 wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
386 wxU(_("Media Resource Locator (MRL)")) );
387 wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
389 wxStaticText *mrl_label = new wxStaticText( panel, -1,
391 mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
392 wxPoint(20,25), wxSize(120, -1),
394 mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
395 "the full MRL you want to open.\n""Alternatively, the field will be "
396 "filled automatically when you use the controls below.")) );
398 mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
399 mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
400 mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
403 /* Create Static Text */
404 wxStaticText *label = new wxStaticText( panel, -1,
405 wxU(_("Alternatively, you can build an MRL using one of the "
406 "following predefined targets:")) );
408 wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 );
410 if( i_method == OPEN_NORMAL )
412 /* Create Stream Output checkox */
413 sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
414 wxU(_("Stream output")) );
415 sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) );
416 common_opt_sizer->Add( sout_checkbox, 0,
417 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
419 sout_button = new wxButton( panel, SoutSettings_Event,
420 wxU(_("Settings...")) );
421 sout_button->Disable();
423 char *psz_sout = config_GetPsz( p_intf, "sout" );
424 if( psz_sout && *psz_sout )
426 sout_checkbox->SetValue(TRUE);
427 sout_button->Enable();
428 subsfile_mrl.Add( wxString(wxT("sout=")) + wxL2U(psz_sout) );
430 if( psz_sout ) free( psz_sout );
432 common_opt_sizer->Add( sout_button, 1, wxALIGN_LEFT |
433 wxALIGN_CENTER_VERTICAL );
435 common_opt_sizer->Add( new wxPanel( this, -1 ), 1,
436 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
439 /* Create caching options */
440 caching_checkbox = new wxCheckBox( panel, CachingEnable_Event,
442 caching_checkbox->SetToolTip( wxU(_("Change the default caching value "
443 "(in milliseconds)")) );
444 common_opt_sizer->Add( caching_checkbox, 0,
445 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
446 caching_value = new wxSpinCtrl( panel, CachingChange_Event );
447 caching_value->SetRange( 0, 1000000 );
448 caching_value->Disable();
449 common_opt_sizer->Add( caching_value, 0,
450 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
453 wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
455 /* Create the buttons */
456 wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
457 ok_button->SetDefault();
458 wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
461 /* Create notebook */
462 notebook = new wxNotebook( panel, Notebook_Event );
463 wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
465 notebook->AddPage( FilePanel( notebook ), wxU(_("File")),
466 i_access_method == FILE_ACCESS );
467 notebook->AddPage( DiscPanel( notebook ), wxU(_("Disc")),
468 i_access_method == DISC_ACCESS );
469 notebook->AddPage( NetPanel( notebook ), wxU(_("Network")),
470 i_access_method == NET_ACCESS );
472 module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "v4l" );
475 AutoBuiltPanel *autopanel =
476 new AutoBuiltPanel( notebook, this, p_intf, p_module );
477 input_tab_array.Add( autopanel );
478 notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
479 i_access_method == CAPTURE_ACCESS );
482 p_module = config_FindModule( VLC_OBJECT(p_intf), "pvr" );
485 AutoBuiltPanel *autopanel =
486 new AutoBuiltPanel( notebook, this, p_intf, p_module );
487 input_tab_array.Add( autopanel );
488 notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
489 i_access_method == CAPTURE_ACCESS );
492 p_module = config_FindModule( VLC_OBJECT(p_intf), "dvb" );
495 AutoBuiltPanel *autopanel =
496 new AutoBuiltPanel( notebook, this, p_intf, p_module );
497 input_tab_array.Add( autopanel );
498 notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
499 i_access_method == CAPTURE_ACCESS );
502 p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
505 AutoBuiltPanel *autopanel =
506 new AutoBuiltPanel( notebook, this, p_intf, p_module );
507 input_tab_array.Add( autopanel );
508 notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
509 i_access_method == CAPTURE_ACCESS );
512 /* Update Disc panel */
513 wxCommandEvent dummy_event;
514 OnDiscTypeChange( dummy_event );
516 /* Update Net panel */
517 dummy_event.SetId( NetRadio1_Event );
518 OnNetTypeChange( dummy_event );
521 wxNotebookEvent event( wxEVT_NULL, 0, i_access_method );
522 OnPageChange( event );
524 /* Place everything in sizers */
525 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
526 button_sizer->Add( ok_button, 0, wxALL, 5 );
527 button_sizer->Add( cancel_button, 0, wxALL, 5 );
528 button_sizer->Layout();
529 wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
530 wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
531 panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
532 panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
533 panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
534 panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
535 panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
536 panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
537 panel_sizer->Layout();
538 panel->SetSizerAndFit( panel_sizer );
539 main_sizer->Add( panel, 1, wxGROW, 0 );
540 main_sizer->Layout();
541 SetSizerAndFit( main_sizer );
544 OpenDialog::~OpenDialog()
547 if( file_dialog ) delete file_dialog;
548 if( sout_dialog ) delete sout_dialog;
549 if( subsfile_dialog ) delete subsfile_dialog;
552 int OpenDialog::Show( int i_access_method, int i_arg )
554 notebook->SetSelection( i_access_method );
555 int i_ret = wxDialog::Show();
562 int OpenDialog::Show()
564 int i_ret = wxDialog::Show();
570 /*****************************************************************************
572 *****************************************************************************/
573 wxPanel *OpenDialog::FilePanel( wxWindow* parent )
575 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
578 wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
580 /* Create browse file line */
581 wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL );
583 file_combo = new wxComboBox( panel, FileName_Event, wxT(""),
584 wxPoint(20,25), wxSize(200, -1), 0, NULL );
585 wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
586 wxU(_("Browse...")) );
587 file_sizer->Add( file_combo, 1, wxALL, 5 );
588 file_sizer->Add( browse_button, 0, wxALL, 5 );
590 /* Create Subtitles File checkox */
591 wxFlexGridSizer *subsfile_sizer = new wxFlexGridSizer( 2, 1, 20 );
592 subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event,
593 wxU(_("Subtitle options")) );
594 subsfile_checkbox->SetToolTip( wxU(_("Force options for separate subtitle files.")) );
595 subsfile_sizer->Add( subsfile_checkbox, 0,
596 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
597 subsfile_button = new wxButton( panel, SubsFileSettings_Event,
598 wxU(_("Settings...")) );
599 subsfile_button->Disable();
601 char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
602 if( psz_subsfile && *psz_subsfile )
604 subsfile_checkbox->SetValue(TRUE);
605 subsfile_button->Enable();
606 subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) );
608 if( psz_subsfile ) free( psz_subsfile );
610 subsfile_sizer->Add( subsfile_button, 1,
611 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
613 sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );
614 sizer->Add( subsfile_sizer, 0, wxEXPAND | wxALL, 5 );
615 panel->SetSizerAndFit( sizer );
619 wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
621 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
624 wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );
625 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 3, 20 );
627 static const wxString disc_type_array[] =
629 wxU(_("DVD (menus)")),
635 disc_type = new wxRadioBox( panel, DiscType_Event, wxU(_("Disc type")),
636 wxDefaultPosition, wxDefaultSize,
637 WXSIZEOF(disc_type_array), disc_type_array,
638 WXSIZEOF(disc_type_array), wxRA_SPECIFY_COLS );
640 sizer_row->Add( disc_type, i_disc_type_selection, wxEXPAND | wxALL, 5 );
642 wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Device name")) );
643 disc_device = new wxTextCtrl( panel, DiscDevice_Event, wxT(""),
644 wxDefaultPosition, wxDefaultSize,
647 sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
648 sizer->Add( disc_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
650 disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) );
651 disc_title = new wxSpinCtrl( panel, DiscTitle_Event );
652 sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
653 sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
655 disc_chapter_label = new wxStaticText( panel, -1, wxU(_("Chapter")) );
656 disc_chapter = new wxSpinCtrl( panel, DiscChapter_Event );
657 sizer->Add( disc_chapter_label, 0,
658 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
659 sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
661 disc_sub_label = new wxStaticText( panel, -1, wxU(_("Subtitles track")) );
662 disc_sub = new wxSpinCtrl( panel, DiscSub_Event );
663 sizer->Add( disc_sub_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
664 sizer->Add( disc_sub, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
665 disc_sub->SetRange( -1, 255 );
666 i_disc_sub = config_GetInt( p_intf, "spu-channel" );
667 disc_sub->SetValue( i_disc_sub );
669 sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
671 panel->SetSizerAndFit( sizer_row );
675 wxPanel *OpenDialog::NetPanel( wxWindow* parent )
678 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
681 wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );
682 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );
684 static const wxString net_type_array[] =
687 wxU(_("UDP/RTP Multicast")),
688 wxU(_("HTTP/FTP/MMS")),
694 net_radios[i] = new wxRadioButton( panel, NetRadio1_Event + i,
696 wxDefaultPosition, wxDefaultSize,
699 net_subpanels[i] = new wxPanel( panel, -1,
700 wxDefaultPosition, wxDefaultSize );
704 wxFlexGridSizer *subpanel_sizer;
706 i_net_ports[0] = config_GetInt( p_intf, "server-port" );
707 subpanel_sizer = new wxFlexGridSizer( 3, 1, 20 );
708 label = new wxStaticText( net_subpanels[0], -1, wxU(_("Port")) );
709 net_ports[0] = new wxSpinCtrl( net_subpanels[0], NetPort1_Event,
710 wxString::Format(wxT("%d"), i_net_ports[0]),
711 wxDefaultPosition, wxDefaultSize,
713 0, 16000, i_net_ports[0] );
715 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
716 subpanel_sizer->Add( net_ports[0], 1,
717 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
718 net_ipv6 = new wxCheckBox( net_subpanels[0], NetForceIPv6_Event,
719 wxU(_("Force IPv6")));
720 subpanel_sizer->Add( net_ipv6, 0,
721 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
722 net_subpanels[0]->SetSizerAndFit( subpanel_sizer );
723 net_radios[0]->SetValue( TRUE );
725 /* UDP/RTP Multicast row */
726 subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
727 label = new wxStaticText( net_subpanels[1], -1, wxU(_("Address")) );
728 net_addrs[1] = new wxTextCtrl( net_subpanels[1], NetAddr2_Event, wxT(""),
729 wxDefaultPosition, wxDefaultSize,
731 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
732 subpanel_sizer->Add( net_addrs[1], 1,
733 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
735 label = new wxStaticText( net_subpanels[1], -1, wxU(_("Port")) );
736 i_net_ports[1] = i_net_ports[0];
737 net_ports[1] = new wxSpinCtrl( net_subpanels[1], NetPort2_Event,
738 wxString::Format(wxT("%d"), i_net_ports[1]),
739 wxDefaultPosition, wxDefaultSize,
741 0, 16000, i_net_ports[1] );
743 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
744 subpanel_sizer->Add( net_ports[1], 1,
745 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
746 net_subpanels[1]->SetSizerAndFit( subpanel_sizer );
748 /* HTTP and RTSP rows */
751 subpanel_sizer = new wxFlexGridSizer( 2, 1, 20 );
752 label = new wxStaticText( net_subpanels[i], -1, wxU(_("URL")) );
753 net_addrs[i] = new wxTextCtrl( net_subpanels[i], NetAddr1_Event + i,
754 (i == 2) ? wxT("") : wxT("rtsp://"),
755 wxDefaultPosition, wxSize( 200, -1 ),
757 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
758 subpanel_sizer->Add( net_addrs[i], 1,
759 wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
760 net_subpanels[i]->SetSizerAndFit( subpanel_sizer );
763 /* Stuff everything into the main panel */
766 sizer->Add( net_radios[i], 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
768 sizer->Add( net_subpanels[i], 1, wxEXPAND | wxALIGN_LEFT |
769 wxALIGN_CENTER_VERTICAL | wxALL, 5 );
772 sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
774 panel->SetSizerAndFit( sizer_row );
778 void OpenDialog::UpdateMRL()
780 UpdateMRL( i_current_access_method );
783 void OpenDialog::UpdateMRL( int i_access_method )
785 wxString mrltemp, caching_name;
787 i_current_access_method = i_access_method;
789 switch( i_access_method )
792 mrltemp = file_combo->GetValue();
793 caching_name = wxT("file-caching");
797 i_disc_type_selection = disc_type->GetSelection();
799 switch ( i_disc_type_selection )
801 case 0: /* DVD with menus */
802 case 1: /* DVD without menus */
803 if( i_disc_type_selection == 0 )
805 mrltemp = wxT("dvd://") + disc_device->GetValue();
806 caching_name = wxT("dvdnav-caching");
810 mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
811 caching_name = wxT("dvdread-caching");
814 if( i_disc_title > 0 )
816 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
818 if( i_disc_chapter > 0 )
819 mrltemp += wxString::Format( wxT(":%d"), i_disc_chapter );
822 if( i_disc_sub >= 0 )
823 mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
827 case 2: /* VCD of some sort */
829 mrltemp = wxT("vcdx://") + disc_device->GetValue();
830 if( i_disc_title > 0 )
831 mrltemp += wxString::Format( wxT("@%c%d"),
832 config_GetInt( p_intf, "vcdx-PBC" )
833 ? 'P' : 'E', i_disc_title );
835 mrltemp = wxT("vcd://") + disc_device->GetValue();
836 if( i_disc_title > 0 )
837 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
840 if( i_disc_sub >= 0 )
841 mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
844 caching_name = wxT("vcd-caching");
848 mrltemp = wxT("cdda://") + disc_device->GetValue();
849 if( i_disc_title > 0 )
850 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
852 caching_name = wxT("cdda-caching");
856 msg_Err( p_intf, "invalid selection (%d)",
857 disc_type->GetSelection() );
866 mrltemp = wxT("udp://");
867 if ( net_ipv6->GetValue() )
869 mrltemp += wxT("@[::]");
871 if( i_net_ports[0] !=
872 config_GetInt( p_intf, "server-port" ) )
874 mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );
877 caching_name = wxT("udp-caching");
881 mrltemp = wxT("udp://@");
882 if ((net_addrs[1]->GetLineText(0).Find (':') != -1)
883 && (net_addrs[1]->GetLineText(0)[0u] != '['))
885 /* automatically adds '[' and ']' to IPv6 addresses */
886 mrltemp += wxT("[") + net_addrs[1]->GetLineText(0)
891 mrltemp += net_addrs[1]->GetLineText(0);
893 if( i_net_ports[1] != config_GetInt( p_intf, "server-port" ) )
895 mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );
898 caching_name = wxT("udp-caching");
903 if( net_addrs[2]->GetLineText(0).Find(wxT("://")) == -1 )
904 mrltemp = wxT("http://");
906 mrltemp += net_addrs[2]->GetLineText(0);
908 caching_name = wxT("http-caching");
913 if( net_addrs[3]->GetLineText(0).Find(wxT("rtsp://")) != 0 )
915 mrltemp = wxT("rtsp://");
917 mrltemp += net_addrs[3]->GetLineText(0);
919 caching_name = wxT("rtsp-caching");
926 int i_item = i_access_method - MAX_ACCESS;
928 if( i_item < 0 || i_item >= (int)input_tab_array.GetCount() )
931 AutoBuiltPanel *input_panel = input_tab_array.Item( i_item );
933 mrltemp = input_panel->name + wxT("://");
935 for( int i=0; i < (int)input_panel->config_array.GetCount(); i++ )
937 ConfigControl *control = input_panel->config_array.Item(i);
939 mrltemp += wxT(" :");
941 if( control->GetType() == CONFIG_ITEM_BOOL &&
942 !control->GetIntValue() ) mrltemp += wxT("no-");
944 mrltemp += control->GetName();
946 switch( control->GetType() )
948 case CONFIG_ITEM_STRING:
949 case CONFIG_ITEM_FILE:
950 case CONFIG_ITEM_DIRECTORY:
951 case CONFIG_ITEM_MODULE:
952 mrltemp += wxT("=\"") + control->GetPszValue() + wxT("\"");
954 case CONFIG_ITEM_INTEGER:
956 wxString::Format( wxT("=%i"), control->GetIntValue() );
958 case CONFIG_ITEM_FLOAT:
960 wxString::Format(wxT("=%f"), control->GetFloatValue());
965 if( input_panel->p_advanced_mrl_combo &&
966 input_panel->p_advanced_mrl_combo->GetValue() )
968 mrltemp += wxT(" ") +
969 input_panel->p_advanced_mrl_combo->GetValue();
975 if( caching_name.size() )
977 if( caching_value->IsEnabled() )
979 mrltemp += wxT(" :") + caching_name +
980 wxString::Format( wxT("=%d"), i_caching );
984 int i_value = config_GetInt( p_intf, caching_name.mb_str() );
985 caching_value->SetValue( i_value );
989 mrl_combo->SetValue( mrltemp );
992 /*****************************************************************************
994 *****************************************************************************/
995 void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
997 mrl = SeparateEntries( mrl_combo->GetValue() );
998 mrl_combo->Append( mrl_combo->GetValue() );
999 if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 );
1000 mrl_combo->SetSelection( mrl_combo->GetCount() - 1 );
1002 if( i_method == OPEN_STREAM )
1004 if( IsModal() ) EndModal( wxID_OK );
1009 /* Update the playlist */
1010 playlist_t *p_playlist =
1011 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1013 if( p_playlist == NULL ) return;
1015 for( int i = 0; i < (int)mrl.GetCount(); i++ )
1017 vlc_bool_t b_start = !i && i_open_arg;
1018 playlist_item_t *p_item =
1019 playlist_ItemNew( p_intf, (const char*)mrl[i].mb_str(),
1020 (const char *)mrl[i].mb_str() );
1022 /* Insert options */
1023 while( i + 1 < (int)mrl.GetCount() &&
1024 ((const char *)mrl[i + 1].mb_str())[0] == ':' )
1026 playlist_ItemAddOption( p_item, mrl[i + 1].mb_str() );
1030 /* Get the options from the subtitles dialog */
1031 if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() )
1033 for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
1035 playlist_ItemAddOption( p_item, subsfile_mrl[j].mb_str() );
1039 /* Get the options from the stream output dialog */
1040 if( sout_checkbox->IsChecked() && sout_mrl.GetCount() )
1042 for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
1044 playlist_ItemAddOption( p_item, sout_mrl[j].mb_str() );
1048 int i_id = playlist_AddItem( p_playlist, p_item,
1049 PLAYLIST_APPEND, PLAYLIST_END );
1053 playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
1057 vlc_object_release( p_playlist );
1061 if( IsModal() ) EndModal( wxID_OK );
1064 void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
1068 if( IsModal() ) EndModal( wxID_CANCEL );
1071 void OpenDialog::OnPageChange( wxNotebookEvent& event )
1073 UpdateMRL( event.GetSelection() );
1076 void OpenDialog::OnMRLChange( wxCommandEvent& event )
1078 //mrl = SeparateEntries( event.GetString() );
1081 /*****************************************************************************
1082 * File panel event methods.
1083 *****************************************************************************/
1084 void OpenDialog::OnFilePanelChange( wxCommandEvent& WXUNUSED(event) )
1086 UpdateMRL( FILE_ACCESS );
1089 void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
1091 if( file_dialog == NULL )
1092 file_dialog = new wxFileDialog( this, wxU(_("Open File")),
1093 wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
1095 if( file_dialog && file_dialog->ShowModal() == wxID_OK )
1097 wxArrayString paths;
1100 file_dialog->GetPaths( paths );
1102 for( size_t i = 0; i < paths.GetCount(); i++ )
1104 if( paths[i].Find( wxT(' ') ) >= 0 )
1105 path += wxT("\"") + paths[i] + wxT("\" ");
1107 path += paths[i] + wxT(" ");
1110 file_combo->SetValue( path );
1111 file_combo->Append( path );
1112 if( file_combo->GetCount() > 10 ) file_combo->Delete( 0 );
1113 UpdateMRL( FILE_ACCESS );
1117 /*****************************************************************************
1118 * Disc panel event methods.
1119 *****************************************************************************/
1120 void OpenDialog::OnDiscPanelChange( wxCommandEvent& event )
1122 if( event.GetId() == DiscTitle_Event ) i_disc_title = event.GetInt();
1123 if( event.GetId() == DiscChapter_Event ) i_disc_chapter = event.GetInt();
1124 if( event.GetId() == DiscSub_Event ) i_disc_sub = event.GetInt();
1126 UpdateMRL( DISC_ACCESS );
1129 void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event )
1133 switch( disc_type->GetSelection() )
1136 psz_device = config_GetPsz( p_intf, "cd-audio" );
1140 psz_device = config_GetPsz( p_intf, "vcd" );
1144 psz_device = config_GetPsz( p_intf, "dvd" );
1148 if ( !psz_device ) psz_device = "";
1150 if( disc_device->GetValue().Cmp( wxL2U( psz_device ) ) )
1152 b_disc_device_changed = true;
1155 UpdateMRL( DISC_ACCESS );
1158 void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
1160 char *psz_device = NULL;
1162 switch( disc_type->GetSelection() )
1165 case 0: /* DVD with menus */
1166 case 1: /* DVD without menus */
1167 disc_sub->Enable(); disc_sub_label->Enable();
1168 disc_chapter->Enable(); disc_chapter_label->Enable();
1169 disc_title_label->SetLabel ( wxU(_("Title")) );
1170 psz_device = config_GetPsz( p_intf, "dvd" );
1171 if( !b_disc_device_changed )
1173 if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
1174 else disc_device->SetValue( wxT("") );
1176 disc_title->SetRange( 0, 255 );
1177 disc_chapter->SetRange( 0, 255 );
1180 case 2: /* VCD of some sort */
1181 disc_sub->Enable(); disc_sub_label->Enable();
1182 disc_chapter->Disable(); disc_chapter_label->Disable();
1183 psz_device = config_GetPsz( p_intf, "vcd" );
1184 if( !b_disc_device_changed )
1186 if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
1187 else disc_device->SetValue( wxT("") );
1191 disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" )
1192 ? wxT("Playback LID") : wxT("Entry") );
1194 disc_title_label->SetLabel ( wxU(_("Track")) );
1196 disc_title->SetRange( 0, 999 );
1200 disc_sub->Disable(); disc_sub_label->Disable();
1201 disc_chapter->Disable(); disc_chapter_label->Disable();
1202 disc_title_label->SetLabel ( wxU(_("Track")) );
1203 psz_device = config_GetPsz( p_intf, "cd-audio" );
1204 if( !b_disc_device_changed )
1206 if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
1207 else disc_device->SetValue( wxT("") );
1210 /* There are at most 99 tracks in a CD-DA */
1211 disc_title->SetRange( 0, 99 );
1215 msg_Err( p_intf, "invalid Disc type selection (%d)",
1216 disc_type->GetSelection() );
1220 disc_title->SetValue( 0 ); i_disc_title = 0;
1221 disc_chapter->SetValue( 0 ); i_disc_chapter = 0;
1223 if( psz_device ) free( psz_device );
1225 UpdateMRL( DISC_ACCESS );
1228 /*****************************************************************************
1229 * Net panel event methods.
1230 *****************************************************************************/
1231 void OpenDialog::OnNetPanelChange( wxCommandEvent& event )
1233 if( event.GetId() >= NetPort1_Event && event.GetId() <= NetPort3_Event )
1235 i_net_ports[event.GetId() - NetPort1_Event] = event.GetInt();
1238 UpdateMRL( NET_ACCESS );
1241 void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
1245 i_net_type = event.GetId() - NetRadio1_Event;
1249 net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) );
1250 net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) );
1253 UpdateMRL( NET_ACCESS );
1256 /*****************************************************************************
1257 * Subtitles file event methods.
1258 *****************************************************************************/
1259 void OpenDialog::OnSubsFileEnable( wxCommandEvent& event )
1261 subsfile_button->Enable( event.GetInt() != 0 );
1264 void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
1266 /* Show/hide the open dialog */
1267 if( subsfile_dialog == NULL )
1268 subsfile_dialog = new SubsFileDialog( p_intf, this );
1270 if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
1272 subsfile_mrl.Empty();
1273 subsfile_mrl.Add( wxString(wxT("sub-file=")) +
1274 subsfile_dialog->file_combo->GetValue() );
1275 if( subsfile_dialog->encoding_combo )
1276 subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) +
1277 subsfile_dialog->encoding_combo->GetValue() );
1278 subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"),
1279 (int)subsfile_dialog->align_combo->GetClientData(
1280 subsfile_dialog->align_combo->GetSelection()) ) );
1282 subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"),
1283 (int)subsfile_dialog->size_combo->GetClientData(
1284 subsfile_dialog->size_combo->GetSelection()) ) );
1285 subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"),
1286 subsfile_dialog->fps_spinctrl->GetValue() ) );
1287 subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
1288 subsfile_dialog->delay_spinctrl->GetValue() ) );
1292 /*****************************************************************************
1293 * Stream output event methods.
1294 *****************************************************************************/
1295 void OpenDialog::OnSoutEnable( wxCommandEvent& event )
1297 sout_button->Enable( event.GetInt() != 0 );
1300 void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
1302 /* Show/hide the open dialog */
1303 if( sout_dialog == NULL )
1304 sout_dialog = new SoutDialog( p_intf, this );
1306 if( sout_dialog && sout_dialog->ShowModal() == wxID_OK )
1308 sout_mrl = sout_dialog->GetOptions();
1312 /*****************************************************************************
1313 * Caching event methods.
1314 *****************************************************************************/
1315 void OpenDialog::OnCachingEnable( wxCommandEvent& event )
1317 caching_value->Enable( event.GetInt() != 0 );
1318 i_caching = caching_value->GetValue();
1322 void OpenDialog::OnCachingChange( wxCommandEvent& event )
1324 i_caching = event.GetInt();
1328 /*****************************************************************************
1329 * Utility functions.
1330 *****************************************************************************/
1331 wxArrayString SeparateEntries( wxString entries )
1333 vlc_bool_t b_quotes_mode = VLC_FALSE;
1335 wxArrayString entries_array;
1338 wxStringTokenizer token( entries, wxT(" \t\r\n\""), wxTOKEN_RET_DELIMS );
1340 while( token.HasMoreTokens() )
1342 entry += token.GetNextToken();
1344 if( entry.IsEmpty() ) continue;
1346 if( !b_quotes_mode && entry.Last() == wxT('\"') )
1348 /* Enters quotes mode */
1350 b_quotes_mode = VLC_TRUE;
1352 else if( b_quotes_mode && entry.Last() == wxT('\"') )
1354 /* Finished the quotes mode */
1356 b_quotes_mode = VLC_FALSE;
1358 else if( !b_quotes_mode && entry.Last() != wxT('\"') )
1360 /* we found a non-quoted standalone string */
1361 if( token.HasMoreTokens() ||
1362 entry.Last() == wxT(' ') || entry.Last() == wxT('\t') ||
1363 entry.Last() == wxT('\r') || entry.Last() == wxT('\n') )
1365 if( !entry.IsEmpty() ) entries_array.Add( entry );
1372 if( !entry.IsEmpty() ) entries_array.Add( entry );
1374 return entries_array;