mirror of https://github.com/aseprite/aseprite.git
Add View > Workspace Layout option to switch the layout w/keys
This commit is contained in:
parent
3792d2e540
commit
b86eea780f
|
@ -175,6 +175,7 @@
|
|||
<param name="popup" value="background" />
|
||||
</key>
|
||||
<key command="ShowExtras" shortcut="Ctrl+H" />
|
||||
<key command="ToggleWorkspaceLayout" shortcut="Shift+W" />
|
||||
<!-- Tabs -->
|
||||
<key command="GotoNextTab" shortcut="Ctrl+Tab" />
|
||||
<key command="GotoPreviousTab" shortcut="Ctrl+Shift+Tab" />
|
||||
|
@ -1002,6 +1003,7 @@
|
|||
</menu>
|
||||
<menu text="@.view" id="view_menu">
|
||||
<item command="DuplicateView" text="@.view_duplicate_view" group="view_new" />
|
||||
<item command="ToggleWorkspaceLayout" text="@.view_workspace_layout" />
|
||||
<separator />
|
||||
<item command="ShowExtras" text="@.view_show_extras" />
|
||||
<menu text="@.view_show" group="view_extras">
|
||||
|
|
|
@ -488,6 +488,7 @@ TilesetDuplicate = Duplicate Tileset
|
|||
Undo = Undo
|
||||
UndoHistory = Undo History
|
||||
UnlinkCel = Unlink Cel
|
||||
ToggleWorkspaceLayout = Toggle Workspace Layout
|
||||
Zoom = Zoom
|
||||
Zoom_In = Zoom In
|
||||
Zoom_Out = Zoom Out
|
||||
|
@ -1163,6 +1164,7 @@ select_load_from_file = &Load from MSK file
|
|||
select_save_to_file = &Save to MSK file
|
||||
view = &View
|
||||
view_duplicate_view = Duplicate &View
|
||||
view_workspace_layout = Workspace &Layout
|
||||
view_show_extras = &Extras
|
||||
view_show = &Show
|
||||
view_show_layer_edges = &Layer Edges
|
||||
|
|
|
@ -520,6 +520,7 @@ target_sources(app-lib PRIVATE
|
|||
commands/tileset_mode.cpp
|
||||
commands/toggle_other_layers_opacity.cpp
|
||||
commands/toggle_play_option.cpp
|
||||
commands/toggle_workspace_layout.cpp
|
||||
console.cpp
|
||||
context.cpp
|
||||
context_flags.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
@ -174,6 +174,7 @@ FOR_EACH_COMMAND(TogglePreview)
|
|||
FOR_EACH_COMMAND(ToggleRewindOnStop)
|
||||
FOR_EACH_COMMAND(ToggleTilesMode)
|
||||
FOR_EACH_COMMAND(ToggleTimelineThumbnails)
|
||||
FOR_EACH_COMMAND(ToggleWorkspaceLayout)
|
||||
FOR_EACH_COMMAND(Undo)
|
||||
FOR_EACH_COMMAND(UndoHistory)
|
||||
FOR_EACH_COMMAND(UnlinkCel)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
// Aseprite
|
||||
// Copyright (c) 2024 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/ui/layout_selector.h"
|
||||
#include "app/ui/main_window.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class ToggleWorkspaceLayoutCommand : public Command {
|
||||
public:
|
||||
ToggleWorkspaceLayoutCommand();
|
||||
|
||||
protected:
|
||||
bool onChecked(Context* ctx) override;
|
||||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
ToggleWorkspaceLayoutCommand::ToggleWorkspaceLayoutCommand()
|
||||
: Command(CommandId::ToggleWorkspaceLayout(), CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
bool ToggleWorkspaceLayoutCommand::onChecked(Context* ctx)
|
||||
{
|
||||
return App::instance()->mainWindow()->layoutSelector()->isSelectorVisible();
|
||||
}
|
||||
|
||||
void ToggleWorkspaceLayoutCommand::onExecute(Context* ctx)
|
||||
{
|
||||
App::instance()->mainWindow()->layoutSelector()->switchSelectorFromCommand();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createToggleWorkspaceLayoutCommand()
|
||||
{
|
||||
return new ToggleWorkspaceLayoutCommand();
|
||||
}
|
||||
|
||||
} // namespace app
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2021-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2021-2024 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "new_layout.xml.h"
|
||||
|
||||
#define ANI_TICKS 5
|
||||
#define ANI_TICKS 2
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -292,10 +292,20 @@ void LayoutSelector::onAnimationFrame()
|
|||
void LayoutSelector::onAnimationStop(int animation)
|
||||
{
|
||||
switch (animation) {
|
||||
case ANI_EXPANDING: m_comboBox.setSizeHint(m_endSize); break;
|
||||
case ANI_EXPANDING:
|
||||
m_comboBox.setSizeHint(m_endSize);
|
||||
if (m_switchComboBoxAfterAni) {
|
||||
m_switchComboBoxAfterAni = false;
|
||||
m_comboBox.openListBox();
|
||||
}
|
||||
break;
|
||||
case ANI_COLLAPSING:
|
||||
m_comboBox.setVisible(false);
|
||||
m_comboBox.setSizeHint(m_endSize);
|
||||
if (m_switchComboBoxAfterAni) {
|
||||
m_switchComboBoxAfterAni = false;
|
||||
m_comboBox.closeListBox();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -338,6 +348,17 @@ void LayoutSelector::switchSelector()
|
|||
startAnimation((expand ? ANI_EXPANDING : ANI_COLLAPSING), ANI_TICKS);
|
||||
}
|
||||
|
||||
void LayoutSelector::switchSelectorFromCommand()
|
||||
{
|
||||
m_switchComboBoxAfterAni = true;
|
||||
switchSelector();
|
||||
}
|
||||
|
||||
bool LayoutSelector::isSelectorVisible() const
|
||||
{
|
||||
return (m_comboBox.isVisible());
|
||||
}
|
||||
|
||||
void LayoutSelector::setupTooltips(TooltipManager* tooltipManager)
|
||||
{
|
||||
tooltipManager->addTooltipFor(&m_button, Strings::main_window_layout(), TOP);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2021-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2021-2024 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
@ -48,6 +48,9 @@ public:
|
|||
~LayoutSelector();
|
||||
|
||||
void addLayout(const LayoutPtr& layout);
|
||||
void switchSelector();
|
||||
void switchSelectorFromCommand();
|
||||
bool isSelectorVisible() const;
|
||||
|
||||
// Dockable impl
|
||||
int dockableAt() const override { return ui::TOP | ui::BOTTOM; }
|
||||
|
@ -56,13 +59,13 @@ private:
|
|||
void setupTooltips(ui::TooltipManager* tooltipManager);
|
||||
void onAnimationFrame() override;
|
||||
void onAnimationStop(int animation) override;
|
||||
void switchSelector();
|
||||
|
||||
LayoutComboBox m_comboBox;
|
||||
IconButton m_button;
|
||||
gfx::Size m_startSize;
|
||||
gfx::Size m_endSize;
|
||||
Layouts m_layouts;
|
||||
bool m_switchComboBoxAfterAni = false;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
// TODO refactor: remove the get prefix from these functions
|
||||
MainMenuBar* getMenuBar() { return m_menuBar.get(); }
|
||||
LayoutSelector* layoutSelector() { return m_layoutSelector.get(); }
|
||||
ContextBar* getContextBar() { return m_contextBar.get(); }
|
||||
StatusBar* statusBar() { return m_statusBar.get(); }
|
||||
WorkspaceTabs* getTabsBar() { return m_tabsBar.get(); }
|
||||
|
|
Loading…
Reference in New Issue