mirror of https://github.com/buggins/dlangui.git
commit
2184396216
|
@ -103,7 +103,6 @@ ubyte tokenCategory(ubyte t) {
|
||||||
dstring[] splitDString(dstring source, dchar delimiter = EOL) {
|
dstring[] splitDString(dstring source, dchar delimiter = EOL) {
|
||||||
int start = 0;
|
int start = 0;
|
||||||
dstring[] res;
|
dstring[] res;
|
||||||
dchar lastchar;
|
|
||||||
for (int i = 0; i <= source.length; i++) {
|
for (int i = 0; i <= source.length; i++) {
|
||||||
if (i == source.length || source[i] == delimiter) {
|
if (i == source.length || source[i] == delimiter) {
|
||||||
if (i >= start) {
|
if (i >= start) {
|
||||||
|
@ -173,10 +172,10 @@ struct TextPosition {
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
inout bool opEquals(ref inout TextPosition v) {
|
bool opEquals(ref inout TextPosition v) inout {
|
||||||
return line == v.line && pos == v.pos;
|
return line == v.line && pos == v.pos;
|
||||||
}
|
}
|
||||||
@property string toString() {
|
@property string toString() const {
|
||||||
return to!string(line) ~ ":" ~ to!string(pos);
|
return to!string(line) ~ ":" ~ to!string(pos);
|
||||||
}
|
}
|
||||||
/// adds deltaPos to position and returns result
|
/// adds deltaPos to position and returns result
|
||||||
|
@ -212,7 +211,7 @@ struct TextRange {
|
||||||
@property int lines() const {
|
@property int lines() const {
|
||||||
return end.line - start.line + 1;
|
return end.line - start.line + 1;
|
||||||
}
|
}
|
||||||
@property string toString() {
|
@property string toString() const {
|
||||||
return "[" ~ start.toString ~ ":" ~ end.toString ~ "]";
|
return "[" ~ start.toString ~ ":" ~ end.toString ~ "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -856,7 +855,7 @@ class EditableContent {
|
||||||
|
|
||||||
/// returns text range for whole line lineIndex
|
/// returns text range for whole line lineIndex
|
||||||
TextRange lineRange(int lineIndex) {
|
TextRange lineRange(int lineIndex) {
|
||||||
return TextRange(TextPosition(lineIndex, 0), lineIndex < _lines.length - 1 ? lineBegin(lineIndex + 1) : lineEnd(lineIndex));
|
return TextRange(TextPosition(lineIndex, 0), lineIndex < cast(int)_lines.length - 1 ? lineBegin(lineIndex + 1) : lineEnd(lineIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find nearest next tab position
|
/// find nearest next tab position
|
||||||
|
|
|
@ -359,8 +359,7 @@ string[] splitPath(string path) {
|
||||||
|
|
||||||
/// for executable name w/o path, find absolute path to executable
|
/// for executable name w/o path, find absolute path to executable
|
||||||
string findExecutablePath(string executableName) {
|
string findExecutablePath(string executableName) {
|
||||||
import std.algorithm;
|
import std.string : split;
|
||||||
import std.string;
|
|
||||||
version (Windows) {
|
version (Windows) {
|
||||||
if (!executableName.endsWith(".exe"))
|
if (!executableName.endsWith(".exe"))
|
||||||
executableName = executableName ~ ".exe";
|
executableName = executableName ~ ".exe";
|
||||||
|
|
|
@ -280,7 +280,6 @@ synchronized class UIStringTranslator {
|
||||||
/** Looks for i18n directory inside one of passed dirs, and uses first found as directory to read i18n files from */
|
/** Looks for i18n directory inside one of passed dirs, and uses first found as directory to read i18n files from */
|
||||||
void findTranslationsDir(string[] dirs ...) {
|
void findTranslationsDir(string[] dirs ...) {
|
||||||
_resourceDirs.length = 0;
|
_resourceDirs.length = 0;
|
||||||
import std.file;
|
|
||||||
foreach(dir; dirs) {
|
foreach(dir; dirs) {
|
||||||
string path = appendPath(dir, "i18n/");
|
string path = appendPath(dir, "i18n/");
|
||||||
if (exists(path) && isDir(path)) {
|
if (exists(path) && isDir(path)) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public enum EncodingType : int {
|
||||||
ASCII,
|
ASCII,
|
||||||
/// encoding is unknown
|
/// encoding is unknown
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
};
|
}
|
||||||
/// Line ending style
|
/// Line ending style
|
||||||
public enum LineEnding : int {
|
public enum LineEnding : int {
|
||||||
/// LF (0x0A) - unix style
|
/// LF (0x0A) - unix style
|
||||||
|
@ -95,7 +95,7 @@ struct TextFileFormat {
|
||||||
LineEnding lineEnding;
|
LineEnding lineEnding;
|
||||||
/// byte order mark character flag
|
/// byte order mark character flag
|
||||||
bool bom;
|
bool bom;
|
||||||
string toString() {
|
string toString() const {
|
||||||
return to!string(encoding) ~ " " ~ to!string(lineEnding) ~ (bom ? " bom" : "");
|
return to!string(encoding) ~ " " ~ to!string(lineEnding) ~ (bom ? " bom" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ class LineStream {
|
||||||
public enum ErrorCodes {
|
public enum ErrorCodes {
|
||||||
/// invalid character for current encoding
|
/// invalid character for current encoding
|
||||||
INVALID_CHARACTER
|
INVALID_CHARACTER
|
||||||
};
|
}
|
||||||
|
|
||||||
private InputStream _stream;
|
private InputStream _stream;
|
||||||
private string _filename;
|
private string _filename;
|
||||||
|
@ -596,7 +596,7 @@ private class Utf8LineStream : LineStream {
|
||||||
invalidCharFlag = true;
|
invalidCharFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ch = ((ch0 & 0x1F) << 6) | ((ch1 & 0x3F));
|
ch = ((ch0 & 0x1F) << 6) | (ch1 & 0x3F);
|
||||||
bread = 2;
|
bread = 2;
|
||||||
} if ((ch0 & 0xF0) == 0xE0) {
|
} if ((ch0 & 0xF0) == 0xE0) {
|
||||||
// three bytes 1110xxxx 10xxxxxx 10xxxxxx
|
// three bytes 1110xxxx 10xxxxxx 10xxxxxx
|
||||||
|
@ -608,7 +608,7 @@ private class Utf8LineStream : LineStream {
|
||||||
invalidCharFlag = true;
|
invalidCharFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ch = ((ch0 & 0x0F) << 12) | ((ch1 & 0x1F) << 6) | ((ch2 & 0x3F));
|
ch = ((ch0 & 0x0F) << 12) | ((ch1 & 0x1F) << 6) | (ch2 & 0x3F);
|
||||||
bread = 3;
|
bread = 3;
|
||||||
} if ((ch0 & 0xF8) == 0xF0) {
|
} if ((ch0 & 0xF8) == 0xF0) {
|
||||||
// four bytes 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
// four bytes 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
|
@ -621,7 +621,7 @@ private class Utf8LineStream : LineStream {
|
||||||
invalidCharFlag = true;
|
invalidCharFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ch = ((ch0 & 0x07) << 18) | ((ch1 & 0x3F) << 12) | ((ch2 & 0x3F) << 6) | ((ch3 & 0x3F));
|
ch = ((ch0 & 0x07) << 18) | ((ch1 & 0x3F) << 12) | ((ch2 & 0x3F) << 6) | (ch3 & 0x3F);
|
||||||
bread = 4;
|
bread = 4;
|
||||||
} if ((ch0 & 0xFC) == 0xF8) {
|
} if ((ch0 & 0xFC) == 0xF8) {
|
||||||
// five bytes 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
|
// five bytes 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
|
@ -635,7 +635,7 @@ private class Utf8LineStream : LineStream {
|
||||||
invalidCharFlag = true;
|
invalidCharFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ch = ((ch0 & 0x03) << 24) | ((ch1 & 0x3F) << 18) | ((ch2 & 0x3F) << 12) | ((ch3 & 0x3F) << 6) | ((ch4 & 0x3F));
|
ch = ((ch0 & 0x03) << 24) | ((ch1 & 0x3F) << 18) | ((ch2 & 0x3F) << 12) | ((ch3 & 0x3F) << 6) | (ch4 & 0x3F);
|
||||||
bread = 5;
|
bread = 5;
|
||||||
} if ((ch0 & 0xFE) == 0xFC) {
|
} if ((ch0 & 0xFE) == 0xFC) {
|
||||||
// six bytes 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
|
// six bytes 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
|
@ -650,7 +650,7 @@ private class Utf8LineStream : LineStream {
|
||||||
invalidCharFlag = true;
|
invalidCharFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ch = ((ch0 & 0x01) << 30) | ((ch1 & 0x3F) << 24) | ((ch2 & 0x3F) << 18) | ((ch3 & 0x3F) << 12) | ((ch4 & 0x3F) << 6) | ((ch5 & 0x3F));
|
ch = ((ch0 & 0x01) << 30) | ((ch1 & 0x3F) << 24) | ((ch2 & 0x3F) << 18) | ((ch3 & 0x3F) << 12) | ((ch4 & 0x3F) << 6) | (ch5 & 0x3F);
|
||||||
bread = 5;
|
bread = 5;
|
||||||
}
|
}
|
||||||
if ((ch >= 0xd800 && ch < 0xe000) || (ch > 0x10FFFF)) {
|
if ((ch >= 0xd800 && ch < 0xe000) || (ch > 0x10FFFF)) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ class SourceFile {
|
||||||
public this(string filename) {
|
public this(string filename) {
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
}
|
}
|
||||||
override @property string toString() {
|
override @property string toString() const {
|
||||||
return _filename;
|
return _filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ struct Rect {
|
||||||
return left >= rc.left && right <= rc.right && top >= rc.top && bottom <= rc.bottom;
|
return left >= rc.left && right <= rc.right && top >= rc.top && bottom <= rc.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool opEquals(Rect rc) {
|
bool opEquals(Rect rc) const {
|
||||||
return left == rc.left && right == rc.right && top == rc.top && bottom == rc.bottom;
|
return left == rc.left && right == rc.right && top == rc.top && bottom == rc.bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ class DMLSyntaxSupport : SyntaxSupport {
|
||||||
static struct TokenWithRange {
|
static struct TokenWithRange {
|
||||||
Token token;
|
Token token;
|
||||||
TextRange range;
|
TextRange range;
|
||||||
@property string toString() {
|
@property string toString() const {
|
||||||
return token.toString ~ range.toString;
|
return token.toString ~ range.toString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,6 @@ class DMLSyntaxSupport : SyntaxSupport {
|
||||||
for (int i = range.start.line; i <= range.end.line; i++) {
|
for (int i = range.start.line; i <= range.end.line; i++) {
|
||||||
dstring s = content.line(i);
|
dstring s = content.line(i);
|
||||||
int charsRemoved = 0;
|
int charsRemoved = 0;
|
||||||
int minp = 0;
|
|
||||||
if (i == range.start.line) {
|
if (i == range.start.line) {
|
||||||
int maxp = content.lineLength(range.start.line);
|
int maxp = content.lineLength(range.start.line);
|
||||||
if (i == range.end.line)
|
if (i == range.end.line)
|
||||||
|
@ -594,7 +593,6 @@ class DMLSyntaxSupport : SyntaxSupport {
|
||||||
if (line == 0)
|
if (line == 0)
|
||||||
return; // not for first line
|
return; // not for first line
|
||||||
int prevLine = line - 1;
|
int prevLine = line - 1;
|
||||||
dstring lineText = _content.line(line);
|
|
||||||
TextLineMeasure lineMeasurement = _content.measureLine(line);
|
TextLineMeasure lineMeasurement = _content.measureLine(line);
|
||||||
TextLineMeasure prevLineMeasurement = _content.measureLine(prevLine);
|
TextLineMeasure prevLineMeasurement = _content.measureLine(prevLine);
|
||||||
while (prevLineMeasurement.empty && prevLine > 0) {
|
while (prevLineMeasurement.empty && prevLine > 0) {
|
||||||
|
@ -636,8 +634,6 @@ class DMLSyntaxSupport : SyntaxSupport {
|
||||||
if (lineMeasurement.firstNonSpace != op.newRange.start.pos)
|
if (lineMeasurement.firstNonSpace != op.newRange.start.pos)
|
||||||
return; // not in beginning of line
|
return; // not in beginning of line
|
||||||
if (lineMeasurement.firstNonSpaceX >= 0 && lineMeasurement.firstNonSpaceX != prevLineMeasurement.firstNonSpaceX) {
|
if (lineMeasurement.firstNonSpaceX >= 0 && lineMeasurement.firstNonSpaceX != prevLineMeasurement.firstNonSpaceX) {
|
||||||
dstring prevLineText = _content.line(prevLine);
|
|
||||||
TokenPropString prevLineTokenProps = _content.lineTokenProps(prevLine);
|
|
||||||
int spacex = prevLineMeasurement.firstNonSpaceX;
|
int spacex = prevLineMeasurement.firstNonSpaceX;
|
||||||
if (spacex != lineMeasurement.firstNonSpaceX) {
|
if (spacex != lineMeasurement.firstNonSpaceX) {
|
||||||
dstring txt = _content.fillSpace(spacex);
|
dstring txt = _content.fillSpace(spacex);
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct Token {
|
||||||
int intvalue;
|
int intvalue;
|
||||||
double floatvalue;
|
double floatvalue;
|
||||||
}
|
}
|
||||||
public @property string toString() {
|
public @property string toString() const {
|
||||||
if (type == TokenType.integer)
|
if (type == TokenType.integer)
|
||||||
return "" ~ to!string(line) ~ ":" ~ to!string(pos) ~ " " ~ to!string(type) ~ " " ~ to!string(intvalue);
|
return "" ~ to!string(line) ~ ":" ~ to!string(pos) ~ " " ~ to!string(type) ~ " " ~ to!string(intvalue);
|
||||||
else if (type == TokenType.floating)
|
else if (type == TokenType.floating)
|
||||||
|
@ -163,7 +163,7 @@ class Tokenizer {
|
||||||
enum : int {
|
enum : int {
|
||||||
EOF_CHAR = 0x001A,
|
EOF_CHAR = 0x001A,
|
||||||
EOL_CHAR = 0x000A
|
EOL_CHAR = 0x000A
|
||||||
};
|
}
|
||||||
|
|
||||||
this(string source, string filename = "") {
|
this(string source, string filename = "") {
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
|
|
|
@ -871,7 +871,6 @@ class GrayDrawBuf : DrawBuf {
|
||||||
int srcdx = glyph.blackBoxX;
|
int srcdx = glyph.blackBoxX;
|
||||||
int srcdy = glyph.blackBoxY;
|
int srcdy = glyph.blackBoxY;
|
||||||
bool clipping = true; //!_clipRect.empty();
|
bool clipping = true; //!_clipRect.empty();
|
||||||
ubyte cl = cast(ubyte)(color & 255);
|
|
||||||
for (int yy = 0; yy < srcdy; yy++) {
|
for (int yy = 0; yy < srcdy; yy++) {
|
||||||
int liney = y + yy;
|
int liney = y + yy;
|
||||||
if (clipping && (liney < _clipRect.top || liney >= _clipRect.bottom))
|
if (clipping && (liney < _clipRect.top || liney >= _clipRect.bottom))
|
||||||
|
|
|
@ -886,7 +886,7 @@ struct glyph_gamma_table(int maxv = 65)
|
||||||
private:
|
private:
|
||||||
ubyte[maxv] _map;
|
ubyte[maxv] _map;
|
||||||
double _gamma = 1.0;
|
double _gamma = 1.0;
|
||||||
};
|
}
|
||||||
|
|
||||||
__gshared glyph_gamma_table!65 _gamma65;
|
__gshared glyph_gamma_table!65 _gamma65;
|
||||||
__gshared glyph_gamma_table!256 _gamma256;
|
__gshared glyph_gamma_table!256 _gamma256;
|
||||||
|
|
|
@ -554,7 +554,7 @@ class FreeTypeFontManager : FontManager {
|
||||||
Log.v("DerelictFT: Missing symbols callback is registered");
|
Log.v("DerelictFT: Missing symbols callback is registered");
|
||||||
DerelictFT.load();
|
DerelictFT.load();
|
||||||
Log.v("DerelictFT: Loaded");
|
Log.v("DerelictFT: Loaded");
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
Log.e("Derelict: cannot load freetype shared library: ", e.msg);
|
Log.e("Derelict: cannot load freetype shared library: ", e.msg);
|
||||||
throw new Exception("Cannot load freetype library");
|
throw new Exception("Cannot load freetype library");
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,7 @@ private class GLImageCache {
|
||||||
removePage(item.page);
|
removePage(item.page);
|
||||||
}
|
}
|
||||||
_map.remove(objectId);
|
_map.remove(objectId);
|
||||||
delete item;
|
destroy(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,6 @@ private class GLGlyphCache {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Log.d("updateTexture for font glyph page - setting image ", _drawbuf.width, "x", _drawbuf.height, " tx=", _texture.ID);
|
//Log.d("updateTexture for font glyph page - setting image ", _drawbuf.width, "x", _drawbuf.height, " tx=", _texture.ID);
|
||||||
int len = _drawbuf.width * _drawbuf.height;
|
|
||||||
if (!glSupport.setTextureImage(_texture, _drawbuf.width, _drawbuf.height, cast(ubyte *)_drawbuf.scanLine(0))) {
|
if (!glSupport.setTextureImage(_texture, _drawbuf.width, _drawbuf.height, cast(ubyte *)_drawbuf.scanLine(0))) {
|
||||||
destroy(_texture);
|
destroy(_texture);
|
||||||
_texture = null;
|
_texture = null;
|
||||||
|
@ -839,7 +838,7 @@ private class GLGlyphCache {
|
||||||
removePage(item.page);
|
removePage(item.page);
|
||||||
}
|
}
|
||||||
_map.remove(objectId);
|
_map.remove(objectId);
|
||||||
delete item;
|
destroy(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -924,8 +923,7 @@ public:
|
||||||
}
|
}
|
||||||
override void draw() {
|
override void draw() {
|
||||||
if (_handler) {
|
if (_handler) {
|
||||||
import derelict.opengl3.gl3;
|
import derelict.opengl3.gl3 : glViewport;
|
||||||
import derelict.opengl3.gl;
|
|
||||||
glViewport(_rc.left, _rc.top, _rc.right, _rc.bottom);
|
glViewport(_rc.left, _rc.top, _rc.right, _rc.bottom);
|
||||||
_handler(_buf, _rc);
|
_handler(_buf, _rc);
|
||||||
glSupport.setOrthoProjection(Rect(0, 0, _buf.width, _buf.height));
|
glSupport.setOrthoProjection(Rect(0, 0, _buf.width, _buf.height));
|
||||||
|
|
|
@ -103,14 +103,19 @@ class GLProgram {
|
||||||
private void compatibilityFixes(ref char[] code, GLuint type) {
|
private void compatibilityFixes(ref char[] code, GLuint type) {
|
||||||
if (glslversionInt < 150) {
|
if (glslversionInt < 150) {
|
||||||
code = replace(code, " texture(", " texture2D(");
|
code = replace(code, " texture(", " texture2D(");
|
||||||
code = replace(code, "in ", "");
|
if(type == GL_VERTEX_SHADER)
|
||||||
code = replace(code, "out ", "");
|
{
|
||||||
}
|
code = replace(code, "in ", "attribute ");
|
||||||
|
code = replace(code, "out ", "varying ");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
code = replace(code, "in ", "varying ");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GLuint compileShader(string src, GLuint type) {
|
private GLuint compileShader(string src, GLuint type) {
|
||||||
import core.stdc.stdlib;
|
import std.string : toStringz, fromStringz;
|
||||||
import std.string;
|
|
||||||
|
|
||||||
char[] sourceCode;
|
char[] sourceCode;
|
||||||
sourceCode ~= "#version ";
|
sourceCode ~= "#version ";
|
||||||
|
@ -202,10 +207,6 @@ class GLProgram {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
immutable string HIGHP = "";
|
|
||||||
immutable string LOWP = "";
|
|
||||||
immutable string MEDIUMP = "";
|
|
||||||
|
|
||||||
class SolidFillProgram : GLProgram {
|
class SolidFillProgram : GLProgram {
|
||||||
@property override string vertexSource() {
|
@property override string vertexSource() {
|
||||||
return q{
|
return q{
|
||||||
|
@ -698,8 +699,8 @@ class GLSupport {
|
||||||
|
|
||||||
// don't flip for framebuffer
|
// don't flip for framebuffer
|
||||||
if (currentFBO) {
|
if (currentFBO) {
|
||||||
dsty0 = cast(float)((yy));
|
dsty0 = cast(float)(yy);
|
||||||
dsty1 = cast(float)((yy + dy));
|
dsty1 = cast(float)(yy + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
float srcx0 = srcx / cast(float)tdx;
|
float srcx0 = srcx / cast(float)tdx;
|
||||||
|
@ -763,8 +764,8 @@ class GLSupport {
|
||||||
|
|
||||||
// don't flip for framebuffer
|
// don't flip for framebuffer
|
||||||
if (currentFBO) {
|
if (currentFBO) {
|
||||||
dsty0 = cast(float)((yy));
|
dsty0 = cast(float)(yy);
|
||||||
dsty1 = cast(float)((yy + dy));
|
dsty1 = cast(float)(yy + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
float srcx0 = srcx / cast(float)tdx;
|
float srcx0 = srcx / cast(float)tdx;
|
||||||
|
|
|
@ -69,7 +69,7 @@ ColorDrawBuf loadImage(immutable ubyte[] data, string filename) {
|
||||||
|
|
||||||
import std.algorithm : endsWith;
|
import std.algorithm : endsWith;
|
||||||
if (filename.endsWith(".xpm")) {
|
if (filename.endsWith(".xpm")) {
|
||||||
import dlangui.graphics.xpm.reader;
|
import dlangui.graphics.xpm.reader : parseXPM;
|
||||||
try {
|
try {
|
||||||
return parseXPM(data);
|
return parseXPM(data);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ ColorDrawBuf loadImage(immutable ubyte[] data, string filename) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else version (USE_DLIBIMAGE) {
|
} else version (USE_DLIBIMAGE) {
|
||||||
import std.algorithm;
|
|
||||||
static import dlib.core.stream;
|
static import dlib.core.stream;
|
||||||
try {
|
try {
|
||||||
version (ENABLE_DLIBIMAGE_JPEG) {
|
version (ENABLE_DLIBIMAGE_JPEG) {
|
||||||
|
@ -138,7 +137,6 @@ ColorDrawBuf loadImage(immutable ubyte[] data, string filename) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else version (USE_DIMAGE) {
|
} else version (USE_DIMAGE) {
|
||||||
import std.algorithm;
|
|
||||||
static import dimage.stream;
|
static import dimage.stream;
|
||||||
try {
|
try {
|
||||||
SuperImage image = null;
|
SuperImage image = null;
|
||||||
|
|
|
@ -458,7 +458,6 @@ class ImageDrawable : Drawable {
|
||||||
//Log.d("drawing nine patch image with frame ", p.frame, " padding ", p.padding);
|
//Log.d("drawing nine patch image with frame ", p.frame, " padding ", p.padding);
|
||||||
int w = width;
|
int w = width;
|
||||||
int h = height;
|
int h = height;
|
||||||
Rect dstrect = rc;
|
|
||||||
Rect srcrect = Rect(1, 1, w + 1, h + 1);
|
Rect srcrect = Rect(1, 1, w + 1, h + 1);
|
||||||
if (true) { //buf.applyClipping(dstrect, srcrect)) {
|
if (true) { //buf.applyClipping(dstrect, srcrect)) {
|
||||||
int x0 = srcrect.left;
|
int x0 = srcrect.left;
|
||||||
|
@ -737,9 +736,6 @@ class StateDrawable : Drawable {
|
||||||
|
|
||||||
/// load from XML file
|
/// load from XML file
|
||||||
bool load(string filename) {
|
bool load(string filename) {
|
||||||
import std.file;
|
|
||||||
import std.string;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
string s = cast(string)loadResourceBytes(filename);
|
string s = cast(string)loadResourceBytes(filename);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ struct XPMPredefinedColor
|
||||||
return cmp(name, str);
|
return cmp(name, str);
|
||||||
}
|
}
|
||||||
///ditto
|
///ditto
|
||||||
const int opBinaryRight(string op)(in char[] str) if (op == "<") {
|
int opBinaryRight(string op)(in char[] str) const
|
||||||
|
if (op == "<") {
|
||||||
return cmp(str, name);
|
return cmp(str, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ class TimerInfo {
|
||||||
protected long _nextTimestamp;
|
protected long _nextTimestamp;
|
||||||
protected Widget _targetWidget;
|
protected Widget _targetWidget;
|
||||||
|
|
||||||
override bool opEquals(Object obj) {
|
override bool opEquals(Object obj) const {
|
||||||
TimerInfo b = cast(TimerInfo)obj;
|
TimerInfo b = cast(TimerInfo)obj;
|
||||||
if (!b)
|
if (!b)
|
||||||
return false;
|
return false;
|
||||||
|
@ -653,7 +653,6 @@ class Window {
|
||||||
//Log.d("addTracking ", w.id, " items after: ", _mouseTrackingWidgets.length);
|
//Log.d("addTracking ", w.id, " items after: ", _mouseTrackingWidgets.length);
|
||||||
}
|
}
|
||||||
private bool checkRemoveTracking(MouseEvent event) {
|
private bool checkRemoveTracking(MouseEvent event) {
|
||||||
import std.algorithm;
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
for(int i = cast(int)_mouseTrackingWidgets.length - 1; i >=0; i--) {
|
for(int i = cast(int)_mouseTrackingWidgets.length - 1; i >=0; i--) {
|
||||||
Widget w = _mouseTrackingWidgets[i];
|
Widget w = _mouseTrackingWidgets[i];
|
||||||
|
|
|
@ -1548,7 +1548,6 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
||||||
Log.d("text entered: ", event.text);
|
Log.d("text entered: ", event.text);
|
||||||
if (readOnly)
|
if (readOnly)
|
||||||
return true;
|
return true;
|
||||||
dchar ch = event.text[0];
|
|
||||||
if (replaceMode && _selectionRange.empty && _content[_caretPos.line].length >= _caretPos.pos + event.text.length) {
|
if (replaceMode && _selectionRange.empty && _content[_caretPos.line].length >= _caretPos.pos + event.text.length) {
|
||||||
// replace next char(s)
|
// replace next char(s)
|
||||||
TextRange range = _selectionRange;
|
TextRange range = _selectionRange;
|
||||||
|
|
|
@ -909,7 +909,7 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
if (_scrollPosition < 0)
|
if (_scrollPosition < 0)
|
||||||
_scrollPosition = 0;
|
_scrollPosition = 0;
|
||||||
if (_needScrollbar) {
|
if (_needScrollbar) {
|
||||||
if (_orientation == Orientation.Vertical) {
|
if (_orientation == Orientation.Vertical) { // FIXME:
|
||||||
_scrollbar.position = _scrollPosition;
|
_scrollbar.position = _scrollPosition;
|
||||||
} else {
|
} else {
|
||||||
_scrollbar.position = _scrollPosition;
|
_scrollbar.position = _scrollPosition;
|
||||||
|
@ -1105,7 +1105,7 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
if (itemEnabled(i))
|
if (itemEnabled(i))
|
||||||
setHoverItem(i);
|
setHoverItem(i);
|
||||||
}
|
}
|
||||||
if ((event.button == MouseFlag.LButton || event.button == MouseFlag.RButton)) {
|
if (event.button == MouseFlag.LButton || event.button == MouseFlag.RButton) {
|
||||||
if ((_clickOnButtonDown && event.action == MouseAction.ButtonDown) || (!_clickOnButtonDown && event.action == MouseAction.ButtonUp)) {
|
if ((_clickOnButtonDown && event.action == MouseAction.ButtonDown) || (!_clickOnButtonDown && event.action == MouseAction.ButtonUp)) {
|
||||||
if (itemEnabled(i)) {
|
if (itemEnabled(i)) {
|
||||||
itemClicked(i);
|
itemClicked(i);
|
||||||
|
|
|
@ -39,7 +39,7 @@ WidgetSignalMetadata[] getSignalList(alias T)() {
|
||||||
// skip non-public members
|
// skip non-public members
|
||||||
static if (__traits(getProtection, __traits(getMember, T, m)) == "public") {
|
static if (__traits(getProtection, __traits(getMember, T, m)) == "public") {
|
||||||
static if (__traits(compiles, __traits(getMember, T, m).params_t ) && __traits(compiles, __traits(getMember, T, m).return_t)) {
|
static if (__traits(compiles, __traits(getMember, T, m).params_t ) && __traits(compiles, __traits(getMember, T, m).return_t)) {
|
||||||
alias typeof(__traits(getMember, T, m)) ti;
|
alias ti = typeof(__traits(getMember, T, m));
|
||||||
res ~= WidgetSignalMetadata(m,
|
res ~= WidgetSignalMetadata(m,
|
||||||
__traits(getMember, T, m).return_t.stringof ~ __traits(getMember, T, m).params_t.stringof,
|
__traits(getMember, T, m).return_t.stringof ~ __traits(getMember, T, m).params_t.stringof,
|
||||||
typeid(__traits(getMember, T, m).return_t),
|
typeid(__traits(getMember, T, m).return_t),
|
||||||
|
|
|
@ -1354,9 +1354,6 @@ bool loadTheme(Theme theme, Element doc, int level = 0) {
|
||||||
/// load theme from file
|
/// load theme from file
|
||||||
bool loadTheme(Theme theme, string resourceId, int level = 0) {
|
bool loadTheme(Theme theme, string resourceId, int level = 0) {
|
||||||
|
|
||||||
import std.file;
|
|
||||||
import std.string;
|
|
||||||
|
|
||||||
string filename;
|
string filename;
|
||||||
try {
|
try {
|
||||||
filename = drawableCache.findResource(resourceId);
|
filename = drawableCache.findResource(resourceId);
|
||||||
|
|
|
@ -222,7 +222,6 @@ class TabItemList {
|
||||||
}
|
}
|
||||||
/// find tab index by id
|
/// find tab index by id
|
||||||
int indexById(string id) const {
|
int indexById(string id) const {
|
||||||
import std.algorithm;
|
|
||||||
for (int i = 0; i < _len; i++) {
|
for (int i = 0; i < _len; i++) {
|
||||||
if (_list[i].id.equal(id))
|
if (_list[i].id.equal(id))
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -799,7 +799,7 @@ class Widget {
|
||||||
bool nearY(TabOrderInfo v) {
|
bool nearY(TabOrderInfo v) {
|
||||||
return v.rect.top >= rect.top - NEAR_THRESHOLD && v.rect.top <= rect.top + NEAR_THRESHOLD;
|
return v.rect.top >= rect.top - NEAR_THRESHOLD && v.rect.top <= rect.top + NEAR_THRESHOLD;
|
||||||
}
|
}
|
||||||
override int opCmp(Object obj) {
|
override int opCmp(Object obj) const {
|
||||||
TabOrderInfo v = cast(TabOrderInfo)obj;
|
TabOrderInfo v = cast(TabOrderInfo)obj;
|
||||||
if (tabOrder != 0 && v.tabOrder !=0) {
|
if (tabOrder != 0 && v.tabOrder !=0) {
|
||||||
if (tabOrder < v.tabOrder)
|
if (tabOrder < v.tabOrder)
|
||||||
|
@ -832,7 +832,7 @@ class Widget {
|
||||||
}
|
}
|
||||||
return obj1.rect.left < obj2.rect.left;
|
return obj1.rect.left < obj2.rect.left;
|
||||||
}
|
}
|
||||||
override string toString() {
|
override string toString() const {
|
||||||
return widget.id;
|
return widget.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue