Changeset View
Changeset View
Standalone View
Standalone View
commands/imagelib/effects/kpEffectClearCommand.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | 54 | | |||
55 | // public virtual [base kpCommand] | 55 | // public virtual [base kpCommand] | ||
56 | QString kpEffectClearCommand::name () const | 56 | QString kpEffectClearCommand::name () const | ||
57 | { | 57 | { | ||
58 | QString opName = i18n ("Clear"); | 58 | QString opName = i18n ("Clear"); | ||
59 | 59 | | |||
60 | if (m_actOnSelection) | 60 | return (m_actOnSelection) ? i18n ("Selection: %1", opName) : opName; | ||
61 | return i18n ("Selection: %1", opName); | | |||
62 | else | | |||
63 | return opName; | | |||
64 | } | 61 | } | ||
65 | 62 | | |||
66 | 63 | | |||
67 | // public virtual [base kpCommand] | 64 | // public virtual [base kpCommand] | ||
68 | kpCommandSize::SizeType kpEffectClearCommand::size () const | 65 | kpCommandSize::SizeType kpEffectClearCommand::size () const | ||
69 | { | 66 | { | ||
70 | return ImageSize (m_oldImagePtr); | 67 | return ImageSize (m_oldImagePtr); | ||
71 | } | 68 | } | ||
Show All 15 Lines | 73 | { | |||
87 | // (kpAbstractImageSelection::fill() takes into account the shape of a selection). | 84 | // (kpAbstractImageSelection::fill() takes into account the shape of a selection). | ||
88 | if (m_actOnSelection) | 85 | if (m_actOnSelection) | ||
89 | { | 86 | { | ||
90 | // OPT: could just edit pixmap directly and signal change | 87 | // OPT: could just edit pixmap directly and signal change | ||
91 | kpAbstractImageSelection *sel = doc->imageSelection (); | 88 | kpAbstractImageSelection *sel = doc->imageSelection (); | ||
92 | Q_ASSERT (sel); | 89 | Q_ASSERT (sel); | ||
93 | sel->fill (m_newColor); | 90 | sel->fill (m_newColor); | ||
94 | } | 91 | } | ||
95 | else | 92 | else { | ||
96 | doc->fill (m_newColor); | 93 | doc->fill (m_newColor); | ||
97 | } | 94 | } | ||
95 | } | ||||
98 | 96 | | |||
99 | // public virtual [base kpCommand] | 97 | // public virtual [base kpCommand] | ||
100 | void kpEffectClearCommand::unexecute () | 98 | void kpEffectClearCommand::unexecute () | ||
101 | { | 99 | { | ||
102 | kpDocument *doc = document (); | 100 | kpDocument *doc = document (); | ||
103 | Q_ASSERT (doc); | 101 | Q_ASSERT (doc); | ||
104 | 102 | | |||
105 | 103 | | |||
106 | doc->setImage (m_actOnSelection, *m_oldImagePtr); | 104 | doc->setImage (m_actOnSelection, *m_oldImagePtr); | ||
107 | 105 | | |||
108 | 106 | | |||
109 | delete m_oldImagePtr; | 107 | delete m_oldImagePtr; | ||
110 | m_oldImagePtr = nullptr; | 108 | m_oldImagePtr = nullptr; | ||
111 | } | 109 | } | ||
112 | 110 | |