134 path =
ChooseDirectory(
nullptr,
_(
"Choose a directory to create the new project"),
135 path,
_T(
""),
false,
true);
138 else if (path.
Mid(path.
Length() - 1) == wxFILE_SEP_PATH)
148 "If you continue, files with the same names WILL BE OVERWRITTEN.\n" 149 "Are you sure you want to continue?"),
173 for (
size_t i = 0; i < files.
GetCount(); ++i)
185 project_filename = dst;
189 #if wxCHECK_VERSION(3, 0, 0) 195 if (count != total_count)
200 if (project_filename.
IsEmpty())
201 cbMessageBox(
_(
"User-template saved successfully but no project file exists in it!"));
206 wxString newname =
cbGetTextFromUser(
_(
"If you want, you can change the project's filename here (without extension):"),
_(
"Change project's filename"), fname.
GetName());
239 if (prj && pFilename)
271 for (
size_t i=0; i<forbidden.
Length(); ++i)
278 wxTextEntryDialog dlg(
nullptr,
_(
"Enter a title for this template"),
_(
"Enter title"), title);
283 title = dlg.GetValue();
286 templ << wxFILE_SEP_PATH << title;
291 cbMessageBox(
_(
"You have another template with the same title.\nPlease choose another title..."));
299 templ << wxFILE_SEP_PATH;
304 wxString src = (*it)->file.GetFullPath();
305 wxString dst = templ + (*it)->relativeToCommonTopLevelPath;
306 #if wxCHECK_VERSION(3, 0, 0) 316 #if wxCHECK_VERSION(3, 0, 0) 344 if (count == total_count)
wxString F(const wxChar *msg,...)
sprintf-like function
cbProject * NewFromTemplate(NewFromTemplateDlg &dlg, wxString *pFilename=nullptr)
virtual void GetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy &prefixOut, TargetFilenameGenerationPolicy &extensionOut) const
~TemplateManager() override
bool wxRenameFile(const wxString &file1, const wxString &file2, bool overwrite=true)
TargetFilenameGenerationPolicy
A target's filename can either be auto-generated based on the running platform, or completely specifi...
void Assign(const wxFileName &filepath)
ConfigManager * GetConfigManager(const wxString &name_space) const
virtual void RebuildTree()=0
Rebuild the project manager's tree.
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
bool SelectedUserTemplate() const
bool GetFirst(wxString *filename, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT) const
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
wxString GetSelectedUserTemplate() const
DLLIMPORT wxString cbGetTextFromUser(const wxString &message, const wxString &caption=cbGetTextFromUserPromptStr, const wxString &default_value=wxEmptyString, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true)
DLLIMPORT wxString ChooseDirectory(wxWindow *parent, const wxString &message=_("Select directory"), const wxString &initialPath=_T(""), const wxString &basePath=_T(""), bool askToMakeRelative=false, bool showCreateDirButton=false)
bool wxDirExists(const wxString &dirname)
static Compiler * GetCompiler(size_t index)
bool HasSubDirs(const wxString &dirspec=wxEmptyString) const
int GetWizardIndex() const
cbProjectManagerUI & GetUI()
DLLIMPORT FileType FileTypeOf(const wxString &filename)
#define wxICON_INFORMATION
static size_t GetAllFiles(const wxString &dirname, wxArrayString *files, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT)
bool wxMkdir(const wxString &dir, int perm=wxS_DIR_DEFAULT)
A generic Code::Blocks event.
virtual wxString GetOutputFilename()
Read the target's output filename.
cbProject * NewProjectFromUserTemplate(NewFromTemplateDlg &dlg, wxString *pFilename=nullptr)
wxWindow * GetAppWindow() const
#define wxICON_EXCLAMATION
template produces custom output (entirely up to the wizard used)
virtual TargetType GetTargetType() const
Read the target's type.
virtual CompileTargetBase * Launch(int index, wxString *createdFilename=nullptr)=0
When this is called, the wizard must get to work ;).
cbWizardPlugin * GetWizard()
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
template outputs a new file (or files)
Represents a Code::Blocks project.
virtual const wxString & GetFilename() const
wxString & RemoveLast(size_t n=1)
static wxString GetConfigFolder()
cbProject * LoadProject(const wxString &filename, bool activateIt=true)
Load a project from disk.
virtual void SetOutputFilename(const wxString &filename)
Set the target's output filename.
virtual const wxString & GetTitle() const
Read the target's title.
cbProject * New(TemplateOutputType initial=totProject, wxString *pFilename=nullptr)
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
LogManager * GetLogManager() const
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
bool wxCopyFile(const wxString &file1, const wxString &file2, bool overwrite=true)
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
const wxStringCharType * wx_str() const
virtual TemplateOutputType GetOutputType(int index) const =0
void SaveUserTemplate(cbProject *prj)
bool SaveAllFiles()
Save all project files.
const wxString & _(const wxString &string)
int GetBuildTargetsCount()
TemplateOutputType
Template output types.
wxArrayString m_UserTemplates
Target produces a static library.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Abstract base class for compilers.
static wxString GetForbiddenChars(wxPathFormat format=wxPATH_NATIVE)
bool GetNext(wxString *filename) const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
virtual const wxString & GetCompilerID() const
Read the target's compiler.
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
template adds a new target in a project
virtual const CompilerSwitches & GetSwitches() const
Get the compiler's generic switches.
bool ProcessEvent(CodeBlocksEvent &event)
wxString GetCommonTopLevelPath() const
wxString & Prepend(const wxString &str)
EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN
size_t Add(const wxString &str, size_t copies=1)
template is a user-saved project template
void SetTitle(const wxString &title) override
Changes project title.
Represents a Code::Blocks project build target.
bool HasFiles(const wxString &filespec=wxEmptyString) const
template outputs a new project
DLLIMPORT bool CreateDirRecursively(const wxString &full_path, int perms=0755)
Base class for wizard plugins.
void SetName(const wxString &name)
bool Save()
Save the project.
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
wxString Mid(size_t first, size_t nCount=wxString::npos) const
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
Base class for build target classes Each Code::Blocks project consists of at least one target...