mirror of https://github.com/aseprite/aseprite.git
Change notification flag location inside the layout selector widget
This improves the look of the flag as another icon above the tabs bottom and at the right of the layout selector icon.
This commit is contained in:
parent
d6c5ac6786
commit
b08662eeca
|
@ -317,8 +317,9 @@ void LayoutSelector::LayoutComboBox::onCloseListBox()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutSelector::LayoutSelector(TooltipManager* tooltipManager)
|
LayoutSelector::LayoutSelector(TooltipManager* tooltipManager, Widget* notifications)
|
||||||
: m_button(SkinTheme::instance()->parts.iconLayout())
|
: m_button(SkinTheme::instance()->parts.iconLayout())
|
||||||
|
, m_notifications(notifications)
|
||||||
{
|
{
|
||||||
setActiveLayoutId(Preferences::instance().general.workspaceLayout());
|
setActiveLayoutId(Preferences::instance().general.workspaceLayout());
|
||||||
|
|
||||||
|
@ -332,6 +333,7 @@ LayoutSelector::LayoutSelector(TooltipManager* tooltipManager)
|
||||||
addChild(&m_bottom);
|
addChild(&m_bottom);
|
||||||
m_center.addChild(&m_comboBox);
|
m_center.addChild(&m_comboBox);
|
||||||
m_center.addChild(&m_button);
|
m_center.addChild(&m_button);
|
||||||
|
m_center.addChild(m_notifications);
|
||||||
|
|
||||||
setupTooltips(tooltipManager);
|
setupTooltips(tooltipManager);
|
||||||
initTheme();
|
initTheme();
|
||||||
|
@ -339,6 +341,8 @@ LayoutSelector::LayoutSelector(TooltipManager* tooltipManager)
|
||||||
|
|
||||||
LayoutSelector::~LayoutSelector()
|
LayoutSelector::~LayoutSelector()
|
||||||
{
|
{
|
||||||
|
m_center.removeChild(m_notifications);
|
||||||
|
|
||||||
Preferences::instance().general.workspaceLayout(m_activeLayoutId);
|
Preferences::instance().general.workspaceLayout(m_activeLayoutId);
|
||||||
|
|
||||||
if (!is_app_state_closing())
|
if (!is_app_state_closing())
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LayoutSelector : public ui::VBox,
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LayoutSelector(ui::TooltipManager* tooltipManager);
|
LayoutSelector(ui::TooltipManager* tooltipManager, ui::Widget* notifications);
|
||||||
~LayoutSelector();
|
~LayoutSelector();
|
||||||
|
|
||||||
LayoutPtr activeLayout() const;
|
LayoutPtr activeLayout() const;
|
||||||
|
@ -88,6 +88,7 @@ private:
|
||||||
ui::HBox m_top, m_center, m_bottom;
|
ui::HBox m_top, m_center, m_bottom;
|
||||||
LayoutComboBox m_comboBox;
|
LayoutComboBox m_comboBox;
|
||||||
IconButton m_button;
|
IconButton m_button;
|
||||||
|
Widget* m_notifications = nullptr;
|
||||||
gfx::Size m_startSize;
|
gfx::Size m_startSize;
|
||||||
gfx::Size m_endSize;
|
gfx::Size m_endSize;
|
||||||
Layouts m_layouts;
|
Layouts m_layouts;
|
||||||
|
|
|
@ -117,7 +117,8 @@ MainWindow::MainWindow()
|
||||||
void MainWindow::initialize()
|
void MainWindow::initialize()
|
||||||
{
|
{
|
||||||
m_menuBar = std::make_unique<MainMenuBar>();
|
m_menuBar = std::make_unique<MainMenuBar>();
|
||||||
m_layoutSelector = std::make_unique<LayoutSelector>(m_tooltipManager);
|
m_notifications = std::make_unique<Notifications>();
|
||||||
|
m_layoutSelector = std::make_unique<LayoutSelector>(m_tooltipManager, m_notifications.get());
|
||||||
|
|
||||||
// Register commands to load menus+shortcuts for these commands
|
// Register commands to load menus+shortcuts for these commands
|
||||||
Editor::registerCommands();
|
Editor::registerCommands();
|
||||||
|
@ -128,7 +129,6 @@ void MainWindow::initialize()
|
||||||
// Setup the main menubar
|
// Setup the main menubar
|
||||||
m_menuBar->setMenu(AppMenus::instance()->getRootMenu());
|
m_menuBar->setMenu(AppMenus::instance()->getRootMenu());
|
||||||
|
|
||||||
m_notifications = std::make_unique<Notifications>();
|
|
||||||
m_statusBar = std::make_unique<StatusBar>(m_tooltipManager);
|
m_statusBar = std::make_unique<StatusBar>(m_tooltipManager);
|
||||||
m_toolBar = std::make_unique<ToolBar>();
|
m_toolBar = std::make_unique<ToolBar>();
|
||||||
m_tabsBar = std::make_unique<WorkspaceTabs>(this);
|
m_tabsBar = std::make_unique<WorkspaceTabs>(this);
|
||||||
|
@ -173,8 +173,7 @@ void MainWindow::initialize()
|
||||||
m_customizableDockPlaceholder = std::make_unique<Widget>();
|
m_customizableDockPlaceholder = std::make_unique<Widget>();
|
||||||
m_customizableDockPlaceholder->addChild(m_customizableDock);
|
m_customizableDockPlaceholder->addChild(m_customizableDock);
|
||||||
|
|
||||||
m_dock->top()->right()->dock(ui::RIGHT, m_notifications.get());
|
m_dock->top()->dock(ui::RIGHT, m_layoutSelector.get());
|
||||||
m_dock->top()->right()->dock(ui::CENTER, m_layoutSelector.get());
|
|
||||||
m_dock->top()->center()->dock(ui::BOTTOM, m_tabsBar.get());
|
m_dock->top()->center()->dock(ui::BOTTOM, m_tabsBar.get());
|
||||||
m_dock->top()->center()->dock(ui::CENTER, m_menuBar.get());
|
m_dock->top()->center()->dock(ui::CENTER, m_menuBar.get());
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2024 Igara Studio S.A.
|
// Copyright (C) 2018-2025 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
|
@ -144,6 +144,7 @@ private:
|
||||||
Dock* m_customizableDock;
|
Dock* m_customizableDock;
|
||||||
std::unique_ptr<Widget> m_customizableDockPlaceholder;
|
std::unique_ptr<Widget> m_customizableDockPlaceholder;
|
||||||
std::unique_ptr<MainMenuBar> m_menuBar;
|
std::unique_ptr<MainMenuBar> m_menuBar;
|
||||||
|
std::unique_ptr<Notifications> m_notifications;
|
||||||
std::unique_ptr<LayoutSelector> m_layoutSelector;
|
std::unique_ptr<LayoutSelector> m_layoutSelector;
|
||||||
std::unique_ptr<StatusBar> m_statusBar;
|
std::unique_ptr<StatusBar> m_statusBar;
|
||||||
std::unique_ptr<ColorBar> m_colorBar;
|
std::unique_ptr<ColorBar> m_colorBar;
|
||||||
|
@ -155,7 +156,6 @@ private:
|
||||||
std::unique_ptr<Workspace> m_workspace;
|
std::unique_ptr<Workspace> m_workspace;
|
||||||
std::unique_ptr<PreviewEditorWindow> m_previewEditor;
|
std::unique_ptr<PreviewEditorWindow> m_previewEditor;
|
||||||
std::unique_ptr<HomeView> m_homeView;
|
std::unique_ptr<HomeView> m_homeView;
|
||||||
std::unique_ptr<Notifications> m_notifications;
|
|
||||||
std::unique_ptr<INotificationDelegate> m_scalePanic;
|
std::unique_ptr<INotificationDelegate> m_scalePanic;
|
||||||
std::unique_ptr<BrowserView> m_browserView;
|
std::unique_ptr<BrowserView> m_browserView;
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
// Copyright (C) 2020-2025 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
|
using namespace app::skin;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
class NotificationItem : public MenuItem {
|
class NotificationItem : public MenuItem {
|
||||||
|
@ -39,10 +40,7 @@ private:
|
||||||
INotificationDelegate* m_delegate;
|
INotificationDelegate* m_delegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
Notifications::Notifications()
|
Notifications::Notifications() : Button(""), m_red(false)
|
||||||
: Button("")
|
|
||||||
, m_flagStyle(skin::SkinTheme::get(this)->styles.flag())
|
|
||||||
, m_red(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,13 +50,22 @@ void Notifications::addLink(INotificationDelegate* del)
|
||||||
m_red = true;
|
m_red = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notifications::onInitTheme(InitThemeEvent& ev)
|
||||||
|
{
|
||||||
|
Button::onInitTheme(ev);
|
||||||
|
m_popup.initTheme();
|
||||||
|
}
|
||||||
|
|
||||||
void Notifications::onSizeHint(SizeHintEvent& ev)
|
void Notifications::onSizeHint(SizeHintEvent& ev)
|
||||||
{
|
{
|
||||||
ev.setSizeHint(gfx::Size(16, 10) * guiscale()); // TODO hard-coded flag size
|
auto* theme = SkinTheme::get(this);
|
||||||
|
auto hint = theme->calcSizeHint(this, theme->styles.flag());
|
||||||
|
ev.setSizeHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::onPaint(PaintEvent& ev)
|
void Notifications::onPaint(PaintEvent& ev)
|
||||||
{
|
{
|
||||||
|
auto* theme = SkinTheme::get(this);
|
||||||
Graphics* g = ev.graphics();
|
Graphics* g = ev.graphics();
|
||||||
|
|
||||||
PaintWidgetPartInfo info;
|
PaintWidgetPartInfo info;
|
||||||
|
@ -69,7 +76,7 @@ void Notifications::onPaint(PaintEvent& ev)
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
info.styleFlags |= ui::Style::Layer::kSelected;
|
info.styleFlags |= ui::Style::Layer::kSelected;
|
||||||
|
|
||||||
theme()->paintWidgetPart(g, m_flagStyle, clientBounds(), info);
|
theme->paintWidgetPart(g, theme->styles.flag(), clientBounds(), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::onClick()
|
void Notifications::onClick()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
// Copyright (C) 2020-2025 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
|
@ -32,12 +32,12 @@ public:
|
||||||
int dockableAt() const override { return ui::TOP | ui::BOTTOM | ui::LEFT | ui::RIGHT; }
|
int dockableAt() const override { return ui::TOP | ui::BOTTOM | ui::LEFT | ui::RIGHT; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void onInitTheme(ui::InitThemeEvent& ev) override;
|
||||||
void onSizeHint(ui::SizeHintEvent& ev) override;
|
void onSizeHint(ui::SizeHintEvent& ev) override;
|
||||||
void onPaint(ui::PaintEvent& ev) override;
|
void onPaint(ui::PaintEvent& ev) override;
|
||||||
void onClick() override;
|
void onClick() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ui::Style* m_flagStyle;
|
|
||||||
bool m_red;
|
bool m_red;
|
||||||
ui::Menu m_popup;
|
ui::Menu m_popup;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue