35 #include <unordered_map> 57 static const unsigned int MAX_OPEN_WITH_ITEMS = 20;
58 static const int idOpenWith[] =
66 static const int idOpenWithInternal =
wxNewId();
68 const int ID_ProjectManager =
wxNewId();
69 const int idMenuSetActiveProject =
wxNewId();
70 const int idMenuOpenFile =
wxNewId();
71 const int idMenuSaveProject =
wxNewId();
72 const int idMenuSaveFile =
wxNewId();
73 const int idMenuCloseProject =
wxNewId();
74 const int idMenuCloseFile =
wxNewId();
75 const int idMenuAddFilePopup =
wxNewId();
76 const int idMenuAddFilesRecursivelyPopup =
wxNewId();
77 const int idMenuAddFile =
wxNewId();
78 const int idMenuAddFilesRecursively =
wxNewId();
79 const int idMenuRemoveFolderFilesPopup =
wxNewId();
80 const int idMenuOpenFolderFilesPopup =
wxNewId();
81 const int idMenuRemoveFilePopup =
wxNewId();
82 const int idMenuRemoveFile =
wxNewId();
83 const int idMenuRenameFile =
wxNewId();
84 const int idMenuRenameVFolder =
wxNewId();
85 const int idMenuProjectNotes =
wxNewId();
86 const int idMenuProjectProperties =
wxNewId();
87 const int idMenuFileProperties =
wxNewId();
88 const int idMenuTreeProjectProperties =
wxNewId();
89 const int idMenuTreeFileProperties =
wxNewId();
90 const int idMenuTreeOptionsCompile =
wxNewId();
91 const int idMenuTreeOptionsLink =
wxNewId();
92 const int idMenuTreeOptionsDisableBoth =
wxNewId();
93 const int idMenuTreeOptionsEnableBoth =
wxNewId();
94 const int idMenuGotoFile =
wxNewId();
95 const int idMenuExecParams =
wxNewId();
96 const int idMenuViewCategorize =
wxNewId();
97 const int idMenuViewUseFolders =
wxNewId();
98 const int idMenuViewHideFolderName =
wxNewId();
99 const int idMenuViewFileMasks =
wxNewId();
100 const int idMenuNextProject =
wxNewId();
101 const int idMenuPriorProject =
wxNewId();
102 const int idMenuProjectTreeProps =
wxNewId();
103 const int idMenuProjectUp =
wxNewId();
104 const int idMenuProjectDown =
wxNewId();
105 const int idMenuViewCategorizePopup =
wxNewId();
106 const int idMenuViewUseFoldersPopup =
wxNewId();
107 const int idMenuViewHideFolderNamePopup =
wxNewId();
108 const int idMenuTreeRenameWorkspace =
wxNewId();
109 const int idMenuTreeSaveWorkspace =
wxNewId();
110 const int idMenuTreeSaveAsWorkspace =
wxNewId();
111 const int idMenuTreeCloseWorkspace =
wxNewId();
112 const int idMenuAddVirtualFolder =
wxNewId();
113 const int idMenuDeleteVirtualFolder =
wxNewId();
114 const int idMenuFindFile =
wxNewId();
116 const int idNB_TabTop =
wxNewId();
117 const int idNB_TabBottom =
wxNewId();
129 bool ProjectShowOptions(
cbProject* project);
211 m_TreeFreezeCounter(0),
212 m_isCheckingForExternallyModifiedProjects(false)
216 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/project_tabs_bottom"),
false))
217 m_pNotebook->SetWindowStyleFlag(m_pNotebook->GetWindowStyleFlag() | wxAUI_NB_BOTTOM);
230 cfg->
Write(
_T(
"/hide_folder_name"),
false);
236 wxT(
"project_tree_non_source_files"),
272 _T(
"file-missing.png"),
273 _T(
"file-modified.png"),
274 _T(
"file-readonly.png"),
277 _T(
"rc-file-added.png"),
278 _T(
"rc-file-conflict.png"),
279 _T(
"rc-file-missing.png"),
280 _T(
"rc-file-modified.png"),
281 _T(
"rc-file-outofdate.png"),
282 _T(
"rc-file-uptodate.png"),
283 _T(
"rc-file-requireslock.png"),
284 _T(
"rc-file-external.png"),
285 _T(
"rc-file-gotlock.png"),
286 _T(
"rc-file-lockstolen.png"),
287 _T(
"rc-file-mismatch.png"),
288 _T(
"rc-file-noncontrolled.png"),
292 _T(
"workspace-readonly.png"),
294 _T(
"project-readonly.png"),
295 _T(
"folder_open.png"),
296 _T(
"vfolder_open.png"),
305 while (!imgs[i].IsEmpty())
322 int count = pa->GetCount();
323 for (
int i = 0; i < count; ++i)
330 bool read_only =
false;
336 read_only = ( !ws_file.
IsEmpty()
341 title =
_(
"Workspace");
343 for (
int i = 0; i < count; ++i)
353 for (
int i = 0; i < count; ++i)
356 prj->RestoreTreeState(
m_pTree);
413 wxArrayTreeItemIds selections;
418 return selections[0];
494 int pos = menuBar->
FindMenu(
_(
"Sea&rch"));
497 menu->
Append(idMenuGotoFile,
_(
"Goto file...\tAlt-G"));
513 menu->
Append(idMenuAddFile,
_(
"Add files..."),
_(
"Add files to the project"));
514 menu->
Append(idMenuAddFilesRecursively,
_(
"Add files recursively..."),
_(
"Add files recursively to the project"));
515 menu->
Append(idMenuRemoveFile,
_(
"Remove files..."),
_(
"Remove files from the project"));
520 menu->
Append(idMenuExecParams,
_(
"Set &programs' arguments..."),
_(
"Set execution parameters for the targets of this project"));
521 menu->
Append(idMenuProjectNotes,
_(
"Notes..."));
522 menu->
Append(idMenuProjectProperties,
_(
"Properties..."));
530 treeprops->
Append(idMenuProjectUp,
_(
"Move project up\tCtrl-Shift-Up"),
531 _(
"Move project up in project tree"));
532 treeprops->
Append(idMenuProjectDown,
_(
"Move project down\tCtrl-Shift-Down"),
533 _(
"Move project down in project tree"));
537 treeprops->
Append(idMenuPriorProject,
_(
"Activate prior project\tAlt-F5"),
538 _(
"Activate prior project in open projects list"));
539 treeprops->
Append(idMenuNextProject,
_(
"Activate next project\tAlt-F6"),
540 _(
"Activate next project in open projects list"));
544 treeprops->
AppendCheckItem((popup ? idMenuViewCategorizePopup : idMenuViewCategorize),
545 _(
"Categorize by file types"));
546 treeprops->
AppendCheckItem((popup ? idMenuViewUseFoldersPopup : idMenuViewUseFolders),
547 _(
"Display folders as on disk"));
548 treeprops->
AppendCheckItem((popup ? idMenuViewHideFolderNamePopup : idMenuViewHideFolderName),
549 _(
"Hide folder name"));
552 bool do_categorise = cfg->
ReadBool(
_T(
"/categorize_tree"),
true);
553 bool do_use_folders = cfg->
ReadBool(
_T(
"/use_folders"),
true);
554 bool do_hide_folder_name = !do_use_folders && cfg->
ReadBool(
_T(
"/hide_folder_name"),
false);
555 cfg->
Write(
_T(
"/hide_folder_name"), do_hide_folder_name);
557 treeprops->
Check((popup ? idMenuViewCategorizePopup : idMenuViewCategorize), do_categorise);
558 treeprops->
Check((popup ? idMenuViewUseFoldersPopup : idMenuViewUseFolders), do_use_folders);
559 treeprops->
Check((popup ? idMenuViewHideFolderNamePopup : idMenuViewHideFolderName), do_hide_folder_name);
561 treeprops->
Enable((popup ? idMenuViewUseFoldersPopup : idMenuViewUseFolders), !do_hide_folder_name);
562 treeprops->
Enable((popup ? idMenuViewHideFolderNamePopup : idMenuViewHideFolderName), !do_use_folders);
564 treeprops->
Append(idMenuViewFileMasks,
_(
"Edit file types && categories..."));
566 menu->
Append(idMenuProjectTreeProps,
_(
"Project tree"), treeprops);
582 bool PopUpMenuOption =
true;
601 menu.
Append(idMenuSetActiveProject,
_(
"Activate project"));
602 menu.
Enable(idMenuSetActiveProject, PopUpMenuOption);
604 menu.
Append(idMenuSaveProject,
_(
"Save project"));
605 menu.
Enable(idMenuSaveProject, PopUpMenuOption);
606 menu.
Append(idMenuCloseProject,
_(
"Close project"));
607 menu.
Enable(idMenuCloseProject, PopUpMenuOption);
609 menu.
Append(idMenuAddFilePopup,
_(
"Add files..."));
610 menu.
Enable(idMenuAddFilePopup, PopUpMenuOption);
611 menu.
Append(idMenuAddFilesRecursivelyPopup,
_(
"Add files recursively..."));
612 menu.
Enable(idMenuAddFilesRecursivelyPopup, PopUpMenuOption);
613 menu.
Append(idMenuRemoveFile,
_(
"Remove files..."));
615 menu.
Append(idMenuFindFile,
_(
"Find file..."));
618 menu.
Append(idMenuAddVirtualFolder,
_(
"Add new virtual folder..."));
620 menu.
Append(idMenuDeleteVirtualFolder,
_(
"Delete this virtual folder..."));
639 menu.
Append(idMenuOpenFile, caption);
642 menu.
Append(idMenuSaveFile, caption);
644 menu.
Append(idMenuCloseFile, caption);
649 menu.
Append(idMenuOpenFile, caption);
655 for (
unsigned int i = 0; i < mimes.GetCount() && i < MAX_OPEN_WITH_ITEMS; ++i)
665 openWith->
Append(idOpenWithInternal,
_(
"Internal editor"));
671 menu.
Append(idMenuRenameFile,
_(
"Rename file..."));
672 menu.
Enable(idMenuRenameFile, PopUpMenuOption);
675 menu.
Append(idMenuRemoveFilePopup,
_(
"Remove file from project"));
676 menu.
Enable(idMenuRemoveFilePopup, PopUpMenuOption);
682 menu.
Append(idMenuAddFilePopup,
_(
"Add files..."));
683 menu.
Enable(idMenuAddFilePopup, PopUpMenuOption);
684 menu.
Append(idMenuAddFilesRecursivelyPopup,
_(
"Add files recursively..."));
685 menu.
Enable(idMenuAddFilesRecursivelyPopup, PopUpMenuOption);
687 menu.
Append(idMenuRemoveFile,
_(
"Remove files..."));
689 menu.
Append(idMenuFindFile,
_(
"Find file..."));
694 menu.
Enable(idMenuRemoveFolderFilesPopup, PopUpMenuOption);
701 menu.
Append(idMenuAddVirtualFolder,
_(
"Add new virtual folder..."));
702 menu.
Append(idMenuDeleteVirtualFolder,
_(
"Delete this virtual folder"));
703 menu.
Append(idMenuRenameVFolder,
_(
"Rename this virtual folder"));
705 menu.
Append(idMenuRemoveFile,
_(
"Remove files..."));
709 menu.
Append(idMenuFindFile,
_(
"Find file..."));
715 menu.
Append(idMenuFindFile,
_(
"Find file..."));
724 menu.
Append(idMenuTreeProjectProperties,
_(
"Properties..."));
725 menu.
Enable(idMenuTreeProjectProperties, PopUpMenuOption);
734 optionsItem->
Enable(PopUpMenuOption);
739 options->
Append(idMenuTreeOptionsEnableBoth,
_(
"Enable both"));
740 options->
Append(idMenuTreeOptionsDisableBoth,
_(
"Disable both"));
744 menu.
Check(idMenuTreeOptionsCompile, pf->compile);
745 menu.
Check(idMenuTreeOptionsLink, pf->link);
747 menu.
Append(idMenuTreeFileProperties,
_(
"Properties..."));
748 menu.
Enable(idMenuTreeFileProperties, PopUpMenuOption);
769 msg.
Printf(
_(
"Could not open the file '%s'.\nThe file does not exist."), filename.
c_str());
782 ed->SetProjectFile(pf);
788 msg.
Printf(
_(
"Failed to open '%s'."), filename.
c_str());
809 msg.
Printf(
_(
"Could not open file '%s'.\nNo handler registered for this type of file."), filename.
c_str());
812 else if (plugin->
OpenFile(filename) != 0)
816 msg.
Printf(
_(
"Could not open file '%s'.\nThe registered handler (%s) could not open it."), filename.
c_str(), info ? info->
title.
c_str() :
wxString(
_(
"<Unknown plugin>")).
c_str());
837 wxTreeItemIdValue cookie;
841 while (i < m_pTree->GetChildrenCount(sel_id))
872 wxTreeItemIdValue cookie;
876 while (i < m_pTree->GetChildrenCount(sel_id))
912 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/project_tabs_bottom"),
false))
913 NBmenu->
Append(idNB_TabTop,
_(
"Tabs at top"));
915 NBmenu->
Append(idNB_TabBottom,
_(
"Tabs at bottom"));
923 style &= ~wxAUI_NB_BOTTOM;
925 if (event.GetId() == idNB_TabBottom)
926 style |= wxAUI_NB_BOTTOM;
939 for (
size_t i = 0; i < count; i++)
958 if ( ! ProjectCanDragNode(prj,
m_pTree,
id))
977 bool isExternalDrag =
false;
978 for (
int ii=0; ii<8; ++ii)
983 wxString winName = pWin ? pWin->GetName().Lower():
_T(
"unkwn");
984 if ( (not pWin) or (
_T(
"treectrl") != winName) )
986 isExternalDrag =
true;
992 if ( (! fileList.
IsEmpty()) and isExternalDrag )
997 dragSource.
SetData(dropObject);
1030 for (
size_t i = 0; i < count; i++)
1045 if (prjFrom != prjTo)
1084 if (
Manager::Get()->GetProjectManager()->GetActiveProject())
1094 bool notCompilingProject =
true;
1097 notCompilingProject =
false;
1102 menu.
Append(idMenuTreeRenameWorkspace,
_(
"Rename workspace..."));
1103 menu.
Enable(idMenuTreeRenameWorkspace, notCompilingProject);
1105 menu.
Append(idMenuTreeSaveWorkspace,
_(
"Save workspace"));
1106 menu.
Enable(idMenuTreeSaveWorkspace, notCompilingProject);
1107 menu.
Append(idMenuTreeSaveAsWorkspace,
_(
"Save workspace as..."));
1108 menu.
Enable(idMenuTreeSaveAsWorkspace, notCompilingProject);
1110 menu.
Append(idMenuFindFile,
_(
"Find file..."));
1120 menu.
AppendCheckItem(idMenuViewCategorizePopup,
_(
"Categorize by file types"));
1121 menu.
AppendCheckItem(idMenuViewUseFoldersPopup,
_(
"Display folders as on disk"));
1122 menu.
AppendCheckItem(idMenuViewHideFolderNamePopup,
_(
"Hide folder name"));
1128 menu.
Check(idMenuViewCategorizePopup, do_categorise);
1129 menu.
Check(idMenuViewUseFoldersPopup, do_use_folders);
1130 menu.
Check(idMenuViewHideFolderNamePopup, do_hide_folder_name);
1132 menu.
Enable(idMenuViewUseFoldersPopup, !do_hide_folder_name);
1133 menu.
Enable(idMenuViewHideFolderNamePopup, !do_use_folders);
1136 menu.
Append(idMenuViewFileMasks,
_(
"Edit file types && categories..."));
1137 menu.
Enable(idMenuViewFileMasks, notCompilingProject);
1143 menu.
Append(idMenuTreeCloseWorkspace,
_(
"Close workspace"));
1144 menu.
Enable(idMenuTreeCloseWorkspace, notCompilingProject);
1148 pt =
m_pTree->ScreenToClient(pt);
1149 m_pTree->PopupMenu(&menu, pt);
1154 if (
Manager::Get()->GetProjectManager()->IsLoadingProject())
1176 _(
"Rename workspace"),
1212 if (event.GetId() == idMenuSetActiveProject)
1224 else if (event.GetId() == idMenuPriorProject)
1231 index = pa->GetCount() - 1;
1234 else if (event.GetId() == idMenuNextProject)
1240 if (index == (
int)pa->GetCount())
1244 else if (event.GetId() == idMenuProjectUp)
1252 else if (event.GetId() == idMenuProjectDown)
1269 if (event.GetId() == idMenuAddFilesRecursively)
1283 if ( (prj = ftd->GetProject()) )
1285 basePath = ftd->GetFolder();
1295 _(
"Add files recursively..."),
1321 array[i].Contains(
_T(
"/.git/")) ||
1322 array[i].Contains(
_T(
"\\.git\\")) ||
1323 array[i].Contains(
_T(
"\\.hg\\")) ||
1324 array[i].Contains(
_T(
"/.hg/")) ||
1325 array[i].Contains(
_T(
"\\.svn\\")) ||
1326 array[i].Contains(
_T(
"/.svn/")) ||
1327 array[i].Contains(
_T(
"\\CVS\\")) ||
1328 array[i].Contains(
_T(
"/CVS/")) ||
1329 array[i].Lower().Matches(
_T(
"*.cbp")))
1339 for (
unsigned fm_idx = 0; fm_idx < fgam->
GetGroupsCount(); fm_idx++)
1342 MultiSelectDlg dlg(
nullptr, array, wild,
_(
"Select the files to add to the project:"));
1359 if (event.GetId() == idMenuAddFile)
1373 if ( (prj = ftd->GetProject()) )
1375 basePath = ftd->GetFolder();
1385 _(
"Add files to project..."),
1422 wxTreeItemIdValue cookie;
1426 FindFiles(resultFiles, tree, i);
1459 if (event.GetId() == idMenuRemoveFile)
1463 FindFiles(files, *
m_pTree, sel);
1465 if (files.Count()==0)
1467 cbMessageBox(
_(
"This project does not contain any files to remove."),
1479 if (indices.GetCount() == 0)
1481 if (
cbMessageBox(
_(
"Are you sure you want to remove these files from the project?"),
1490 for (
int i = (
int)indices.GetCount() - 1; i >= 0; --i)
1502 else if (event.GetId() == idMenuRemoveFilePopup)
1516 else if (event.GetId() == idMenuRemoveFolderFilesPopup)
1519 if (
cbMessageBox(
_(
"Are you sure you want to recursively remove from the project all the files under this folder?"),
1535 else if (is_virtual)
1536 ProjectVirtualFolderDeleted(prj,
m_pTree, sel);
1551 if (
cbProject* prj = ftd->GetProject() )
1571 wxArrayTreeItemIds selections;
1575 std::set<cbProject*> projectsToClose;
1577 for (
size_t ii = 0; ii < selections.GetCount(); ++ii)
1589 projectsToClose.insert(prj);
1593 for (std::set<cbProject*>::iterator it = projectsToClose.begin(); it != projectsToClose.end(); ++it)
1641 if (
cbMessageBox(
_(
"Are you sure you want to recursively open from the project all the files under this folder?"),
1669 wxString filename = pf->file.GetFullPath();
1670 if (event.GetId() == idOpenWithInternal)
1674 ed->SetProjectFile(pf);
1683 if (plugin && plugin->
OpenFile(filename) == 0)
1687 msg.
Printf(
_(
"Failed to open '%s'."), filename.
c_str());
1695 prj->ShowNotes(
false,
true);
1702 if (event.GetId() == idMenuProjectProperties)
1705 if (ProjectShowOptions(activePrj))
1713 else if (event.GetId() == idMenuTreeProjectProperties)
1723 if (ProjectShowOptions(prj) && prj == activePrj)
1732 if (backupTitle != newTitle)
1741 if (toolTip.
EndsWith(
_(
"Project: ") + backupTitle))
1743 toolTip.
Replace(
_(
"Project: ") + backupTitle,
_(
"Project: ") + newTitle);
1750 else if (event.GetId() == idMenuTreeFileProperties)
1789 template<
typename Func>
1792 wxArrayTreeItemIds selected;
1794 for (
size_t ii = 0; ii < count; ++ii)
1805 if (pf && func(*pf))
1815 std::set<cbProject*> modified;
1816 if (event.GetId() == idMenuTreeOptionsCompile)
1818 const bool checked =
event.IsChecked();
1822 pf.compile = checked;
1829 else if (event.GetId() == idMenuTreeOptionsLink)
1831 const bool checked =
event.IsChecked();
1833 if (pf.
link != checked)
1842 else if (event.GetId() == idMenuTreeOptionsEnableBoth ||
event.GetId() == idMenuTreeOptionsDisableBoth)
1844 const bool newValue = (
event.GetId() == idMenuTreeOptionsEnableBoth);
1851 for (std::set<cbProject*>::iterator it = modified.begin(); it != modified.end(); ++it)
1852 (*it)->SetModified(
true);
1853 if (!modified.empty())
1885 #if wxCHECK_VERSION(3, 0, 0) 1888 return std::hash<std::wstring>()(s.
wc_str());
1889 #endif // wxCHECK_VERSION 1906 std::unordered_map<wxString, ProjectFile*, cbStringHash> uniqueAbsPathFiles;
1907 for (
size_t prjIdx = 0; prjIdx < pa->GetCount(); ++prjIdx)
1915 uniqueAbsPathFiles.insert({projectFile->
file.
GetFullPath(), projectFile});
1919 typedef std::vector<ProjectFile*> VProjectFiles;
1920 VProjectFiles pfiles;
1921 if (!uniqueAbsPathFiles.empty())
1923 pfiles.reserve(uniqueAbsPathFiles.size());
1924 for (
const auto &pf : uniqueAbsPathFiles)
1925 pfiles.push_back(pf.second);
1931 Iterator(VProjectFiles &pfiles,
bool showProject) :
1933 m_ShowProject(showProject),
1938 int GetTotalCount()
const override 1940 return m_pfiles.size();
1942 const wxString& GetItemFilterString(
int index)
const override 1944 return m_pfiles[index]->relativeFilename;
1946 wxString GetDisplayText(
int index, cb_unused
int column)
const override 1949 return MakeDisplayName(*pf);
1951 int GetColumnWidth(cb_unused
int column)
const override 1953 return m_ColumnWidth;
1956 void CalcColumnWidth(
wxListCtrl &list)
override 1960 for (
const auto &pf : m_pfiles)
1964 pfLength += pf->GetParentProject()->GetTitle().length() + 3;
1965 if (pfLength > length)
1973 const wxString &longestString = MakeDisplayName(*pfLongest);
1975 list.GetTextExtent(longestString, &m_ColumnWidth, &yTemp);
1977 m_ColumnWidth += 50;
1980 m_ColumnWidth = 300;
1992 const VProjectFiles &m_pfiles;
1998 Iterator iterator(pfiles, (pa->GetCount() > 1));
1999 GotoFile dlg(
Manager::Get()->GetAppWindow(), &iterator,
_(
"Select file..."),
_(
"Please select file to open:"));
2004 if (selection >= 0 && selection <
int(pfiles.size()))
2005 DoOpenFile(pfiles[selection], pfiles[selection]->file.GetFullPath());
2011 bool do_categorise =
event.IsChecked();
2026 bool do_use_folders =
event.IsChecked();
2050 bool do_hide_folder_name =
event.IsChecked();
2052 if (do_hide_folder_name)
2062 if (do_hide_folder_name)
2087 wxTreeItemIdValue cookie;
2096 for (
size_t i = 0; i < children.
GetCount(); ++i)
2097 nodes.
Add(parent +
wxT(
"/") + children[i]);
2119 for (
size_t i = 0; i < pm->
GetProjects()->GetCount(); ++i)
2123 files.
Add(file.GetFullName());
2124 fileNameMap[file.GetFullName()] = prj->
GetTitle();
2130 Iterator(
const wxArrayString &files) : m_files(files), m_ColumnWidth(300)
2134 int GetTotalCount()
const override 2136 return m_files.size();
2138 const wxString& GetItemFilterString(
int index)
const override 2140 return m_files[index];
2142 wxString GetDisplayText(
int index, cb_unused
int column)
const override 2144 return m_files[m_indices[index]];
2147 int GetColumnWidth(cb_unused
int column)
const override 2149 return m_ColumnWidth;
2152 void CalcColumnWidth(
wxListCtrl &list)
override 2156 for (
size_t ii = 0; ii < m_files.size(); ++ii)
2158 size_t itemLength = m_files[ii].
length();
2159 if (itemLength > length)
2162 length = itemLength;
2165 if (index >= 0 && index <
int(m_files.size()))
2168 list.GetTextExtent(m_files[index], &m_ColumnWidth, &yTemp);
2170 m_ColumnWidth += 50;
2173 m_ColumnWidth = 300;
2180 Iterator iter(files);
2182 _(
"Please enter the name of the file you are searching:"));
2199 ConfigManagerContainer::StringToStringMap::iterator it = fileNameMap.find(file);
2200 if (it != fileNameMap.end())
2202 wxTreeItemIdValue cookie;
2261 ProjectVirtualFolderAdded(prj,
m_pTree, sel, fld);
2279 ProjectVirtualFolderDeleted(prj,
m_pTree, sel);
2303 _(
"Please enter the new name for the virtual folder:"),
2304 _(
"Rename Virtual Folder"),
2309 ProjectVirtualFolderRenamed(prj,
m_pTree, sel, dlg.GetValue());
2352 if (!ProjectVirtualFolderRenamed(prj,
m_pTree, event.
GetItem(),
event.GetLabel()))
2359 if (event.GetId() == idMenuFileProperties)
2362 bool enableProperties;
2368 enableProperties = (editor && editor != startHerePage);
2369 if (enableProperties)
2373 enableProperties =
false;
2375 event.Enable(enableProperties);
2377 else if (event.GetId() == idMenuProjectProperties ||
event.GetId() == idMenuAddFile
2378 ||
event.GetId() == idMenuAddFilesRecursively ||
event.GetId() == idMenuRemoveFile
2379 ||
event.GetId() == idMenuProjectTreeProps ||
event.GetId() == idMenuAddVirtualFolder
2380 ||
event.GetId() == idMenuDeleteVirtualFolder)
2383 if (!projectManager || (projectManager->
GetIsRunning() !=
nullptr))
2384 event.Enable(
false);
2389 event.Enable(
false);
2393 event.Enable(enable);
2422 cbMessageBox(
_(
"Can't rename file because it is auto-generated..."),
_(
"Error"));
2434 wxString new_name = fn.GetFullName();
2436 if (name != new_name)
2442 if (!
wxRenameFile(path + name, path + new_name,
false))
2451 pf->Rename(new_name);
2460 const wxKeyEvent& key_event =
event.GetKeyEvent();
2483 int idx = pa->Index(project);
2494 pa->RemoveAt(idx--);
2495 pa->Insert(project, idx);
2514 int idx = pa->Index(project);
2518 if (idx == (
int)pa->Count() - 1)
2525 pa->RemoveAt(idx++);
2526 pa->Insert(project, idx);
2541 if (!
Manager::Get()->GetEditorManager()->QueryCloseAll())
2544 for (
size_t i = 0; i < pa->GetCount(); ++i)
2569 msg.
Printf(
_(
"Project '%s' is modified...\nDo you want to save the changes?"), proj->
GetTitle().
c_str());
2593 if ( !(wkspc->
IsDefault() && blankWorkspace) )
2601 msg.
Printf(
_(
"Workspace '%s' is modified. Do you want to save it?"), wkspc->
GetTitle().
c_str());
2633 for (
int i = 0; i < count; ++i)
2652 for (
int i = 0; i < count; ++i)
2655 MultiSelectDlg dlg(
nullptr, array,
true,
_(
"Select the targets this file should belong to:"));
2681 bool reloadAll =
false;
2684 std::vector<cbProject*> ProjectPointers;
2685 for (
unsigned int idxProject = 0; idxProject < pa->Count(); ++idxProject)
2686 ProjectPointers.push_back(pa->Item(idxProject));
2688 for (
unsigned int idxProject = 0; idxProject < ProjectPointers.size(); ++idxProject)
2690 cbProject* prj = ProjectPointers[idxProject];
2692 wxDateTime last = fname.GetModificationTime();
2700 msg.
Printf(
_(
"Project %s is modified outside the IDE...\nDo you want to reload it (you will lose any unsaved work)?"),
2703 dlg.SetTitle(
_(
"Reload Project?"));
2708 wxWindow* win = wxWindow::GetCapture();
2710 win->ReleaseMouse();
2713 reloadAll = ret ==
crAll;
2715 if (reloadAll || ret ==
crYes)
2719 else if (ret ==
crNo)
2738 wxTreeItemIdValue cookie =
nullptr;
2742 ProjectTreeSortChildrenRecursive(tree, current);
2751 while (parent.
IsOk())
2768 if (tree && parent.
IsOk())
2770 wxTreeItemIdValue cookie =
nullptr;
2826 if ( platform::windows && (path.
Length() > 1) && (path.
GetChar(1) ==
_T(
':')) )
2839 int pos = path.
Find(
_T(
'/'));
2841 pos = path.
Find(
_T(
'\\'));
2842 if (useFolders && pos >= 0)
2851 wxTreeItemIdValue cookie =
nullptr;
2869 newparent = ProjectFindNodeToInsertAfter(tree, folder, parent,
true);
2876 ftd->
SetFolder(GetRelativeFolderPath(tree, parent) + folder + wxFILE_SEP_PATH);
2879 newparent = tree->
InsertItem(parent, newparent, folder, idx, idx, ftd);
2881 ret = ProjectAddTreeNode(project, tree, path, newparent,
true, folders_kind, compiles, image, data);
2885 ret = tree->
AppendItem(parent, text, image, image, data);
2919 if (!tree || !item.
IsOk() || !new_parent.
IsOk())
2935 wxTreeItemIdValue cookie;
2937 while (child.
IsOk())
2939 ProjectCopyTreeNodeRecursively(tree, child, target);
2945 tree->
Expand(new_parent);
2955 if (!ftdFrom || !ftdTo)
2963 wxString fromFolder = fromFolderPath;
2974 for (
size_t i = 0; i < oldArray.
GetCount(); ++i)
2981 int posFrom = item.
Find(fromFolderPath);
2985 item = item.
Left(posFrom);
2987 newFolders.
Add(item);
2989 else if (item.
IsSameAs(toFolderPath))
2992 newFolders.
Add(item);
2993 wxString fromFolderStr = fromFolderPath;
2996 newFolders.
Add(item + fromFolderStr + sep);
2999 newFolders.
Add(item);
3006 cbMessageBox(
_(
"Another Virtual folder with same name exists in the destination folder!"),
3011 newFolders.
Add(item);
3014 int pos = item.
Find(fromFolder);
3018 newFolders.
Add(toFolderPath + item);
3023 newFolders.
Add(item.
Left(pos));
3025 newFolders.
Add(toFolderPath + item.
Mid(pos));
3038 newFolders.
Add(fromFolder);
3040 for (
size_t i = 0; i < oldArray.
GetCount(); ++i)
3046 cbMessageBox(
_(
"Another Virtual folder with same name exists in the Project tree!"),
3052 int pos = item.
Find(fromFolderPath);
3055 item = item.
Mid(pos + fromFolderPath.
Length());
3058 item = item.
Prepend(fromFolder);
3060 newFolders.
Add(item);
3066 newFolders.
Add(item);
3069 newFolders.
Add(item);
3103 size_t count = fromArray.Count();
3104 for (
size_t i = 0; i < count; i++)
3126 if (parentFrom == parentTo)
3135 while (toParent != root)
3137 if (toParent == from)
3141 if (!ProjectVirtualFolderDragged(project, tree, from, to))
3147 for (
size_t i = 0; i < count; i++)
3151 ProjectCopyTreeNodeRecursively(tree, from, parentTo);
3165 for (
size_t i = 0; i < virtualFolders.
GetCount(); ++i)
3167 if (virtualFolders[i].StartsWith(folderName))
3169 cbMessageBox(
_(
"A virtual folder with the same name already exists."),
3180 wxString foldername = GetRelativeFolderPath(tree, parent_node);
3181 foldername << virtual_folder;
3184 if (foldername.
Last() != wxFILE_SEP_PATH)
3185 foldername << wxFILE_SEP_PATH;
3188 if (!ProjectHasVirtualFolder(foldername, virtualFolders))
3198 ProjectAddTreeNode(project, tree, foldername, project->
GetProjectNode(),
true,
3201 tree->
Expand(parent_node);
3224 wxString foldername = GetRelativeFolderPath(tree, node);
3228 if (!parent_foldername.
IsEmpty())
3242 cbMessageBox(
_(
"A virtual folder name cannot contain these special characters: \";\", \"\\\" or \"/\"."),
3264 wxString old_foldername = GetRelativeFolderPath(tree, node);
3265 wxString new_foldername = GetRelativeFolderPath(tree, tree->
GetItemParent(node)) + new_name + wxFILE_SEP_PATH;
3268 if (!ProjectHasVirtualFolder(new_foldername, virtualFolders))
3280 bool ProjectShowOptions(
cbProject* project)
3290 for (FilesList::iterator it = filesList.begin(); it != filesList.end(); ++it)
3293 pf->UpdateFileDetails();
3296 event.SetProject(project);
3309 #ifdef fileload_measuring 3349 for (
size_t i = 0; i < virtualFolders.
GetCount(); ++i)
3353 ProjectAddTreeNode(project, tree, virtualFolders[i], project->
GetProjectNode(),
true,
3360 for (FilesList::iterator it = fileList.begin(); it != fileList.end(); ++it)
3392 else if (do_categorise && pGroupNodes)
3399 parentNode = generated;
3411 parentNode = pGroupNodes[i];
3420 parentNode = others;
3433 pf->
SetTreeItemId(ProjectAddTreeNode(project, tree, nodetext, parentNode, useFolders, folders_kind,
3438 if (do_categorise && pGroupNodes)
3443 tree->
Delete(pGroupNodes[i]);
3450 delete[] pGroupNodes;
3452 ProjectTreeSortChildrenRecursive(tree, project->
GetProjectNode());
3454 #ifdef fileload_measuring wxTreeItemId GetProjectNode()
wxArrayString GetSelectedStrings() const
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
virtual wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
wxString AfterLast(wxUniChar ch) const
wxString F(const wxChar *msg,...)
sprintf-like function
static int WorkspaceIconIndex(bool read_only=false)
wxPoint wxGetMousePosition()
wxString relativeToCommonTopLevelPath
The relative filename to the common top-level path.
void FinishLoadingWorkspace(cbProject *activeProject, const wxString &workspaceTitle)
bool IsLoadingProject()
Check if the project manager is loading a project.
void OnViewFileMasks(wxCommandEvent &event)
void MoveProjectDown(cbProject *project, bool warpAround=false)
Move a project down in the project manager tree.
void RemoveFilesRecursively(wxTreeItemId &sel_id)
bool QueryCloseWorkspace()
Asks user to save the workspace, projects and files (Yes/No/cancel).
bool wxRenameFile(const wxString &file1, const wxString &file2, bool overwrite=true)
bool AddPage(wxWindow *page, const wxString &caption, bool select=false, const wxBitmap &bitmap=wxNullBitmap)
Add Page.
const wxTreeItemId & GetTreeItemId() const
Returns the wxTreeItemId for the file.
const wxString & GetFolder() const
bool Matches(const wxString &mask) const
virtual void SetItemBold(const wxTreeItemId &item, bool bold=true)
PluginManager * GetPluginManager() const
static int ProjectIconIndex(bool read_only=false)
bool QueryCloseAllProjects()
Checks whether all projects are saved.
void ShowFileInTree(ProjectFile &projectFile)
void OnSaveProject(wxCommandEvent &event)
void SetVirtualFolders(const wxArrayString &folders)
Set the virtual folders list.
wxString relativeFilename
The relative (to the project) filename of this file.
virtual wxTreeItemId GetItemParent(const wxTreeItemId &item) const
void OnOpenWith(wxCommandEvent &event)
void OnAddFilesToProjectRecursively(wxCommandEvent &event)
void ReloadProject(cbProject *project)
Reloads a project and tries to keep everything the same (project order, dependencies, active project)
ProjectFileRelativePathCmp(cbProject *pActiveProject)
ConfigManager * GetConfigManager(const wxString &name_space) const
void DebugLogError(const wxString &msg)
void SetCompareFunction(const int ptvs)
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...
cbProject * m_pActiveProject
void OnRenameVirtualFolder(wxCommandEvent &event)
void OnViewCategorize(wxCommandEvent &event)
void Touch()
Sets the last modification time for the project to 'now'.
void MoveProjectUp(cbProject *project, bool warpAround=false)
Move a project up in the project manager tree.
bool SaveWorkspaceAs(const wxString &filename)
Save the open workspace under a different filename.
void UnfreezeTree(bool force=false)
Le the tree control be updated again.
int Cmp(const wxString &s) const
void RemoveProject(cbProject *project)
void BeginRemoveFiles()
Notify that file(s) will be removed shortly.
virtual bool GetModified() const
Is this workspace modified?
Information about the plugin.
void OnIdle(wxIdleEvent &event)
static bool IsAppShuttingDown()
void RegisterColour(const wxString &category, const wxString &name, const wxString &id, const wxColour &defaultColour)
wxTreeItemId m_RightClickItem
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
FileTreeDataKind
The kind of tree node.
virtual void DeleteAllItems()
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
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)
wxWindow * pWindow
The window to dock.
wxFileName file
The full filename of this file.
void SetProjectNode(wxTreeItemId node)
Sets the root item of this item, should not be called by user's code!
void RemoveFileFromProject(ProjectFile *pfile, cbProject *project)
Remove a file from a project.
static int VirtualFolderIconIndex()
bool QueryCloseAllFiles()
Act like closing all project files, but don't do it.
virtual void SetTitle(const wxString &title)
Set the workspace's title.
bool m_isCheckingForExternallyModifiedProjects
virtual size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true) const
bool compile
Compile flag.
bool ReadBool(const wxString &name, bool defaultVal=false)
std::wstring ToStdWstring() const
DLLIMPORT wxString ChooseDirectory(wxWindow *parent, const wxString &message=_("Select directory"), const wxString &initialPath=_T(""), const wxString &basePath=_T(""), bool askToMakeRelative=false, bool showCreateDirButton=false)
virtual wxString GetFilename() const
Get the workspace file's name.
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.
virtual void SetFilterIndex(int filterIndex)
unsigned int GetGroupsCount() const
Return total number of groups.
virtual bool CanHandleFile(const wxString &filename) const =0
Can a file be handled by this plugin?
size_t GetPageCount() const
void SetData(wxDataObject &data)
virtual bool IsDefault() const
Is this workspace the Code::Blocks default?
virtual void EnsureVisible(const wxTreeItemId &item)
void OnSetActiveProject(wxCommandEvent &event)
Event used to request from the main app to add a window to the docking system.
bool wxDirExists(const wxString &dirname)
virtual void Activate()
Activate this editor.
DLLIMPORT int cbGetSingleChoiceIndex(const wxString &message, const wxString &caption, const wxArrayString &choices, wxWindow *parent=NULL, const wxSize &size=wxSize(300, 300), int initialSelection=0)
FileType
Known file types.
virtual void SetModified(bool modified)
Mark the workspace as modified or not.
void UpdateActiveProject(cbProject *oldProject, cbProject *newProject, bool refresh)
virtual size_t GetSelections(wxArrayTreeItemIds &selection) const
bool Close(const wxString &filename, bool dontsave=false)
virtual int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
void OnTreeEndDrag(wxTreeEvent &event)
cbProjectManagerUI & GetUI()
EVTIMPORT const wxEventType cbEVT_PROJECT_OPTIONS_CHANGED
The default style: All "off".
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
DLLIMPORT FileType FileTypeOf(const wxString &filename)
void ReplaceVirtualFolder(const wxString &oldFolder, const wxString &newFolder)
Replaced the oldFolder with newFolder or appends newFolder to the end of the list if oldFolder is not...
int AddMultipleFilesToProject(const wxArrayString &filelist, cbProject *project, int target=-1)
Add multiple files to a project.
void OnCloseFile(wxCommandEvent &event)
virtual wxTreeItemData * GetItemData(const wxTreeItemId &item) const
const FilesGroupsAndMasks * GetFilesGroupsAndMasks() const
ProjectFile * GetProjectFile() const
virtual wxString GetItemText(const wxTreeItemId &item) const
wxString & Remove(size_t pos)
static size_t GetAllFiles(const wxString &dirname, wxArrayString *files, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT)
void CalculateCommonTopLevelPath()
Calculates the top-level path common to all project files.
void EndRemoveFiles()
Notify that file(s) removal finished.
virtual bool IsExpanded(const wxTreeItemId &item) const
Base class for mime plugins.
void OnNotes(wxCommandEvent &event)
wxMouseState wxGetMouseState()
void OnTabPosition(wxCommandEvent &event)
void OnFileOptions(wxCommandEvent &event)
Represents a file in a Code::Blocks project.
ProjectBuildTarget * GetCurrentlyCompilingTarget()
Get a pointer to the currently compiling target.
size_t operator()(const wxString &s) const
A generic Code::Blocks event.
void DoOpenSelectedFile()
int CmpNoCase(const wxString &s) const
wxWindow * GetAppWindow() const
wxTreeItemId GetItem() const
virtual void SortChildren(const wxTreeItemId &item)
void SwitchToProjectsPage()
Switches the management's notebook to the Projects tab.
void SetFolder(const wxString &folder)
const PluginInfo * GetPluginInfo(const wxString &pluginName)
cbMimePlugin * GetMIMEHandlerForFile(const wxString &filename)
EditorManager * GetEditorManager() const
virtual void SetItemTextColour(const wxTreeItemId &item, const wxColour &col)
void LogError(const wxString &msg, int i=app_log)
If true, create folders as needed. If false, the list is flat (not compatible with "hie folder name")...
void OnSaveFile(wxCommandEvent &event)
wxUSE_UNICODE_dependent wxChar
void OnCloseWorkspace(wxCommandEvent &event)
DLLIMPORT bool cbHasRunningCompilers(const PluginManager *manager)
wxString BeforeFirst(wxUniChar ch, wxString *rest=NULL) const
void RemoveVirtualFolders(const wxString &folder)
Remove all virtual folders starting with folder.
void OnBeginEditNode(wxTreeEvent &event)
wxString GetFileMasks(unsigned int group) const
Return a specific group file mask.
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
cbAuiNotebook * m_pNotebook
void BuildProjectTree(cbProject *project, cbTreeCtrl *tree, const wxTreeItemId &root, int ptvs, FilesGroupsAndMasks *fgam)
(Re)build the project tree.
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
virtual wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
void OnRightClick(wxCommandEvent &event)
If true, the folder name will be hidden and only the file name will be shown (not compatible with "us...
Represents a Code::Blocks project.
wxWindow * wxFindWindowAtPoint(const wxPoint &pt)
virtual const wxString & GetFilename() const
EditorBase * GetActiveEditor()
wxString & RemoveLast(size_t n=1)
wxArrayInt GetSelectedIndices() const
bool AppendUniqueVirtualFolder(const wxString &folder)
Appends a new virtual folder to the end of the list only if it doesn't exists.
cbPlugin * GetIsRunning() const
Return a pointer to the plugin which is running the application.
wxColour GetColour(const wxString &id) const
size_t SetSelection(size_t new_page)
DLLIMPORT wxString cbC2U(const char *str)
Return str as a proper unicode-compatible string.
void OnViewHideFolderName(wxCommandEvent &event)
virtual const wxString & GetTitle() const
Read the target's title.
virtual wxDragResult DoDragDrop(int flags=wxDrag_CopyOnly)
bool MatchesMask(const wxString &ext, unsigned int group) const
Return whether a file extension matches a file mask (group)
void DoOpenFile(ProjectFile *pf, const wxString &filename)
wxString Left(size_t count) const
wxArrayTreeItemIds m_DraggingSelection
void OpenFilesRecursively(wxTreeItemId &sel_id)
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
wxFrame * GetAppFrame() const
virtual void SelectItem(const wxTreeItemId &item, bool select=true)
void OnViewUseFolders(wxCommandEvent &event)
const wxSize wxDefaultSize
cbEditor * GetBuiltinActiveEditor()
bool CloseProject(cbProject *project, bool dontsave=false, bool refresh=true)
Close a project.
const wxPoint wxDefaultPosition
void OnFindFile(wxCommandEvent &event)
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
static bool IsBatchBuild()
void RebuildTree()
Rebuild the project manager's tree.
Base class that all "editors" should inherit from.
LogManager * GetLogManager() const
wxString GetPageToolTip(size_t pageIdx) const
static wxColour GetColour(wxSystemColour index)
void OnRenameFile(wxCommandEvent &event)
cbProject * GetActiveProject()
Retrieve the active project.
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
void OnProjectFileActivated(wxTreeEvent &event)
virtual void Collapse(const wxTreeItemId &item)
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
DLLIMPORT size_t GetIndexForFilterAll()
Get the filter index for the special "All files" filter.
wxString GetLongPath() const
bool Save(const wxString &filename)
void OnProperties(wxCommandEvent &event)
bool operator()(ProjectFile *pf1, ProjectFile *pf2)
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
void CheckForExternallyModifiedProjects()
wxDateTime GetLastModificationTime() const
Returns the last modification time for the file.
const wchar_t * wc_str() const
wxString Right(size_t count) const
const wxString g_StartHereTitle
void OnExecParameters(wxCommandEvent &event)
void OnRenameWorkspace(wxCommandEvent &event)
int AskForBuildTargetIndex(cbProject *project)
Utility function.
void OnOpenFile(wxCommandEvent &event)
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
static bool Access(const wxString &name, wxFile::OpenMode mode)
virtual void SetItemText(const wxTreeItemId &item, const wxString &text)
bool SaveProject(cbProject *project)
Save a project to disk.
const wxString & _(const wxString &string)
EditorBase * GetEditor(int index)
void OnGotoFile(wxCommandEvent &event)
void FreezeTree()
Stop the tree control from updating.
int GetBuildTargetsCount()
void OnSaveAsWorkspace(wxCommandEvent &event)
void BeginLoadingWorkspace()
wxArray< int > wxArrayInt
int First(wxUniChar ch) const
void OnOpenFolderFiles(wxCommandEvent &event)
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
virtual void Expand(const wxTreeItemId &item)
PluginsArray GetMimeOffers()
static bool Exists(const wxString &filename)
cbWorkspace * GetWorkspace()
Get the current workspace filename.
bool SetPageToolTip(size_t page, const wxString &text)
DLLIMPORT wxString GetFilterString(const wxString &ext=wxEmptyString)
Generates and returns the filter string for use in file dialogs.
void SetTreeItemId(wxTreeItemId id)
Sets the tree item id for the file.
ColourManager * GetColourManager() const
bool QueryCloseProject(cbProject *project, bool dontsavefiles)
Checks whether project is saved.
const wxArrayString & GetVirtualFolders() const
Get a list of the virtual folders.
int GetPageIndex(wxWindow *page_wnd) const
void SetProject(cbProject *project, bool refresh=true)
Set the active project.
FileVisualState GetFileState() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
cbProject * GetProject() const
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
void Save()
Save groups/masks to config.
The entry point singleton for working with projects.
void OnAddFileToProject(wxCommandEvent &event)
cbAuiNotebook * GetNotebook()
EVTIMPORT const wxEventType cbEVT_SHOW_DOCK_WINDOW
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
virtual void SetImageList(wxImageList *imageList)
wxString GetFullName() const
A notebook class This class is derived from wxAuiNotebook, to enhance its abilities.
FileTreeDataKind GetKind() const
virtual void GetPaths(wxArrayString &paths) const
void OnCloseProject(wxCommandEvent &event)
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
bool CloseWorkspace()
Close the workspace.
bool ProcessEvent(CodeBlocksEvent &event)
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
void OnRemoveFileFromProject(wxCommandEvent &event)
virtual void Delete(const wxTreeItemId &item)
static void applyFileOptionChange(std::set< cbProject *> &modified, wxTreeCtrl &tree, Func func)
Find all selected tree items which are files and call the func on them.
void OnEndEditNode(wxTreeEvent &event)
void wxMilliSleep(unsigned long milliseconds)
wxString virtual_path
A string that represents the virtual folder this file will appear in.
wxString GetCommonTopLevelPath() const
bool GetModified() const override
void OnDeleteVirtualFolder(wxCommandEvent &event)
wxString & Prepend(const wxString &str)
void OnKeyDown(wxTreeEvent &event)
virtual wxTreeItemId AddRoot(const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
size_t Add(const wxString &str, size_t copies=1)
static wxString ReadDataPath()
cbProject * GetParentProject()
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
void SetKind(FileTreeDataKind kind)
void Sort(bool reverseOrder=false)
int Add(const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap)
virtual wxTreeItemId GetRootItem() const
void SetProjectFile(ProjectFile *file)
void OnSaveWorkspace(wxCommandEvent &event)
ProjectFile * AutoGeneratedBy() const
If this is an auto-generated file, which file is generating it?
void AddControlBelowList(wxControl *control)
int Find(wxUniChar ch, bool fromEnd=false) const
wxUniChar GetChar(size_t n) const
ProjectsArray * GetProjects()
Retrieve an array of all the opened projects.
void OnTreeItemRightClick(wxTreeEvent &event)
void RemoveAt(size_t nIndex, size_t count=1)
void FinishLoadingProject(cbProject *project, bool newAddition, cb_unused FilesGroupsAndMasks *fgam)
wxString GetGroupName(unsigned int group) const
Return a specific group name.
void SetFileState(FileVisualState state)
Set the visual state (modified, read-only, etc).
int Printf(const wxString &pszFormat,...)
EditorBase * IsOpen(const wxString &filename)
bool Save()
Save the project.
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
virtual int OpenFile(const wxString &filename)=0
Open the file.
virtual wxColour GetItemTextColour(const wxTreeItemId &item) const
int SelectTarget(int initial=-1, bool evenIfOne=false)
Displays a target selection dialog.
void OnUpdateUI(wxUpdateUIEvent &event)
If true, use virtual folders like "Sources", "Headers", etc.
virtual void SetValue(bool state)
virtual wxString GetTitle() const
Get the workspace's title.
void SetFileIndex(int index)
static int FolderIconIndex()
wxTreeItemId InsertItem(const wxTreeItemId &parent, const wxTreeItemId &previous, const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
static wxString Format(const wxString &format,...)
wxTreeItemId GetTreeSelection()
Get the selection of the project manager's tree (GUI).
wxString Mid(size_t first, size_t nCount=wxString::npos) const
bool SaveWorkspace()
Save the open workspace.
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
virtual bool ItemHasChildren(const wxTreeItemId &item) const
void OnAddVirtualFolder(wxCommandEvent &event)
void OnTreeBeginDrag(wxTreeEvent &event)
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
virtual void UnselectAll()
wxArrayString ListNodes(wxTreeItemId node) const
std::map< wxString, wxString > StringToStringMap