51 template<>
EditorManager* Mgr<EditorManager>::instance =
nullptr;
146 : m_pNotebook(
nullptr),
148 m_pNotebookStackTail(m_pNotebookStackHead),
149 m_nNotebookStackSize(0),
150 m_isCheckingForExternallyModifiedFiles(false)
157 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/editor_tabs_bottom"),
false))
158 m_pNotebook->SetWindowStyleFlag(m_pNotebook->GetWindowStyleFlag() | wxAUI_NB_BOTTOM);
174 colours->
RegisterColour(
_(
"Editor"),
_(
"Line numbers foreground colour"),
wxT(
"editor_linenumbers_fg"),
176 colours->
RegisterColour(
_(
"Editor"),
_(
"Line numbers background colour"),
wxT(
"editor_linenumbers_bg"),
180 colours->
RegisterColour(
_(
"Editor"),
_(
"Margin chrome colour"),
wxT(
"editor_margin_chrome"),
182 colours->
RegisterColour(
_(
"Editor"),
_(
"Margin chrome highlight colour"),
wxT(
"editor_margin_chrome_highlight"),
184 colours->
RegisterColour(
_(
"Editor"),
_(
"Whitespace"),
wxT(
"editor_whitespace"), wxColor(195, 195, 195));
189 DeleteNotebookStack();
190 delete m_pNotebookStackHead;
203 while (m_nNotebookStackSize != m_pNotebook->GetPageCount())
205 if (m_nNotebookStackSize < m_pNotebook->GetPageCount())
207 for (
size_t i = 0; i<m_pNotebook->GetPageCount(); ++i)
209 wnd = m_pNotebook->GetPage(i);
211 for (body = m_pNotebookStackHead->
next; body !=
NULL; body = body->
next)
222 m_pNotebookStackTail = m_pNotebookStackTail->next;
223 ++m_nNotebookStackSize;
227 if (m_nNotebookStackSize > m_pNotebook->GetPageCount())
229 for (prev_body = m_pNotebookStackHead, body = prev_body->
next; body !=
NULL; prev_body = body, body = body->
next)
235 --m_nNotebookStackSize;
242 return m_pNotebookStackHead->
next;
248 while(m_pNotebookStackHead->next)
250 tmp = m_pNotebookStackHead->
next;
251 m_pNotebookStackHead->
next = tmp->
next;
254 m_pNotebookStackTail = m_pNotebookStackHead;
255 m_nNotebookStackSize = 0;
260 DeleteNotebookStack();
261 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
263 m_pNotebookStackTail->next =
new cbNotebookStack(m_pNotebook->GetPage(i));
264 m_pNotebookStackTail = m_pNotebookStackTail->
next;
265 ++m_nNotebookStackSize;
272 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
274 cbEditor* ed = InternalGetBuiltinEditor(i);
289 return m_pNotebook->GetPageCount();
294 if (page >= 0 && page < (
int)m_pNotebook->GetPageCount())
296 return static_cast<EditorBase*
>(m_pNotebook->GetPage(page));
317 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
334 return InternalGetEditorBase(index);
345 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
347 cbEditor* ed = InternalGetBuiltinEditor(i);
355 return Open(
nullptr, filename, pos, data);
371 s_CanShutdown =
false;
383 s_CanShutdown =
true;
394 ed =
new cbEditor(m_pNotebook, fileLdr, fname, m_Theme);
427 s_CanShutdown =
true;
434 if (m_pNotebook->GetPageCount() > 0)
436 return InternalGetEditorBase(m_pNotebook->GetSelection());
443 m_pNotebook->AdvanceSelection(
true);
448 m_pNotebook->AdvanceSelection(
false);
455 int page = FindPageFromEditor(ed);
459 int sel = m_pNotebook->GetSelection();
460 m_pNotebook->SetSelection(page);
463 eb_old =
static_cast<EditorBase*
>(m_pNotebook->GetPage(sel));
473 static_cast<cbEditor*>(ed)->GetControl()->SetFocus();
523 RemoveEditorBase(eb,
false);
528 int page = FindPageFromEditor(eb);
533 m_pNotebook->AddPage(eb, fn.GetFullName(),
true);
539 int page = FindPageFromEditor(eb);
541 m_pNotebook->RemovePage(page);
549 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
551 cbEditor* ed = InternalGetBuiltinEditor(i);
560 pf->
editorTabPos = m_pNotebook->GetTabPositionFromIndex(i) + 1;
569 EditorBase *startPage = GetEditor(
_(
"Start here"));
570 std::vector<EditorBase*> editors;
571 editors.reserve(m_pNotebook->GetPageCount());
572 for (
size_t ii = 0; ii < m_pNotebook->GetPageCount(); ++ii)
576 editors.push_back(eb);
578 return CloseEditors(editors, dontsave);
583 for (
int i = m_pNotebook->GetPageCount() - 1; i >= 0; --i)
586 if (eb && !QueryClose(eb))
594 std::vector<EditorBase*> editors;
595 editors.reserve(m_pNotebook->GetPageCount());
596 for (
size_t ii = 0; ii < m_pNotebook->GetPageCount(); ++ii)
597 editors.push_back(InternalGetEditorBase(ii));
599 editors.erase(std::remove(editors.begin(), editors.end(), editor), editors.end());
601 return CloseEditors(editors, dontsave);
606 std::vector<EditorBase*> editors;
607 GetEditorsInTabCtrl(editors, GetActiveEditor());
609 return CloseEditors(editors, dontsave);
614 std::vector<EditorBase*> editors;
615 GetEditorsInTabCtrl(editors, editor);
617 editors.erase(std::remove(editors.begin(), editors.end(), editor), editors.end());
619 return CloseEditors(editors, dontsave);
624 std::vector<EditorBase*> editors;
625 GetEditorsInTabCtrl(editors, editor);
627 for (
auto it = editors.begin(); it != editors.end(); ++it)
632 editors.erase(it, editors.end());
637 return CloseEditors(editors, dontsave);
642 std::vector<EditorBase*> editors;
643 GetEditorsInTabCtrl(editors, editor);
645 for (
auto it = editors.begin(); it != editors.end(); ++it)
650 editors.erase(editors.begin(), it + 1);
655 return CloseEditors(editors, dontsave);
660 std::vector<wxWindow*> windows;
661 m_pNotebook->GetPagesInTabCtrl(windows, editor);
662 if (!windows.empty())
664 editors.reserve(windows.size());
665 for (std::vector<wxWindow*>::const_iterator it = windows.begin(); it != windows.end(); ++it)
666 editors.push_back(static_cast<EditorBase*>(*it));
674 for (std::vector<EditorBase*>::const_iterator it = editors.begin(); it != editors.end(); ++it)
677 if (eb && !QueryClose(eb))
682 m_pNotebook->Freeze();
683 int count = editors.size();
684 for (std::vector<EditorBase*>::const_reverse_iterator it = editors.rbegin(); it != editors.rend(); ++it)
687 if (eb && Close(eb,
true))
696 return Close(GetActiveEditor(), dontsave);
709 if (!m_pNotebook || !eb)
712 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
714 if (m_pNotebook->GetPage(i) == eb)
722 return Close(IsOpen(filename), dontsave);
729 int idx = FindPageFromEditor(editor);
733 if (!QueryClose(editor))
735 m_pNotebook->DeletePage(idx);
743 EditorBase* ed = InternalGetEditorBase(index);
745 return Close(ed, dontsave);
763 EditorBase* ed = InternalGetEditorBase(index);
787 EditorBase* eb = InternalGetEditorBase(index);
805 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
825 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
827 cbEditor* ed = InternalGetBuiltinEditor(i);
829 ed->
Print(
false, pcm, line_numbers);
837 cbEditor* ed = GetBuiltinEditor(GetActiveEditor());
847 if (m_isCheckingForExternallyModifiedFiles)
849 m_isCheckingForExternallyModifiedFiles =
true;
851 bool reloadAll =
false;
853 for (
size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
855 cbEditor* ed = InternalGetBuiltinEditor(i);
856 bool b_modified =
false;
871 MarkReadOnly(i, readOnly);
875 if (!fn.FileExists())
881 wxWindow* win = wxWindow::GetCapture();
886 msg.
Printf(
_(
"%s has been deleted, or is no longer available.\n" 887 "Do you wish to try to save the file to disk?\n" 888 "If you close it, it will most likely be lost !\n" 889 "If you cancel this dialog, you have to take care yourself !\n" 890 "Yes: save the file, No: close it, Cancel: keep your fingers crossed."), eb->
GetFilename().
c_str());
938 wxWindow* win = wxWindow::GetCapture();
943 msg.
Printf(
_(
"%s has been deleted, or is no longer available.\n" 944 "Do you wish to keep the file open?\n" 958 wxDateTime last = fname.GetModificationTime();
966 MarkReadOnly(i,
false);
991 msg.
Printf(
_(
"File %s is modified outside the IDE...\nDo you want to reload it (you will lose any unsaved work)?"),
994 dlg.SetTitle(
_(
"Reload file?"));
995 dlg.GetSizer()->SetSizeHints(&dlg);
1000 wxWindow* win = wxWindow::GetCapture();
1002 win->ReleaseMouse();
1005 reloadAll = ret ==
crAll;
1007 if (reloadAll || ret ==
crYes)
1014 else if (ret ==
crNo)
1022 SetActiveEditor(GetActiveEditor());
1028 wxWindow* win = wxWindow::GetCapture();
1030 win->ReleaseMouse();
1036 m_isCheckingForExternallyModifiedFiles =
false;
1045 m_pNotebook->SetPageBitmap(page, bmp);
1075 for (
unsigned i=0; i<fileArray.
GetCount(); i++)
1094 for (
unsigned i = 0; i < candidateFilesArray.
GetCount(); ++i)
1096 wxFileName currentCandidateFile(candidateFilesArray[i]);
1098 if (IsHeaderSource(currentCandidateFile, activeFile, ftActive, isCandidate))
1101 if (isUpper == extStartsWithCapital && !isCandidate)
1104 return currentCandidateFile;
1110 candidateFile = currentCandidateFile;
1118 return candidateFile;
1130 #if !defined(__WXMSW__) && !defined(__WXMAC__) 1142 const wxString cmdGetManager = shell +
wxT(
" 'xdg-mime query default inode/directory'");
1147 fileManager = output[0];
1150 fileManager = command;
1158 fileManager =
wxT(
"nautilus");
1167 const wxString firstLine = output[0].Trim(
true).Trim(
false);
1173 int fullVersion = 0;
1175 for (
int ii = versionTokens.
GetCount() - 1; ii >= 0; --ii)
1178 versionTokens[ii].ToLong(&number);
1179 fullVersion += number * multiplier;
1182 if (fullVersion >= 30002)
1187 #endif // !__WXMSW__ && !__WXMAC__ 1191 cbEditor* ed = GetBuiltinEditor(GetActiveEditor());
1197 #if defined __WXMSW__ || defined __WXMAC__ 1224 cbEditor* ed = GetBuiltinEditor(GetActiveEditor());
1260 wxFileName currentCandidateFile = FindHeaderSource(fileArray, theFile, isCandidate);
1264 candidateFile = currentCandidateFile;
1266 else if (currentCandidateFile.IsOk())
1268 cbEditor* newEd = Open(currentCandidateFile.GetFullPath());
1277 for (
int i = 0; i < GetEditorsCount(); ++i)
1279 cbEditor* edit = GetBuiltinEditor(GetEditor(i));
1291 currentCandidateFile = FindHeaderSource(fileArray, theFile, isCandidate);
1293 if (!isCandidate && currentCandidateFile.IsOk())
1295 cbEditor* newEd = Open(currentCandidateFile.GetFullPath());
1316 currentCandidateFile = FindHeaderSource(fileArray, theFile, isCandidate);
1318 if (isCandidate && !candidateFile.IsOk())
1320 candidateFile = currentCandidateFile;
1322 else if (currentCandidateFile.IsOk())
1324 cbEditor* newEd = Open(currentCandidateFile.GetFullPath());
1351 for (
unsigned int i = 0; i < dirs.
GetCount(); ++i)
1367 currentCandidateFile = FindHeaderSource(fileArray, theFile, isCandidate);
1371 candidateFile = currentCandidateFile;
1373 else if (currentCandidateFile.IsOk())
1375 cbEditor* newEd = Open(currentCandidateFile.GetFullPath());
1384 if (candidateFile.IsOk())
1386 cbEditor* newEd = Open(candidateFile.GetFullPath());
1407 if (
cbMessageBox(
_(
"The file seems not to exist. Do you want to create it?"),
1422 cbEditor* newEd = New(theFile.GetFullPath());
1425 if (
cbMessageBox(
_(
"Do you want to add this new file in the active project?"),
1426 _(
"Add file to project"),
1441 CheckForExternallyModifiedFiles();
1450 cbEditor* ed = GetBuiltinEditor(eb);
1451 int id =
event.GetId();
1463 SetActiveEditor(eb);
1472 eb_old = static_cast<EditorBase*>(m_pNotebook->GetPage(event.
GetOldSelection()));
1480 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/tabs_stacked_based_switching")))
1486 for (body = m_pNotebookStackHead; body->
next !=
nullptr; body = body->
next)
1490 if (m_pNotebookStackTail == body->
next)
1491 m_pNotebookStackTail = body;
1494 tmp->
next = m_pNotebookStackHead->
next;
1495 m_pNotebookStackHead->
next = tmp;
1499 if ( (m_pNotebookStackHead->next ==
nullptr)
1500 || (wnd != m_pNotebookStackHead->next->window) )
1503 body->
next = m_pNotebookStackHead->
next;
1504 m_pNotebookStackHead->
next = body;
1505 ++m_nNotebookStackSize;
1510 m_pData->m_SetFocusFlag =
true;
1517 int old_sel =
event.GetOldSelection();
1518 if (old_sel != -1 && static_cast<size_t>(old_sel) < m_pNotebook->GetPageCount())
1529 int sel =
event.GetSelection();
1530 bool doClose =
false;
1536 eb =
static_cast<EditorBase*
>(m_pNotebook->GetPage(sel));
1540 if (m_pNotebook->GetPageCount()<=1)
1548 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/tabs_stacked_based_switching")))
1554 for (body = m_pNotebookStackHead; body->
next !=
nullptr; body = body->
next)
1561 --m_nNotebookStackSize;
1567 if (doClose && eb !=
nullptr)
1588 if (other == current)
1596 m_pNotebook->PopupMenu(pop);
1610 EditorBase *activeEditor = GetActiveEditor();
1611 wxAuiTabCtrl *activeTabCtrl = m_pNotebook->GetTabCtrl(activeEditor);
1612 if (!activeTabCtrl || activeTabCtrl->GetPageCount() <= 1)
1621 const int pageCount = activeTabCtrl->GetPageCount();
1622 const int tabIndex = activeTabCtrl->GetIdxFromWindow(activeEditor);
1625 if (tabIndex == pageCount - 1)
1629 int any_modified = 0;
1630 for (
int i = 0; i<GetEditorsCount(); ++i)
1635 if (++any_modified > 1)
1646 if (any_modified > 0)
1650 if (any_modified > 1 || !GetEditor(event.
GetSelection())->GetModified())
1663 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/editor_tabs_bottom"),
false))
1680 pop->
Append(-1,
_(
"Split view"), splitMenu);
1682 if (
Manager::Get()->GetProjectManager()->GetActiveProject())
1703 m_pNotebook->PopupMenu(pop);
1709 Close(GetActiveEditor());
1714 CloseAllInTabCtrl();
1720 CloseAllInTabCtrlExcept(GetActiveEditor());
1722 CloseAllInTabCtrlToTheLeft(GetActiveEditor());
1724 CloseAllInTabCtrlToTheRight(GetActiveEditor());
1729 Save(m_pNotebook->GetSelection());
1739 SwapActiveHeaderSource();
1744 OpenContainingFolder();
1749 long style = m_pNotebook->GetWindowStyleFlag();
1750 style &= ~wxAUI_NB_BOTTOM;
1753 style |= wxAUI_NB_BOTTOM;
1754 m_pNotebook->SetWindowStyleFlag(style);
1755 m_pNotebook->Refresh();
1763 cbEditor* ed = GetBuiltinActiveEditor();
1780 wxString fname = GetBuiltinActiveEditor()->GetFilename();
1783 if (
Manager::Get()->GetProjectManager()->AddFileToProject(fname, project, targets) != 0)
1786 GetBuiltinActiveEditor()->SetProjectFile(pf);
1793 ProjectFile* pf = GetBuiltinActiveEditor()->GetProjectFile();
1804 ProjectFile* pf = GetBuiltinActiveEditor()->GetProjectFile();
1825 CheckForExternallyModifiedFiles();
1831 m_pNotebook->Hide();
1837 m_pNotebook->Show();
1844 if (!
Manager::Get()->IsAppShuttingDown() && m_pData->m_SetFocusFlag)
1846 cbEditor* ed = GetBuiltinActiveEditor();
1849 m_pData->m_SetFocusFlag =
false;
1861 || !
Manager::Get()->GetConfigManager(
wxT(
"editor"))->ReadBool(
wxT(
"/track_preprocessor"),
true)
1862 || !
Manager::Get()->GetConfigManager(
wxT(
"editor"))->ReadBool(
wxT(
"/collect_prj_defines"),
true) )
1889 for (
size_t i = 0; i < compilerFlags.
GetCount(); ++i)
1891 if ( compilerFlags[i].StartsWith(
wxT(
"-D"))
1892 || compilerFlags[i].StartsWith(
wxT(
"/D")) )
1894 defines.
Add(compilerFlags[i].Mid(2));
1903 else if ( compilerFlags[i] ==
wxT(
"-ansi")
1904 || compilerFlags[i] ==
wxT(
"-std=c90")
1905 || compilerFlags[i] ==
wxT(
"-std=c++98"))
1907 defines.Add(
wxT(
"__STRICT_ANSI__"));
1911 defines.Add(
wxT(
"__cplusplus"));
1912 for (FilesList::iterator it = lst->begin(); it != lst->end(); ++it)
1914 if ((*it)->relativeFilename.EndsWith(
wxT(
".c")))
1916 defines.RemoveAt(defines.GetCount() - 1);
1923 defines.Add(
wxT(
"__GNUC__"));
1924 defines.Add(
wxT(
"__GNUG__"));
1928 defines.Add(
wxT(
"_MSC_VER"));
1929 defines.Add(
wxT(
"__VISUALC__"));
1932 if (
Manager::Get()->GetConfigManager(
wxT(
"editor"))->ReadBool(
wxT(
"/platform_defines"),
false))
1934 if (platform::windows)
1936 defines.Add(
wxT(
"_WIN32"));
1937 defines.Add(
wxT(
"__WIN32"));
1938 defines.Add(
wxT(
"__WIN32__"));
1939 defines.Add(
wxT(
"WIN32"));
1940 defines.Add(
wxT(
"__WINNT"));
1941 defines.Add(
wxT(
"__WINNT__"));
1942 defines.Add(
wxT(
"WINNT"));
1943 defines.Add(
wxT(
"__WXMSW__"));
1944 defines.Add(
wxT(
"__WINDOWS__"));
1945 if (platform::bits == 64)
1947 defines.Add(
wxT(
"_WIN64"));
1948 defines.Add(
wxT(
"__WIN64__"));
1951 else if (platform::macosx)
1953 defines.Add(
wxT(
"__WXMAC__"));
1954 defines.Add(
wxT(
"__WXOSX__"));
1955 defines.Add(
wxT(
"__WXCOCOA__"));
1956 defines.Add(
wxT(
"__WXOSX_MAC__"));
1957 defines.Add(
wxT(
"__APPLE__"));
1959 else if (platform::Linux)
1961 defines.Add(
wxT(
"LINUX"));
1962 defines.Add(
wxT(
"linux"));
1963 defines.Add(
wxT(
"__linux"));
1964 defines.Add(
wxT(
"__linux__"));
1966 else if (platform::freebsd)
1968 defines.Add(
wxT(
"FREEBSD"));
1969 defines.Add(
wxT(
"__FREEBSD__"));
1971 else if (platform::netbsd)
1973 defines.Add(
wxT(
"NETBSD"));
1974 defines.Add(
wxT(
"__NETBSD__"));
1976 else if (platform::openbsd)
1978 defines.Add(
wxT(
"OPENBSD"));
1979 defines.Add(
wxT(
"__OPENBSD__"));
1981 else if (platform::darwin)
1983 defines.Add(
wxT(
"DARWIN"));
1984 defines.Add(
wxT(
"__APPLE__"));
1986 else if (platform::solaris)
1988 defines.Add(
wxT(
"sun"));
1989 defines.Add(
wxT(
"__sun"));
1990 defines.Add(
wxT(
"__SUN__"));
1991 defines.Add(
wxT(
"__SUNOS__"));
1992 defines.Add(
wxT(
"__SOLARIS__"));
1996 defines.Add(
wxT(
"unix"));
1997 defines.Add(
wxT(
"__unix"));
1998 defines.Add(
wxT(
"__unix__"));
1999 defines.Add(
wxT(
"__UNIX__"));
2002 defines.Add(
wxT(
"__WXGTK__"));
2003 if (platform::bits == 32)
2005 defines.Add(
wxT(
"i386"));
2006 defines.Add(
wxT(
"__i386"));
2007 defines.Add(
wxT(
"__i386__"));
2008 defines.Add(
wxT(
"__i386__"));
2009 defines.Add(
wxT(
"_X86_"));
2010 defines.Add(
wxT(
"__INTEL__"));
2012 else if (platform::bits == 64)
2014 defines.Add(
wxT(
"__amd64"));
2015 defines.Add(
wxT(
"__amd64__"));
2016 defines.Add(
wxT(
"__x86_64"));
2017 defines.Add(
wxT(
"__x86_64__"));
2018 defines.Add(
wxT(
"__IA64__"));
2024 if (m_Theme->GetKeywords(hlCpp, 4) == keywords)
2027 m_Theme->SetKeywords(hlCpp, 4, keywords);
2028 const wxString key =
wxT(
"/colour_sets/") + m_Theme->GetName() +
wxT(
"/cc/");
2033 for (
int index = 0; index < GetEditorsCount(); ++index)
2035 cbEditor* ed = GetBuiltinEditor(index);
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
#define EVT_APP_STARTUP_DONE(fn)
bool CloseAll(bool dontsave=false)
Closes all opened editors.
wxString F(const wxChar *msg,...)
sprintf-like function
EditorBase * InternalGetEditorBase(int page)
bool CloseAllInTabCtrlExcept(EditorBase *editor, bool dontsave=false)
Closes all editors in the same tab control as the active editor, except the editor passed as paramete...
DLLIMPORT wxArrayString GetArrayFromString(const wxString &text, const wxString &separator=DEFAULT_ARRAY_SEP, bool trimSpaces=true)
int editorTabPos
The position of the editor-tab for this file.
virtual const wxString & GetShortName() const
Returns the editor's short name.
static const int idNBSwitchFileMax
static const int idNBRemoveFileFromProject
PluginManager * GetPluginManager() const
cbEditor * New(const wxString &newFileName=wxEmptyString)
bool CloseAllInTabCtrl(bool dontsave=false)
Closes all editors in the same tab control as the active editor.
void RemoveEditorBase(EditorBase *eb, bool deleteObject=true)
wxDateTime GetLastModificationTime() const
Returns the last modification time for the file.
void OnProperties(wxCommandEvent &event)
ConfigManager * GetConfigManager(const wxString &name_space) const
virtual const wxString & GetTitle()
The editor's title.
int ReadInt(const wxString &name, int defaultVal=0)
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 FixFoldState()
Fix fold states by comparing foldBackup with m_pControl.
wxString substr(size_t nStart=0, size_t nLen=npos) const
virtual bool QueryClose()
Can this be closed (destroyed)?
bool IsOK() const
Returns true if editor is OK, i.e.
DLLIMPORT const wxString cbDEFAULT_OPEN_FOLDER_CMD
static const int idNBProperties
const DLLIMPORT wxString H_EXT
bool ShowOptions(wxWindow *parent)
Show the file properties dialog.
static bool IsAppShuttingDown()
void SetColourSet(EditorColourSet *theme)
cbNotebookStack * GetNotebookStack()
void CollectDefines(CodeBlocksEvent &event)
void RegisterColour(const wxString &category, const wxString &name, const wxString &id, const wxColour &defaultColour)
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
bool Reload(bool detectEncoding=true)
Reloads the file from disk.
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
bool wxFileExists(const wxString &filename)
wxFileName file
The full filename of this file.
void RemoveFileFromProject(ProjectFile *pfile, cbProject *project)
Remove a file from a project.
virtual bool IsReadOnly() const
Is the editor read-only?
void SetColourSet(EditorColourSet *theme)
Set the colour set to use.
virtual void ShowFileInTree(ProjectFile &projectFile)=0
void OnAppStartShutdown(wxCommandEvent &event)
void RebuildNotebookStack()
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_SELECTED
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
cbEditor * InternalGetBuiltinEditor(int page)
DLLIMPORT bool NormalizePath(wxFileName &f, const wxString &base)
static const int idNBTabTop
void Print(bool selectionOnly, PrintColourMode pcm, bool line_numbers)
Print the file.
static const int idNBTabSplitHorz
bool GetCheckForExternallyModifiedFiles() const
Get check for externally modified files.
bool CloseAllInTabCtrlToTheLeft(EditorBase *editor, bool dontsave=false)
Closes all editors in the same tab control which are on the left of the passed editor.
EVTIMPORT const wxEventType cbEVT_PROJECT_ACTIVATE
FileManager * GetFileManager() const
void OnAppDoneStartup(wxCommandEvent &event)
void OnCloseAllOthers(wxCommandEvent &event)
~EditorManager() override
bool CloseAllExcept(EditorBase *editor, bool dontsave=false)
Closes all opened editors, except the editor passed as parameter.
virtual const wxArrayString & GetCompilerOptions() const
bool wxDirExists(const wxString &dirname)
static Compiler * GetCompiler(size_t index)
void SetText(const wxString &text)
Replace the contents of the document with the argument text.
virtual void SwitchToProjectsPage()=0
Switches the management's notebook to the Projects tab.
void wxRegisterId(int id)
void SetActiveEditor(EditorBase *ed)
FileType
Known file types.
OpenContainingFolderData()
void OnPageChanged(wxAuiNotebookEvent &event)
bool Close(const wxString &filename, bool dontsave=false)
void Unsplit()
Unsplit the editor window.
cbProjectManagerUI & GetUI()
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
bool IsLoading()
Check if the project manager is loading a project/workspace.
bool IsAbsolute(wxPathFormat format=wxPATH_NATIVE) const
DLLIMPORT FileType FileTypeOf(const wxString &filename)
void OnAddFileToProject(wxCommandEvent &event)
void OnOpenContainingFolder(wxCommandEvent &event)
void SetModified(bool modified=true) override
Set the editor's modification state to modified.
void OnShowFileInTree(wxCommandEvent &event)
static size_t GetAllFiles(const wxString &dirname, wxArrayString *files, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT)
void OnPageChanging(wxAuiNotebookEvent &event)
bool OpenContainingFolder()
static const int idNBTabCloseAll
int idEditorManagerCheckFiles
bool CloseEditors(const std::vector< EditorBase *> &editors, bool dontsave=false)
Closes all editors passed to the function.
Represents a file in a Code::Blocks project.
size_t find(const wxString &str, size_t nStart=0) const
A generic Code::Blocks event.
void RecreateOpenEditorStyles()
void OnRemoveFileFromProject(wxCommandEvent &event)
int CmpNoCase(const wxString &s) const
wxWindow * GetAppWindow() const
virtual void SetModified(bool=true)
Set the modification status.
void OnUpdateUI(wxUpdateUIEvent &event)
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
virtual bool Close()
Close this editor.
virtual const wxString & GetFilename() const
Get the editor's filename (if applicable).
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
Represents a Code::Blocks project.
const wxString & GetActiveBuildTarget() const
void OnSave(wxCommandEvent &event)
EVTIMPORT const wxEventType cbEVT_WORKSPACE_LOADING_COMPLETE
bool wxSetWorkingDirectory(const wxString &dir)
EditorBase * GetActiveEditor()
static const int idNBShowFileInTree
void SetReadOnly(bool readonly=true) override
Set the editor read-only.
OpenContainingFolderData(const wxString &command, bool select)
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
DLLIMPORT const wxString DEFAULT_CONSOLE_SHELL
int FindPageFromEditor(EditorBase *eb)
bool CloseActive(bool dontsave=false)
EVTIMPORT const wxEventType cbEVT_EDITOR_SWITCHED
void AddCustomEditor(EditorBase *eb)
wxString wxPathOnly(const wxString &path)
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
virtual bool SaveAs()
Save editor contents under a different filename.
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
void HideNotebook()
Hides the editor notebook for layout purposes.
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
void Print(PrintScope ps, PrintColourMode pcm, bool line_numbers)
Base class that all "editors" should inherit from.
LogManager * GetLogManager() const
static wxColour GetColour(wxSystemColour index)
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
static const int idNBTabCloseToTheLeft
struct EditorManagerInternalData * This is the private data holder for the EditorManager * All data ...
void OnTabPosition(wxCommandEvent &event)
bool wxIsupper(const wxUniChar &c)
const wxString g_EditorModified
const wxStringCharType * wx_str() const
bool Save(const wxString &filename)
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
static const int idNBTabCloseToTheRight
static const int idNBAddFileToProject
EVTIMPORT const wxEventType cbEVT_EDITOR_DEACTIVATED
static const int idNBSwitchFile1
bool QueryClose(EditorBase *editor)
DLLIMPORT wxArrayString MakeUniqueArray(const wxArrayString &array, bool caseSens)
void NotifyPlugins(CodeBlocksEvent &event)
MacrosManager * GetMacrosManager() const
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
void RemoveCustomEditor(EditorBase *eb)
static bool Access(const wxString &name, wxFile::OpenMode mode)
const wxString & _(const wxString &string)
DLLIMPORT void QuoteStringIfNeeded(wxString &str)
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
EditorBase * GetEditor(int index)
cbEditor * GetBuiltinEditor(EditorBase *eb)
int GetBuildTargetsCount()
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
virtual const wxArrayString & GetIncludeDirs() const
cb_must_consume_result LoaderBase * Load(const wxString &file, bool reuseEditors=false)
Loads a file, once this function is called, the actually loading process is done in the worker thread...
ProjectFilesVector generatedFiles
Auto-generated files when compiling this file.
virtual bool GetModified() const
Is it modified?
wxArray< int > wxArrayInt
void OnGenericContextMenuHandler(wxCommandEvent &event)
static wxString GetDataFolder(bool global=true)
void CheckForExternallyModifiedFiles()
Check if one of the open files has been modified outside the IDE.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Abstract base class for compilers.
ColourManager * GetColourManager() const
void MarkReadOnly(int page, bool readOnly=true)
void SetKeyWords(int keyWordSet, const wxString &keyWords)
Set up the key words used by the lexer.
bool SaveFoldState()
Save fold states within a new cbStyledTextCtrl.
SplitType GetSplitType() const
Returns the state of split-view for this editor.
void Touch()
Sets the last modification time for the file to 'now'.
void SetProjectFile(ProjectFile *project_file, bool preserve_modified=false)
Set the ProjectFile pointer associated with this editor.
bool CloseAllInTabCtrlToTheRight(EditorBase *editor, bool dontsave=false)
Closes all editors in the same tab control which are on the right of the passed editor.
bool GetReadOnly() const
In read-only mode?
EVTIMPORT const wxEventType cbEVT_EDITOR_ACTIVATED
static const int idNBTabSplitVert
FileVisualState GetFileState() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
The entry point singleton for working with projects.
void ShowNotebook()
Shows the previously hidden editor notebook.
virtual const wxString & GetCompilerID() const
Read the target's compiler.
DLLIMPORT void AppendArray(const wxArrayString &from, wxArrayString &to)
static const int idNBTabClose
wxString GetFullName() const
A notebook class This class is derived from wxAuiNotebook, to enhance its abilities.
void OnPageClose(wxAuiNotebookEvent &event)
void GetEditorsInTabCtrl(std::vector< EditorBase *> &editors, EditorBase *editor)
Returns a vector with pointers to the editors that are in the same tab control as the passed editor...
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
static const int idNBTabSave
void OnCloseAll(wxCommandEvent &event)
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
EditorManagerInternalData(EditorManager *owner)
size_t Add(const wxString &str, size_t copies=1)
cbProject * FindProjectForFile(const wxString &file, ProjectFile **resultFile, bool isRelative, bool isUnixFilename)
Return the project which has the file in it, also return the pointer to the ProjectFile object...
cbProject * GetParentProject()
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
Represents a Code::Blocks project build target.
static bool s_CanShutdown
bool Normalize(int flags=wxPATH_NORM_ALL, const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
const DLLIMPORT wxString CPP_EXT
static const int idNBTabBottom
wxArrayString wxStringTokenize(const wxString &str, const wxString &delims=wxDEFAULT_DELIMITERS, wxStringTokenizerMode mode=wxTOKEN_DEFAULT)
ProjectFile * AutoGeneratedBy() const
If this is an auto-generated file, which file is generating it?
ProjectFile * GetProjectFile() const
Read the ProjectFile pointer associated with this editor.
EVTIMPORT const wxEventType cbEVT_EDITOR_OPEN
void Split(SplitType split)
Split the editor window.
#define EVT_APP_START_SHUTDOWN(fn)
DLLIMPORT wxString ExpandBackticks(wxString &str)
static void SplitPath(const wxString &fullpath, wxString *volume, wxString *path, wxString *name, wxString *ext, bool *hasExt=NULL, wxPathFormat format=wxPATH_NATIVE)
bool MakeAbsolute(const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
bool UpdateProjectFiles(cbProject *project)
static const int EditorMaxSwitchTo
HighlightLanguage GetLanguage() const
void SetFileState(FileVisualState state)
Set the visual state (modified, read-only, etc).
int Printf(const wxString &pszFormat,...)
EditorBase * IsOpen(const wxString &filename)
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
void DeleteNotebookStack()
int AddFileToProject(const wxString &filename, cbProject *project=nullptr, int target=-1)
Add a file to a project.
virtual bool Save()
Save contents.
bool wxGetKeyState(wxKeyCode key)
int GetOldSelection() const
bool GetModified() const override
Returns true if editor is modified, false otherwise.
static const int idNBTabUnsplit
#define wxNO_FULL_REPAINT_ON_RESIZE
void AddEditorBase(EditorBase *eb)
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
void OnClose(wxCommandEvent &event)
void OnSaveAll(wxCommandEvent &event)
static const int idNBTabSaveAll
void UpdateProjectFile()
Updates the associated ProjectFile object with the editor's caret position, top visible line and its ...
void SetEditorStyle()
Applies the styles that match the filename of the editor.
long wxExecute(const wxString &command, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
DLLIMPORT wxString realpath(const wxString &path)
static const int idNBTabOpenContainingFolder
static const int idNBTabCloseAllOthers