mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 21:39:57 +00:00
Add ContextBar::updateForCurrentTool() which is a common thing to do
This commit is contained in:
parent
e398a1f21f
commit
18b067ee77
@ -125,7 +125,7 @@ void NewBrushCommand::onQuickboxEnd(const gfx::Rect& rect, ui::MouseButtons butt
|
||||
// TODO find a way to avoid all these singletons. Maybe a simple
|
||||
// signal in the context like "brush has changed" could be enough.
|
||||
App::instance()->getMainWindow()->getContextBar()
|
||||
->updateFromTool(UIContext::instance()->settings()->getCurrentTool());
|
||||
->updateForCurrentTool();
|
||||
|
||||
current_editor->backToPreviousState();
|
||||
}
|
||||
|
@ -895,8 +895,7 @@ void ContextBar::onCurrentToolChange()
|
||||
if (m_activeBrush->type() != kImageBrushType)
|
||||
setActiveBrush(ContextBar::createBrushFromSettings());
|
||||
else {
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
updateFromTool(settings->getCurrentTool());
|
||||
updateForCurrentTool();
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,7 +904,12 @@ void ContextBar::onDropPixels(ContextBarObserver::DropAction action)
|
||||
notifyObservers(&ContextBarObserver::onDropPixels, action);
|
||||
}
|
||||
|
||||
void ContextBar::updateFromTool(tools::Tool* tool)
|
||||
void ContextBar::updateForCurrentTool()
|
||||
{
|
||||
updateForTool(UIContext::instance()->settings()->getCurrentTool());
|
||||
}
|
||||
|
||||
void ContextBar::updateForTool(tools::Tool* tool)
|
||||
{
|
||||
base::ScopedValue<bool> lockFlag(g_updatingFromTool, true, false);
|
||||
|
||||
@ -1002,7 +1006,7 @@ void ContextBar::updateForMovingPixels()
|
||||
tools::Tool* tool = App::instance()->getToolBox()->getToolById(
|
||||
tools::WellKnownTools::RectangularMarquee);
|
||||
if (tool)
|
||||
updateFromTool(tool);
|
||||
updateForTool(tool);
|
||||
|
||||
m_dropPixels->deselectItems();
|
||||
m_dropPixels->setVisible(true);
|
||||
@ -1111,8 +1115,7 @@ void ContextBar::setActiveBrush(const doc::BrushRef& brush)
|
||||
{
|
||||
m_activeBrush = brush;
|
||||
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
updateFromTool(settings->getCurrentTool());
|
||||
updateForCurrentTool();
|
||||
}
|
||||
|
||||
doc::BrushRef ContextBar::activeBrush(tools::Tool* tool) const
|
||||
|
@ -40,7 +40,8 @@ namespace app {
|
||||
ContextBar();
|
||||
~ContextBar();
|
||||
|
||||
void updateFromTool(tools::Tool* tool);
|
||||
void updateForCurrentTool();
|
||||
void updateForTool(tools::Tool* tool);
|
||||
void updateForMovingPixels();
|
||||
void updateSelectionMode(SelectionMode mode);
|
||||
void updateAutoSelectLayer(bool state);
|
||||
|
@ -1139,7 +1139,7 @@ void Editor::updateQuicktool()
|
||||
updateStatusBar();
|
||||
|
||||
App::instance()->getMainWindow()->getContextBar()
|
||||
->updateFromTool(getCurrentEditorTool());
|
||||
->updateForTool(getCurrentEditorTool());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ MovingPixelsState::~MovingPixelsState()
|
||||
{
|
||||
ContextBar* contextBar = App::instance()->getMainWindow()->getContextBar();
|
||||
contextBar->removeObserver(this);
|
||||
contextBar->updateFromTool(UIContext::instance()->settings()->getCurrentTool());
|
||||
contextBar->updateForCurrentTool();
|
||||
|
||||
m_ctxConn.disconnect();
|
||||
UIContext::instance()->settings()->selection()->removeObserver(this);
|
||||
|
@ -386,8 +386,7 @@ void MainWindow::configureWorkspaceLayout()
|
||||
App::instance()->preferences().general.visibleTimeline());
|
||||
|
||||
if (m_contextBar->isVisible()) {
|
||||
m_contextBar->updateFromTool(
|
||||
UIContext::instance()->settings()->getCurrentTool());
|
||||
m_contextBar->updateForCurrentTool();
|
||||
}
|
||||
|
||||
layout();
|
||||
|
Loading…
x
Reference in New Issue
Block a user