diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj index cb1444ad..128d1fb1 100644 --- a/dlanguilib.visualdproj +++ b/dlanguilib.visualdproj @@ -66,7 +66,7 @@ 0 DebugFocus 0 - EmbedStandardResources Unicode USE_SDL + EmbedStandardResources Unicode USE_FREETYPE 0 0 1 @@ -89,6 +89,7 @@ $(OutDir)\$(ProjectName).lib 1 + 2 @@ -183,6 +184,7 @@ $(OutDir)\$(ProjectName).lib 1 + 1 diff --git a/src/dlangui/graphics/fonts.d b/src/dlangui/graphics/fonts.d index 691a0608..ecbdafb3 100644 --- a/src/dlangui/graphics/fonts.d +++ b/src/dlangui/graphics/fonts.d @@ -480,12 +480,12 @@ struct FontList { return -1; } ref FontRef add(Font item) { - Log.d("FontList.add() enter"); + //Log.d("FontList.add() enter"); if (_len >= _list.length) { _list.length = _len < 16 ? 16 : _list.length * 2; } _list[_len++] = item; - Log.d("FontList.add() exit"); + //Log.d("FontList.add() exit"); return _list[_len - 1]; } // remove unused items - with reference == 1 diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d index a03cefeb..f79733b1 100644 --- a/src/dlangui/graphics/ftfonts.d +++ b/src/dlangui/graphics/ftfonts.d @@ -19,6 +19,9 @@ private import std.file; private import std.string; private import std.utf; +/// define debug=FontResources for logging of font file resources creation/freeing +//debug = FontResources; + private struct FontDef { immutable FontFamily _family; immutable string _face; @@ -116,12 +119,12 @@ private class FreeTypeFontFile { _matrix.yy = 0x10000; _matrix.xy = 0; _matrix.yx = 0; - debug Log.d("Created FreeTypeFontFile, count=", ++_instanceCount); + debug(FontResources) Log.d("Created FreeTypeFontFile, count=", ++_instanceCount); } ~this() { clear(); - debug Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount); + debug(FontResources) Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount); } private static string familyName(FT_Face face) @@ -152,7 +155,7 @@ private class FreeTypeFontFile { if (kernFile.length > 0) error = FT_Attach_File(_face, kernFile.toStringz); } - Log.d("Font file opened successfully"); + debug(FontResources) Log.d("Font file opened successfully"); _slot = _face.glyph; _faceName = familyName(_face); error = FT_Set_Pixel_Sizes( @@ -168,7 +171,7 @@ private class FreeTypeFontFile { _baseline = _height + cast(int)(_face.size.metrics.descender >> 6); _weight = _face.style_flags & FT_STYLE_FLAG_BOLD ? FontWeight.Bold : FontWeight.Normal; _italic = _face.style_flags & FT_STYLE_FLAG_ITALIC ? true : false; - Log.d("Opened font face=", _faceName, " height=", _height, " size=", size, " weight=", weight, " italic=", italic); + debug(FontResources) Log.d("Opened font face=", _faceName, " height=", _height, " size=", size, " weight=", weight, " italic=", italic); return true; // successfully opened } @@ -498,14 +501,14 @@ class FreeTypeFontManager : FontManager { FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT); } ~this() { - debug Log.d("FreeTypeFontManager ~this()"); + debug(FontResources) Log.d("FreeTypeFontManager ~this()"); //_activeFonts.clear(); foreach(ref FontFileItem item; _fontFiles) { destroy(item); item = null; } _fontFiles.length = 0; - debug Log.d("Destroyed all fonts. Freeing library."); + debug(FontResources) Log.d("Destroyed all fonts. Freeing library."); // uninit library if (_library) FT_Done_FreeType(_library); @@ -548,7 +551,7 @@ class FreeTypeFontManager : FontManager { face = font.face; italic = font.italic; weight = font.weight; - Log.d("Using properties from font file: face=", face, " weight=", weight, " italic=", italic); + debug(FontResources)Log.d("Using properties from font file: face=", face, " weight=", weight, " italic=", italic); } destroy(font); diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d index 669e7e05..9414e27a 100644 --- a/src/dlangui/widgets/controls.d +++ b/src/dlangui/widgets/controls.d @@ -480,7 +480,7 @@ class AbstractSlider : WidgetGroup { @property AbstractSlider pageSize(int size) { if (_pageSize != size) { _pageSize = size; - requestLayout(); + //requestLayout(); } return this; } @@ -489,7 +489,7 @@ class AbstractSlider : WidgetGroup { if (_minValue != min || _maxValue != max) { _minValue = min; _maxValue = max; - requestLayout(); + //requestLayout(); } return this; } @@ -782,8 +782,18 @@ class ScrollBar : AbstractSlider, OnClickHandler { _pageUp.visibility = Visibility.Gone; _pageDown.visibility = Visibility.Gone; } + cancelLayout(); } + override void cancelLayout() { + _btnBack.cancelLayout(); + _btnForward.cancelLayout(); + _indicator.cancelLayout(); + _pageUp.cancelLayout(); + _pageDown.cancelLayout(); + super.cancelLayout(); + } + protected void layoutButtons() { Rect irc = _scrollArea; if (_orientation == Orientation.Vertical) { @@ -802,6 +812,7 @@ class ScrollBar : AbstractSlider, OnClickHandler { layoutButtons(irc); } updateState(); + cancelLayout(); } protected void layoutButtons(Rect irc) { diff --git a/src/dlangui/widgets/scroll.d b/src/dlangui/widgets/scroll.d index 566b06b2..4f2f3439 100644 --- a/src/dlangui/widgets/scroll.d +++ b/src/dlangui/widgets/scroll.d @@ -276,12 +276,12 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler { hsbrc.right = hsbrc.right - (needVscroll ? _vscrollbar.measuredWidth : 0); hsbrc.top = hsbrc.bottom - (needHscroll ? _hscrollbar.measuredHeight : 0); if (_vscrollbar) { - _vscrollbar.layout(vsbrc); _vscrollbar.visibility = needVscroll ? Visibility.Visible : Visibility.Gone; + _vscrollbar.layout(vsbrc); } if (_hscrollbar) { - _hscrollbar.layout(hsbrc); _hscrollbar.visibility = needHscroll ? Visibility.Visible : Visibility.Gone; + _hscrollbar.layout(hsbrc); } // client area _clientRect = rc;