From d6684691bfd2cf937cd65a197075277e3077002c Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 28 Aug 2015 20:48:49 -0300 Subject: [PATCH] Rename PRINTF to LOG --- src/app/app.cpp | 12 ++++----- src/app/app_menus.cpp | 10 ++++---- src/app/context.cpp | 20 +++++++-------- src/app/file/file.cpp | 4 +-- src/app/file/gif_format.cpp | 8 +++--- src/app/file/jpeg_format.cpp | 2 +- src/app/file_system.cpp | 30 +++++++++++------------ src/app/gui_xml.cpp | 2 +- src/app/log.cpp | 4 +-- src/app/modules.cpp | 4 +-- src/app/res/http_loader.cpp | 8 +++--- src/app/res/resources_loader.cpp | 8 +++--- src/app/resource_finder.cpp | 8 +++--- src/app/tools/tool_box.cpp | 16 ++++++------ src/app/ui/editor/moving_pixels_state.cpp | 6 ++--- src/app/ui/file_selector.cpp | 2 +- src/app/ui/keyboard_shortcuts.cpp | 8 +++--- src/app/ui/resources_listbox.cpp | 2 +- src/app/ui/skin/skin_theme.cpp | 12 ++++----- src/cfg/cfg.cpp | 4 +-- src/config.h | 11 ++++----- src/she/alleg4/alleg_display.cpp | 8 +++--- src/she/alleg4/she.cpp | 2 +- src/she/win/window.h | 4 +-- src/updater/check_update.cpp | 6 ++--- 25 files changed, 99 insertions(+), 102 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 4f5fd9112..8e70ff776 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -175,7 +175,7 @@ void App::initialize(const AppOptions& options) FileFormatsManager::instance()->registerAllFormats(); if (isPortable()) - PRINTF("Running in portable mode\n"); + LOG("Running in portable mode\n"); // Load or create the default palette, or migrate the default // palette from an old format palette to the new one, etc. @@ -184,7 +184,7 @@ void App::initialize(const AppOptions& options) // Initialize GUI interface UIContext* ctx = UIContext::instance(); if (isGui()) { - PRINTF("GUI mode\n"); + LOG("GUI mode\n"); // Setup the GUI cursor and redraw screen @@ -213,7 +213,7 @@ void App::initialize(const AppOptions& options) } // Procress options - PRINTF("Processing options...\n"); + LOG("Processing options...\n"); bool ignoreEmpty = false; bool trim = false; @@ -506,7 +506,7 @@ void App::initialize(const AppOptions& options) // Export if (m_exporter) { - PRINTF("Exporting sheet...\n"); + LOG("Exporting sheet...\n"); if (ignoreEmpty) m_exporter->setIgnoreEmptyCels(true); @@ -517,7 +517,7 @@ void App::initialize(const AppOptions& options) base::UniquePtr spriteSheet(m_exporter->exportSheet()); 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); // Remove Aseprite handlers - PRINTF("ASE: Uninstalling\n"); + LOG("ASE: Uninstalling\n"); // Delete file formats. FileFormatsManager::destroyInstance(); diff --git a/src/app/app_menus.cpp b/src/app/app_menus.cpp index dae2758b0..26beff747 100644 --- a/src/app/app_menus.cpp +++ b/src/app/app_menus.cpp @@ -71,7 +71,7 @@ void AppMenus::reload() //////////////////////////////////////// // Load menus - PRINTF(" - Loading menus from \"%s\"...\n", path); + LOG(" - Loading menus from \"%s\"...\n", path); m_rootMenu.reset(loadMenuById(handle, "main_menu")); @@ -79,7 +79,7 @@ void AppMenus::reload() if (GuiXml::instance()->version() != VERSION) m_rootMenu->insertChild(0, createInvalidVersionMenuitem()); - PRINTF("Main menu loaded.\n"); + LOG("Main menu loaded.\n"); m_tabPopupMenu.reset(loadMenuById(handle, "tab_popup")); m_documentTabPopupMenu.reset(loadMenuById(handle, "document_tab_popup")); @@ -93,7 +93,7 @@ void AppMenus::reload() //////////////////////////////////////// // 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 .FirstChild("gui") @@ -165,7 +165,7 @@ Menu* AppMenus::loadMenuById(TiXmlHandle& handle, const char* id) { ASSERT(id != NULL); - //PRINTF("loadMenuById(%s)\n", id); + //LOG("loadMenuById(%s)\n", id); // TiXmlElement* xmlMenu = handle @@ -188,7 +188,7 @@ Menu* AppMenus::convertXmlelemToMenu(TiXmlElement* elem) { 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(); while (child) { diff --git a/src/app/context.cpp b/src/app/context.cpp index a44b0ddbc..88bb30150 100644 --- a/src/app/context.cpp +++ b/src/app/context.cpp @@ -53,7 +53,7 @@ void Context::executeCommand(Command* command, const Params& params) ASSERT(command != NULL); - PRINTF("Context: Executing command '%s'...\n", command->id().c_str()); + LOG("Context: Executing command '%s'...\n", command->id().c_str()); try { m_flags.update(this); @@ -63,14 +63,14 @@ void Context::executeCommand(Command* command, const Params& params) BeforeCommandExecution(ev); 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)) { command->execute(this); - PRINTF("Context: '%s' executed successfully\n", command->id().c_str()); + LOG("Context: '%s' executed successfully\n", command->id().c_str()); } else { - PRINTF("Context: '%s' is disabled\n", command->id().c_str()); + LOG("Context: '%s' is disabled\n", command->id().c_str()); } AfterCommandExecution(ev); @@ -80,21 +80,21 @@ void Context::executeCommand(Command* command, const Params& params) app_rebuild_documents_tabs(); } catch (base::Exception& e) { - PRINTF("Context: Exception caught executing '%s' command\n%s\n", - command->id().c_str(), e.what()); + LOG("Context: Exception caught executing '%s' command\n%s\n", + command->id().c_str(), e.what()); Console::showException(e); } catch (std::exception& e) { - PRINTF("Context: std::exception caught executing '%s' command\n%s\n", - command->id().c_str(), e.what()); + LOG("Context: std::exception caught executing '%s' command\n%s\n", + command->id().c_str(), e.what()); console.printf("An error ocurred executing the command.\n\nDetails:\n%s", e.what()); } #ifndef DEBUGMODE catch (...) { - PRINTF("Context: Unknown exception executing '%s' command\n", - command->id().c_str()); + LOG("Context: Unknown exception executing '%s' command\n", + command->id().c_str()); console.printf("An unknown error ocurred executing the command.\n" "Please save your work, close the program, try it\n" diff --git a/src/app/file/file.cpp b/src/app/file/file.cpp index 838b940c3..40b9c8747 100644 --- a/src/app/file/file.cpp +++ b/src/app/file/file.cpp @@ -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) 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? 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) 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 fop->format = FileFormatsManager::instance() diff --git a/src/app/file/gif_format.cpp b/src/app/file/gif_format.cpp index 32cda2c43..41fd1f537 100644 --- a/src/app/file/gif_format.cpp +++ b/src/app/file/gif_format.cpp @@ -182,7 +182,7 @@ public: , m_remap(256) , m_hasLocalColormaps(false) , m_firstLocalColormap(nullptr) { - // PRINTF("GIF background index = %d\n", (int)m_gifFile->SBackGroundColor); + // LOG("GIF background index = %d\n", (int)m_gifFile->SBackGroundColor); } ~GifDecoder() { @@ -300,7 +300,7 @@ private: UniquePtr frameImage( 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_localTransparentIndex >= 0) @@ -602,7 +602,7 @@ private: m_localTransparentIndex = (extension[1] & 1) ? extension[4]: -1; 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); } } @@ -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, // prev.x, prev.y, prev.w, prev.h, // next.x, next.y, next.w, next.h); diff --git a/src/app/file/jpeg_format.cpp b/src/app/file/jpeg_format.cpp index ebd8f88be..9f0bac77b 100644 --- a/src/app/file/jpeg_format.cpp +++ b/src/app/file/jpeg_format.cpp @@ -90,7 +90,7 @@ static void output_message(j_common_ptr cinfo) (*cinfo->err->format_message)(cinfo, buffer); // Put in the log file if. - PRINTF("JPEG library: \"%s\"\n", buffer); + LOG("JPEG library: \"%s\"\n", buffer); // Leave the message for the application. fop_error(((struct error_mgr *)cinfo->err)->fop, "%s\n", buffer); diff --git a/src/app/file_system.cpp b/src/app/file_system.cpp index 5fcb4cf50..445cf4c7c 100644 --- a/src/app/file_system.cpp +++ b/src/app/file_system.cpp @@ -166,12 +166,12 @@ FileSystemModule::FileSystemModule() // the 'rootitem' FileItem) getRootFileItem(); - PRINTF("File system module installed\n"); + LOG("File system module installed\n"); } FileSystemModule::~FileSystemModule() { - PRINTF("File system module: uninstalling\n"); + LOG("File system module: uninstalling\n"); ASSERT(m_instance == this); for (FileItemMap::iterator @@ -198,7 +198,7 @@ FileSystemModule::~FileSystemModule() delete fileitems_map; delete thumbnail_map; - PRINTF("File system module: uninstalled\n"); + LOG("File system module: uninstalled\n"); m_instance = NULL; } @@ -222,7 +222,7 @@ IFileItem* FileSystemModule::getRootFileItem() fileitem = new FileItem(NULL); rootitem = fileitem; - //PRINTF("FS: Creating root fileitem %p\n", rootitem); + //LOG("FS: Creating root fileitem %p\n", rootitem); #ifdef _WIN32 { @@ -261,7 +261,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path) { 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 { @@ -271,7 +271,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path) if (path.empty()) { fileitem = getRootFileItem(); - //PRINTF("FS: > %p (root)\n", fileitem); + //LOG("FS: > %p (root)\n", fileitem); return fileitem; } @@ -279,7 +279,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path) (NULL, NULL, const_cast(base::from_utf8(path).c_str()), &cbEaten, &fullpidl, &attrib) != S_OK) { - //PRINTF("FS: > (null)\n"); + //LOG("FS: > (null)\n"); return NULL; } @@ -293,7 +293,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path) } #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; } @@ -375,7 +375,7 @@ const FileItemList& FileItem::getChildren() 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 { IShellFolder* pFolder = NULL; @@ -548,7 +548,7 @@ void FileItem::setThumbnail(she::Surface* thumbnail) 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->filename = NOTINITIALIZED; @@ -565,7 +565,7 @@ FileItem::FileItem(FileItem* parent) FileItem::~FileItem() { - PRINTF("FS: Destroying FileItem() with parent %p\n", parent); + LOG("FS: Destroying FileItem() with parent %p\n", parent); #ifdef _WIN32 if (this->fullpidl && this->fullpidl != this->pidl) { @@ -813,7 +813,7 @@ static std::string get_key_for_pidl(LPITEMIDLIST pidl) int len; // Go pidl by pidl from the fullpidl to the root (desktop) - //PRINTF("FS: ***\n"); + //LOG("FS: ***\n"); pidl = clone_pidl(pidl); while (pidl->mkid.cb > 0) { 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) pszName[0] = 0; - //PRINTF("FS: + %s\n", pszName); + //LOG("FS: + %s\n", pszName); len = wcslen(pszName); if (len > 0) { @@ -844,7 +844,7 @@ static std::string get_key_for_pidl(LPITEMIDLIST pidl) } free_pidl(pidl); - //PRINTF("FS: =%s\n***\n", key); + //LOG("FS: =%s\n***\n", key); return base::to_utf8(key); #endif } @@ -877,7 +877,7 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_ update_by_pidl(fileitem, attrib); 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; } diff --git a/src/app/gui_xml.cpp b/src/app/gui_xml.cpp index 6cf19a000..0518d75d2 100644 --- a/src/app/gui_xml.cpp +++ b/src/app/gui_xml.cpp @@ -29,7 +29,7 @@ GuiXml* GuiXml::instance() GuiXml::GuiXml() { - PRINTF("Loading gui.xml file..."); + LOG("Loading gui.xml file..."); ResourceFinder rf; rf.includeDataDir("gui.xml"); diff --git a/src/app/log.cpp b/src/app/log.cpp index bad9cc06e..ddd6d1246 100644 --- a/src/app/log.cpp +++ b/src/app/log.cpp @@ -33,7 +33,7 @@ LoggerModule::LoggerModule(bool verbose) 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) { fclose(log_fileptr); @@ -45,7 +45,7 @@ LoggerModule::~LoggerModule() } // namespace app -void verbose_printf(const char* format, ...) +void verbose_log(const char* format, ...) { if (app::logger_instance && !app::logger_instance->isVerbose()) return; diff --git a/src/app/modules.cpp b/src/app/modules.cpp index 7546ea4d5..2d6b765f4 100644 --- a/src/app/modules.cpp +++ b/src/app/modules.cpp @@ -42,7 +42,7 @@ LegacyModules::LegacyModules(int requirements) { for (int c=0; c=0; c--) 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].installed = false; } diff --git a/src/app/res/http_loader.cpp b/src/app/res/http_loader.cpp index a195dd2c2..6c3311a6a 100644 --- a/src/app/res/http_loader.cpp +++ b/src/app/res/http_loader.cpp @@ -48,7 +48,7 @@ void HttpLoader::threadHttpRequest() try { base::ScopedValue 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); base::make_all_directories(dir); @@ -68,13 +68,13 @@ void HttpLoader::threadHttpRequest() if (response.status() == 200) m_filename = fn; - PRINTF("Response: %d\n", response.status()); + LOG("Response: %d\n", response.status()); } 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 (...) { - PRINTF("Unexpected unknown exception sending http request\n"); + LOG("Unexpected unknown exception sending http request\n"); } } diff --git a/src/app/res/resources_loader.cpp b/src/app/res/resources_loader.cpp index 45dd19c10..49d68e766 100644 --- a/src/app/res/resources_loader.cpp +++ b/src/app/res/resources_loader.cpp @@ -28,14 +28,14 @@ ResourcesLoader::ResourcesLoader(ResourcesLoaderDelegate* delegate) , m_cancel(false) , m_thread(Bind(&ResourcesLoader::threadLoadResources, this)) { - PRINTF("ResourcesLoader::ResourcesLoader()\n"); + LOG("ResourcesLoader::ResourcesLoader()\n"); } ResourcesLoader::~ResourcesLoader() { m_thread.join(); - PRINTF("ResourcesLoader::~ResourcesLoader()\n"); + LOG("ResourcesLoader::~ResourcesLoader()\n"); } void ResourcesLoader::cancel() @@ -56,12 +56,12 @@ bool ResourcesLoader::next(base::UniquePtr& resource) void ResourcesLoader::threadLoadResources() { - PRINTF("threadLoadResources()\n"); + LOG("threadLoadResources()\n"); base::ScopedValue scoped(m_done, false, true); 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()) return; diff --git a/src/app/resource_finder.cpp b/src/app/resource_finder.cpp index 2b347c688..44245d6a7 100644 --- a/src/app/resource_finder.cpp +++ b/src/app/resource_finder.cpp @@ -53,18 +53,18 @@ bool ResourceFinder::findFirst() { while (next()) { 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 (m_log) - PRINTF("- OK\n"); + LOG("- OK\n"); return true; } } if (m_log) - PRINTF("- Resource not found.\n"); + LOG("- Resource not found.\n"); return false; } @@ -136,7 +136,7 @@ void ResourceFinder::includeHomeDir(const char* filename) addPath(buf); } else { - PRINTF("You don't have set $HOME variable\n"); + LOG("You don't have set $HOME variable\n"); addPath(filename); } diff --git a/src/app/tools/tool_box.cpp b/src/app/tools/tool_box.cpp index 2eb7e5bcc..78b497a51 100644 --- a/src/app/tools/tool_box.cpp +++ b/src/app/tools/tool_box.cpp @@ -81,7 +81,7 @@ const char* WellKnownPointShapes::Spray = "spray"; ToolBox::ToolBox() { - PRINTF("Toolbox module: installing\n"); + LOG("Toolbox module: installing\n"); m_inks[WellKnownInks::Selection] = new SelectionInk(); m_inks[WellKnownInks::Paint] = new PaintInk(PaintInk::Merge); @@ -123,7 +123,7 @@ ToolBox::ToolBox() loadTools(); - PRINTF("Toolbox module: installed\n"); + LOG("Toolbox module: installed\n"); } struct deleter { @@ -136,7 +136,7 @@ struct deleter { 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_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_inks.begin(), m_inks.end(), deleter()); - PRINTF("Toolbox module: uninstalled\n"); + LOG("Toolbox module: uninstalled\n"); } Tool* ToolBox::getToolById(const std::string& id) @@ -155,7 +155,7 @@ Tool* ToolBox::getToolById(const std::string& id) if (tool->getId() == id) 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); return NULL; } @@ -177,7 +177,7 @@ PointShape* ToolBox::getPointShapeById(const std::string& id) void ToolBox::loadTools() { - PRINTF("Loading Aseprite tools\n"); + LOG("Loading Aseprite tools\n"); XmlDocumentRef doc(GuiXml::instance()->doc()); TiXmlHandle handle(doc.get()); @@ -188,7 +188,7 @@ void ToolBox::loadTools() const char* group_id = xmlGroup->Attribute("id"); 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) throw base::Exception("The configuration file has a without 'id' or 'text' attributes."); @@ -207,7 +207,7 @@ void ToolBox::loadTools() Tool* tool = new Tool(tool_group, tool_id, tool_text, tool_tips, 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, 1, "right"); diff --git a/src/app/ui/editor/moving_pixels_state.cpp b/src/app/ui/editor/moving_pixels_state.cpp index e00ee2b8e..5f54584f9 100644 --- a/src/app/ui/editor/moving_pixels_state.cpp +++ b/src/app/ui/editor/moving_pixels_state.cpp @@ -145,7 +145,7 @@ void MovingPixelsState::onEnterState(Editor* editor) EditorState::LeaveAction MovingPixelsState::onLeaveState(Editor* editor, EditorState* newState) { - PRINTF("MovingPixels: leave state\n"); + LOG("MovingPixels: leave state\n"); ASSERT(m_pixelsMovement); ASSERT(editor == m_editor); @@ -432,7 +432,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev) { 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 (!isActiveEditor()) @@ -581,7 +581,7 @@ void MovingPixelsState::setTransparentColor(bool opaque, const app::Color& color void MovingPixelsState::dropPixels() { - PRINTF("MovingPixels: drop pixels\n"); + LOG("MovingPixels: drop pixels\n"); // Just change to default state (StandbyState generally). We'll // receive an onLeaveState() event after this call. diff --git a/src/app/ui/file_selector.cpp b/src/app/ui/file_selector.cpp index 4c82deabc..55f4c20c7 100644 --- a/src/app/ui/file_selector.cpp +++ b/src/app/ui/file_selector.cpp @@ -366,7 +366,7 @@ std::string FileSelector::show( if (!start_folder) 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)); remapWindow(); diff --git a/src/app/ui/keyboard_shortcuts.cpp b/src/app/ui/keyboard_shortcuts.cpp index feba25ecb..0f24f8237 100644 --- a/src/app/ui/keyboard_shortcuts.cpp +++ b/src/app/ui/keyboard_shortcuts.cpp @@ -335,7 +335,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source) 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 Key* key = this->command(command_name, params, keycontext); @@ -375,7 +375,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source) if (tool_id && tool_key) { tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id); 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); if (key) { @@ -404,7 +404,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source) if (tool_id && tool_key) { tools::Tool* tool = App::instance()->getToolBox()->getToolById(tool_id); 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); if (key) { @@ -431,7 +431,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source) bool removed = bool_attr_is_true(xmlKey, "removed"); 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(tool_action); diff --git a/src/app/ui/resources_listbox.cpp b/src/app/ui/resources_listbox.cpp index 8ae060fc4..93b43fab0 100644 --- a/src/app/ui/resources_listbox.cpp +++ b/src/app/ui/resources_listbox.cpp @@ -197,7 +197,7 @@ void ResourcesListBox::onTick() if (m_resourcesLoader->isDone()) { stop(); - PRINTF("Done\n"); + LOG("Done\n"); } return; } diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index 8ebd4966a..9118c03f4 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -237,7 +237,7 @@ void SkinTheme::onRegenerate() std::string id = xmlDim->Attribute("id"); 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; xmlDim = xmlDim->NextSiblingElement(); @@ -258,7 +258,7 @@ void SkinTheme::onRegenerate() (value & 0xff00) >> 8, (value & 0xff)); - PRINTF("Loading color '%s'...\n", id.c_str()); + LOG("Loading color '%s'...\n", id.c_str()); m_colors_by_id[id] = color; xmlColor = xmlColor->NextSiblingElement(); @@ -281,7 +281,7 @@ void SkinTheme::onRegenerate() int focusy = strtol(xmlCursor->Attribute("focusy"), NULL, 10); int c; - PRINTF("Loading cursor '%s'...\n", id.c_str()); + LOG("Loading cursor '%s'...\n", id.c_str()); for (c=0; cAttribute("w"), 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 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 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]; if (!part) @@ -397,7 +397,7 @@ void SkinTheme::onRegenerate() while (xmlRule) { 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. diff --git a/src/cfg/cfg.cpp b/src/cfg/cfg.cpp index 3f76408bc..51c4987c7 100644 --- a/src/cfg/cfg.cpp +++ b/src/cfg/cfg.cpp @@ -67,7 +67,7 @@ public: if (file) { SI_Error err = m_ini.LoadFile(file.get()); 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) { SI_Error err = m_ini.SaveFile(file.get()); 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()); } } diff --git a/src/config.h b/src/config.h index 73754befa..038216183 100644 --- a/src/config.h +++ b/src/config.h @@ -34,16 +34,15 @@ #define UPDATE_URL WEBSITE "update/?xml=1" #define COPYRIGHT "Copyright (C) 2001-2015 David Capello" -#define PRINTF verbose_printf -#define LOG PRINTF +#define LOG verbose_log #ifdef _DEBUG -#define DLOG PRINTF +#define DLOG LOG #else -#define DLOG(...) +#define DLOG(...) ((void)0) #endif -// verbose_printf is defined in src/app/log.cpp and used through PRINTF macro -void verbose_printf(const char* format, ...); +// verbose_log() is defined in src/app/log.cpp and used through LOG macro +void verbose_log(const char* format, ...); #include "base/base.h" #include "base/debug.h" diff --git a/src/she/alleg4/alleg_display.cpp b/src/she/alleg4/alleg_display.cpp index c42bc20d2..d798baf33 100644 --- a/src/she/alleg4/alleg_display.cpp +++ b/src/she/alleg4/alleg_display.cpp @@ -121,7 +121,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara ReleaseCapture(); } - //PRINTF("GetCapture=%p hwnd=%p\n", GetCapture(), hwnd); + //LOG("GetCapture=%p hwnd=%p\n", GetCapture(), hwnd); Event ev; 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)); ev.setWheelDelta(delta); - //PRINTF("WHEEL: %d %d\n", delta.x, delta.y); + //LOG("WHEEL: %d %d\n", delta.x, delta.y); queue_event(ev); break; @@ -273,7 +273,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara (msg == WM_VSCROLL ? (z-50): 0)); 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); @@ -307,7 +307,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara ::MapWindowPoints(hwnd, NULL, (POINT*)&rc, 2); 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 // as it's in the window client or resize area. (Remember that diff --git a/src/she/alleg4/she.cpp b/src/she/alleg4/she.cpp index cbefd2838..7727cdc56 100644 --- a/src/she/alleg4/she.cpp +++ b/src/she/alleg4/she.cpp @@ -160,7 +160,7 @@ public: } 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); } diff --git a/src/she/win/window.h b/src/she/win/window.h index 23f2ca77a..5d57db9c3 100644 --- a/src/she/win/window.h +++ b/src/she/win/window.h @@ -320,7 +320,7 @@ namespace she { (msg == WM_MOUSEWHEEL ? -z: 0)); ev.setWheelDelta(delta); - //PRINTF("WHEEL: %d %d\n", delta.x, delta.y); + //LOG("WHEEL: %d %d\n", delta.x, delta.y); queueEvent(ev); break; @@ -366,7 +366,7 @@ namespace she { (msg == WM_VSCROLL ? (z-50): 0)); 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); diff --git a/src/updater/check_update.cpp b/src/updater/check_update.cpp index 6e114ddaa..ced6c8318 100644 --- a/src/updater/check_update.cpp +++ b/src/updater/check_update.cpp @@ -117,10 +117,8 @@ public: HttpResponse response(&body); request.send(response); -#ifdef _DEBUG - PRINTF("Checking updates: %s (User-Agent: %s)\n", url.c_str(), getUserAgent().c_str()); - PRINTF("Response:\n--\n%s--\n", body.str().c_str()); -#endif + DLOG("Checking updates: %s (User-Agent: %s)\n", url.c_str(), getUserAgent().c_str()); + DLOG("Response:\n--\n%s--\n", body.str().c_str()); CheckUpdateResponse data(body.str()); delegate->onResponse(data);