Rename PRINTF to LOG

This commit is contained in:
David Capello 2015-08-28 20:48:49 -03:00
parent 7fb7b85b13
commit d6684691bf
25 changed files with 99 additions and 102 deletions

View File

@ -175,7 +175,7 @@ void App::initialize(const AppOptions& options)
FileFormatsManager::instance()->registerAllFormats(); FileFormatsManager::instance()->registerAllFormats();
if (isPortable()) if (isPortable())
PRINTF("Running in portable mode\n"); LOG("Running in portable mode\n");
// Load or create the default palette, or migrate the default // Load or create the default palette, or migrate the default
// palette from an old format palette to the new one, etc. // palette from an old format palette to the new one, etc.
@ -184,7 +184,7 @@ void App::initialize(const AppOptions& options)
// Initialize GUI interface // Initialize GUI interface
UIContext* ctx = UIContext::instance(); UIContext* ctx = UIContext::instance();
if (isGui()) { if (isGui()) {
PRINTF("GUI mode\n"); LOG("GUI mode\n");
// Setup the GUI cursor and redraw screen // Setup the GUI cursor and redraw screen
@ -213,7 +213,7 @@ void App::initialize(const AppOptions& options)
} }
// Procress options // Procress options
PRINTF("Processing options...\n"); LOG("Processing options...\n");
bool ignoreEmpty = false; bool ignoreEmpty = false;
bool trim = false; bool trim = false;
@ -506,7 +506,7 @@ void App::initialize(const AppOptions& options)
// Export // Export
if (m_exporter) { if (m_exporter) {
PRINTF("Exporting sheet...\n"); LOG("Exporting sheet...\n");
if (ignoreEmpty) if (ignoreEmpty)
m_exporter->setIgnoreEmptyCels(true); m_exporter->setIgnoreEmptyCels(true);
@ -517,7 +517,7 @@ void App::initialize(const AppOptions& options)
base::UniquePtr<Document> spriteSheet(m_exporter->exportSheet()); base::UniquePtr<Document> spriteSheet(m_exporter->exportSheet());
m_exporter.reset(NULL); m_exporter.reset(NULL);
PRINTF("Export sprite sheet: Done\n"); LOG("Export sprite sheet: Done\n");
} }
} }
@ -590,7 +590,7 @@ App::~App()
ASSERT(m_instance == this); ASSERT(m_instance == this);
// Remove Aseprite handlers // Remove Aseprite handlers
PRINTF("ASE: Uninstalling\n"); LOG("ASE: Uninstalling\n");
// Delete file formats. // Delete file formats.
FileFormatsManager::destroyInstance(); FileFormatsManager::destroyInstance();

View File

