Changeset View
Changeset View
Standalone View
Standalone View
imagelib/transforms/kpTransformCrop.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 46 | { | |||
---|---|---|---|---|---|
54 | kpCommand *resizeDocCommand = | 54 | kpCommand *resizeDocCommand = | ||
55 | new kpTransformResizeScaleCommand ( | 55 | new kpTransformResizeScaleCommand ( | ||
56 | false/*act on doc, not sel*/, | 56 | false/*act on doc, not sel*/, | ||
57 | sel->width (), sel->height (), | 57 | sel->width (), sel->height (), | ||
58 | kpTransformResizeScaleCommand::Resize, | 58 | kpTransformResizeScaleCommand::Resize, | ||
59 | mainWindow->commandEnvironment ()); | 59 | mainWindow->commandEnvironment ()); | ||
60 | 60 | | |||
61 | 61 | | |||
62 | kpTextSelection *textSel = | 62 | auto *textSel = dynamic_cast <kpTextSelection *> (sel); | ||
63 | dynamic_cast <kpTextSelection *> (sel); | 63 | auto *imageSel = dynamic_cast <kpAbstractImageSelection *> (sel); | ||
64 | kpAbstractImageSelection *imageSel = | | |||
65 | dynamic_cast <kpAbstractImageSelection *> (sel); | | |||
66 | // It's either a text selection or an image selection, but cannot be | 64 | // It's either a text selection or an image selection, but cannot be | ||
67 | // neither or both. | 65 | // neither or both. | ||
68 | Q_ASSERT (!!textSel != !!imageSel); | 66 | Q_ASSERT (!!textSel != !!imageSel); | ||
69 | 67 | | |||
70 | if (textSel) | 68 | if (textSel) { | ||
71 | ::kpTransformCrop_TextSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); | 69 | ::kpTransformCrop_TextSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); | ||
72 | else if (imageSel) | 70 | } | ||
71 | else if (imageSel) { | ||||
73 | ::kpTransformCrop_ImageSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); | 72 | ::kpTransformCrop_ImageSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); | ||
74 | else | 73 | } | ||
74 | else { | ||||
75 | Q_ASSERT (!"unreachable"); | 75 | Q_ASSERT (!"unreachable"); | ||
76 | } | 76 | } | ||
77 | } |