Changeset View
Changeset View
Standalone View
Standalone View
tools/selection/image/kpToolRectSelection.cpp
Show All 19 Lines | 2 | /* | |||
---|---|---|---|---|---|
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | 26 | */ | ||
27 | 27 | | |||
28 | #define DEBUG_KP_TOOL_RECT_SELECTION 0 | | |||
29 | | ||||
30 | #include "kpToolRectSelection.h" | 28 | #include "kpToolRectSelection.h" | ||
31 | #include "kpLogCategories.h" | 29 | #include "kpLogCategories.h" | ||
32 | #include "document/kpDocument.h" | 30 | #include "document/kpDocument.h" | ||
33 | #include "layers/selections/image/kpRectangularImageSelection.h" | 31 | #include "layers/selections/image/kpRectangularImageSelection.h" | ||
34 | #include "environments/tools/selection/kpToolSelectionEnvironment.h" | 32 | #include "environments/tools/selection/kpToolSelectionEnvironment.h" | ||
35 | 33 | | |||
36 | #include <KLocalizedString> | 34 | #include <KLocalizedString> | ||
37 | 35 | | |||
Show All 17 Lines | 52 | bool kpToolRectSelection::drawCreateMoreSelectionAndUpdateStatusBar ( | |||
55 | bool dragAccepted, | 53 | bool dragAccepted, | ||
56 | const QPoint &accidentalDragAdjustedPoint, | 54 | const QPoint &accidentalDragAdjustedPoint, | ||
57 | const QRect &normalizedRect) | 55 | const QRect &normalizedRect) | ||
58 | { | 56 | { | ||
59 | // Prevent unintentional creation of 1-pixel selections. | 57 | // Prevent unintentional creation of 1-pixel selections. | ||
60 | // REFACTOR: This line is duplicated code with other tools. | 58 | // REFACTOR: This line is duplicated code with other tools. | ||
61 | if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) | 59 | if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) | ||
62 | { | 60 | { | ||
63 | #if DEBUG_KP_TOOL_RECT_SELECTION && 1 | | |||
64 | qCDebug(kpLogTools) << "\tnon-text NOP - return"; | 61 | qCDebug(kpLogTools) << "\tnon-text NOP - return"; | ||
65 | #endif | | |||
66 | setUserShapePoints (accidentalDragAdjustedPoint); | 62 | setUserShapePoints (accidentalDragAdjustedPoint); | ||
67 | return false; | 63 | return false; | ||
68 | } | 64 | } | ||
69 | 65 | | |||
70 | Q_ASSERT (accidentalDragAdjustedPoint == currentPoint ()); | 66 | Q_ASSERT (accidentalDragAdjustedPoint == currentPoint ()); | ||
71 | 67 | | |||
72 | const QRect usefulRect = normalizedRect.intersected (document ()->rect ()); | 68 | const QRect usefulRect = normalizedRect.intersected (document ()->rect ()); | ||
73 | document ()->setSelection ( | 69 | document ()->setSelection ( | ||
Show All 10 Lines |