diff --git a/data/widgets/about.xml b/data/widgets/about.xml
index d0198ec98..61924582a 100644
--- a/data/widgets/about.xml
+++ b/data/widgets/about.xml
@@ -8,9 +8,9 @@
-
+
-
+
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 9e5ecf936..72066f7e8 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -295,8 +295,9 @@ void App::initialize(const AppOptions& options)
// Default status of the main window.
app_rebuild_documents_tabs();
- app_default_statusbar_message();
+ m_mainWindow->statusBar()->showDefaultText();
+ // Show the main window (this is not modal, the code continues)
m_mainWindow->openWindow();
// Redraw the whole screen.
@@ -682,14 +683,6 @@ PixelFormat app_get_current_pixel_format()
return IMAGE_RGB;
}
-void app_default_statusbar_message()
-{
-#ifdef ENABLE_UI
- StatusBar::instance()
- ->setStatusText(250, "%s %s | %s", PACKAGE, VERSION, COPYRIGHT);
-#endif
-}
-
int app_get_color_to_clear_layer(Layer* layer)
{
ASSERT(layer != NULL);
diff --git a/src/app/app.h b/src/app/app.h
index 8ed5c6bdb..c3a822a4a 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -151,7 +151,6 @@ namespace app {
void app_refresh_screen();
void app_rebuild_documents_tabs();
PixelFormat app_get_current_pixel_format();
- void app_default_statusbar_message();
int app_get_color_to_clear_layer(doc::Layer* layer);
std::string memory_dump_filename();
diff --git a/src/app/ui/browser_view.cpp b/src/app/ui/browser_view.cpp
index b536febd3..360dd12c0 100644
--- a/src/app/ui/browser_view.cpp
+++ b/src/app/ui/browser_view.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2018 Igara Studio S.A.
+// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2016-2017 David Capello
//
// This program is distributed under the terms of
@@ -567,6 +567,7 @@ WorkspaceView* BrowserView::cloneWorkspaceView()
void BrowserView::onWorkspaceViewSelected()
{
+ // Do nothing
}
bool BrowserView::onCloseView(Workspace* workspace, bool quitting)
diff --git a/src/app/ui/data_recovery_view.cpp b/src/app/ui/data_recovery_view.cpp
index 48c65d129..27c7b1102 100644
--- a/src/app/ui/data_recovery_view.cpp
+++ b/src/app/ui/data_recovery_view.cpp
@@ -352,6 +352,7 @@ TabIcon DataRecoveryView::getTabIcon()
void DataRecoveryView::onWorkspaceViewSelected()
{
+ // Do nothing
}
bool DataRecoveryView::onCloseView(Workspace* workspace, bool quitting)
diff --git a/src/app/ui/doc_view.cpp b/src/app/ui/doc_view.cpp
index 52bfc9e85..0d899c388 100644
--- a/src/app/ui/doc_view.cpp
+++ b/src/app/ui/doc_view.cpp
@@ -240,7 +240,7 @@ WorkspaceView* DocView::cloneWorkspaceView()
void DocView::onWorkspaceViewSelected()
{
- // Do nothing
+ StatusBar::instance()->showDefaultText(m_document);
}
void DocView::onClonedFrom(WorkspaceView* from)
diff --git a/src/app/ui/home_view.cpp b/src/app/ui/home_view.cpp
index 1a60ab1ea..2bdb9c18f 100644
--- a/src/app/ui/home_view.cpp
+++ b/src/app/ui/home_view.cpp
@@ -21,6 +21,7 @@
#include "app/ui/main_window.h"
#include "app/ui/recent_listbox.h"
#include "app/ui/skin/skin_theme.h"
+#include "app/ui/status_bar.h"
#include "app/ui/workspace.h"
#include "app/ui/workspace_tabs.h"
#include "app/ui_context.h"
@@ -132,6 +133,7 @@ void HomeView::onTabPopup(Workspace* workspace)
void HomeView::onWorkspaceViewSelected()
{
+ StatusBar::instance()->showDefaultText();
}
void HomeView::onNewFile()
diff --git a/src/app/ui/main_window.cpp b/src/app/ui/main_window.cpp
index 27e0b102f..5bdf18cb6 100644
--- a/src/app/ui/main_window.cpp
+++ b/src/app/ui/main_window.cpp
@@ -477,21 +477,15 @@ void MainWindow::onMouseOverTab(Tabs* tabs, TabView* tabView)
{
// Note: tabView can be NULL
if (DocView* docView = dynamic_cast(tabView)) {
- Doc* document = docView->document();
-
- std::string name;
- if (Preferences::instance().general.showFullPath())
- name = document->filename();
- else
- name = base::get_file_name(document->filename());
-
- m_statusBar->showDefaultText(document);
+ m_statusBar->showDefaultText(docView->document());
}
- else
+ else {
m_statusBar->showDefaultText();
+ }
}
-void MainWindow::onMouseLeaveTab() {
+void MainWindow::onMouseLeaveTab()
+{
m_statusBar->showDefaultText();
}
diff --git a/src/app/ui/main_window.h b/src/app/ui/main_window.h
index c3de552a4..68869764a 100644
--- a/src/app/ui/main_window.h
+++ b/src/app/ui/main_window.h
@@ -58,6 +58,7 @@ namespace app {
MainMenuBar* getMenuBar() { return m_menuBar; }
ContextBar* getContextBar() { return m_contextBar; }
+ StatusBar* statusBar() { return m_statusBar; }
WorkspaceTabs* getTabsBar() { return m_tabsBar; }
Timeline* getTimeline() { return m_timeline; }
Workspace* getWorkspace() { return m_workspace; }
diff --git a/src/app/ui/status_bar.cpp b/src/app/ui/status_bar.cpp
index 4a1cf4389..ec93e7e14 100644
--- a/src/app/ui/status_bar.cpp
+++ b/src/app/ui/status_bar.cpp
@@ -36,10 +36,12 @@
#include "app/ui_context.h"
#include "app/util/range_utils.h"
#include "base/bind.h"
+#include "base/fs.h"
#include "base/string.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/sprite.h"
+#include "fmt/format.h"
#include "gfx/size.h"
#include "os/font.h"
#include "os/surface.h"
@@ -609,24 +611,41 @@ void StatusBar::clearText()
setStatusText(1, "");
}
+// TODO Workspace views should have a method to set the default status
+// bar text, because here the StatusBar is depending on too many
+// details of the main window/docs/etc.
void StatusBar::showDefaultText()
{
- showDefaultText(current_editor ? current_editor->document(): nullptr);
+ if (current_editor) {
+ showDefaultText(current_editor->document());
+ }
+ else if (App::instance()->mainWindow()->isHomeSelected()) {
+ setStatusText(0, "-- %s %s by David & Gaspar Capello -- Igara Studio --",
+ PACKAGE, VERSION);
+ }
+ else {
+ clearText();
+ }
}
void StatusBar::showDefaultText(Doc* doc)
{
clearText();
- if (doc){
- std::string buf = base::string_printf("%s :size: %d %d",
- doc->name().c_str(),
- doc->width(),
- doc->height());
+ if (doc) {
+ std::string buf =
+ fmt::format("{} :size: {} {}",
+ doc->name(), doc->width(), doc->height());
if (doc->getTransformation().bounds().w != 0) {
- buf += base::string_printf(" :selsize: %d %d",
- int(doc->getTransformation().bounds().w),
- int(doc->getTransformation().bounds().h));
+ buf += fmt::format(" :selsize: {} {}",
+ int(doc->getTransformation().bounds().w),
+ int(doc->getTransformation().bounds().h));
}
+ if (Preferences::instance().general.showFullPath()) {
+ std::string path = base::get_file_path(doc->filename());
+ if (!path.empty())
+ buf += fmt::format(" ({})", path);
+ }
+
setStatusText(1, buf.c_str());
}
}
diff --git a/src/app/ui/workspace_panel.cpp b/src/app/ui/workspace_panel.cpp
index e375d6b7d..db314b134 100644
--- a/src/app/ui/workspace_panel.cpp
+++ b/src/app/ui/workspace_panel.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2018 Igara Studio S.A.
+// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@@ -150,6 +150,9 @@ void WorkspacePanel::setActiveView(WorkspaceView* view)
m_tabs->selectTab(dynamic_cast(view));
adjustActiveViewBounds();
+
+ if (m_activeView)
+ m_activeView->onWorkspaceViewSelected();
}
void WorkspacePanel::onPaint(PaintEvent& ev)