Changeset View
Changeset View
Standalone View
Standalone View
commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 41 | kpToolSelectionPullFromDocumentCommand::kpToolSelectionPullFromDocumentCommand ( | |||
---|---|---|---|---|---|
42 | const kpAbstractImageSelection &originalSelBorder, | 42 | const kpAbstractImageSelection &originalSelBorder, | ||
43 | const kpColor &backgroundColor, | 43 | const kpColor &backgroundColor, | ||
44 | const QString &name, | 44 | const QString &name, | ||
45 | kpCommandEnvironment *environ) | 45 | kpCommandEnvironment *environ) | ||
46 | : kpAbstractSelectionContentCommand (originalSelBorder, name, environ), | 46 | : kpAbstractSelectionContentCommand (originalSelBorder, name, environ), | ||
47 | m_backgroundColor (backgroundColor) | 47 | m_backgroundColor (backgroundColor) | ||
48 | { | 48 | { | ||
49 | qCDebug(kpLogCommands) << "kpToolSelectionPullFromDocumentCommand::<ctor>() environ=" | 49 | qCDebug(kpLogCommands) << "kpToolSelectionPullFromDocumentCommand::<ctor>() environ=" | ||
50 | << environ | 50 | << environ; | ||
51 | << endl; | | |||
52 | } | 51 | } | ||
53 | 52 | | |||
54 | kpToolSelectionPullFromDocumentCommand::~kpToolSelectionPullFromDocumentCommand () | 53 | kpToolSelectionPullFromDocumentCommand::~kpToolSelectionPullFromDocumentCommand () = default; | ||
55 | { | | |||
56 | } | | |||
57 | 54 | | |||
58 | 55 | | |||
59 | // public virtual [base kpCommand] | 56 | // public virtual [base kpCommand] | ||
60 | void kpToolSelectionPullFromDocumentCommand::execute () | 57 | void kpToolSelectionPullFromDocumentCommand::execute () | ||
61 | { | 58 | { | ||
62 | qCDebug(kpLogCommands) << "kpToolSelectionPullFromDocumentCommand::execute()"; | 59 | qCDebug(kpLogCommands) << "kpToolSelectionPullFromDocumentCommand::execute()"; | ||
63 | 60 | | |||
64 | kpDocument *doc = document (); | 61 | kpDocument *doc = document (); | ||
Show All 25 Lines | 68 | { | |||
90 | // This assertion covers all 3 possibilities: | 87 | // This assertion covers all 3 possibilities: | ||
91 | // | 88 | // | ||
92 | // 1. First call: image selection with no content | 89 | // 1. First call: image selection with no content | ||
93 | // 2. Later calls: | 90 | // 2. Later calls: | ||
94 | // a) no image selection (due to deselection) | 91 | // a) no image selection (due to deselection) | ||
95 | // b) image selection with no content, at an arbitrary location | 92 | // b) image selection with no content, at an arbitrary location | ||
96 | Q_ASSERT (!imageSelection () || !imageSelection ()->hasContent ()); | 93 | Q_ASSERT (!imageSelection () || !imageSelection ()->hasContent ()); | ||
97 | 94 | | |||
98 | const kpAbstractImageSelection *originalImageSel = | 95 | const auto *originalImageSel = dynamic_cast <const kpAbstractImageSelection *> | ||
99 | static_cast <const kpAbstractImageSelection *> (originalSelection ()); | 96 | (originalSelection ()); | ||
97 | | ||||
100 | if (originalImageSel->transparency () != | 98 | if (originalImageSel->transparency () != | ||
101 | environ ()->imageSelectionTransparency ()) | 99 | environ ()->imageSelectionTransparency ()) | ||
102 | { | 100 | { | ||
103 | environ ()->setImageSelectionTransparency (originalImageSel->transparency ()); | 101 | environ ()->setImageSelectionTransparency (originalImageSel->transparency ()); | ||
104 | } | 102 | } | ||
105 | 103 | | |||
106 | doc->setSelection (*originalSelection ()); | 104 | doc->setSelection (*originalSelection ()); | ||
107 | 105 | | |||
Show All 29 Lines |