Show current sprite's filename in window title bar.

This commit is contained in:
David Capello 2010-12-29 23:19:45 -03:00
parent 6a64fa311f
commit 85e75122b5
2 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

@ -19,8 +19,10 @@
#include "config.h"
#include <allegro/file.h>
#include <allegro/system.h>
#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());
}