fix console mode parent theme loading

This commit is contained in:
Vadim Lopatin 2016-09-12 10:45:43 +03:00
parent 79790c0654
commit 3bb6d95cbb
3 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,7 @@ module dlangui.platforms.windows.win32drawbuf;
version(Windows): version(Windows):
public import dlangui.core.config; public import dlangui.core.config;
static if (BACKEND_GUI):
import core.sys.windows.windows; import core.sys.windows.windows;
import dlangui.core.logger; import dlangui.core.logger;

View File

@ -23,6 +23,7 @@ module dlangui.platforms.windows.win32fonts;
version(Windows): version(Windows):
public import dlangui.core.config; public import dlangui.core.config;
static if (BACKEND_GUI):
import core.sys.windows.windows; import core.sys.windows.windows;
import dlangui.graphics.fonts; import dlangui.graphics.fonts;

View File

@ -23,6 +23,8 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
*/ */
module dlangui.widgets.styles; module dlangui.widgets.styles;
import dlangui.core.config;
private import std.xml; private import std.xml;
private import std.string; private import std.string;
private import std.algorithm; private import std.algorithm;
@ -1542,7 +1544,7 @@ bool loadTheme(Theme theme, string resourceId, int level = 0) {
string filename; string filename;
try { try {
filename = drawableCache.findResource(resourceId); filename = drawableCache.findResource(BACKEND_CONSOLE ? "console_" ~ resourceId : resourceId);
if (!filename || !filename.endsWith(".xml")) if (!filename || !filename.endsWith(".xml"))
return false; return false;
string s = cast(string)loadResourceBytes(filename); string s = cast(string)loadResourceBytes(filename);
@ -1567,7 +1569,7 @@ bool loadTheme(Theme theme, string resourceId, int level = 0) {
/// load theme from XML file (null if failed) /// load theme from XML file (null if failed)
Theme loadTheme(string resourceId) { Theme loadTheme(string resourceId) {
Theme res = new Theme(resourceId); Theme res = new Theme(resourceId);
if (loadTheme(res, BACKEND_CONSOLE ? "console_" ~ resourceId : resourceId)) { if (loadTheme(res, resourceId)) {
res.id = resourceId; res.id = resourceId;
return res; return res;
} }