53 int first_single_line_comment, first_multi_line_comment_begin, first_multi_line_comment_end;
56 line = line.Trim(
true);
57 line = line.Trim(
false);
63 if (language.lineComment.Length() > 0)
64 first_single_line_comment = line.Find(language.lineComment);
65 else first_single_line_comment = -1;
66 if (language.streamCommentStart.Length() > 0)
67 first_multi_line_comment_begin = line.Find(language.streamCommentStart);
68 else first_multi_line_comment_begin = -1;
69 if (language.streamCommentEnd.Length() > 0)
70 first_multi_line_comment_end = line.Find(language.streamCommentEnd);
71 else first_multi_line_comment_end = -1;
74 if (multi_line_comment)
77 if (first_multi_line_comment_end > -1)
79 multi_line_comment =
false;
80 if (first_multi_line_comment_end+language.streamCommentEnd.Length() < line.Length())
81 AnalyseLine(language, line.Mid(first_multi_line_comment_end+language.streamCommentEnd.Length()), comment, code, multi_line_comment);
85 else if (!multi_line_comment)
88 if ( (first_single_line_comment>-1)
89 &&((first_multi_line_comment_begin==-1)||((first_multi_line_comment_begin>-1)&&(first_single_line_comment<first_multi_line_comment_begin))) )
92 if (first_single_line_comment > 0)
96 else if (first_multi_line_comment_begin>-1)
98 multi_line_comment =
true;
100 if (first_multi_line_comment_begin > 0)
102 if (first_multi_line_comment_begin+language.streamCommentStart.Length() < line.Length())
103 AnalyseLine(language, line.Mid(first_multi_line_comment_begin+language.streamCommentStart.Length()), comment, code, multi_line_comment);
113 long int &code_lines,
long int &codecomments_lines,
114 long int &comment_lines,
long int &empty_lines,
115 long int &total_lines)
120 bool multi_line_comment =
false;
125 line = line.
Trim(
true);
126 line = line.
Trim(
false);
127 bool comment =
false;
135 AnalyseLine(language, line, comment, code, multi_line_comment);
136 if (comment&&code) ++codecomments_lines;
137 else if (comment) ++comment_lines;
138 else if (code) ++code_lines;
148 m_LastBuildStageCompilerSel(-1)
151 XRCCTRL(*
this,
"wxID_OK",
wxButton)->SetDefault();
160 list->Append(targetName);
162 list->
Check(i,
true);
184 XRCCTRL(*
this,
"txtObjName",
wxTextCtrl)->Enable(
false);
186 XRCCTRL(*
this,
"staticIncludedFilesLabel",
wxStaticText)->Hide();
187 XRCCTRL(*
this,
"staticIncludedFiles",
wxStaticText)->Hide();
191 XRCCTRL(*
this,
"tabBuild",
wxPanel)->Enable(
false);
192 XRCCTRL(*
this,
"tabAdvanced",
wxPanel)->Enable(
false);
204 XRCCTRL(*
this,
"wxID_OK",
wxButton)->SetDefault();
210 XRCCTRL(*
this,
"lblAutoGen",
wxStaticText)->Show(
false);
224 if (event.IsChecked())
260 bool en = XRCCTRL(*
this,
"chkBuildStage",
wxCheckBox)->GetValue();
261 XRCCTRL(*
this,
"txtBuildStage",
wxTextCtrl)->Enable(en);
265 XRCCTRL(*
this,
"txtCompiler",
wxTextCtrl)->Enable(
false);
267 XRCCTRL(*
this,
"chkCompile",
wxCheckBox)->Enable(
false);
268 XRCCTRL(*
this,
"chkLink",
wxCheckBox)->Enable(
false);
269 XRCCTRL(*
this,
"txtObjName",
wxTextCtrl)->Enable(
false);
270 XRCCTRL(*
this,
"chkBuildStage",
wxCheckBox)->Enable(
false);
271 XRCCTRL(*
this,
"txtBuildStage",
wxTextCtrl)->Enable(
false);
272 XRCCTRL(*
this,
"sliderWeight",
wxSlider)->Enable(
false);
281 for (
size_t i = 0; i < list->
GetCount(); i++)
322 long int total_lines = 0;
323 long int code_lines = 0;
324 long int empty_lines = 0;
325 long int comment_lines = 0;
326 long int codecomments_lines = 0;
332 XRCCTRL(*
this,
"staticEmptyLines",
wxStaticText)->GetContainingSizer()->Layout();
337 long length =
static_cast<long>(file.Length());
339 XRCCTRL(*
this,
"staticFileSize",
wxStaticText)->GetContainingSizer()->Layout();
344 XRCCTRL(*
this,
"staticDateTimeStamp",
wxStaticText)->SetLabel(
359 cmb->Append(compiler->
GetName());
380 XRCCTRL(*
this,
"lblBuildCommand",
wxStaticText)->SetLabel(
_(
"Default: ") + cmd);
401 const int MS_MODE_MASK = 0x0000ffff;
402 int mask = setReadOnly ? _S_IREAD : ( _S_IREAD | _S_IWRITE );
408 else if (errno == EINVAL)
410 else if (errno == EBADF)
417 const int X_MODE_MASK = S_IRGRP | S_IROTH;
418 int mask = setReadOnly ? S_IRUSR : ( S_IRUSR | S_IWUSR );
void SaveBuildCommandSelection()
int m_LastBuildStageCompilerSel
wxString F(const wxChar *msg,...)
sprintf-like function
void EndModal(int retCode)
unsigned short int weight
The weight.
void OnCompilerCombo(wxCommandEvent &event)
bool ToggleFileReadOnly(bool setReadOnly)
void AnalyseLine(const CommentToken &language, wxString line, bool &comment, bool &code, bool &multi_line_comment)
wxString relativeFilename
The relative (to the project) filename of this file.
void OnUpdateUI(wxUpdateUIEvent &event)
void Assign(const wxFileName &filepath)
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...
virtual int GetSelection() const
virtual wxString GetString(unsigned int n) const
const wxString & GetObjName()
wxFileName file
The full filename of this file.
HighlightLanguage GetLanguageForFilename(const wxString &filename)
bool compile
Compile flag.
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
void SetModified(bool modified=true) override
Mark the project as modified or not.
~ProjectFileOptionsDlg() override
static Compiler * GetCompiler(size_t index)
static int GetCompilerIndex(const wxString &id)
void CountLines(wxFileName filename, const CommentToken &language, long int &code_lines, long int &codecomments_lines, long int &comment_lines, long int &empty_lines, long int &total_lines)
size_t GetLineCount() const
FileType
Known file types.
void FillGeneralProperties()
cbProjectManagerUI & GetUI()
const wxCharBuffer mb_str(const wxMBConv &conv=wxConvLibc) const
DLLIMPORT FileType FileTypeOf(const wxString &filename)
Compile object command, e.g. "$compiler $options $includes -c $file -o $object".
bool IsChecked(unsigned int item) const
Represents a file in a Code::Blocks project.
virtual const wxString & GetCommand(CommandType ct, const wxString &fileExtension=wxEmptyString) const
Get a command based on CommandType.
Month GetMonth(const TimeZone &tz=Local) const
EditorManager * GetEditorManager() const
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
const wxString & GetID() const
Get this compiler's unique ID.
Represents a Code::Blocks project.
virtual const wxString & GetFilename() const
virtual const wxString & GetTitle() const
Read the target's title.
void RemoveBuildTarget(const wxString &targetName)
Remove this file from the specified build target.
void Check(unsigned int item, bool check=true)
unsigned short GetSecond(const TimeZone &tz=Local) const
LogManager * GetLogManager() const
pfCustomBuildMap customBuild
A map for custom builds.
bool IsFileWritable() const
const wxStringCharType * wx_str() const
unsigned short GetDay(const TimeZone &tz=Local) const
void UpdateBuildCommand()
bool Open(const wxMBConv &conv=wxConvAuto())
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
int GetBuildTargetsCount()
wxString compilerVar
The compiler variable used for this file (e.g CPP, CC, etc).
void CheckForExternallyModifiedFiles()
Check if one of the open files has been modified outside the IDE.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Compile Win32 resources command, e.g. "$rescomp -i $file -J rc -o $resource_output -O coff $includes"...
Abstract base class for compilers.
EditorColourSet * GetColourSet()
void EndModal(int retCode) override
virtual const wxString & GetCompilerID() const
Read the target's compiler.
unsigned short GetMinute(const TimeZone &tz=Local) const
void OnReadOnlyCheck(wxCommandEvent &event)
virtual const wxString & GetName() const
Get the compiler's name.
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
int GetYear(const TimeZone &tz=Local) const
wxString GetCommonTopLevelPath() const
cbProject * GetParentProject()
static size_t GetCompilersCount()
ProjectFile * AutoGeneratedBy() const
If this is an auto-generated file, which file is generating it?
static wxXmlResource * Get()
ProjectFileOptionsDlg(wxWindow *parent, ProjectFile *pf)
void AddBuildTarget(const wxString &targetName)
Make this file belong to an additional build target.
ProjectFile * m_ProjectFile
unsigned short GetHour(const TimeZone &tz=Local) const
wxDateTime GetModificationTime() const
virtual void SetSelection(int n)
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
static wxString Format(const wxString &format,...)
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
virtual unsigned int GetCount() const
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...