@ -71,7 +71,7 @@ void AppMenus::reload()
//////////////////////////////////////// ////////////////////////////////////////
// Load menus // Load menus
PRINTF(" - Loading menus from \"%s\"...\n", path); LOG(" - Loading menus from \"%s\"...\n", path);
m_rootMenu.reset(loadMenuById(handle, "main_menu")); m_rootMenu.reset(loadMenuById(handle, "main_menu"));
@ -79,7 +79,7 @@ void AppMenus::reload()
if (GuiXml::instance()->version() != VERSION) if (GuiXml::instance()->version() != VERSION)
m_rootMenu->insertChild(0, createInvalidVersionMenuitem()); m_rootMenu->insertChild(0, createInvalidVersionMenuitem());
PRINTF("Main menu loaded.\n"); LOG("Main menu loaded.\n");
m_tabPopupMenu.reset(loadMenuById(handle, "tab_popup")); m_tabPopupMenu.reset(loadMenuById(handle, "tab_popup"));
m_documentTabPopupMenu.reset(loadMenuById(handle, "document_tab_popup")); m_documentTabPopupMenu.reset(loadMenuById(handle, "document_tab_popup"));
@ -93,7 +93,7 @@ void AppMenus::reload()
//////////////////////////////////////// ////////////////////////////////////////
// Load keyboard shortcuts for commands // Load keyboard shortcuts for commands
PRINTF(" - Loading commands keyboard shortcuts from \"%s\"...\n", path); LOG(" - Loading commands keyboard shortcuts from \"%s\"...\n", path);
TiXmlElement* xmlKey = handle TiXmlElement* xmlKey = handle
.FirstChild("gui") .FirstChild("gui")
@ -165,7 +165,7 @@ Menu* AppMenus::loadMenuById(TiXmlHandle& handle, const char* id)
{ {
ASSERT(id != NULL); ASSERT(id != NULL);
//PRINTF("loadMenuById(%s)\n", id); //LOG("loadMenuById(%s)\n", id);
// <gui><menus><menu> // <gui><menus><menu>
TiXmlElement* xmlMenu = handle TiXmlElement* xmlMenu = handle
@ -188,7 +188,7 @@ Menu* AppMenus::convertXmlelemToMenu(TiXmlElement* elem)
{ {
Menu* menu = new Menu(); Menu* menu = new Menu();
//PRINTF("convertXmlelemToMenu(%s, %s, %s)\n", elem->Value(), elem->Attribute("id"), elem->Attribute("text")); //LOG("convertXmlelemToMenu(%s, %s, %s)\n", elem->Value(), elem->Attribute("id"), elem->Attribute("text"));
TiXmlElement* child = elem->FirstChildElement(); TiXmlElement* child = elem->FirstChildElement();
while (child) { while (child) {

View File

@ -53,7 +53,7 @@ void Context::executeCommand(Command* command, const Params& params)
ASSERT(command != NULL); ASSERT(command != NULL);
PRINTF("Context: Executing command '%s'...\n", command->id().c_str()); LOG("Context: Executing command '%s'...\n", command->id().c_str());
try { try {
m_flags.update(this); m_flags.update(this);
@ -63,14 +63,14 @@ void Context::executeCommand(Command* command, const Params& params)
BeforeCommandExecution(ev); BeforeCommandExecution(ev);
if (ev.isCanceled()) { if (ev.isCanceled()) {
PRINTF("Context: '%s' was canceled/simulated.\n", command->id().c_str()); LOG("Context: '%s' was canceled/simulated.\n", command->id().c_str());
} }
else if (command->isEnabled(this)) { else if (command->isEnabled(this)) {
command->execute(this); command->execute(this);
PRINTF("Context: '%s' executed successfully\n", command->id().c_str()); LOG("Context: '%s' executed successfully\n", command->id().c_str());
} }
else { else {
PRINTF("Context: '%s' is disabled\n", command->id().c_str()); LOG("Context: '%s' is disabled\n", command->id().c_str());
} }
AfterCommandExecution(ev); AfterCommandExecution(ev);
@ -80,21 +80,21 @@ void Context::executeCommand(Command* command, const Params& params)
app_rebuild_documents_tabs(); app_rebuild_documents_tabs();
} }
catch (base::Exception& e) { catch (base::Exception& e) {
PRINTF("Context: Exception caught executing '%s' command\n%s\n", LOG("Context: Exception caught executing '%s' command\n%s\n",
command->id().c_str(), e.what()); command->id().c_str(), e.what());
Console::showException(e); Console::showException(e);
} }
catch (std::exception& e) { catch (std::exception& e) {
PRINTF("Context: std::exception caught executing '%s' command\n%s\n", LOG("Context: std::exception caught executing '%s' command\n%s\n",
command->id().c_str(), e.what()); command->id().c_str(), e.what());
console.printf("An error ocurred executing the command.\n\nDetails:\n%s", e.what()); console.printf("An error ocurred executing the command.\n\nDetails:\n%s", e.what());
} }
#ifndef DEBUGMODE #ifndef DEBUGMODE
catch (...) { catch (...) {
PRINTF("Context: Unknown exception executing '%s' command\n", LOG("Context: Unknown exception executing '%s' command\n",
command->id().c_str()); command->id().c_str());
console.printf("An unknown error ocurred executing the command.\n" console.printf("An unknown error ocurred executing the command.\n"
"Please save your work, close the program, try it\n" "Please save your work, close the program, try it\n"

View File

@ -139,7 +139,7 @@ FileOp* fop_to_load_document(Context* context, const char* filename, int flags)
// Get the extension of the filename (in lower case) // Get the extension of the filename (in lower case)
std::string extension = base::string_to_lower(base::get_file_extension(filename)); std::string extension = base::string_to_lower(base::get_file_extension(filename));
PRINTF("Loading file \"%s\" (%s)\n", filename, extension.c_str()); LOG("Loading file \"%s\" (%s)\n", filename, extension.c_str());
// Does file exist? // Does file exist?
if (!base::is_file(filename)) { if (!base::is_file(filename)) {
@ -240,7 +240,7 @@ FileOp* fop_to_save_document(const Context* context, const Document* document,
// Get the extension of the filename (in lower case) // Get the extension of the filename (in lower case)
std::string extension = base::string_to_lower(base::get_file_extension(filename)); std::string extension = base::string_to_lower(base::get_file_extension(filename));
PRINTF("Saving document \"%s\" (%s)\n", filename, extension.c_str()); LOG("Saving document \"%s\" (%s)\n", filename, extension.c_str());
// Get the format through the extension of the filename // Get the format through the extension of the filename
fop->format = FileFormatsManager::instance() fop->format = FileFormatsManager::instance()

View File

@ -182,7 +182,7 @@ public:
, m_remap(256) , m_remap(256)
, m_hasLocalColormaps(false) , m_hasLocalColormaps(false)
, m_firstLocalColormap(nullptr) { , m_firstLocalColormap(nullptr) {
// PRINTF("GIF background index = %d\n", (int)m_gifFile->SBackGroundColor); // LOG("GIF background index = %d\n", (int)m_gifFile->SBackGroundColor);
} }
~GifDecoder() { ~GifDecoder() {
@ -300,7 +300,7 @@ private:
UniquePtr<Image> frameImage( UniquePtr<Image> frameImage(
readFrameIndexedImage(frameBounds)); readFrameIndexedImage(frameBounds));
// PRINTF("Frame[%d] transparent index = %d\n", (int)m_frameNum, m_localTransparentIndex); // LOG("Frame[%d] transparent index = %d\n", (int)m_frameNum, m_localTransparentIndex);
if (m_frameNum == 0) { if (m_frameNum == 0) {
if (m_localTransparentIndex >= 0) if (m_localTransparentIndex >= 0)
@ -602,7 +602,7 @@ private:
m_localTransparentIndex = (extension[1] & 1) ? extension[4]: -1; m_localTransparentIndex = (extension[1] & 1) ? extension[4]: -1;
m_frameDelay = (extension[3] << 8) | extension[2]; m_frameDelay = (extension[3] << 8) | extension[2];
// PRINTF("Disposal method: %d\nTransparent index: %d\nFrame delay: %d\n", // LOG("Disposal method: %d\nTransparent index: %d\nFrame delay: %d\n",
// m_disposalMethod, m_localTransparentIndex, m_frameDelay); // m_disposalMethod, m_localTransparentIndex, m_frameDelay);
} }
} }
@ -984,7 +984,7 @@ private:
} }
} }
// PRINTF("frameBounds=%d %d %d %d prev=%d %d %d %d next=%d %d %d %d\n", // LOG("frameBounds=%d %d %d %d prev=%d %d %d %d next=%d %d %d %d\n",
// frameBounds.x, frameBounds.y, frameBounds.w, frameBounds.h, // frameBounds.x, frameBounds.y, frameBounds.w, frameBounds.h,
// prev.x, prev.y, prev.w, prev.h, // prev.x, prev.y, prev.w, prev.h,
// next.x, next.y, next.w, next.h); // next.x, next.y, next.w, next.h);

View File

@ -90,7 +90,7 @@ static void output_message(j_common_ptr cinfo)
(*cinfo->err->format_message)(cinfo, buffer); (*cinfo->err->format_message)(cinfo, buffer);
// Put in the log file if. // Put in the log file if.
PRINTF("JPEG library: \"%s\"\n", buffer); LOG("JPEG library: \"%s\"\n", buffer);
// Leave the message for the application. // Leave the message for the application.
fop_error(((struct error_mgr *)cinfo->err)->fop, "%s\n", buffer); fop_error(((struct error_mgr *)cinfo->err)->fop, "%s\n", buffer);

View File

@ -166,12 +166,12 @@ FileSystemModule::FileSystemModule()
// the 'rootitem' FileItem) // the 'rootitem' FileItem)
getRootFileItem(); getRootFileItem();
PRINTF("File system module installed\n"); LOG("File system module installed\n");
} }
FileSystemModule::~FileSystemModule() FileSystemModule::~FileSystemModule()
{ {
PRINTF("File system module: uninstalling\n"); LOG("File system module: uninstalling\n");
ASSERT(m_instance == this); ASSERT(m_instance == this);
for (FileItemMap::iterator for (FileItemMap::iterator
@ -198,7 +198,7 @@ FileSystemModule::~FileSystemModule()
delete fileitems_map; delete fileitems_map;
delete thumbnail_map; delete thumbnail_map;
PRINTF("File system module: uninstalled\n"); LOG("File system module: uninstalled\n");
m_instance = NULL; m_instance = NULL;
} }
@ -222,7 +222,7 @@ IFileItem* FileSystemModule::getRootFileItem()
fileitem = new FileItem(NULL); fileitem = new FileItem(NULL);
rootitem = fileitem; rootitem = fileitem;
//PRINTF("FS: Creating root fileitem %p\n", rootitem); //LOG("FS: Creating root fileitem %p\n", rootitem);
#ifdef _WIN32 #ifdef _WIN32
{ {
@ -261,7 +261,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
{ {
IFileItem* fileitem = NULL; IFileItem* fileitem = NULL;
//PRINTF("FS: get_fileitem_from_path(%s)\n", path.c_str()); //LOG("FS: get_fileitem_from_path(%s)\n", path.c_str());
#ifdef _WIN32 #ifdef _WIN32
{ {
@ -271,7 +271,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
if (path.empty()) { if (path.empty()) {
fileitem = getRootFileItem(); fileitem = getRootFileItem();
//PRINTF("FS: > %p (root)\n", fileitem); //LOG("FS: > %p (root)\n", fileitem);
return fileitem; return fileitem;
} }
@ -279,7 +279,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
(NULL, NULL, (NULL, NULL,
const_cast<LPWSTR>(base::from_utf8(path).c_str()), const_cast<LPWSTR>(base::from_utf8(path).c_str()),
&cbEaten, &fullpidl, &attrib) != S_OK) { &cbEaten, &fullpidl, &attrib) != S_OK) {
//PRINTF("FS: > (null)\n"); //LOG("FS: > (null)\n");
return NULL; return NULL;
} }
@ -293,7 +293,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
} }
#endif #endif
//PRINTF("FS: get_fileitem_from_path(%s) -> %p\n", path.c_str(), fileitem); //LOG("FS: get_fileitem_from_path(%s) -> %p\n", path.c_str(), fileitem);
return fileitem; return fileitem;
} }
@ -375,7 +375,7 @@ const FileItemList& FileItem::getChildren()
child->removed = true; child->removed = true;
} }
//PRINTF("FS: Loading files for %p (%s)\n", fileitem, fileitem->displayname); //LOG("FS: Loading files for %p (%s)\n", fileitem, fileitem->displayname);
#ifdef _WIN32 #ifdef _WIN32
{ {
IShellFolder* pFolder = NULL; IShellFolder* pFolder = NULL;
@ -548,7 +548,7 @@ void FileItem::setThumbnail(she::Surface* thumbnail)
FileItem::FileItem(FileItem* parent) FileItem::FileItem(FileItem* parent)
{ {
//PRINTF("FS: Creating %p fileitem with parent %p\n", this, parent); //LOG("FS: Creating %p fileitem with parent %p\n", this, parent);
this->keyname = NOTINITIALIZED; this->keyname = NOTINITIALIZED;
this->filename = NOTINITIALIZED; this->filename = NOTINITIALIZED;
@ -565,7 +565,7 @@ FileItem::FileItem(FileItem* parent)
FileItem::~FileItem() FileItem::~FileItem()
{ {
PRINTF("FS: Destroying FileItem() with parent %p\n", parent); LOG("FS: Destroying FileItem() with parent %p\n", parent);
#ifdef _WIN32 #ifdef _WIN32
if (this->fullpidl && this->fullpidl != this->pidl) { if (this->fullpidl && this->fullpidl != this->pidl) {
@ -813,7 +813,7 @@ static std::string get_key_for_pidl(LPITEMIDLIST pidl)
int len; int len;
// Go pidl by pidl from the fullpidl to the root (desktop) // Go pidl by pidl from the fullpidl to the root (desktop)
//PRINTF("FS: ***\n"); //LOG("FS: ***\n");
pidl = clone_pidl(pidl); pidl = clone_pidl(pidl);
while (pidl->mkid.cb > 0) { while (pidl->mkid.cb > 0) {
if (shl_idesktop->GetDisplayNameOf(pidl, if (shl_idesktop->GetDisplayNameOf(pidl,
@ -822,7 +822,7 @@ static std::string get_key_for_pidl(LPITEMIDLIST pidl)
if (StrRetToBuf(&strret, pidl, pszName, MAX_PATH) != S_OK) if (StrRetToBuf(&strret, pidl, pszName, MAX_PATH) != S_OK)
pszName[0] = 0; pszName[0] = 0;
//PRINTF("FS: + %s\n", pszName); //LOG("FS: + %s\n", pszName);
len = wcslen(pszName); len = wcslen(pszName);
if (len > 0) { if (len > 0) {
@ -844,7 +844,7 @@ static std::string get_key_for_pidl(LPITEMIDLIST pidl)
} }
free_pidl(pidl); free_pidl(pidl);
//PRINTF("FS: =%s\n***\n", key); //LOG("FS: =%s\n***\n", key);
return base::to_utf8(key); return base::to_utf8(key);
#endif #endif
} }
@ -877,7 +877,7 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_
update_by_pidl(fileitem, attrib); update_by_pidl(fileitem, attrib);
put_fileitem(fileitem); put_fileitem(fileitem);
//PRINTF("FS: fileitem %p created %s with parent %p\n", fileitem, fileitem->keyname.c_str(), fileitem->parent); //LOG("FS: fileitem %p created %s with parent %p\n", fileitem, fileitem->keyname.c_str(), fileitem->parent);
return fileitem; return fileitem;
} }

View File

@ -29,7 +29,7 @@ GuiXml* GuiXml::instance()
GuiXml::GuiXml() GuiXml::GuiXml()
{ {
PRINTF("Loading gui.xml file..."); LOG("Loading gui.xml file...");
ResourceFinder rf; ResourceFinder rf;
rf.includeDataDir("gui.xml"); rf.includeDataDir("gui.xml");

View File

@ -33,7 +33,7 @@ LoggerModule::LoggerModule(bool verbose)
LoggerModule::~LoggerModule() LoggerModule::~LoggerModule()
{ {
PRINTF("Logger module: shutting down (this is the last line)\n"); LOG("Logger module: shutting down (this is the last line)\n");
if (log_fileptr) { if (log_fileptr) {
fclose(log_fileptr); fclose(log_fileptr);
@ -45,7 +45,7 @@ LoggerModule::~LoggerModule()
} // namespace app } // namespace app
void verbose_printf(const char* format, ...) void verbose_log(const char* format, ...)
{ {
if (app::logger_instance && !app::logger_instance->isVerbose()) if (app::logger_instance && !app::logger_instance->isVerbose())
return; return;

View File

@ -42,7 +42,7 @@ LegacyModules::LegacyModules(int requirements)
{ {
for (int c=0; c<modules; c++) for (int c=0; c<modules; c++)
if ((module[c].reqs & requirements) == module[c].reqs) { if ((module[c].reqs & requirements) == module[c].reqs) {
PRINTF("Installing module: %s\n", module[c].name); LOG("Installing module: %s\n", module[c].name);
if ((*module[c].init)() < 0) if ((*module[c].init)() < 0)
throw base::Exception("Error initializing module: %s", throw base::Exception("Error initializing module: %s",
@ -56,7 +56,7 @@ LegacyModules::~LegacyModules()
{ {
for (int c=modules-1; c>=0; c--) for (int c=modules-1; c>=0; c--)
if (module[c].installed) { if (module[c].installed) {
PRINTF("Unstalling module: %s\n", module[c].name); LOG("Unstalling module: %s\n", module[c].name);
(*module[c].exit)(); (*module[c].exit)();
module[c].installed = false; module[c].installed = false;
} }

View File

@ -48,7 +48,7 @@ void HttpLoader::threadHttpRequest()
try { try {
base::ScopedValue<bool> scoped(m_done, false, true); base::ScopedValue<bool> scoped(m_done, false, true);
PRINTF("Sending http request to %s...\n", m_url.c_str()); LOG("Sending http request to %s...\n", m_url.c_str());
std::string dir = base::join_path(base::get_temp_path(), PACKAGE); std::string dir = base::join_path(base::get_temp_path(), PACKAGE);
base::make_all_directories(dir); base::make_all_directories(dir);
@ -68,13 +68,13 @@ void HttpLoader::threadHttpRequest()
if (response.status() == 200) if (response.status() == 200)
m_filename = fn; m_filename = fn;
PRINTF("Response: %d\n", response.status()); LOG("Response: %d\n", response.status());
} }
catch (const std::exception& e) { catch (const std::exception& e) {
PRINTF("Unexpected exception sending http request: '%s'\n", e.what()); LOG("Unexpected exception sending http request: '%s'\n", e.what());
} }
catch (...) { catch (...) {
PRINTF("Unexpected unknown exception sending http request\n"); LOG("Unexpected unknown exception sending http request\n");
} }
} }

View File

@ -28,14 +28,14 @@ ResourcesLoader::ResourcesLoader(ResourcesLoaderDelegate* delegate)
, m_cancel(false) , m_cancel(false)
, m_thread(Bind<void>(&ResourcesLoader::threadLoadResources, this)) , m_thread(Bind<void>(&ResourcesLoader::threadLoadResources, this))
{ {
PRINTF("ResourcesLoader::ResourcesLoader()\n"); LOG("ResourcesLoader::ResourcesLoader()\n");
} }
ResourcesLoader::~ResourcesLoader() ResourcesLoader::~ResourcesLoader()
{ {
m_thread.join(); m_thread.join();
PRINTF("ResourcesLoader::~ResourcesLoader()\n"); LOG("ResourcesLoader::~ResourcesLoader()\n");
} }
void ResourcesLoader::cancel() void ResourcesLoader::cancel()
@ -56,12 +56,12 @@ bool ResourcesLoader::next(base::UniquePtr<Resource>& resource)
void ResourcesLoader::threadLoadResources() void ResourcesLoader::threadLoadResources()
{ {
PRINTF("threadLoadResources()\n"); LOG("threadLoadResources()\n");
base::ScopedValue<bool> scoped(m_done, false, true); base::ScopedValue<bool> scoped(m_done, false, true);
std::string path = m_delegate->resourcesLocation(); std::string path = m_delegate->resourcesLocation();
PRINTF("Loading resources from %s...\n", path.c_str()); LOG("Loading resources from %s...\n", path.c_str());
if (path.empty()) if (path.empty())
return; return;

View File

@ -53,18 +53,18 @@ bool ResourceFinder::findFirst()
{ {
while (next()) { while (next()) {
if (m_log) if (m_log)
PRINTF("Loading resource from \"%s\"...\n", filename().c_str()); LOG("Loading resource from \"%s\"...\n", filename().c_str());
if (base::is_file(filename())) { if (base::is_file(filename())) {
if (m_log) if (m_log)
PRINTF("- OK\n"); LOG("- OK\n");
return true; return true;
} }
} }
if (m_log) if (m_log)
PRINTF("- Resource not found.\n"); LOG("- Resource not found.\n");
return false; return false;
} }
@ -136,7 +136,7 @@ void ResourceFinder::includeHomeDir(const char* filename)
addPath(buf); addPath(buf);
} }
else { else {
PRINTF("You don't have set $HOME variable\n"); LOG("You don't have set $HOME variable\n");
addPath(filename); addPath(filename);
} }

View File

@ -81,7 +81,7 @@ const char* WellKnownPointShapes::Spray = "spray";
ToolBox::ToolBox() ToolBox::ToolBox()
{ {
PRINTF("Toolbox module: installing\n"); LOG("Toolbox module: installing\n");
m_inks[WellKnownInks::Selection] = new SelectionInk(); m_inks[WellKnownInks::Selection] = new SelectionInk();
m_inks[WellKnownInks::Paint] = new PaintInk(PaintInk::Merge); m_inks[WellKnownInks::Paint] = new PaintInk(PaintInk::Merge);
@ -123,7 +123,7 @@ ToolBox::ToolBox()
loadTools(); loadTools();
PRINTF("Toolbox module: installed\n"); LOG("Toolbox module: installed\n");
} }
struct deleter { struct deleter {
@ -136,7 +136,7 @@ struct deleter {
ToolBox::~ToolBox() ToolBox::~ToolBox()
{ {
PRINTF("Toolbox module: uninstalling\n"); LOG("Toolbox module: uninstalling\n");
std::for_each(m_tools.begin(), m_tools.end(), deleter()); std::for_each(m_tools.begin(), m_tools.end(), deleter());
std::for_each(m_groups.begin(), m_groups.end(), deleter()); std::for_each(m_groups.begin(), m_groups.end(), deleter());
@ -145,7 +145,7 @@ ToolBox::~ToolBox()
std::for_each(m_controllers.begin(), m_controllers.end(), deleter()); std::for_each(m_controllers.begin(), m_controllers.end(), deleter());
std::for_each(m_inks.begin(), m_inks.end(), deleter()); std::for_each(m_inks.begin(), m_inks.end(), deleter());
PRINTF("Toolbox module: uninstalled\n"); LOG("Toolbox module: uninstalled\n");
} }
Tool* ToolBox::getToolById(const std::string& id) Tool* ToolBox::getToolById(const std::string& id)
@ -155,7 +155,7 @@ Tool* ToolBox::getToolById(const std::string& id)
if (tool->getId() == id) if (tool->getId() == id)
return tool; return tool;
} }
// PRINTF("Error get_tool_by_name() with '%s'\n", name.c_str()); // LOG("Error get_tool_by_name() with '%s'\n", name.c_str());
// ASSERT(false); // ASSERT(false);
return NULL; return NULL;
} }
@ -177,7 +177,7 @@ PointShape* ToolBox::getPointShapeById(const std::string& id)
void ToolBox::loadTools() void ToolBox::loadTools()
{ {
PRINTF("Loading Aseprite tools\n"); LOG("Loading Aseprite tools\n");
XmlDocumentRef doc(GuiXml::instance()->doc()); XmlDocumentRef doc(GuiXml::instance()->doc());
TiXmlHandle handle(doc.get()); TiXmlHandle handle(doc.get());
@ -188,7 +188,7 @@ void ToolBox::loadTools()
const char* group_id = xmlGroup->Attribute("id"); const char* group_id = xmlGroup->Attribute("id");
const char* group_text = xmlGroup->Attribute("text"); const char* group_text = xmlGroup->Attribute("text");
PRINTF(" - New group '%s'\n", group_id); LOG(" - New group '%s'\n", group_id);
if (!group_id || !group_text) if (!group_id || !group_text)
throw base::Exception("The configuration file has a <group> without 'id' or 'text' attributes."); throw base::Exception("The configuration file has a <group> without 'id' or 'text' attributes.");
@ -207,7 +207,7 @@ void ToolBox::loadTools()
Tool* tool = new Tool(tool_group, tool_id, tool_text, tool_tips, Tool* tool = new Tool(tool_group, tool_id, tool_text, tool_tips,
default_brush_size ? strtol(default_brush_size, NULL, 10): 1); default_brush_size ? strtol(default_brush_size, NULL, 10): 1);
PRINTF(" - New tool '%s' in group '%s' found\n", tool_id, group_id); LOG(" - New tool '%s' in group '%s' found\n", tool_id, group_id);
loadToolProperties(xmlTool, tool, 0, "left"); loadToolProperties(xmlTool, tool, 0, "left");
loadToolProperties(xmlTool, tool, 1, "right"); loadToolProperties(xmlTool, tool, 1, "right");

View File

@ -145,7 +145,7 @@ void MovingPixelsState::onEnterState(Editor* editor)
EditorState::LeaveAction MovingPixelsState::onLeaveState(Editor* editor, EditorState* newState) EditorState::LeaveAction MovingPixelsState::onLeaveState(Editor* editor, EditorState* newState)
{ {
PRINTF("MovingPixels: leave state\n"); LOG("MovingPixels: leave state\n");
ASSERT(m_pixelsMovement); ASSERT(m_pixelsMovement);
ASSERT(editor == m_editor); ASSERT(editor == m_editor);
@ -432,7 +432,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
{ {
Command* command = ev.command(); Command* command = ev.command();
PRINTF("MovingPixelsState::onBeforeCommandExecution %s\n", command->id().c_str()); LOG("MovingPixelsState::onBeforeCommandExecution %s\n", command->id().c_str());
// If the command is for other editor, we don't drop pixels. // If the command is for other editor, we don't drop pixels.
if (!isActiveEditor()) if (!isActiveEditor())
@ -581,7 +581,7 @@ void MovingPixelsState::setTransparentColor(bool opaque, const app::Color& color
void MovingPixelsState::dropPixels() void MovingPixelsState::dropPixels()
{ {
PRINTF("MovingPixels: drop pixels\n"); LOG("MovingPixels: drop pixels\n");
// Just change to default state (StandbyState generally). We'll // Just change to default state (StandbyState generally). We'll
// receive an onLeaveState() event after this call. // receive an onLeaveState() event after this call.

View File

@ -366,7 +366,7 @@ std::string FileSelector::show(
if (!start_folder) if (!start_folder)
start_folder = fs->getFileItemFromPath(start_folder_path); start_folder = fs->getFileItemFromPath(start_folder_path);
PRINTF("start_folder_path = %s (%p)\n", start_folder_path.c_str(), start_folder); LOG("start_folder_path = %s (%p)\n", start_folder_path.c_str(), start_folder);
setMinSize(gfx::Size(ui::display_w()*9/10, ui::display_h()*9/10)); setMinSize(gfx::Size(ui::display_w()*9/10, ui::display_h()*9/10));
remapWindow(); remapWindow();

View File

@ -335,7 +335,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
xmlParam = xmlParam->NextSiblingElement(); xmlParam = xmlParam->NextSiblingElement();
} }
PRINTF(" - Shortcut for command `%s' <%s>\n", command_name, command_key); LOG(" - Shortcut for command `%s' <%s>\n", command_name, command_key);
// add the keyboard shortcut to the command // add the keyboard shortcut to the command
Key* key = this->command(command_name, params, keycontext); Key* key = this->command(command_name, params, keycontext);
@ -375,7 +375,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
if (tool_id && tool_key) { if (tool_id && tool_key) {
tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id); tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id);
if (tool) { if (tool) {
PRINTF(" - Shortcut for tool `%s': <%s>\n", tool_id, tool_key); LOG(" - Shortcut for tool `%s': <%s>\n", tool_id, tool_key);
Key* key = this->tool(tool); Key* key = this->tool(tool);
if (key) { if (key) {
@ -404,7 +404,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
if (tool_id && tool_key) { if (tool_id && tool_key) {
tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id); tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id);
if (tool) { if (tool) {
PRINTF(" - Shortcut for quicktool `%s': <%s>\n", tool_id, tool_key); LOG(" - Shortcut for quicktool `%s': <%s>\n", tool_id, tool_key);
Key* key = this->quicktool(tool); Key* key = this->quicktool(tool);
if (key) { if (key) {
@ -431,7 +431,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
bool removed = bool_attr_is_true(xmlKey, "removed"); bool removed = bool_attr_is_true(xmlKey, "removed");
if (tool_action && tool_key) { if (tool_action && tool_key) {
PRINTF(" - Shortcut for sprite editor `%s': <%s>\n", tool_action, tool_key); LOG(" - Shortcut for sprite editor `%s': <%s>\n", tool_action, tool_key);
KeyAction action = base::convert_to<KeyAction, std::string>(tool_action); KeyAction action = base::convert_to<KeyAction, std::string>(tool_action);

View File

@ -197,7 +197,7 @@ void ResourcesListBox::onTick()
if (m_resourcesLoader->isDone()) { if (m_resourcesLoader->isDone()) {
stop(); stop();
PRINTF("Done\n"); LOG("Done\n");
} }
return; return;
} }

View File

@ -237,7 +237,7 @@ void SkinTheme::onRegenerate()
std::string id = xmlDim->Attribute("id"); std::string id = xmlDim->Attribute("id");
uint32_t value = strtol(xmlDim->Attribute("value"), NULL, 10); uint32_t value = strtol(xmlDim->Attribute("value"), NULL, 10);
PRINTF("Loading dimension '%s'...\n", id.c_str()); LOG("Loading dimension '%s'...\n", id.c_str());
m_dimensions_by_id[id] = value; m_dimensions_by_id[id] = value;
xmlDim = xmlDim->NextSiblingElement(); xmlDim = xmlDim->NextSiblingElement();
@ -258,7 +258,7 @@ void SkinTheme::onRegenerate()
(value & 0xff00) >> 8, (value & 0xff00) >> 8,
(value & 0xff)); (value & 0xff));
PRINTF("Loading color '%s'...\n", id.c_str()); LOG("Loading color '%s'...\n", id.c_str());
m_colors_by_id[id] = color; m_colors_by_id[id] = color;
xmlColor = xmlColor->NextSiblingElement(); xmlColor = xmlColor->NextSiblingElement();
@ -281,7 +281,7 @@ void SkinTheme::onRegenerate()
int focusy = strtol(xmlCursor->Attribute("focusy"), NULL, 10); int focusy = strtol(xmlCursor->Attribute("focusy"), NULL, 10);
int c; int c;
PRINTF("Loading cursor '%s'...\n", id.c_str()); LOG("Loading cursor '%s'...\n", id.c_str());
for (c=0; c<kCursorTypes; ++c) { for (c=0; c<kCursorTypes; ++c) {
if (id != cursor_names[c]) if (id != cursor_names[c])
@ -320,7 +320,7 @@ void SkinTheme::onRegenerate()
int w = strtol(xmlIcon->Attribute("w"), NULL, 10); int w = strtol(xmlIcon->Attribute("w"), NULL, 10);
int h = strtol(xmlIcon->Attribute("h"), NULL, 10); int h = strtol(xmlIcon->Attribute("h"), NULL, 10);
PRINTF("Loading tool icon '%s'...\n", tool_id); LOG("Loading tool icon '%s'...\n", tool_id);
// Crop the tool-icon from the sheet // Crop the tool-icon from the sheet
m_toolicon[tool_id] = sliceSheet( m_toolicon[tool_id] = sliceSheet(
@ -344,7 +344,7 @@ void SkinTheme::onRegenerate()
int w = xmlPart->Attribute("w") ? strtol(xmlPart->Attribute("w"), NULL, 10): 0; int w = xmlPart->Attribute("w") ? strtol(xmlPart->Attribute("w"), NULL, 10): 0;
int h = xmlPart->Attribute("h") ? strtol(xmlPart->Attribute("h"), NULL, 10): 0; int h = xmlPart->Attribute("h") ? strtol(xmlPart->Attribute("h"), NULL, 10): 0;
PRINTF("Loading part '%s'...\n", part_id); LOG("Loading part '%s'...\n", part_id);
SkinPartPtr part = m_parts_by_id[part_id]; SkinPartPtr part = m_parts_by_id[part_id];
if (!part) if (!part)
@ -397,7 +397,7 @@ void SkinTheme::onRegenerate()
while (xmlRule) { while (xmlRule) {
const std::string ruleName = xmlRule->Value(); const std::string ruleName = xmlRule->Value();
PRINTF("- Rule '%s' for '%s'\n", ruleName.c_str(), style_id); LOG("- Rule '%s' for '%s'\n", ruleName.c_str(), style_id);
// TODO This code design to read styles could be improved. // TODO This code design to read styles could be improved.

View File

@ -67,7 +67,7 @@ public:
if (file) { if (file) {
SI_Error err = m_ini.LoadFile(file.get()); SI_Error err = m_ini.LoadFile(file.get());
if (err != SI_OK) if (err != SI_OK)
PRINTF("Error '%d' loading configuration from '%s'.", err, m_filename.c_str()); LOG("Error '%d' loading configuration from '%s'.", err, m_filename.c_str());
} }
} }
@ -76,7 +76,7 @@ public:
if (file) { if (file) {
SI_Error err = m_ini.SaveFile(file.get()); SI_Error err = m_ini.SaveFile(file.get());
if (err != SI_OK) if (err != SI_OK)
PRINTF("Error '%d' saving configuration into '%s'.", err, m_filename.c_str()); LOG("Error '%d' saving configuration into '%s'.", err, m_filename.c_str());
} }
} }

View File

@ -34,16 +34,15 @@
#define UPDATE_URL WEBSITE "update/?xml=1" #define UPDATE_URL WEBSITE "update/?xml=1"
#define COPYRIGHT "Copyright (C) 2001-2015 David Capello" #define COPYRIGHT "Copyright (C) 2001-2015 David Capello"
#define PRINTF verbose_printf #define LOG verbose_log
#define LOG PRINTF
#ifdef _DEBUG #ifdef _DEBUG
#define DLOG PRINTF #define DLOG LOG
#else #else
#define DLOG(...) #define DLOG(...) ((void)0)
#endif #endif
// verbose_printf is defined in src/app/log.cpp and used through PRINTF macro // verbose_log() is defined in src/app/log.cpp and used through LOG macro
void verbose_printf(const char* format, ...); void verbose_log(const char* format, ...);
#include "base/base.h" #include "base/base.h"
#include "base/debug.h" #include "base/debug.h"

View File

@ -121,7 +121,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
ReleaseCapture(); ReleaseCapture();
} }
//PRINTF("GetCapture=%p hwnd=%p\n", GetCapture(), hwnd); //LOG("GetCapture=%p hwnd=%p\n", GetCapture(), hwnd);
Event ev; Event ev;
ev.setPosition(gfx::Point( ev.setPosition(gfx::Point(
@ -227,7 +227,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
(msg == WM_MOUSEWHEEL ? -z: 0)); (msg == WM_MOUSEWHEEL ? -z: 0));
ev.setWheelDelta(delta); ev.setWheelDelta(delta);
//PRINTF("WHEEL: %d %d\n", delta.x, delta.y); //LOG("WHEEL: %d %d\n", delta.x, delta.y);
queue_event(ev); queue_event(ev);
break; break;
@ -273,7 +273,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
(msg == WM_VSCROLL ? (z-50): 0)); (msg == WM_VSCROLL ? (z-50): 0));
ev.setWheelDelta(delta); ev.setWheelDelta(delta);
//PRINTF("SCROLL: %d %d\n", delta.x, delta.y); //LOG("SCROLL: %d %d\n", delta.x, delta.y);
SetScrollPos(hwnd, bar, 50, FALSE); SetScrollPos(hwnd, bar, 50, FALSE);
@ -307,7 +307,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
::MapWindowPoints(hwnd, NULL, (POINT*)&rc, 2); ::MapWindowPoints(hwnd, NULL, (POINT*)&rc, 2);
gfx::Rect area(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); gfx::Rect area(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
//PRINTF("NCHITTEST: %d %d - %d %d %d %d - %s\n", pt.x, pt.y, area.x, area.y, area.w, area.h, area.contains(pt) ? "true": "false"); //LOG("NCHITTEST: %d %d - %d %d %d %d - %s\n", pt.x, pt.y, area.x, area.y, area.w, area.h, area.contains(pt) ? "true": "false");
// We ignore scrollbars so if the mouse is above them, we return // We ignore scrollbars so if the mouse is above them, we return
// as it's in the window client or resize area. (Remember that // as it's in the window client or resize area. (Remember that

View File

@ -160,7 +160,7 @@ public:
} }
Display* createDisplay(int width, int height, int scale) override { Display* createDisplay(int width, int height, int scale) override {
//PRINTF("Creating display %dx%d (scale = %d)\n", width, height, scale); //LOG("Creating display %dx%d (scale = %d)\n", width, height, scale);
return new Alleg4Display(width, height, scale); return new Alleg4Display(width, height, scale);
} }

View File

@ -320,7 +320,7 @@ namespace she {
(msg == WM_MOUSEWHEEL ? -z: 0)); (msg == WM_MOUSEWHEEL ? -z: 0));
ev.setWheelDelta(delta); ev.setWheelDelta(delta);
//PRINTF("WHEEL: %d %d\n", delta.x, delta.y); //LOG("WHEEL: %d %d\n", delta.x, delta.y);
queueEvent(ev); queueEvent(ev);
break; break;
@ -366,7 +366,7 @@ namespace she {
(msg == WM_VSCROLL ? (z-50): 0)); (msg == WM_VSCROLL ? (z-50): 0));
ev.setWheelDelta(delta); ev.setWheelDelta(delta);
//PRINTF("SCROLL: %d %d\n", delta.x, delta.y); //LOG("SCROLL: %d %d\n", delta.x, delta.y);
SetScrollPos(m_hwnd, bar, 50, FALSE); SetScrollPos(m_hwnd, bar, 50, FALSE);

View File

@ -117,10 +117,8 @@ public:
HttpResponse response(&body); HttpResponse response(&body);
request.send(response); request.send(response);
#ifdef _DEBUG DLOG("Checking updates: %s (User-Agent: %s)\n", url.c_str(), getUserAgent().c_str());
PRINTF("Checking updates: %s (User-Agent: %s)\n", url.c_str(), getUserAgent().c_str()); DLOG("Response:\n--\n%s--\n", body.str().c_str());
PRINTF("Response:\n--\n%s--\n", body.str().c_str());
#endif
CheckUpdateResponse data(body.str()); CheckUpdateResponse data(body.str());
delegate->onResponse(data); delegate->onResponse(data);