This commit is contained in:
Vadim Lopatin 2015-01-21 16:51:38 +03:00
parent 84f7fdc0f9
commit 5af53ca271
3 changed files with 24 additions and 19 deletions

View File

@ -3,10 +3,6 @@ module dlangide.ui.commands;
import dlangui.core.events;
import dlangui.widgets.editors;
enum : int {
ACTION_HELP_ABOUT = 5500,
}
enum IDEActions : int {
None = 0,
ProjectOpen = 1010000,
@ -15,6 +11,7 @@ enum IDEActions : int {
FileSave,
FileClose,
FileExit,
HelpAbout,
}
__gshared Action ACTION_FILE_NEW = new Action(IDEActions.FileOpen, "MENU_FILE_NEW"c, "document-new", KeyCode.KEY_N, KeyFlag.Control);
@ -26,3 +23,4 @@ __gshared Action ACTION_EDIT_PASTE = new Action(EditorActions.Paste, "Paste"d, "
__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);

View File

@ -1,5 +1,19 @@
module dlangide.ui.dsourceedit;
import dlangui.core.logger;
import dlangui.widgets.editors;
import dlangui.widgets.srcedit;
import ddc.lexer.textsource;
import ddc.lexer.exceptions;
import ddc.lexer.tokenizer;
import dlangide.workspace.workspace;
import dlangide.workspace.project;
import std.algorithm;
/// DIDE source file editor
class DSourceEdit : SourceEdit {
this(string ID) {

View File

@ -15,13 +15,10 @@ import dlangui.dialogs.filedlg;
import dlangide.ui.commands;
import dlangide.ui.wspanel;
import dlangide.ui.outputpanel;
import dlangide.ui.dsourceedit;
import dlangide.workspace.workspace;
import dlangide.workspace.project;
import ddc.lexer.textsource;
import ddc.lexer.exceptions;
import ddc.lexer.tokenizer;
import std.conv;
import std.utf;
import std.algorithm;
@ -141,14 +138,7 @@ class IDEFrame : AppFrame {
windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES"));
MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c));
helpItem.add(new Action(40, "MENU_HELP_VIEW_HELP"));
MenuItem aboutItem = new MenuItem(new Action(ACTION_HELP_ABOUT, "MENU_HELP_ABOUT"));
helpItem.add(aboutItem);
aboutItem.onMenuItemClick = delegate(MenuItem item) {
Window wnd = Platform.instance.createWindow("About...", window, WindowFlag.Modal);
wnd.mainWidget = createAboutWidget();
wnd.show();
return true;
};
helpItem.add(ACTION_HELP_ABOUT);
mainMenuItems.add(fileItem);
mainMenuItems.add(editItem);
//mainMenuItems.add(viewItem);
@ -165,8 +155,10 @@ class IDEFrame : AppFrame {
ToolBarHost res = new ToolBarHost();
ToolBar tb;
tb = res.getOrAddToolbar("Standard");
tb.addButtons(ACTION_FILE_OPEN, ACTION_FILE_SAVE, ACTION_SEPARATOR,
ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT);
tb.addButtons(ACTION_FILE_OPEN, ACTION_FILE_SAVE);
tb = res.getOrAddToolbar("Edit");
tb.addButtons(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_SEPARATOR,
ACTION_EDIT_UNDO, ACTION_EDIT_REDO);
return res;
}
@ -175,8 +167,9 @@ class IDEFrame : AppFrame {
if (a) {
switch (a.id) {
case IDEActions.FileExit:
window.close();
return true;
case ACTION_HELP_ABOUT:
case IDEActions.HelpAbout:
Window wnd = Platform.instance.createWindow("About...", window, WindowFlag.Modal);
wnd.mainWidget = createAboutWidget();
wnd.show();