33 bool DefaultExecTarget) :
75 m_LastSelected(wxNOT_FOUND)
82 m_List = XRCCTRL(*
this,
"lstItems",
wxListBox);
84 for (
int i = 0; i < m_pProject->GetBuildTargetsCount(); ++i)
89 (m_pProject->GetDefaultExecuteTarget() == target->
GetTitle()));
90 m_List->Append(target->
GetTitle(), targetData);
93 m_List->SetSelection(selected);
96 int item = m_List->FindString(m_pProject->GetActiveBuildTarget());
97 if (item == wxNOT_FOUND)
98 item = m_List->FindString(m_pProject->GetDefaultExecuteTarget());
99 m_List->SetSelection(item);
104 okButton->MoveBeforeInTabOrder (XRCCTRL(*
this,
"lstItems",
wxListBox));
105 okButton->SetDefault();
122 auto lastData =
static_cast<TargetListData*
>(m_List->GetClientObject(m_LastSelected));
124 lastData->SetHostApp(txtHostApp->GetValue());
125 lastData->SetRunHostAppInTerminal(chkHostInTerminal->
GetValue());
127 if (chkSetAsDefaultExec->
GetValue())
129 for (
size_t i = 0; i < m_List->GetCount(); i++)
131 auto data =
static_cast<TargetListData*
>(m_List->GetClientObject(i));
135 lastData->SetDefaultExecTarget(chkSetAsDefaultExec->
GetValue());
140 auto selectedData =
static_cast<TargetListData*
>(m_List->GetClientObject(m_List->GetSelection()));
141 chkSetAsDefaultExec->
SetValue(selectedData->GetDefaultExecTarget());
142 txtParams->SetValue(selectedData->GetExecParameters());
143 txtHostApp->SetValue(selectedData->GetHostApp());
144 chkHostInTerminal->
SetValue(selectedData->GetRunHostAppInTerminal());
146 m_LastSelected = m_List->GetSelection();
151 return m_pProject->GetBuildTarget(m_Selected);
171 _(
"Select host application"),
175 _(
"Executable files (*.exe)|*.exe"),
177 _(
"All files (*)|*"),
182 if (dlg.ShowModal() !=
wxID_OK)
185 if (fname.GetFullPath().StartsWith(m_pProject->GetCommonTopLevelPath()))
188 obj->SetValue(fname.GetFullPath());
191 obj->SetValue(fname.GetFullPath());
200 m_Selected = m_List->GetSelection();
203 for (
size_t i = 0; i < m_List->GetCount(); i++)
205 auto data =
static_cast<TargetListData*
>(m_List->GetClientObject(i));
212 if (data->GetDefaultExecTarget())
213 defaultExecTarget = m_List->GetString(i);
216 if (defaultExecTarget != m_pProject->GetDefaultExecuteTarget())
217 m_pProject->SetDefaultExecuteTarget(defaultExecTarget);
void EndModal(int retCode)
void EndModal(int retCode) override
virtual const wxString & GetExecutionParameters() const
Read the target's execution parameters.
void SetDefaultExecTarget(bool defaultTarget)
virtual const wxString & GetHostApplication() const
Read the target's host application.
virtual void SetFilterIndex(int filterIndex)
ProjectBuildTarget * GetSelectionTarget()
virtual void SetExecutionParameters(const wxString ¶ms)
Set the target's execution parameters to params.
virtual bool GetRunHostApplicationInTerminal() const
Get the flag if the host app should be run in terminal.
void SetRunHostAppInTerminal(bool runAppInTerminal)
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
virtual void SetHostApplication(const wxString &app)
Set the target's host application to app.
Represents a Code::Blocks project.
void OnListboxDClick(wxCommandEvent &event)
virtual const wxString & GetTitle() const
Read the target's title.
wxString m_ExecParameters
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
void SetExecParameters(const wxString &ExecParameters)
const wxString & GetHostApp() const
TargetListData(const wxString &ExecParameters, const wxString &HostApp, bool RunHostAppInTerminal, bool DefaultExecTarget)
bool GetRunHostAppInTerminal() const
Store target UI data for every target in the list box control in the SelectTargetDlg.
void SetHostApp(const wxString &hostApp)
const wxString & _(const wxString &string)
~SelectTargetDlg() override
void OnListboxSelection(wxCommandEvent &event)
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
const wxString & GetExecParameters() const
bool m_RunHostAppInTerminal
Represents a Code::Blocks project build target.
static wxXmlResource * Get()
virtual bool GetValue() const
virtual void SetValue(bool state)
virtual void SetRunHostApplicationInTerminal(bool in_terminal)
bool GetDefaultExecTarget() const
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)