Merge branch 'master' into beta

This commit is contained in:
David Capello 2016-11-29 19:05:35 -03:00
commit 1378275364
4 changed files with 19 additions and 13 deletions

View File

@ -1751,12 +1751,14 @@ void ContextBar::updateToolLoopModifiersIndicators(tools::ToolLoopModifiers modi
void ContextBar::updateAutoSelectLayer(bool state)
{
if (!m_autoSelectLayer->isVisible())
return;
m_autoSelectLayer->setSelected(state);
}
bool ContextBar::isAutoSelectLayer() const
{
return m_autoSelectLayer->isSelected();
}
void ContextBar::setActiveBrushBySlot(tools::Tool* tool, int slot)
{
ASSERT(tool);

View File

@ -53,6 +53,7 @@ namespace app {
void updateForSelectingBox(const std::string& text);
void updateToolLoopModifiersIndicators(app::tools::ToolLoopModifiers modifiers);
void updateAutoSelectLayer(bool state);
bool isAutoSelectLayer() const;
void setActiveBrush(const doc::BrushRef& brush);
void setActiveBrushBySlot(tools::Tool* tool, int slot);

View File

@ -162,7 +162,6 @@ Editor::Editor(Document* document, EditorFlags flags)
, m_brushPreview(this)
, m_lastDrawingPosition(-1, -1)
, m_toolLoopModifiers(tools::ToolLoopModifiers::kNone)
, m_autoSelectLayer(false)
, m_padding(0, 0)
, m_antsTimer(100, this)
, m_antsOffset(0)
@ -1029,6 +1028,11 @@ tools::Ink* Editor::getCurrentEditorInk()
return App::instance()->activeToolManager()->activeInk();
}
bool Editor::isAutoSelectLayer() const
{
return App::instance()->contextBar()->isAutoSelectLayer();
}
gfx::Point Editor::screenToEditor(const gfx::Point& pt)
{
View* view = View::getView(this);
@ -1185,7 +1189,8 @@ void Editor::updateToolByTipProximity(ui::PointerType pointerType)
void Editor::updateToolLoopModifiersIndicators()
{
int modifiers = int(tools::ToolLoopModifiers::kNone);
bool autoSelectLayer = Preferences::instance().editor.autoSelectLayer();
const bool autoSelectLayer = isAutoSelectLayer();
bool newAutoSelectLayer = autoSelectLayer;
KeyAction action;
if (m_customizationDelegate) {
@ -1197,7 +1202,6 @@ void Editor::updateToolLoopModifiersIndicators()
(int(tools::ToolLoopModifiers::kReplaceSelection) |
int(tools::ToolLoopModifiers::kAddSelection) |
int(tools::ToolLoopModifiers::kSubtractSelection)));
autoSelectLayer = m_autoSelectLayer;
// Shape tools (line, curves, rectangles, etc.)
action = m_customizationDelegate->getPressedKeyAction(KeyContext::ShapeTool);
@ -1226,7 +1230,9 @@ void Editor::updateToolLoopModifiersIndicators()
// For move tool
action = m_customizationDelegate->getPressedKeyAction(KeyContext::MoveTool);
if (int(action & KeyAction::AutoSelectLayer))
autoSelectLayer = true;
newAutoSelectLayer = true;
else
newAutoSelectLayer = Preferences::instance().editor.autoSelectLayer();
}
}
@ -1243,10 +1249,8 @@ void Editor::updateToolLoopModifiersIndicators()
}
}
if (m_autoSelectLayer != autoSelectLayer) {
m_autoSelectLayer = autoSelectLayer;
ctxBar->updateAutoSelectLayer(autoSelectLayer);
}
if (autoSelectLayer != newAutoSelectLayer)
ctxBar->updateAutoSelectLayer(newAutoSelectLayer);
}
app::Color Editor::getColorByPosition(const gfx::Point& mousePos)

View File

@ -181,7 +181,7 @@ namespace app {
tools::Ink* getCurrentEditorInk();
tools::ToolLoopModifiers getToolLoopModifiers() const { return m_toolLoopModifiers; }
bool isAutoSelectLayer() const { return m_autoSelectLayer; }
bool isAutoSelectLayer() const;
bool isSecondaryButton() const { return m_secondaryButton; }
gfx::Point lastDrawingPosition() const { return m_lastDrawingPosition; }
@ -296,7 +296,6 @@ namespace app {
gfx::Point m_lastDrawingPosition;
tools::ToolLoopModifiers m_toolLoopModifiers;
bool m_autoSelectLayer;
// Extra space around the sprite.
gfx::Point m_padding;