From aff4b3cf27d823696ffb0d34ed469a4a0adcd2a4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Mar 2013 02:20:21 +0300 Subject: Add chat command to clean fonts cache. New chat command: /cleanfonts --- src/commands.cpp | 10 +++++++++- src/commands.h | 2 ++ src/gui/chatwindow.cpp | 1 + src/gui/gui.cpp | 16 ++++++++++++++++ src/gui/gui.h | 2 ++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/commands.cpp b/src/commands.cpp index 0850ba909..dce8c57e0 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -351,7 +351,15 @@ impHandler0(cleanGraphics) while(resman->cleanOrphans(true)); if (debugChatTab) - debugChatTab->chatLog("cache cleaned"); + debugChatTab->chatLog(_("Cache cleaned")); +} + +impHandler0(cleanFonts) +{ + if (gui) + gui->clearFonts(); + if (debugChatTab) + debugChatTab->chatLog(_("Cache cleaned")); } impHandler(join) diff --git a/src/commands.h b/src/commands.h index fbd2929ec..b0e3b6951 100644 --- a/src/commands.h +++ b/src/commands.h @@ -56,6 +56,7 @@ namespace Commands decHandler(listChannels); decHandler(clear); decHandler(cleanGraphics); + decHandler(cleanFonts); decHandler(createParty); decHandler(createGuild); decHandler(party); @@ -142,6 +143,7 @@ static const CommandInfo commands[] = {"list", &Commands::listChannels}, {"clear", &Commands::clear}, {"cleangraphics", &Commands::cleanGraphics}, + {"cleanfonts", &Commands::cleanFonts}, {"createparty", &Commands::createParty}, {"createguild", &Commands::createGuild}, {"party", &Commands::party}, diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index c900da9e8..59da87d37 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -290,6 +290,7 @@ void ChatWindow::fillCommands() mCommands.push_back("/closeall"); mCommands.push_back("/clear"); mCommands.push_back("/cleangraphics"); + mCommands.push_back("/cleanfonts"); mCommands.push_back("/create "); mCommands.push_back("/close"); mCommands.push_back("/cacheinfo"); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 205bdff5a..a6e222183 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -310,6 +310,22 @@ void Gui::slowLogic() BLOCK_END("Gui::slowLogic") } +void Gui::clearFonts() +{ + if (mGuiFont) + mGuiFont->clear(); + if (mInfoParticleFont) + mInfoParticleFont->clear(); + if (mHelpFont) + mHelpFont->clear(); + if (mSecureFont) + mSecureFont->clear(); + if (boldFont) + boldFont->clear(); + if (mNpcFont) + mNpcFont->clear(); +} + bool Gui::handleInput() { BLOCK_START("Gui::handleInput") diff --git a/src/gui/gui.h b/src/gui/gui.h index 983b34dc0..84142f3e1 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -75,6 +75,8 @@ class Gui final : public gcn::Gui void slowLogic(); + void clearFonts(); + /** * Draws the whole Gui by calling draw functions down in the * Gui hierarchy. It also draws the mouse pointer. -- cgit v1.2.3-70-g09d2