From 3d90b7b992bd61fc75dc241257b96737fd40a137 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 10 Mar 2015 10:46:36 +0300 Subject: [PATCH] themed editor; dark theme fixes; fix project for search feature --- dlangide.visualdproj | 1 + src/dlangide/ui/dsourceedit.d | 15 +++++++++------ src/dlangide/ui/settings.d | 6 +++--- views/res/ide_theme_dark.xml | 10 ++++++++++ views/res/ide_theme_default.xml | 8 ++++++++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/dlangide.visualdproj b/dlangide.visualdproj index 51867a8..aaf310a 100644 --- a/dlangide.visualdproj +++ b/dlangide.visualdproj @@ -241,6 +241,7 @@ + diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index 3813404..ef08bdb 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -25,12 +25,7 @@ class DSourceEdit : SourceEdit { super(ID); styleId = null; backgroundColor = style.customColor("edit_background"); - setTokenHightlightColor(TokenCategory.Comment, 0x008000); // green - setTokenHightlightColor(TokenCategory.Keyword, 0x0000FF); // blue - setTokenHightlightColor(TokenCategory.String, 0xA31515); // brown - setTokenHightlightColor(TokenCategory.Character, 0xA31515); // brown - setTokenHightlightColor(TokenCategory.Error, 0xFF0000); // red - setTokenHightlightColor(TokenCategory.Comment_Documentation, 0x206000); + onThemeChanged(); //setTokenHightlightColor(TokenCategory.Identifier, 0x206000); // no colors MenuItem editPopupItem = new MenuItem(null); editPopupItem.add(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_EDIT_UNDO, ACTION_EDIT_REDO, ACTION_EDIT_INDENT, ACTION_EDIT_UNINDENT, ACTION_EDIT_TOGGLE_LINE_COMMENT, ACTION_GET_COMPLETIONS, ACTION_GO_TO_DEFINITION); @@ -46,6 +41,14 @@ class DSourceEdit : SourceEdit { /// handle theme change: e.g. reload some themed resources override void onThemeChanged() { backgroundColor = style.customColor("edit_background"); + setTokenHightlightColor(TokenCategory.Comment, style.customColor("syntax_highlight_comment")); // green + setTokenHightlightColor(TokenCategory.Keyword, style.customColor("syntax_highlight_keyword")); // blue + setTokenHightlightColor(TokenCategory.String, style.customColor("syntax_highlight_string")); // brown + setTokenHightlightColor(TokenCategory.Character, style.customColor("syntax_highlight_character")); // brown + setTokenHightlightColor(TokenCategory.Error, style.customColor("syntax_highlight_error")); // red + setTokenHightlightColor(TokenCategory.Comment_Documentation, style.customColor("syntax_highlight_comment_documentation")); + + super.onThemeChanged(); } protected IDESettings _settings; diff --git a/src/dlangide/ui/settings.d b/src/dlangide/ui/settings.d index 5c51ffe..61da088 100644 --- a/src/dlangide/ui/settings.d +++ b/src/dlangide/ui/settings.d @@ -7,7 +7,7 @@ import dlangui.widgets.lists; import dlangui.dialogs.settingsdialog; -const AVAILABLE_THEMES = ["theme_default", "theme_dark"]; +const AVAILABLE_THEMES = ["ide_theme_default", "ide_theme_dark"]; const AVAILABLE_LANGUAGES = ["en", "ru"]; class IDESettings : SettingsFile { @@ -23,7 +23,7 @@ class IDESettings : SettingsFile { ed.setBooleanDef("smartIndents", true); ed.setBooleanDef("smartIndentsAfterPaste", true); Setting ui = uiSettings(); - ui.setStringDef("theme", "theme_default"); + ui.setStringDef("theme", "ide_theme_default"); ui.setStringDef("language", "en"); ui.setIntegerDef("hintingMode", 1); ui.setIntegerDef("minAntialiasedFontSize", 0); @@ -62,7 +62,7 @@ class IDESettings : SettingsFile { /// theme @property string uiTheme() { - return limitString(uiSettings.getString("theme", "theme_default"), AVAILABLE_THEMES); + return limitString(uiSettings.getString("theme", "ide_theme_default"), AVAILABLE_THEMES); } /// theme @property IDESettings uiTheme(string v) { diff --git a/views/res/ide_theme_dark.xml b/views/res/ide_theme_dark.xml index bb43ee9..a7ad875 100644 --- a/views/res/ide_theme_dark.xml +++ b/views/res/ide_theme_dark.xml @@ -7,5 +7,15 @@ > + + + + + + + + + + diff --git a/views/res/ide_theme_default.xml b/views/res/ide_theme_default.xml index b3561b8..111e03e 100644 --- a/views/res/ide_theme_default.xml +++ b/views/res/ide_theme_default.xml @@ -6,6 +6,14 @@ > + + + + + + + +