{
Notebook_Event,
Timer_Event,
+ Close_Event,
+ Load_Event,
+ Save_Event,
};
BEGIN_EVENT_TABLE( VLMPanel, wxPanel)
EVT_TIMER( Timer_Event, VLMPanel::OnTimer )
+ EVT_BUTTON( Close_Event, VLMPanel::OnClose )
+ EVT_BUTTON( Load_Event, VLMPanel::OnLoad )
+ EVT_BUTTON( Save_Event, VLMPanel::OnSave )
END_EVENT_TABLE()
timer( this, Timer_Event )
{
p_intf = _p_intf;
+ p_parent = _p_parent;
p_vlm = new VLMWrapper( p_intf );
p_vlm->AttachVLM();
panel_sizer->Add( p_notebook, 1 , wxEXPAND | wxALL, 5 );
#endif
+ wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
+ button_sizer->Add( new wxButton( this, Close_Event, wxU(_("Close") ) ) );
+ button_sizer->Add( 0, 0, 1 );
+ button_sizer->Add( new wxButton( this, Load_Event, wxU(_("Load") ) ), 0, wxRIGHT, 10 );
+ button_sizer->Add( new wxButton( this, Save_Event, wxU(_("Save") ) ) );
+ panel_sizer->Add( button_sizer, 0 , wxEXPAND | wxALL, 5 );
+
panel_sizer->Layout();
SetSizerAndFit( panel_sizer );
p_vlm->UnlockVLM();
}
+void VLMPanel::OnClose( wxCommandEvent &event )
+{
+ ((VLMFrame*)p_parent)->OnClose( *( new wxCloseEvent() ) );
+}
+
+void VLMPanel::OnLoad( wxCommandEvent &event )
+{
+ p_file_dialog = new wxFileDialog( NULL, wxT(""), wxT(""), wxT(""),
+ wxT("*"), wxOPEN | wxMULTIPLE );
+ if( p_file_dialog == NULL ) return;
+
+ p_file_dialog->SetTitle( wxU(_("Load configuration") ) );
+ if( p_file_dialog->ShowModal() == wxID_OK )
+ {
+ vlm_Load( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() );
+ }
+ Update();
+}
+
+void VLMPanel::OnSave( wxCommandEvent &event )
+{
+ p_file_dialog = new wxFileDialog( NULL, wxT(""), wxT(""), wxT(""),
+ wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );
+ if( p_file_dialog == NULL ) return;
+
+ p_file_dialog->SetTitle( wxU(_("Save configuration") ) );
+ if( p_file_dialog->ShowModal() == wxID_OK )
+ {
+ vlm_Save( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() );
+ }
+}
+
/*************************
* Broadcasts management
*************************/
****************************************************************************/
enum
{
- Close_Event,
};
BEGIN_EVENT_TABLE( VLMFrame, wxFrame )
OpenDialog *p_open_dialog;
SoutDialog *p_sout_dialog;
- wxFileDialog *p_file_dialog;
DECLARE_EVENT_TABLE();
};
private:
VLMWrapper *p_vlm;
intf_thread_t *p_intf;
+ wxWindow *p_parent;
+ wxFileDialog *p_file_dialog;
wxTimer timer;
void OnTimer( wxTimerEvent &);
+ void OnClose( wxCommandEvent& );
+ void OnLoad( wxCommandEvent& );
+ void OnSave( wxCommandEvent& );
+
/** Notebook */
wxNotebook *p_notebook;
DECLARE_EVENT_TABLE();
virtual ~VLMFrame();
void Update();
+ void OnClose( wxCloseEvent& );
private:
VLMPanel *vlm_panel;
DECLARE_EVENT_TABLE();
- void OnClose( wxCloseEvent& );
};
/** This class is the edit dialog for a stream