diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index d8cf0ec..dc1770c 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -50,6 +50,7 @@ enum IDEActions : int { WindowCloseDocument, WindowCloseAllDocuments, WindowShowHomeScreen, + WindowShowWorkspaceExplorer, CreateNewWorkspace, AddToCurrentWorkspace, //ProjectFolderAddItem, @@ -136,6 +137,7 @@ const Action ACTION_HELP_DONATE = new Action(IDEActions.HelpDonate, "MENU_HELP_D const Action ACTION_WINDOW_CLOSE_DOCUMENT = new Action(IDEActions.WindowCloseDocument, "MENU_WINDOW_CLOSE_DOCUMENT"c, null, KeyCode.KEY_W, KeyFlag.Control).disableByDefault(); const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c).disableByDefault(); const Action ACTION_WINDOW_SHOW_HOME_SCREEN = new Action(IDEActions.WindowShowHomeScreen, "MENU_WINDOW_SHOW_HOME_SCREEN"c); +const Action ACTION_WINDOW_SHOW_WORKSPACE_EXPLORER = new Action(IDEActions.WindowShowWorkspaceExplorer, "MENU_WINDOW_SHOW_WORKSPACE_EXPLORER"c); const Action ACTION_CREATE_NEW_WORKSPACE = new Action(IDEActions.CreateNewWorkspace, "OPTION_CREATE_NEW_WORKSPACE"c); const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurrentWorkspace, "OPTION_ADD_TO_CURRENT_WORKSPACE"c); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index c10cb47..d8da4e4 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -463,6 +463,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL return true; } + void showWorkspaceExplorer() { + _wsPanel.activate(); + } + static immutable HOME_SCREEN_ID = "HOME_SCREEN"; void showHomeScreen() { int index = _tabs.tabIndex(HOME_SCREEN_ID); @@ -734,7 +738,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL MenuItem windowItem = new MenuItem(new Action(3, "MENU_WINDOW"c)); //windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES")); - windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT, ACTION_WINDOW_CLOSE_ALL_DOCUMENTS, ACTION_WINDOW_SHOW_HOME_SCREEN); + windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT, ACTION_WINDOW_CLOSE_ALL_DOCUMENTS, ACTION_WINDOW_SHOW_HOME_SCREEN, ACTION_WINDOW_SHOW_WORKSPACE_EXPLORER); MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c)); helpItem.add(ACTION_HELP_VIEW_HELP, ACTION_HELP_ABOUT, ACTION_HELP_DONATE); mainMenuItems.add(fileItem); @@ -828,6 +832,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL switch (a.id) { case IDEActions.EditPreferences: return true; + case IDEActions.WindowShowWorkspaceExplorer: + a.state = currentWorkspace !is null ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE; + return true; case IDEActions.FileExit: case IDEActions.FileOpen: case IDEActions.WindowShowHomeScreen: @@ -1055,6 +1062,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.WindowShowHomeScreen: showHomeScreen(); return true; + case IDEActions.WindowShowWorkspaceExplorer: + showWorkspaceExplorer(); + return true; case IDEActions.FileOpenWorkspace: // Already specified workspace if (!a.stringParam.empty) { @@ -1603,14 +1613,14 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _tabs.setFocus(); } if (ws) { - _wsPanel.visibility = Visibility.Visible; + _wsPanel.activate(); _settings.updateRecentWorkspace(ws.filename); _settings.setRecentPath(ws.dir, "FILE_OPEN_WORKSPACE_PATH"); if (ws.startupProject) { warmUpImportPaths(ws.startupProject); } } else { - _wsPanel.visibility = Visibility.Gone; + _wsPanel.hide(); } } diff --git a/src/dlangide/ui/wspanel.d b/src/dlangide/ui/wspanel.d index 03a624b..9fde5c6 100644 --- a/src/dlangide/ui/wspanel.d +++ b/src/dlangide/ui/wspanel.d @@ -319,4 +319,24 @@ class WorkspacePanel : DockWindow { return workspaceActionListener(a); return false; } + + override protected bool onCloseButtonClick(Widget source) { + hide(); + return true; + } + + /// hide workspace panel + void hide() { + visibility = Visibility.Gone; + parent.layout(parent.pos); + } + + // activate workspace panel if hidden + void activate() { + if (visibility == Visibility.Gone) { + visibility = Visibility.Visible; + parent.layout(parent.pos); + } + setFocus(); + } } diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 3486036..c5a3927 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -99,6 +99,7 @@ MENU_WINDOW_PREFERENCES=&Preferences MENU_WINDOW_CLOSE_DOCUMENT=Close document MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Close all documents MENU_WINDOW_SHOW_HOME_SCREEN=Show home screen +MENU_WINDOW_SHOW_WORKSPACE_EXPLORER=Show workspace explorer MENU_HELP=&Help MENU_HELP_VIEW_HELP=Online help diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index ced1a2f..3f8f09a 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -99,6 +99,7 @@ MENU_WINDOW_PREFERENCES=&Настройки MENU_WINDOW_CLOSE_DOCUMENT=Закрыть документ MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Закрыть все документы MENU_WINDOW_SHOW_HOME_SCREEN=Домашняя страница +MENU_WINDOW_SHOW_WORKSPACE_EXPLORER=Менеджер рабочего пространства MENU_HELP=&Справка MENU_HELP_VIEW_HELP=Онлайн справка