setting to override screen DPI detected by platform - close #336

This commit is contained in:
Vadim Lopatin 2017-09-29 10:58:18 +03:00
parent 6fd6387df6
commit 325915097a
6 changed files with 35 additions and 1 deletions

View File

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

View File

@ -1575,11 +1575,18 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
currentTheme.fontFace = newFontFace;
needUpdateTheme = true;
}
if (overrideScreenDPI != settings.screenDpiOverride) {
overrideScreenDPI = settings.screenDpiOverride;
needUpdateTheme = true;
}
if (oldFontSize != settings.uiFontSize) {
currentTheme.fontSize = settings.uiFontSize;
needUpdateTheme = true;
}
if (needUpdateTheme) {
drawableCache.clear();
imageCache.checkpoint();
imageCache.cleanup();
Log.d("updating theme after UI font change");
Platform.instance.onThemeChanged();
}

View File

@ -117,6 +117,17 @@ SettingsPage createSettingsPages() {
StringListValue(1700, "1.7 "d),
StringListValue(2000, "2.0 "d)]);
ui.addIntComboBox("interface/screenDpiOverride", UIString.fromId("OPTION_SCREEN_DPI_OVERRIDE"c),
[StringListValue(0, UIString.fromId("OPTION_SCREEN_DPI_OVERRIDE_NONE"c).value ~ " ("d ~ to!dstring(systemScreenDPI) ~ ")"d),
StringListValue(72, "72"d),
StringListValue(96, "96"d),
StringListValue(120, "120"d),
StringListValue(140, "140"d),
StringListValue(150, "150"d),
StringListValue(300, "300"d),
StringListValue(400, "400"d),
StringListValue(600, "600"d)]);
SettingsPage ed = res.addChild("editors", UIString.fromId("OPTION_EDITORS"c));
SettingsPage texted = ed.addChild("editors/textEditor", UIString.fromId("OPTION_TEXT_EDITORS"c));

View File

@ -35,6 +35,7 @@ class IDESettings : SettingsFile {
ui.setIntegerDef("uiFontSize", 11);
ui.setBooleanDef("showToolbar", true);
ui.setBooleanDef("showStatusbar", true);
ui.setIntegerDef("screenDpiOverride", 0);
version (Windows) {
debuggerSettings.setStringDef("executable", "mago-mi");
} else {
@ -129,6 +130,17 @@ class IDESettings : SettingsFile {
return this;
}
/// to allow overriding detected screen DPI
@property int screenDpiOverride() {
return cast(int)uiSettings.getInteger("screenDpiOverride", 0);
}
/// to allow overriding detected screen DPI
@property IDESettings screenDpiOverride(int newDpi) {
uiSettings.setInteger("screenDpiOverride", newDpi);
return this;
}
/// UI font face
@property string uiFontFace() {
return uiSettings.getString("uiFontFace", "Default");

View File

@ -183,6 +183,8 @@ OPTION_FONT_HINTING_LIGHT=LIGHT
OPTION_FONT_FACE=Font face
OPTION_FONT_SIZE=Font face
OPTION_FONT_GAMMA=Font gamma
OPTION_SCREEN_DPI_OVERRIDE=Override screen DPI
OPTION_SCREEN_DPI_OVERRIDE_NONE=Use screen DPI
OPTION_GDC_EXECUTABLE=GDC executable
OPTION_LANGUAGE=Language
OPTION_LDC2_EXECUTABLE=LDC2 executable

View File

@ -181,6 +181,8 @@ OPTION_FONT_HINTING_LIGHT=Частично
OPTION_FONT_HINTING_NORMAL=Нормально
OPTION_FONT_FACE=Имя шрифта
OPTION_FONT_GAMMA=Контрастность шрифта
OPTION_SCREEN_DPI_OVERRIDE=Подмена DPI экрана
OPTION_SCREEN_DPI_OVERRIDE_NONE=Не менять DPI
OPTION_GDC_EXECUTABLE=Исполняемый файл GDC
OPTION_LANGUAGE=Язык
OPTION_LDC2_EXECUTABLE=Исполняемый файл LDC2