本文整理汇总了C++中ProjectBuildTarget::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectBuildTarget::GetTitle方法的具体用法?C++ ProjectBuildTarget::GetTitle怎么用?C++ ProjectBuildTarget::GetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectBuildTarget
的用法示例。
在下文中一共展示了ProjectBuildTarget::GetTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCopyBuildTargetClick
void ProjectOptionsDlg::OnCopyBuildTargetClick(wxCommandEvent& /*event*/)
{
wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
int targetIdx = lstTargets->GetSelection();
ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
if (!target)
{
cbMessageBox(_("Could not locate target..."),
_("Error"),
wxOK | wxICON_ERROR,
this);
return;
}
wxString newTargetName = wxGetTextFromUser(_("Enter the duplicated build target's name:"),
_("Duplicate build target"),
_("Copy of ") + target->GetTitle());
if (!ValidateTargetName(newTargetName))
return;
if (!m_Project->DuplicateBuildTarget(targetIdx, newTargetName))
{
cbMessageBox(_("Failed to duplicate this build target..."), _("Error"), wxICON_ERROR, this);
return;
}
// add target to targets combo
lstTargets->Append(newTargetName);
lstTargets->SetSelection(lstTargets->GetCount() - 1);
DoTargetChange();
BuildScriptsTree();
CodeBlocksEvent e(cbEVT_PROJECT_TARGETS_MODIFIED);
e.SetProject(m_Project);
Manager::Get()->GetPluginManager()->NotifyPlugins(e);
}
示例2: OnEditBuildTargetClick
void ProjectOptionsDlg::OnEditBuildTargetClick(wxCommandEvent& /*event*/)
{
wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
int targetIdx = lstTargets->GetSelection();
ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
if (!target)
{
cbMessageBox(_("Could not locate target..."),
_("Error"),
wxOK | wxICON_ERROR,
this);
return;
}
wxString oldTargetName = target->GetTitle();
wxString newTargetName = wxGetTextFromUser(_("Change the build target name:"),
_("Rename build target"),
oldTargetName);
if (newTargetName == oldTargetName || !ValidateTargetName(newTargetName))
return;
m_Project->RenameBuildTarget(targetIdx, newTargetName);
lstTargets->SetString(targetIdx, newTargetName);
lstTargets->SetSelection(targetIdx);
BuildScriptsTree();
CodeBlocksEvent e(cbEVT_PROJECT_TARGETS_MODIFIED);
e.SetProject(m_Project);
Manager::Get()->GetPluginManager()->NotifyPlugins(e);
}
示例3: OnFileToggleMarkClick
void ProjectOptionsDlg::OnFileToggleMarkClick(wxCommandEvent& /*event*/)
{
wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
int targetIdx = lstTargets->GetSelection();
ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
for (int i = 0; i < (int)list->GetCount(); ++i)
{
ProjectFile* pf = m_Project->GetFile(i);
list->Check(i, !list->IsChecked(i));
if (list->IsChecked(i))
pf->AddBuildTarget(target->GetTitle());
else
pf->RemoveBuildTarget(target->GetTitle());
}
}
示例4: DoBeforeTargetChange
void ProjectOptionsDlg::DoBeforeTargetChange(bool force)
{
wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
// if no previously selected target, exit
if (m_Current_Sel == -1)
return;
if (force || lstTargets->GetSelection() != m_Current_Sel)
{
// selected another build target
// save changes to the previously selected target
wxArrayString array;
ProjectBuildTarget* target = m_Project->GetBuildTarget(m_Current_Sel);
if (!target)
return;
target->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection()));
wxFileName fname(XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->GetValue());
// fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath());
// fname.MakeRelativeTo(m_Project->GetBasePath());
target->SetOutputFilename(fname.GetFullPath());
fname.Assign(XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->GetValue());
// fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath());
// fname.MakeRelativeTo(m_Project->GetBasePath());
target->SetObjectOutput(fname.GetFullPath());
target->SetCreateHex(XRCCTRL(*this, "chkCreateHex", wxCheckBox)->GetValue());
// files options
wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
int count = list->GetCount();
for (int i = 0; i < count; ++i)
{
ProjectFile* pf = m_Project->GetFile(i);
if (!pf)
break;
if (list->IsChecked(i))
pf->AddBuildTarget(target->GetTitle());
else
pf->RemoveBuildTarget(target->GetTitle());
}
}
}
示例5: BuildScriptsTree
void ProjectOptionsDlg::BuildScriptsTree()
{
wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
tc->DeleteAllItems();
wxTreeItemId root = tc->AddRoot(m_Project->GetTitle());
for (int x = 0; x < m_Project->GetBuildTargetsCount(); ++x)
{
ProjectBuildTarget* target = m_Project->GetBuildTarget(x);
tc->AppendItem(root, target->GetTitle());
}
tc->Expand(root);
tc->SelectItem(root);
FillScripts();
}
示例6: OnExportTargetClick
void ProjectOptionsDlg::OnExportTargetClick(wxCommandEvent& /*event*/)
{
wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
if (!target)
return;
AnnoyingDialog dlg(_("Create project from target confirmation"),
_("This project will be saved before exporting the build target.\n"
"Are you sure you want to export the selected "
"build target to a new project?"),
wxART_QUESTION,
AnnoyingDialog::YES_NO,
wxID_YES);
if (dlg.ShowModal() == wxID_YES)
{
if (m_Project->ExportTargetAsProject(target->GetTitle()))
cbMessageBox(_("New project created successfully!"), _("Information"), wxICON_INFORMATION, this);
}
}
示例7: DoAddFileToProject
int ProjectManager::DoAddFileToProject(const wxString& filename, cbProject* project, wxArrayInt& targets)
{
if (!project)
return 0;
// do we have to ask for target?
if (targets.GetCount() == 0)
{
// if project has only one target, use this
if (project->GetBuildTargetsCount() == 1)
targets.Add(0);
// else display multiple target selection dialog
else
{
targets = m_ui->AskForMultiBuildTargetIndex(project);
if (targets.GetCount() == 0)
return 0;
}
}
// make sure filename is relative to project path
wxFileName fname(filename);
fname.Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE, project->GetBasePath());
fname.MakeRelativeTo(project->GetBasePath());
// add the file to the first selected target
ProjectFile* pf = project->AddFile(targets[0], fname.GetFullPath());
if (pf)
{
// if the file was added successfully,
// add to this file the rest of the selected targets...
for (size_t i = 0; i < targets.GetCount(); ++i)
{
ProjectBuildTarget* target = project->GetBuildTarget(targets[i]);
if (target)
pf->AddBuildTarget(target->GetTitle());
}
}
return targets.GetCount();
}
示例8: RecalcVars
void MacrosManager::RecalcVars(cbProject* project, EditorBase* editor, ProjectBuildTarget* target)
{
m_ActiveEditorFilename = wxEmptyString; // invalidate
m_ActiveEditorLine = -1; // invalidate
m_ActiveEditorColumn = -1; // invalidate
if (editor)
{
// don't use pointer to editor here, because this might be the same,
// even after closing one file and opening a new one
if (editor->GetFilename() != m_ActiveEditorFilename)
m_ActiveEditorFilename = editor->GetFilename();
// (re-) compute column and line but only in case it's a builtin-editor
if (editor->IsBuiltinEditor())
{
cbEditor* cbEd = static_cast<cbEditor*>(editor);
cbStyledTextCtrl* cbSTC = cbEd->GetControl();
if (cbSTC)
{
m_ActiveEditorLine = cbSTC->GetCurrentLine() + 1;
int pos = cbSTC->GetCurrentPos();
if (pos!=-1)
m_ActiveEditorColumn = cbSTC->GetColumn(pos) + 1;
}
}
}
if (!project)
{
// Manager::Get()->GetLogManager()->DebugLog("project == 0");
m_ProjectFilename = wxEmptyString;
m_ProjectName = wxEmptyString;
m_ProjectDir = wxEmptyString;
m_ProjectFiles = wxEmptyString;
m_Makefile = wxEmptyString;
m_LastProject = 0;
ClearProjectKeys();
m_Macros[_T("PROJECTFILE")] = wxEmptyString;
m_Macros[_T("PROJECT_FILE")] = wxEmptyString;
m_Macros[_T("PROJECTFILENAME")] = wxEmptyString;
m_Macros[_T("PROJECT_FILENAME")] = wxEmptyString;
m_Macros[_T("PROJECT_FILE_NAME")] = wxEmptyString;
m_Macros[_T("PROJECTNAME")] = wxEmptyString;
m_Macros[_T("PROJECT_NAME")] = wxEmptyString;
m_Macros[_T("PROJECTDIR")] = wxEmptyString;
m_Macros[_T("PROJECT_DIR")] = wxEmptyString;
m_Macros[_T("PROJECTDIRECTORY")] = wxEmptyString;
m_Macros[_T("PROJECT_DIRECTORY")] = wxEmptyString;
m_Macros[_T("PROJECTTOPDIR")] = wxEmptyString;
m_Macros[_T("PROJECT_TOPDIR")] = wxEmptyString;
m_Macros[_T("PROJECTTOPDIRECTORY")] = wxEmptyString;
m_Macros[_T("PROJECT_TOPDIRECTORY")] = wxEmptyString;
m_Macros[_T("MAKEFILE")] = wxEmptyString;
m_Macros[_T("ALL_PROJECT_FILES")] = wxEmptyString;
}
else if (project != m_LastProject)
{
// Manager::Get()->GetLogManager()->DebugLog("project != m_LastProject");
m_LastTarget = 0; // reset last target when project changes
m_ProjectWxFileName.Assign(project->GetFilename());
m_ProjectFilename = UnixFilename(m_ProjectWxFileName.GetFullName());
m_ProjectName = project->GetTitle();
m_ProjectDir = UnixFilename(project->GetBasePath());
m_ProjectTopDir = UnixFilename(project->GetCommonTopLevelPath());
m_Makefile = UnixFilename(project->GetMakefile());
m_ProjectFiles = wxEmptyString;
for (int i = 0; i < project->GetFilesCount(); ++i)
{
// quote filenames, if they contain spaces
wxString out = UnixFilename(project->GetFile(i)->relativeFilename);
QuoteStringIfNeeded(out);
m_ProjectFiles << out << _T(' ');
}
ClearProjectKeys();
m_Macros[_T("PROJECTFILE")] = m_ProjectFilename;
m_Macros[_T("PROJECT_FILE")] = m_ProjectFilename;
m_Macros[_T("PROJECTFILENAME")] = m_ProjectFilename;
m_Macros[_T("PROJECT_FILENAME")] = m_ProjectFilename;
m_Macros[_T("PROJECT_FILE_NAME")] = m_ProjectFilename;
m_Macros[_T("PROJECTNAME")] = m_ProjectName;
m_Macros[_T("PROJECT_NAME")] = m_ProjectName;
m_Macros[_T("PROJECTDIR")] = m_ProjectDir;
m_Macros[_T("PROJECT_DIR")] = m_ProjectDir;
m_Macros[_T("PROJECTDIRECTORY")] = m_ProjectDir;
m_Macros[_T("PROJECT_DIRECTORY")] = m_ProjectDir;
m_Macros[_T("PROJECTTOPDIR")] = m_ProjectTopDir;
m_Macros[_T("PROJECT_TOPDIR")] = m_ProjectTopDir;
m_Macros[_T("PROJECTTOPDIRECTORY")] = m_ProjectTopDir;
m_Macros[_T("PROJECT_TOPDIRECTORY")] = m_ProjectTopDir;
m_Macros[_T("MAKEFILE")] = m_Makefile;
m_Macros[_T("ALL_PROJECT_FILES")] = m_ProjectFiles;
for (int i = 0; i < project->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* target = project->GetBuildTarget(i);
if (!target)
continue;
wxString title = target->GetTitle().Upper();
//.........这里部分代码省略.........
示例9: FindTargetsDebugger
void DebuggerManager::FindTargetsDebugger()
{
if (Manager::Get()->GetProjectManager()->IsLoadingOrClosing())
return;
m_activeDebugger = nullptr;
m_menuHandler->SetActiveDebugger(nullptr);
if (m_registered.empty())
{
m_menuHandler->MarkActiveTargetAsValid(false);
return;
}
ProjectManager* projectMgr = Manager::Get()->GetProjectManager();
LogManager* log = Manager::Get()->GetLogManager();
cbProject* project = projectMgr->GetActiveProject();
ProjectBuildTarget *target = nullptr;
if (project)
{
const wxString &targetName = project->GetActiveBuildTarget();
if (project->BuildTargetValid(targetName))
target = project->GetBuildTarget(targetName);
}
Compiler *compiler = nullptr;
if (!target)
{
if (project)
compiler = CompilerFactory::GetCompiler(project->GetCompilerID());
if (!compiler)
compiler = CompilerFactory::GetDefaultCompiler();
if (!compiler)
{
log->LogError(_("Can't get the compiler for the active target, nor the project, nor the default one!"));
m_menuHandler->MarkActiveTargetAsValid(false);
return;
}
}
else
{
compiler = CompilerFactory::GetCompiler(target->GetCompilerID());
if (!compiler)
{
log->LogError(wxString::Format(_("Current target '%s' doesn't have valid compiler!"),
target->GetTitle().c_str()));
m_menuHandler->MarkActiveTargetAsValid(false);
return;
}
}
wxString dbgString = compiler->GetPrograms().DBGconfig;
wxString::size_type pos = dbgString.find(wxT(':'));
wxString name, config;
if (pos != wxString::npos)
{
name = dbgString.substr(0, pos);
config = dbgString.substr(pos + 1, dbgString.length() - pos - 1);
}
if (name.empty() || config.empty())
{
log->LogError(wxString::Format(_("Current compiler '%s' doesn't have correctly defined debugger!"),
compiler->GetName().c_str()));
m_menuHandler->MarkActiveTargetAsValid(false);
return;
}
for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
{
PluginData &data = it->second;
if (it->first->GetSettingsName() == name)
{
ConfigurationVector &configs = data.GetConfigurations();
int index = 0;
for (ConfigurationVector::iterator itConf = configs.begin(); itConf != configs.end(); ++itConf, ++index)
{
if ((*itConf)->GetName() == config)
{
m_activeDebugger = it->first;
m_activeDebugger->SetActiveConfig(index);
m_useTargetsDefault = true;
WriteActiveDebuggerConfig(wxEmptyString, -1);
RefreshUI();
m_menuHandler->MarkActiveTargetAsValid(true);
return;
}
}
}
}
wxString targetTitle(target ? target->GetTitle() : wxT("<nullptr>"));
log->LogError(wxString::Format(_("Can't find the debugger config: '%s:%s' for the current target '%s'!"),
name.c_str(), config.c_str(),
targetTitle.c_str()));
m_menuHandler->MarkActiveTargetAsValid(false);
}
示例10: ProcessLinkerLibs
void ProjectOptionsManipulator::ProcessLinkerLibs(cbProject* prj, const wxString& lib, const wxString& lib_new, wxArrayString& result)
{
ProjectOptionsManipulatorDlg::EProjectScanOption scan_opt = m_Dlg->GetScanOption();
switch (scan_opt)
{
case ProjectOptionsManipulatorDlg::eSearch:
case ProjectOptionsManipulatorDlg::eSearchNot:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
bool has_opt = HasOption(prj->GetLinkLibs(), lib);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains linker lib '%s'."),
prj->GetTitle().wx_str(), lib.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not contain linker lib '%s'."),
prj->GetTitle().wx_str(), lib.wx_str()));
}
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt)
{
bool has_opt = HasOption(tgt->GetLinkLibs(), lib);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains linker lib '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), lib.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not contain linker lib '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), lib.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
wxString full_lib;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLinkLibs(), lib, full_lib) )
prj->RemoveLinkLib(full_lib);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && HasOption(tgt->GetLinkLibs(), lib, full_lib))
tgt->RemoveLinkLib(lib);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( !HasOption(prj->GetLinkLibs(), lib) )
prj->AddLinkLib(lib);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && !HasOption(tgt->GetLinkLibs(), lib))
tgt->AddLinkLib(lib);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace:
{
wxString full_lib;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLinkLibs(), lib, full_lib) )
prj->ReplaceLinkLib(full_lib, ManipulateOption(full_lib, lib, lib_new));
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
//.........这里部分代码省略.........
示例11: ProcessResCompPaths
void ProjectOptionsManipulator::ProcessResCompPaths(cbProject* prj, const wxString& path, const wxString& path_new, wxArrayString& result)
{
ProjectOptionsManipulatorDlg::EProjectScanOption scan_opt = m_Dlg->GetScanOption();
switch (scan_opt)
{
case ProjectOptionsManipulatorDlg::eSearch:
case ProjectOptionsManipulatorDlg::eSearchNot:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
bool has_opt = HasOption(prj->GetResourceIncludeDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains resource compiler path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not contain resource compiler path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt)
{
bool has_opt = HasOption(tgt->GetResourceIncludeDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains resource compiler path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not contain resource compiler path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
wxString full_path;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetResourceIncludeDirs(), path, full_path) )
prj->RemoveResourceIncludeDir(full_path);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && HasOption(tgt->GetResourceIncludeDirs(), path, full_path))
tgt->RemoveResourceIncludeDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( !HasOption(prj->GetResourceIncludeDirs(), path) )
prj->AddResourceIncludeDir(path);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && !HasOption(tgt->GetResourceIncludeDirs(), path))
tgt->AddResourceIncludeDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace:
{
wxString full_path;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetResourceIncludeDirs(), path, full_path) )
prj->ReplaceResourceIncludeDir(full_path, ManipulateOption(full_path, path, path_new));
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
//.........这里部分代码省略.........
示例12: ProcessCustomVars
void ProjectOptionsManipulator::ProcessCustomVars(cbProject* prj, const wxString& var, const wxString& value, wxArrayString& result)
{
ProjectOptionsManipulatorDlg::EProjectScanOption scan_opt = m_Dlg->GetScanOption();
switch (scan_opt)
{
case ProjectOptionsManipulatorDlg::eSearch:
case ProjectOptionsManipulatorDlg::eSearchNot:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
bool has_var = prj->HasVar(var);
if (has_var && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not define custom var '%s'."),
prj->GetTitle().wx_str(), var.wx_str()));
}
else if (has_var && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Defines custom var '%s'."),
prj->GetTitle().wx_str(), var.wx_str()));
}
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt)
{
bool has_var = prj->HasVar(var);
if (has_var && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not define custom var '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), var.wx_str()));
}
else if (has_var && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Defines custom var '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), var.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
prj->UnsetVar(var);
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt) tgt->UnsetVar(var);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
prj->SetVar(var, value);
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt) tgt->SetVar(var, value);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace: // fall-through
case ProjectOptionsManipulatorDlg::eFiles: // fall-through
default:
break;
}
}
示例13: txtFilename
FilePathPanel::FilePathPanel(wxWindow* parent,wxWindowID id) :
txtFilename(0),
btnBrowse(0),
lblGuard(0),
txtGuard(0),
chkAddToProject(0),
clbTargets(0),
btnAll(0),
btnNone(0),
m_ExtFilter(_T("")),
m_Selection(-1)
{
//(*Initialize(FilePathPanel)
wxBoxSizer* BoxSizer1;
wxStaticText* StaticText1;
wxStaticText* StaticText2;
wxStaticText* StaticText4;
Create(parent,id,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL,_T("wxPanel"));
BoxSizer1 = new wxBoxSizer(wxVERTICAL);
StaticText1 = new wxStaticText(this,ID_STATICTEXT1,_("Please enter the file\'s location and name and\nwhether to add it to the active project."),wxDefaultPosition,wxDefaultSize,0,_T("ID_STATICTEXT1"));
BoxSizer1->Add(StaticText1,0,wxALL|wxALIGN_LEFT|wxALIGN_TOP,8);
StaticText2 = new wxStaticText(this,ID_STATICTEXT2,_("Filename with full path:"),wxDefaultPosition,wxDefaultSize,0,_T("ID_STATICTEXT2"));
BoxSizer1->Add(StaticText2,0,wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
txtFilename = new wxTextCtrl(this,ID_TEXTCTRL1,_("Text"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("ID_TEXTCTRL1"));
BoxSizer2->Add(txtFilename,1,wxALL|wxALIGN_LEFT|wxALIGN_TOP,0);
btnBrowse = new wxButton(this,ID_BUTTON1,_("..."),wxDefaultPosition,wxSize(22,22),0,wxDefaultValidator,_T("ID_BUTTON1"));
BoxSizer2->Add(btnBrowse,0,wxALL|wxALIGN_LEFT|wxALIGN_TOP,0);
BoxSizer1->Add(BoxSizer2,0,wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
lblGuard = new wxStaticText(this,ID_STATICTEXT3,_("Header guard word:"),wxDefaultPosition,wxDefaultSize,0,_T("ID_STATICTEXT3"));
BoxSizer1->Add(lblGuard,0,wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
txtGuard = new wxTextCtrl(this,ID_TEXTCTRL2,_("Text"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("ID_TEXTCTRL2"));
BoxSizer1->Add(txtGuard,0,wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
BoxSizer1->Add(-1,-1,0,wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,0);
chkAddToProject = new wxCheckBox(this,ID_CHECKBOX1,_("Add file to active project"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("ID_CHECKBOX1"));
chkAddToProject->SetValue(false);
BoxSizer1->Add(chkAddToProject,0,wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
FlexGridSizer1 = new wxFlexGridSizer(0,2,0,0);
FlexGridSizer1->AddGrowableCol(1);
FlexGridSizer1->AddGrowableRow(1);
FlexGridSizer1->Add(16,16,0,wxALL|wxALIGN_LEFT|wxALIGN_TOP,0);
StaticText4 = new wxStaticText(this,ID_STATICTEXT4,_("In build target(s):"),wxDefaultPosition,wxDefaultSize,0,_T("ID_STATICTEXT4"));
FlexGridSizer1->Add(StaticText4,0,wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,0);
FlexGridSizer1->Add(16,16,0,wxALL|wxALIGN_LEFT|wxALIGN_TOP,0);
clbTargets = new wxCheckListBox(this,ID_CHECKLISTBOX2,wxDefaultPosition,wxSize(222,111),0,NULL,wxLB_HSCROLL|wxLB_SINGLE,wxDefaultValidator,_T("ID_CHECKLISTBOX2"));
clbTargets->Disable();
FlexGridSizer1->Add(clbTargets,1,wxALL|wxEXPAND|wxFIXED_MINSIZE|wxALIGN_LEFT|wxALIGN_TOP,0);
FlexGridSizer1->Add(16,16,0,wxALL|wxALIGN_LEFT|wxALIGN_TOP,0);
BoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
btnAll = new wxButton(this,ID_BUTTON2,_("All"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("ID_BUTTON2"));
btnAll->Disable();
BoxSizer6->Add(btnAll,0,wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL,4);
btnNone = new wxButton(this,ID_BUTTON3,_("None"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("ID_BUTTON3"));
btnNone->Disable();
BoxSizer6->Add(btnNone,0,wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL,0);
FlexGridSizer1->Add(BoxSizer6,0,wxALL|wxALIGN_RIGHT|wxALIGN_TOP,0);
BoxSizer1->Add(FlexGridSizer1,1,wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL,8);
BoxSizer3 = new wxBoxSizer(wxVERTICAL);
BoxSizer1->Add(BoxSizer3,0,wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP,8);
SetSizer(BoxSizer1);
BoxSizer1->Fit(this);
BoxSizer1->SetSizeHints(this);
Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FilePathPanel::OntxtFilenameText);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&FilePathPanel::OnbtnBrowseClick);
Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&FilePathPanel::OnchkAddToProjectChange);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&FilePathPanel::OnbtnAllClick);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&FilePathPanel::OnbtnNoneClick);
//*)
txtFilename->SetValue(wxEmptyString);
txtGuard->SetValue(wxEmptyString);
// fill targets list
cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject();
if (prj)
{
clbTargets->Clear();
for (int i = 0; i < prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* bt = prj->GetBuildTarget(i);
if (bt)
clbTargets->Append(bt->GetTitle());
}
clbTargets->SetSelection(clbTargets->FindString(prj->GetActiveBuildTarget()));
chkAddToProject->SetValue(true);
ToggleVisibility(true);
}
else
{
chkAddToProject->SetValue(false);
ToggleVisibility(false);
}
}
示例14: ProcessLinkerPaths
void ProjectOptionsManipulator::ProcessLinkerPaths(cbProject* prj, const wxString& path, wxArrayString& result)
{
ProjectOptionsManipulatorDlg::EProjectScanOption scan_opt = m_Dlg->GetScanOption();
switch (scan_opt)
{
case ProjectOptionsManipulatorDlg::eSearch:
case ProjectOptionsManipulatorDlg::eSearchNot:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
bool has_opt = SearchOption(prj->GetLibDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains linker path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not contain linker path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt)
{
bool has_opt = SearchOption(tgt->GetLibDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains linker path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not contain linker path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
prj->RemoveLibDir(path);
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt) tgt->RemoveLibDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
prj->AddLibDir(path);
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt) tgt->AddLibDir(path);
}
}
}
break;
default:
break;
}
}
示例15: BatchJob
int CodeBlocksApp::BatchJob()
{
if (!m_Batch)
return -1;
// find compiler plugin
cbCompilerPlugin *compiler = Manager::Get()->GetPluginManager()->GetFirstCompiler();
if (!compiler)
return -3;
if (!m_Clean && m_BatchTarget.Lower() == _T("ask"))
{
m_BatchTarget.Clear();
cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject();
if (prj)
{
int idx = -1;
wxString defTarget = prj->GetActiveBuildTarget();
// find active target's index
// TODO: make this easier in the SDK
for (int i = 0; i < prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* target = prj->GetBuildTarget(i);
if ( target->GetTitle().Matches(defTarget) )
{
idx = i;
break;
}
}
idx = prj->SelectTarget(idx, false);
if (idx == -1)
return 0; // no target selected: just abort
m_BatchTarget = prj->GetBuildTarget(idx)->GetTitle();
}
}
m_pBatchBuildDialog = m_Frame->GetBatchBuildDialog();
PlaceWindow(m_pBatchBuildDialog);
wxString title = _("Building '") + wxFileNameFromPath(wxString(argv[argc-1])) + _("' (target '") + m_BatchTarget + _T("')");
wxTaskBarIcon* tbIcon = new wxTaskBarIcon();
tbIcon->SetIcon(
#ifdef __WXMSW__
wxICON(A_MAIN_ICON),
#else
wxIcon(app),
#endif // __WXMSW__
title);
wxString bb_title = m_pBatchBuildDialog->GetTitle();
m_pBatchBuildDialog->SetTitle(bb_title + _T(" - ") + title);
m_pBatchBuildDialog->Show();
if (m_ReBuild)
{
if (m_HasProject)
compiler->Rebuild(m_BatchTarget);
else if (m_HasWorkSpace)
compiler->RebuildWorkspace(m_BatchTarget);
}
else if (m_Build)
{
if (m_HasProject)
compiler->Build(m_BatchTarget);
else if (m_HasWorkSpace)
compiler->BuildWorkspace(m_BatchTarget);
}
else if (m_Clean)
{
if (m_HasProject)
compiler->Clean(m_BatchTarget);
else if (m_HasWorkSpace)
compiler->CleanWorkspace(m_BatchTarget);
}
// The batch build log might have been deleted in
// CodeBlocksApp::OnBatchBuildDone().
// If it has not, it's still compiling.
if (m_pBatchBuildDialog)
{
// If operation is "--clean", there is no need to display the dialog
// as the operation is synchronous and it already has finished by the
// time the call to Clean() returned.
if (!m_Clean)
m_pBatchBuildDialog->ShowModal();
if ( m_pBatchBuildDialog->IsModal() )
m_pBatchBuildDialog->EndModal(wxID_OK);
else
{
m_pBatchBuildDialog->Destroy();
m_pBatchBuildDialog = nullptr;
}
}
if (tbIcon)
{
tbIcon->RemoveIcon();
delete tbIcon;
}
//.........这里部分代码省略.........