From 85e75122b5f0f92211ed55793a4c6ef6580e2f74 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 29 Dec 2010 23:19:45 -0300 Subject: [PATCH] Show current sprite's filename in window title bar. --- src/modules/gui.cpp | 3 --- src/ui_context.cpp | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/modules/gui.cpp b/src/modules/gui.cpp index 76e7f450a..2243d8540 100644 --- a/src/modules/gui.cpp +++ b/src/modules/gui.cpp @@ -292,9 +292,6 @@ int init_module_gui() gfx_done:; - /* window title */ - set_window_title(PACKAGE " v" VERSION); - /* create the default-manager */ manager = jmanager_new(); jwidget_add_hook(manager, JI_WIDGET, manager_msg_proc, NULL); diff --git a/src/ui_context.cpp b/src/ui_context.cpp index bf64bede6..3069eaf83 100644 --- a/src/ui_context.cpp +++ b/src/ui_context.cpp @@ -19,8 +19,10 @@ #include "config.h" #include +#include #include "app.h" +#include "base/path.h" #include "modules/editors.h" #include "raster/sprite.h" #include "settings/ui_settings_impl.h" @@ -71,9 +73,19 @@ void UIContext::on_remove_sprite(Sprite* sprite) void UIContext::on_set_current_sprite(Sprite* sprite) { - // base method Context::on_set_current_sprite(sprite); - // select the sprite in the tabs + // Select the sprite in the tabs. app_get_tabsbar()->selectTab(sprite); + + // Change the main frame title. + base::string defaultTitle = PACKAGE " v" VERSION; + base::string title; + if (sprite) { + // Prepend the sprite's filename. + title += base::get_file_name(sprite->getFilename()); + title += " - "; + } + title += defaultTitle; + set_window_title(title.c_str()); }