Added new directory to the right-click menu

This commit is contained in:
Zevenberge 2017-11-30 18:57:09 +01:00
parent f7cbb17a51
commit 3900fd4a34
5 changed files with 18 additions and 3 deletions

4
.gitignore vendored
View File

@ -20,3 +20,7 @@ index.html
api.html api.html
screenshots.html screenshots.html
*.log *.log
*.userprefs
\.dlangidews\.wssettings

View File

@ -6,6 +6,7 @@ import dlangui.widgets.editors;
enum IDEActions : int { enum IDEActions : int {
//ProjectOpen = 1010000, //ProjectOpen = 1010000,
FileNew = 1010000, FileNew = 1010000,
FileNewDirectory,
FileNewWorkspace, FileNewWorkspace,
FileNewProject, FileNewProject,
FileOpen, FileOpen,
@ -100,6 +101,7 @@ const Action ACTION_PROJECT_FOLDER_COLLAPSE_ALL = new Action(IDEActions.ProjectF
const Action ACTION_FILE_WORKSPACE_CLOSE = new Action(IDEActions.CloseWorkspace, "MENU_FILE_WORKSPACE_CLOSE"c).disableByDefault(); const Action ACTION_FILE_WORKSPACE_CLOSE = new Action(IDEActions.CloseWorkspace, "MENU_FILE_WORKSPACE_CLOSE"c).disableByDefault();
const Action ACTION_FILE_NEW_DIRECTORY = new Action(IDEActions.FileNewDirectory, "MENU_FILE_NEW_DIRECTORY"c);
const Action ACTION_FILE_NEW_SOURCE_FILE = new Action(IDEActions.FileNew, "MENU_FILE_NEW_SOURCE_FILE"c, "document-new", KeyCode.KEY_N, KeyFlag.Control); const Action ACTION_FILE_NEW_SOURCE_FILE = new Action(IDEActions.FileNew, "MENU_FILE_NEW_SOURCE_FILE"c, "document-new", KeyCode.KEY_N, KeyFlag.Control);
const Action ACTION_FILE_NEW_PROJECT = new Action(IDEActions.FileNewProject, "MENU_FILE_NEW_PROJECT"c); const Action ACTION_FILE_NEW_PROJECT = new Action(IDEActions.FileNewProject, "MENU_FILE_NEW_PROJECT"c);
const Action ACTION_FILE_NEW_WORKSPACE = new Action(IDEActions.FileNewWorkspace, "MENU_FILE_NEW_WORKSPACE"c); const Action ACTION_FILE_NEW_WORKSPACE = new Action(IDEActions.FileNewWorkspace, "MENU_FILE_NEW_WORKSPACE"c);

View File

@ -1367,6 +1367,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
case IDEActions.FileNew: case IDEActions.FileNew:
addProjectItem(cast(Object)a.objectParam); addProjectItem(cast(Object)a.objectParam);
return true; return true;
case IDEActions.FileNewDirectory:
//static assert(false);
return true;
case IDEActions.ProjectFolderRemoveItem: case IDEActions.ProjectFolderRemoveItem:
removeProjectItem(a.objectParam); removeProjectItem(a.objectParam);
return true; return true;
@ -1488,7 +1491,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
} }
/// add new file to project /// add new file to project
void addProjectItem(Object obj) { private void addProjectItem(Object obj) {
if (currentWorkspace is null) if (currentWorkspace is null)
return; return;
if (obj is null && _wsPanel !is null && !currentEditorSourceFile) { if (obj is null && _wsPanel !is null && !currentEditorSourceFile) {
@ -1515,6 +1518,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
project = srcfile.project; project = srcfile.project;
} }
} }
//static assert(false, "hier verdergaan okdoei");
if (project && folder && project.workspace is currentWorkspace) { if (project && folder && project.workspace is currentWorkspace) {
NewFileDlg dlg = new NewFileDlg(this, project, folder); NewFileDlg dlg = new NewFileDlg(this, project, folder);
dlg.dialogResult = delegate(Dialog dlg, const Action result) { dlg.dialogResult = delegate(Dialog dlg, const Action result) {

View File

@ -103,6 +103,7 @@ class WorkspacePanel : DockWindow {
_projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP, _projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP,
ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_REFRESH,
ACTION_FILE_NEW_SOURCE_FILE, ACTION_FILE_NEW_SOURCE_FILE,
ACTION_FILE_NEW_DIRECTORY,
//ACTION_PROJECT_FOLDER_OPEN_ITEM, //ACTION_PROJECT_FOLDER_OPEN_ITEM,
ACTION_PROJECT_BUILD, ACTION_PROJECT_BUILD,
ACTION_PROJECT_REBUILD, ACTION_PROJECT_REBUILD,
@ -116,14 +117,17 @@ class WorkspacePanel : DockWindow {
); );
_folderPopupMenu = new MenuItem(); _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_FILE_NEW_DIRECTORY,
ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_OPEN_ITEM,
ACTION_PROJECT_FOLDER_EXPAND_ALL, ACTION_PROJECT_FOLDER_COLLAPSE_ALL ACTION_PROJECT_FOLDER_EXPAND_ALL, ACTION_PROJECT_FOLDER_COLLAPSE_ALL
//ACTION_PROJECT_FOLDER_REMOVE_ITEM, //ACTION_PROJECT_FOLDER_REMOVE_ITEM,
//ACTION_PROJECT_FOLDER_RENAME_ITEM //ACTION_PROJECT_FOLDER_RENAME_ITEM
); );
_filePopupMenu = new MenuItem(); _filePopupMenu = new MenuItem();
_filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, _filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE,
ACTION_PROJECT_FOLDER_REFRESH,
ACTION_PROJECT_FOLDER_OPEN_ITEM, ACTION_PROJECT_FOLDER_OPEN_ITEM,
ACTION_PROJECT_FOLDER_REMOVE_ITEM, ACTION_PROJECT_FOLDER_REMOVE_ITEM,
//ACTION_PROJECT_FOLDER_RENAME_ITEM //ACTION_PROJECT_FOLDER_RENAME_ITEM

View File

@ -34,6 +34,7 @@ NAME=Name
MENU_FILE=&File MENU_FILE=&File
MENU_FILE_NEW=&Create MENU_FILE_NEW=&Create
MENU_FILE_NEW_SOURCE_FILE=New file MENU_FILE_NEW_SOURCE_FILE=New file
MENU_FILE_NEW_DIRECTORY=New directory
MENU_FILE_NEW_PROJECT=New project MENU_FILE_NEW_PROJECT=New project
MENU_FILE_NEW_WORKSPACE=New workspace MENU_FILE_NEW_WORKSPACE=New workspace
MENU_FILE_OPEN=&Open file... MENU_FILE_OPEN=&Open file...