diff --git a/dub.json b/dub.json index 62218cf..003c7e6 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views"], "dependencies": { - "dlangui": "==0.9.139", + "dlangui": "==0.9.140", "dsymbol": "~>0.2.9", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index 2248628..62bc0e1 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -60,6 +60,8 @@ enum IDEActions : int { ProjectFolderOpenItem, ProjectFolderRenameItem, ProjectFolderRefresh, + ProjectFolderExpandAll, + ProjectFolderCollapseAll, GoToDefinition, GetCompletionSuggestions, @@ -86,6 +88,9 @@ const Action ACTION_PROJECT_FOLDER_OPEN_ITEM = new Action(IDEActions.ProjectFold const Action ACTION_PROJECT_FOLDER_REMOVE_ITEM = new Action(IDEActions.ProjectFolderRemoveItem, "MENU_PROJECT_FOLDER_REMOVE_ITEM"c); const Action ACTION_PROJECT_FOLDER_RENAME_ITEM = new Action(IDEActions.ProjectFolderRenameItem, "MENU_PROJECT_FOLDER_RENAME_ITEM"c); const Action ACTION_PROJECT_FOLDER_REFRESH = new Action(IDEActions.ProjectFolderRefresh, "MENU_PROJECT_FOLDER_REFRESH"c); +const Action ACTION_PROJECT_FOLDER_EXPAND_ALL = new Action(IDEActions.ProjectFolderExpandAll, "MENU_PROJECT_FOLDER_EXPAND_ALL"c); +const Action ACTION_PROJECT_FOLDER_COLLAPSE_ALL = new Action(IDEActions.ProjectFolderCollapseAll, "MENU_PROJECT_FOLDER_COLLAPSE_ALL"c); + const Action ACTION_FILE_WORKSPACE_CLOSE = new Action(IDEActions.CloseWorkspace, "MENU_FILE_WORKSPACE_CLOSE"c).disableByDefault(); const Action ACTION_FILE_NEW_SOURCE_FILE = new Action(IDEActions.FileNew, "MENU_FILE_NEW_SOURCE_FILE"c, "document-new", KeyCode.KEY_N, KeyFlag.Control); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index aa0501f..1bf6bf5 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -928,6 +928,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.ViewToggleTabPositionMarks: a.state = _settings.showTabPositionMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED; return true; + case IDEActions.ProjectFolderExpandAll: + case IDEActions.ProjectFolderCollapseAll: + a.state = currentWorkspace !is null ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE; + return true; default: return super.handleActionStateRequest(a); } @@ -1220,6 +1224,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.ProjectFolderRefresh: refreshProjectItem(a.objectParam); return true; + case IDEActions.ProjectFolderExpandAll: + _wsPanel.expandAll(a); + return true; + case IDEActions.ProjectFolderCollapseAll: + _wsPanel.collapseAll(a); + return true; case IDEActions.CloseWorkspace: closeWorkspace(); return true; diff --git a/src/dlangide/ui/wspanel.d b/src/dlangide/ui/wspanel.d index d6a3f4b..d1a026d 100644 --- a/src/dlangide/ui/wspanel.d +++ b/src/dlangide/ui/wspanel.d @@ -86,8 +86,11 @@ class WorkspacePanel : DockWindow { _tree.popupMenu = &onTreeItemPopupMenu; _workspacePopupMenu = new MenuItem(); - _workspacePopupMenu.add(ACTION_PROJECT_FOLDER_REFRESH, - ACTION_FILE_WORKSPACE_CLOSE); + _workspacePopupMenu.add(ACTION_PROJECT_FOLDER_REFRESH, + ACTION_FILE_WORKSPACE_CLOSE, + ACTION_PROJECT_FOLDER_EXPAND_ALL, + ACTION_PROJECT_FOLDER_COLLAPSE_ALL + ); _projectPopupMenu = new MenuItem(); _projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP, @@ -100,19 +103,22 @@ class WorkspacePanel : DockWindow { ACTION_PROJECT_UPDATE_DEPENDENCIES, ACTION_PROJECT_REVEAL_IN_EXPLORER, ACTION_PROJECT_SETTINGS, + ACTION_PROJECT_FOLDER_EXPAND_ALL, + ACTION_PROJECT_FOLDER_COLLAPSE_ALL //ACTION_PROJECT_FOLDER_REMOVE_ITEM ); _folderPopupMenu = new MenuItem(); - _folderPopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_OPEN_ITEM, + _folderPopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_OPEN_ITEM, + ACTION_PROJECT_FOLDER_EXPAND_ALL, ACTION_PROJECT_FOLDER_COLLAPSE_ALL //ACTION_PROJECT_FOLDER_REMOVE_ITEM, //ACTION_PROJECT_FOLDER_RENAME_ITEM ); _filePopupMenu = new MenuItem(); - _filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, - ACTION_PROJECT_FOLDER_OPEN_ITEM, - ACTION_PROJECT_FOLDER_REMOVE_ITEM, + _filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, + ACTION_PROJECT_FOLDER_OPEN_ITEM, + ACTION_PROJECT_FOLDER_REMOVE_ITEM, //ACTION_PROJECT_FOLDER_RENAME_ITEM ); return _tree; @@ -123,6 +129,7 @@ class WorkspacePanel : DockWindow { protected MenuItem _folderPopupMenu; protected MenuItem _filePopupMenu; protected string _popupMenuSelectedItemId; + protected TreeItem _popupMenuSelectedItem; protected void onPopupMenuItem(MenuItem item) { if (item.action) handleAction(item.action); @@ -131,6 +138,7 @@ class WorkspacePanel : DockWindow { protected MenuItem onTreeItemPopupMenu(TreeItems source, TreeItem selectedItem) { MenuItem menu = null; _popupMenuSelectedItemId = selectedItem.id; + _popupMenuSelectedItem = selectedItem; if (selectedItem.intParam == ProjectItemType.SourceFolder) { menu = _folderPopupMenu; } else if (selectedItem.intParam == ProjectItemType.SourceFile) { @@ -217,6 +225,20 @@ class WorkspacePanel : DockWindow { _tree.items.setDefaultItem(defaultItem); } + void expandAll(const Action a) { + if (!_workspace) + return; + if (_popupMenuSelectedItem) + _popupMenuSelectedItem.expandAll(); + } + + void collapseAll(const Action a) { + if (!_workspace) + return; + if (_popupMenuSelectedItem) + _popupMenuSelectedItem.collapseAll(); + } + protected bool[string] _itemStates; protected bool _itemStatesDirty; protected void readExpandedStateFromWorkspace() { diff --git a/views/VERSION b/views/VERSION index 00cd085..eee71b3 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.85 \ No newline at end of file +v0.7.86 \ No newline at end of file diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 0ecec66..23dfcd0 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -133,6 +133,8 @@ MENU_PROJECT_FOLDER_REMOVE_ITEM=Remove MENU_PROJECT_FOLDER_RENAME_ITEM=Rename... MENU_PROJECT_FOLDER_REFRESH=Refresh MENU_PROJECT_REVEAL_IN_EXPLORER=Reveal in Explorer +MENU_PROJECT_FOLDER_EXPAND_ALL=Expand all +MENU_PROJECT_FOLDER_COLLAPSE_ALL=Collapse all HEADER_SETTINGS=DlangIDE settings HEADER_OPEN_WORKSPACE_OR_PROJECT=Open Workspace or Project diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 37a1ad2..9758042 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -133,6 +133,8 @@ MENU_PROJECT_FOLDER_REMOVE_ITEM=Удалить MENU_PROJECT_FOLDER_RENAME_ITEM=Переименовать... MENU_PROJECT_FOLDER_REFRESH=Обновить MENU_PROJECT_REVEAL_IN_EXPLORER=Открыть в проводнике +MENU_PROJECT_FOLDER_EXPAND_ALL=Раскрыть все +MENU_PROJECT_FOLDER_COLLAPSE_ALL=Свернуть все HEADER_SETTINGS=DlangIDE настройки HEADER_OPEN_WORKSPACE_OR_PROJECT=Открыть рабочее пространство или проект