From aeb265f224b6624c59b08d8a259fbdb108777bc7 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 26 Jan 2015 16:55:14 +0300 Subject: [PATCH] main menu and actions --- src/dlangide/ui/commands.d | 45 ++++++++++++++----- src/dlangide/ui/frame.d | 15 +++++++ views/res/i18n/en.ini | 16 +++++++ .../sample1/sampleproject1/source/main.d | 1 - 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index a5778fc..53c393f 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -11,19 +11,42 @@ enum IDEActions : int { FileSave, FileClose, FileExit, + BuildWorkspace, + RebuildWorkspace, + CleanWorkspace, + BuildProject, + RebuildProject, + CleanProject, + SetStartupProject, + ProjectSettings, DebugStart, DebugStartNoDebug, + DebugContinue, + DebugStop, + DebugPause, HelpAbout, } -__gshared Action ACTION_FILE_NEW = new Action(IDEActions.FileOpen, "MENU_FILE_NEW"c, "document-new", KeyCode.KEY_N, KeyFlag.Control); -__gshared Action ACTION_FILE_OPEN = new Action(IDEActions.FileOpen, "MENU_FILE_OPEN"c, "document-open", KeyCode.KEY_O, KeyFlag.Control); -__gshared Action ACTION_FILE_SAVE = new Action(IDEActions.FileSave, "MENU_FILE_SAVE"c, "document-save", KeyCode.KEY_S, KeyFlag.Control); -__gshared Action ACTION_FILE_EXIT = new Action(IDEActions.FileExit, "MENU_FILE_EXIT"c, "document-close"c, KeyCode.KEY_X, KeyFlag.Alt); -__gshared Action ACTION_DEBUG_START = new Action(IDEActions.DebugStart, "Start Debugging"d, "debug-run"c, KeyCode.F5, 0); -__gshared Action ACTION_EDIT_COPY = new Action(EditorActions.Copy, "Copy"d, "edit-copy"c, KeyCode.KEY_C, KeyFlag.Control); -__gshared Action ACTION_EDIT_PASTE = new Action(EditorActions.Paste, "Paste"d, "edit-paste"c, KeyCode.KEY_V, KeyFlag.Control); -__gshared Action ACTION_EDIT_CUT = new Action(EditorActions.Cut, "Cut"d, "edit-cut"c, KeyCode.KEY_X, KeyFlag.Control); -__gshared Action ACTION_EDIT_UNDO = new Action(EditorActions.Undo, "Undo"d, "edit-undo"c, KeyCode.KEY_Z, KeyFlag.Control); -__gshared Action ACTION_EDIT_REDO = new Action(EditorActions.Redo, "Redo"d, "edit-redo"c, KeyCode.KEY_Z, KeyFlag.Control|KeyFlag.Shift); -__gshared Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABOUT"c); +const Action ACTION_FILE_NEW = new Action(IDEActions.FileOpen, "MENU_FILE_NEW"c, "document-new", KeyCode.KEY_N, KeyFlag.Control); +const Action ACTION_FILE_OPEN = new Action(IDEActions.FileOpen, "MENU_FILE_OPEN"c, "document-open", KeyCode.KEY_O, KeyFlag.Control); +const Action ACTION_FILE_SAVE = new Action(IDEActions.FileSave, "MENU_FILE_SAVE"c, "document-save", KeyCode.KEY_S, KeyFlag.Control); +const Action ACTION_FILE_EXIT = new Action(IDEActions.FileExit, "MENU_FILE_EXIT"c, "document-close"c, KeyCode.KEY_X, KeyFlag.Alt); +const Action ACTION_WORKSPACE_BUILD = new Action(IDEActions.BuildWorkspace, "MENU_BUILD_WORKSPACE_BUILD"c); +const Action ACTION_WORKSPACE_REBUILD = new Action(IDEActions.RebuildWorkspace, "MENU_BUILD_WORKSPACE_REBUILD"c); +const Action ACTION_WORKSPACE_CLEAN = new Action(IDEActions.CleanWorkspace, "MENU_BUILD_WORKSPACE_CLEAN"c); +const Action ACTION_PROJECT_BUILD = new Action(IDEActions.BuildProject, "MENU_BUILD_PROJECT_BUILD"c, null, KeyCode.F7, 0); +const Action ACTION_PROJECT_REBUILD = new Action(IDEActions.RebuildProject, "MENU_BUILD_PROJECT_REBUILD"c, null, KeyCode.F7, KeyFlag.Control); +const Action ACTION_PROJECT_CLEAN = new Action(IDEActions.CleanProject, "MENU_BUILD_PROJECT_CLEAN"c, null); +const Action ACTION_PROJECT_SET_STARTUP = new Action(IDEActions.SetStartupProject, "MENU_PROJECT_SET_AS_STARTUP"c, null); +const Action ACTION_PROJECT_SETTINGS = new Action(IDEActions.ProjectSettings, "MENU_PROJECT_SETTINGS"c, null); +const Action ACTION_DEBUG_START = new Action(IDEActions.DebugStart, "MENU_DEBUG_START_DEBUGGING"c, "debug-run"c, KeyCode.F5, 0); +const Action ACTION_DEBUG_START_NO_DEBUG = new Action(IDEActions.DebugStartNoDebug, "MENU_DEBUG_START_NO_DEBUGGING"c, null, KeyCode.F5, KeyFlag.Control); +const Action ACTION_DEBUG_CONTINUE = new Action(IDEActions.DebugContinue, "MENU_DEBUG_CONTINUE"c); +const Action ACTION_DEBUG_STOP = new Action(IDEActions.DebugStop, "MENU_DEBUG_STOP"c); +const Action ACTION_DEBUG_PAUSE = new Action(IDEActions.DebugPause, "MENU_DEBUG_PAUSE"c); +const Action ACTION_EDIT_COPY = new Action(EditorActions.Copy, "MENU_EDIT_COPY"c, "edit-copy"c, KeyCode.KEY_C, KeyFlag.Control); +const Action ACTION_EDIT_PASTE = new Action(EditorActions.Paste, "MENU_EDIT_PASTE"c, "edit-paste"c, KeyCode.KEY_V, KeyFlag.Control); +const Action ACTION_EDIT_CUT = new Action(EditorActions.Cut, "MENU_EDIT_CUT"c, "edit-cut"c, KeyCode.KEY_X, KeyFlag.Control); +const Action ACTION_EDIT_UNDO = new Action(EditorActions.Undo, "MENU_EDIT_UNDO"c, "edit-undo"c, KeyCode.KEY_Z, KeyFlag.Control); +const Action ACTION_EDIT_REDO = new Action(EditorActions.Redo, "MENU_EDIT_REDO"c, "edit-redo"c, KeyCode.KEY_Z, KeyFlag.Control|KeyFlag.Shift); +const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABOUT"c); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 0ddc74e..70e3242 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -198,6 +198,18 @@ class IDEFrame : AppFrame { editItem.add(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_EDIT_UNDO, ACTION_EDIT_REDO); editItem.add(new Action(20, "MENU_EDIT_PREFERENCES")); + + MenuItem projectItem = new MenuItem(new Action(21, "MENU_PROJECT")); + projectItem.add(ACTION_PROJECT_SET_STARTUP, ACTION_PROJECT_SETTINGS); + + MenuItem buildItem = new MenuItem(new Action(22, "MENU_BUILD")); + buildItem.add(ACTION_WORKSPACE_BUILD, ACTION_WORKSPACE_REBUILD, ACTION_WORKSPACE_CLEAN, + ACTION_PROJECT_BUILD, ACTION_PROJECT_REBUILD, ACTION_PROJECT_CLEAN); + + MenuItem debugItem = new MenuItem(new Action(23, "MENU_DEBUG")); + debugItem.add(ACTION_DEBUG_START, ACTION_DEBUG_START_NO_DEBUG, ACTION_DEBUG_CONTINUE, ACTION_DEBUG_STOP, ACTION_DEBUG_PAUSE); + + MenuItem windowItem = new MenuItem(new Action(3, "MENU_WINDOW"c)); windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES")); MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c)); @@ -205,6 +217,9 @@ class IDEFrame : AppFrame { helpItem.add(ACTION_HELP_ABOUT); mainMenuItems.add(fileItem); mainMenuItems.add(editItem); + mainMenuItems.add(projectItem); + mainMenuItems.add(buildItem); + mainMenuItems.add(debugItem); //mainMenuItems.add(viewItem); mainMenuItems.add(windowItem); mainMenuItems.add(helpItem); diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 1e35566..1e707c2 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -12,6 +12,22 @@ MENU_EDIT_CUT=Cu&t MENU_EDIT_UNDO=&Undo MENU_EDIT_REDO=&Redo MENU_EDIT_PREFERENCES=&Preferences +MENU_BUILD=&BUILD +MENU_BUILD_WORKSPACE_BUILD=Build Workspace +MENU_BUILD_WORKSPACE_REBUILD=Rebuild Workspace +MENU_BUILD_WORKSPACE_CLEAN=Clean Workspace +MENU_BUILD_PROJECT_BUILD=Build Project +MENU_BUILD_PROJECT_REBUILD=Rebuild Project +MENU_BUILD_PROJECT_CLEAN=Clean Project +MENU_PROJECT=&PROJECT +MENU_PROJECT_SET_AS_STARTUP=Set as Startup Project +MENU_PROJECT_SETTINGS=Project Settings +MENU_DEBUG=&DEBUG +MENU_DEBUG_START_DEBUGGING=Start Debugging +MENU_DEBUG_START_NO_DEBUGGING=Start Without Debugging +MENU_DEBUG_CONTINUE=Continue Debugging +MENU_DEBUG_STOP=Stop +MENU_DEBUG_PAUSE=Pause MENU_VIEW=&VIEW MENU_VIEW_LANGUAGE=Interface &Language MENU_VIEW_LANGUAGE_EN=English diff --git a/workspaces/sample1/sampleproject1/source/main.d b/workspaces/sample1/sampleproject1/source/main.d index d09973e..c598a03 100644 --- a/workspaces/sample1/sampleproject1/source/main.d +++ b/workspaces/sample1/sampleproject1/source/main.d @@ -1,7 +1,6 @@ void main() { - } // Computes average line length for standard input.