diff --git a/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp b/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp index 3b4e8122e5..695e640b1f 100644 --- a/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp +++ b/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp @@ -1,163 +1,165 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2004-2008 Boudewijn Rempt * Copyright (c) 2004 Clarence Dang * Copyright (c) 2004 Adrian Page * Copyright (c) 2004 Cyrille Berger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_duplicateop_settings.h" #include "kis_duplicateop_option.h" #include "kis_duplicateop_settings_widget.h" #include #include #include #include #include #include #include #include #include #include #include #include KisDuplicateOpSettings::KisDuplicateOpSettings() : m_isOffsetNotUptodate(false) { } KisDuplicateOpSettings::~KisDuplicateOpSettings() { } bool KisDuplicateOpSettings::paintIncremental() { return false; } QString KisDuplicateOpSettings::indirectPaintingCompositeOp() const { return COMPOSITE_COPY; } QPointF KisDuplicateOpSettings::offset() const { return m_offset; } QPointF KisDuplicateOpSettings::position() const { return m_position; } bool KisDuplicateOpSettings::mousePressEvent(const KisPaintInformation &info, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode) { bool ignoreEvent = true; - if (modifiers == Qt::ControlModifier) { - m_sourceNode = currentNode; + if (modifiers & Qt::ControlModifier) { + if (!m_sourceNode || !(modifiers & Qt::AltModifier)) { + m_sourceNode = currentNode; + } m_position = info.pos(); m_isOffsetNotUptodate = true; ignoreEvent = false; } else { if (m_isOffsetNotUptodate) { m_offset = info.pos() - m_position; m_isOffsetNotUptodate = false; } ignoreEvent = true; } return ignoreEvent; } KisNodeWSP KisDuplicateOpSettings::sourceNode() const { return m_sourceNode; } void KisDuplicateOpSettings::activate() { } void KisDuplicateOpSettings::fromXML(const QDomElement& elt) { // First, call the parent class fromXML to make sure all the // properties are saved to the map KisPaintOpSettings::fromXML(elt); m_offset.setX(elt.attribute("OffsetX", "0.0").toDouble()); m_offset.setY(elt.attribute("OffsetY", "0.0").toDouble()); m_isOffsetNotUptodate = false; } void KisDuplicateOpSettings::toXML(QDomDocument& doc, QDomElement& rootElt) const { // Then call the parent class fromXML KisPropertiesConfiguration::toXML(doc, rootElt); rootElt.setAttribute("OffsetX", QString::number(m_offset.x())); rootElt.setAttribute("OffsetY", QString::number(m_offset.y())); } KisPaintOpSettingsSP KisDuplicateOpSettings::clone() const { KisPaintOpSettingsSP setting = KisPaintOpSettings::clone(); KisDuplicateOpSettings* s = dynamic_cast(setting.data()); s->m_offset = m_offset; s->m_isOffsetNotUptodate = m_isOffsetNotUptodate; s->m_position = m_position; return setting; } QPainterPath KisDuplicateOpSettings::brushOutline(const KisPaintInformation &info, OutlineMode mode) const { QPainterPath path; // clone tool should always show an outline path = KisBrushBasedPaintOpSettings::brushOutlineImpl(info, mode, 1.0, true); QPainterPath copy(path); QRectF rect2 = copy.boundingRect(); if (m_isOffsetNotUptodate || !getBool(DUPLICATE_MOVE_SOURCE_POINT)) { copy.translate(m_position - info.pos()); } else { copy.translate(-m_offset); } path.addPath(copy); qreal dx = rect2.width() / 4.0; qreal dy = rect2.height() / 4.0; rect2.adjust(dx, dy, -dx, -dy); path.moveTo(rect2.topLeft()); path.lineTo(rect2.bottomRight()); path.moveTo(rect2.topRight()); path.lineTo(rect2.bottomLeft()); return path; } diff --git a/krita/plugins/paintops/defaultpaintops/duplicate/wdgduplicateop.ui b/krita/plugins/paintops/defaultpaintops/duplicate/wdgduplicateop.ui index 26c963bf98..0b3fdf42ac 100644 --- a/krita/plugins/paintops/defaultpaintops/duplicate/wdgduplicateop.ui +++ b/krita/plugins/paintops/defaultpaintops/duplicate/wdgduplicateop.ui @@ -1,114 +1,114 @@ DuplicateOpOptionsWidget 0 0 521 193 Healing To correct perspective, first create a perspective grid. Correct the perspective Move the clone origin with the brush. Uncheck to keep cloning from the selected point. Source point move true When checked, clone from all visible layers. Otherwise, clone from the active layer. Clone From All Visible Layers Qt::Vertical 20 40 0 0 - <html><head/><body><p><span style=" font-weight:600;">Clone Brush:</span></p><p>Select the source point with ctrl-click.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Clone Brush:</span></p><p>Select the source point from the current layer with Ctrl-click. Use Ctrl+Alt-click to select a source from the previously picked layer.</p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop true 2 Qt::Vertical 20 40