mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Several changes to default StatusBar text
* Change the Home status bar text * Show the full path of the document (if the user preferences allow us) when we move the mouse over the document tab * We weren't calling onWorkspaceViewSelected() from WorkspacePanel::setActiveView()
This commit is contained in:
parent
706590df05
commit
ad64deef6c
@ -8,9 +8,9 @@
|
||||
<label text="Animated sprite editor && pixel art tool" />
|
||||
<separator text="Authors:" horizontal="true" />
|
||||
<grid columns="2">
|
||||
<link text="David Capello" url="https://davidcapello.com/" />
|
||||
<link text="David Capello" url="https://twitter.com/davidcapello" />
|
||||
<label text="- Lead developer, graphics && maintainer" />
|
||||
<link text="Gaspar Capello" url="https://github.com/Gasparoken" />
|
||||
<link text="Gaspar Capello" url="https://twitter.com/Gasparoken" />
|
||||
<label text="- Programmer, bug fixing" />
|
||||
|
||||
<separator text="Contributors:" horizontal="true" cell_hspan="2" />
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -352,6 +352,7 @@ TabIcon DataRecoveryView::getTabIcon()
|
||||
|
||||
void DataRecoveryView::onWorkspaceViewSelected()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool DataRecoveryView::onCloseView(Workspace* workspace, bool quitting)
|
||||
|
@ -240,7 +240,7 @@ WorkspaceView* DocView::cloneWorkspaceView()
|
||||
|
||||
void DocView::onWorkspaceViewSelected()
|
||||
{
|
||||
// Do nothing
|
||||
StatusBar::instance()->showDefaultText(m_document);
|
||||
}
|
||||
|
||||
void DocView::onClonedFrom(WorkspaceView* from)
|
||||
|
@ -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()
|
||||
|
@ -477,21 +477,15 @@ void MainWindow::onMouseOverTab(Tabs* tabs, TabView* tabView)
|
||||
{
|
||||
// Note: tabView can be NULL
|
||||
if (DocView* docView = dynamic_cast<DocView*>(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();
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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<TabView*>(view));
|
||||
|
||||
adjustActiveViewBounds();
|
||||
|
||||
if (m_activeView)
|
||||
m_activeView->onWorkspaceViewSelected();
|
||||
}
|
||||
|
||||
void WorkspacePanel::onPaint(PaintEvent& ev)
|
||||
|
Loading…
x
Reference in New Issue
Block a user