remove excessive logging

This commit is contained in:
Vadim Lopatin 2014-04-30 09:38:34 +04:00
parent 233adaace3
commit b769f5f3ec
8 changed files with 34 additions and 32 deletions

View File

@ -300,13 +300,13 @@ class FreeTypeFont : Font {
_fontItem = item; _fontItem = item;
_size = size; _size = size;
_height = size; _height = size;
Log.d("Created font, count=", ++_instanceCount); debug Log.d("Created font, count=", ++_instanceCount);
} }
/// do cleanup /// do cleanup
~this() { ~this() {
clear(); clear();
Log.d("Destroyed font, count=", --_instanceCount); debug Log.d("Destroyed font, count=", --_instanceCount);
} }
private int _size; private int _size;
@ -451,14 +451,14 @@ class FreeTypeFontManager : FontManager {
} }
} }
~this() { ~this() {
Log.d("FreeTypeFontManager ~this()"); debug 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;
Log.d("Destroyed all fonts. Freeing library."); debug Log.d("Destroyed all fonts. Freeing library.");
// uninit library // uninit library
if (_library) if (_library)
FT_Done_FreeType(_library); FT_Done_FreeType(_library);

View File

@ -493,9 +493,6 @@ class StateDrawable : Drawable {
foreach(ref item; _stateList) foreach(ref item; _stateList)
if (item.matchState(state)) { if (item.matchState(state)) {
if (!item.drawable.isNull) { 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); item.drawable.drawTo(buf, rc, state, tilex0, tiley0);
} }
return; return;
@ -610,10 +607,10 @@ class ImageCache {
} }
this() { this() {
Log.i("Creating ImageCache"); debug Log.i("Creating ImageCache");
} }
~this() { ~this() {
Log.i("Destroying ImageCache"); debug Log.i("Destroying ImageCache");
foreach (ref item; _map) { foreach (ref item; _map) {
destroy(item); destroy(item);
item = null; item = null;
@ -858,17 +855,16 @@ class DrawableCache {
if (fn !is null) { if (fn !is null) {
_idToFileMap[id] = fn; _idToFileMap[id] = fn;
return fn; return fn;
} else {
Log.w("resource ", id, " is not found");
} }
} }
Log.w("resource ", id, " is not found");
return null; return null;
} }
this() { this() {
Log.i("Creating DrawableCache"); debug Log.i("Creating DrawableCache");
} }
~this() { ~this() {
Log.i("Destroying DrawableCache"); debug Log.i("Destroying DrawableCache");
foreach (ref item; _idToDrawableMap) { foreach (ref item; _idToDrawableMap) {
destroy(item); destroy(item);
item = null; item = null;

View File

@ -125,13 +125,13 @@ class Window {
_backgroundColor = 0xFFFFFF; _backgroundColor = 0xFFFFFF;
} }
~this() { ~this() {
foreach(p; _popups)
destroy(p);
_popups = null;
if (_mainWidget !is null) { if (_mainWidget !is null) {
destroy(_mainWidget); destroy(_mainWidget);
_mainWidget = null; _mainWidget = null;
} }
foreach(p; _popups)
destroy(p);
_popups = null;
} }
private void animate(Widget root, long interval) { private void animate(Widget root, long interval) {

View File

@ -41,12 +41,12 @@ version(USE_SDL) {
SDL_Renderer* _renderer; SDL_Renderer* _renderer;
this(string caption, Window parent) { this(string caption, Window parent) {
_caption = caption; _caption = caption;
Log.d("Creating SDL window"); debug Log.d("Creating SDL window");
create(); create();
} }
~this() { ~this() {
Log.d("Destroying window"); debug Log.d("Destroying SDL window");
if (_renderer) if (_renderer)
SDL_DestroyRenderer(_renderer); SDL_DestroyRenderer(_renderer);
if (_win) if (_win)
@ -124,7 +124,7 @@ version(USE_SDL) {
} }
void redraw() { 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 // check if size has been changed
int w, h; int w, h;
SDL_GetWindowSize(_win, SDL_GetWindowSize(_win,
@ -610,11 +610,20 @@ version(USE_SDL) {
/// retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) /// retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
override dstring getClipboardText(bool mouseBuffer = false) { 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) /// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
override void setClipboardText(dstring text, bool mouseBuffer = false) { override void setClipboardText(dstring text, bool mouseBuffer = false) {
string s = toUTF8(text);
SDL_SetClipboardText(s.toStringz);
} }
protected SDLWindow[uint] _windowMap; protected SDLWindow[uint] _windowMap;
@ -643,7 +652,7 @@ version(USE_SDL) {
} }
catch (Throwable e) // catch any uncaught exceptions 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); MB_OK | MB_ICONEXCLAMATION);
result = 0; // failed result = 0; // failed
} }

View File

@ -251,17 +251,17 @@ class Win32FontManager : FontManager {
/// initialize in constructor /// initialize in constructor
this() { this() {
Log.i("Creating Win32FontManager"); debug Log.i("Creating Win32FontManager");
//instance = this; //instance = this;
init(); init();
} }
~this() { ~this() {
Log.i("Destroying Win32FontManager"); debug Log.i("Destroying Win32FontManager");
} }
/// initialize font manager by enumerating of system fonts /// initialize font manager by enumerating of system fonts
bool init() { bool init() {
Log.i("Win32FontManager.init()"); debug Log.i("Win32FontManager.init()");
Win32ColorDrawBuf drawbuf = new Win32ColorDrawBuf(1,1); Win32ColorDrawBuf drawbuf = new Win32ColorDrawBuf(1,1);
LOGFONTA lf; LOGFONTA lf;
lf.lfCharSet = ANSI_CHARSET; //DEFAULT_CHARSET; lf.lfCharSet = ANSI_CHARSET; //DEFAULT_CHARSET;

View File

@ -248,7 +248,7 @@ class Win32Window : Window {
} }
~this() { ~this() {
Log.d("Window destructor"); debug Log.d("Window destructor");
version (USE_OPENGL) { version (USE_OPENGL) {
import derelict.opengl3.wgl; import derelict.opengl3.wgl;
if (_hGLRC) { if (_hGLRC) {

View File

@ -166,9 +166,6 @@ class ImageWidget : Widget {
sz.y = img.height; sz.y = img.height;
applyAlign(rc, sz); applyAlign(rc, sz);
uint st = state; uint st = state;
if (state & State.Checked) {
Log.d("Drawing image for checked state");
}
img.drawTo(buf, rc, st); img.drawTo(buf, rc, st);
} }
} }

View File

@ -456,12 +456,12 @@ class Style {
_theme = theme; _theme = theme;
_parentStyle = theme; _parentStyle = theme;
_id = id; _id = id;
Log.d("Created style ", _id, ", count=", ++_instanceCount); //Log.d("Created style ", _id, ", count=", ++_instanceCount);
} }
~this() { ~this() {
foreach(ref Style item; _substates) { foreach(ref Style item; _substates) {
Log.d("Destroying substate"); //Log.d("Destroying substate");
destroy(item); destroy(item);
item = null; item = null;
} }
@ -473,7 +473,7 @@ class Style {
_children.clear(); _children.clear();
_backgroundDrawable.clear(); _backgroundDrawable.clear();
_font.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 /// create named substyle of this style
@ -537,7 +537,7 @@ class Theme : Style {
} }
~this() { ~this() {
Log.d("Theme destructor"); //Log.d("Theme destructor");
foreach(ref Style item; _byId) { foreach(ref Style item; _byId) {
destroy(item); destroy(item);
item = null; item = null;