+ void OnUpdateEnvironmentUI(wxUpdateUIEvent& event)
+ {
+ event.Enable(m_useEnv->GetValue());
+ }
+
+ wxTextCtrl* m_executable;
+ wxTextCtrl* m_cwdtext;
+ wxTextCtrl* m_envtext;
+ wxCheckBox* m_useCWD;
+ wxCheckBox* m_useEnv;
+
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(ExecQueryDialog, wxDialog)
+ EVT_UPDATE_UI(TEXT_CWD, ExecQueryDialog::OnUpdateWorkingDirectoryUI)
+ EVT_UPDATE_UI(TEXT_ENVIRONMENT, ExecQueryDialog::OnUpdateEnvironmentUI)
+END_EVENT_TABLE()
+
+ExecQueryDialog::ExecQueryDialog(const wxString& cmd)
+ : wxDialog(NULL, wxID_ANY, DIALOG_TITLE,
+ wxDefaultPosition, wxDefaultSize,
+ wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+{
+ wxSizer* globalSizer = new wxBoxSizer(wxVERTICAL);
+
+ m_executable = new wxTextCtrl(this, TEXT_EXECUTABLE, wxString());
+ m_cwdtext = new wxTextCtrl(this, TEXT_CWD, wxString());
+ m_envtext = new wxTextCtrl(this, TEXT_ENVIRONMENT, wxString(),
+ wxDefaultPosition, wxSize(300, 200),
+ wxTE_MULTILINE|wxHSCROLL);
+
+ const wxSizerFlags flagsExpand = wxSizerFlags().Expand().Border();
+ globalSizer->Add(new wxStaticText(this, wxID_ANY, "Enter the command: "),
+ flagsExpand);
+ globalSizer->Add(m_executable, flagsExpand);
+
+ m_useCWD = new wxCheckBox(this, wxID_ANY, "Working directory: ");
+ globalSizer->Add(m_useCWD, flagsExpand);
+ globalSizer->Add(m_cwdtext, flagsExpand);
+
+ m_useEnv = new wxCheckBox(this, wxID_ANY, "Environment: ");
+ globalSizer->Add(m_useEnv, flagsExpand);
+ globalSizer->Add(m_envtext, wxSizerFlags(flagsExpand).Proportion(1));
+
+ globalSizer->Add(CreateStdDialogButtonSizer(wxOK|wxCANCEL), flagsExpand);
+ SetSizerAndFit(globalSizer);
+
+
+ m_executable->SetValue(cmd);
+ m_cwdtext->SetValue(wxGetCwd());
+ wxEnvVariableHashMap env;
+ if ( wxGetEnvMap(&env) )
+ {
+ for ( wxEnvVariableHashMap::iterator it = env.begin();
+ it != env.end();
+ ++it )
+ {
+ m_envtext->AppendText(it->first + '=' + it->second + '\n');
+ }