View menu itmes; check items for whitespace and tab marks settings - #302

This commit is contained in:
Vadim Lopatin 2017-09-18 10:50:56 +03:00
parent 0cdee6d5e4
commit db88a02863
6 changed files with 41 additions and 4 deletions

View File

@ -12,7 +12,7 @@
"stringImportPaths": ["views"],
"dependencies": {
"dlangui": "==0.9.137",
"dlangui": "==0.9.138",
"dsymbol": "~>0.2.9",
"dcd": "~>0.9.1"
},

View File

@ -70,6 +70,9 @@ enum IDEActions : int {
InsertCompletion,
FindInFiles,
CloseWorkspace,
ViewToggleWhitespaceMarks,
ViewToggleTabPositionMarks,
}
__gshared static this() {
@ -133,6 +136,10 @@ const Action ACTION_EDIT_UNINDENT = (new Action(EditorActions.Unindent, "MENU_ED
const Action ACTION_EDIT_TOGGLE_LINE_COMMENT = (new Action(EditorActions.ToggleLineComment, "MENU_EDIT_TOGGLE_LINE_COMMENT"c, null, KeyCode.KEY_DIVIDE, KeyFlag.Control)).disableByDefault();
const Action ACTION_EDIT_TOGGLE_BLOCK_COMMENT = (new Action(EditorActions.ToggleBlockComment, "MENU_EDIT_TOGGLE_BLOCK_COMMENT"c, null, KeyCode.KEY_DIVIDE, KeyFlag.Control|KeyFlag.Shift)).disableByDefault();
const Action ACTION_EDIT_PREFERENCES = (new Action(IDEActions.EditPreferences, "MENU_EDIT_PREFERENCES"c, null)).disableByDefault();
const Action ACTION_VIEW_TOGGLE_SHOW_WHITESPACES = (new Action(IDEActions.ViewToggleWhitespaceMarks, "MENU_VIEW_SHOW_WHITESPACE_MARKS"c, null));
const Action ACTION_VIEW_TOGGLE_TAB_POSITIONS = (new Action(IDEActions.ViewToggleTabPositionMarks, "MENU_VIEW_SHOW_TAB_POSITIONS"c, null));
const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABOUT"c);
const Action ACTION_HELP_VIEW_HELP = new Action(IDEActions.HelpViewHelp, "MENU_HELP_VIEW_HELP"c);
const Action ACTION_HELP_DONATE = new Action(IDEActions.HelpDonate, "MENU_HELP_DONATE"c);

View File

@ -709,9 +709,14 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
MenuItem editItemAdvanced = new MenuItem(new Action(221, "MENU_EDIT_ADVANCED"));
editItemAdvanced.add(ACTION_EDIT_INDENT, ACTION_EDIT_UNINDENT, ACTION_EDIT_TOGGLE_LINE_COMMENT, ACTION_EDIT_TOGGLE_BLOCK_COMMENT);
editItem.add(editItemAdvanced);
editItem.add(ACTION_EDIT_PREFERENCES);
MenuItem viewItem = new MenuItem(new Action(3, "MENU_VIEW"));
viewItem.add(ACTION_WINDOW_SHOW_HOME_SCREEN, ACTION_WINDOW_SHOW_WORKSPACE_EXPLORER, ACTION_WINDOW_SHOW_LOG_WINDOW);
viewItem.addSeparator();
viewItem.addCheck(ACTION_VIEW_TOGGLE_SHOW_WHITESPACES);
viewItem.addCheck(ACTION_VIEW_TOGGLE_TAB_POSITIONS);
MenuItem navItem = new MenuItem(new Action(21, "MENU_NAVIGATE"));
navItem.add(ACTION_GO_TO_DEFINITION, ACTION_GET_COMPLETIONS, ACTION_GET_DOC_COMMENTS,
ACTION_GET_PAREN_COMPLETION, ACTION_EDITOR_GOTO_PREVIOUS_BOOKMARK,
@ -739,12 +744,12 @@ 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);
windowItem.addSeparator();
windowItem.add(ACTION_WINDOW_SHOW_HOME_SCREEN, ACTION_WINDOW_SHOW_WORKSPACE_EXPLORER, ACTION_WINDOW_SHOW_LOG_WINDOW);
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);
mainMenuItems.add(editItem);
mainMenuItems.add(viewItem);
mainMenuItems.add(projectItem);
mainMenuItems.add(navItem);
mainMenuItems.add(buildItem);
@ -910,6 +915,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
case IDEActions.GotoLine:
a.state = (currentEditor !is null && !_currentBackgroundOperation) ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE;
return true;
case IDEActions.ViewToggleWhitespaceMarks:
a.state = _settings.showWhiteSpaceMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
return true;
case IDEActions.ViewToggleTabPositionMarks:
a.state = _settings.showTabPositionMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
return true;
default:
return super.handleActionStateRequest(a);
}
@ -1070,6 +1081,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
case IDEActions.WindowShowLogWindow:
_logPanel.activateLogTab();
return true;
case IDEActions.ViewToggleWhitespaceMarks:
_settings.showWhiteSpaceMarks = !_settings.showWhiteSpaceMarks;
_settings.save();
applySettings(_settings);
return true;
case IDEActions.ViewToggleTabPositionMarks:
_settings.showTabPositionMarks = !_settings.showTabPositionMarks;
_settings.save();
applySettings(_settings);
return true;
case IDEActions.FileOpenWorkspace:
// Already specified workspace
if (!a.stringParam.empty) {

View File

@ -172,6 +172,7 @@ class IDESettings : SettingsFile {
/// set tab position marks enabled flag
@property IDESettings showTabPositionMarks(bool enabled) { editorSettings.setBoolean("showTabPositionMarks", enabled); return this; }
/// string value of font face in text editors
@property string editorFontFace() { return editorSettings.getString("fontFace", "Default"); }
/// int value of font size in text editors
@property int editorFontSize() { return cast(int)editorSettings.getInteger("fontSize", 11); }

View File

@ -54,6 +54,10 @@ MENU_EDIT_TOGGLE_BLOCK_COMMENT=Toggle block comment
MENU_EDIT_ADVANCED=Advanced...
MENU_EDIT_PREFERENCES=&Preferences
MENU_VIEW=&View
MENU_VIEW_SHOW_WHITESPACE_MARKS=Show whitespace marks
MENU_VIEW_SHOW_TAB_POSITIONS=Tab position marks
MENU_PROJECT=&Project
MENU_PROJECT_CONFIGURATIONS=Project configurations
MENU_PROJECT_SET_AS_STARTUP=Set as startup project

View File

@ -54,6 +54,10 @@ MENU_EDIT_TOGGLE_BLOCK_COMMENT=Закомментировать блок
MENU_EDIT_ADVANCED=Продвинутые...
MENU_EDIT_PREFERENCES=&Настройки
MENU_VIEW=&Вид
MENU_VIEW_SHOW_WHITESPACE_MARKS=Видимые пробелы и табы
MENU_VIEW_SHOW_TAB_POSITIONS=Метки отступов
MENU_PROJECT=&Проект
MENU_PROJECT_CONFIGURATIONS=Конфигурации проекта
MENU_PROJECT_SET_AS_STARTUP=Установить как начальный проект