mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-15 19:52:05 +00:00
Disable Ctrl+Tab (and Ctrl+Shift+Tab) when we are dragging tabs
This commit is contained in:
parent
61fa0b454f
commit
39859e9858
@ -23,7 +23,8 @@ public:
|
||||
Command* clone() const override { return new GotoNextTabCommand(*this); }
|
||||
|
||||
protected:
|
||||
void onExecute(Context* context);
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
GotoNextTabCommand::GotoNextTabCommand()
|
||||
@ -33,6 +34,11 @@ GotoNextTabCommand::GotoNextTabCommand()
|
||||
{
|
||||
}
|
||||
|
||||
bool GotoNextTabCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->getMainWindow()->getWorkspace()->canSelectOtherTab();
|
||||
}
|
||||
|
||||
void GotoNextTabCommand::onExecute(Context* context)
|
||||
{
|
||||
App::instance()->getMainWindow()->getWorkspace()->selectNextTab();
|
||||
@ -44,7 +50,8 @@ public:
|
||||
Command* clone() const override { return new GotoPreviousTabCommand(*this); }
|
||||
|
||||
protected:
|
||||
void onExecute(Context* context);
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
GotoPreviousTabCommand::GotoPreviousTabCommand()
|
||||
@ -54,6 +61,11 @@ GotoPreviousTabCommand::GotoPreviousTabCommand()
|
||||
{
|
||||
}
|
||||
|
||||
bool GotoPreviousTabCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->getMainWindow()->getWorkspace()->canSelectOtherTab();
|
||||
}
|
||||
|
||||
void GotoPreviousTabCommand::onExecute(Context* context)
|
||||
{
|
||||
App::instance()->getMainWindow()->getWorkspace()->selectPreviousTab();
|
||||
|
@ -172,6 +172,12 @@ void Tabs::updateTabs()
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// Returns true if the user can select other tab.
|
||||
bool Tabs::canSelectOtherTab() const
|
||||
{
|
||||
return (m_selected && !m_isDragging);
|
||||
}
|
||||
|
||||
void Tabs::selectTab(TabView* tabView)
|
||||
{
|
||||
ASSERT(tabView != NULL);
|
||||
|
@ -126,6 +126,9 @@ namespace app {
|
||||
void removeTab(TabView* tabView, bool with_animation);
|
||||
void updateTabs();
|
||||
|
||||
// Returns true if the user can select other tab.
|
||||
bool canSelectOtherTab() const;
|
||||
|
||||
void selectTab(TabView* tabView);
|
||||
void selectNextTab();
|
||||
void selectPreviousTab();
|
||||
|
@ -106,6 +106,11 @@ void Workspace::setMainPanelAsActive()
|
||||
ActiveViewChanged(); // Fire ActiveViewChanged event
|
||||
}
|
||||
|
||||
bool Workspace::canSelectOtherTab() const
|
||||
{
|
||||
return m_activePanel->tabs()->canSelectOtherTab();
|
||||
}
|
||||
|
||||
void Workspace::selectNextTab()
|
||||
{
|
||||
m_activePanel->tabs()->selectNextTab();
|
||||
|
@ -41,6 +41,7 @@ namespace app {
|
||||
WorkspaceView* activeView();
|
||||
void setActiveView(WorkspaceView* view);
|
||||
void setMainPanelAsActive();
|
||||
bool canSelectOtherTab() const;
|
||||
void selectNextTab();
|
||||
void selectPreviousTab();
|
||||
void duplicateActiveView();
|
||||
|
Loading…
Reference in New Issue
Block a user