00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014 #include "wx/wxprec.h"
00015
00016 #ifdef __BORLANDC__
00017 #pragma hdrstop
00018 #endif
00019
00020 #ifndef WX_PRECOMP
00021 #include "wx/wx.h"
00022 #endif
00023
00024 #include "guipkg/cmdeditdlg.h"
00025
00026
00027
00028
00029
00030
00031 IMPLEMENT_DYNAMIC_CLASS( wxPackageCommandEditDlg, wxDialog )
00032 BEGIN_EVENT_TABLE( wxPackageCommandEditDlg, wxDialog )
00033 EVT_BUTTON( wxID_OK, wxPackageCommandEditDlg::OnOK )
00034 END_EVENT_TABLE()
00035
00036 wxPackageCommandEditDlg::wxPackageCommandEditDlg( )
00037 {
00038 }
00039
00040 wxPackageCommandEditDlg::wxPackageCommandEditDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00041 {
00042 Create(parent, id, caption, pos, size, style);
00043 }
00044
00045 bool wxPackageCommandEditDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00046 {
00048 m_pNotebook = NULL;
00049 m_pLabel = NULL;
00050 m_pCmd = NULL;
00051 m_pWorkDir = NULL;
00053
00055 SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
00056 wxDialog::Create( parent, id, caption, pos, size, style );
00057
00058 CreateControls();
00059 if (GetSizer())
00060 {
00061 GetSizer()->SetSizeHints(this);
00062 }
00063 Centre();
00065 return true;
00066 }
00067
00068 void wxPackageCommandEditDlg::CreateControls()
00069 {
00071 wxPackageCommandEditDlg* itemDialog1 = this;
00072
00073 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00074 itemDialog1->SetSizer(itemBoxSizer2);
00075
00076 m_pNotebook = new wxNotebook( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
00077
00078 wxPanel* itemPanel4 = new wxPanel( m_pNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
00079 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
00080 itemPanel4->SetSizer(itemBoxSizer5);
00081
00082 itemBoxSizer5->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00083
00084 m_pLabel = new wxStaticText( itemPanel4, wxID_STATIC, _("TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT\n** SET BY wxPackageCmdEditDlg AUTOMATICALLY **"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxST_NO_AUTORESIZE );
00085 itemBoxSizer5->Add(m_pLabel, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
00086
00087 itemBoxSizer5->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00088
00089 wxStaticText* itemStaticText9 = new wxStaticText( itemPanel4, wxID_STATIC, _("Note that, unlike local references, the 'working directory'\ncan be specified without using file:/// prefix.\nIf empty, the command will be executed from the package root."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
00090 itemBoxSizer5->Add(itemStaticText9, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
00091
00092 itemBoxSizer5->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00093
00094 wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 2, 0, 0);
00095 itemFlexGridSizer11->AddGrowableCol(1);
00096 itemBoxSizer5->Add(itemFlexGridSizer11, 0, wxGROW|wxALL, 5);
00097 wxStaticText* itemStaticText12 = new wxStaticText( itemPanel4, wxID_STATIC, _("Command:"), wxDefaultPosition, wxDefaultSize, 0 );
00098 itemFlexGridSizer11->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
00099
00100 m_pCmd = new wxTextCtrl( itemPanel4, ID_CMDEDIT_CMD, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00101 itemFlexGridSizer11->Add(m_pCmd, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00102
00103 wxStaticText* itemStaticText14 = new wxStaticText( itemPanel4, wxID_STATIC, _("Working directory:"), wxDefaultPosition, wxDefaultSize, 0 );
00104 itemFlexGridSizer11->Add(itemStaticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
00105
00106 m_pWorkDir = new wxTextCtrl( itemPanel4, ID_CMDEDIT_WORKDIR, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00107 itemFlexGridSizer11->Add(m_pWorkDir, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00108
00109 itemBoxSizer5->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00110
00111 m_pNotebook->AddPage(itemPanel4, _("Command"));
00112
00113 itemBoxSizer2->Add(m_pNotebook, 1, wxGROW|wxALL, 5);
00114
00115 wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
00116
00117 itemBoxSizer2->Add(itemStdDialogButtonSizer17, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00118 wxButton* itemButton18 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
00119 itemStdDialogButtonSizer17->AddButton(itemButton18);
00120
00121 wxButton* itemButton19 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
00122 itemStdDialogButtonSizer17->AddButton(itemButton19);
00123
00124 itemStdDialogButtonSizer17->Realize();
00125
00127
00128
00129 wxPanel *panel = new wxPanel(m_pNotebook, wxID_ANY);
00130 wxSizer *sz = new wxBoxSizer(wxVERTICAL);
00131 m_pConditionPanel = new wxPackageConditionPanel(panel, wxID_ANY);
00132 sz->Add(new wxStaticText(panel, wxID_ANY,
00133 _("Check the build systems, platforms, formats and stages to which this command applies.")), 0, wxGROW|wxALL, 5);
00134 sz->AddSpacer(10);
00135 sz->Add(m_pConditionPanel, 1, wxGROW);
00136 sz->AddSpacer(10);
00137 panel->SetSizer(sz);
00138 sz->SetSizeHints(panel);
00139 m_pNotebook->AddPage(panel, _("Condition"));
00140
00141
00142 wxPackageCondition cond;
00143 cond.SetAlwaysTrue();
00144 m_pConditionPanel->SetCondition(cond);
00145
00146
00147
00148 m_pConditionPanel->EnableStageList(false);
00149 }
00150
00151 bool wxPackageCommandEditDlg::ShowToolTips()
00152 {
00153 return true;
00154 }
00155
00156
00157
00158
00159
00160
00161 void wxPackageCommandEditDlg::OnOK(wxCommandEvent &WXUNUSED(ev))
00162 {
00163 wxString str(m_pCmd->GetValue());
00164 if (str.IsEmpty())
00165 {
00166 wxLogError(wxT("Please provide the command to execute."));
00167 return;
00168 }
00169
00170
00171 if (!m_pConditionPanel->IsOk())
00172 return;
00173
00174 EndModal(wxID_OK);
00175 }