mirror of https://github.com/buggins/dlangui.git
fix unnecessary relayouts; remove excessive logging
This commit is contained in:
parent
4df4c0fc04
commit
d35498a82d
|
@ -66,7 +66,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids>DebugFocus</debugids>
|
<debugids>DebugFocus</debugids>
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>EmbedStandardResources Unicode USE_SDL</versionids>
|
<versionids>EmbedStandardResources Unicode USE_FREETYPE</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>1</createImplib>
|
<createImplib>1</createImplib>
|
||||||
|
@ -89,6 +89,7 @@
|
||||||
<resfile />
|
<resfile />
|
||||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||||
<useStdLibPath>1</useStdLibPath>
|
<useStdLibPath>1</useStdLibPath>
|
||||||
|
<cRuntime>2</cRuntime>
|
||||||
<additionalOptions />
|
<additionalOptions />
|
||||||
<preBuildCommand />
|
<preBuildCommand />
|
||||||
<postBuildCommand />
|
<postBuildCommand />
|
||||||
|
@ -183,6 +184,7 @@
|
||||||
<resfile />
|
<resfile />
|
||||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||||
<useStdLibPath>1</useStdLibPath>
|
<useStdLibPath>1</useStdLibPath>
|
||||||
|
<cRuntime>1</cRuntime>
|
||||||
<additionalOptions />
|
<additionalOptions />
|
||||||
<preBuildCommand />
|
<preBuildCommand />
|
||||||
<postBuildCommand />
|
<postBuildCommand />
|
||||||
|
|
|
@ -480,12 +480,12 @@ struct FontList {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ref FontRef add(Font item) {
|
ref FontRef add(Font item) {
|
||||||
Log.d("FontList.add() enter");
|
//Log.d("FontList.add() enter");
|
||||||
if (_len >= _list.length) {
|
if (_len >= _list.length) {
|
||||||
_list.length = _len < 16 ? 16 : _list.length * 2;
|
_list.length = _len < 16 ? 16 : _list.length * 2;
|
||||||
}
|
}
|
||||||
_list[_len++] = item;
|
_list[_len++] = item;
|
||||||
Log.d("FontList.add() exit");
|
//Log.d("FontList.add() exit");
|
||||||
return _list[_len - 1];
|
return _list[_len - 1];
|
||||||
}
|
}
|
||||||
// remove unused items - with reference == 1
|
// remove unused items - with reference == 1
|
||||||
|
|
|
@ -19,6 +19,9 @@ private import std.file;
|
||||||
private import std.string;
|
private import std.string;
|
||||||
private import std.utf;
|
private import std.utf;
|
||||||
|
|
||||||
|
/// define debug=FontResources for logging of font file resources creation/freeing
|
||||||
|
//debug = FontResources;
|
||||||
|
|
||||||
private struct FontDef {
|
private struct FontDef {
|
||||||
immutable FontFamily _family;
|
immutable FontFamily _family;
|
||||||
immutable string _face;
|
immutable string _face;
|
||||||
|
@ -116,12 +119,12 @@ private class FreeTypeFontFile {
|
||||||
_matrix.yy = 0x10000;
|
_matrix.yy = 0x10000;
|
||||||
_matrix.xy = 0;
|
_matrix.xy = 0;
|
||||||
_matrix.yx = 0;
|
_matrix.yx = 0;
|
||||||
debug Log.d("Created FreeTypeFontFile, count=", ++_instanceCount);
|
debug(FontResources) Log.d("Created FreeTypeFontFile, count=", ++_instanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
~this() {
|
~this() {
|
||||||
clear();
|
clear();
|
||||||
debug Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount);
|
debug(FontResources) Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string familyName(FT_Face face)
|
private static string familyName(FT_Face face)
|
||||||
|
@ -152,7 +155,7 @@ private class FreeTypeFontFile {
|
||||||
if (kernFile.length > 0)
|
if (kernFile.length > 0)
|
||||||
error = FT_Attach_File(_face, kernFile.toStringz);
|
error = FT_Attach_File(_face, kernFile.toStringz);
|
||||||
}
|
}
|
||||||
Log.d("Font file opened successfully");
|
debug(FontResources) Log.d("Font file opened successfully");
|
||||||
_slot = _face.glyph;
|
_slot = _face.glyph;
|
||||||
_faceName = familyName(_face);
|
_faceName = familyName(_face);
|
||||||
error = FT_Set_Pixel_Sizes(
|
error = FT_Set_Pixel_Sizes(
|
||||||
|
@ -168,7 +171,7 @@ private class FreeTypeFontFile {
|
||||||
_baseline = _height + cast(int)(_face.size.metrics.descender >> 6);
|
_baseline = _height + cast(int)(_face.size.metrics.descender >> 6);
|
||||||
_weight = _face.style_flags & FT_STYLE_FLAG_BOLD ? FontWeight.Bold : FontWeight.Normal;
|
_weight = _face.style_flags & FT_STYLE_FLAG_BOLD ? FontWeight.Bold : FontWeight.Normal;
|
||||||
_italic = _face.style_flags & FT_STYLE_FLAG_ITALIC ? true : false;
|
_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
|
return true; // successfully opened
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,14 +501,14 @@ class FreeTypeFontManager : FontManager {
|
||||||
FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);
|
FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);
|
||||||
}
|
}
|
||||||
~this() {
|
~this() {
|
||||||
debug Log.d("FreeTypeFontManager ~this()");
|
debug(FontResources) Log.d("FreeTypeFontManager ~this()");
|
||||||
//_activeFonts.clear();
|
//_activeFonts.clear();
|
||||||
foreach(ref FontFileItem item; _fontFiles) {
|
foreach(ref FontFileItem item; _fontFiles) {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_fontFiles.length = 0;
|
_fontFiles.length = 0;
|
||||||
debug Log.d("Destroyed all fonts. Freeing library.");
|
debug(FontResources) Log.d("Destroyed all fonts. Freeing library.");
|
||||||
// uninit library
|
// uninit library
|
||||||
if (_library)
|
if (_library)
|
||||||
FT_Done_FreeType(_library);
|
FT_Done_FreeType(_library);
|
||||||
|
@ -548,7 +551,7 @@ class FreeTypeFontManager : FontManager {
|
||||||
face = font.face;
|
face = font.face;
|
||||||
italic = font.italic;
|
italic = font.italic;
|
||||||
weight = font.weight;
|
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);
|
destroy(font);
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ class AbstractSlider : WidgetGroup {
|
||||||
@property AbstractSlider pageSize(int size) {
|
@property AbstractSlider pageSize(int size) {
|
||||||
if (_pageSize != size) {
|
if (_pageSize != size) {
|
||||||
_pageSize = size;
|
_pageSize = size;
|
||||||
requestLayout();
|
//requestLayout();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ class AbstractSlider : WidgetGroup {
|
||||||
if (_minValue != min || _maxValue != max) {
|
if (_minValue != min || _maxValue != max) {
|
||||||
_minValue = min;
|
_minValue = min;
|
||||||
_maxValue = max;
|
_maxValue = max;
|
||||||
requestLayout();
|
//requestLayout();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -782,6 +782,16 @@ class ScrollBar : AbstractSlider, OnClickHandler {
|
||||||
_pageUp.visibility = Visibility.Gone;
|
_pageUp.visibility = Visibility.Gone;
|
||||||
_pageDown.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() {
|
protected void layoutButtons() {
|
||||||
|
@ -802,6 +812,7 @@ class ScrollBar : AbstractSlider, OnClickHandler {
|
||||||
layoutButtons(irc);
|
layoutButtons(irc);
|
||||||
}
|
}
|
||||||
updateState();
|
updateState();
|
||||||
|
cancelLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void layoutButtons(Rect irc) {
|
protected void layoutButtons(Rect irc) {
|
||||||
|
|
|
@ -276,12 +276,12 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
hsbrc.right = hsbrc.right - (needVscroll ? _vscrollbar.measuredWidth : 0);
|
hsbrc.right = hsbrc.right - (needVscroll ? _vscrollbar.measuredWidth : 0);
|
||||||
hsbrc.top = hsbrc.bottom - (needHscroll ? _hscrollbar.measuredHeight : 0);
|
hsbrc.top = hsbrc.bottom - (needHscroll ? _hscrollbar.measuredHeight : 0);
|
||||||
if (_vscrollbar) {
|
if (_vscrollbar) {
|
||||||
_vscrollbar.layout(vsbrc);
|
|
||||||
_vscrollbar.visibility = needVscroll ? Visibility.Visible : Visibility.Gone;
|
_vscrollbar.visibility = needVscroll ? Visibility.Visible : Visibility.Gone;
|
||||||
|
_vscrollbar.layout(vsbrc);
|
||||||
}
|
}
|
||||||
if (_hscrollbar) {
|
if (_hscrollbar) {
|
||||||
_hscrollbar.layout(hsbrc);
|
|
||||||
_hscrollbar.visibility = needHscroll ? Visibility.Visible : Visibility.Gone;
|
_hscrollbar.visibility = needHscroll ? Visibility.Visible : Visibility.Gone;
|
||||||
|
_hscrollbar.layout(hsbrc);
|
||||||
}
|
}
|
||||||
// client area
|
// client area
|
||||||
_clientRect = rc;
|
_clientRect = rc;
|
||||||
|
|
Loading…
Reference in New Issue