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