diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d index de5c61ef..f5d1121b 100644 --- a/src/dlangui/graphics/ftfonts.d +++ b/src/dlangui/graphics/ftfonts.d @@ -300,13 +300,13 @@ class FreeTypeFont : Font { _fontItem = item; _size = size; _height = size; - Log.d("Created font, count=", ++_instanceCount); + debug Log.d("Created font, count=", ++_instanceCount); } /// do cleanup ~this() { clear(); - Log.d("Destroyed font, count=", --_instanceCount); + debug Log.d("Destroyed font, count=", --_instanceCount); } private int _size; @@ -451,14 +451,14 @@ class FreeTypeFontManager : FontManager { } } ~this() { - Log.d("FreeTypeFontManager ~this()"); + debug Log.d("FreeTypeFontManager ~this()"); //_activeFonts.clear(); foreach(ref FontFileItem item; _fontFiles) { destroy(item); item = null; } _fontFiles.length = 0; - Log.d("Destroyed all fonts. Freeing library."); + debug Log.d("Destroyed all fonts. Freeing library."); // uninit library if (_library) FT_Done_FreeType(_library); diff --git a/src/dlangui/graphics/resources.d b/src/dlangui/graphics/resources.d index 8ce9b299..4415d104 100644 --- a/src/dlangui/graphics/resources.d +++ b/src/dlangui/graphics/resources.d @@ -493,9 +493,6 @@ class StateDrawable : Drawable { foreach(ref item; _stateList) if (item.matchState(state)) { if (!item.drawable.isNull) { - if (state & State.Checked) { - Log.d("Found item for checked state: ", item.stateMask, " ", item.stateValue); - } item.drawable.drawTo(buf, rc, state, tilex0, tiley0); } return; @@ -610,10 +607,10 @@ class ImageCache { } this() { - Log.i("Creating ImageCache"); + debug Log.i("Creating ImageCache"); } ~this() { - Log.i("Destroying ImageCache"); + debug Log.i("Destroying ImageCache"); foreach (ref item; _map) { destroy(item); item = null; @@ -858,17 +855,16 @@ class DrawableCache { if (fn !is null) { _idToFileMap[id] = fn; return fn; - } else { - Log.w("resource ", id, " is not found"); } } + Log.w("resource ", id, " is not found"); return null; } this() { - Log.i("Creating DrawableCache"); + debug Log.i("Creating DrawableCache"); } ~this() { - Log.i("Destroying DrawableCache"); + debug Log.i("Destroying DrawableCache"); foreach (ref item; _idToDrawableMap) { destroy(item); item = null; diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index 9a95eee7..416adde3 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -125,13 +125,13 @@ class Window { _backgroundColor = 0xFFFFFF; } ~this() { + foreach(p; _popups) + destroy(p); + _popups = null; if (_mainWidget !is null) { destroy(_mainWidget); _mainWidget = null; } - foreach(p; _popups) - destroy(p); - _popups = null; } private void animate(Widget root, long interval) { diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index a680aae3..8181617e 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -41,12 +41,12 @@ version(USE_SDL) { SDL_Renderer* _renderer; this(string caption, Window parent) { _caption = caption; - Log.d("Creating SDL window"); + debug Log.d("Creating SDL window"); create(); } ~this() { - Log.d("Destroying window"); + debug Log.d("Destroying SDL window"); if (_renderer) SDL_DestroyRenderer(_renderer); if (_win) @@ -124,7 +124,7 @@ version(USE_SDL) { } void redraw() { - Log.e("Widget instance count in SDLWindow.redraw: ", Widget.instanceCount()); + //Log.e("Widget instance count in SDLWindow.redraw: ", Widget.instanceCount()); // check if size has been changed int w, h; SDL_GetWindowSize(_win, @@ -610,11 +610,20 @@ version(USE_SDL) { /// retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) override dstring getClipboardText(bool mouseBuffer = false) { - return ""d; + if (!SDL_HasClipboardText()) + return ""d; + char * txt = SDL_GetClipboardText(); + if (!txt) + return ""d; + string s = fromStringz(txt); + SDL_free(txt); + return toUTF32(s); } /// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) override void setClipboardText(dstring text, bool mouseBuffer = false) { + string s = toUTF8(text); + SDL_SetClipboardText(s.toStringz); } protected SDLWindow[uint] _windowMap; @@ -643,7 +652,7 @@ version(USE_SDL) { } catch (Throwable e) // catch any uncaught exceptions { - MessageBox(null, toUTF16z(e.toString()), "Error", + MessageBox(null, toUTF16z(e.toString ~ "\nStack trace:\n" ~ defaultTraceHandler.toString), "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; // failed } diff --git a/src/dlangui/platforms/windows/win32fonts.d b/src/dlangui/platforms/windows/win32fonts.d index 4b4abdde..80355017 100644 --- a/src/dlangui/platforms/windows/win32fonts.d +++ b/src/dlangui/platforms/windows/win32fonts.d @@ -251,17 +251,17 @@ class Win32FontManager : FontManager { /// initialize in constructor this() { - Log.i("Creating Win32FontManager"); + debug Log.i("Creating Win32FontManager"); //instance = this; init(); } ~this() { - Log.i("Destroying Win32FontManager"); + debug Log.i("Destroying Win32FontManager"); } /// initialize font manager by enumerating of system fonts bool init() { - Log.i("Win32FontManager.init()"); + debug Log.i("Win32FontManager.init()"); Win32ColorDrawBuf drawbuf = new Win32ColorDrawBuf(1,1); LOGFONTA lf; lf.lfCharSet = ANSI_CHARSET; //DEFAULT_CHARSET; diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index fc6977c4..7232ee02 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -248,7 +248,7 @@ class Win32Window : Window { } ~this() { - Log.d("Window destructor"); + debug Log.d("Window destructor"); version (USE_OPENGL) { import derelict.opengl3.wgl; if (_hGLRC) { diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d index 0e355320..88d1eadb 100644 --- a/src/dlangui/widgets/controls.d +++ b/src/dlangui/widgets/controls.d @@ -166,9 +166,6 @@ class ImageWidget : Widget { sz.y = img.height; applyAlign(rc, sz); uint st = state; - if (state & State.Checked) { - Log.d("Drawing image for checked state"); - } img.drawTo(buf, rc, st); } } diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index 61fa184a..aac61dc9 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -456,12 +456,12 @@ class Style { _theme = theme; _parentStyle = theme; _id = id; - Log.d("Created style ", _id, ", count=", ++_instanceCount); + //Log.d("Created style ", _id, ", count=", ++_instanceCount); } ~this() { foreach(ref Style item; _substates) { - Log.d("Destroying substate"); + //Log.d("Destroying substate"); destroy(item); item = null; } @@ -473,7 +473,7 @@ class Style { _children.clear(); _backgroundDrawable.clear(); _font.clear(); - Log.d("Destroyed style ", _id, ", parentId=", _parentId, ", state=", _stateMask, ", count=", --_instanceCount); + //Log.d("Destroyed style ", _id, ", parentId=", _parentId, ", state=", _stateMask, ", count=", --_instanceCount); } /// create named substyle of this style @@ -537,7 +537,7 @@ class Theme : Style { } ~this() { - Log.d("Theme destructor"); + //Log.d("Theme destructor"); foreach(ref Style item; _byId) { destroy(item); item = null;