mirror of https://github.com/buggins/dlangui.git
fixes for console mode; close issue #292
This commit is contained in:
parent
b5f4bc38eb
commit
d3a4f7df02
3
dub.json
3
dub.json
|
|
@ -30,6 +30,7 @@
|
|||
"--ex", "dimage.", "--ex", "fontconfig", "--ex", "src.dlangui"],
|
||||
|
||||
"sourceFiles-windows": ["$PACKAGE_DIR/src/win_app.def"],
|
||||
"excludedSourceFiles-windows": ["3rdparty/fontconfig/*"],
|
||||
|
||||
"subPackages": [
|
||||
"./examples/helloworld/",
|
||||
|
|
@ -66,7 +67,7 @@
|
|||
{
|
||||
"name": "console",
|
||||
"versions": ["USE_CONSOLE", "EmbedStandardResources"],
|
||||
"versions-windows": ["Unicode"]
|
||||
"excludedSourceFiles": ["3rdparty/*"]
|
||||
},
|
||||
{
|
||||
"name": "minimal",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
"sourceFiles-windows": ["$PACKAGE_DIR/src/win_app.def"],
|
||||
|
||||
"versions": ["EmbedStandardResources", "ForceLogs"],
|
||||
"versions": ["ForceLogs"],
|
||||
|
||||
"dependencies": {
|
||||
"dlangui": {"path": "../../"}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,18 @@
|
|||
"dlangui": {"path": "../../"}
|
||||
},
|
||||
|
||||
"subConfigurations": {
|
||||
"dlangui": "minimal"
|
||||
}
|
||||
"configurations" : [
|
||||
{
|
||||
"name" : "default",
|
||||
"subConfigurations" : {
|
||||
"dlangui" : "minimal"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "console",
|
||||
"subConfigurations" : {
|
||||
"dlangui" : "console"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ mixin APP_ENTRY_POINT;
|
|||
|
||||
/// entry point for dlangui based application
|
||||
extern (C) int UIAppMain(string[] args) {
|
||||
|
||||
// load theme from file "theme_default.xml"
|
||||
Platform.instance.uiTheme = "theme_default";
|
||||
|
||||
// create window
|
||||
Log.d("Creating window");
|
||||
if (!Platform.instance) {
|
||||
Log.e("Platform.instance is null!!!");
|
||||
}
|
||||
Window window = Platform.instance.createWindow("DlangUI example - HelloWorld", null);
|
||||
Log.d("Window created");
|
||||
|
||||
|
|
@ -18,10 +19,9 @@ extern (C) int UIAppMain(string[] args) {
|
|||
//window.mainWidget = (new Button()).text("Hello, world!"d).margins(Rect(20,20,20,20));
|
||||
window.mainWidget = parseML(q{
|
||||
VerticalLayout {
|
||||
margins: 10
|
||||
padding: 10
|
||||
margins: 10pt
|
||||
padding: 10pt
|
||||
layoutWidth: fill
|
||||
backgroundColor: "#C0E0E070" // semitransparent yellow background
|
||||
// red bold text with size = 150% of base style size and font face Arial
|
||||
TextWidget { text: "Hello World example for DlangUI"; textColor: "red"; fontSize: 150%; fontWeight: 800; fontFace: "Arial" }
|
||||
// arrange controls as form - table with two columns
|
||||
|
|
@ -46,10 +46,10 @@ extern (C) int UIAppMain(string[] args) {
|
|||
layoutWidth: fill
|
||||
CheckBox { id: cb1; text: "checkbox 1" }
|
||||
CheckBox { id: cb2; text: "checkbox 2" }
|
||||
ComboEdit { id: ce1; text: "some text"; minWidth: 100; items: ["Item 1", "Item 2", "Additional item"] }
|
||||
ComboEdit { id: ce1; text: "some text"; minWidth: 20pt; items: ["Item 1", "Item 2", "Additional item"] }
|
||||
}
|
||||
}
|
||||
EditBox { layoutWidth: 300; layoutHeight: 80 }
|
||||
EditBox { layoutWidth: 20pt; layoutHeight: 10pt }
|
||||
HorizontalLayout {
|
||||
Button { id: btnOk; text: "Ok" }
|
||||
Button { id: btnCancel; text: "Cancel" }
|
||||
|
|
|
|||
|
|
@ -273,7 +273,9 @@ private bool parseLength(ref string src, ref CssValue value)
|
|||
ident = parseIdent(src);
|
||||
if (!ident.empty) {
|
||||
switch(ident) {
|
||||
case "em": value.type = CssValueType.em; break;
|
||||
case "em":
|
||||
case "m": // for DML - cannot add suffix which starts from 'e'
|
||||
value.type = CssValueType.em; break;
|
||||
case "pt": value.type = CssValueType.pt; break;
|
||||
case "ex": value.type = CssValueType.ex; break;
|
||||
case "px": value.type = CssValueType.px; break;
|
||||
|
|
|
|||
|
|
@ -284,10 +284,14 @@ private __gshared int PRIVATE_SCREEN_DPI = 96;
|
|||
}
|
||||
|
||||
@property void SCREEN_DPI(int dpi) {
|
||||
if (dpi >= 72 && dpi <= 500) {
|
||||
if (PRIVATE_SCREEN_DPI != dpi) {
|
||||
// changed DPI
|
||||
PRIVATE_SCREEN_DPI = dpi;
|
||||
static if (BACKEND_CONSOLE) {
|
||||
PRIVATE_SCREEN_DPI = dpi;
|
||||
} else {
|
||||
if (dpi >= 72 && dpi <= 500) {
|
||||
if (PRIVATE_SCREEN_DPI != dpi) {
|
||||
// changed DPI
|
||||
PRIVATE_SCREEN_DPI = dpi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ class MLParser {
|
|||
// do nothing, value is in px by default
|
||||
} else if (suffix.equal("pt")) {
|
||||
value = makePointSize(value);
|
||||
} else if (suffix.equal("m") || suffix.equal("em")) {
|
||||
// todo: implement EMs
|
||||
value = makePointSize(value);
|
||||
} else if (suffix.equal("%")) {
|
||||
value = makePercentSize(value);
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.gldrawbuf;
|
||||
|
||||
public import dlangui.core.config;
|
||||
static if (BACKEND_GUI):
|
||||
static if (ENABLE_OPENGL):
|
||||
|
||||
import dlangui.graphics.drawbuf;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.glsupport;
|
||||
|
||||
public import dlangui.core.config;
|
||||
static if (BACKEND_GUI):
|
||||
static if (ENABLE_OPENGL):
|
||||
|
||||
public import dlangui.core.math3d;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.images;
|
||||
|
||||
public import dlangui.core.config;
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
//version = USE_DEIMAGE;
|
||||
//version = USE_DLIBIMAGE;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.camera;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.graphics.scene.node;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.drawableobject;
|
|||
|
||||
import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.types;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.effect;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.types;
|
||||
import dlangui.core.logger;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.fbximport;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.logger;
|
||||
import dlangui.core.math3d;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.light;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.math3d;
|
||||
import dlangui.core.types;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.material;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.types;
|
||||
import dlangui.core.logger;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.mesh;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.math3d;
|
||||
import dlangui.core.types;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.model;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.graphics.scene.drawableobject;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.node;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.math3d;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.objimport;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.logger;
|
||||
import dlangui.core.math3d;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.scene3d;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.types;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.skybox;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.math3d;
|
||||
import dlangui.graphics.scene.node;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module dlangui.graphics.scene.transform;
|
|||
|
||||
public import dlangui.core.config;
|
||||
static if (ENABLE_OPENGL):
|
||||
static if (BACKEND_GUI):
|
||||
|
||||
import dlangui.core.math3d;
|
||||
import dlangui.core.types;
|
||||
|
|
|
|||
Loading…
Reference in New Issue