Commit b55104a6 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Merge branch 'master' into wolthera/T1624-pattern-rotation

This enables pattern rotation and scale in the fill tool,
geometric tools and the fill layer. Scale is also enabled
for the pattern overlay layerstyle. The fill layer has several
extra features like shear and odd rotations.

CCMAIL:kimageshop@kde.org
Fixes T1624
BUG:345250
BUG:422453
parents 2a18026d 99760f90
......@@ -264,10 +264,6 @@ qreal KoMarker::maxInset(qreal strokeWidth) const
result = qMax(KisAlgebra2D::norm(shapesBounds.bottomLeft()), result);
result = qMax(KisAlgebra2D::norm(shapesBounds.bottomRight()), result);
if (d->coordinateSystem == StrokeWidth) {
result *= strokeWidth;
}
return result;
}
......
......@@ -305,7 +305,8 @@ QRectF KoPathShape::boundingRect() const
QRectF bb = transform.map(pathStroke(pen)).boundingRect();
#endif
QRectF bb = transform.mapRect(kisGrowRect(outline().boundingRect(), outlineSweepWidth));
// add 10% extra update area around the doubled insets
QRectF bb = transform.mapRect(kisGrowRect(outline().boundingRect(), 1.1 * 0.5 * outlineSweepWidth));
if (shadow()) {
KoInsets insets;
......@@ -1327,6 +1328,9 @@ void KoPathShape::setMarker(KoMarker *marker, KoFlake::MarkerPosition pos)
} else {
d->markersNew[pos] = marker;
}
notifyChanged();
shapeChangedPriv(StrokeChanged);
}
KoMarker *KoPathShape::marker(KoFlake::MarkerPosition pos) const
......
......@@ -59,13 +59,13 @@ void KoPathShapeMarkerCommand::redo()
{
KUndo2Command::redo();
Q_FOREACH (KoPathShape *shape, m_d->shapes) {
shape->update();
const QRectF oldDirtyRect = shape->boundingRect();
shape->setMarker(m_d->marker.data(), m_d->position);
// we have no GUI for selection auto-filling yet! So just enable it!
shape->setAutoFillMarkers(true);
shape->update();
shape->updateAbsolute(oldDirtyRect | shape->boundingRect());
}
}
......@@ -75,11 +75,12 @@ void KoPathShapeMarkerCommand::undo()
auto markerIt = m_d->oldMarkers.begin();
auto autoFillIt = m_d->oldAutoFillMarkers.begin();
Q_FOREACH (KoPathShape *shape, m_d->shapes) {
shape->update();
const QRectF oldDirtyRect = shape->boundingRect();
shape->setMarker((*markerIt).data(), m_d->position);
shape->setAutoFillMarkers(*autoFillIt);
shape->update();
shape->updateAbsolute(oldDirtyRect | shape->boundingRect());
++markerIt;
++autoFillIt;
}
}
......
......@@ -29,7 +29,7 @@
<path
id="path4209"
d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.2) translate(7.4, 1)" />
</marker>
<marker
......@@ -43,7 +43,7 @@
<path
id="path4206"
d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.4) translate(7.4, 1)" />
</marker>
<marker
......@@ -57,7 +57,7 @@
<path
id="path4203"
d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) translate(7.4, 1)" />
</marker>
<marker
......@@ -71,7 +71,7 @@
<path
id="path4157"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.2) rotate(180) translate(6,0)" />
</marker>
<marker
......@@ -85,7 +85,7 @@
<path
id="path4154"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.2) translate(6,0)" />
</marker>
<marker
......@@ -99,7 +99,7 @@
<path
id="path4151"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
......@@ -113,7 +113,7 @@
<path
id="path4148"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.4) translate(10,0)" />
</marker>
<marker
......@@ -127,7 +127,7 @@
<path
id="path4145"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<marker
......@@ -141,7 +141,7 @@
<path
id="path4142"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:1"
style="fill-rule:evenodd;stroke:#000000;stroke-width:2.8;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) translate(12.5,0)" />
</marker>
</defs>
......
......@@ -176,4 +176,7 @@ void KisIndirectPaintingSupport::releaseResources()
{
d->temporaryTarget = 0;
d->selection = 0;
d->compositeOp = COMPOSITE_OVER;
d->compositeOpacity = OPACITY_OPAQUE_U8;
d->channelFlags.clear();
}
......@@ -11,5 +11,5 @@ CREATE TABLE IF NOT EXISTS resources (
, version INTEGER /* the current version number of the resource (cached for performance reasons */
, FOREIGN KEY(resource_type_id) REFERENCES resource_types(id)
, UNIQUE(storage_id, resource_type_id, name)
, UNIQUE(storage_id, filename)
, UNIQUE(storage_id, filename, resource_type_id)
);
......@@ -102,6 +102,7 @@
#include "kis_layer_utils.h"
#include "lazybrush/kis_colorize_mask.h"
#include "kis_processing_applicator.h"
#include "kis_projection_leaf.h"
#include "KisSaveGroupVisitor.h"
......@@ -387,7 +388,11 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
source->paintDevice() ? source->projection() : source->original();
bool putBehind = false;
QString newCompositeOp = source->compositeOpId();
QString newCompositeOp =
source->projectionLeaf()->isLayer() ?
source->compositeOpId() : COMPOSITE_OVER;
KisColorizeMask *colorizeMask = dynamic_cast<KisColorizeMask*>(source.data());
if (colorizeMask) {
srcDevice = colorizeMask->coloringProjection();
......@@ -405,6 +410,9 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
*srcDevice->compositionSourceColorSpace()) {
clone = new KisPaintDevice(srcDevice->compositionSourceColorSpace());
clone->setDefaultPixel(
srcDevice->defaultPixel().convertedTo(
srcDevice->compositionSourceColorSpace()));
QRect rc(srcDevice->extent());
KisPainter::copyAreaOptimized(rc.topLeft(), srcDevice, clone, rc);
......
......@@ -27,5 +27,7 @@ install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/FileExists2.nsh
install(
FILES
${CMAKE_CURRENT_LIST_DIR}/translations/English.nsh
${CMAKE_CURRENT_LIST_DIR}/translations/TradChinese.nsh
${CMAKE_CURRENT_LIST_DIR}/translations/SimpChinese.nsh
DESTINATION ${CMAKE_INSTALL_PREFIX}/installer/translations
)
......@@ -96,6 +96,7 @@ Page Custom func_BeforeInstallPage_Init
!insertmacro MUI_PAGE_FINISH
# Uninstaller Pages
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.func_UnintallFirstpage_Init
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
......@@ -218,6 +219,10 @@ Section "-Thing"
!else
DeleteRegValue HKLM "Software\Krita" "x64"
!endif
# InstallerLanguage:
# Language used by the installer (to be re-used for the uninstaller)
WriteRegStr HKLM "Software\Krita" \
"InstallerLanguage" "$LANGUAGE"
# StartMenuFolder:
# Start Menu Folder
# Handled by Modern UI 2.0 MUI_PAGE_STARTMENU
......@@ -378,21 +383,22 @@ Function .onInit
Abort
${EndIf}
# Language selection, seems that the order is predefined.
Push "" # This value is for languages auto count
Push ${LANG_ENGLISH}
Push English
Push ${LANG_TRADCHINESE}
Push "繁體中文"
Push ${LANG_SIMPCHINESE}
Push "简体中文"
Push A # = auto count languages
LangDLL::LangDialog "$(^SetupCaption)" "$(SetupLangPrompt)"
Pop $LANGUAGE
${If} $LANGUAGE == "cancel"
Abort
${Endif}
# ---
${IfNot} ${Silent}
# Language selection, seems that the order is predefined.
Push "" # This value is for languages auto count
Push ${LANG_ENGLISH}
Push English
Push ${LANG_TRADCHINESE}
Push "繁體中文"
Push ${LANG_SIMPCHINESE}
Push "简体中文"
Push A # = auto count languages
LangDLL::LangDialog "$(^SetupCaption)" "$(SetupLangPrompt)"
Pop $LANGUAGE
${If} $LANGUAGE == "cancel"
Abort
${Endif}
${EndIf}
!ifdef KRITA_INSTALLER_64
${If} ${RunningX64}
......@@ -512,6 +518,7 @@ Function .onInit
${IfNot} ${Silent}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(MsgKritaRunning)"
${EndIf}
SetErrorLevel 10
Abort
${EndIf}
pop $R0
......@@ -551,12 +558,34 @@ Function un.onInit
SetRegView 64
${Endif}
!endif
# Get and use installer language:
Push $0
ReadRegStr $0 HKLM "Software\Krita" "InstallerLanguage"
${If} $0 != ""
StrCpy $LANGUAGE $0
${EndIf}
Pop $0
ReadRegDWORD $UninstallShellExStandalone HKLM "Software\Krita\ShellExtension" "Standalone"
${If} ${Silent}
# Only check here if running in silent mode. It's otherwise checked in
# un.func_UnintallFirstpage_Init in order to display a prompt in the
# correct language.
${If} ${IsFileinUse} "$INSTDIR\bin\krita.exe"
SetErrorLevel 10
Abort
${EndIf}
${EndIf}
FunctionEnd
Function un.func_UnintallFirstpage_Init
${If} ${IsFileinUse} "$INSTDIR\bin\krita.exe"
${IfNot} ${Silent}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(MsgUninstallKritaRunning)"
${EndIf}
Abort
SetErrorLevel 10
Quit
${EndIf}
FunctionEnd
......
......@@ -221,6 +221,12 @@ LayerBox::LayerBox()
connect(m_nodeModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(updateUI()));
connect(m_nodeModel, SIGNAL(modelReset()), SLOT(slotModelReset()));
connect(m_nodeModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(slotForgetAboutSavedNodeBeforeEditSelectionMode()));
connect(m_nodeModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(slotForgetAboutSavedNodeBeforeEditSelectionMode()));
connect(m_nodeModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(slotForgetAboutSavedNodeBeforeEditSelectionMode()));
connect(m_nodeModel, SIGNAL(modelReset()), SLOT(slotForgetAboutSavedNodeBeforeEditSelectionMode()));
KisAction *showGlobalSelectionMask = new KisAction(i18n("&Show Global Selection Mask"), this);
showGlobalSelectionMask->setObjectName("show-global-selection-mask");
showGlobalSelectionMask->setActivationFlags(KisAction::ACTIVE_IMAGE);
......@@ -334,6 +340,10 @@ void LayerBox::setViewManager(KisViewManager* kisview)
{
m_nodeManager = kisview->nodeManager();
if (m_nodeManager) {
connect(m_nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)), SLOT(slotForgetAboutSavedNodeBeforeEditSelectionMode()));
}
Q_FOREACH (KisAction *action, m_actions) {
kisview->actionManager()->
addAction(action->objectName(),
......@@ -850,7 +860,10 @@ void LayerBox::slotEditGlobalSelection(bool showSelections)
KisSelectionMaskSP globalSelectionMask;
if (!showSelections) {
activateNode = findNonHidableNode(activateNode);
activateNode =
m_savedNodeBeforeEditSelectionMode ?
KisNodeSP(m_savedNodeBeforeEditSelectionMode) :
findNonHidableNode(activateNode);
}
m_nodeModel->setShowGlobalSelection(showSelections);
......@@ -919,6 +932,9 @@ void LayerBox::slotEditGlobalSelection(bool showSelections)
applicator.end();
}
if (showSelections) {
m_savedNodeBeforeEditSelectionMode = lastActiveNode;
}
}
void LayerBox::selectionChanged(const QModelIndexList selection)
......@@ -1082,6 +1098,11 @@ void LayerBox::slotImageTimeChanged(int time)
updateUI();
}
void LayerBox::slotForgetAboutSavedNodeBeforeEditSelectionMode()
{
m_savedNodeBeforeEditSelectionMode = 0;
}
void LayerBox::slotUpdateIcons() {
m_wdgLayerBox->bnAdd->setIcon(KisIconUtils::loadIcon("addlayer"));
m_wdgLayerBox->bnRaise->setIcon(KisIconUtils::loadIcon("arrowupblr"));
......
......@@ -139,6 +139,8 @@ private Q_SLOTS:
void slotOpacityKeyframeMoved(KisKeyframeSP keyframe, int fromTime);
void slotImageTimeChanged(int time);
void slotForgetAboutSavedNodeBeforeEditSelectionMode();
private:
inline void connectActionToButton(KisViewManager* view, QAbstractButton *button, const QString &id);
inline void addActionToMenu(QMenu *menu, const QString &id);
......@@ -171,6 +173,7 @@ private:
QSlider* thumbnailSizeSlider;
KisNodeSP m_activeNode;
KisNodeWSP m_savedNodeBeforeEditSelectionMode;
QPointer<KisKeyframeChannel> m_opacityChannel;
bool m_blockOpacityUpdate {false};
};
......
......@@ -7,14 +7,20 @@ X-Python-2-Compatible=false
Name=Batch Exporter
Name[ca]=Exportador per lots
Name[es]=Exportador por lotes
Name[et]=Hulgieksport
Name[nl]=Exportprogramma voor bulk
Name[nn]=Fleirbileteksport
Name[pt]=Exportação em Lote
Name[pt_BR]=Exportador em lote
Name[uk]=Пакетне експортування
Name[x-test]=xxBatch Exporterxx
Comment=Smart export tool that uses layer names to scale and (re-)export art assets in batches fast
Comment[ca]=Eina d'exportació intel·ligent que usa els noms de les capes per escalar i (re)exportar elements d'art en lots ràpidament
Comment[es]=Herramienta de exportación inteligente que usa nombres de capas para escalar y (volver a) exportar recursos artísticos por lotes de un modo rápido
Comment[et]=Nutikas eksporditööriist, mid kasutab kihtide nimesid kunstiresursside kiireks hulgiskaleerimiseks ja -(taas)eksportimiseks
Comment[nl]=Slim hulpmiddel voor exporteren die lagennamen gebruikt om snel kunstbezittingen te schalen en (opnieuw) te exporteren in bulk
Comment[nn]=Smart eksportverktøy som brukar lagnamn til å skalera og (re)eksportera til fleire bilete
Comment[pt]=Uma ferramenta inteligente de exportação em lote que usa os nomes das camadas para definir a escala e (re-)exportar os itens gráficos em lote de forma rápida
Comment[pt_BR]=Ferramenta de exportação inteligente que usa nomes de camada para dimensionar e (re)exportar ativos de arte em lotes rapidamente
Comment[uk]=Інструмент пакетного експортування, який використовує назви шарів для масштабування і швидкого (повторного) пакетного експортування художніх елементів
Comment[x-test]=xxSmart export tool that uses layer names to scale and (re-)export art assets in batches fastxx
......@@ -1051,12 +1051,12 @@ class ChannelsToLayers(Extension):
ledLayerGroupName = QLineEdit()
ledLayerGroupName.setText(self.__outputOptions['layerGroupName'])
ledLayerGroupName.textChanged.connect(ledLayerGroupName_Changed)
flLayersMgt.addRow(i18n('New layer group name'), ledLayerGroupName)
flLayersMgt.addRow(i18nc('The name for a new group layer; the generated layers will be placed in this group.', 'New layer group name'), ledLayerGroupName)
ledLayerColorName = QLineEdit()
ledLayerColorName.setText(self.__outputOptions['layerColorName'])
ledLayerColorName.textChanged.connect(ledLayerColorName_Changed)
flLayersMgt.addRow(i18n('New layers color name'), ledLayerColorName)
flLayersMgt.addRow(i18nc('Defines how the name for each layer created from the channel is generated.', 'New layers color name'), ledLayerColorName)
cmbOriginalLayerAction = QComboBox()
cmbOriginalLayerAction.addItems([
......
......@@ -7,14 +7,20 @@ X-Krita-Manual=Manual.html
Name=Channels to layers
Name[ca]=Canals a capes
Name[es]=Canales a capas
Name[et]=Kanalid kihtideks
Name[nl]=Kanalen naar lagen
Name[nn]=Kanalar til lag
Name[pt]=Canais para camadas
Name[pt_BR]=Canais para camadas
Name[uk]=Канали у шари
Name[x-test]=xxChannels to layersxx
Comment=Extract channels as color layers
Comment[ca]=Extreu canals com a capes de color
Comment[es]=Extraer canales como capas de color
Comment[et]=Kanalite ekstraktimine värvikihtidena
Comment[nl]=Kanalen als kleurlagen extraheren
Comment[nn]=Hent ut kanalar som fargelag
Comment[pt]=Extrair os canais como camadas de cores
Comment[pt_BR]=Extraia canais como camadas de cores
Comment[uk]=Видобування каналів як колірних шарів
Comment[x-test]=xxExtract channels as color layersxx
......@@ -426,7 +426,7 @@ void KisToolMove::paint(QPainter& gc, const KoViewConverter &converter)
{
Q_UNUSED(converter);
if (m_strokeId && !m_handlesRect.isEmpty()) {
if (m_strokeId && !m_handlesRect.isEmpty() && !m_currentlyUsingSelection) {
QPainterPath handles;
handles.addRect(m_handlesRect.translated(currentOffset()));
......@@ -533,6 +533,13 @@ void KisToolMove::startAction(KoPointerEvent *event, MoveToolMode mode)
if (startStrokeImpl(mode, &pos)) {
setMode(KisTool::PAINT_MODE);
if (m_currentlyUsingSelection) {
KisImageSP image = currentImage();
image->addJob(m_strokeId,
new MoveSelectionStrokeStrategy::ShowSelectionData(false));
}
} else {
event->ignore();
m_dragPos = QPoint();
......@@ -572,6 +579,12 @@ void KisToolMove::endAction(KoPointerEvent *event)
m_dragPos = QPoint();
commitChanges();
if (m_currentlyUsingSelection) {
KisImageSP image = currentImage();
image->addJob(m_strokeId,
new MoveSelectionStrokeStrategy::ShowSelectionData(true));
}
notifyGuiAfterMove();
qobject_cast<KisCanvas2*>(canvas())->updateCanvas();
......@@ -579,7 +592,7 @@ void KisToolMove::endAction(KoPointerEvent *event)
void KisToolMove::drag(const QPoint& newPos)
{
KisImageWSP image = currentImage();
KisImageSP image = currentImage();
QPoint offset = m_accumulatedOffset + newPos - m_dragStart;
......
......@@ -82,10 +82,11 @@ void MoveSelectionStrokeStrategy::initStrokeCallback()
indirect->setTemporaryTarget(movedDevice);
indirect->setTemporaryCompositeOp(COMPOSITE_OVER);
indirect->setTemporaryOpacity(OPACITY_OPAQUE_U8);
indirect->setTemporarySelection(0);
indirect->setTemporaryChannelFlags(QBitArray());
m_initialDeviceOffset = QPoint(movedDevice->x(), movedDevice->y());
m_selection->setVisible(false);
m_initialSelectionOffset = QPoint(m_selection->x(), m_selection->y());
{
QRect handlesRect = movedDevice->exactBounds();
......@@ -115,12 +116,12 @@ void MoveSelectionStrokeStrategy::finishStrokeCallback()
indirect->setTemporaryTarget(0);
QPoint selectionOffset(m_selection->x(), m_selection->y());
m_updatesFacade->blockUpdates();
KUndo2CommandSP moveSelectionCommand(
new KisSelectionMoveCommand2(m_selection, selectionOffset, selectionOffset + m_finalOffset));
new KisSelectionMoveCommand2(m_selection,
m_initialSelectionOffset,
m_initialSelectionOffset + m_finalOffset));
runAndSaveCommand(
moveSelectionCommand,
......@@ -146,9 +147,12 @@ void MoveSelectionStrokeStrategy::cancelStrokeCallback()
indirect->setTemporaryTarget(0);
m_selection->setVisible(true);
m_paintLayer->setDirty(dirtyRegion);
m_selection->setX(m_initialSelectionOffset.x());
m_selection->setY(m_initialSelectionOffset.y());
m_selection->setVisible(true);
m_selection->notifySelectionChanged();
}
}
KisStrokeStrategyUndoCommandBased::cancelStrokeCallback();
......@@ -159,6 +163,7 @@ void MoveSelectionStrokeStrategy::cancelStrokeCallback()
void MoveSelectionStrokeStrategy::doStrokeCallback(KisStrokeJobData *data)
{
MoveStrokeStrategy::Data *d = dynamic_cast<MoveStrokeStrategy::Data*>(data);
ShowSelectionData *ssd = dynamic_cast<ShowSelectionData*>(data);
if (d) {
KisIndirectPaintingSupport *indirect =
......@@ -178,6 +183,16 @@ void MoveSelectionStrokeStrategy::doStrokeCallback(KisStrokeJobData *data)
m_finalOffset = d->offset;
m_paintLayer->setDirty(KisRegion::fromQRegion(dirtyRegion));
m_selection->setX((m_initialSelectionOffset + d->offset).x());
m_selection->setY((m_initialSelectionOffset + d->offset).y());
if (m_selection->isVisible()) {
m_selection->notifySelectionChanged();
}
} else if (ssd) {
m_selection->setVisible(ssd->showSelection);
} else {
KisStrokeStrategyUndoCommandBased::doStrokeCallback(data);
}
......
......@@ -32,6 +32,17 @@ class MoveSelectionStrokeStrategy : public QObject, public KisStrokeStrategyUndo
{
Q_OBJECT
public:
struct ShowSelectionData : public KisStrokeJobData
{
ShowSelectionData(bool _showSelection)
: KisStrokeJobData(),
showSelection(_showSelection)
{}
bool showSelection = false;
};
public:
MoveSelectionStrokeStrategy(KisPaintLayerSP paintLayer,
KisSelectionSP selection,
......@@ -58,6 +69,7 @@ private:
KisUpdatesFacade *m_updatesFacade;
QPoint m_finalOffset;
QPoint m_initialDeviceOffset;
QPoint m_initialSelectionOffset;
};
#endif /* __MOVE_SELECTION_STROKE_STRATEGY_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment