1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2009 Cecilio Salmeron
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation;
7
// either version 3 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program. If not, see <http://www.gnu.org/licenses/>.
17
// for (any comment, suggestion or feature request, please contact the manager of
18
// the project at cecilios@users.sourceforge.net
20
//-------------------------------------------------------------------------------------
22
// for (compilers that support precompilation, includes "wx/wx.h".
23
#include "wx/wxprec.h"
33
#include <wx/dialog.h>
34
#include <wx/button.h>
35
#include <wx/xrc/xmlres.h>
36
#include <wx/filedlg.h>
38
#include "DlgRunAgdoc.h"
46
//-----------------------------------------------------------------------------
47
// Event table: connect the events to the handler functions to process them
48
//-----------------------------------------------------------------------------
50
BEGIN_EVENT_TABLE(ltDlgRunAgdoc, wxDialog)
51
EVT_BUTTON(wxID_OK, ltDlgRunAgdoc::OnAcceptClicked )
52
EVT_BUTTON(wxID_CANCEL, ltDlgRunAgdoc::OnCancelClicked )
53
EVT_BUTTON(ltID_SELECT, ltDlgRunAgdoc::OnSelectProject )
59
ltDlgRunAgdoc::ltDlgRunAgdoc(wxWindow* parent, wxString* pProject)
60
: wxDialog(parent, wxID_ANY, wxT("agdoc project selection"), wxDefaultPosition,
61
wxDefaultSize, wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX )
62
, m_pProject(pProject)
65
m_pTxtProject->SetValue(*m_pProject);
68
ltDlgRunAgdoc::~ltDlgRunAgdoc()
72
void ltDlgRunAgdoc::Create()
74
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
76
wxBoxSizer* pMainSizer;
77
pMainSizer = new wxBoxSizer( wxVERTICAL );
80
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
82
m_pLblProject = new wxStaticText( this, wxID_ANY, wxT("Project:"), wxDefaultPosition, wxDefaultSize, 0 );
83
m_pLblProject->Wrap( -1 );
84
bSizer3->Add( m_pLblProject, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
86
m_pTxtProject = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 );
87
bSizer3->Add( m_pTxtProject, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
89
m_pBtSelect = new wxButton( this, ltID_SELECT, wxT("Select..."), wxDefaultPosition, wxDefaultSize, 0 );
90
bSizer3->Add( m_pBtSelect, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
92
pMainSizer->Add( bSizer3, 1, wxEXPAND|wxALL, 5 );
94
wxBoxSizer* pButtonsSizer;
95
pButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
98
pButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
100
m_pBtAccept = new wxButton( this, wxID_OK, wxT("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
101
pButtonsSizer->Add( m_pBtAccept, 0, wxALL, 5 );
103
m_pBtCancel = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
104
pButtonsSizer->Add( m_pBtCancel, 0, wxALL, 5 );
107
pButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
109
pMainSizer->Add( pButtonsSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 );
111
this->SetSizer( pMainSizer );
113
pMainSizer->Fit( this );
115
this->Centre( wxBOTH );
118
void ltDlgRunAgdoc::OnAcceptClicked(wxCommandEvent& WXUNUSED(event))
123
void ltDlgRunAgdoc::OnCancelClicked(wxCommandEvent& WXUNUSED(event))
125
EndDialog(wxID_CANCEL);
128
void ltDlgRunAgdoc::OnSelectProject(wxCommandEvent& WXUNUSED(event))
130
// ask for the file to covert
131
wxString sFilter = wxT("*.agproj");
132
wxString sPath = ::wxFileSelector(_T("Choose the project file"),
133
wxT(""), //default path
134
wxT(""), //default filename
135
wxT("agproj"), //default_extension
139
if ( sPath.IsEmpty() ) return;
141
m_pTxtProject->SetValue(sPath);