ability to hide toolbar and statusbar - fix #303

This commit is contained in:
Vadim Lopatin 2017-09-26 10:49:06 +03:00
parent ada63d3cc7
commit 368351c869
6 changed files with 44 additions and 3 deletions

View File

@ -78,6 +78,8 @@ enum IDEActions : int {
ViewToggleWhitespaceMarks,
ViewToggleTabPositionMarks,
ViewToggleToolbar,
ViewToggleStatusbar,
}
__gshared static this() {
@ -150,6 +152,8 @@ const Action ACTION_EDIT_PREFERENCES = (new Action(IDEActions.EditPreferences, "
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_VIEW_TOGGLE_TOOLBAR = (new Action(IDEActions.ViewToggleToolbar, "MENU_VIEW_SHOW_TOOLBAR"c, null)).disableByDefault();
const Action ACTION_VIEW_TOGGLE_STATUSBAR = (new Action(IDEActions.ViewToggleStatusbar, "MENU_VIEW_SHOW_STATUSBAR"c, null)).disableByDefault();
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);

View File

@ -724,6 +724,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
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_TOOLBAR);
viewItem.addCheck(ACTION_VIEW_TOGGLE_STATUSBAR);
viewItem.addSeparator();
viewItem.addCheck(ACTION_VIEW_TOGGLE_SHOW_WHITESPACES);
viewItem.addCheck(ACTION_VIEW_TOGGLE_TAB_POSITIONS);
@ -764,7 +767,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
ACTION_RUN_WITH_RDMD);
MenuItem debugItem = new MenuItem(new Action(23, "MENU_DEBUG"));
debugItem.add(ACTION_DEBUG_START, ACTION_DEBUG_START_NO_DEBUG,
debugItem.add(ACTION_DEBUG_START, ACTION_DEBUG_START_NO_DEBUG,
ACTION_DEBUG_CONTINUE, ACTION_DEBUG_STOP, ACTION_DEBUG_PAUSE,
ACTION_DEBUG_RESTART,
ACTION_DEBUG_STEP_INTO,
@ -968,6 +971,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
case IDEActions.ViewToggleTabPositionMarks:
a.state = _settings.showTabPositionMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
return true;
case IDEActions.ViewToggleToolbar:
a.state = _settings.showToolbar ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
return true;
case IDEActions.ViewToggleStatusbar:
a.state = _settings.showStatusbar ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
return true;
case IDEActions.ProjectFolderExpandAll:
case IDEActions.ProjectFolderCollapseAll:
a.state = currentWorkspace !is null ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE;
@ -1164,6 +1173,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
_settings.save();
applySettings(_settings);
return true;
case IDEActions.ViewToggleToolbar:
_settings.showToolbar = !_settings.showToolbar;
_settings.save();
applySettings(_settings);
return true;
case IDEActions.ViewToggleStatusbar:
_settings.showStatusbar = !_settings.showStatusbar;
_settings.save();
applySettings(_settings);
return true;
case IDEActions.FileOpenWorkspace:
// Already specified workspace
if (!a.stringParam.empty) {
@ -1525,6 +1544,8 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
// Applying settings to tabs/sources and it's opening
void applySettings(IDESettings settings) {
_toolbarHost.visibility = _settings.showToolbar ? Visibility.Visible : Visibility.Gone;
_statusLine.visibility = _settings.showStatusbar ? Visibility.Visible : Visibility.Gone;
for (int i = _tabs.tabCount - 1; i >= 0; i--) {
DSourceEdit ed = cast(DSourceEdit)_tabs.tabBody(i);
if (ed) {

View File

@ -33,6 +33,8 @@ class IDESettings : SettingsFile {
ui.setFloatingDef("fontGamma", 0.8);
ui.setStringDef("uiFontFace", "Default");
ui.setIntegerDef("uiFontSize", 10);
ui.setBooleanDef("showToolbar", true);
ui.setBooleanDef("showStatusbar", true);
version (Windows) {
debuggerSettings.setStringDef("executable", "mago-mi");
} else {
@ -171,8 +173,18 @@ class IDESettings : SettingsFile {
@property bool showTabPositionMarks() { return editorSettings.getBoolean("showTabPositionMarks", true); }
/// 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
/// when true, toolbar is visible
@property bool showToolbar() { return uiSettings.getBoolean("showToolbar", true); }
/// when true, toolbar is visible
@property IDESettings showToolbar(bool enabled) { uiSettings.setBoolean("showToolbar", enabled); return this; }
/// when true, statusbar is visible
@property bool showStatusbar() { return uiSettings.getBoolean("showStatusbar", true); }
/// when true, statusbar is visible
@property IDESettings showStatusbar(bool enabled) { uiSettings.setBoolean("showStatusbar", 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

@ -1 +1 @@
v0.7.94
v0.7.95

View File

@ -57,6 +57,8 @@ MENU_EDIT_PREFERENCES=&Preferences
MENU_VIEW=&View
MENU_VIEW_SHOW_WHITESPACE_MARKS=Show whitespace marks
MENU_VIEW_SHOW_TAB_POSITIONS=Tab position marks
MENU_VIEW_SHOW_TOOLBAR=Show toolbar
MENU_VIEW_SHOW_STATUSBAR=Show statusbar
MENU_PROJECT=&Project
MENU_PROJECT_CONFIGURATIONS=Project configurations

View File

@ -57,6 +57,8 @@ MENU_EDIT_PREFERENCES=&Настройки...
MENU_VIEW=&Вид
MENU_VIEW_SHOW_WHITESPACE_MARKS=Видимые пробелы и табы
MENU_VIEW_SHOW_TAB_POSITIONS=Метки отступов
MENU_VIEW_SHOW_TOOLBAR=Панель инструментов
MENU_VIEW_SHOW_STATUSBAR=Строка состояния
MENU_PROJECT=&Проект
MENU_PROJECT_CONFIGURATIONS=Конфигурации проекта