From ce8f93a26fc3fa1c8d18cc0329fed8818f26f3d4 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 7 Feb 2020 02:14:07 +0000 Subject: [PATCH] generic: purge Qt support with fire see commit in kdelibs repository Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - ark/kerfuffle/CMakeLists.txt | 39 +- ark/kerfuffle/tests/CMakeLists.txt | 3 - kdeplasma-addons/CMakeLists.txt | 21 +- kdeplasma-addons/applets/CMakeLists.txt | 16 +- kdeplasma-addons/applets/dict/CMakeLists.txt | 24 +- .../applets/kdeobservatory/CMakeLists.txt | 53 - .../cmake/modules/FindQwt.cmake | 105 -- .../kdeobservatory/icons/CMakeLists.txt | 1 - .../icons/hi128-app-kdeobservatory.png | Bin 17648 -> 0 bytes .../icons/hi16-app-kdeobservatory.png | Bin 818 -> 0 bytes .../icons/hi22-app-kdeobservatory.png | Bin 1300 -> 0 bytes .../icons/hi32-app-kdeobservatory.png | Bin 2302 -> 0 bytes .../icons/hi48-app-kdeobservatory.png | Bin 4083 -> 0 bytes .../icons/hi64-app-kdeobservatory.png | Bin 6377 -> 0 bytes .../icons/hisc-app-kdeobservatory.svgz | Bin 7453 -> 0 bytes .../plasma-applet-kdeobservatory.desktop | 114 -- .../applets/kdeobservatory/src/Messages.sh | 4 - .../kdeobservatory/src/commithistoryview.cpp | 153 -- .../kdeobservatory/src/commithistoryview.h | 42 - .../kdeobservatory/src/iviewprovider.cpp | 78 - .../kdeobservatory/src/iviewprovider.h | 60 - .../kdeobservatory/src/kdeobservatory.cpp | 839 --------- .../kdeobservatory/src/kdeobservatory.h | 170 -- .../src/kdeobservatoryconfiggeneral.cpp | 37 - .../src/kdeobservatoryconfiggeneral.h | 38 - .../src/kdeobservatoryconfigprojects.cpp | 122 -- .../src/kdeobservatoryconfigprojects.h | 49 - .../src/kdeobservatoryconfigviews.cpp | 125 -- .../src/kdeobservatoryconfigviews.h | 56 - .../kdeobservatory/src/krazyreportview.cpp | 139 -- .../kdeobservatory/src/krazyreportview.h | 42 - .../src/topactiveprojectsview.cpp | 103 -- .../src/topactiveprojectsview.h | 43 - .../kdeobservatory/src/topdevelopersview.cpp | 102 -- .../kdeobservatory/src/topdevelopersview.h | 42 - .../src/ui/kdeobservatoryconfiggeneral.ui | 329 ---- .../src/ui/kdeobservatoryconfigproject.ui | 223 --- .../src/ui/kdeobservatoryconfigprojects.ui | 183 -- .../src/ui/kdeobservatoryconfigviews.ui | 344 ---- .../applets/konqprofiles/CMakeLists.txt | 6 - .../applets/konqprofiles/Messages.sh | 4 - .../package/contents/ui/konqprofiles.qml | 164 -- .../konqprofiles/package/metadata.desktop | 133 -- .../applets/microblog/CMakeLists.txt | 19 - .../applets/microblog/Messages.sh | 3 - .../applets/microblog/configuration.ui | 289 ---- .../applets/microblog/microblog.cpp | 1042 ------------ .../applets/microblog/microblog.h | 196 --- .../applets/microblog/microblog.svgz | Bin 7498 -> 0 bytes .../microblog/plasma-applet-microblog.desktop | 165 -- .../applets/microblog/postwidget.cpp | 166 -- .../applets/microblog/postwidget.h | 78 - kdeplasma-addons/applets/news/CMakeLists.txt | 20 - kdeplasma-addons/applets/news/Messages.sh | 4 - kdeplasma-addons/applets/news/config.ui | 215 --- kdeplasma-addons/applets/news/feedsConfig.ui | 102 -- kdeplasma-addons/applets/news/news.cpp | 436 ----- kdeplasma-addons/applets/news/news.css | 13 - kdeplasma-addons/applets/news/news.h | 78 - .../applets/news/plasma-applet-news.desktop | 128 -- .../applets/rememberthemilk/CMakeLists.txt | 32 - .../applets/rememberthemilk/Messages.sh | 3 - .../applets/rememberthemilk/authenticate.ui | 144 -- .../applets/rememberthemilk/general.ui | 73 - .../plasma-applet-rememberthemilk.desktop | 118 -- .../rememberthemilk-plasmoid.cpp | 433 ----- .../rememberthemilk-plasmoid.h | 123 -- .../applets/rememberthemilk/taskeditor.cpp | 254 --- .../applets/rememberthemilk/taskeditor.h | 102 -- .../applets/rememberthemilk/taskitem.cpp | 53 - .../applets/rememberthemilk/taskitem.h | 73 - .../rememberthemilk/taskitemdelegate.cpp | 308 ---- .../rememberthemilk/taskitemdelegate.h | 66 - .../applets/rememberthemilk/taskmodel.cpp | 328 ---- .../applets/rememberthemilk/taskmodel.h | 91 - .../rememberthemilk/tasksortfilter.cpp | 170 -- .../applets/rememberthemilk/tasksortfilter.h | 51 - .../applets/webslice/CMakeLists.txt | 21 - .../applets/webslice/kgraphicswebslice.cpp | 294 ---- .../applets/webslice/kgraphicswebslice.h | 190 --- .../applets/webslice/kwebslice.cpp | 90 - kdeplasma-addons/applets/webslice/kwebslice.h | 87 - kdeplasma-addons/applets/webslice/main.cpp | 16 - .../applets/webslice/plasma/CMakeLists.txt | 20 - .../applets/webslice/plasma/Messages.sh | 3 - .../plasma/plasma-applet-webslice.desktop | 111 -- .../applets/webslice/plasma/webslice.cpp | 293 ---- .../applets/webslice/plasma/webslice.h | 70 - .../applets/webslice/plasma/websliceConfig.ui | 88 - .../applets/webslice/webslice.pro | 15 - kdeplasma-addons/cmake/FindQJSON.cmake | 44 - kdeplasma-addons/cmake/FindQtOAuth.cmake | 37 - kdeplasma-addons/dataengines/CMakeLists.txt | 6 - .../dataengines/konqprofiles/CMakeLists.txt | 12 - .../dataengines/konqprofiles/Messages.sh | 2 - .../konqprofiles/konqprofilesengine.cpp | 95 -- .../konqprofiles/konqprofilesengine.h | 50 - .../konqprofiles/konqprofilesservice.cpp | 60 - .../konqprofiles/konqprofilesservice.h | 45 - ....plasma.dataengine.konqprofiles.operations | 8 - .../plasma-dataengine-konqprofiles.desktop | 127 -- .../dataengines/microblog/CMakeLists.txt | 34 - .../dataengines/microblog/imagesource.cpp | 125 -- .../dataengines/microblog/imagesource.h | 70 - .../dataengines/microblog/koauth.cpp | 660 -------- .../dataengines/microblog/koauth.h | 118 -- .../dataengines/microblog/koauthwebhelper.cpp | 218 --- .../dataengines/microblog/koauthwebhelper.h | 60 - .../plasma-dataengine-microblog.desktop | 117 -- .../dataengines/microblog/timelineservice.cpp | 89 - .../dataengines/microblog/timelineservice.h | 50 - .../dataengines/microblog/timelinesource.cpp | 533 ------ .../dataengines/microblog/timelinesource.h | 143 -- .../dataengines/microblog/tweet.operations | 71 - .../dataengines/microblog/tweetjob.cpp | 118 -- .../dataengines/microblog/tweetjob.h | 73 - .../dataengines/microblog/twitterengine.cpp | 356 ---- .../dataengines/microblog/twitterengine.h | 105 -- .../dataengines/microblog/usersource.cpp | 174 -- .../dataengines/microblog/usersource.h | 83 - .../dataengines/potd/CMakeLists.txt | 11 - .../dataengines/potd/natgeoprovider.cpp | 109 -- .../dataengines/potd/natgeoprovider.desktop | 46 - .../dataengines/potd/natgeoprovider.h | 70 - .../rememberthemilk/CMakeLists.txt | 42 - .../rememberthemilk/authservice.cpp | 80 - .../dataengines/rememberthemilk/authservice.h | 63 - .../rememberthemilk/listsource.cpp | 64 - .../dataengines/rememberthemilk/listsource.h | 44 - .../rememberthemilk/listssource.cpp | 83 - .../dataengines/rememberthemilk/listssource.h | 59 - .../rememberthemilk/plasma-engine-rtm.desktop | 116 -- .../rememberthemilk/rtmauth.operations | 14 - .../dataengines/rememberthemilk/rtmengine.cpp | 171 -- .../dataengines/rememberthemilk/rtmengine.h | 64 - .../rememberthemilk/rtmtask.operations | 41 - .../rememberthemilk/rtmtasks.operations | 13 - .../rememberthemilk/taskservice.cpp | 102 -- .../dataengines/rememberthemilk/taskservice.h | 60 - .../rememberthemilk/tasksource.cpp | 68 - .../dataengines/rememberthemilk/tasksource.h | 51 - .../rememberthemilk/tasksservice.cpp | 60 - .../rememberthemilk/tasksservice.h | 56 - .../rememberthemilk/taskssource.cpp | 84 - .../dataengines/rememberthemilk/taskssource.h | 69 - kdeplasma-addons/libs/CMakeLists.txt | 2 - .../libs/lancelot-datamodels/CMakeLists.txt | 34 +- kdeplasma-addons/libs/rtm/CMakeLists.txt | 46 - kdeplasma-addons/libs/rtm/FindRTM.cmake | 12 - kdeplasma-addons/libs/rtm/INSTALL | 3 - kdeplasma-addons/libs/rtm/Messages.sh | 2 - kdeplasma-addons/libs/rtm/README | 2 - kdeplasma-addons/libs/rtm/auth.cpp | 131 -- kdeplasma-addons/libs/rtm/auth.h | 55 - kdeplasma-addons/libs/rtm/list.cpp | 183 -- kdeplasma-addons/libs/rtm/list.h | 128 -- kdeplasma-addons/libs/rtm/note.h | 55 - kdeplasma-addons/libs/rtm/request.cpp | 158 -- kdeplasma-addons/libs/rtm/request.h | 77 - kdeplasma-addons/libs/rtm/request_p.h | 88 - kdeplasma-addons/libs/rtm/rtm.h | 64 - kdeplasma-addons/libs/rtm/rtm.pro | 39 - kdeplasma-addons/libs/rtm/rtm_export.h | 46 - kdeplasma-addons/libs/rtm/session.cpp | 301 ---- kdeplasma-addons/libs/rtm/session.h | 140 -- kdeplasma-addons/libs/rtm/session_p.h | 297 ---- kdeplasma-addons/libs/rtm/task.cpp | 308 ---- kdeplasma-addons/libs/rtm/task.h | 124 -- kdeplasma-addons/libs/rtm/task_p.h | 71 - .../libs/rtm/tests/CMakeLists.txt | 14 - kdeplasma-addons/libs/rtm/tests/login.cpp | 45 - .../libs/rtm/tests/loginwidget.cpp | 47 - kdeplasma-addons/libs/rtm/tests/refresh.cpp | 83 - kdeplasma-addons/libs/rtm/xmlreaders.cpp | 430 ----- kdeplasma-addons/libs/rtm/xmlreaders.h | 70 - kdeplasma-addons/runners/CMakeLists.txt | 13 +- .../runners/konquerorsessions/CMakeLists.txt | 11 - .../runners/konquerorsessions/Messages.sh | 2 - .../konquerorsessions/konquerorsessions.cpp | 151 -- .../konquerorsessions.desktop | 121 -- .../konquerorsessions/konquerorsessions.h | 45 - .../runners/translator/CMakeLists.txt | 18 +- .../runners/youtube/CMakeLists.txt | 14 +- kgpg/CMakeLists.txt | 186 +- kolourpaint/.krazy | 1 - kolourpaint/AUTHORS | 38 - kolourpaint/BUGS | 138 -- kolourpaint/CMakeLists.txt | 358 ---- kolourpaint/COPYING | 139 -- kolourpaint/COPYING.DOC | 397 ----- kolourpaint/COPYING.LIB | 481 ------ kolourpaint/Messages.sh | 3 - kolourpaint/NEWS | 383 ----- kolourpaint/README | 105 -- kolourpaint/VERSION | 1 - .../effects/kpEffectBalanceCommand.cpp | 61 - .../imagelib/effects/kpEffectBalanceCommand.h | 56 - .../effects/kpEffectBlurSharpenCommand.cpp | 71 - .../effects/kpEffectBlurSharpenCommand.h | 58 - .../imagelib/effects/kpEffectClearCommand.cpp | 113 -- .../imagelib/effects/kpEffectClearCommand.h | 62 - .../imagelib/effects/kpEffectCommandBase.cpp | 127 -- .../imagelib/effects/kpEffectCommandBase.h | 67 - .../effects/kpEffectEmbossCommand.cpp | 58 - .../imagelib/effects/kpEffectEmbossCommand.h | 53 - .../effects/kpEffectFlattenCommand.cpp | 64 - .../imagelib/effects/kpEffectFlattenCommand.h | 59 - .../effects/kpEffectGrayscaleCommand.cpp | 61 - .../effects/kpEffectGrayscaleCommand.h | 57 - .../imagelib/effects/kpEffectHSVCommand.cpp | 50 - .../imagelib/effects/kpEffectHSVCommand.h | 51 - .../effects/kpEffectInvertCommand.cpp | 78 - .../imagelib/effects/kpEffectInvertCommand.h | 63 - .../effects/kpEffectReduceColorsCommand.cpp | 86 - .../effects/kpEffectReduceColorsCommand.h | 60 - .../effects/kpEffectToneEnhanceCommand.cpp | 56 - .../effects/kpEffectToneEnhanceCommand.h | 53 - .../imagelib/kpDocumentMetaInfoCommand.cpp | 89 - .../imagelib/kpDocumentMetaInfoCommand.h | 59 - .../transforms/kpTransformFlipCommand.cpp | 141 -- .../transforms/kpTransformFlipCommand.h | 60 - .../kpTransformResizeScaleCommand.cpp | 486 ------ .../kpTransformResizeScaleCommand.h | 102 -- .../transforms/kpTransformRotateCommand.cpp | 223 --- .../transforms/kpTransformRotateCommand.h | 68 - .../transforms/kpTransformSkewCommand.cpp | 199 --- .../transforms/kpTransformSkewCommand.h | 66 - kolourpaint/commands/kpCommand.cpp | 85 - kolourpaint/commands/kpCommand.h | 91 - kolourpaint/commands/kpCommandHistory.cpp | 128 -- kolourpaint/commands/kpCommandHistory.h | 105 -- kolourpaint/commands/kpCommandHistoryBase.cpp | 753 --------- kolourpaint/commands/kpCommandHistoryBase.h | 155 -- kolourpaint/commands/kpCommandSize.cpp | 157 -- kolourpaint/commands/kpCommandSize.h | 87 - kolourpaint/commands/kpMacroCommand.cpp | 148 -- kolourpaint/commands/kpMacroCommand.h | 69 - kolourpaint/commands/kpNamedCommand.cpp | 45 - kolourpaint/commands/kpNamedCommand.h | 50 - .../commands/tools/flow/kpToolFlowCommand.cpp | 141 -- .../commands/tools/flow/kpToolFlowCommand.h | 64 - .../tools/kpToolColorPickerCommand.cpp | 83 - .../commands/tools/kpToolColorPickerCommand.h | 59 - .../commands/tools/kpToolFloodFillCommand.cpp | 170 -- .../commands/tools/kpToolFloodFillCommand.h | 68 - .../polygonal/kpToolPolygonalCommand.cpp | 145 -- .../tools/polygonal/kpToolPolygonalCommand.h | 68 - .../rectangular/kpToolRectangularCommand.cpp | 134 -- .../rectangular/kpToolRectangularCommand.h | 62 - .../kpAbstractSelectionContentCommand.cpp | 69 - .../kpAbstractSelectionContentCommand.h | 71 - ...pToolImageSelectionTransparencyCommand.cpp | 97 -- .../kpToolImageSelectionTransparencyCommand.h | 56 - .../kpToolSelectionCreateCommand.cpp | 159 -- .../selection/kpToolSelectionCreateCommand.h | 63 - .../kpToolSelectionDestroyCommand.cpp | 185 -- .../selection/kpToolSelectionDestroyCommand.h | 61 - .../selection/kpToolSelectionMoveCommand.cpp | 229 --- .../selection/kpToolSelectionMoveCommand.h | 74 - ...kpToolSelectionPullFromDocumentCommand.cpp | 144 -- .../kpToolSelectionPullFromDocumentCommand.h | 59 - .../kpToolSelectionResizeScaleCommand.cpp | 277 --- .../kpToolSelectionResizeScaleCommand.h | 107 -- .../text/kpToolTextBackspaceCommand.cpp | 151 -- .../text/kpToolTextBackspaceCommand.h | 64 - .../text/kpToolTextChangeStyleCommand.cpp | 99 -- .../text/kpToolTextChangeStyleCommand.h | 55 - .../text/kpToolTextDeleteCommand.cpp | 139 -- .../selection/text/kpToolTextDeleteCommand.h | 64 - .../selection/text/kpToolTextEnterCommand.cpp | 125 -- .../selection/text/kpToolTextEnterCommand.h | 63 - .../text/kpToolTextGiveContentCommand.cpp | 154 -- .../text/kpToolTextGiveContentCommand.h | 59 - .../text/kpToolTextInsertCommand.cpp | 108 -- .../selection/text/kpToolTextInsertCommand.h | 56 - kolourpaint/cursors/kpCursorLightCross.cpp | 130 -- kolourpaint/cursors/kpCursorLightCross.h | 39 - kolourpaint/cursors/kpCursorProvider.cpp | 47 - kolourpaint/cursors/kpCursorProvider.h | 43 - .../imagelib/effects/kpEffectsDialog.cpp | 370 ---- .../imagelib/effects/kpEffectsDialog.h | 92 - .../imagelib/kpDocumentMetaInfoDialog.cpp | 793 --------- .../imagelib/kpDocumentMetaInfoDialog.h | 114 -- .../transforms/kpTransformPreviewDialog.cpp | 459 ----- .../transforms/kpTransformPreviewDialog.h | 144 -- .../kpTransformResizeScaleDialog.cpp | 817 --------- .../transforms/kpTransformResizeScaleDialog.h | 124 -- .../transforms/kpTransformRotateDialog.cpp | 315 ---- .../transforms/kpTransformRotateDialog.h | 93 - .../transforms/kpTransformSkewDialog.cpp | 296 ---- .../transforms/kpTransformSkewDialog.h | 90 - .../dialogs/kpColorSimilarityDialog.cpp | 156 -- kolourpaint/dialogs/kpColorSimilarityDialog.h | 68 - .../kpDocumentSaveOptionsPreviewDialog.cpp | 249 --- .../kpDocumentSaveOptionsPreviewDialog.h | 83 - kolourpaint/document/kpDocument.cpp | 467 ----- kolourpaint/document/kpDocument.h | 362 ---- kolourpaint/document/kpDocumentPrivate.h | 47 - .../document/kpDocumentSaveOptions.cpp | 628 ------- kolourpaint/document/kpDocumentSaveOptions.h | 150 -- kolourpaint/document/kpDocument_Open.cpp | 268 --- kolourpaint/document/kpDocument_Save.cpp | 514 ------ kolourpaint/document/kpDocument_Selection.cpp | 341 ---- .../commands/kpCommandEnvironment.cpp | 103 -- .../commands/kpCommandEnvironment.h | 80 - .../kpTransformDialogEnvironment.cpp | 43 - .../transforms/kpTransformDialogEnvironment.h | 53 - .../document/kpDocumentEnvironment.cpp | 213 --- .../document/kpDocumentEnvironment.h | 72 - .../environments/kpEnvironmentBase.cpp | 121 -- kolourpaint/environments/kpEnvironmentBase.h | 99 -- .../environments/tools/kpToolEnvironment.cpp | 212 --- .../environments/tools/kpToolEnvironment.h | 161 -- .../selection/kpToolSelectionEnvironment.cpp | 97 -- .../selection/kpToolSelectionEnvironment.h | 72 - kolourpaint/gen_cmake_include_dirs | 7 - kolourpaint/gen_cmake_srcs | 7 - .../generic/kpSetOverrideCursorSaver.cpp | 43 - .../generic/kpSetOverrideCursorSaver.h | 107 -- kolourpaint/generic/kpWidgetMapper.cpp | 76 - kolourpaint/generic/kpWidgetMapper.h | 48 - .../widgets/kpResizeSignallingLabel.cpp | 68 - .../generic/widgets/kpResizeSignallingLabel.h | 56 - kolourpaint/generic/widgets/kpSubWindow.cpp | 35 - kolourpaint/generic/widgets/kpSubWindow.h | 57 - .../imagelib/effects/kpEffectBalance.cpp | 213 --- .../imagelib/effects/kpEffectBalance.h | 53 - .../imagelib/effects/kpEffectBlurSharpen.cpp | 204 --- .../imagelib/effects/kpEffectBlurSharpen.h | 57 - .../imagelib/effects/kpEffectEmboss.cpp | 93 - kolourpaint/imagelib/effects/kpEffectEmboss.h | 52 - .../imagelib/effects/kpEffectFlatten.cpp | 64 - .../imagelib/effects/kpEffectFlatten.h | 47 - .../imagelib/effects/kpEffectGrayscale.cpp | 74 - .../imagelib/effects/kpEffectGrayscale.h | 47 - kolourpaint/imagelib/effects/kpEffectHSV.cpp | 173 -- kolourpaint/imagelib/effects/kpEffectHSV.h | 44 - .../imagelib/effects/kpEffectInvert.cpp | 90 - kolourpaint/imagelib/effects/kpEffectInvert.h | 62 - .../imagelib/effects/kpEffectReduceColors.cpp | 236 --- .../imagelib/effects/kpEffectReduceColors.h | 51 - .../imagelib/effects/kpEffectToneEnhance.cpp | 283 ---- .../imagelib/effects/kpEffectToneEnhance.h | 61 - kolourpaint/imagelib/kpColor.cpp | 310 ---- kolourpaint/imagelib/kpColor.h | 156 -- kolourpaint/imagelib/kpColor_Constants.cpp | 117 -- kolourpaint/imagelib/kpDocumentMetaInfo.cpp | 283 ---- kolourpaint/imagelib/kpDocumentMetaInfo.h | 108 -- kolourpaint/imagelib/kpFloodFill.cpp | 413 ----- kolourpaint/imagelib/kpFloodFill.h | 128 -- kolourpaint/imagelib/kpImage.h | 38 - kolourpaint/imagelib/kpPainter.cpp | 600 ------- kolourpaint/imagelib/kpPainter.h | 188 --- .../transforms/kpTransformAutoCrop.cpp | 769 --------- .../imagelib/transforms/kpTransformAutoCrop.h | 85 - .../imagelib/transforms/kpTransformCrop.cpp | 76 - .../imagelib/transforms/kpTransformCrop.h | 83 - .../transforms/kpTransformCropPrivate.h | 49 - .../kpTransformCrop_ImageSelection.cpp | 269 --- .../kpTransformCrop_TextSelection.cpp | 76 - kolourpaint/kolourpaint.appdata.xml | 238 --- kolourpaint/kolourpaint.cpp | 118 -- kolourpaint/kolourpaint.desktop | 165 -- kolourpaint/kolourpaintui.rc | 226 --- kolourpaint/kpDefs.h | 152 -- kolourpaint/kpThumbnail.cpp | 179 -- kolourpaint/kpThumbnail.h | 76 - kolourpaint/kpViewScrollableContainer.cpp | 1181 ------------- kolourpaint/kpViewScrollableContainer.h | 216 --- .../image/kpAbstractImageSelection.cpp | 583 ------- .../image/kpAbstractImageSelection.h | 267 --- .../image/kpEllipticalImageSelection.cpp | 183 -- .../image/kpEllipticalImageSelection.h | 118 -- .../image/kpFreeFormImageSelection.cpp | 389 ----- .../image/kpFreeFormImageSelection.h | 159 -- .../image/kpImageSelectionTransparency.cpp | 208 --- .../image/kpImageSelectionTransparency.h | 82 - .../image/kpRectangularImageSelection.cpp | 149 -- .../image/kpRectangularImageSelection.h | 119 -- .../layers/selections/kpAbstractSelection.cpp | 312 ---- .../layers/selections/kpAbstractSelection.h | 278 --- .../layers/selections/kpSelectionDrag.cpp | 154 -- .../layers/selections/kpSelectionDrag.h | 52 - .../layers/selections/kpSelectionFactory.cpp | 93 - .../layers/selections/kpSelectionFactory.h | 48 - .../layers/selections/text/kpPreeditText.cpp | 142 -- .../layers/selections/text/kpPreeditText.h | 65 - .../selections/text/kpTextSelection.cpp | 346 ---- .../layers/selections/text/kpTextSelection.h | 294 ---- .../selections/text/kpTextSelectionPrivate.h | 47 - .../text/kpTextSelection_Cursor.cpp | 126 -- .../selections/text/kpTextSelection_Paint.cpp | 269 --- .../layers/selections/text/kpTextStyle.cpp | 270 --- .../layers/selections/text/kpTextStyle.h | 107 -- kolourpaint/layers/tempImage/kpTempImage.cpp | 217 --- kolourpaint/layers/tempImage/kpTempImage.h | 110 -- .../lgpl/generic/kpColorCollection.cpp | 537 ------ kolourpaint/lgpl/generic/kpColorCollection.h | 264 --- kolourpaint/lgpl/generic/kpUrlFormatter.cpp | 58 - kolourpaint/lgpl/generic/kpUrlFormatter.h | 57 - .../lgpl/generic/widgets/kpColorCellsBase.cpp | 563 ------- .../lgpl/generic/widgets/kpColorCellsBase.h | 185 -- kolourpaint/lgpl/kolourpaint_lgpl_export.h | 40 - kolourpaint/mainWindow/kpMainWindow.cpp | 974 ----------- kolourpaint/mainWindow/kpMainWindow.h | 698 -------- kolourpaint/mainWindow/kpMainWindowPrivate.h | 428 ----- .../mainWindow/kpMainWindow_Colors.cpp | 454 ----- kolourpaint/mainWindow/kpMainWindow_Edit.cpp | 921 ---------- kolourpaint/mainWindow/kpMainWindow_File.cpp | 1495 ----------------- kolourpaint/mainWindow/kpMainWindow_Image.cpp | 595 ------- .../mainWindow/kpMainWindow_Settings.cpp | 145 -- .../mainWindow/kpMainWindow_StatusBar.cpp | 438 ----- kolourpaint/mainWindow/kpMainWindow_Text.cpp | 435 ----- kolourpaint/mainWindow/kpMainWindow_Tools.cpp | 807 --------- kolourpaint/mainWindow/kpMainWindow_View.cpp | 170 -- .../kpMainWindow_View_Thumbnail.cpp | 477 ------ .../mainWindow/kpMainWindow_View_Zoom.cpp | 708 -------- .../patches/checkerboard-faster-render.diff | 147 -- .../patches/linear-sharpen-effect.diff | 150 -- kolourpaint/pics/CMakeLists.txt | 11 - kolourpaint/pics/action/CMakeLists.txt | 9 - .../pics/action/hi16-action-tool_brush.png | Bin 622 -> 0 bytes .../action/hi16-action-tool_color_eraser.png | Bin 954 -> 0 bytes .../action/hi16-action-tool_color_picker.png | Bin 582 -> 0 bytes .../pics/action/hi16-action-tool_curve.png | Bin 425 -> 0 bytes .../pics/action/hi16-action-tool_ellipse.png | Bin 754 -> 0 bytes .../hi16-action-tool_elliptical_selection.png | Bin 833 -> 0 bytes .../pics/action/hi16-action-tool_eraser.png | Bin 745 -> 0 bytes .../action/hi16-action-tool_flood_fill.png | Bin 583 -> 0 bytes .../hi16-action-tool_free_form_selection.png | Bin 783 -> 0 bytes .../pics/action/hi16-action-tool_line.png | Bin 338 -> 0 bytes .../pics/action/hi16-action-tool_pen.png | Bin 535 -> 0 bytes .../pics/action/hi16-action-tool_polygon.png | Bin 826 -> 0 bytes .../pics/action/hi16-action-tool_polyline.png | Bin 489 -> 0 bytes .../hi16-action-tool_rect_selection.png | Bin 857 -> 0 bytes .../action/hi16-action-tool_rectangle.png | Bin 495 -> 0 bytes .../hi16-action-tool_rounded_rectangle.png | Bin 670 -> 0 bytes .../pics/action/hi16-action-tool_spraycan.png | Bin 723 -> 0 bytes .../pics/action/hi16-action-tool_text.png | Bin 332 -> 0 bytes .../pics/action/hi22-action-tool_brush.png | Bin 912 -> 0 bytes .../action/hi22-action-tool_color_eraser.png | Bin 1440 -> 0 bytes .../action/hi22-action-tool_color_picker.png | Bin 889 -> 0 bytes .../pics/action/hi22-action-tool_curve.png | Bin 586 -> 0 bytes .../pics/action/hi22-action-tool_ellipse.png | Bin 1102 -> 0 bytes .../hi22-action-tool_elliptical_selection.png | Bin 1264 -> 0 bytes .../pics/action/hi22-action-tool_eraser.png | Bin 1165 -> 0 bytes .../action/hi22-action-tool_flood_fill.png | Bin 783 -> 0 bytes .../hi22-action-tool_free_form_selection.png | Bin 1188 -> 0 bytes .../pics/action/hi22-action-tool_line.png | Bin 343 -> 0 bytes .../pics/action/hi22-action-tool_pen.png | Bin 774 -> 0 bytes .../pics/action/hi22-action-tool_polygon.png | Bin 1250 -> 0 bytes .../pics/action/hi22-action-tool_polyline.png | Bin 719 -> 0 bytes .../hi22-action-tool_rect_selection.png | Bin 1210 -> 0 bytes .../action/hi22-action-tool_rectangle.png | Bin 742 -> 0 bytes .../hi22-action-tool_rounded_rectangle.png | Bin 1043 -> 0 bytes .../pics/action/hi22-action-tool_spraycan.png | Bin 1096 -> 0 bytes .../pics/action/hi22-action-tool_text.png | Bin 675 -> 0 bytes .../pics/action/hi32-action-tool_brush.png | Bin 1504 -> 0 bytes .../action/hi32-action-tool_color_eraser.png | Bin 2485 -> 0 bytes .../action/hi32-action-tool_color_picker.png | Bin 1369 -> 0 bytes .../pics/action/hi32-action-tool_curve.png | Bin 854 -> 0 bytes .../pics/action/hi32-action-tool_ellipse.png | Bin 1673 -> 0 bytes .../hi32-action-tool_elliptical_selection.png | Bin 1802 -> 0 bytes .../pics/action/hi32-action-tool_eraser.png | Bin 1886 -> 0 bytes .../action/hi32-action-tool_flood_fill.png | Bin 1176 -> 0 bytes .../hi32-action-tool_free_form_selection.png | Bin 1768 -> 0 bytes .../pics/action/hi32-action-tool_line.png | Bin 550 -> 0 bytes .../pics/action/hi32-action-tool_pen.png | Bin 1139 -> 0 bytes .../pics/action/hi32-action-tool_polygon.png | Bin 1877 -> 0 bytes .../pics/action/hi32-action-tool_polyline.png | Bin 1008 -> 0 bytes .../hi32-action-tool_rect_selection.png | Bin 2002 -> 0 bytes .../action/hi32-action-tool_rectangle.png | Bin 889 -> 0 bytes .../hi32-action-tool_rounded_rectangle.png | Bin 1461 -> 0 bytes .../pics/action/hi32-action-tool_spraycan.png | Bin 1859 -> 0 bytes .../pics/action/hi32-action-tool_text.png | Bin 994 -> 0 bytes .../pics/action/hi48-action-tool_brush.png | Bin 2609 -> 0 bytes .../action/hi48-action-tool_color_eraser.png | Bin 4328 -> 0 bytes .../action/hi48-action-tool_color_picker.png | Bin 2369 -> 0 bytes .../pics/action/hi48-action-tool_curve.png | Bin 1257 -> 0 bytes .../pics/action/hi48-action-tool_ellipse.png | Bin 2537 -> 0 bytes .../hi48-action-tool_elliptical_selection.png | Bin 2911 -> 0 bytes .../pics/action/hi48-action-tool_eraser.png | Bin 3328 -> 0 bytes .../action/hi48-action-tool_flood_fill.png | Bin 1474 -> 0 bytes .../hi48-action-tool_free_form_selection.png | Bin 2887 -> 0 bytes .../pics/action/hi48-action-tool_line.png | Bin 750 -> 0 bytes .../pics/action/hi48-action-tool_pen.png | Bin 1952 -> 0 bytes .../pics/action/hi48-action-tool_polygon.png | Bin 2914 -> 0 bytes .../pics/action/hi48-action-tool_polyline.png | Bin 1341 -> 0 bytes .../hi48-action-tool_rect_selection.png | Bin 3456 -> 0 bytes .../action/hi48-action-tool_rectangle.png | Bin 1325 -> 0 bytes .../hi48-action-tool_rounded_rectangle.png | Bin 2184 -> 0 bytes .../pics/action/hi48-action-tool_spraycan.png | Bin 3200 -> 0 bytes .../pics/action/hi48-action-tool_text.png | Bin 1210 -> 0 bytes .../pics/action/hisc-action-tool_brush.svgz | Bin 8136 -> 0 bytes .../action/hisc-action-tool_color_eraser.svgz | Bin 7818 -> 0 bytes .../action/hisc-action-tool_color_picker.svgz | Bin 10939 -> 0 bytes .../pics/action/hisc-action-tool_curve.svgz | Bin 2380 -> 0 bytes .../pics/action/hisc-action-tool_ellipse.svgz | Bin 1994 -> 0 bytes ...hisc-action-tool_elliptical_selection.svgz | Bin 3597 -> 0 bytes .../pics/action/hisc-action-tool_eraser.svgz | Bin 6959 -> 0 bytes .../action/hisc-action-tool_flood_fill.svgz | Bin 2903 -> 0 bytes .../hisc-action-tool_free_form_selection.svgz | Bin 4661 -> 0 bytes .../pics/action/hisc-action-tool_line.svgz | Bin 1333 -> 0 bytes .../pics/action/hisc-action-tool_pen.svgz | Bin 4924 -> 0 bytes .../pics/action/hisc-action-tool_polygon.svgz | Bin 2276 -> 0 bytes .../action/hisc-action-tool_polyline.svgz | Bin 2098 -> 0 bytes .../hisc-action-tool_rect_selection.svgz | Bin 3819 -> 0 bytes .../action/hisc-action-tool_rectangle.svgz | Bin 1960 -> 0 bytes .../hisc-action-tool_rounded_rectangle.svgz | Bin 2220 -> 0 bytes .../action/hisc-action-tool_spraycan.svgz | Bin 8587 -> 0 bytes .../pics/action/hisc-action-tool_text.svgz | Bin 2666 -> 0 bytes kolourpaint/pics/app/CMakeLists.txt | 9 - kolourpaint/pics/app/hi16-app-kolourpaint.png | Bin 759 -> 0 bytes kolourpaint/pics/app/hi22-app-kolourpaint.png | Bin 1206 -> 0 bytes kolourpaint/pics/app/hi32-app-kolourpaint.png | Bin 2086 -> 0 bytes kolourpaint/pics/app/hi48-app-kolourpaint.png | Bin 3922 -> 0 bytes .../pics/app/hisc-app-kolourpaint.svgz | Bin 12874 -> 0 bytes kolourpaint/pics/custom/CMakeLists.txt | 14 - .../pics/custom/color_transparent_26x26.png | Bin 919 -> 0 bytes .../pics/custom/colorbutton_swap_16x16.png | Bin 119 -> 0 bytes .../custom/image_rotate_anticlockwise.png | Bin 203 -> 0 bytes .../pics/custom/image_rotate_clockwise.png | Bin 196 -> 0 bytes .../pics/custom/image_skew_horizontal.png | Bin 179 -> 0 bytes .../pics/custom/image_skew_vertical.png | Bin 237 -> 0 bytes kolourpaint/pics/custom/option_opaque.png | Bin 659 -> 0 bytes .../pics/custom/option_transparent.png | Bin 815 -> 0 bytes kolourpaint/pics/custom/resize.png | Bin 3951 -> 0 bytes kolourpaint/pics/custom/scale.png | Bin 1724 -> 0 bytes kolourpaint/pics/custom/smooth_scale.png | Bin 5039 -> 0 bytes .../pics/custom/tool_spraycan_17x17.png | Bin 130 -> 0 bytes .../pics/custom/tool_spraycan_29x29.png | Bin 210 -> 0 bytes kolourpaint/pics/custom/tool_spraycan_9x9.png | Bin 92 -> 0 bytes kolourpaint/pixmapfx/kpPixmapFX.h | 281 ---- .../pixmapfx/kpPixmapFX_DrawShapes.cpp | 492 ------ .../pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp | 143 -- .../pixmapfx/kpPixmapFX_Transforms.cpp | 674 -------- kolourpaint/stamp | 4 - kolourpaint/tests/45deg_line.png | Bin 94 -> 0 bytes kolourpaint/tests/4x4-transparent.png | Bin 98 -> 0 bytes kolourpaint/tests/5x5.png | Bin 99 -> 0 bytes kolourpaint/tests/depth1.bmp | Bin 462 -> 0 bytes kolourpaint/tests/dither.png | Bin 859 -> 0 bytes kolourpaint/tests/freeform-selection.png | Bin 206 -> 0 bytes kolourpaint/tests/kolourcircles.png | Bin 4889 -> 0 bytes kolourpaint/tests/paste_in_new_window.png | Bin 227 -> 0 bytes kolourpaint/tests/paste_in_new_window.txt | 15 - kolourpaint/tests/rotate.png | Bin 79 -> 0 bytes kolourpaint/tests/selections.txt | 12 - kolourpaint/tests/small16x16.png | Bin 120 -> 0 bytes kolourpaint/tests/tool_fill_xlimit.png | Bin 119 -> 0 bytes .../transforms-rotate-me-90-clockwise.png | Bin 201 -> 0 bytes kolourpaint/tests/transforms.png | Bin 192 -> 0 bytes kolourpaint/tests/transparent.png | Bin 149 -> 0 bytes kolourpaint/tests/transparent_selection.png | Bin 205 -> 0 bytes kolourpaint/tools/flow/kpToolBrush.cpp | 57 - kolourpaint/tools/flow/kpToolBrush.h | 50 - kolourpaint/tools/flow/kpToolColorEraser.cpp | 163 -- kolourpaint/tools/flow/kpToolColorEraser.h | 65 - kolourpaint/tools/flow/kpToolEraser.cpp | 80 - kolourpaint/tools/flow/kpToolEraser.h | 55 - kolourpaint/tools/flow/kpToolFlowBase.cpp | 492 ------ kolourpaint/tools/flow/kpToolFlowBase.h | 120 -- .../tools/flow/kpToolFlowPixmapBase.cpp | 87 - kolourpaint/tools/flow/kpToolFlowPixmapBase.h | 58 - kolourpaint/tools/flow/kpToolPen.cpp | 96 -- kolourpaint/tools/flow/kpToolPen.h | 54 - kolourpaint/tools/flow/kpToolSpraycan.cpp | 264 --- kolourpaint/tools/flow/kpToolSpraycan.h | 90 - kolourpaint/tools/kpTool.cpp | 264 --- kolourpaint/tools/kpTool.h | 468 ------ kolourpaint/tools/kpToolAction.cpp | 70 - kolourpaint/tools/kpToolAction.h | 53 - kolourpaint/tools/kpToolColorPicker.cpp | 145 -- kolourpaint/tools/kpToolColorPicker.h | 71 - kolourpaint/tools/kpToolFloodFill.cpp | 170 -- kolourpaint/tools/kpToolFloodFill.h | 60 - kolourpaint/tools/kpToolPrivate.h | 83 - kolourpaint/tools/kpToolZoom.cpp | 253 --- kolourpaint/tools/kpToolZoom.h | 66 - kolourpaint/tools/kpTool_Drawing.cpp | 418 ----- kolourpaint/tools/kpTool_KeyboardEvents.cpp | 412 ----- kolourpaint/tools/kpTool_MouseEvents.cpp | 337 ---- kolourpaint/tools/kpTool_OtherEvents.cpp | 166 -- .../tools/kpTool_UserNotifications.cpp | 164 -- kolourpaint/tools/kpTool_Utilities.cpp | 291 ---- kolourpaint/tools/polygonal/kpToolCurve.cpp | 182 -- kolourpaint/tools/polygonal/kpToolCurve.h | 54 - kolourpaint/tools/polygonal/kpToolLine.cpp | 93 - kolourpaint/tools/polygonal/kpToolLine.h | 52 - kolourpaint/tools/polygonal/kpToolPolygon.cpp | 162 -- kolourpaint/tools/polygonal/kpToolPolygon.h | 62 - .../tools/polygonal/kpToolPolygonalBase.cpp | 501 ------ .../tools/polygonal/kpToolPolygonalBase.h | 209 --- .../tools/polygonal/kpToolPolyline.cpp | 114 -- kolourpaint/tools/polygonal/kpToolPolyline.h | 59 - .../tools/rectangular/kpToolEllipse.cpp | 47 - kolourpaint/tools/rectangular/kpToolEllipse.h | 45 - .../tools/rectangular/kpToolRectangle.cpp | 48 - .../tools/rectangular/kpToolRectangle.h | 45 - .../rectangular/kpToolRectangularBase.cpp | 394 ----- .../tools/rectangular/kpToolRectangularBase.h | 98 -- .../rectangular/kpToolRoundedRectangle.cpp | 46 - .../rectangular/kpToolRoundedRectangle.h | 45 - .../image/kpAbstractImageSelectionTool.cpp | 103 -- .../image/kpAbstractImageSelectionTool.h | 106 -- ...bstractImageSelectionTool_Transparency.cpp | 212 --- .../image/kpToolEllipticalSelection.cpp | 82 - .../image/kpToolEllipticalSelection.h | 50 - .../image/kpToolFreeFormSelection.cpp | 141 -- .../selection/image/kpToolFreeFormSelection.h | 50 - .../selection/image/kpToolRectSelection.cpp | 85 - .../selection/image/kpToolRectSelection.h | 50 - .../selection/kpAbstractSelectionTool.cpp | 631 ------- .../tools/selection/kpAbstractSelectionTool.h | 600 ------- .../kpAbstractSelectionToolPrivate.h | 92 - .../kpAbstractSelectionTool_Create.cpp | 305 ---- ...kpAbstractSelectionTool_KeyboardEvents.cpp | 103 -- .../kpAbstractSelectionTool_Move.cpp | 401 ----- .../kpAbstractSelectionTool_ResizeScale.cpp | 454 ----- .../tools/selection/text/kpToolText.cpp | 221 --- kolourpaint/tools/selection/text/kpToolText.h | 725 -------- .../tools/selection/text/kpToolTextPrivate.h | 51 - .../selection/text/kpToolText_Commands.cpp | 126 -- .../selection/text/kpToolText_Create.cpp | 288 ---- .../selection/text/kpToolText_CursorCalc.cpp | 215 --- .../text/kpToolText_InputMethodEvents.cpp | 96 -- .../text/kpToolText_KeyboardEvents.cpp | 215 --- ...oolText_KeyboardEvents_HandleArrowKeys.cpp | 216 --- ...olText_KeyboardEvents_HandleTypingKeys.cpp | 198 --- .../tools/selection/text/kpToolText_Move.cpp | 63 - .../selection/text/kpToolText_ResizeScale.cpp | 55 - .../selection/text/kpToolText_SelectText.cpp | 136 -- .../selection/text/kpToolText_TextStyle.cpp | 331 ---- kolourpaint/views/kpThumbnailView.cpp | 99 -- kolourpaint/views/kpThumbnailView.h | 90 - kolourpaint/views/kpUnzoomedThumbnailView.cpp | 218 --- kolourpaint/views/kpUnzoomedThumbnailView.h | 106 -- kolourpaint/views/kpView.cpp | 672 -------- kolourpaint/views/kpView.h | 599 ------- kolourpaint/views/kpViewPrivate.h | 78 - kolourpaint/views/kpView_Events.cpp | 272 --- kolourpaint/views/kpView_Paint.cpp | 628 ------- kolourpaint/views/kpView_Selections.cpp | 362 ---- kolourpaint/views/kpZoomedThumbnailView.cpp | 140 -- kolourpaint/views/kpZoomedThumbnailView.h | 95 -- kolourpaint/views/kpZoomedView.cpp | 103 -- kolourpaint/views/kpZoomedView.h | 96 -- kolourpaint/views/manager/kpViewManager.cpp | 365 ---- kolourpaint/views/manager/kpViewManager.h | 256 --- .../views/manager/kpViewManagerPrivate.h | 86 - .../manager/kpViewManager_TextCursor.cpp | 242 --- .../manager/kpViewManager_ViewUpdates.cpp | 268 --- .../kpColorSimilarityCubeRenderer.cpp | 234 --- .../kpColorSimilarityCubeRenderer.h | 54 - .../kpColorSimilarityFrame.cpp | 78 - .../colorSimilarity/kpColorSimilarityFrame.h | 52 - .../kpColorSimilarityHolder.cpp | 189 --- .../colorSimilarity/kpColorSimilarityHolder.h | 65 - .../kpColorSimilarityToolBarItem.cpp | 282 ---- .../kpColorSimilarityToolBarItem.h | 106 -- .../effects/kpEffectBalanceWidget.cpp | 325 ---- .../imagelib/effects/kpEffectBalanceWidget.h | 85 - .../effects/kpEffectBlurSharpenWidget.cpp | 185 -- .../effects/kpEffectBlurSharpenWidget.h | 72 - .../imagelib/effects/kpEffectEmbossWidget.cpp | 131 -- .../imagelib/effects/kpEffectEmbossWidget.h | 66 - .../effects/kpEffectFlattenWidget.cpp | 187 --- .../imagelib/effects/kpEffectFlattenWidget.h | 80 - .../imagelib/effects/kpEffectHSVWidget.cpp | 128 -- .../imagelib/effects/kpEffectHSVWidget.h | 62 - .../imagelib/effects/kpEffectInvertWidget.cpp | 211 --- .../imagelib/effects/kpEffectInvertWidget.h | 77 - .../effects/kpEffectReduceColorsWidget.cpp | 177 -- .../effects/kpEffectReduceColorsWidget.h | 73 - .../effects/kpEffectToneEnhanceWidget.cpp | 144 -- .../effects/kpEffectToneEnhanceWidget.h | 68 - .../imagelib/effects/kpEffectWidgetBase.cpp | 66 - .../imagelib/effects/kpEffectWidgetBase.h | 77 - kolourpaint/widgets/kpColorCells.cpp | 597 ------- kolourpaint/widgets/kpColorCells.h | 169 -- kolourpaint/widgets/kpColorPalette.cpp | 125 -- kolourpaint/widgets/kpColorPalette.h | 63 - .../widgets/kpDefaultColorCollection.cpp | 71 - .../widgets/kpDefaultColorCollection.h | 50 - .../widgets/kpDocumentSaveOptionsWidget.cpp | 768 --------- .../widgets/kpDocumentSaveOptionsWidget.h | 157 -- kolourpaint/widgets/kpDualColorButton.cpp | 464 ----- kolourpaint/widgets/kpDualColorButton.h | 96 -- kolourpaint/widgets/kpPrintDialogPage.cpp | 101 -- kolourpaint/widgets/kpPrintDialogPage.h | 52 - .../widgets/kpTransparentColorCell.cpp | 129 -- kolourpaint/widgets/kpTransparentColorCell.h | 66 - .../widgets/toolbars/kpColorToolBar.cpp | 329 ---- kolourpaint/widgets/toolbars/kpColorToolBar.h | 124 -- .../widgets/toolbars/kpToolToolBar.cpp | 459 ----- kolourpaint/widgets/toolbars/kpToolToolBar.h | 123 -- .../toolbars/options/kpToolWidgetBase.cpp | 723 -------- .../toolbars/options/kpToolWidgetBase.h | 114 -- .../toolbars/options/kpToolWidgetBrush.cpp | 299 ---- .../toolbars/options/kpToolWidgetBrush.h | 81 - .../options/kpToolWidgetEraserSize.cpp | 188 --- .../toolbars/options/kpToolWidgetEraserSize.h | 82 - .../options/kpToolWidgetFillStyle.cpp | 182 -- .../toolbars/options/kpToolWidgetFillStyle.h | 79 - .../options/kpToolWidgetLineWidth.cpp | 90 - .../toolbars/options/kpToolWidgetLineWidth.h | 54 - .../kpToolWidgetOpaqueOrTransparent.cpp | 104 -- .../options/kpToolWidgetOpaqueOrTransparent.h | 57 - .../options/kpToolWidgetSpraycanSize.cpp | 120 -- .../options/kpToolWidgetSpraycanSize.h | 54 - kuser/CMakeLists.txt | 2 +- libkscreen/CMakeLists.txt | 5 - libkscreen/backends/fake/CMakeLists.txt | 21 +- 714 files changed, 181 insertions(+), 93150 deletions(-) delete mode 100644 kdeplasma-addons/applets/kdeobservatory/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/kdeobservatory/cmake/modules/FindQwt.cmake delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi128-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi16-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi22-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi32-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi48-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hi64-app-kdeobservatory.png delete mode 100644 kdeplasma-addons/applets/kdeobservatory/icons/hisc-app-kdeobservatory.svgz delete mode 100644 kdeplasma-addons/applets/kdeobservatory/plasma-applet-kdeobservatory.desktop delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/Messages.sh delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.cpp delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.h delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfiggeneral.ui delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigproject.ui delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigprojects.ui delete mode 100644 kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigviews.ui delete mode 100644 kdeplasma-addons/applets/konqprofiles/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/konqprofiles/Messages.sh delete mode 100644 kdeplasma-addons/applets/konqprofiles/package/contents/ui/konqprofiles.qml delete mode 100644 kdeplasma-addons/applets/konqprofiles/package/metadata.desktop delete mode 100644 kdeplasma-addons/applets/microblog/CMakeLists.txt delete mode 100755 kdeplasma-addons/applets/microblog/Messages.sh delete mode 100644 kdeplasma-addons/applets/microblog/configuration.ui delete mode 100644 kdeplasma-addons/applets/microblog/microblog.cpp delete mode 100644 kdeplasma-addons/applets/microblog/microblog.h delete mode 100644 kdeplasma-addons/applets/microblog/microblog.svgz delete mode 100644 kdeplasma-addons/applets/microblog/plasma-applet-microblog.desktop delete mode 100644 kdeplasma-addons/applets/microblog/postwidget.cpp delete mode 100644 kdeplasma-addons/applets/microblog/postwidget.h delete mode 100644 kdeplasma-addons/applets/news/CMakeLists.txt delete mode 100755 kdeplasma-addons/applets/news/Messages.sh delete mode 100644 kdeplasma-addons/applets/news/config.ui delete mode 100644 kdeplasma-addons/applets/news/feedsConfig.ui delete mode 100644 kdeplasma-addons/applets/news/news.cpp delete mode 100644 kdeplasma-addons/applets/news/news.css delete mode 100644 kdeplasma-addons/applets/news/news.h delete mode 100644 kdeplasma-addons/applets/news/plasma-applet-news.desktop delete mode 100644 kdeplasma-addons/applets/rememberthemilk/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/rememberthemilk/Messages.sh delete mode 100644 kdeplasma-addons/applets/rememberthemilk/authenticate.ui delete mode 100644 kdeplasma-addons/applets/rememberthemilk/general.ui delete mode 100644 kdeplasma-addons/applets/rememberthemilk/plasma-applet-rememberthemilk.desktop delete mode 100644 kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.h delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskeditor.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskeditor.h delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskitem.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskitem.h delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.h delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskmodel.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/taskmodel.h delete mode 100644 kdeplasma-addons/applets/rememberthemilk/tasksortfilter.cpp delete mode 100644 kdeplasma-addons/applets/rememberthemilk/tasksortfilter.h delete mode 100644 kdeplasma-addons/applets/webslice/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/webslice/kgraphicswebslice.cpp delete mode 100644 kdeplasma-addons/applets/webslice/kgraphicswebslice.h delete mode 100644 kdeplasma-addons/applets/webslice/kwebslice.cpp delete mode 100644 kdeplasma-addons/applets/webslice/kwebslice.h delete mode 100644 kdeplasma-addons/applets/webslice/main.cpp delete mode 100644 kdeplasma-addons/applets/webslice/plasma/CMakeLists.txt delete mode 100644 kdeplasma-addons/applets/webslice/plasma/Messages.sh delete mode 100644 kdeplasma-addons/applets/webslice/plasma/plasma-applet-webslice.desktop delete mode 100644 kdeplasma-addons/applets/webslice/plasma/webslice.cpp delete mode 100644 kdeplasma-addons/applets/webslice/plasma/webslice.h delete mode 100644 kdeplasma-addons/applets/webslice/plasma/websliceConfig.ui delete mode 100644 kdeplasma-addons/applets/webslice/webslice.pro delete mode 100644 kdeplasma-addons/cmake/FindQJSON.cmake delete mode 100644 kdeplasma-addons/cmake/FindQtOAuth.cmake delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/CMakeLists.txt delete mode 100755 kdeplasma-addons/dataengines/konqprofiles/Messages.sh delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.cpp delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.h delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.cpp delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.h delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/org.kde.plasma.dataengine.konqprofiles.operations delete mode 100644 kdeplasma-addons/dataengines/konqprofiles/plasma-dataengine-konqprofiles.desktop delete mode 100644 kdeplasma-addons/dataengines/microblog/CMakeLists.txt delete mode 100644 kdeplasma-addons/dataengines/microblog/imagesource.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/imagesource.h delete mode 100644 kdeplasma-addons/dataengines/microblog/koauth.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/koauth.h delete mode 100644 kdeplasma-addons/dataengines/microblog/koauthwebhelper.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/koauthwebhelper.h delete mode 100644 kdeplasma-addons/dataengines/microblog/plasma-dataengine-microblog.desktop delete mode 100644 kdeplasma-addons/dataengines/microblog/timelineservice.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/timelineservice.h delete mode 100644 kdeplasma-addons/dataengines/microblog/timelinesource.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/timelinesource.h delete mode 100644 kdeplasma-addons/dataengines/microblog/tweet.operations delete mode 100644 kdeplasma-addons/dataengines/microblog/tweetjob.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/tweetjob.h delete mode 100644 kdeplasma-addons/dataengines/microblog/twitterengine.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/twitterengine.h delete mode 100644 kdeplasma-addons/dataengines/microblog/usersource.cpp delete mode 100644 kdeplasma-addons/dataengines/microblog/usersource.h delete mode 100644 kdeplasma-addons/dataengines/potd/natgeoprovider.cpp delete mode 100644 kdeplasma-addons/dataengines/potd/natgeoprovider.desktop delete mode 100644 kdeplasma-addons/dataengines/potd/natgeoprovider.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/CMakeLists.txt delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/authservice.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/authservice.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/listsource.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/listsource.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/listssource.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/listssource.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/plasma-engine-rtm.desktop delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/rtmauth.operations delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/rtmengine.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/rtmengine.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/rtmtask.operations delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/rtmtasks.operations delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/taskservice.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/taskservice.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/tasksource.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/tasksource.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/tasksservice.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/tasksservice.h delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/taskssource.cpp delete mode 100644 kdeplasma-addons/dataengines/rememberthemilk/taskssource.h delete mode 100644 kdeplasma-addons/libs/rtm/CMakeLists.txt delete mode 100644 kdeplasma-addons/libs/rtm/FindRTM.cmake delete mode 100644 kdeplasma-addons/libs/rtm/INSTALL delete mode 100755 kdeplasma-addons/libs/rtm/Messages.sh delete mode 100644 kdeplasma-addons/libs/rtm/README delete mode 100644 kdeplasma-addons/libs/rtm/auth.cpp delete mode 100644 kdeplasma-addons/libs/rtm/auth.h delete mode 100644 kdeplasma-addons/libs/rtm/list.cpp delete mode 100644 kdeplasma-addons/libs/rtm/list.h delete mode 100644 kdeplasma-addons/libs/rtm/note.h delete mode 100644 kdeplasma-addons/libs/rtm/request.cpp delete mode 100644 kdeplasma-addons/libs/rtm/request.h delete mode 100644 kdeplasma-addons/libs/rtm/request_p.h delete mode 100644 kdeplasma-addons/libs/rtm/rtm.h delete mode 100644 kdeplasma-addons/libs/rtm/rtm.pro delete mode 100644 kdeplasma-addons/libs/rtm/rtm_export.h delete mode 100644 kdeplasma-addons/libs/rtm/session.cpp delete mode 100644 kdeplasma-addons/libs/rtm/session.h delete mode 100644 kdeplasma-addons/libs/rtm/session_p.h delete mode 100644 kdeplasma-addons/libs/rtm/task.cpp delete mode 100644 kdeplasma-addons/libs/rtm/task.h delete mode 100644 kdeplasma-addons/libs/rtm/task_p.h delete mode 100644 kdeplasma-addons/libs/rtm/tests/CMakeLists.txt delete mode 100644 kdeplasma-addons/libs/rtm/tests/login.cpp delete mode 100644 kdeplasma-addons/libs/rtm/tests/loginwidget.cpp delete mode 100644 kdeplasma-addons/libs/rtm/tests/refresh.cpp delete mode 100644 kdeplasma-addons/libs/rtm/xmlreaders.cpp delete mode 100644 kdeplasma-addons/libs/rtm/xmlreaders.h delete mode 100644 kdeplasma-addons/runners/konquerorsessions/CMakeLists.txt delete mode 100755 kdeplasma-addons/runners/konquerorsessions/Messages.sh delete mode 100644 kdeplasma-addons/runners/konquerorsessions/konquerorsessions.cpp delete mode 100644 kdeplasma-addons/runners/konquerorsessions/konquerorsessions.desktop delete mode 100644 kdeplasma-addons/runners/konquerorsessions/konquerorsessions.h delete mode 100644 kolourpaint/.krazy delete mode 100644 kolourpaint/AUTHORS delete mode 100644 kolourpaint/BUGS delete mode 100644 kolourpaint/CMakeLists.txt delete mode 100644 kolourpaint/COPYING delete mode 100644 kolourpaint/COPYING.DOC delete mode 100644 kolourpaint/COPYING.LIB delete mode 100644 kolourpaint/Messages.sh delete mode 100644 kolourpaint/NEWS delete mode 100644 kolourpaint/README delete mode 100644 kolourpaint/VERSION delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectClearCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectClearCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectCommandBase.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectCommandBase.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.h delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.h delete mode 100644 kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.h delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.h delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.h delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.h delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.cpp delete mode 100644 kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.h delete mode 100644 kolourpaint/commands/kpCommand.cpp delete mode 100644 kolourpaint/commands/kpCommand.h delete mode 100644 kolourpaint/commands/kpCommandHistory.cpp delete mode 100644 kolourpaint/commands/kpCommandHistory.h delete mode 100644 kolourpaint/commands/kpCommandHistoryBase.cpp delete mode 100644 kolourpaint/commands/kpCommandHistoryBase.h delete mode 100644 kolourpaint/commands/kpCommandSize.cpp delete mode 100644 kolourpaint/commands/kpCommandSize.h delete mode 100644 kolourpaint/commands/kpMacroCommand.cpp delete mode 100644 kolourpaint/commands/kpMacroCommand.h delete mode 100644 kolourpaint/commands/kpNamedCommand.cpp delete mode 100644 kolourpaint/commands/kpNamedCommand.h delete mode 100644 kolourpaint/commands/tools/flow/kpToolFlowCommand.cpp delete mode 100644 kolourpaint/commands/tools/flow/kpToolFlowCommand.h delete mode 100644 kolourpaint/commands/tools/kpToolColorPickerCommand.cpp delete mode 100644 kolourpaint/commands/tools/kpToolColorPickerCommand.h delete mode 100644 kolourpaint/commands/tools/kpToolFloodFillCommand.cpp delete mode 100644 kolourpaint/commands/tools/kpToolFloodFillCommand.h delete mode 100644 kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.cpp delete mode 100644 kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.h delete mode 100644 kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.cpp delete mode 100644 kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.h delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.h delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.cpp delete mode 100644 kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.h delete mode 100644 kolourpaint/cursors/kpCursorLightCross.cpp delete mode 100644 kolourpaint/cursors/kpCursorLightCross.h delete mode 100644 kolourpaint/cursors/kpCursorProvider.cpp delete mode 100644 kolourpaint/cursors/kpCursorProvider.h delete mode 100644 kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.h delete mode 100644 kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.h delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.h delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.h delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.h delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp delete mode 100644 kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.h delete mode 100644 kolourpaint/dialogs/kpColorSimilarityDialog.cpp delete mode 100644 kolourpaint/dialogs/kpColorSimilarityDialog.h delete mode 100644 kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp delete mode 100644 kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.h delete mode 100644 kolourpaint/document/kpDocument.cpp delete mode 100644 kolourpaint/document/kpDocument.h delete mode 100644 kolourpaint/document/kpDocumentPrivate.h delete mode 100644 kolourpaint/document/kpDocumentSaveOptions.cpp delete mode 100644 kolourpaint/document/kpDocumentSaveOptions.h delete mode 100644 kolourpaint/document/kpDocument_Open.cpp delete mode 100644 kolourpaint/document/kpDocument_Save.cpp delete mode 100644 kolourpaint/document/kpDocument_Selection.cpp delete mode 100644 kolourpaint/environments/commands/kpCommandEnvironment.cpp delete mode 100644 kolourpaint/environments/commands/kpCommandEnvironment.h delete mode 100644 kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.cpp delete mode 100644 kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.h delete mode 100644 kolourpaint/environments/document/kpDocumentEnvironment.cpp delete mode 100644 kolourpaint/environments/document/kpDocumentEnvironment.h delete mode 100644 kolourpaint/environments/kpEnvironmentBase.cpp delete mode 100644 kolourpaint/environments/kpEnvironmentBase.h delete mode 100644 kolourpaint/environments/tools/kpToolEnvironment.cpp delete mode 100644 kolourpaint/environments/tools/kpToolEnvironment.h delete mode 100644 kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.cpp delete mode 100644 kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.h delete mode 100755 kolourpaint/gen_cmake_include_dirs delete mode 100755 kolourpaint/gen_cmake_srcs delete mode 100644 kolourpaint/generic/kpSetOverrideCursorSaver.cpp delete mode 100644 kolourpaint/generic/kpSetOverrideCursorSaver.h delete mode 100644 kolourpaint/generic/kpWidgetMapper.cpp delete mode 100644 kolourpaint/generic/kpWidgetMapper.h delete mode 100644 kolourpaint/generic/widgets/kpResizeSignallingLabel.cpp delete mode 100644 kolourpaint/generic/widgets/kpResizeSignallingLabel.h delete mode 100644 kolourpaint/generic/widgets/kpSubWindow.cpp delete mode 100644 kolourpaint/generic/widgets/kpSubWindow.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectBalance.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectBalance.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectBlurSharpen.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectBlurSharpen.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectEmboss.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectEmboss.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectFlatten.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectFlatten.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectGrayscale.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectGrayscale.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectHSV.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectHSV.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectInvert.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectInvert.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectReduceColors.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectReduceColors.h delete mode 100644 kolourpaint/imagelib/effects/kpEffectToneEnhance.cpp delete mode 100644 kolourpaint/imagelib/effects/kpEffectToneEnhance.h delete mode 100644 kolourpaint/imagelib/kpColor.cpp delete mode 100644 kolourpaint/imagelib/kpColor.h delete mode 100644 kolourpaint/imagelib/kpColor_Constants.cpp delete mode 100644 kolourpaint/imagelib/kpDocumentMetaInfo.cpp delete mode 100644 kolourpaint/imagelib/kpDocumentMetaInfo.h delete mode 100644 kolourpaint/imagelib/kpFloodFill.cpp delete mode 100644 kolourpaint/imagelib/kpFloodFill.h delete mode 100644 kolourpaint/imagelib/kpImage.h delete mode 100644 kolourpaint/imagelib/kpPainter.cpp delete mode 100644 kolourpaint/imagelib/kpPainter.h delete mode 100644 kolourpaint/imagelib/transforms/kpTransformAutoCrop.cpp delete mode 100644 kolourpaint/imagelib/transforms/kpTransformAutoCrop.h delete mode 100644 kolourpaint/imagelib/transforms/kpTransformCrop.cpp delete mode 100644 kolourpaint/imagelib/transforms/kpTransformCrop.h delete mode 100644 kolourpaint/imagelib/transforms/kpTransformCropPrivate.h delete mode 100644 kolourpaint/imagelib/transforms/kpTransformCrop_ImageSelection.cpp delete mode 100644 kolourpaint/imagelib/transforms/kpTransformCrop_TextSelection.cpp delete mode 100644 kolourpaint/kolourpaint.appdata.xml delete mode 100644 kolourpaint/kolourpaint.cpp delete mode 100644 kolourpaint/kolourpaint.desktop delete mode 100644 kolourpaint/kolourpaintui.rc delete mode 100644 kolourpaint/kpDefs.h delete mode 100644 kolourpaint/kpThumbnail.cpp delete mode 100644 kolourpaint/kpThumbnail.h delete mode 100644 kolourpaint/kpViewScrollableContainer.cpp delete mode 100644 kolourpaint/kpViewScrollableContainer.h delete mode 100644 kolourpaint/layers/selections/image/kpAbstractImageSelection.cpp delete mode 100644 kolourpaint/layers/selections/image/kpAbstractImageSelection.h delete mode 100644 kolourpaint/layers/selections/image/kpEllipticalImageSelection.cpp delete mode 100644 kolourpaint/layers/selections/image/kpEllipticalImageSelection.h delete mode 100644 kolourpaint/layers/selections/image/kpFreeFormImageSelection.cpp delete mode 100644 kolourpaint/layers/selections/image/kpFreeFormImageSelection.h delete mode 100644 kolourpaint/layers/selections/image/kpImageSelectionTransparency.cpp delete mode 100644 kolourpaint/layers/selections/image/kpImageSelectionTransparency.h delete mode 100644 kolourpaint/layers/selections/image/kpRectangularImageSelection.cpp delete mode 100644 kolourpaint/layers/selections/image/kpRectangularImageSelection.h delete mode 100644 kolourpaint/layers/selections/kpAbstractSelection.cpp delete mode 100644 kolourpaint/layers/selections/kpAbstractSelection.h delete mode 100644 kolourpaint/layers/selections/kpSelectionDrag.cpp delete mode 100644 kolourpaint/layers/selections/kpSelectionDrag.h delete mode 100644 kolourpaint/layers/selections/kpSelectionFactory.cpp delete mode 100644 kolourpaint/layers/selections/kpSelectionFactory.h delete mode 100644 kolourpaint/layers/selections/text/kpPreeditText.cpp delete mode 100644 kolourpaint/layers/selections/text/kpPreeditText.h delete mode 100644 kolourpaint/layers/selections/text/kpTextSelection.cpp delete mode 100644 kolourpaint/layers/selections/text/kpTextSelection.h delete mode 100644 kolourpaint/layers/selections/text/kpTextSelectionPrivate.h delete mode 100644 kolourpaint/layers/selections/text/kpTextSelection_Cursor.cpp delete mode 100644 kolourpaint/layers/selections/text/kpTextSelection_Paint.cpp delete mode 100644 kolourpaint/layers/selections/text/kpTextStyle.cpp delete mode 100644 kolourpaint/layers/selections/text/kpTextStyle.h delete mode 100644 kolourpaint/layers/tempImage/kpTempImage.cpp delete mode 100644 kolourpaint/layers/tempImage/kpTempImage.h delete mode 100644 kolourpaint/lgpl/generic/kpColorCollection.cpp delete mode 100644 kolourpaint/lgpl/generic/kpColorCollection.h delete mode 100644 kolourpaint/lgpl/generic/kpUrlFormatter.cpp delete mode 100644 kolourpaint/lgpl/generic/kpUrlFormatter.h delete mode 100644 kolourpaint/lgpl/generic/widgets/kpColorCellsBase.cpp delete mode 100644 kolourpaint/lgpl/generic/widgets/kpColorCellsBase.h delete mode 100644 kolourpaint/lgpl/kolourpaint_lgpl_export.h delete mode 100644 kolourpaint/mainWindow/kpMainWindow.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow.h delete mode 100644 kolourpaint/mainWindow/kpMainWindowPrivate.h delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Colors.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Edit.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_File.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Image.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Settings.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_StatusBar.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Text.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_Tools.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_View.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_View_Thumbnail.cpp delete mode 100644 kolourpaint/mainWindow/kpMainWindow_View_Zoom.cpp delete mode 100644 kolourpaint/patches/checkerboard-faster-render.diff delete mode 100644 kolourpaint/patches/linear-sharpen-effect.diff delete mode 100644 kolourpaint/pics/CMakeLists.txt delete mode 100644 kolourpaint/pics/action/CMakeLists.txt delete mode 100644 kolourpaint/pics/action/hi16-action-tool_brush.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_color_eraser.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_color_picker.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_curve.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_ellipse.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_elliptical_selection.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_eraser.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_flood_fill.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_free_form_selection.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_line.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_pen.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_polygon.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_polyline.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_rect_selection.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_rectangle.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_rounded_rectangle.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_spraycan.png delete mode 100644 kolourpaint/pics/action/hi16-action-tool_text.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_brush.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_color_eraser.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_color_picker.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_curve.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_ellipse.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_elliptical_selection.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_eraser.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_flood_fill.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_free_form_selection.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_line.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_pen.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_polygon.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_polyline.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_rect_selection.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_rectangle.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_rounded_rectangle.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_spraycan.png delete mode 100644 kolourpaint/pics/action/hi22-action-tool_text.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_brush.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_color_eraser.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_color_picker.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_curve.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_ellipse.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_elliptical_selection.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_eraser.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_flood_fill.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_free_form_selection.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_line.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_pen.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_polygon.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_polyline.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_rect_selection.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_rectangle.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_rounded_rectangle.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_spraycan.png delete mode 100644 kolourpaint/pics/action/hi32-action-tool_text.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_brush.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_color_eraser.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_color_picker.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_curve.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_ellipse.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_elliptical_selection.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_eraser.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_flood_fill.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_free_form_selection.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_line.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_pen.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_polygon.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_polyline.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_rect_selection.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_rectangle.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_rounded_rectangle.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_spraycan.png delete mode 100644 kolourpaint/pics/action/hi48-action-tool_text.png delete mode 100644 kolourpaint/pics/action/hisc-action-tool_brush.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_color_eraser.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_color_picker.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_curve.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_ellipse.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_elliptical_selection.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_eraser.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_flood_fill.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_free_form_selection.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_line.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_pen.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_polygon.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_polyline.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_rect_selection.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_rectangle.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_rounded_rectangle.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_spraycan.svgz delete mode 100644 kolourpaint/pics/action/hisc-action-tool_text.svgz delete mode 100644 kolourpaint/pics/app/CMakeLists.txt delete mode 100644 kolourpaint/pics/app/hi16-app-kolourpaint.png delete mode 100644 kolourpaint/pics/app/hi22-app-kolourpaint.png delete mode 100644 kolourpaint/pics/app/hi32-app-kolourpaint.png delete mode 100644 kolourpaint/pics/app/hi48-app-kolourpaint.png delete mode 100644 kolourpaint/pics/app/hisc-app-kolourpaint.svgz delete mode 100644 kolourpaint/pics/custom/CMakeLists.txt delete mode 100644 kolourpaint/pics/custom/color_transparent_26x26.png delete mode 100644 kolourpaint/pics/custom/colorbutton_swap_16x16.png delete mode 100644 kolourpaint/pics/custom/image_rotate_anticlockwise.png delete mode 100644 kolourpaint/pics/custom/image_rotate_clockwise.png delete mode 100644 kolourpaint/pics/custom/image_skew_horizontal.png delete mode 100644 kolourpaint/pics/custom/image_skew_vertical.png delete mode 100644 kolourpaint/pics/custom/option_opaque.png delete mode 100644 kolourpaint/pics/custom/option_transparent.png delete mode 100644 kolourpaint/pics/custom/resize.png delete mode 100644 kolourpaint/pics/custom/scale.png delete mode 100644 kolourpaint/pics/custom/smooth_scale.png delete mode 100644 kolourpaint/pics/custom/tool_spraycan_17x17.png delete mode 100644 kolourpaint/pics/custom/tool_spraycan_29x29.png delete mode 100644 kolourpaint/pics/custom/tool_spraycan_9x9.png delete mode 100644 kolourpaint/pixmapfx/kpPixmapFX.h delete mode 100644 kolourpaint/pixmapfx/kpPixmapFX_DrawShapes.cpp delete mode 100644 kolourpaint/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp delete mode 100644 kolourpaint/pixmapfx/kpPixmapFX_Transforms.cpp delete mode 100644 kolourpaint/stamp delete mode 100644 kolourpaint/tests/45deg_line.png delete mode 100644 kolourpaint/tests/4x4-transparent.png delete mode 100644 kolourpaint/tests/5x5.png delete mode 100644 kolourpaint/tests/depth1.bmp delete mode 100644 kolourpaint/tests/dither.png delete mode 100644 kolourpaint/tests/freeform-selection.png delete mode 100644 kolourpaint/tests/kolourcircles.png delete mode 100644 kolourpaint/tests/paste_in_new_window.png delete mode 100644 kolourpaint/tests/paste_in_new_window.txt delete mode 100644 kolourpaint/tests/rotate.png delete mode 100644 kolourpaint/tests/selections.txt delete mode 100644 kolourpaint/tests/small16x16.png delete mode 100644 kolourpaint/tests/tool_fill_xlimit.png delete mode 100644 kolourpaint/tests/transforms-rotate-me-90-clockwise.png delete mode 100644 kolourpaint/tests/transforms.png delete mode 100644 kolourpaint/tests/transparent.png delete mode 100644 kolourpaint/tests/transparent_selection.png delete mode 100644 kolourpaint/tools/flow/kpToolBrush.cpp delete mode 100644 kolourpaint/tools/flow/kpToolBrush.h delete mode 100644 kolourpaint/tools/flow/kpToolColorEraser.cpp delete mode 100644 kolourpaint/tools/flow/kpToolColorEraser.h delete mode 100644 kolourpaint/tools/flow/kpToolEraser.cpp delete mode 100644 kolourpaint/tools/flow/kpToolEraser.h delete mode 100644 kolourpaint/tools/flow/kpToolFlowBase.cpp delete mode 100644 kolourpaint/tools/flow/kpToolFlowBase.h delete mode 100644 kolourpaint/tools/flow/kpToolFlowPixmapBase.cpp delete mode 100644 kolourpaint/tools/flow/kpToolFlowPixmapBase.h delete mode 100644 kolourpaint/tools/flow/kpToolPen.cpp delete mode 100644 kolourpaint/tools/flow/kpToolPen.h delete mode 100644 kolourpaint/tools/flow/kpToolSpraycan.cpp delete mode 100644 kolourpaint/tools/flow/kpToolSpraycan.h delete mode 100644 kolourpaint/tools/kpTool.cpp delete mode 100644 kolourpaint/tools/kpTool.h delete mode 100644 kolourpaint/tools/kpToolAction.cpp delete mode 100644 kolourpaint/tools/kpToolAction.h delete mode 100644 kolourpaint/tools/kpToolColorPicker.cpp delete mode 100644 kolourpaint/tools/kpToolColorPicker.h delete mode 100644 kolourpaint/tools/kpToolFloodFill.cpp delete mode 100644 kolourpaint/tools/kpToolFloodFill.h delete mode 100644 kolourpaint/tools/kpToolPrivate.h delete mode 100644 kolourpaint/tools/kpToolZoom.cpp delete mode 100644 kolourpaint/tools/kpToolZoom.h delete mode 100644 kolourpaint/tools/kpTool_Drawing.cpp delete mode 100644 kolourpaint/tools/kpTool_KeyboardEvents.cpp delete mode 100644 kolourpaint/tools/kpTool_MouseEvents.cpp delete mode 100644 kolourpaint/tools/kpTool_OtherEvents.cpp delete mode 100644 kolourpaint/tools/kpTool_UserNotifications.cpp delete mode 100644 kolourpaint/tools/kpTool_Utilities.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolCurve.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolCurve.h delete mode 100644 kolourpaint/tools/polygonal/kpToolLine.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolLine.h delete mode 100644 kolourpaint/tools/polygonal/kpToolPolygon.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolPolygon.h delete mode 100644 kolourpaint/tools/polygonal/kpToolPolygonalBase.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolPolygonalBase.h delete mode 100644 kolourpaint/tools/polygonal/kpToolPolyline.cpp delete mode 100644 kolourpaint/tools/polygonal/kpToolPolyline.h delete mode 100644 kolourpaint/tools/rectangular/kpToolEllipse.cpp delete mode 100644 kolourpaint/tools/rectangular/kpToolEllipse.h delete mode 100644 kolourpaint/tools/rectangular/kpToolRectangle.cpp delete mode 100644 kolourpaint/tools/rectangular/kpToolRectangle.h delete mode 100644 kolourpaint/tools/rectangular/kpToolRectangularBase.cpp delete mode 100644 kolourpaint/tools/rectangular/kpToolRectangularBase.h delete mode 100644 kolourpaint/tools/rectangular/kpToolRoundedRectangle.cpp delete mode 100644 kolourpaint/tools/rectangular/kpToolRoundedRectangle.h delete mode 100644 kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.cpp delete mode 100644 kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.h delete mode 100644 kolourpaint/tools/selection/image/kpAbstractImageSelectionTool_Transparency.cpp delete mode 100644 kolourpaint/tools/selection/image/kpToolEllipticalSelection.cpp delete mode 100644 kolourpaint/tools/selection/image/kpToolEllipticalSelection.h delete mode 100644 kolourpaint/tools/selection/image/kpToolFreeFormSelection.cpp delete mode 100644 kolourpaint/tools/selection/image/kpToolFreeFormSelection.h delete mode 100644 kolourpaint/tools/selection/image/kpToolRectSelection.cpp delete mode 100644 kolourpaint/tools/selection/image/kpToolRectSelection.h delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool.cpp delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool.h delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionToolPrivate.h delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool_Create.cpp delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool_KeyboardEvents.cpp delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool_Move.cpp delete mode 100644 kolourpaint/tools/selection/kpAbstractSelectionTool_ResizeScale.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText.h delete mode 100644 kolourpaint/tools/selection/text/kpToolTextPrivate.h delete mode 100644 kolourpaint/tools/selection/text/kpToolText_Commands.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_Create.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_CursorCalc.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_InputMethodEvents.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_KeyboardEvents.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleTypingKeys.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_Move.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_ResizeScale.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_SelectText.cpp delete mode 100644 kolourpaint/tools/selection/text/kpToolText_TextStyle.cpp delete mode 100644 kolourpaint/views/kpThumbnailView.cpp delete mode 100644 kolourpaint/views/kpThumbnailView.h delete mode 100644 kolourpaint/views/kpUnzoomedThumbnailView.cpp delete mode 100644 kolourpaint/views/kpUnzoomedThumbnailView.h delete mode 100644 kolourpaint/views/kpView.cpp delete mode 100644 kolourpaint/views/kpView.h delete mode 100644 kolourpaint/views/kpViewPrivate.h delete mode 100644 kolourpaint/views/kpView_Events.cpp delete mode 100644 kolourpaint/views/kpView_Paint.cpp delete mode 100644 kolourpaint/views/kpView_Selections.cpp delete mode 100644 kolourpaint/views/kpZoomedThumbnailView.cpp delete mode 100644 kolourpaint/views/kpZoomedThumbnailView.h delete mode 100644 kolourpaint/views/kpZoomedView.cpp delete mode 100644 kolourpaint/views/kpZoomedView.h delete mode 100644 kolourpaint/views/manager/kpViewManager.cpp delete mode 100644 kolourpaint/views/manager/kpViewManager.h delete mode 100644 kolourpaint/views/manager/kpViewManagerPrivate.h delete mode 100644 kolourpaint/views/manager/kpViewManager_TextCursor.cpp delete mode 100644 kolourpaint/views/manager/kpViewManager_ViewUpdates.cpp delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.h delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.cpp delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.h delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.cpp delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.h delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.cpp delete mode 100644 kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.h delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.cpp delete mode 100644 kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.h delete mode 100644 kolourpaint/widgets/kpColorCells.cpp delete mode 100644 kolourpaint/widgets/kpColorCells.h delete mode 100644 kolourpaint/widgets/kpColorPalette.cpp delete mode 100644 kolourpaint/widgets/kpColorPalette.h delete mode 100644 kolourpaint/widgets/kpDefaultColorCollection.cpp delete mode 100644 kolourpaint/widgets/kpDefaultColorCollection.h delete mode 100644 kolourpaint/widgets/kpDocumentSaveOptionsWidget.cpp delete mode 100644 kolourpaint/widgets/kpDocumentSaveOptionsWidget.h delete mode 100644 kolourpaint/widgets/kpDualColorButton.cpp delete mode 100644 kolourpaint/widgets/kpDualColorButton.h delete mode 100644 kolourpaint/widgets/kpPrintDialogPage.cpp delete mode 100644 kolourpaint/widgets/kpPrintDialogPage.h delete mode 100644 kolourpaint/widgets/kpTransparentColorCell.cpp delete mode 100644 kolourpaint/widgets/kpTransparentColorCell.h delete mode 100644 kolourpaint/widgets/toolbars/kpColorToolBar.cpp delete mode 100644 kolourpaint/widgets/toolbars/kpColorToolBar.h delete mode 100644 kolourpaint/widgets/toolbars/kpToolToolBar.cpp delete mode 100644 kolourpaint/widgets/toolbars/kpToolToolBar.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetBase.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetBase.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.h delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.cpp delete mode 100644 kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 22685446..9aeb1418 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,6 @@ macro_optional_add_subdirectory(kfloppy) macro_optional_add_subdirectory(kget) macro_optional_add_subdirectory(kgpg) macro_optional_add_subdirectory(kmix) -macro_optional_add_subdirectory(kolourpaint) macro_optional_add_subdirectory(kompare) macro_optional_add_subdirectory(krdc) macro_optional_add_subdirectory(krfb) diff --git a/ark/kerfuffle/CMakeLists.txt b/ark/kerfuffle/CMakeLists.txt index 470e238b..c1cd90ed 100644 --- a/ark/kerfuffle/CMakeLists.txt +++ b/ark/kerfuffle/CMakeLists.txt @@ -1,6 +1,3 @@ -macro_optional_find_package(QJSON) -macro_log_feature(QJSON_FOUND "qjson" "A library for processing and serializing JSON files" "http://qjson.sourceforge.net" FALSE "" "Required for compiling Ark's unit tests") - ########### next target ############### set(kerfuffle_SRCS @@ -20,31 +17,25 @@ kde4_add_kcfg_files(kerfuffle_SRCS settings.kcfgc) add_library(kerfuffle SHARED ${kerfuffle_SRCS}) -target_link_libraries(kerfuffle ${KDE4_KFILE_LIBS} ${KDE4_KPARTS_LIBS}) -if (NOT WIN32) - target_link_libraries(kerfuffle ${KDE4_KPTY_LIBS}) -endif (NOT WIN32) +target_link_libraries(kerfuffle + ${KDE4_KFILE_LIBS} + ${KDE4_KPARTS_LIBS} + ${KDE4_KPTY_LIBS} +) set_target_properties(kerfuffle PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) install(TARGETS kerfuffle ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES kerfufflePlugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) -install(FILES ark.kcfg DESTINATION ${KCFG_INSTALL_DIR}) +install( + FILES kerfufflePlugin.desktop + DESTINATION ${SERVICETYPES_INSTALL_DIR} +) +install( + FILES ark.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) -if (QJSON_FOUND AND ENABLE_TESTING) - # This is a hack to make QJSON work with both 0.7.1 (the latest stable) - # and the current master (b440550), which uses a different casing for - # the CMake variables. - # It should be removed when QJSON master becomes sane and reverts the - # casing again. - if (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR) - set(KERFUFFLE_QJSON_LIBRARIES "${QJSON_LIBRARIES}") - set(KERFUFFLE_QJSON_INCLUDE_DIR "${QJSON_INCLUDE_DIR}") - else (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR) - set(KERFUFFLE_QJSON_LIBRARIES "${qjson_LIBRARIES}") - set(KERFUFFLE_QJSON_INCLUDE_DIR "${qjson_INCLUDE_DIR}") - endif (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR) - - add_subdirectory(tests) +if (ENABLE_TESTING) + add_subdirectory(tests) endif () diff --git a/ark/kerfuffle/tests/CMakeLists.txt b/ark/kerfuffle/tests/CMakeLists.txt index f7dc50dc..798bdf68 100644 --- a/ark/kerfuffle/tests/CMakeLists.txt +++ b/ark/kerfuffle/tests/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${KERFUFFLE_QJSON_INCLUDE_DIR}) - set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(JSONINTERFACE_SOURCES @@ -16,7 +14,6 @@ macro(KERFUFFLE_UNIT_TESTS) kerfuffle ${KDE4_KDEUI_LIBS} ${QT_QTTEST_LIBRARY} - ${KERFUFFLE_QJSON_LIBRARIES} ) endforeach(_testname) endmacro(KERFUFFLE_UNIT_TESTS) diff --git a/kdeplasma-addons/CMakeLists.txt b/kdeplasma-addons/CMakeLists.txt index e425c916..24fcc9b1 100644 --- a/kdeplasma-addons/CMakeLists.txt +++ b/kdeplasma-addons/CMakeLists.txt @@ -15,9 +15,6 @@ macro_log_feature(KDE4WORKSPACE_FOUND "kdebase workspace" "KDE base workspace li macro_optional_find_package(QCA2) macro_log_feature(QCA2_FOUND "QCA2" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0.0" "Needed for building microblog dataengine") -macro_optional_find_package(KdepimLibs) -macro_log_feature(KDEPIMLIBS_FOUND "kdepimlibs" "KDE PIM libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma plugins") - set(LIBATTICA_MIN_VERSION "0.1.1") macro_optional_find_package(LibAttica) macro_log_feature(LIBATTICA_FOUND "libattica" "Attica Library" "http://websvn.kde.org/trunk/kdesupport/attica/" FALSE "" "Needed for building the Open Collaboration Services plasma dataengine and applets") @@ -25,24 +22,18 @@ macro_log_feature(LIBATTICA_FOUND "libattica" "Attica Library" "http://websvn.kd macro_optional_find_package(OpenGL) macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3D graphics applications" "http://mesa3d.sourceforge.net" FALSE "" "STRONGLY RECOMMENDED: The 3D hardware acceleration available through the OpenGL API is used in applications ranging from graphics and modellers to screensavers and video players.") -macro_optional_find_package(QJSON) -macro_log_feature(QJSON_FOUND "QJSon" "Used for various Internet runners, for parsing API responses, and the microblog dataengine" "" FALSE "" "") - -macro_optional_find_package(QtOAuth) -macro_log_feature(QTOAUTH_FOUND "QtOAuth" "QtOAuth Library - required to build the Plasma Microblog DataEngine" "https://github.com/ayoy/qoauth" FALSE "" "Needed for building Plasma Microblog DataEngine") - macro_optional_find_package(Marble) macro_log_feature(MARBLE_FOUND "Marble" "Desktop Globe" "http://marble.kde.org" FALSE "" "RECOMMENDED: Marble is used to provide a desktop globe wallpaper for Plasma.") macro_optional_find_package(DBusMenuQt) macro_log_feature(DBUSMENUQT_FOUND "DBusMenuQt" "DBusMenu Qt" "https://launchpad.net/libdbusmenu-qt/" FALSE "" "Needed for Unity support in IconTasks.") -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) -include_directories (${KDE4_INCLUDES} - ${KDE4WORKSPACE_INCLUDE_DIR} - ${KDEPIMLIBS_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/libs) +add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +include_directories( + ${KDE4_INCLUDES} + ${KDE4WORKSPACE_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/libs +) add_subdirectory(libs) add_subdirectory(applets) diff --git a/kdeplasma-addons/applets/CMakeLists.txt b/kdeplasma-addons/applets/CMakeLists.txt index 9834f2bf..636fe1b7 100644 --- a/kdeplasma-addons/applets/CMakeLists.txt +++ b/kdeplasma-addons/applets/CMakeLists.txt @@ -19,12 +19,10 @@ add_subdirectory(fifteenPuzzle) add_subdirectory(fileWatcher) add_subdirectory(frame) add_subdirectory(kolourpicker) -add_subdirectory(konqprofiles) add_subdirectory(konsoleprofiles) add_subdirectory(life) add_subdirectory(luna) add_subdirectory(magnifique) -add_subdirectory(microblog) add_subdirectory(notes) add_subdirectory(nowplaying) if(LIBATTICA_FOUND) @@ -44,13 +42,7 @@ add_subdirectory(eyes) add_subdirectory(unitconverter) add_subdirectory(weatherstation) -if(QT_QTWEBKIT_FOUND) - add_subdirectory(dict) - add_subdirectory(news) - add_subdirectory(webslice) - # this one needs kdewebkit actually - add_subdirectory(rememberthemilk) -endif(QT_QTWEBKIT_FOUND) +add_subdirectory(dict) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/qalculate/cmake_modules) macro_optional_find_package(Qalculate) @@ -59,12 +51,6 @@ if ( QALCULATE_FOUND ) add_subdirectory(qalculate) endif( QALCULATE_FOUND ) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/kdeobservatory/cmake/modules) -macro_optional_find_package(Qwt) -if ( Qwt5-Qt4_FOUND ) - add_subdirectory(kdeobservatory) -endif( Qwt5-Qt4_FOUND ) - if(KDE4WORKSPACE_FOUND) add_subdirectory(lancelot) endif(KDE4WORKSPACE_FOUND) diff --git a/kdeplasma-addons/applets/dict/CMakeLists.txt b/kdeplasma-addons/applets/dict/CMakeLists.txt index 7a509b94..8a1d373c 100644 --- a/kdeplasma-addons/applets/dict/CMakeLists.txt +++ b/kdeplasma-addons/applets/dict/CMakeLists.txt @@ -1,16 +1,22 @@ project(plasma-dict) -INCLUDE_DIRECTORIES( - ${QT_QTWEBKIT_INCLUDE_DIR}) - set(dict_SRCS - dict.cpp) - -kde4_add_plugin(plasma_applet_dict ${dict_SRCS}) -target_link_libraries(plasma_applet_dict ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} + dict.cpp ) -install(TARGETS plasma_applet_dict DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-dict-default.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +kde4_add_plugin(plasma_applet_dict ${dict_SRCS}) +target_link_libraries(plasma_applet_dict + ${KDE4_PLASMA_LIBS} + ${KDE4_KDEUI_LIBS} +) + +install( + TARGETS plasma_applet_dict + DESTINATION ${PLUGIN_INSTALL_DIR} +) +install( + FILES plasma-dict-default.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/kdeplasma-addons/applets/kdeobservatory/CMakeLists.txt b/kdeplasma-addons/applets/kdeobservatory/CMakeLists.txt deleted file mode 100644 index b3ce7014..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -project(plasma-kdeobservatory) - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - find_package(KDE4 4.18.0 REQUIRED) - include(KDE4Defaults) - include_directories(${KDE4_INCLUDES}) - add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) - -find_package(Qwt REQUIRED) - -include(KDE4Defaults) - -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -include_directories( - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} - ${Qwt5_INCLUDE_DIR} -) - -set(kdeobservatory_SRCS - src/iviewprovider.cpp - src/kdeobservatory.cpp - src/krazyreportview.cpp - src/topdevelopersview.cpp - src/commithistoryview.cpp - src/topactiveprojectsview.cpp - src/kdeobservatoryconfigviews.cpp - src/kdeobservatoryconfiggeneral.cpp - src/kdeobservatoryconfigprojects.cpp -) - -kde4_add_ui_files(kdeobservatory_SRCS - src/ui/kdeobservatoryconfigviews.ui - src/ui/kdeobservatoryconfiggeneral.ui - src/ui/kdeobservatoryconfigproject.ui - src/ui/kdeobservatoryconfigprojects.ui -) - -kde4_add_plugin(plasma_applet_kdeobservatory ${kdeobservatory_SRCS}) -target_link_libraries(plasma_applet_kdeobservatory - ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTSQL_LIBRARY} ${Qwt5-Qt4_LIBRARY}) - -install(TARGETS plasma_applet_kdeobservatory - DESTINATION ${PLUGIN_INSTALL_DIR}) - -install(FILES plasma-applet-kdeobservatory.desktop - DESTINATION ${SERVICES_INSTALL_DIR}) - -add_subdirectory(icons) diff --git a/kdeplasma-addons/applets/kdeobservatory/cmake/modules/FindQwt.cmake b/kdeplasma-addons/applets/kdeobservatory/cmake/modules/FindQwt.cmake deleted file mode 100644 index 883efbe4..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/cmake/modules/FindQwt.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4 -# -# On Windows it makes these assumptions: -# - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path -# - the Qwt .h files are in QT_DIR\include\Qwt or in the path -# - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path -# -# Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt -# Qwt5-Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists) -# Qwt5-Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists) -# Qwt5-Qt4_FOUND - Qwt5 was found and uses Qt4 -# Qwt5-Qt3_FOUND - Qwt5 was found and uses Qt3 -# Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4) - -# Copyright (c) 2007, Pau Garcia i Quiles, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# Condition is "(A OR B) AND C", CMake does not support parentheses but it evaluates left to right -IF(Qwt5-Qt4_LIBRARY OR Qwt5-Qt3_LIBRARY AND Qwt5_INCLUDE_DIR) - SET(Qwt5_FIND_QUIETLY TRUE) -ENDIF(Qwt5-Qt4_LIBRARY OR Qwt5-Qt3_LIBRARY AND Qwt5_INCLUDE_DIR) - -IF( WITH_KATIE ) - FIND_PACKAGE( Katie ) -ENDIF() -IF( NOT KATIE_FOUND) - FIND_PACKAGE( Qt4 REQUIRED QUIET ) -ENDIF() - -IF( QT4_FOUND ) - # Is Qwt5 installed? Look for header files - FIND_PATH( Qwt5_INCLUDE_DIR qwt_event_pattern.h PATHS ${QT_INCLUDE_DIR} PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH) - - # Find Qwt version - IF( Qwt5_INCLUDE_DIR ) - FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H ) - STRING( REGEX MATCH "#define *QWT_VERSION *(0x05)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H}) - - IF( QWT_IS_VERSION_5 ) - STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}") - - # Find Qwt5 library linked to Qt4 - FIND_LIBRARY( Qwt5-Qt4_TENTATIVE_LIBRARY NAMES qwt5-qt4 qwt-qt4 qwt5 qwt ) - IF( UNIX AND NOT CYGWIN) - IF( Qwt5-Qt4_TENTATIVE_LIBRARY ) - #MESSAGE("Qwt5-Qt4_TENTATIVE_LIBRARY = ${Qwt5-Qt4_TENTATIVE_LIBRARY}") - EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5-Qt4_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt4_LIBRARIES_LINKED_TO ) - STRING( REGEX MATCH "QtCore" Qwt5_IS_LINKED_TO_Qt4 ${Qwt-Qt4_LIBRARIES_LINKED_TO}) - IF( Qwt5_IS_LINKED_TO_Qt4 ) - SET( Qwt5-Qt4_LIBRARY ${Qwt5-Qt4_TENTATIVE_LIBRARY} ) - SET( Qwt5-Qt4_FOUND TRUE ) - IF (NOT Qwt5_FIND_QUIETLY) - MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" ) - ENDIF (NOT Qwt5_FIND_QUIETLY) - ENDIF( Qwt5_IS_LINKED_TO_Qt4 ) - ENDIF( Qwt5-Qt4_TENTATIVE_LIBRARY ) - ELSE( UNIX AND NOT CYGWIN) - # Assumes qwt.dll is in the Qt dir - SET( Qwt5-Qt4_LIBRARY ${Qwt5-Qt4_TENTATIVE_LIBRARY} ) - SET( Qwt5-Qt4_FOUND TRUE ) - IF (NOT Qwt5_FIND_QUIETLY) - MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" ) - ENDIF (NOT Qwt5_FIND_QUIETLY) - ENDIF( UNIX AND NOT CYGWIN) - - - # Find Qwt5 library linked to Qt3 - FIND_LIBRARY( Qwt5-Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 ) - IF( UNIX AND NOT CYGWIN) - IF( Qwt5-Qt3_TENTATIVE_LIBRARY ) - #MESSAGE("Qwt5-Qt3_TENTATIVE_LIBRARY = ${Qwt5-Qt3_TENTATIVE_LIBRARY}") - EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5-Qt3_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt3_LIBRARIES_LINKED_TO ) - STRING( REGEX MATCH "qt-mt" Qwt5_IS_LINKED_TO_Qt3 ${Qwt-Qt3_LIBRARIES_LINKED_TO}) - IF( Qwt5_IS_LINKED_TO_Qt3 ) - SET( Qwt5-Qt3_LIBRARY ${Qwt5-Qt3_TENTATIVE_LIBRARY} ) - SET( Qwt5-Qt3_FOUND TRUE ) - IF (NOT Qwt5_FIND_QUIETLY) - MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" ) - ENDIF (NOT Qwt5_FIND_QUIETLY) - ENDIF( Qwt5_IS_LINKED_TO_Qt3 ) - ENDIF( Qwt5-Qt3_TENTATIVE_LIBRARY ) - ELSE( UNIX AND NOT CYGWIN) - SET( Qwt5-Qt3_LIBRARY ${Qwt5-Qt3_TENTATIVE_LIBRARY} ) - SET( Qwt5-Qt3_FOUND TRUE ) - IF (NOT Qwt5_FIND_QUIETLY) - MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" ) - ENDIF (NOT Qwt5_FIND_QUIETLY) - ENDIF( UNIX AND NOT CYGWIN) - - ENDIF( QWT_IS_VERSION_5 ) - - IF( Qwt5-Qt4_FOUND OR Qwt5-Qt3_FOUND ) - SET( Qwt5_FOUND TRUE ) - ENDIF( Qwt5-Qt4_FOUND OR Qwt5-Qt3_FOUND ) - - MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5-Qt4_LIBRARY Qwt5-Qt3_LIBRARY ) - ENDIF( Qwt5_INCLUDE_DIR ) - - IF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find Qwt 5.x") - ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED) - -ENDIF( QT4_FOUND ) \ No newline at end of file diff --git a/kdeplasma-addons/applets/kdeobservatory/icons/CMakeLists.txt b/kdeplasma-addons/applets/kdeobservatory/icons/CMakeLists.txt deleted file mode 100644 index 02e3c9ec..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/icons/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/kdeplasma-addons/applets/kdeobservatory/icons/hi128-app-kdeobservatory.png b/kdeplasma-addons/applets/kdeobservatory/icons/hi128-app-kdeobservatory.png deleted file mode 100644 index 681dd48068e333f1f95b55457dc809f47cec9fe3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17648 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 diff --git a/kdeplasma-addons/applets/kdeobservatory/icons/hi22-app-kdeobservatory.png b/kdeplasma-addons/applets/kdeobservatory/icons/hi22-app-kdeobservatory.png deleted file mode 100644 index 682d2643bf56f8f11371cabbdd1b42d733699db8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1300 zcmV+v1?&2WP)M-i1I6|rJo)J6~^^xfLxV+qARvSWP18U)xO(jx&Yz#a;++M=;|6lMEKZ;P6q(EtCMGW28X0+S598?n z0iFKkOhFL4#{d-}>brkbi++EJF zRF&S|Cj|owPJx-NWaf~~E~36638yXz%W2@aa8<>5urY&g;mBKuQ7Eh-fA1z%%Pwc5 ziY}?Sm~jnQklZ0nE~4iav9?u&xnV|(4IP0WLU|A{cb*V{E=@?g9xZJ;aiN>%9H!~KmlWLK7P_n#Zs za!aVAixRxdiKSc>6wv+#`)oAu&-r)8S}e7qXLWr3`Df-_ zzH|A<0{;gcKYqN~%qG8YCXH_@0tMd-EC?uyrd5>?vq2b~nXAqm`ux*h`V@~zkLAGN zsXy;(YHt2@Hk0i(5{6Jzm8=T3jWAN;2R?kyg%<>H?ArWHY340mm~U?0ytxa&%fy$7 z|3n-wx}O{^f88p&Ym3}KDP@%6%ncUFEn)egO{3G+fNnR3hk+s1q2}sBPD$f ziH)Q|5&IBAK{A=d`27id^2rF^eeZn?ojOfUsd)3y&$NRFf1vdDZ@{{B{pjvqw!Bd2 zTzmff`FH*&0)wZIf2*Ul@Vlm_W}&JoMJdR*A)`!NY1Hf*tW+BFl{s9yK8l~e^$T3N zdczHg^v6cj9?Q)dQuwKli> zmW>B~08Q1Umm23?2&qU>RH($7qM^5E74DB0F>>{)bkO&G*tU(Qp4v*XinrfBjH#)I z6hw$@HqU!(vmHc>9iSWyrL9!zom@7rc%Fv@L2ElTBn^XJbO;3#Hb-w-P*p|3pUGtK z@++^z^+A!Z#M5E&V{ihcX`()EYf zvEv!+-u)bQ@7ZIMj)31~5_BO~Cr+G5HMM7_TAErCY=PP>G8n+5;&U7umX%=yD7RUL zTb84$X(*S=_{r;U;KOt0aQpUcOiWB5B0@2N7r*{B95}EaPb}?(=Q?=saN>n$c0BiP zV+w?B;2Wl4B)G*8gtE^adN`pcIY_R289gl#P@XwO5Q;21rUU!Gi;EX8#>OQ&eSLj+ z^+&JbjYF@aqq6|{Ht9_m=4*{LAehaR`J$%j07A(UYGVEc48KHM?n|Sd=ScXuPy<3~ z<;oT4rTlAzNFtHo*&v_&=g0q&QfiHyP3nmaiycs?pw`kKg4QQk^(gAPQQNf{YIZ~# z_rtmjSTg&*96T@W-OKGNo#6K6)XdG5Bw8w^(Ig;MvZS+v=Klazt?I$R zzyP*x-Hg`Oc2vqUn4TWT_?;`L&dZ++P>q< zKU_e7+E6MZAr&~aIXtM8QJU5%9U8K^X6Q+iXCHJ;tEVUM*aZ6V#P!cGjilU*?rHUX z!S`t$y~A?(%5_+?{%La7!kU5YI4qnDLx4M*M^#JLL>Q7V<=w;zqB;j&zs#Dn{{Dc{$) zV@Qr5mC9n>rk(PPfryJxuQh& zKO;GIyRUycL0;y;L~>4|bLHY0+TVue)+LyFa2Hrq0|9e1c^l@w)Eq08d-IhlRlGx7 ztIzg80vJzA$u~YdPlldACf9;Hw=QG8Jc|`iZotg+1SZDsKvTsdcrQ305Hg7%KDQN+ z0U?jt#l!<8kPdhfFL_Ld^(kpn@u{kgp59HU(8TLn(U0pR7m%{Ds8bx2Ki-Id*VOT3 zP?{>LF2TnNg+xKf^Kb0Ia7=X*S2<8Fw)pcUzCK$0>E)5`HbCUO>}GtHsr`!(08{>^dy-@Bf3thaYy zk`ds;$N-?SGck{ijdg~?e?f%G^Lj$-pPZahM@B|4@o*Bev$I&gW+mF&^89H9utBKu z0Mqm&5($&1ANRiJ*wuT1@16~yzt`GY_)9*Yw|Y$BT>t<807*qoM6N<$f?YdmEdT%j diff --git a/kdeplasma-addons/applets/kdeobservatory/icons/hi48-app-kdeobservatory.png b/kdeplasma-addons/applets/kdeobservatory/icons/hi48-app-kdeobservatory.png deleted file mode 100644 index 086b97dd2370df25757c354c8df40c28e86e3a4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4083 zcmVlxt}vLedhh<%N&o^mZPG6 z-`EB|r*`DXk+>DNAB{%h&%`3p?GDiEICcUCtcV$@0A|@Ror}$e z`-amj|I7aU2PW}3wEq)`g2u#ci%Z%E&?9V8P;EG{mh ztu2jGsf0*`R^VZIWNI~-h6&eoVB1ahfWza&@sBS4@cTdLd*X?M8SmNezyEXm;ujw_ z=H?3Dn3$OO2Q1Sp++ln7-M7~BCC7SK^!;XMuFLY=A|6ko*{ma#ZbP|TMti0m#ZpOn zHePEWK_WE*PN&n}JutNd*olhZdaGcyNT5|dMt_}!;}FaOFbFU1E2)?(GF)!4mz z7w)-dyOqo350=Z7%afCnClP89+(CQqy(5pOGMWGE?(Rt>2pR?iNU>N%Hk+eAHxZA; zVNk248KH>F@ScQ>=?)ZAEOPezMU0G$;**a*MzvCrczEfh7x1k=`7?BNbt99>de7vz z7nMqx*Ij(!3$C$l-O%5@{PN3(mzI`he=Pz(`RUtVZ_Bm+TUTe7N${f8G&No+m62)7 z2)J6U%9nP4S;zBvagRo$DVCUF+c?vbi<_g{N%oU`(AqU%{Tw_jtRW;-jRnh+04Iou=ie6B&l3`PJ)&?m-GBB&Yd}nzxnIGLbzSJbP0t*0bl&$ zeb~8kCsXl%(c150!-fq4J{F5HMrrYG1~clCp$4d@?4*5KBZj|H_k3U~tVEgc^Y*v17*$3=XbkkXtx;@+97P z;|NZjIzdBhdPfABsC^@wZQsH`6>U=E)IthuqVcppc5GL!!zV(xs#g=$t0A6y_F44O z-@VpOH>Ar5iP6zfFFoV6*S?S5-fled$Ue-^FW~v-U&O1gzABlkQmHVVeq`6{_3zv^ zjq24k9*?}0ZflEqes2g+8!^c;1{(D`NKD3Mx)lRjG~Q$YJFdfQln}(Vs!EkqsJLH$ z|0X$h@SFm# z`e3X{%KWQLsf-N)&EHFn#9jiGL5jKAIn2(^LLO;YVmVj4FIy}ceIQIgz=JKCh(5}P z`GuCNZO2}Z1MlJL%T+h-0~7FpgozlS4>!ajTQ+aPZn_dzYys~Rk)CCO=jZtJ(=*DN zJPd^%y770NN00s}2TeeOXESJ?yCoGGenQljIA;kVdD(?%TS^7SicikbX4Ws3-|Det zaO!I^618yeZ`>=O!@}B17OZ0obQlV_KC}g*u?Vrm*Mwb2kaFkL&5;n$Km`N=GFyn& zTwmMzydxrahuucSLW@OQnY-AzYbX6YBcSQmnt*2knGatW)>@~MJixXlpbExFWJfCj zLkpV)rAPj#DGwE(6x{@b%yrP}V1))R^QO~~vCN@eOp#qPu$qh7iU7PXTx}(Bl$MH; zmic_Kh)n_p58YyMGb^4G%0dQTEY8D=!kX-LECf9iMNLc}3~HI{fHe&(@M9PR=ICsX z{#7f{)zd98KoKIoNHANbfw61X;Ue$=7|X839UfWvJcMTSAng6E%#9b0tN=xXz(|Ypyg$LjjOb)75A$sg;<=r=#^R6g;+Tn zt5>Zo zWS`8HR+SLDc3}Pb^(^$ZVB7ZX$am)D85NcjH>So&be77UhSRJek?FY+wty+(*TGJs zim7You`qWH*^U+H$gh+K5`dJqj@uNVH4-w-C|5^|kO0j`NGL*@swzdAHZ9uVz{LPF z(TgvB6TJ*(0+)R-n^<6Jv4F|z!zeDzq0B9CrCLFp`QHsPK9;or^``!&z>9CYj>Wk# zEETT9h-Tz!4#G>>_=g87*-uBHh_e1coa z4wfG&sa#Ehi?Ot@R8H3}=KFO+q}nLc4eBh>OK|Nf-KWYNUlpR3-qfjrQN$I;aAfS~ z(bgt+FK+=6Xz;R0Z`~?_E>xj;jb>Tj&qb&%!ET!3P6X#|eBywk0+ShtMAh0*;UblY z$3(-XXC3*=SDNGK_iF8n$R9VTUNwn;Kwuel7;Yui143h*~_lP5UiR+hzt-SrY)m2=@Zi6DC}hpxh`W(RHUbGkf5_H zUFza4aVCUS{TmUX3(ZV>xxWBFqigk@mMs86x45CL9<=WVWMm$=m6}6=4|Jge90|LER`#!#@$Aev7px_w=N$T21+a0xaFZJYA%r0d=yUqMV66Jq^}+80G67g^ z5krg21LDEBN#DM9^(-3o8b*gt2>~`PVzUzH{exRcaD(=2>05DzEr2i)L#?Kv3yRJU ze)JO*3X53L%T;t}5JN-#K6p(MnzXh@a1DVXSi0~z6L9PXG=WNK5fj%(v0?MQSTnR! zNMAVjKM0bl@#}qF53`rx8XL!_XD-M%5sxF4Omc-zVcpWSdQ zWhTc*6H9iKX@`46NNICHB(7EP%NXj$j&TnYi>#+5afq z8ob`Ta75w7+Z#+)Rzpt$Lhj81iguZN_bTM`D_9eiS#Egc`#dh5J&s> zcGv<+tW+7zg|v2=V2|qrAZ|k-0J!`ZN>mpl2?p&5#x9@1+M(^p=6Z1c%yHBz1-j2= zc{kjUA2f>pu7@`f=pWpYEH2HUaN{a(s`#Hx44Cq<)>U%{w``7Fx7FCTMO*}5>}>Cv zY%%?79G^e^-%<#gCNMcMB8wm6f!tawrohYIBgt~!jHb2&_+i)rPHAcWL{Cruo_zi; zb8`GLN=uXSGPUPb0$H1GL&9!~W=VvAn<}z+PH+BQ>1{L0q-an?Gsv)9ei!Zh4U zL0)Kt!YSlKqGba@K(x#z=M+c_fXnla0yrY}~|3ps1}((wHeEAlng`VTYDcY|$VVZpsPGHhJFauwGnCNVQJ zBmXRvNha|7&m54-v&tGik&J^AYFa+Lf(nsB&9owj#!~_`ozD1W2v8~&?M9<|&9>d+ zgmE;J$^N*vw|7YZD{*wM74H#<1q1>jVc~bn)Q#Dx$N4`|_RbaN4s>>QWy1@X+Cnzv ztDf5A7$A8m=EC>!3x`doSfm?`!ZDB0R-g2A<$jjQx8FWcIh8c;&_Ua#>)K*XgK&S}kZ&|P>Rh~}ZVWVSQq!R;nM}Qv z$=LRVi^50OuV0^pFF1W+1nhfvpWhX8-smtKf8}<%*6DWL?{#~@;c#&Fdc4rw+zd{` zfbxoRKw=QwwsRszaZeiYcFm!4C8w~uW!4{ zaN9iyRD%ro{6#Q1IgY@65Rb?3I)DT;!NSNw=;-Kxs;Wu^twSbbLNb+tR5}GVU57+6 z3D^kJ@#(Sg@#rs8vDl+qx8B$bGbbnJ#2=l2OeUkfdhq4jTyEnhp-`yS>2QI^?Ewt| zAa(@pfwA#12o{B4cw`8|#bHPzz>fA#s9hL=*47q?MCxD!?@^zr=_z_A15cSI*ljvY zO-+Ft-!ncwW)2PwznGXB|C{TsySW1Z{Fwh4^Ie!jm|HOa3+COJQ(rg%2M!*%%CPHC z27{rM!Qx^_CsPO_h^m|bo6QC;mkUNmqfitG@~=&dk3$jO9~vG6GnIkTvJ$v(;Q~Y! zE`*7Rad6n}Xd+G+9g6~KPb!rnEkHuuNa83s@g5ROWSL!EolpJK!#}v@w%fk4G!m)7 z-x-5<-~9mIdFK$CQL?GKyL%@9w0|K4y#M~Q?x}d-5ueZd-Eg=>^SHgJ+6e?,_V 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 diff --git a/kdeplasma-addons/applets/kdeobservatory/icons/hisc-app-kdeobservatory.svgz b/kdeplasma-addons/applets/kdeobservatory/icons/hisc-app-kdeobservatory.svgz deleted file mode 100644 index 48ae9958534acb3c7174bf37adb4dea0671bbc4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7453 zcmV+&9pd62iwFP!000000PUPxZyZOKpx@_L)XFa{Z1L#aFLJvFyY8960KM47PB-?k zL6ap}GcqZV^!3+op2#Azib~Ovn;MUdF3ND$mvK39ZV?$#RlonoAHI3L`EGZ0{p#}K zizfv5WV5?CyF7n&@$!o&fBEx2pX8Ix_08$U`RVJ+i`^GbE-s(^;~)Ov_y6tWWb@_K z?(}ANzWM&u&DWcMz4(vov(q=b&F{Xxxq0*a*|YDz{~liLAzWU)eD-v6ax&Gt{_f>J zY&M&z+l%Yx=VxC$*_VIw?bYj1?)>c8?)C1Q-NnuIGXi?{WGQ~O6hG_EUwyYbyZq*x z%Zuw#^WyrmgThzmFQ(FqFyG54L{;?+`5E)cRO00N$BUcOA5M;|PBN}lWkh^7-CIh& zU#aImyq+}iPGQE~!`>(DznT8Kt8fe8`tsYWv)zlS<_<1)H_!g~=Re-vJV7|WIX`IT zR{7n`x$a1_Tk6NP&M(g+Xk} z-NoG0G@xa4^X*aZ4jwnK`{B*y)y>I^SFd+-f6uC0Vv=YOA^`u;S zdqErY+hrWno7-WIcXxi!MmhiP)$aR=9_sG~nH5AmnV z%WtNU1G%EJ-M@YI!z7M4XeH}gHz!%WzynF&q4}vgo4@1cR9*3{M!&tfn)3b0>(d{1 zS4%EAEOLEu`sU>2>&vfBU++hC8x(g%dc?P0J2~T|?jL?^)=k}MsX=ObyXSDfw>@s~ z^WBT zI_3WFi@)3&rZYBu@#KV5z_jv?{@9ec0Ihr}%d2Jixa@K7f1dpBdW!VP>{GB`z53yI zC$z=s?}Vm*n4pNdJz>;w^>jbf4#=C!H%ltGeDUIXH-#NOS=jZ>kFO_Pcfph4oXeodfjqf%akkoSv-c zvc>+{&f>#6!h$7&zW(;=Sm5J(GQEyO zKmX(IyH}?-`{~~uIn8q^vV{CJwAZ_{N$Atp-=F??eIWTP(t}p*h$2-G!=R&xG67}6 ztfPn`PcSTsqlk(ERj)<9HE&T|ni^}l=U-p#UQ8)^#jD;gE%ZnqwubUAvxf3R)?ic? zrue1Scv#~2g%a085)-18*+-FB>X%8Z^pM2N%HjG^Bv$){630Uln_w2@N0Hcmpr zek{o>Z1gus-0^w(`hHd!OCwIOG+G4cH4#yPV0zurX(3|@jwNAt@WpBaFIF4qVIPYj z7W%lU<~>#l2(Cy@v^_xxA}W{dbfpo>HC=fKTIlwKXu^pmTOtLC^mw|S%a&(I1}QZ< z$i|Z{rjERVtt9q%c?N|{V%1pmFv_cuV3Bl zeu)w@)|B|6ec|J&Ff;yk6=v3dnhLY%W2O3C57{7BGQ^Dq4Lp0aS6@NUZ%Zvw{ z&XMpjRcuC)H0e=@64R$EDkWBLref?o77MJHvOOu#Af?i$M^4QIoM}WyPVEd8=AlPU z%?RQukw;E#3P#A~hfXa5S&1nhRpXKJpvKuB*QqTyTf3#EL0g05Fd=G(_6}{{dpA*l z8d-1rfLBV9AM4!`Jkj_#nFO$)OnlMsYS|a7WqVm{-CdRbx_Zx}u@VZfA>UipD_E#6 zV_GfwVx{CX&IGe6MtKj@&D(JZ5o%I0T?=qpRprz7^N+{P%*$5h0~tA)`O%zr*^w0R zu#Cwqy@1M@o_?&I(vLcwNy>xDGkP@T&AKB%6z)f{gp^Ft>_9(JP-j!@us>F%6`0?f zv@D=l#N$Yj#0bG?aimC9D3`+esG%$mhH|pkBR=gWnlnW|?IuTQREMRdXhdHX7geix zoREarmQaDv*^aX(NdTit9WTWk%v|CiPp+1Iv0ApXr$Aw$)7=q9pH7Uc4%)foq@=F1 ztbgxTx{#kw523H0Pp5ak`|Ry-?jhVe&baO8<#OjGtLKxZN4<`I|JTM9EQumpU5Zso zw)t`+3ND83hnNsZ(3G~!W94eJNf2|clC36`q!@4hG*Py)q<2wcKoPDwqJ$1uNj?c+ z2uP*6B|$JVwoMUuy5Pjdu8gv5+S5x6>7eqT7P@qFL>HlEn&{{Yow_F~Kq2G(P=$0; z3dVt{w>lBxb^VP4@FUX*6*fFH^DymaU!8t+{*@0qA3RQ7-&|e($L{&X^f`|G^?XP= z`Gnnq=@@r+_4?KHzvp_(&QGVq(yOb}9}lZ8?JkkO<_IYg9$Nyn2%f!wL@4Wy6)-Yu z$d(l<3Mp?{%GP8kxD9wn6_l!&nwgmLV43BS%{-L5oPh+XWcM7PPD!?nfGqNfdI2hG z@iq#|gSm$F7}auX31NoRayJ!AqpbyyTe=UX!ol5-Ipso*WfSJ9cdIg)TO4mM+YT%?GQ}dnPXk zlEQl?Hx?8-G&uz%Bi510o0gm8p~)!$#Z(uQFJuvWp@$|{FkvoTOn$7ab(0&dn|x&O zx2M9VzrGJpDujg4HXN#?TAedhR_>?iv{qe@zY=Xc1BP?jhLqqK?X@Y+bx5m#DJ}A@ zxh5>0e$?$!&KyV_Sr6KiuA>#abiAN17YP@-jALnVb;OG)Z{A+70eWC*?$>S3!I|5W z3=kFVC7cUz2^&3q+a;82)g^|Z*3JK!pZDKe9)Qy;E&m2b=nkh!vp+89lTROV5JC_U z&#eI!4$!QFZ`(Ev#cbAzX#@fKmc6nd;Kw%mR&% z`d&(M0$NbSL5m0`8O6#==ZEmiMa~1f3}|U|ZRl%3FGwG3;d$D>Z((;9%Ami8`mYn} z2+3Z8b{Fa?lDs`J0i_U^5$h646l<~0j~46h$S(5eu^tb`IwGJ;-8no~YkSb-9Fgfr zshbq2K*D_lm!)^O5uu?iY^tpaY*^?AloQA}IF=S?7RYkc_fnF_B%PuMEsmT>rn&Te zz`k6hT<9{IrNy;zuLrvPJ@^GkNRFpa=-+c^q@rqsZte=rSn7h;Wd`fnuEsr`zUP#1}LU)oKB=B0Z$v&(9z*Q10wfgx2&_+y8rCBp1g2wpZajdKDd(x$BPsXuD&Ya^+5~Qid`PW8BF%hhab`uXM}03P zJ1WIU>Yzmgp-2{$rSn7hQF(+jmK7WR_7%KjNTeCBpH$L+AZj)q0DTxK-L{Qq7WU;E@P9nzH}`bowG#kuv(U{yrCC50rHpkA#JqsosOUMlM;m=`iK5AQ{ z*?li>rIs9fIRO$g=AoAtplOi4ua~RYJ3o^kRlmNM69QXLe_@)Ot(QRv6H19_&L+Vb zx+M_^G#|-?D5MchsM5ygIn*-_>;CD0I*xf&YSuDyhf6Z3Nwks^5IrY^VCL*`U$)lo zhp*!pZm$&32s3@<(Zt-}_fT0Z^n*g;ksneD{lW8v0MU|p^DjzeN-+y0a!BpyX_jJ@ zI>7)U&gx@7Aqlj>#5uiLB4Wf~&T2hJEYulFl9{{Bu5Xpq)Tx4W?g!1ZnGlM{ijb?p zme3N19`y&@sp{6ulGDkCKM)tuZD}BSA zjZ!KGb1l@V&4qe^rWD)Urn3rqQ}R@kW+a)REmJz9@rs=5%8yS;`I4Y&%G)3i&eSQx zFR+tPP*u+R;3bSjgO)}3MhX-w(T9;JlC@cuQ^a73v+5Tb3>0eAs_**5nBLuIiKUHx z*xj_5GluYrll%sZ3eST<8j3GYdqCEatd#By#H zY$!D`0aV8}=R!lkMXaZirmR?+O+_u#M?Ypp-VEJYXid&lR>)w*A3doG4|D2?iY$PE>zb77s<%%_^`78HR5ijIy*k@3bSShc zG570viS(ultm)Lu$t-O!O)T34jx7lD!Ge{#&4tGNV#(Ba|282jyMEW{i%BAY~d@U4gY#t}FKOZNs+?+3nx zhJrX&=bO29AxcvWRL!{$v7nYGGTC!Y#&yMiN)s(10kRkOx(!XU^UVT@5||@&|7jxA zi4Ur&M1!HT$zZ{h(uYhIPCift`jl=K=nmy>v3x!W*_yhGm+pHp&t?-biWMPO6<_oz zDV`A0EXG3(Q;~OSSSXQ97&&i0v*|@Ls5+)>2n(`E2l5h%ffNm8uo9Qn{6bxT2)Xx` z2F)zu?mkIbW9}x@yqU3w=$e@8y8o1B*))jpX?3o0Y9-Ai83HXmhRy|SY#k6Pn6xgm zb9hK22hob!P$`sWS2mCm8Q#9oD5wmgZt}1`LaCS@bW;VyL8kY``?(zo7GahBR~u8& zyuale1t?+DRe}qaRjuq$2)|>$6vyjV+>j7?@YHl1!KA5gt+nMAy+&QABM4$v%-@X2 z99ciXHC1ZfkdqAUjUftS*?%R;Qiu0j6;CZL&=Qc$v4dx+9X6Cpa?ptap%T%WjO%;W zzHWp0heJN>gj3yuD|1q_wUDVoZY?#3-u)n9RZxbC^)o z#uyZpb!J9Wi_HYl!?qPb%-nFL^EGvHyYxprO#JODQQ7hrC~^IB6(8-eeO$giz1jT^ zw?hF)!uL+ol?_);(?9LG;8ACTW4o(=*m32rKQ}C9{Y}gd>sHB!tn%y57VC%1tI6ZV zcpZy~J@QNppZV3duZI);w7a@|FQ4k8#pz4$&#x}Oy*NLF|9<)EVx}KHyr$!aj#dvE zk9W%qA~4;zMi5$*y;XTY5fsU+=}Os^?3+b)2bZ7Dy*%IbFYZoXxIa5PTbo~&7C6n0 zr6gqF9N*@ILTB3_23K%JGpZuW!Q7mynL0AZU}9EV-&bP9^sNJOq}4#Es?;dmxw;NQ z7PC!^MsHP+rYSiQNq0)!RCbc(tcfL3DNQV((%pF*U|76VCGRt)gd2dun5BsTKbi;Rc8QZo6zR}xT4 zOy*}xPLAPW)^6$A%99XF-VhO#o7$ET(4>SWrjX{uTXH~;O4@&)*oCQWmMT&?Y>Q-V z*+?;s(VTNX)d~U?jZ~fvgvB0PMG(|fZYtp7s#|72chV8Z0YXt++khw$MQsny5eC|n z*iER~>lw@XIlEmwsA|LpTS~JI8>Ft?REbHOqJX7f&Jpo-*sy3Nci-(`~1^SfN!g0{*nCC ztCbmhz1;hLV#Fx?Q;ofq^@_ZoH?6zk2l?@O6#V)jx}JO#Q_Z*I$SBjJ6OWl?&EJiu zFyrl5(0IoD%ZZ4UB=>gD9$rsgU!R@5Wfh6UW7SlF5ToTbfmFMrG5H7(r;T~97!iG9 z0i{v8EeI|b_c7~|c<7cCP$)e2>nAkAi8_d7Ne)KoMq5gtkf3>Y+9JxfRA8B5I{NND z%cJLKb9C~SQaP-837{lK+zW5SaI(<}7Nhiptx#AwQz~btX31hM%`mb;ngtg}uldT= z-R8=A`z0&D6v3&W16rs}>M64{TGiN3?;GNdoS$fje}4FUhsUoEam;qjHP5{Nd{YT% z;^^A|W2z#Zw{qNEGCB^kvZ^Lp6QvRvj}FC>)N~xUNI%7JLb6HG-aC_=r5_bg3MmE? z53FX45^Te_GqJ3huvXUaPKUBI>vg6Xr_sF5^KjmB`@2|-_Mx3{Hu3pO!J*D=GX^22)TWZI9ZOA#+?tuQYF92Xk|yCAtIe&u zKpXL0x=27})~3p&Rr@I_(#xBgQDF^cge1*et3+0sd}yY4`)8Y<{^sL)d96pa*UF}s z7x~tJla@^{O_yefNSVW1os)TDLC7O|6NJeuw*jIOw{^u$Wb0t$aT{hnf8PisOB{8j z-*%am7MoFMay3hFQg4PzL@_ZHR4MBjBGaXg_rxTFD?0F4(YVt{7*uLWjkyiSJQM*M zl&Z(uVjiBP_qWBEotAB}Mp+j7X)O%*#}ryT=Ec$jTjTLHSW;z@2^DZqX2U94?zT^Y1EX^z?H0v4&S`};7^q2IILBUmSE0R>?+$#$Y2&4G(fAT z>&USy=(;cK#hgviOmZ)QVv=gNU|h-6bY;990V$B`##3nrDYcqXO4G=c7*vT!WiSq= znMo#UGcVMdS&>M#7740UX9*@~-fcEzVV`ILl9}6J;)H{dA#aiaDX|7&Rpim40kQUD zWO0wf!n;LHW za+;}^v2>dT!DiZ&z_E?tz)}>mo2qgSmL@anq_0wQlX%;CfTAJK>Z~-3nHqEED9NHa zGj~#&jgdw(3(=HrGr+oX(*hN2bvAY5u$dY%X0yofnwe&)HOnNrWf;8w{JB^OHub(_ zofmeDSTs|2Gw%?^LaLc%2y(kTBB#%+Og;Bcf{~*(5s;PaC!k=*nkh%JG)s+?nTcjp zvkFPvGj_{46=aGUPZS|ZY{*%FXcjY#;z7FlOuUG#8KH^H%-myyYb(J?CyEADsI*^V zvs2B~vV!*~app6_#26?vQYWOK^Mg(600m{QOJ>#ma{y_I%(Mf1FixkKnW+0<;z%|a zbGhFwehp=KS4VC8QBxw1nFa>So@wM@7N|8C3Y!n6;Z=J%nS+O4E2Ru(5T!^1x~fO_ z(^N=&rs0u;xv|I0tdeGiLOe4pYF)0;p{_!XIRM>ICnkVWwylIpWUWz|fks5n`I^ex zWUfWTL+k9EIp^X^(!o*`ZT}@-^z^0%uI3{sloSVJFs}(YII`+UG3B0Zv8IToJQAEG zA3CcZ|$fh%6#+gOs$m|NpD7c@0(&i=w%1QS$L|6wyb>Fi@@zvSu br?EQOe>may&#u3l{`da@3%47jk9`0Dl2qTD diff --git a/kdeplasma-addons/applets/kdeobservatory/plasma-applet-kdeobservatory.desktop b/kdeplasma-addons/applets/kdeobservatory/plasma-applet-kdeobservatory.desktop deleted file mode 100644 index 62c9a647..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/plasma-applet-kdeobservatory.desktop +++ /dev/null @@ -1,114 +0,0 @@ -[Desktop Entry] -Name=KDE Observatory -Name[ar]=مرقاب كدي -Name[ast]=KDE Observatory -Name[bs]=opservatorija KDE‑a -Name[ca]=Observatori KDE -Name[ca@valencia]=Observatori KDE -Name[cs]=KDE Observatory -Name[da]=KDE-observatorium -Name[de]=KDE-Observatorium -Name[el]=Παρατηρητήριο του KDE -Name[en_GB]=KDE Observatory -Name[es]=Observatorio de KDE -Name[et]=KDE ülevaataja -Name[eu]=KDE-ren behatokia -Name[fi]=KDE-observatorio -Name[fr]=Observatoire de KDE -Name[ga]=Réadlann KDE -Name[gl]=Observatorio de KDE -Name[hr]=KDE-ov opservatorij -Name[hu]=KDE obszervatórium -Name[it]=Osservatorio di KDE -Name[ja]=KDE 展望台 -Name[kk]=KDE бақылау бекеті -Name[km]=កន្លែង​សង្កេត​មើល KDE -Name[ko]=KDE 천문대 -Name[lt]=KDE observatorija -Name[lv]=KDE observatorija -Name[mr]=केडीई वेधशाळा -Name[nb]=KDE-observatorium -Name[nds]=KDE-Projektkieker -Name[nl]=KDE Sterrenwacht -Name[nn]=KDE-observatorium -Name[pa]=KDE ਖਾਗੋਲਸ਼ਾਲਾ -Name[pl]=Obserwatorium KDE -Name[pt]=Observatório do KDE -Name[pt_BR]=Observatório do KDE -Name[ro]=Observator KDE -Name[ru]=Статистика разработки KDE -Name[sk]=Observatórium KDE -Name[sl]=Opazovanje KDE-ja -Name[sr]=опсерваторија КДЕ‑а -Name[sr@ijekavian]=опсерваторија КДЕ‑а -Name[sr@ijekavianlatin]=opservatorija KDE‑a -Name[sr@latin]=opservatorija KDE‑a -Name[sv]=KDE-observatorium -Name[tr]=KDE Gözlem Evi -Name[uk]=Спостережний пункт KDE -Name[wa]=Observatwere KDE -Name[x-test]=xxKDE Observatoryxx -Name[zh_CN]=KDE 观测台 -Name[zh_TW]=KDE 觀測所 -Comment=Visualize the KDE ecosystem -Comment[bs]=Vizuelizacija ekosistema KDE‑a -Comment[ca]=Visualitzeu l'ecosistema KDE -Comment[ca@valencia]=Visualitzeu l'ecosistema KDE -Comment[cs]=Vizualizace ekosystému KDE -Comment[da]=Visualisering af KDE's økosystem -Comment[de]=Anzeige des KDE-Ökosystems -Comment[el]=Οπτικοποίηση του οικοσυστήματος του KDE -Comment[en_GB]=Visualise the KDE ecosystem -Comment[es]=Visualizar el ecosistema de KDE -Comment[et]=KDE ökosüsteemi näitamine -Comment[eu]=KDE ekosistema erakutsi -Comment[fi]=Visualisoi KDE:n ekosysteemi -Comment[fr]=Visualisez l'écosystème de KDE -Comment[gl]=Visualice o ecosistema de KDE. -Comment[hr]=Vizualiziraj ekosustav KDE-a -Comment[hu]=Megjeleníti a KDE ökoszisztémáját -Comment[it]=Visualizza l'ecosistema di KDE -Comment[ja]=KDE の生態系を可視化 -Comment[kk]=KDE экосистемасының жағдайы -Comment[km]=មើល KDE ecosystem -Comment[ko]=KDE 생태계를 표시합니다 -Comment[lt]=Vizualizuoti KDE ekosistemą -Comment[lv]=Vizualizē KDE ekosistēmu -Comment[mr]=केडीई पर्यावरण प्रणालीची कल्पना करा -Comment[nb]=Visualiser KDE-økosystemet -Comment[nds]=De Projekten op KDE ankieken -Comment[nl]=Het KDE-ecosysteem visualiseren -Comment[nn]=Visualiser KDE-økosystemet -Comment[pl]=Wyobraź sobie ekosystem KDE -Comment[pt]=Visualizar o ecossistema do KDE -Comment[pt_BR]=Visualiza o ecossistema do KDE -Comment[ro]=Vizualizează ecosistemul KDE -Comment[ru]=Визуализация работы сообщества KDE -Comment[sk]=Vizualizácia ekosystému KDE -Comment[sl]=Vizualizira KDE-jev ekosistem -Comment[sr]=Визуелизација екосистема КДЕ‑а -Comment[sr@ijekavian]=Визуелизација екосистема КДЕ‑а -Comment[sr@ijekavianlatin]=Vizuelizacija ekosistema KDE‑a -Comment[sr@latin]=Vizuelizacija ekosistema KDE‑a -Comment[sv]=Åskådliggör KDE:s ekosystem -Comment[tr]=KDE ekosistemini canlandır -Comment[uk]=Візуалізація екосистеми KDE -Comment[wa]=Vey l' ecosistinme da KDE -Comment[x-test]=xxVisualize the KDE ecosystemxx -Comment[zh_CN]=观测 KDE 开发状况 -Comment[zh_TW]=將 KDE 生態系統視覺化 -Type=Service -Icon=kdeobservatory.png - -X-KDE-ServiceTypes=Plasma/Applet -X-KDE-Library=plasma_applet_kdeobservatory -X-KDE-PluginInfo-Author=Sandro S. Andrade (developer)
Lee Olson (artwork) -X-KDE-PluginInfo-Name=kdeobservatory -X-KDE-PluginInfo-Version=0.2 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Development Tools -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-Requires-FileDialog=Unused -X-Plasma-Requires-LaunchApp=Unused diff --git a/kdeplasma-addons/applets/kdeobservatory/src/Messages.sh b/kdeplasma-addons/applets/kdeobservatory/src/Messages.sh deleted file mode 100644 index d73048d7..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT *.cpp -o $podir/plasma_applet_kdeobservatory.pot -rm -f rc.cpp diff --git a/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.cpp b/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.cpp deleted file mode 100644 index 92cc74b5..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "commithistoryview.h" - -#include - -#include - -#include -#include -#include -#include - -class TimeScaleDraw : public QwtScaleDraw -{ -public: - TimeScaleDraw(const QDate &minDate) - { - m_minDate = minDate; - } - - virtual QwtText label(double v) const - { - QString dateFormat = KGlobal::locale()->dateFormatShort(); - if (dateFormat == "%Y-%m-%d") - return QwtText(m_minDate.addDays((int)v).toString("MM/dd")); - else - return QwtText(m_minDate.addDays((int)v).toString("dd/MM")); - } - -private: - QDate m_minDate; -}; - -CommitHistoryView::CommitHistoryView(KdeObservatory *kdeObservatory, const QHash &commitHistoryViewProjects, const QMap &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags) -: IViewProvider(kdeObservatory, parent, wFlags), - m_commitHistoryViewProjects(commitHistoryViewProjects), - m_projects(projects) -{ -} - -CommitHistoryView::~CommitHistoryView() -{ -} - -void CommitHistoryView::createViews() -{ - deleteViews(); - QHashIterator i(m_commitHistoryViewProjects); - while (i.hasNext()) - { - i.next(); - if (i.value()) - createView(i18nc("Commit history for a given project %1", "Commit History - %1", i.key()), QString("Commit History - ") + i.key()); - } -} - -void CommitHistoryView::updateViews(const Plasma::DataEngine::Data &data) -{ - QString project = data["project"].toString(); - - const DateCommitList &projectCommits = data[project].value(); - - int count = projectCommits.count(); - if (count > 0) - { - int maxCommit = 0; - - QString tmpStr = projectCommits.at(0).first; - qlonglong minDate = tmpStr.remove('-').toLongLong(); - double *x = new double[count]; - double *y = new double[count]; - - int count = projectCommits.count(); - int j; - for (j = 0; j < count; ++j) - { - const QPair &pair = projectCommits.at(j); - tmpStr = pair.first; - x[j] = j; - y[j] = pair.second; - if (y[j] > maxCommit) - maxCommit = y[j]; - } - - QGraphicsWidget *container = containerForView(QString("Commit History - ") + project); - if (!container) { - delete []x; - delete []y; - return; - } - - QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(container); - proxy->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); - - QwtPlot *plot = new QwtPlot; - plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - plot->setAttribute(Qt::WA_TranslucentBackground, true); - - plot->setAxisScale(QwtPlot::yLeft, 0, qRound((maxCommit/5.)+0.5)*5, qRound((maxCommit/5.)+0.5)); - - plot->setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw(QDate::fromString(QString::number(minDate), "yyyyMMdd"))); - - plot->setAxisFont(QwtPlot::yLeft, KGlobalSettings::smallestReadableFont()); - plot->setAxisFont(QwtPlot::xBottom, KGlobalSettings::smallestReadableFont()); - - plot->setAxisLabelRotation(QwtPlot::xBottom, -15); - - plot->setCanvasBackground(QColor(0, 0, 140)); - - QwtPlotCurve *curve = new QwtPlotCurve; -#if QWT_VERSION >= (((6) << 16) | ((0) << 8) | (0)) - curve->setSamples(x, y, j); -#else - curve->setData(x, y, j); -#endif - delete []x; - delete []y; - - curve->attach(plot); - QPen pen = curve->pen(); - pen.setColor(QColor(255, 255, 0)); - curve->setPen(pen); - plot->replot(); - - QwtPlotGrid *grid = new QwtPlotGrid; - grid->enableXMin(true); - grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine)); - grid->setMinPen(QPen(Qt::NoPen)); - grid->attach(plot); - - proxy->setWidget(plot); - plot->setGeometry(0, 0, container->geometry().width(), container->geometry().height()); - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.h b/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.h deleted file mode 100644 index 557c69ac..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/commithistoryview.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef COMMITHISTORYVIEW_HEADER -#define COMMITHISTORYVIEW_HEADER - -#include "iviewprovider.h" - -#include "kdeobservatory.h" - -class CommitHistoryView : public IViewProvider -{ -public: - CommitHistoryView(KdeObservatory *kdeObservatory, const QHash &commitHistoryViewProjects, const QMap &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0); - virtual ~CommitHistoryView(); - - virtual void createViews(); - virtual void updateViews(const Plasma::DataEngine::Data &data); - -private: - const QHash &m_commitHistoryViewProjects; - const QMap &m_projects; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.cpp b/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.cpp deleted file mode 100644 index e531a874..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "iviewprovider.h" - -#include -#include - -#include - -IViewProvider::IViewProvider(KdeObservatory *kdeObservatory, QGraphicsWidget *parent, Qt::WindowFlags wFlags) -: m_kdeObservatory(kdeObservatory), - m_parent(parent), - m_wFlags(wFlags) -{ -} - -IViewProvider::~IViewProvider() -{ -} - -void IViewProvider::createView(const QString &title, const QString &id) -{ - QGraphicsWidget *view = new QGraphicsWidget(m_parent); - view->setHandlesChildEvents(true); - view->hide(); - - Plasma::Frame *header = new Plasma::Frame(view); - header->setText(title); - header->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - - QGraphicsWidget *container = new QGraphicsWidget(view); - container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, view); - layout->addItem(header); - layout->addItem(container); - - view->setLayout(layout); - view->setGeometry(m_parent->geometry()); - - m_views.insert(id, view); - m_viewContainers.insert(id, container); -} - -QGraphicsWidget *IViewProvider::containerForView(const QString &id) -{ - return m_viewContainers[id]; -} - -void IViewProvider::deleteViews() -{ - foreach(QGraphicsWidget *view, m_views) - view->deleteLater(); - m_views.clear(); -} - -const QList IViewProvider::views() const -{ - return m_views.values(); -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.h b/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.h deleted file mode 100644 index 13e989de..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/iviewprovider.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef IVIEWPROVIDER_HEADER -#define IVIEWPROVIDER_HEADER - -#include - -#include - -#include - -namespace Plasma -{ - class Frame; -} - -class KdeObservatory; - -class IViewProvider : public QObject -{ - Q_OBJECT -public: - explicit IViewProvider(KdeObservatory *kdeObservatory, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0); - virtual ~IViewProvider(); - - void createView(const QString &title, const QString &id); - QGraphicsWidget *containerForView(const QString &id); - void deleteViews(); - const QList views() const; - - virtual void createViews() = 0; - virtual void updateViews(const Plasma::DataEngine::Data &data) = 0; - -protected: - KdeObservatory *m_kdeObservatory; - QGraphicsWidget *m_parent; - Qt::WindowFlags m_wFlags; - QMap m_views; - QHash m_viewContainers; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.cpp b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.cpp deleted file mode 100644 index 73cd2505..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.cpp +++ /dev/null @@ -1,839 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "kdeobservatory.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "krazyreportview.h" -#include "topdevelopersview.h" -#include "commithistoryview.h" -#include "topactiveprojectsview.h" - -#include "kdeobservatoryconfigviews.h" -#include "kdeobservatoryconfiggeneral.h" -#include "kdeobservatoryconfigprojects.h" - -K_EXPORT_PLASMA_APPLET(kdeobservatory, KdeObservatory) - -KdeObservatory::KdeObservatory(QObject *parent, const QVariantList &args) -: Plasma::PopupApplet(parent, args), - m_mainContainer(0), - m_currentView(0), - m_viewTransitionTimer(new QTimer(this)), - m_transitionTimer(new QTimeLine(500, this)), - m_engine(0), - m_service(0) -{ - setBackgroundHints(DefaultBackground); - setHasConfigurationInterface(true); - setAspectRatioMode(Plasma::IgnoreAspectRatio); - resize(300, 200); - - connect(m_transitionTimer, SIGNAL(finished()), this, SLOT(timeLineFinished())); - connect(m_viewTransitionTimer, SIGNAL(timeout()), this, SLOT(moveViewRight())); -} - -KdeObservatory::~KdeObservatory() -{ - delete m_viewTransitionTimer; - delete m_transitionTimer; - delete m_service; - - if (!hasFailedToLaunch()) - { - delete m_viewProviders[i18n("Top Active Projects")]; - delete m_viewProviders[i18n("Top Developers")]; - delete m_viewProviders[i18n("Commit History")]; - delete m_viewProviders[i18n("Krazy Report")]; - } -} - -void KdeObservatory::init() -{ - m_engine = dataEngine("kdeobservatory"); - - m_service = m_engine->serviceForSource(""); - connect(m_service, SIGNAL(engineReady()), SLOT(safeInit())); - connect(m_service, SIGNAL(engineError(QString,QString)), SLOT(engineError(QString,QString))); - - setPopupIcon(KIcon("kdeobservatory")); - - if (Solid::Networking::status() != Solid::Networking::Connected && Solid::Networking::status() != Solid::Networking::Unknown) - { - engineError("fatal", i18n("No active network connection")); - return; - } - - Plasma::PopupApplet::setBusy(true); - m_service->startOperationCall(m_service->operationDescription("allProjectsInfo")); -} - -QGraphicsWidget *KdeObservatory::graphicsWidget() -{ - if (!m_mainContainer) - { - m_mainContainer = new QGraphicsWidget(this); - m_mainContainer->installEventFilter(this); - - m_viewContainer = new QGraphicsWidget(m_mainContainer); - m_viewContainer->setAcceptHoverEvents(true); - m_viewContainer->setHandlesChildEvents(true); - m_viewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_viewContainer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); - - m_right = new Plasma::PushButton(m_mainContainer); - m_right->setIcon(KIcon("go-next-view")); - m_right->setToolTip(i18n("Go to previous view")); - m_right->setMaximumSize(22, 22); - m_right->hide(); - connect(m_right, SIGNAL(clicked()), this, SLOT(moveViewRightClicked())); - - m_left = new Plasma::PushButton(m_mainContainer); - m_left->setIcon(KIcon("go-previous-view")); - m_left->setToolTip(i18n("Go to next view")); - m_left->setMaximumSize(22, 22); - m_left->hide(); - connect(m_left, SIGNAL(clicked()), this, SLOT(moveViewLeftClicked())); - - m_collectorProgress = new Plasma::Meter(m_mainContainer); - m_collectorProgress->hide(); - m_collectorProgress->setMeterType(Plasma::Meter::BarMeterHorizontal); - m_collectorProgress->setMaximumHeight(22); - m_collectorProgress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_collectorProgress->setValue(0); - - m_updateLabel = new Plasma::Label(m_mainContainer); - m_updateLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - m_updateLabel->setFont(KGlobalSettings::smallestReadableFont()); - m_updateLabel->setAlignment(Qt::AlignCenter); - - m_horizontalLayout = new QGraphicsLinearLayout(Qt::Horizontal); - m_horizontalLayout->addItem(m_left); - m_horizontalLayout->addItem(m_updateLabel); - m_horizontalLayout->addItem(m_right); - m_horizontalLayout->setMaximumHeight(22); - - QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical); - verticalLayout->addItem(m_viewContainer); - verticalLayout->addItem(m_horizontalLayout); - - m_mainContainer->setLayout(verticalLayout); - m_mainContainer->setPreferredSize(300, 200); - m_mainContainer->setMinimumSize(300, 200); - } - - return m_mainContainer; -} - -bool KdeObservatory::eventFilter(QObject *receiver, QEvent *event) -{ - if (!m_viewProviders.isEmpty() && - dynamic_cast(receiver) == m_mainContainer && - event->type() == QEvent::GraphicsSceneResize) - { - delete m_transitionTimer; - m_viewTransitionTimer->stop(); - createViews(); - updateSources(); - m_viewTransitionTimer->start(); - m_transitionTimer = new QTimeLine(500, this); - connect(m_transitionTimer, SIGNAL(finished()), this, SLOT(timeLineFinished())); - return true; - } - else - return Plasma::PopupApplet::eventFilter(receiver, event); -} - -bool KdeObservatory::sceneEventFilter(QGraphicsItem *watched, QEvent *event) -{ - Q_UNUSED(watched); - if (event->type() == QEvent::GraphicsSceneHoverEnter && m_enableAutoViewChange) - m_viewTransitionTimer->stop(); - else if (event->type() == QEvent::GraphicsSceneHoverLeave && m_enableAutoViewChange) - m_viewTransitionTimer->start(); - else - return Plasma::PopupApplet::sceneEventFilter(watched, event); - return true; -} - -void KdeObservatory::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) -{ - // Prevent for being updated from another instance update request - if (data["appletId"].toUInt() != id()) - return; - - QString project = data["project"].toString(); - - if (sourceName != "topActiveProjects" && !data.contains(project) && !data.contains("error")) - return; - - if (sourceName == "topActiveProjects") - m_viewProviders[i18n("Top Active Projects")]->updateViews(data); - else if (sourceName == "topProjectDevelopers" && !project.isEmpty()) - m_viewProviders[i18n("Top Developers")]->updateViews(data); - else if (sourceName == "commitHistory" && !project.isEmpty()) - m_viewProviders[i18n("Commit History")]->updateViews(data); - else if (sourceName == "krazyReport" && !project.isEmpty()) - m_viewProviders[i18n("Krazy Report")]->updateViews(data); - - --m_sourceCounter; - m_collectorProgress->setValue(m_collectorProgress->maximum() - m_sourceCounter); - - if (m_sourceCounter == 0) - { - KDateTime currentTime = KDateTime::currentLocalDateTime(); - KLocale *locale = KGlobal::locale(); - m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); - m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); - setBusy(false); - updateViews(); - } -} - -void KdeObservatory::safeInit() -{ - if (m_projects.count() == 0) - { - configChanged(); - saveConfig(); - createViewProviders(); - createTimers(); - createViews(); - - m_sourceCounter = 4; - - m_engine->connectSource("topActiveProjects", this); - m_engine->connectSource("topProjectDevelopers", this); - m_engine->connectSource("commitHistory", this); - m_engine->connectSource("krazyReport", this); - } - - updateSources(); -} - -void KdeObservatory::engineError(const QString &source, const QString &error) -{ - kDebug() << "Source:" << source << "Error:" << error; - if (source == "fatal" && m_sourceCounter > 0) - { - m_viewTransitionTimer->stop(); - - foreach(QGraphicsWidget *widget, m_views) - widget->hide(); - - m_views.clear(); - - graphicsWidget(); - m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(255, 0, 0);}")); - m_updateLabel->setText(error); - setBusy(false); - - return; - } - - --m_sourceCounter; - - if (m_sourceCounter == 0) - { - KDateTime currentTime = KDateTime::currentLocalDateTime(); - KLocale *locale = KGlobal::locale(); - m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); - m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); - setBusy(false); - updateViews(); - } -} - -void KdeObservatory::createConfigurationInterface(KConfigDialog *parent) -{ - m_configGeneral = new KdeObservatoryConfigGeneral(parent); - parent->addPage(m_configGeneral, i18nc("Global configuration options", "General"), "applications-development"); - - m_configProjects = new KdeObservatoryConfigProjects(parent); - parent->addPage(m_configProjects, i18n("Projects"), "project-development"); - - m_configViews = new KdeObservatoryConfigViews(parent); - m_configViews->m_projects = m_projects; - m_configViews->m_projectsInView[i18n("Top Active Projects")] = m_topActiveProjectsViewProjects; - m_configViews->m_projectsInView[i18n("Top Developers")] = m_topDevelopersViewProjects; - m_configViews->m_projectsInView[i18n("Commit History")] = m_commitHistoryViewProjects; - m_configViews->m_projectsInView[i18n("Krazy Report")] = m_krazyReportViewProjects; - m_configViews->updateView(i18n("Top Active Projects")); - parent->addPage(m_configViews, i18n("Views"), "view-presentation"); - - connect(m_configProjects, SIGNAL(projectAdded(QString,QString)), - m_configViews, SLOT(projectAdded(QString,QString))); - connect(m_configProjects, SIGNAL(projectRemoved(QString)), - m_configViews, SLOT(projectRemoved(QString))); - - // Config - General - if (m_activityRangeType == 0) - m_configGeneral->activitiesFullHistory->setChecked(true); - else if (m_activityRangeType == 1) - m_configGeneral->activitiesInPastDays->setChecked(true); - else - m_configGeneral->activitiesInRange->setChecked(true); - - m_configGeneral->commitExtent->setValue(m_commitExtent); - m_configGeneral->fromDate->setDate(QDate::fromString(m_commitFrom, "yyyyMMdd")); - m_configGeneral->toDate ->setDate(QDate::fromString(m_commitTo , "yyyyMMdd")); - - m_configGeneral->enableAutoViewChange->setChecked(m_enableAutoViewChange); - m_configGeneral->viewsDelay->setTime(QTime(m_viewsDelay/3600, (m_viewsDelay/60)%60, m_viewsDelay%60)); - - int viewsCount = m_activeViews.count(); - for (int i = 0; i < viewsCount; ++i) - { - const QPair &pair = m_activeViews.at(i); - QListWidgetItem * item = m_configViews->activeViews->findItems(pair.first, Qt::MatchFixedString).first(); - item->setCheckState(pair.second == true ? Qt::Checked:Qt::Unchecked); - m_configViews->activeViews->takeItem(m_configViews->activeViews->row(item)); - m_configViews->activeViews->insertItem(i, item); - } - - // Config - Projects - QMapIterator i(m_projects); - while (i.hasNext()) - { - i.next(); - Project project = i.value(); - m_configProjects->createTableWidgetItem(i.key(), project.commitSubject, project.krazyReport, project.krazyFilePrefix, project.icon); - m_configProjects->projects->setCurrentCell(0, 0); - } - - m_configProjects->projects->setCurrentItem(m_configProjects->projects->item(0, 0)); - m_configProjects->projects->resizeColumnsToContents(); - m_configProjects->projects->horizontalHeader()->setStretchLastSection(true); - - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(cancelClicked()), m_viewTransitionTimer, SLOT(start())); - - m_viewTransitionTimer->stop(); - - connect(m_configGeneral->activitiesFullHistory, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(m_configGeneral->activitiesInPastDays, SIGNAL(toggled()), parent, SLOT(settingsModified())); - connect(m_configGeneral->activitiesInRange , SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(m_configGeneral->commitExtent, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified())); - connect(m_configGeneral->fromDate, SIGNAL(dateChanged(QDate)), parent, SLOT(settingsModified())); - connect(m_configGeneral->toDate, SIGNAL(dateChanged(QDate)), parent, SLOT(settingsModified())); - connect(m_configGeneral->enableAutoViewChange, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(m_configGeneral->viewsDelay, SIGNAL(dateTimeChanged(QDateTime)), parent, SLOT(settingsModified())); - - connect(m_configProjects, SIGNAL(projectAdded(QString,QString)), parent, SLOT(settingsModified())); - connect(m_configProjects, SIGNAL(projectRemoved(QString)), parent, SLOT(settingsModified())); - connect(m_configProjects->projects, SIGNAL(cellChanged(int,int)), parent, SLOT(settingsModified())); - connect(m_configProjects, SIGNAL(projectEdited(QString)) , parent, SLOT(settingsModified())); - - connect(m_configViews->activeViews, SIGNAL(itemChanged(QListWidgetItem*)), parent, SLOT(settingsModified())); - connect(m_configViews->tlbUp, SIGNAL(clicked(bool)), parent, SLOT(settingsModified())); - connect(m_configViews->tlbDown, SIGNAL(clicked(bool)), parent, SLOT(settingsModified())); - connect(m_configViews->views, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified())); - connect(m_configViews->projectsInView, SIGNAL(itemChanged(QListWidgetItem*)), parent, SLOT(settingsModified())); - connect(m_configViews->psbCheckAll, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(m_configViews->psbUncheckAll, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); -} - -void KdeObservatory::configAccepted() -{ - // General properties - m_activityRangeType = (m_configGeneral->activitiesFullHistory->isChecked()) ? 0:(m_configGeneral->activitiesInPastDays->isChecked()) ? 1:2; - m_commitExtent = m_configGeneral->commitExtent->value(); - m_commitFrom = m_configGeneral->fromDate->date().toString("yyyyMMdd"); - m_commitTo = m_configGeneral->toDate ->date().toString("yyyyMMdd"); - m_enableAutoViewChange = (m_configGeneral->enableAutoViewChange->checkState() == Qt::Checked) ? true:false; - QTime viewsDelay = m_configGeneral->viewsDelay->time(); - m_viewsDelay = viewsDelay.second() + viewsDelay.minute()*60 + viewsDelay.hour()*3600; - - m_activeViews.clear(); - QStringList viewNames; - QList viewActives; - - for (int i = 0; i < m_configViews->activeViews->count(); ++i) - { - QListWidgetItem *item = m_configViews->activeViews->item(i); - QString viewName = item->text(); - bool viewActive = (item->checkState() == Qt::Checked) ? true:false; - m_activeViews << QPair(viewName, viewActive); - viewNames << viewName; - viewActives << viewActive; - } - - m_viewTransitionTimer->setInterval(m_viewsDelay * 1000); - - // Projects properties - QStringList projectNames; - QStringList projectCommitSubjects; - QStringList projectKrazyReports; - QStringList projectKrazyFilePrefix; - QStringList projectIcons; - - m_projects.clear(); - - int projectsCount = m_configProjects->projects->rowCount(); - for (int i = 0; i < projectsCount; ++i) - { - Project project; - project.commitSubject = m_configProjects->projects->item(i, 1)->text(); - project.krazyReport = m_configProjects->projects->item(i, 2)->text(); - project.krazyFilePrefix = m_configProjects->projects->item(i, 3)->text(); - project.icon = m_configProjects->projects->item(i, 0)->data(Qt::UserRole).value(); - m_projects[m_configProjects->projects->item(i, 0)->text()] = project; - projectNames << m_configProjects->projects->item(i, 0)->text(); - projectCommitSubjects << project.commitSubject; - projectKrazyReports << project.krazyReport; - projectKrazyFilePrefix << project.krazyFilePrefix; - projectIcons << project.icon; - } - - m_configViews->on_views_currentIndexChanged(i18n("Top Active Projects")); - m_topActiveProjectsViewProjects = m_configViews->m_projectsInView[i18n("Top Active Projects")]; - m_topDevelopersViewProjects = m_configViews->m_projectsInView[i18n("Top Developers")]; - m_commitHistoryViewProjects = m_configViews->m_projectsInView[i18n("Commit History")]; - m_krazyReportViewProjects = m_configViews->m_projectsInView[i18n("Krazy Report")]; - - saveConfig(); - - m_lastViewCount = m_views.count(); - createTimers(); - createViews(); - updateSources(); -} - -void KdeObservatory::moveViewRight() -{ - switchViews(1); -} - -void KdeObservatory::moveViewLeft() -{ - switchViews(-1); -} - -void KdeObservatory::moveViewRightClicked() -{ - m_viewTransitionTimer->stop(); - moveViewRight(); - // Causes a short delay (10s) to next transition - if (m_enableAutoViewChange) - QTimer::singleShot(10000, m_viewTransitionTimer, SLOT(start())); -} - -void KdeObservatory::moveViewLeftClicked() -{ - m_viewTransitionTimer->stop(); - moveViewLeft(); - // Causes a short delay (10s) to next transition - if (m_enableAutoViewChange) - QTimer::singleShot(10000, m_viewTransitionTimer, SLOT(start())); -} - -void KdeObservatory::switchViews(int delta) -{ - if (m_views.count() > 0 && m_transitionTimer->state() == QTimeLine::NotRunning) - { - int previousView = m_currentView; - int newView = m_currentView + delta; - m_currentView = (newView >= 0) ? (newView % m_views.count()):(m_views.count() + newView); - - QGraphicsWidget *previousViewWidget = m_views.at(previousView); - QGraphicsWidget *currentViewWidget = m_views.at(m_currentView); - currentViewWidget->setPos(currentViewWidget->geometry().width(), 0); - currentViewWidget->show(); - - m_transitionTimer->setFrameRange(0, 1); - m_transitionTimer->setCurveShape(QTimeLine::EaseOutCurve); - - m_animationPrevious = new QGraphicsItemAnimation(this); - m_animationPrevious->setItem(previousViewWidget); - m_animationPrevious->setTimeLine(m_transitionTimer); - m_animationPrevious->setPosAt(0, QPointF(0, 0)); - m_animationPrevious->setPosAt(1, -delta*QPointF(previousViewWidget->geometry().width(), 0)); - - m_animationNew = new QGraphicsItemAnimation(this); - m_animationNew->setItem(currentViewWidget); - m_animationNew->setTimeLine(m_transitionTimer); - m_animationNew->setPosAt(0, delta*QPointF(currentViewWidget->geometry().width(), 0)); - m_animationNew->setPosAt(1, QPointF(0, 0)); - - m_transitionTimer->start(); - } -} - -void KdeObservatory::timeLineFinished() -{ - delete m_animationPrevious; - delete m_animationNew; -} - -void KdeObservatory::setBusy(bool value) -{ - if (m_mainContainer) - { - if (value) - { - m_right->hide(); - m_left->hide(); - m_updateLabel->hide(); - m_horizontalLayout->removeItem(m_updateLabel); - m_collectorProgress->setValue(0); - m_horizontalLayout->insertItem(1, m_collectorProgress); - m_collectorProgress->show(); - } - else - { - m_collectorProgress->hide(); - m_horizontalLayout->removeItem(m_collectorProgress); - m_horizontalLayout->insertItem(1, m_updateLabel); - m_updateLabel->show(); - m_left->show(); - m_right->show(); - } - } - Plasma::PopupApplet::setBusy(value); -} - -void KdeObservatory::updateSources() -{ - kDebug(); - setBusy(true); - - QString commitFrom = ""; - QString commitTo = ""; - - if (m_activityRangeType == 2) - { - commitFrom = m_commitFrom; - commitTo = m_commitTo; - } - else if (m_activityRangeType == 1) - { - QDate currentDate = QDate::currentDate(); - commitTo = currentDate.toString("yyyyMMdd"); - commitFrom = currentDate.addDays(-m_commitExtent).toString("yyyyMMdd"); - } - - m_sourceCounter = 0; - uint appletId = id(); - - QListIterator< QPair > i (m_activeViews); - while (i.hasNext()) - { - const QPair &pair = i.next(); - - if (pair.first == i18n("Top Active Projects") && pair.second) - { - KConfigGroup ops = m_service->operationDescription("topActiveProjects"); - ops.writeEntry("appletId", appletId); - ops.writeEntry("commitFrom", commitFrom); - ops.writeEntry("commitTo" , commitTo); - m_service->startOperationCall(ops); - ++m_sourceCounter; - } - - if (pair.first == i18n("Top Developers") && pair.second) - { - QHashIterator i1(m_topDevelopersViewProjects); - while (i1.hasNext()) - { - i1.next(); - if (i1.value()) - { - KConfigGroup ops = m_service->operationDescription("topProjectDevelopers"); - ops.writeEntry("appletId", appletId); - ops.writeEntry("project", i1.key()); - ops.writeEntry("commitFrom", commitFrom); - ops.writeEntry("commitTo" , commitTo); - m_service->startOperationCall(ops); - ++m_sourceCounter; - } - } - } - - if (pair.first == i18n("Commit History") && pair.second) - { - QHashIterator i2(m_commitHistoryViewProjects); - while (i2.hasNext()) - { - i2.next(); - if (i2.value()) - { - KConfigGroup ops = m_service->operationDescription("commitHistory"); - ops.writeEntry("appletId", appletId); - ops.writeEntry("project", i2.key()); - ops.writeEntry("commitFrom", commitFrom); - ops.writeEntry("commitTo" , commitTo); - m_service->startOperationCall(ops); - ++m_sourceCounter; - } - } - } - - if (pair.first == i18n("Krazy Report") && pair.second) - { - QHashIterator i3(m_krazyReportViewProjects); - while (i3.hasNext()) - { - i3.next(); - if (i3.value() && (m_projects[i3.key()].krazyReport.contains("reports") || m_projects[i3.key()].krazyReport.contains("component="))) - { - KConfigGroup ops = m_service->operationDescription("krazyReport"); - ops.writeEntry("appletId", appletId); - ops.writeEntry("project", i3.key()); - ops.writeEntry("krazyReport", m_projects[i3.key()].krazyReport); - ops.writeEntry("krazyFilePrefix", m_projects[i3.key()].krazyFilePrefix); - m_service->startOperationCall(ops); - ++m_sourceCounter; - } - } - } - } - - m_collectorProgress->setMaximum(m_sourceCounter); - m_collectorProgress->setValue(0); -} - -void KdeObservatory::createViews() -{ - m_viewTransitionTimer->stop(); - - foreach(QGraphicsWidget *widget, m_views) - widget->hide(); - - m_views.clear(); - - QListIterator< QPair > i (m_activeViews); - while (i.hasNext()) - { - const QPair &pair = i.next(); - const QString &view = pair.first; - if (pair.second && m_viewProviders.value(view)) - m_viewProviders[view]->createViews(); - } -} - -void KdeObservatory::updateViews() -{ - m_viewTransitionTimer->stop(); - - foreach(QGraphicsWidget *widget, m_views) - widget->hide(); - - m_views.clear(); - QListIterator< QPair > i (m_activeViews); - while (i.hasNext()) - { - const QPair &pair = i.next(); - const QString &view = pair.first; - if (pair.second && m_viewProviders.value(view)) - m_views.append(m_viewProviders[view]->views()); - } - - if (m_views.count() > 0) - { - if (m_views.count() != m_lastViewCount) - m_currentView = m_views.count()-1; - moveViewRight(); - if (m_enableAutoViewChange && m_views.count() > 1) - m_viewTransitionTimer->start(); - } -} - -void KdeObservatory::configChanged() -{ - KConfigGroup configGroup = config(); - - // Config - General - m_activityRangeType = configGroup.readEntry("activityRangeType", 1); - m_commitExtent = configGroup.readEntry("commitExtent", 7); - m_commitFrom = configGroup.readEntry("commitFrom", QDate::currentDate().toString("yyyyMMdd")); - m_commitTo = configGroup.readEntry("commitTo" , QDate::currentDate().toString("yyyyMMdd")); - m_enableAutoViewChange = configGroup.readEntry("enableAutoViewChange", true); - m_viewsDelay = configGroup.readEntry("viewsDelay", 5); - - Plasma::DataEngine::Data presetsData = m_engine->query("allProjectsInfo"); - - QStringList viewNames = configGroup.readEntry("viewNames", presetsData["views"].toStringList()); - QList viewActives = configGroup.readEntry("viewActives", presetsData["viewsActive"].toList()); - - m_activeViews.clear(); - int viewsCount = viewNames.count(); - for (int i = 0; i < viewsCount; ++i) - m_activeViews.append(QPair(viewNames.at(i), viewActives.at(i).toBool())); - - // Config - Projects - QStringList projectNames = configGroup.readEntry("projectNames", presetsData["projectNames"].toStringList()); - QStringList projectCommitSubjects = configGroup.readEntry("projectCommitSubjects", presetsData["projectCommitSubjects"].toStringList()); - QStringList projectKrazyReports = configGroup.readEntry("projectKrazyReports", presetsData["projectKrazyReports"].toStringList()); - QStringList projectKrazyFilePrefix = configGroup.readEntry("projectKrazyFilePrefix", presetsData["projectKrazyFilePrefixes"].toStringList()); - QStringList projectIcons = configGroup.readEntry("projectIcons", presetsData["projectIcons"].toStringList()); - - m_projects.clear(); - int projectsCount = projectNames.count(); - for (int i = 0; i < projectsCount; ++i) - { - Project project; - project.commitSubject = projectCommitSubjects.at(i); - project.krazyReport = projectKrazyReports.at(i); - project.krazyFilePrefix = projectKrazyFilePrefix.at(i); - project.icon = projectIcons.at(i); - m_projects[projectNames.at(i)] = project; - } - - QStringList defaultProjectNames = presetsData["projectNames"].toStringList(); - QList automaticallyInViews = presetsData["automaticallyInViews"].toList(); - - // Config - Top Active Projects - QStringList topActiveProjectsViewNames = configGroup.readEntry("topActiveProjectsViewNames", defaultProjectNames); - QList topActiveProjectsViewActives = configGroup.readEntry("topActiveProjectsViewActives", automaticallyInViews); - - m_topActiveProjectsViewProjects.clear(); - int topActiveProjectsViewsCount = topActiveProjectsViewNames.count(); - for (int i = 0; i < topActiveProjectsViewsCount; ++i) - m_topActiveProjectsViewProjects[topActiveProjectsViewNames.at(i)] = topActiveProjectsViewActives.at(i).toBool(); - - // Config - Top Developers - QStringList topDevelopersViewNames = configGroup.readEntry("topDevelopersViewNames", defaultProjectNames); - QList topDevelopersViewActives = configGroup.readEntry("topDevelopersViewActives", automaticallyInViews); - - m_topDevelopersViewProjects.clear(); - int topDevelopersViewsCount = topDevelopersViewNames.count(); - for (int i = 0; i < topDevelopersViewsCount; ++i) - m_topDevelopersViewProjects[topDevelopersViewNames.at(i)] = topDevelopersViewActives.at(i).toBool(); - - // Config - Commit History - QStringList commitHistoryViewNames = configGroup.readEntry("commitHistoryViewNames", defaultProjectNames); - QList commitHistoryViewActives = configGroup.readEntry("commitHistoryViewActives", automaticallyInViews); - - m_commitHistoryViewProjects.clear(); - int commitHistoryViewsCount = commitHistoryViewNames.count(); - for (int i = 0; i < commitHistoryViewsCount; ++i) - m_commitHistoryViewProjects[commitHistoryViewNames.at(i)] = commitHistoryViewActives.at(i).toBool(); - - // Config - Krazy Report - QStringList krazyReportViewNames = configGroup.readEntry("krazyReportViewNames", defaultProjectNames); - QList krazyReportViewActives = configGroup.readEntry("krazyReportViewActives", automaticallyInViews); - - m_krazyReportViewProjects.clear(); - int krazyReportViewsCount = krazyReportViewNames.count(); - for (int i = 0; i < krazyReportViewsCount; ++i) - m_krazyReportViewProjects[krazyReportViewNames.at(i)] = krazyReportViewActives.at(i).toBool(); -} - -void KdeObservatory::saveConfig() -{ - // General properties - KConfigGroup configGroup = config(); - - configGroup.writeEntry("activityRangeType", m_activityRangeType); - configGroup.writeEntry("commitExtent", m_commitExtent); - configGroup.writeEntry("commitFrom", m_commitFrom); - configGroup.writeEntry("commitTo" , m_commitTo); - configGroup.writeEntry("enableAutoViewChange", m_enableAutoViewChange); - configGroup.writeEntry("viewsDelay", m_viewsDelay); - - QStringList viewNames; - QList viewActives; - - QListIterator< QPair > i1(m_activeViews); - while (i1.hasNext()) - { - const QPair &pair = i1.next(); - viewNames << pair.first; - viewActives << pair.second; - } - configGroup.writeEntry("viewNames", viewNames); - configGroup.writeEntry("viewActives", viewActives); - - // Projects properties - QStringList projectNames; - QStringList projectCommitSubjects; - QStringList projectKrazyReports; - QStringList projectKrazyFilePrefix; - QStringList projectIcons; - - QMapIterator i2(m_projects); - while (i2.hasNext()) - { - i2.next(); - const Project &project = i2.value(); - projectNames << i2.key(); - projectCommitSubjects << project.commitSubject; - projectKrazyReports << project.krazyReport; - projectKrazyFilePrefix << project.krazyFilePrefix; - projectIcons << project.icon; - } - - configGroup.writeEntry("projectNames", projectNames); - configGroup.writeEntry("projectCommitSubjects", projectCommitSubjects); - configGroup.writeEntry("projectKrazyReports", projectKrazyReports); - configGroup.writeEntry("projectKrazyFilePrefix", projectKrazyFilePrefix); - configGroup.writeEntry("projectIcons", projectIcons); - - configGroup.writeEntry("topActiveProjectsViewNames", m_topActiveProjectsViewProjects.keys()); - configGroup.writeEntry("topActiveProjectsViewActives", m_topActiveProjectsViewProjects.values()); - - configGroup.writeEntry("topDevelopersViewNames", m_topDevelopersViewProjects.keys()); - configGroup.writeEntry("topDevelopersViewActives", m_topDevelopersViewProjects.values()); - - configGroup.writeEntry("commitHistoryViewNames", m_commitHistoryViewProjects.keys()); - configGroup.writeEntry("commitHistoryViewActives", m_commitHistoryViewProjects.values()); - - configGroup.writeEntry("krazyReportViewNames", m_krazyReportViewProjects.keys()); - configGroup.writeEntry("krazyReportViewActives", m_krazyReportViewProjects.values()); - - emit configNeedsSaving(); -} - -void KdeObservatory::createTimers() -{ - m_viewTransitionTimer->setInterval(m_viewsDelay * 1000); -} - -void KdeObservatory::createViewProviders() -{ - if (!m_viewContainer) - graphicsWidget(); - - m_viewProviders[i18n("Top Active Projects")] = new TopActiveProjectsView(this, m_topActiveProjectsViewProjects, m_projects, m_viewContainer); - m_viewProviders[i18n("Top Developers")] = new TopDevelopersView(this, m_topDevelopersViewProjects, m_projects, m_viewContainer); - m_viewProviders[i18n("Commit History")] = new CommitHistoryView(this, m_commitHistoryViewProjects, m_projects, m_viewContainer); - m_viewProviders[i18n("Krazy Report")] = new KrazyReportView(this, m_krazyReportViewProjects, m_projects, m_viewContainer); -} - diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.h b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.h deleted file mode 100644 index 1608d2d0..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatory.h +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef KDEOBSERVATORY_HEADER -#define KDEOBSERVATORY_HEADER - -#include - -#include -#include - -#include -#include -#include -#include -#include - -class IViewProvider; -class KdeObservatoryConfigViews; -class KdeObservatoryConfigGeneral; -class KdeObservatoryConfigProjects; - -namespace Plasma -{ - class Label; - class Meter; - class Engine; - class PushButton; -} - -class KdeObservatory : public Plasma::PopupApplet -{ - Q_OBJECT -public: - KdeObservatory(QObject *parent, const QVariantList &args); - ~KdeObservatory(); - - void init(); - - virtual QGraphicsWidget* graphicsWidget(); - - struct Project - { - QString commitSubject; - QString krazyReport; - QString krazyFilePrefix; - QString icon; - }; - -protected: - bool eventFilter(QObject *receiver, QEvent *event); - bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); - -public Q_SLOTS: - void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); - void configChanged(); - -protected Q_SLOTS: - void safeInit(); - void engineError(const QString &source, const QString &error); - void setBusy(bool value); - void updateSources(); - - void createConfigurationInterface(KConfigDialog *parent); - void configAccepted(); - - void moveViewRight(); - void moveViewLeft(); - void moveViewRightClicked(); - void moveViewLeftClicked(); - void switchViews(int delta); - void timeLineFinished(); - -private: - void createViews(); - void updateViews(); - void saveConfig(); - void createTimers(); - void createViewProviders(); - - KdeObservatoryConfigGeneral *m_configGeneral; - KdeObservatoryConfigProjects *m_configProjects; - KdeObservatoryConfigViews *m_configViews; - - // Config - General - int m_activityRangeType; - int m_commitExtent; - QString m_commitFrom; - QString m_commitTo; - bool m_cacheContents; - bool m_enableAutoViewChange; - int m_viewsDelay; - int m_lastViewCount; - QList< QPair > m_activeViews; - - // Config - Projects - QMap m_projects; - - // Config - Top Active Projects - QHash m_topActiveProjectsViewProjects; - - // Config - Top Developers - QHash m_topDevelopersViewProjects; - - // Config - Commit History - QHash m_commitHistoryViewProjects; - - // Config - Krazy - QHash m_krazyReportViewProjects; - - // Main Layout - QGraphicsWidget *m_mainContainer; - QGraphicsLinearLayout *m_horizontalLayout; - QGraphicsWidget *m_viewContainer; - Plasma::Meter *m_collectorProgress; - Plasma::Label *m_updateLabel; - Plasma::PushButton *m_right; - Plasma::PushButton *m_left; - - // View providers and data - QMap m_viewProviders; - - QList m_views; - - int m_currentView; - - QTimer *m_viewTransitionTimer; - QPointer m_transitionTimer; - - QGraphicsItemAnimation *m_animationPrevious; - QGraphicsItemAnimation *m_animationNew; - - Plasma::DataEngine *m_engine; - Plasma::Service *m_service; - - int m_sourceCounter; -}; - -typedef QMultiMap RankValueMap; -typedef QMapIterator RankValueMapIterator; -Q_DECLARE_METATYPE(RankValueMap) - -typedef QList< QPair > DateCommitList; -Q_DECLARE_METATYPE(DateCommitList) - -// FileType TestName FileName Errors -typedef QMap< QString, QMap > > KrazyReportMap; -typedef QMapIterator< QString, QMap > > KrazyReportMapIterator; -Q_DECLARE_METATYPE(KrazyReportMap) - -typedef QMap FileTypeKrazyReportMap; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.cpp b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.cpp deleted file mode 100644 index be190c5e..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "kdeobservatoryconfiggeneral.h" - -KdeObservatoryConfigGeneral::KdeObservatoryConfigGeneral(QWidget *parent, Qt::WindowFlags f) -: QWidget(parent, f) -{ - setupUi(this); -} - -KdeObservatoryConfigGeneral::~KdeObservatoryConfigGeneral() -{ -} - -void KdeObservatoryConfigGeneral::on_activitiesInRange_toggled(bool value) -{ - fromDate->setEnabled(value); - toDate->setEnabled(value); -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.h b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.h deleted file mode 100644 index 0094a610..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfiggeneral.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef KDEOBSERVATORYCONFIGGENERAL_HEADER -#define KDEOBSERVATORYCONFIGGENERAL_HEADER - -#include -#include "ui_kdeobservatoryconfiggeneral.h" - -class KdeObservatoryConfigGeneral : public QWidget, public Ui::KdeObservatoryConfigGeneral -{ - Q_OBJECT -public: - explicit KdeObservatoryConfigGeneral(QWidget *parent = 0, Qt::WindowFlags f = 0); - virtual ~KdeObservatoryConfigGeneral(); - -protected Q_SLOTS: - void on_activitiesInRange_toggled(bool value); -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.cpp b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.cpp deleted file mode 100644 index 777aacbc..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "kdeobservatoryconfigprojects.h" - -#include - -#include -#include - -#include "ui_kdeobservatoryconfigproject.h" - -KdeObservatoryConfigProjects::KdeObservatoryConfigProjects(QWidget *parent, Qt::WindowFlags f) -: QWidget(parent, f) -{ - setupUi(this); - psbAddProject->setIcon(KIcon("list-add")); - psbRemoveProject->setIcon(KIcon("list-remove")); - psbEditProject->setIcon(KIcon("document-edit")); -} - -KdeObservatoryConfigProjects::~KdeObservatoryConfigProjects() -{ -} - -void KdeObservatoryConfigProjects::createTableWidgetItem(const QString &projectName, const QString &commitSubject, const QString &krazyReport, const QString &krazyFilePrefix, const QString &icon) -{ - QTableWidgetItem *itemProject = new QTableWidgetItem(KIcon(icon), projectName); - itemProject->setData(Qt::UserRole, icon); - QTableWidgetItem *itemCommitSubject = new QTableWidgetItem(commitSubject); - QTableWidgetItem *itemKrazyReport = new QTableWidgetItem(krazyReport); - QTableWidgetItem *itemKrazyFilePrefix = new QTableWidgetItem(krazyFilePrefix); - int rowCount = projects->rowCount(); - projects->setRowCount(rowCount+1); - projects->setItem(rowCount, 0, itemProject); - projects->setItem(rowCount, 1, itemCommitSubject); - projects->setItem(rowCount, 2, itemKrazyReport); - projects->setItem(rowCount, 3, itemKrazyFilePrefix); - projects->setRowHeight(rowCount, projects->rowHeight(rowCount)*0.75); - projects->setCurrentItem(itemProject); -} - -void KdeObservatoryConfigProjects::on_psbAddProject_clicked() -{ - QPointer configProject = new KDialog(this); - configProject->setButtons(KDialog::None); - Ui::KdeObservatoryConfigProject *ui_configProject = new Ui::KdeObservatoryConfigProject; - ui_configProject->setupUi(configProject); - - if (configProject->exec() == KDialog::Accepted) - { - createTableWidgetItem(ui_configProject->projectName->text(), ui_configProject->commitSubject->text(), ui_configProject->krazyReport->text(), ui_configProject->krazyFilePrefix->text(), ui_configProject->icon->icon()); - projects->resizeColumnsToContents(); - projects->horizontalHeader()->setStretchLastSection(true); - emit projectAdded(ui_configProject->projectName->text(), ui_configProject->icon->icon()); - } - - delete ui_configProject; - delete configProject; -} - -void KdeObservatoryConfigProjects::on_psbRemoveProject_clicked() -{ - QTableWidgetItem *currentItem; - if ((currentItem = projects->currentItem())) - if (KMessageBox::questionYesNo(this, i18n("Are you sure you want to remove project '%1'?", projects->item(currentItem->row(), 0)->text() ), i18n("Remove project")) == KMessageBox::Yes) - { - QString projectName = currentItem->text(); - projects->removeRow(currentItem->row()); - emit projectRemoved(projectName); - } -} - -void KdeObservatoryConfigProjects::on_psbEditProject_clicked() -{ - QTableWidgetItem *currentItem; - if ((currentItem = projects->currentItem())) - { - QPointer configProjects = new KDialog(this); - configProjects->setButtons(KDialog::None); - Ui::KdeObservatoryConfigProject *ui_configProjects = new Ui::KdeObservatoryConfigProject; - ui_configProjects->setupUi(configProjects); - - int currentRow = projects->currentRow(); - ui_configProjects->projectName->setText(projects->item(currentRow, 0)->text()); - ui_configProjects->commitSubject->setText(projects->item(currentRow, 1)->text()); - ui_configProjects->krazyReport->setText(projects->item(currentRow, 2)->text()); - ui_configProjects->krazyFilePrefix->setText(projects->item(currentRow, 3)->text()); - ui_configProjects->icon->setIcon(projects->item(currentRow, 0)->data(Qt::UserRole).toString()); - - if (configProjects->exec() == KDialog::Accepted) - { - projects->item(currentRow, 0)->setText(ui_configProjects->projectName->text()); - projects->item(currentRow, 0)->setIcon(KIcon(ui_configProjects->icon->icon())); - projects->item(currentRow, 0)->setData(Qt::UserRole, ui_configProjects->icon->icon()); - projects->item(currentRow, 1)->setText(ui_configProjects->commitSubject->text()); - projects->item(currentRow, 2)->setText(ui_configProjects->krazyReport->text()); - projects->item(currentRow, 3)->setText(ui_configProjects->krazyFilePrefix->text()); - emit projectEdited(projects->item(currentRow, 0)->text()); - } - - delete ui_configProjects; - delete configProjects; - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.h b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.h deleted file mode 100644 index 38d71c80..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigprojects.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef KDEOBSERVATORYCONFIGPROJECTS_HEADER -#define KDEOBSERVATORYCONFIGPROJECTS_HEADER - -#include -#include "ui_kdeobservatoryconfigprojects.h" - -class KdeObservatoryConfigProjects : public QWidget, public Ui::KdeObservatoryConfigProjects -{ - Q_OBJECT -public: - explicit KdeObservatoryConfigProjects(QWidget *parent = 0, Qt::WindowFlags f = 0); - virtual ~KdeObservatoryConfigProjects(); - - void createTableWidgetItem(const QString &projectName, const QString &commitSubject, const QString &krazyReport, const QString &krazyFilePrefix, const QString &icon); - -Q_SIGNALS: - void projectAdded(const QString &projectName, const QString &icon); - void projectRemoved(const QString &projectName); - - // I've added the QString argument for feature possible use, don't know if it's really needed! - void projectEdited(const QString &projectName); - -public Q_SLOTS: - void on_psbAddProject_clicked(); - void on_psbRemoveProject_clicked(); - void on_psbEditProject_clicked(); -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.cpp b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.cpp deleted file mode 100644 index e27258c7..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "kdeobservatoryconfigviews.h" - -KdeObservatoryConfigViews::KdeObservatoryConfigViews(QWidget *parent, Qt::WindowFlags f) -: QWidget(parent, f) -{ - setupUi(this); - psbCheckAll->setIcon(KIcon("button_more")); - psbUncheckAll->setIcon(KIcon("button_fewer")); - m_lastView = views->currentText(); -} - -KdeObservatoryConfigViews::~KdeObservatoryConfigViews() -{ -} - -void KdeObservatoryConfigViews::projectAdded(const QString &projectName, const QString &icon) -{ - KdeObservatory::Project project; - project.icon = icon; - m_projects[projectName] = project; - QMapIterator i(m_projectsInView); - while (i.hasNext()) - { - i.next(); - QString view = i.key(); - m_projectsInView[view][projectName] = true; - } - on_views_currentIndexChanged(m_lastView); -} - -void KdeObservatoryConfigViews::projectRemoved(const QString &projectName) -{ - m_projects.remove(projectName); - QMapIterator i(m_projectsInView); - while (i.hasNext()) - { - i.next(); - QString view = i.key(); - m_projectsInView[view].remove(projectName); - } - updateView(m_lastView); -} - -void KdeObservatoryConfigViews::on_views_currentIndexChanged(QString view) -{ - int counter = projectsInView->count(); - for (int i = 0; i < counter; ++i) - { - QListWidgetItem *item = projectsInView->item(i); - m_projectsInView[m_lastView][item->text()] = item->checkState() == Qt::Checked ? true:false; - } - updateView(view); -} - -void KdeObservatoryConfigViews::updateView(const QString &view) -{ - projectsInView->clear(); - QHashIterator i(m_projectsInView[view]); - while (i.hasNext()) - { - i.next(); - QString project = i.key(); - QListWidgetItem *item = new QListWidgetItem(project, projectsInView); - item->setCheckState(i.value() ? Qt::Checked:Qt::Unchecked); - item->setIcon(KIcon(m_projects[project].icon)); - } - m_lastView = view; -} - -void KdeObservatoryConfigViews::on_tlbUp_clicked() -{ - swapViewItems(-1); -} - -void KdeObservatoryConfigViews::on_tlbDown_clicked() -{ - swapViewItems(1); -} - -void KdeObservatoryConfigViews::on_psbCheckAll_clicked() -{ - int counter = projectsInView->count(); - for (int i = 0; i < counter; ++i) - projectsInView->item(i)->setCheckState(Qt::Checked); -} - -void KdeObservatoryConfigViews::on_psbUncheckAll_clicked() -{ - int counter = projectsInView->count(); - for (int i = 0; i < counter; ++i) - projectsInView->item(i)->setCheckState(Qt::Unchecked); -} - -void KdeObservatoryConfigViews::swapViewItems(int updown) -{ - int linenumber = activeViews->currentRow(); - - if (linenumber + updown < activeViews->count()) - { - QListWidgetItem *item = activeViews->currentItem(); - activeViews->takeItem(linenumber); - activeViews->insertItem(linenumber + updown, item); - activeViews->setCurrentItem(item); - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.h b/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.h deleted file mode 100644 index fe0d8f2e..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/kdeobservatoryconfigviews.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef KDEOBSERVATORYCONFIGVIEWS_HEADER -#define KDEOBSERVATORYCONFIGVIEWS_HEADER - -#include - -#include "ui_kdeobservatoryconfigviews.h" -#include "kdeobservatory.h" - -class KdeObservatoryConfigViews : public QWidget, public Ui::KdeObservatoryConfigViews -{ - Q_OBJECT -public: - explicit KdeObservatoryConfigViews(QWidget *parent = 0, Qt::WindowFlags f = 0); - virtual ~KdeObservatoryConfigViews(); - - typedef QHash ViewProjects; - QMap m_projects; - QMap m_projectsInView; - -public Q_SLOTS: - void projectAdded(const QString &projectName, const QString &icon); - void projectRemoved(const QString &projectName); - void on_views_currentIndexChanged(QString view); - void updateView(const QString &view); - void on_tlbUp_clicked(); - void on_tlbDown_clicked(); - void on_psbCheckAll_clicked(); - void on_psbUncheckAll_clicked(); - -private: - void swapViewItems(int updown); - - QString m_lastView; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.cpp b/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.cpp deleted file mode 100644 index 97329480..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "krazyreportview.h" - -#include -#include - -#include -#include -#include - -KrazyReportView::KrazyReportView(KdeObservatory *kdeObservatory, const QHash &krazyReportViewProjects, const QMap &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags) -: IViewProvider(kdeObservatory, parent, wFlags), - m_krazyReportViewProjects(krazyReportViewProjects), - m_projects(projects) -{ -} - -KrazyReportView::~KrazyReportView() -{ -} - -void KrazyReportView::createViews() -{ - deleteViews(); - // We don't know in advance how many Krazy report views will be created - // so view creation is postponed to the updateViews function. -} - -void KrazyReportView::updateViews(const Plasma::DataEngine::Data &data) -{ - QString project = data["project"].toString(); - - KrazyReportMap krazyReportMap = data[project].value(); - - const QList &keys = krazyReportMap.keys(); - foreach (const QString &fileType, keys) - createView(i18nc("Krazy report for a given project %1", "Krazy Report - %1", project), QString("Krazy Report") + " - " + project + " - " + fileType); - - KrazyReportMapIterator i1(krazyReportMap); - - // For each file type - while (i1.hasNext()) - { - i1.next(); - - QString fileType = i1.key(); - const QMap< QString, FileTypeKrazyReportMap > &projectFileTypeKrazyReport = i1.value(); - - QGraphicsWidget *container = containerForView(QString("Krazy Report") + " - " + project + " - " + fileType); - if (!container) - return; - - QGraphicsTextItem *fileTypeText = new QGraphicsTextItem(fileType, container); - fileTypeText->setDefaultTextColor(QColor(0, 0, 0)); - fileTypeText->setFont(KGlobalSettings::smallestReadableFont()); - fileTypeText->setPos((qreal) ((container->rect().width())/2)-(fileTypeText->boundingRect().width()/2), (qreal) 0); - - int maxRank = 0; - qreal height = container->geometry().height() - fileTypeText->boundingRect().height(); - qreal step = qMin(container->geometry().width() / projectFileTypeKrazyReport.size(), (qreal) 22); - - QMultiMap orderedTestMap; - - QMapIterator< QString, FileTypeKrazyReportMap > i2(projectFileTypeKrazyReport); - int errors; - while (i2.hasNext()) - { - i2.next(); - errors = 0; - foreach (const QStringList &list, i2.value()) - errors += list.count(); - orderedTestMap.insert(errors, i2.key()); - } - - int j = 0; - QMapIterator i3(orderedTestMap); - i3.toBack(); - - // For each krazy test - while (i3.hasPrevious()) - { - i3.previous(); - QString testName = i3.value(); - int rank = i3.key(); - if (j == 0) - maxRank = rank; - - qreal heightFactor = height/maxRank; - qreal xItem = (j*step)+2; - - QGraphicsRectItem *testNameRect = new QGraphicsRectItem(0, 0, (qreal) step-4, (qreal) heightFactor*rank, container); - testNameRect->setPos(xItem, container->geometry().height() - testNameRect->rect().height()); - testNameRect->setPen(QPen(QColor(0, 0, 0))); - QColor color = QColor::fromHsv(qrand() % 256, 255, 190); - QLinearGradient grad (0.0, 0.0, 0.0, (qreal) heightFactor*rank); - grad.setColorAt(0, KColorUtils::darken(color, 0.8)); - grad.setColorAt(1, color); - testNameRect->setBrush(QBrush(grad)); - QString toolTipContents = i18np("%2 %1 error", "%2 %1 errors", rank, testName); - QString toolTip = "
" + toolTipContents + "
    "; - - const FileTypeKrazyReportMap &fileErrors = projectFileTypeKrazyReport[testName]; - QMapIterator i4(fileErrors); - while (i4.hasNext()) - { - i4.next(); - foreach (const QString &error, i4.value()) - toolTip += "
  • " + i4.key() + ": " + error + "
  • "; - } - - toolTip += "
"; - testNameRect->setToolTip(toolTip); - - testNameRect->setAcceptHoverEvents(true); - testNameRect->installSceneEventFilter(m_kdeObservatory); - - j++; - } - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.h b/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.h deleted file mode 100644 index a7c49fd3..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/krazyreportview.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef KRAZYREPORTVIEW_HEADER -#define KRAZYREPORTVIEW_HEADER - -#include "iviewprovider.h" - -#include "kdeobservatory.h" - -class KrazyReportView : public IViewProvider -{ -public: - KrazyReportView(KdeObservatory *kdeObservatory, const QHash &krazyReportViewProjects, const QMap &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0); - virtual ~KrazyReportView(); - - virtual void createViews(); - virtual void updateViews(const Plasma::DataEngine::Data &data); - -private: - const QHash &m_krazyReportViewProjects; - const QMap &m_projects; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.cpp b/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.cpp deleted file mode 100644 index 3ef48f06..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "topactiveprojectsview.h" - -#include -#include -#include - -#include -#include -#include - -TopActiveProjectsView::TopActiveProjectsView(KdeObservatory *kdeObservatory, const QHash &topActiveProjectsViewProjects, const QMap &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags) -: IViewProvider(kdeObservatory, parent, wFlags), - m_parent(parent), - m_topActiveProjectsViewProjects(topActiveProjectsViewProjects), - m_projects(projects) -{ -} - -TopActiveProjectsView::~TopActiveProjectsView() -{ -} - -void TopActiveProjectsView::createViews() -{ - deleteViews(); - createView(i18n("Top Active Projects"), "Top Active Projects"); -} - -void TopActiveProjectsView::updateViews(const Plasma::DataEngine::Data &data) -{ - QMultiMap topActiveProjects = data["topActiveProjects"].value< QMultiMap >(); - - QGraphicsWidget *container = containerForView("Top Active Projects"); - if (!container) - return; - - int maxRank = 0; - qreal width = container->geometry().width(); - qreal step = 22; - - QMapIterator i(topActiveProjects); - i.toBack(); - int j = 0; - while (i.hasPrevious()) - { - i.previous(); - QString project = i.value(); - if (m_topActiveProjectsViewProjects[project]) - { - int rank = i.key(); - if (j == 0) - maxRank = rank; - - qreal widthFactor = (width-24)/maxRank; - qreal yItem = (j*step)+2; - - if (yItem + step-4 > container->geometry().height()) - break; - - QGraphicsRectItem *projectRect = new QGraphicsRectItem(0, 0, (qreal) widthFactor*rank, (qreal) step-4, container); - projectRect->setPos(0, yItem); - projectRect->setPen(QPen(QColor(0, 0, 0))); - QColor color = QColor::fromHsv(qrand() % 256, 255, 190); - QLinearGradient grad (0.0, 0.0, (qreal) widthFactor*rank, 0.0); - grad.setColorAt(0, KColorUtils::darken(color, 0.8)); - grad.setColorAt(1, color); - projectRect->setBrush(QBrush(grad)); - projectRect->setToolTip(i18np("%2 - %1 commit", "%2 - %1 commits", rank, project)); - projectRect->setAcceptHoverEvents(true); - projectRect->installSceneEventFilter(m_kdeObservatory); - - QGraphicsPixmapItem *icon = new QGraphicsPixmapItem(KIcon(m_projects[project].icon).pixmap(22, 22), container); - icon->setPos((qreal) widthFactor*rank+2, (qreal) yItem+((step-4)/2)-11); - - QGraphicsTextItem *commitsNumber = new QGraphicsTextItem(QString::number(rank), projectRect); - commitsNumber->setDefaultTextColor(QColor(255, 255, 255)); - commitsNumber->setFont(KGlobalSettings::smallestReadableFont()); - commitsNumber->setPos((qreal) ((projectRect->rect().width())/2)-(commitsNumber->boundingRect().width()/2), - (qreal) ((projectRect->rect().height())/2)-(commitsNumber->boundingRect().height()/2)); - j++; - } - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.h b/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.h deleted file mode 100644 index 4698ee06..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/topactiveprojectsview.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef TOPACTIVEPROJECTSVIEW_HEADER -#define TOPACTIVEPROJECTSVIEW_HEADER - -#include "iviewprovider.h" - -#include "kdeobservatory.h" - -class TopActiveProjectsView : public IViewProvider -{ -public: - TopActiveProjectsView(KdeObservatory *kdeObservatory, const QHash &topActiveProjectsViewProjects, const QMap &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0); - virtual ~TopActiveProjectsView(); - - virtual void createViews(); - virtual void updateViews(const Plasma::DataEngine::Data &data); - -private: - QGraphicsWidget *m_parent; - const QHash &m_topActiveProjectsViewProjects; - const QMap &m_projects; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.cpp b/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.cpp deleted file mode 100644 index b5f399cc..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#include "topdevelopersview.h" - -#include -#include - -#include -#include -#include - -TopDevelopersView::TopDevelopersView(KdeObservatory *kdeObservatory, const QHash &topDevelopersViewProjects, const QMap &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags) -: IViewProvider(kdeObservatory, parent, wFlags), - m_topDevelopersViewProjects(topDevelopersViewProjects), - m_projects(projects) -{ -} - -TopDevelopersView::~TopDevelopersView() -{ -} - -void TopDevelopersView::createViews() -{ - deleteViews(); - QHashIterator i(m_topDevelopersViewProjects); - while (i.hasNext()) - { - i.next(); - if (i.value()) - createView(i18n("Top Developers - %1", i.key()), QString("Top Developers") + " - " + i.key()); - } -} - -void TopDevelopersView::updateViews(const Plasma::DataEngine::Data &data) -{ - QString project = data["project"].toString(); - - RankValueMap topProjectDevelopers = data[project].value(); - - QGraphicsWidget *container = containerForView(QString("Top Developers") + " - " + project); - if (!container) - return; - - int maxRank = 0; - qreal width = container->geometry().width(); - qreal step = 22; - - RankValueMapIterator i(topProjectDevelopers); - i.toBack(); - int j = 0; - while (i.hasPrevious()) - { - i.previous(); - QString developer = i.value(); - int rank = i.key(); - if (j == 0) - maxRank = rank; - - qreal widthFactor = (width-24)/maxRank; - qreal yItem = (j*step)+2; - - if (yItem + step-4 > container->geometry().height()) - break; - - QGraphicsRectItem *developerRect = new QGraphicsRectItem(0, 0, (qreal) widthFactor*rank, (qreal) step-4, container); - developerRect->setPos(0, yItem); - developerRect->setPen(QPen(QColor(0, 0, 0))); - QColor color = QColor::fromHsv(qrand() % 256, 255, 190); - QLinearGradient grad (0.0, 0.0, (qreal) widthFactor*rank, 0.0); - grad.setColorAt(0, KColorUtils::darken(color, 0.8)); - grad.setColorAt(1, color); - developerRect->setBrush(QBrush(grad)); - developerRect->setToolTip(i18np("%2 - %1 commit", "%2 - %1 commits", rank, developer)); - developerRect->setAcceptHoverEvents(true); - developerRect->installSceneEventFilter(m_kdeObservatory); - - QGraphicsTextItem *commitsNumber = new QGraphicsTextItem(developer.split(' ')[0], developerRect); - commitsNumber->setDefaultTextColor(QColor(255, 255, 255)); - commitsNumber->setFont(KGlobalSettings::smallestReadableFont()); - commitsNumber->setPos((qreal) 0, (qreal) ((developerRect->rect().height())/2)-(commitsNumber->boundingRect().height()/2)); - j++; - } -} diff --git a/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.h b/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.h deleted file mode 100644 index 0f2c8340..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/topdevelopersview.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * ***********************************************************************/ - -#ifndef TOPDEVELOPERSVIEW_HEADER -#define TOPDEVELOPERSVIEW_HEADER - -#include "iviewprovider.h" - -#include "kdeobservatory.h" - -class TopDevelopersView : public IViewProvider -{ -public: - TopDevelopersView(KdeObservatory *kdeObservatory, const QHash &topDevelopersViewProjects, const QMap &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0); - virtual ~TopDevelopersView(); - - virtual void createViews(); - virtual void updateViews(const Plasma::DataEngine::Data &data); - -private: - const QHash &m_topDevelopersViewProjects; - const QMap &m_projects; -}; - -#endif diff --git a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfiggeneral.ui b/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfiggeneral.ui deleted file mode 100644 index bb3e0953..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfiggeneral.ui +++ /dev/null @@ -1,329 +0,0 @@ - - - KdeObservatoryConfigGeneral - - - - 0 - 0 - 552 - 362 - - - - - - - Activity Range - - - - - - - - &Full history - - - - - - - - - &Past - - - true - - - - - - - - 0 - 0 - - - - - 46 - 25 - - - - - 46 - 25 - - - - 1 - - - 30 - - - 7 - - - - - - - - 0 - 0 - - - - days - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 106 - 44 - - - - - - - - - - - - Fro&m - - - - - - - false - - - - 0 - 0 - - - - - 222 - 182 - - - - - - - - - 0 - 0 - - - - to - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 0 - - - - - 222 - 182 - - - - - - - - - - - - Qt::Horizontal - - - - 0 - 233 - - - - - - - - - - - 0 - - - - - &Enable automatic view change - - - true - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 27 - 44 - - - - - - - - - 0 - 0 - - - - Change view every: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - hh 'Hours' mm 'Mins' ss 'Secs' - - - - - - - Qt::Horizontal - - - - 133 - 20 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 112 - - - - - - - - - KDatePicker - QFrame -
kdatepicker.h
-
-
- - activitiesInPastDays - commitExtent - activitiesInRange - enableAutoViewChange - viewsDelay - - - - - enableAutoViewChange - toggled(bool) - viewsDelay - setEnabled(bool) - - - 162 - 306 - - - 293 - 341 - - - - - activitiesInPastDays - toggled(bool) - commitExtent - setEnabled(bool) - - - 44 - 92 - - - 111 - 94 - - - - -
diff --git a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigproject.ui b/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigproject.ui deleted file mode 100644 index 98895e56..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigproject.ui +++ /dev/null @@ -1,223 +0,0 @@ - - - KdeObservatoryConfigProject - - - - 0 - 0 - 411 - 235 - - - - - 0 - 0 - - - - - 411 - 235 - - - - - 411 - 235 - - - - - - - - - Project name: - - - - - - - - - - Commit subject: - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Prefix used for this project in kde-commits mailing list.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Ex:</span> KDE/kdebase/runtime/plasma/</p></body></html> - - - - - - - Icon: - - - - - - - - 0 - 0 - - - - - 60 - 60 - - - - - 60 - 60 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Krazy report: - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Krazy report web address for this project.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Format:</span> http://www.englishbreakfastnetwork.org/krazy/<span style=" font-style:italic;">&lt;krazy-report&gt;</span> <span style=" font-weight:600;">or </span>http://www.englishbreakfastnetwork.org/krazy/index.php?<span style=" font-style:italic;">&lt;krazy-component-module&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Ex:</span> http://www.englishbreakfastnetwork.org/krazy/<span style=" font-weight:600; font-style:italic;">reports/kde-4.x/kdebase-runtime/plasma</span>/<span style=" font-weight:600; font-style:italic;">index.html</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">or</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">http://www.englishbreakfastnetwork.org/krazy/index.php?<span style=" font-weight:600; font-style:italic;">component=kde-4.x&amp;module=kdevelop</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> - - - - - - - Krazy file identifier: - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Sub-string that must appear in files belonging to this project. Leave it blank if all files in Krazy report belong to this project or a component-module address was given.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ex: for a plasmoid in playground, <span style=" text-decoration: underline;">Krazy report</span> would be "playground/base/plasma" and <span style=" text-decoration: underline;">Krazy file identifier</span> would be "&lt;plasmoid-directory&gt;".</p></body></html> - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - KIconButton - QPushButton -
kicondialog.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
-
- - projectName - commitSubject - krazyReport - krazyFilePrefix - icon - buttonBox - - - - - buttonBox - accepted() - KdeObservatoryConfigProject - accept() - - - 222 - 128 - - - 409 - 44 - - - - - buttonBox - rejected() - KdeObservatoryConfigProject - reject() - - - 195 - 128 - - - 405 - 80 - - - - -
diff --git a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigprojects.ui b/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigprojects.ui deleted file mode 100644 index 7d9fd350..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigprojects.ui +++ /dev/null @@ -1,183 +0,0 @@ - - - KdeObservatoryConfigProjects - - - - 0 - 0 - 543 - 248 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 13 - 47 - - - - - - - - - - - - - 406 - 0 - - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - - Project - - - - - Commit Subject - - - - - Krazy Report - - - - - Krazy File Identifier - - - - - - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - - 85 - 16777215 - - - - &Add - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - - 85 - 16777215 - - - - &Remove - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - - 85 - 16777215 - - - - &Edit - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - - - - - KPushButton - QPushButton -
kpushbutton.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigviews.ui b/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigviews.ui deleted file mode 100644 index 83cc9784..00000000 --- a/kdeplasma-addons/applets/kdeobservatory/src/ui/kdeobservatoryconfigviews.ui +++ /dev/null @@ -1,344 +0,0 @@ - - - KdeObservatoryConfigViews - - - - 0 - 0 - 393 - 364 - - - - - - - - 0 - 0 - - - - Active views: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 13 - 47 - - - - - - - - - - - 0 - 123 - - - - - Top Active Projects - - - Checked - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png - - - - - Commit History - - - Checked - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png - - - - - Top Developers - - - Checked - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png - - - - - Krazy Report - - - Checked - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png - - - - - - - - - - ... - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/go-up.png../../../../../usr/share/icons/oxygen/16x16/actions/go-up.png - - - - - - - ... - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/go-down.png../../../../../usr/share/icons/oxygen/16x16/actions/go-down.png - - - - - - - Qt::Vertical - - - - 20 - 18 - - - - - - - - - - - - View Configuration - - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - View: - - - - - - - - Top Active Projects - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png - - - - - Top Developers - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png - - - - - Commit History - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png - - - - - Krazy Report - - - - ../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png - - - - - - - - - - - 0 - 0 - - - - Projects in view: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 85 - - - - - - - - - - - 0 - 0 - - - - - 105 - 0 - - - - - 105 - 16777215 - - - - &Check All - - - - - - - - 0 - 0 - - - - - 105 - 0 - - - - - 105 - 16777215 - - - - &Uncheck All - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 13 - 47 - - - - - - - - - KPushButton - QPushButton -
kpushbutton.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/konqprofiles/CMakeLists.txt b/kdeplasma-addons/applets/konqprofiles/CMakeLists.txt deleted file mode 100644 index afbca256..00000000 --- a/kdeplasma-addons/applets/konqprofiles/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -project(konqprofiles) - -install(DIRECTORY package/ - DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/konqprofiles) - -install(FILES package/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-applet-konqprofiles.desktop) diff --git a/kdeplasma-addons/applets/konqprofiles/Messages.sh b/kdeplasma-addons/applets/konqprofiles/Messages.sh deleted file mode 100644 index 89b380aa..00000000 --- a/kdeplasma-addons/applets/konqprofiles/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT `find . -name \*.qml` -L Java -o $podir/konqprofiles.pot -rm -f rc.cpp - diff --git a/kdeplasma-addons/applets/konqprofiles/package/contents/ui/konqprofiles.qml b/kdeplasma-addons/applets/konqprofiles/package/contents/ui/konqprofiles.qml deleted file mode 100644 index 4ad73b5b..00000000 --- a/kdeplasma-addons/applets/konqprofiles/package/contents/ui/konqprofiles.qml +++ /dev/null @@ -1,164 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2011, 2012 by Shaun Reich * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - *****************************************************************************/ - -import QtQuick 1.1 -import org.kde.qtextracomponents 0.1 - -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents - -Item { - id: konqProfiles - - property int minimumWidth: 200 - property int minimumHeight: 300 - - function popupEventSlot(shown) { - if(shown) - view.forceActiveFocus(); - } - - PlasmaCore.DataSource { - id: profilesSource - engine: "org.kde.konqprofiles" - onSourceAdded: connectSource(source) - onSourceRemoved: disconnectSource(source) - - Component.onCompleted: connectedSources = sources - } - - PlasmaCore.DataModel { - id: profilesModel - dataSource: profilesSource - } - - Component.onCompleted: { - plasmoid.popupIcon = "konqueror"; - plasmoid.aspectRatioMode = IgnoreAspectRatio; - plasmoid.popupEvent.connect('popupEvent', popupEventSlot); - } - - PlasmaCore.Svg { - id: lineSvg - imagePath: "widgets/line" - } - - Row { - id: headerRow - anchors { left: parent.left; right: parent.right} - - QIconItem { - icon: QIcon("konqueror") - width: 32 - height: 32 - } - - PlasmaComponents.Label { - id: header - text: i18n("Konqueror Profiles") - anchors { horizontalCenter: parent.horizontalCenter } - horizontalAlignment: Text.AlignHCenter - } - } - - PlasmaCore.SvgItem { - id: separator - - anchors { left: headerRow.left; right: headerRow.right; top: headerRow.bottom } - svg: lineSvg - elementId: "horizontal-line" - height: lineSvg.elementSize("horizontal-line").height - } - - Text { - id: textMetric - visible: false - // translated but not used, we just need length/height - text: i18n("Arbitrary String Which Says The Dictionary Type") - } - - ListView { - id: view - - anchors { left: parent.left; right: scrollBar.left; bottom: parent.bottom; top: separator.bottom; topMargin: 5} - - model: profilesModel - clip: true - focus: true - - delegate: Item { - id: listdelegate - height: textMetric.paintedHeight * 2 - anchors { left: parent.left; leftMargin: 10; right: parent.right; } - - function openProfile() { - var service = profilesSource.serviceForSource(model["DataEngineSource"]) - var operation = service.operationDescription("open") - var job = service.startOperationCall(operation) - } - - PlasmaComponents.Label { - id: profileText - anchors.fill: parent - text: model.prettyName - } - - MouseArea { - height: parent.height + 15 - anchors { left: parent.left; right: parent.right;} - hoverEnabled: true - - onClicked: { - openProfile(); - } - - onEntered: { - view.currentIndex = index - view.highlightItem.opacity = 1 - } - - onExited: { - view.highlightItem.opacity = 0 - } - } - - Keys.onPressed: { - if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) - openProfile(); - } - } - - highlight: PlasmaComponents.Highlight { - hover: true - } - - highlightMoveDuration: 250 - highlightMoveSpeed: 1 - } - - PlasmaComponents.ScrollBar { - id: scrollBar - - anchors { bottom: parent.bottom; top: separator.top; right: parent.right } - - orientation: Qt.Vertical - stepSize: view.count / 4 - scrollButtonInterval: view.count / 4 - - flickableItem: view - } -} diff --git a/kdeplasma-addons/applets/konqprofiles/package/metadata.desktop b/kdeplasma-addons/applets/konqprofiles/package/metadata.desktop deleted file mode 100644 index 2b4172ae..00000000 --- a/kdeplasma-addons/applets/konqprofiles/package/metadata.desktop +++ /dev/null @@ -1,133 +0,0 @@ -[Desktop Entry] -Name=Konqueror Profiles -Name[ar]=تشكيلة كنيكر -Name[ast]=Perfiles de Konqueror -Name[bs]=Konqueror profili -Name[ca]=Perfils del Konqueror -Name[ca@valencia]=Perfils del Konqueror -Name[cs]=Profily Konqueroru -Name[da]=Konqueror-profiler -Name[de]=Konqueror-Profile -Name[el]=Προφίλ Konqueror -Name[en_GB]=Konqueror Profiles -Name[es]=Perfiles de Konqueror -Name[et]=Konquerori profiilid -Name[eu]=Konquerorren profilak -Name[fi]=Konqueror-profiilit -Name[fr]=Profils de Konqueror -Name[ga]=Próifílí Konqueror -Name[gl]=Perfís de Konqueror -Name[he]=הפרופילים של Konqueror -Name[hr]=Profili u Konqueroru -Name[hu]=Konqueror profilok -Name[is]=Konqueror snið -Name[it]=Profili di Konqueror -Name[ja]=Konqueror プロファイル -Name[kk]=Konqueror профильдері -Name[km]=ទម្រង់​របស់ Konqueror -Name[ko]=Konqueror 프로필 -Name[ku]=Profîlên Komqueror -Name[lt]=Konqueror profiliai -Name[lv]=Konqueror profili -Name[mr]=कॉन्करर रूपरेषा -Name[nb]=Konqueror-profiler -Name[nds]=Konqueror-Profilen -Name[nl]=Konqueror-profielen -Name[nn]=Konqueror-profilar -Name[pa]=ਕੋਨਕਿਊਰੋਰ ਪਰੋਫਾਇਲ -Name[pl]=Profile Konquerora -Name[pt]=Perfis do Konqueror -Name[pt_BR]=Perfis do Konqueror -Name[ro]=Profiluri Konqueror -Name[ru]=Konqueror: профили -Name[sk]=Profily Konquerora -Name[sl]=Profili za Konqueror -Name[sr]=К‑освајачеви профили -Name[sr@ijekavian]=К‑освајачеви профили -Name[sr@ijekavianlatin]=K‑osvajačevi profili -Name[sr@latin]=K‑osvajačevi profili -Name[sv]=Konquerorprofiler -Name[th]=โพรไฟล์ต่าง ๆ ของคอนเควอร์เรอร์ -Name[tr]=Konqueror Profilleri -Name[uk]=Профілі Konqueror -Name[wa]=Profils di Konqueror -Name[x-test]=xxKonqueror Profilesxx -Name[zh_CN]=Konqueror 配置集 -Name[zh_TW]=Konqueror 設定檔 -Comment=List and launch Konqueror profiles -Comment[ar]=تعرض و تطلق تشكيلات كنكير -Comment[ast]=Amuesa y anicia perfiles de Konqueror -Comment[bs]=Nabraja i pokreće profile Konquerora -Comment[ca]=Llista i executa els perfils del Konqueror -Comment[ca@valencia]=Llista i executa els perfils del Konqueror -Comment[cs]=Seznam a spouštění profilů Konqueroru -Comment[da]=Vis og start Konqueror-profiler. -Comment[de]=Konqueror-Profile anzeigen und starten -Comment[el]=Εμφάνιση και εκτέλεση προφίλ του Konqueror -Comment[en_GB]=List and launch Konqueror profiles -Comment[es]=Muestra e inicia perfiles de Konqueror -Comment[et]=Konquerori profiilide näitamine ja käivitamine -Comment[eu]=Zerrendatu eta jaurti Konquerorren profilak -Comment[fi]=Luettelee ja käynnistää Konqueror-profiileja -Comment[fr]=Permet d'afficher et de lancer des profils de Konqueror -Comment[ga]=Liostaigh agus tosaigh próifílí Konqueror -Comment[gl]=Enumera e inicia perfís de Konqueror -Comment[he]=הצג והפעל פרופילים של Konqueror -Comment[hr]=Navedi i pokreni profile u Konqueroru -Comment[hu]=Konqueror profilok listázása és indítása -Comment[is]=Listar upp og ræsir Konqueror snið -Comment[it]=Elenca ed esegue i profili di Konqueror -Comment[ja]=Konqueror のプロファイルを起動します -Comment[kk]=Konqueror профильдерін таңдап жегу -Comment[km]=រាយ និង​ចាប់ផ្ដើម​ទម្រង់​របស់ Konqueror -Comment[ko]=Konqueror 프로필을 보고 실행하기 -Comment[ku]=Profîlên Konqueror lîste bike û bide destpêkirin -Comment[lt]=Rikiuoti ir įkelti Konqueror profilius -Comment[lv]=Parāda un atver Konqueror profilus -Comment[mr]=कॉन्करर रूपरेषांची यादी व प्रक्षेपण करा -Comment[nb]=List opp og start Konqueror-profiler -Comment[nds]=Konqueror-Profilen oplisten un opropen -Comment[nl]=Toon en start Konqueror-profielen -Comment[nn]=Vis og start Konqueror-profilar -Comment[pa]=ਕੋਨਕਿਉਰੋਰ ਪਰੋਫਾਇਲ ਵੇਖੋ ਅਤੇ ਚਲਾਓ -Comment[pl]=Wypisywanie i uruchamianie profili Konquerora -Comment[pt]=Listar e invocar os perfis do Konqueror -Comment[pt_BR]=Lista e carrega os perfis do Konqueror -Comment[ro]=Enumeră și lansează profiluri Konqueror -Comment[ru]=Запуск Konqueror для разных задач -Comment[sk]=Zobrazenie a spustenie profilov Konquerora -Comment[sl]=Prikažite in zaženite profile Konquerorja -Comment[sr]=Набраја и покреће профиле К‑освајача -Comment[sr@ijekavian]=Набраја и покреће профиле К‑освајача -Comment[sr@ijekavianlatin]=Nabraja i pokreće profile K‑osvajača -Comment[sr@latin]=Nabraja i pokreće profile K‑osvajača -Comment[sv]=Lista och starta Konquerorprofiler -Comment[th]=เรียกรายการและเรียกใช้โพรไฟล์ต่าง ๆ ของคอนเควอร์เรอร์ -Comment[tr]=Konqueror profillerini listeleyin ve çalıştırın -Comment[uk]=Перегляньте список і запустіть профілі Konqueror -Comment[wa]=Fé l' djivêye des profils di Konqueror eyet ls enonder -Comment[x-test]=xxList and launch Konqueror profilesxx -Comment[zh_CN]=罗列和启动 Konqueror 配置集 -Comment[zh_TW]=列出並啟動 Konqueror 設定檔 - -Icon=konqueror -Type=Service -X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/konqprofiles.qml -X-Plasma-DefaultSize=200,200 - -X-KDE-PluginInfo-Author=Shaun Reich -X-KDE-PluginInfo-Email=shaun.reich@kdemail.net -X-KDE-PluginInfo-Name=konqprofiles -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://userbase.kde.org/Plasma -X-KDE-PluginInfo-Category=Utilities -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - -#X-Plasma-Requires-FileDialog=Unused -#X-Plasma-Requires-LaunchApp=Required -#X-Plasma-NotificationArea=true diff --git a/kdeplasma-addons/applets/microblog/CMakeLists.txt b/kdeplasma-addons/applets/microblog/CMakeLists.txt deleted file mode 100644 index 543e899d..00000000 --- a/kdeplasma-addons/applets/microblog/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -project(plasma-microblog) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ) - -set(microblog_SRCS - microblog.cpp - postwidget.cpp - configuration.ui -) - -kde4_add_plugin(plasma_applet_microblog ${microblog_SRCS}) -target_link_libraries(plasma_applet_microblog ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS}) - -install(TARGETS plasma_applet_microblog DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-applet-microblog.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - -install(FILES - microblog.svgz - DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/) - diff --git a/kdeplasma-addons/applets/microblog/Messages.sh b/kdeplasma-addons/applets/microblog/Messages.sh deleted file mode 100755 index 621f8024..00000000 --- a/kdeplasma-addons/applets/microblog/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_applet_microblog.pot diff --git a/kdeplasma-addons/applets/microblog/configuration.ui b/kdeplasma-addons/applets/microblog/configuration.ui deleted file mode 100644 index 79bd1222..00000000 --- a/kdeplasma-addons/applets/microblog/configuration.ui +++ /dev/null @@ -1,289 +0,0 @@ - - - TwitterConfig - - - - 0 - 0 - 504 - 292 - - - - - - - - 75 - true - - - - Login - - - - - - - Password: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - passwordEdit - - - - - - - QLineEdit::Password - - - true - - - - - - - - 75 - true - - - - Appearance - - - - - - - Timeline size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - historySizeSpinBox - - - - - - - - - 500 - - - 3 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Timeline refresh: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - historyRefreshSpinBox - - - - - - - - - 2 - - - 999 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Show friends: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - checkIncludeFriends - - - - - - - - - - true - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - - 75 - true - - - - Service - - - - - - - Username: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - usernameEdit - - - - - - - - - - Service URL: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - serviceUrlCombo - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - true - - - - - - - - KIntSpinBox - QSpinBox -
knuminput.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - serviceUrlCombo - usernameEdit - passwordEdit - historySizeSpinBox - historyRefreshSpinBox - checkIncludeFriends - - - -
diff --git a/kdeplasma-addons/applets/microblog/microblog.cpp b/kdeplasma-addons/applets/microblog/microblog.cpp deleted file mode 100644 index f9999957..00000000 --- a/kdeplasma-addons/applets/microblog/microblog.cpp +++ /dev/null @@ -1,1042 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by André Duffeck * - * Copyright (C) 2007 Chani Armitage * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#include "microblog.h" -#include "postwidget.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -Q_DECLARE_METATYPE(Plasma::DataEngine::Data) - -MicroBlog::MicroBlog(QObject *parent, const QVariantList &args) - : Plasma::PopupApplet(parent, args), - m_graphicsWidget(0), - m_historySize(0), - m_historyRefresh(0), - m_newTweets(0), - m_includeFriends(false), - m_lastMode(0), - m_profileService(0), - m_lastTweet(0), - m_wallet(0), - m_walletWait(None), - m_colorScheme(0), - m_showTweetsTimer(0), - m_getWalletDelayTimer(0) -{ - setAspectRatioMode(Plasma::IgnoreAspectRatio); - setHasConfigurationInterface(true); - setPopupIcon("view-pim-journal"); - setAssociatedApplication("choqok"); -} - -void MicroBlog::init() -{ - m_engine = dataEngine("microblog"); - m_flash = new Plasma::FlashingLabel(this); - m_theme = new Plasma::Svg(this); - m_theme->setImagePath("widgets/microblog"); - m_theme->setContainsMultipleImages(true); - configChanged(); -} - -void MicroBlog::constraintsEvent(Plasma::Constraints constraints) -{ - //i am an icon? - if ((constraints|Plasma::SizeConstraint || constraints|Plasma::FormFactorConstraint) && - layout() && layout()->itemAt(0) != m_graphicsWidget) { - paintIcon(); - } -} - -void MicroBlog::paintIcon() -{ - int size = qMin(contentsRect().width(), contentsRect().height()); - if (size < 1) { - size = KIconLoader::SizeSmall; - } - - QPixmap icon(size, size); - if (m_popupIcon.isNull()) { - icon = KIconLoader::global()->loadIcon("view-pim-journal", KIconLoader::NoGroup, size); - } else { - icon.fill(Qt::transparent); - } - - QPainter p(&icon); - p.setRenderHints(QPainter::SmoothPixmapTransform); - p.drawPixmap(icon.rect(), m_popupIcon, m_popupIcon.rect()); - //4.3: a notification system for popupapplets would be cool - if (m_newTweets > 0) { - QFont font = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont); - QFontMetrics fm(font); - QRect textRect(fm.boundingRect(QString::number(m_newTweets))); - int textSize = qMax(textRect.width(), textRect.height()); - textRect.setSize(QSize(textSize, textSize)); - textRect.moveBottomRight(icon.rect().bottomRight()); - - QColor c(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - c.setAlphaF(0.6); - - p.setBrush(c); - p.setPen(Qt::NoPen); - p.setRenderHints(QPainter::Antialiasing); - p.drawEllipse(textRect); - - p.setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - p.drawText(textRect, Qt::AlignCenter, QString::number(m_newTweets)); - } - p.end(); - - setPopupIcon(icon); -} - -void MicroBlog::popupEvent(bool show) -{ - if (show) { - m_newTweets = 0; - paintIcon(); - } -} - -void MicroBlog::focusInEvent(QFocusEvent *event) -{ - Q_UNUSED(event); - - m_statusEdit->setFocus(); -} - -QGraphicsWidget *MicroBlog::graphicsWidget() -{ - if (m_graphicsWidget) { - return m_graphicsWidget; - } - - m_graphicsWidget = new QGraphicsWidget(this); - m_graphicsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - m_colorScheme = new KColorScheme(QPalette::Active, KColorScheme::View, Plasma::Theme::defaultTheme()->colorScheme()); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(themeChanged())); - - //ui setup - m_layout = new QGraphicsLinearLayout( Qt::Vertical, m_graphicsWidget ); - m_layout->setSpacing( 3 ); - - QGraphicsLinearLayout *flashLayout = new QGraphicsLinearLayout( Qt::Horizontal ); - flashLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - m_flash->setAutohide( true ); - m_flash->setMinimumSize( 0, 20 ); - QFont fnt = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont); - fnt.setBold( true ); - QFontMetrics fm( fnt ); - m_flash->setFont( fnt ); - m_flash->flash( "", 20000 ); - m_flash->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout(Qt::Vertical); - Plasma::SvgWidget *svgTitle = new Plasma::SvgWidget(m_theme, "microblog", this); - svgTitle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - svgTitle->setPreferredSize(m_theme->elementSize("microblog")); - titleLayout->addItem(svgTitle); - - flashLayout->addItem(m_flash); - flashLayout->addItem(titleLayout); - - m_layout->addItem(flashLayout); - - m_headerFrame = new Plasma::Frame(this); - m_headerLayout = new QGraphicsAnchorLayout(m_headerFrame); - m_headerLayout->setSpacing( 5 ); - - m_icon = new Plasma::IconWidget(m_headerFrame); - m_icon->setIcon(KIcon("user-identity")); - m_icon->setText(m_username); - m_icon->setTextBackgroundColor(QColor()); - QSizeF iconSize = m_icon->sizeFromIconSize(48); - m_icon->setMinimumSize( iconSize ); - m_icon->setMaximumSize( iconSize ); - m_headerLayout->addAnchor(m_icon, Qt::AnchorVerticalCenter, m_headerLayout, Qt::AnchorVerticalCenter); - m_headerLayout->addAnchor(m_icon, Qt::AnchorLeft, m_headerLayout, Qt::AnchorLeft); - - Plasma::Frame *statusEditFrame = new Plasma::Frame(m_headerFrame); - - statusEditFrame->setFrameShadow(Plasma::Frame::Sunken); - QGraphicsLinearLayout *statusEditLayout = new QGraphicsLinearLayout(statusEditFrame); - m_statusEdit = new Plasma::TextEdit(this); - m_statusEdit->setPreferredHeight(fm.height() * 4); - m_statusEdit->setEnabled(!configurationRequired()); - - statusEditLayout->addItem(m_statusEdit); - - //FIXME: m_statusEdit->setTextColor( m_colorScheme->foreground().color() ); - // seems to have no effect - QPalette editPal = m_statusEdit->palette(); - editPal.setColor(QPalette::Text, m_colorScheme->foreground().color()); - m_statusEdit->nativeWidget()->setPalette(editPal); - m_statusEdit->nativeWidget()->installEventFilter(this); - m_headerLayout->addAnchor(m_icon, Qt::AnchorRight, statusEditFrame, Qt::AnchorLeft); - m_headerLayout->addAnchors(statusEditFrame, m_headerLayout, Qt::Vertical); - m_headerLayout->addAnchor(statusEditFrame, Qt::AnchorRight, m_headerLayout, Qt::AnchorRight); - m_headerLayout->activate(); - m_headerLayout->setMaximumHeight(m_headerLayout->effectiveSizeHint(Qt::PreferredSize).height()); - - m_tabBar = new Plasma::TabBar(this); - m_tabBar->addTab(i18n("Timeline")); - m_tabBar->addTab(i18n("Replies")); - m_tabBar->addTab(i18n("Messages")); - m_layout->addItem(m_tabBar); - - m_scrollWidget = new Plasma::ScrollWidget(this); - m_tweetsWidget = new QGraphicsWidget(m_scrollWidget); - m_scrollWidget->setWidget(m_tweetsWidget); - m_tweetsLayout = new QGraphicsLinearLayout(Qt::Vertical, m_tweetsWidget); - m_tweetsLayout->setSpacing(0); - m_tweetsLayout->addItem(m_headerFrame); - - m_layout->addItem(m_scrollWidget); - - m_graphicsWidget->setPreferredSize(300, 400); - - if(m_engine->isValid()) { - connect(m_statusEdit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); - connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(modeChanged(int))); - - m_tabBar->nativeWidget()->installEventFilter(this); - - if (!m_imageQuery.isEmpty()) { - m_engine->connectSource(m_imageQuery, this); - } - } - else { - const QString failureMessage = i18n("Failed to load twitter DataEngine"); - QGraphicsWidget *failureWidget = new QGraphicsWidget(this); - QGraphicsLinearLayout *failureLayout = new QGraphicsLinearLayout(failureWidget); - Plasma::IconWidget *failureIcon = new Plasma::IconWidget(this); - Plasma::Label *failureLabel = new Plasma::Label(this); - - failureLayout->setContentsMargins(0, 0, 0, 0); - failureIcon->setIcon(KIcon("dialog-error")); - failureLayout->addItem(failureIcon); - failureLabel->setText(failureMessage); - failureLabel->nativeWidget()->setWordWrap(true); - failureLayout->addItem(failureLabel); - - Plasma::ToolTipManager::self()->registerWidget(failureIcon); - Plasma::ToolTipContent data(i18n("Unable to load the widget"), failureMessage, KIcon("dialog-error")); - Plasma::ToolTipManager::self()->setContent(failureIcon, data); - - m_tweetsLayout->addItem(failureWidget); - } - - return m_graphicsWidget; -} - -void MicroBlog::configChanged() -{ - //config stuff - KConfigGroup cg = config(); - QString serviceUrl = cg.readEntry("serviceUrl", "https://identi.ca/api/"); - QString username = cg.readEntry("username"); - QString password = KStringHandler::obscure(cg.readEntry("password")); - int historySize = cg.readEntry("historySize", 6); - int historyRefresh = cg.readEntry("historyRefresh", 5); - bool includeFriends = cg.readEntry("includeFriends", true); - bool changed = false; - bool reloadRequired = false; - - if (m_serviceUrl != serviceUrl) { - m_serviceUrl = serviceUrl; - changed = true; - reloadRequired = true; - } - - if (username != m_username) { - m_username = username; - changed = true; - reloadRequired = true; - m_tweetMap.clear(); - m_lastTweet = 0; - - if (m_graphicsWidget) { - m_icon->setIcon(KIcon("user-identity")); - m_icon->setText(m_username); - } - } - - //if (m_walletWait == Read) - //then the user is a dumbass. - //we're going to ignore that, which drops the read attempt - //I hope that doesn't cause trouble. - if (!m_username.isEmpty() && (changed || m_password.isEmpty())) { - //a change in name *or* pass means we need to update the wallet - //if the user doesn't set a password, see if it's already in our wallet - m_walletWait = m_password.isEmpty() ? Read : Write; - getWallet(); - reloadRequired = true; - } - - if (m_historyRefresh != historyRefresh) { - changed = true; - m_historyRefresh = historyRefresh; - } - - if (m_includeFriends != includeFriends) { - changed = true; - reloadRequired = true; - m_includeFriends = includeFriends; - m_tweetMap.clear(); - m_lastTweet = 0; - } - - if (m_historySize != historySize) { - //kDebug() << "m_historysize,historysize: "<disconnectSource(m_imageQuery, this); - } - - m_imageQuery = "UserImages:" + m_serviceUrl; - if (m_graphicsWidget) { - m_engine->connectSource(m_imageQuery, this); - } - - if (m_username.isEmpty()) { - setAuthRequired(true); - } else if (m_password.isEmpty()) { - //kDebug() << "started, password is not in config file, trying wallet"; - m_walletWait = Read; - getWallet(); - } else { //use config value - //kDebug() << "password was in config file, using that to get twitter history"; - reloadRequired = true; - } - - if (changed) { - if (m_service) { - m_service.data()->deleteLater(); - } - - if (m_profileService) { - m_profileService->deleteLater(); - m_profileService = 0; - } - } - - if (reloadRequired) { - m_lastTweet = 0; - downloadHistory(); - } - - setAuthRequired(m_username.isEmpty()); -} - -void MicroBlog::modeChanged(int) -{ - m_tweetMap.clear(); - m_lastTweet = 0; - downloadHistory(); -} - -void MicroBlog::reply(const QString &replyToId, const QString &to) -{ - m_replyToId = replyToId; - m_scrollWidget->ensureItemVisible(m_headerFrame); - m_statusEdit->nativeWidget()->setPlainText(to); - QTextCursor cursor = m_statusEdit->nativeWidget()->textCursor(); - cursor.movePosition(QTextCursor::End); - m_statusEdit->nativeWidget()->setTextCursor(cursor); - m_statusEdit->setFocus(); -} - -void MicroBlog::forward(const QString &messageId) -{ - createTimelineService(); - - if (!m_service) { - return; - } - - KConfigGroup cg = m_service.data()->operationDescription("statuses/retweet"); - cg.writeEntry("id", messageId); - - connect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(retweetCompleted(Plasma::ServiceJob*)), Qt::UniqueConnection); - - m_retweetJobs.insert(m_service.data()->startOperationCall(cg)); - setBusy(true); -} - -void MicroBlog::favorite(const QString &messageId, const bool isFavorite) -{ - QString operation; - if (isFavorite) { - operation = "favorites/create"; - } else { - operation = "favorites/destroy"; - } - - KConfigGroup cg = m_service.data()->operationDescription(operation); - cg.writeEntry("id", messageId); - - connect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(favoriteCompleted(Plasma::ServiceJob*)), Qt::UniqueConnection); - - m_favoriteJobs.insert(m_service.data()->startOperationCall(cg)); - setBusy(true); -} - -void MicroBlog::getWallet() -{ - //TODO: maybe Plasma in general should handle the wallet - delete m_wallet; - m_wallet = 0; - - QGraphicsView *v = view(); - WId w = 0; - if (v) { - w = v->winId(); - } - - if (!w) { - //KWallet requires a valid window id to work, wait until we have one - if (!m_getWalletDelayTimer) { - m_getWalletDelayTimer = new QTimer(this); - m_getWalletDelayTimer->setSingleShot(true); - m_getWalletDelayTimer->setInterval(100); - connect(m_getWalletDelayTimer, SIGNAL(timeout()), this, SLOT(getWallet())); - } - - if (!m_getWalletDelayTimer->isActive()) { - m_getWalletDelayTimer->start(); - } - - return; - } else { - delete m_getWalletDelayTimer; - m_getWalletDelayTimer = 0; - } - - //kDebug() << "opening wallet"; - m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), - w, KWallet::Wallet::Asynchronous); - - if (m_walletWait == Write) { - connect(m_wallet, SIGNAL(walletOpened(bool)), SLOT(writeWallet(bool))); - } else { - connect(m_wallet, SIGNAL(walletOpened(bool)), SLOT(readWallet(bool))); - } -} - -void MicroBlog::writeWallet(bool success) -{ - //kDebug() << success; - if (success && - enterWalletFolder(QString::fromLatin1("Plasma-MicroBlog")) && - (m_wallet->writePassword(identifier(), m_password) == 0)) { - //kDebug() << "successfully put password in wallet, removing from config file"; - config().deleteEntry("password"); - emit configNeedsSaving(); - } else { - //kDebug() << "failed to store password in wallet, putting into config file instead"; - writeConfigPassword(); - } - m_walletWait = None; - delete m_wallet; - m_wallet = 0; -} - -void MicroBlog::readWallet(bool success) -{ - //kDebug() << success; - QString pwd; - if (success && - enterWalletFolder(QString::fromLatin1("Plasma-MicroBlog")) && - (m_wallet->readPassword(identifier(), pwd) == 0)) { - //kDebug() << "successfully retrieved password from wallet"; - m_password = pwd; - downloadHistory(); - } else if (m_password.isEmpty()) { - //FIXME: when out of string freeze, tell the user WHY they need - // to configure the widget; - m_password = KStringHandler::obscure(config().readEntry("password")); - if(m_password.isEmpty()){ - setConfigurationRequired(true, i18n("Your password is required.")); - }else{ - //kDebug() << "reading from config"; - //kDebug() << "failed to read password"; - downloadHistory(); - } - } - - m_walletWait = None; - delete m_wallet; - m_wallet = 0; -} - -bool MicroBlog::enterWalletFolder(const QString &folder) -{ - //TODO: seems a bit silly to have a function just for this here - //why doesn't kwallet have this itself? - m_wallet->createFolder(folder); - if (! m_wallet->setFolder(folder)) { - //kDebug() << "failed to open folder" << folder; - return false; - } - - //kDebug() << "wallet now on folder" << folder; - return true; -} - -void MicroBlog::setAuthRequired(bool required) -{ - setConfigurationRequired(required, i18n("Your account information is incomplete.")); - if (m_graphicsWidget) { - m_statusEdit->setEnabled(!required); - } -} - -void MicroBlog::writeConfigPassword() -{ - //kDebug(); - //TODO: don't use "Yes" and "No", but replace with meaningful labels! - if (KMessageBox::warningYesNo(0, i18n("Failed to access kwallet. Store password in config file instead?")) - == KMessageBox::Yes) { - config().writeEntry("password", KStringHandler::obscure(m_password)); - } -} - -void MicroBlog::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data) -{ - //kDebug() << source << data.count() << m_curTimeline; - if (data.isEmpty()) { - if (source.startsWith(QLatin1String("Error"))) { - m_flash->kill(); //FIXME only clear it if it was showing an error msg - } else { - //this is a fake update from a new source - return; - } - } - - if (source == m_curTimeline) { - m_flash->flash( i18n("Refreshing timeline...") ); - - //add the newbies - int newCount = 0; - qulonglong maxId = m_lastTweet; - foreach (const QString &id, data.keys()) { - - qulonglong i = id.toULongLong(); - //kDebug() << i << m_lastTweet; - if (i > m_lastTweet) { - newCount++; - } - - QVariant v = data.value(id); - //Warning: This function is not available with MSVC 6 - Plasma::DataEngine::Data t = v.value(); - m_tweetMap[i] = t; - - if (i > maxId) { - maxId = i; - } - } - //kDebug() << m_lastTweet << maxId << "<-- updated"; - m_lastTweet = maxId; - m_newTweets = qMin(newCount, m_historySize); - - if (m_newTweets > 0) { - m_flash->flash( i18np( "1 new tweet", "%1 new tweets", m_newTweets ), 20*1000 ); - } - - scheduleShowTweets(); - } else if (source == m_imageQuery) { - foreach (const QString &user, data.keys()) { - QPixmap pm = data[user].value(); - - if (!pm.isNull()) { - if (!user.compare(m_username, Qt::CaseInsensitive)) { - QAction *profile = new QAction(QIcon(pm), m_username, this); - profile->setData(m_username); - - QSizeF iconSize = m_icon->sizeFromIconSize(48); - m_icon->setAction(profile); - m_icon->setMinimumSize( iconSize ); - m_icon->setMaximumSize( iconSize ); - connect(profile, SIGNAL(triggered()), this, SLOT(openProfile())); - } - m_pictureMap[user] = pm; - m_avatarHistory.removeAll(user); - m_avatarHistory.append(user); - while (m_avatarHistory.size() > 30) { - QString oldestUser = m_avatarHistory.first(); - m_avatarHistory.pop_front(); - m_pictureMap.remove(oldestUser); - } - //TODO it would be nice to check whether the updated image is actually in use - scheduleShowTweets(); - } - } - } else if (source.startsWith(QLatin1String("Error"))) { - QString desc = data["description"].toString(); - - if (desc == "Authentication required"){ - setAuthRequired(true); - } - - m_flash->flash(desc, 60 * 1000); //I'd really prefer it to stay there. and be red. - } - m_graphicsWidget->setPreferredSize(-1, -1); - emit sizeHintChanged(Qt::PreferredSize); -} - -void MicroBlog::themeChanged() -{ - delete m_colorScheme; - m_colorScheme = new KColorScheme(QPalette::Active, KColorScheme::View, Plasma::Theme::defaultTheme()->colorScheme()); - showTweets(); -} - -void MicroBlog::scheduleShowTweets() -{ - if (!m_showTweetsTimer) { - m_showTweetsTimer = new QTimer(this); - m_showTweetsTimer->setInterval(100); - m_showTweetsTimer->setSingleShot(true); - connect(m_showTweetsTimer, SIGNAL(timeout()), this, SLOT(showTweets())); - } - - m_showTweetsTimer->stop(); - m_showTweetsTimer->start(); -} - -void MicroBlog::showTweets() -{ - if (!m_graphicsWidget) { - return; - } - - prepareGeometryChange(); - // Adjust the number of the TweetWidgets if the configuration has changed - // Add more tweetWidgets if there are not enough - - if (m_tweetMap.count() > m_historySize) { - QMap::iterator it = m_tweetMap.begin(); - while (it != m_tweetMap.end() && m_tweetMap.count() > m_historySize) { - it = m_tweetMap.erase(it); - } - } - - while (m_tweetWidgets.count() < m_tweetMap.count()) { - PostWidget *postWidget = new PostWidget(m_tweetsWidget); - connect(postWidget, SIGNAL(reply(QString,QString)), this, SLOT(reply(QString,QString))); - connect(postWidget, SIGNAL(forward(QString)), this, SLOT(forward(QString))); - connect(postWidget, SIGNAL(favorite(QString,bool)), this, SLOT(favorite(QString,bool))); - connect(postWidget, SIGNAL(openProfile(QString)), this, SLOT(openProfile(QString))); - m_tweetWidgets.append(postWidget); - } - - //clear out tweet widgets if there are too many - while (m_tweetWidgets.count() > m_tweetMap.count()) { - PostWidget *t = m_tweetWidgets[m_tweetWidgets.size() - 1]; - m_layout->removeItem(t); - m_tweetWidgets.removeAt(m_tweetWidgets.size() - 1); - t->deleteLater(); - m_tweetsWidget->resize(m_tweetsWidget->effectiveSizeHint(Qt::PreferredSize)); - } - - int i = 0; - QMap::iterator it = m_tweetMap.end(); - - while (it != m_tweetMap.begin()) { - Plasma::DataEngine::Data &tweetData = *(--it); - - QString user = tweetData.value("User").toString(); - - if (i == 0) { - m_popupIcon = m_pictureMap[user]; - } - - PostWidget *t = m_tweetWidgets[i]; - t->setColorScheme(m_colorScheme); - t->setData(tweetData); - t->setPicture(m_pictureMap[user]); - //you don't want to reply or RT yourself - t->setActionsShown(user != m_username); - m_tweetsLayout->addItem(t); - - ++i; - } - - //are we complete? - if (layout() && layout()->itemAt(0) != m_graphicsWidget) { - paintIcon(); - } -} - -void MicroBlog::createConfigurationInterface(KConfigDialog *parent) -{ - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - - QWidget *configWidget = new QWidget(); - configUi.setupUi(configWidget); - - configUi.serviceUrlCombo->addItem("https://identi.ca/api/"); - configUi.serviceUrlCombo->addItem("https://api.twitter.com/1/"); - configUi.serviceUrlCombo->setEditText(m_serviceUrl); - configUi.usernameEdit->setText(m_username); - configUi.passwordEdit->setText(m_password); - configUi.historySizeSpinBox->setValue(m_historySize); - configUi.historySizeSpinBox->setSuffix(ki18np(" message", " messages")); - configUi.historyRefreshSpinBox->setValue(m_historyRefresh); - configUi.historyRefreshSpinBox->setSuffix(ki18np(" minute", " minutes")); - configUi.checkIncludeFriends->setChecked(m_includeFriends); - - parent->addPage(configWidget, i18n("General"), icon()); - connect(configUi.serviceUrlCombo, SIGNAL(editTextChanged(QString)), parent, SLOT(settingsModified())); - connect(configUi.usernameEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified())); - connect(configUi.passwordEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified())); - connect(configUi.historySizeSpinBox, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified())); - connect(configUi.historyRefreshSpinBox, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified())); - connect(configUi.checkIncludeFriends, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); -} - -void MicroBlog::configAccepted() -{ - KConfigGroup cg = config(); - //kDebug()<<"Inside configAccepted"; - //kDebug()<<"username: "<text(); - cg.writeEntry("serviceUrl", configUi.serviceUrlCombo->currentText()); - cg.writeEntry("username", configUi.usernameEdit->text()); - cg.writeEntry("historyRefresh", configUi.historyRefreshSpinBox->value()); - cg.writeEntry("includeFriends", configUi.checkIncludeFriends->isChecked()); - cg.writeEntry("historySize", configUi.historySizeSpinBox->value()); - - QString password = configUi.passwordEdit->text(); - if (m_password != password) { - m_password = password; - m_walletWait = Write; - getWallet(); - - if (m_service) { - m_service.data()->deleteLater(); - } - - if (m_profileService) { - m_profileService->deleteLater(); - m_profileService = 0; - } - } - - emit configNeedsSaving(); -} - -MicroBlog::~MicroBlog() -{ - delete m_colorScheme; - delete m_service.data(); - delete m_profileService; -} - -void MicroBlog::editTextChanged() -{ - m_flash->flash(i18np("%1 character left", "%1 characters left", 140 - m_statusEdit->nativeWidget()->toPlainText().length()), 2000); - //if the text has been cleared, discard - if (m_statusEdit->nativeWidget()->toPlainText().length() == 0) { - m_replyToId = QString(); - } -} - -bool MicroBlog::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == m_statusEdit->nativeWidget()) { - //FIXME:it's nevessary this eventfilter to intercept keypresses in - // QTextEdit (or KTextedit) is it intended? - if (event->type() == QEvent::KeyPress) { - QKeyEvent *keyEvent = static_cast(event); - - //use control modifiers to allow multiline input (even if twitter seems to flatten everything to a slingle line) - if (!(keyEvent->modifiers() & Qt::ControlModifier) && - (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)) { - updateStatus(); - return true; - } else { - return false; - } - } else { - return false; - } - } else if (obj == m_tabBar->nativeWidget() && event->type() == QEvent::MouseButtonPress) { - m_scrollWidget->ensureItemVisible(m_headerFrame); - m_statusEdit->setFocus(); - return false; - } else { - return Plasma::Applet::eventFilter(obj, event); - } -} - -void MicroBlog::updateStatus() -{ - createTimelineService(); - - if (!m_service) { - return; - } - - QString status = m_statusEdit->nativeWidget()->toPlainText(); - - KConfigGroup cg = m_service.data()->operationDescription("update"); - cg.writeEntry("status", status); - if (!m_replyToId.isEmpty()) { - cg.writeEntry("in_reply_to_status_id", m_replyToId); - } - - connect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(updateCompleted(Plasma::ServiceJob*)), Qt::UniqueConnection); - - m_updateJobs.insert(m_service.data()->startOperationCall(cg)); - m_statusEdit->nativeWidget()->setPlainText(""); - setBusy(true); -} - -void MicroBlog::updateCompleted(Plasma::ServiceJob *job) -{ - if (!m_updateJobs.contains(job)) { - return; - } - - m_updateJobs.remove(job); - if (m_updateJobs.isEmpty()) { - disconnect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(updateCompleted(Plasma::ServiceJob*))); - } - - if (!job->error()) { - //m_statusUpdates.value(job); - downloadHistory(); - } - - //m_statusUpdates.remove(job); - setBusy(false); -} - -void MicroBlog::retweetCompleted(Plasma::ServiceJob *job) -{ - if (!m_retweetJobs.contains(job)) { - return; - } - - m_retweetJobs.remove(job); - if (m_retweetJobs.isEmpty()) { - disconnect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(retweetCompleted(Plasma::ServiceJob*))); - } - - if (!job->error()) { - //m_statusUpdates.value(job); - downloadHistory(); - m_flash->flash(i18nc("Repeat of the post also called retweet", "Repeat completed")); - } else { - m_flash->flash(i18n("Repeat failed")); - } - - setBusy(false); -} - -void MicroBlog::favoriteCompleted(Plasma::ServiceJob *job) -{ - if (!m_favoriteJobs.contains(job)) { - return; - } - - m_favoriteJobs.remove(job); - if (m_favoriteJobs.isEmpty()) { - disconnect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(favoriteCompleted(Plasma::ServiceJob*))); - } - - if (!job->error()) { - //m_statusUpdates.value(job); - downloadHistory(); - } - - setBusy(false); -} - -//what this really means now is 'reconnect to the timeline source' -void MicroBlog::downloadHistory() -{ - // kDebug() << "Inside downloadhistory"; - if (m_username.isEmpty() || m_password.isEmpty()) { - //kDebug() << "BOOHYA got empty password"; - if (!m_curTimeline.isEmpty()) { - m_engine->disconnectSource(m_curTimeline, this); - m_engine->disconnectSource("Error:" + m_curTimeline, this); - } - return; - } - - m_flash->flash(i18n("Refreshing timeline..."), -1); - - createTimelineService(); - if (m_service) { - KConfigGroup cg = m_service.data()->operationDescription("auth"); - cg.writeEntry("password", m_password); - - bool ok = m_service.data()->startOperationCall(cg); - kDebug() << "operation OK" << ok; - } - - //get the profile to retrieve the user icon - - if (m_profileService) { - KConfigGroup cg = m_profileService->operationDescription("refresh"); - m_profileService->startOperationCall(cg); - } else { - QString profileQuery(QString("Profile:%1@%2").arg(m_username, m_serviceUrl)); - m_engine->connectSource(m_imageQuery, this); - m_engine->connectSource(profileQuery, this, m_historyRefresh * 60 * 1000); - m_profileService = m_engine->serviceForSource(profileQuery); - connect(m_profileService, SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(serviceFinished(Plasma::ServiceJob*))); - KConfigGroup profileConf = m_profileService->operationDescription("auth"); - profileConf.writeEntry("password", m_password); - m_profileService->startOperationCall(profileConf); - } -} - -void MicroBlog::createTimelineService() -{ - if (!m_tabBar || (m_service && m_lastMode == m_tabBar->currentIndex())) { - return; - } - - delete m_service.data(); - m_lastMode = m_tabBar->currentIndex(); - - QString query; - switch (m_tabBar->currentIndex()) { - case 2: - query = "Messages:%1@%2"; - break; - case 1: - query = "Replies:%1@%2"; - break; - default: - if (m_includeFriends) { - query = QString("TimelineWithFriends:%1@%2"); - } else { - query = QString("Timeline:%1@%2"); - } - break; - } - - query = query.arg(m_username, m_serviceUrl); - //kDebug() << m_curTimeline << query; - if (m_curTimeline != query) { - //ditch the old one, if needed - if (!m_curTimeline.isEmpty()) { - m_engine->disconnectSource(m_curTimeline, this); - m_engine->disconnectSource("Error:" + m_curTimeline, this); - } - - m_curTimeline = query; - } - - //kDebug() << "Connecting to source " << query << "with refresh rate" << m_historyRefresh * 60 * 1000; - m_engine->connectSource(query, this, m_historyRefresh * 60 * 1000); - m_engine->connectSource("Error:" + query, this); - m_service = m_engine->serviceForSource(m_curTimeline); - connect(m_service.data(), SIGNAL(finished(Plasma::ServiceJob*)), this, SLOT(serviceFinished(Plasma::ServiceJob*))); -} - -void MicroBlog::serviceFinished(Plasma::ServiceJob *job) -{ - if (job->error()) { - m_flash->flash(job->errorString(), 2000); - kDebug() << "Job failed."; - - // reset the service objects to give it a chance - // to re-authenticate - if (m_service) { - m_service.data()->deleteLater(); - } - - if (m_profileService) { - m_profileService->deleteLater(); - m_profileService = 0; - } - } else { - kDebug() << "Job succeeded."; - - } -} - -void MicroBlog::openProfile(const QString &profile) -{ - QString url = m_serviceUrl; - url.remove("api/"); - if (!profile.isEmpty()) { - KToolInvocation::invokeBrowser(KUrl(KUrl(url), profile).prettyUrl()); - } else { - KToolInvocation::invokeBrowser(KUrl(KUrl(url), m_username).prettyUrl()); - } -} - - - -#include "moc_microblog.cpp" diff --git a/kdeplasma-addons/applets/microblog/microblog.h b/kdeplasma-addons/applets/microblog/microblog.h deleted file mode 100644 index cf6f27b0..00000000 --- a/kdeplasma-addons/applets/microblog/microblog.h +++ /dev/null @@ -1,196 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by André Duffeck * - * Copyright (C) 2007 Chani Armitage * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef MICROBLOG_H -#define MICROBLOG_H - -#include -#include - -#include - -#include -#include - -#include "ui_configuration.h" - -#include -#include -class KColorScheme; -class PostWidget; - -namespace KWallet -{ - class Wallet; -} - -namespace Plasma -{ - class Svg; - class FlashingLabel; - class IconWidget; - class TextEdit; - class WebContent; - class Frame; - class ServiceJob; - class TabBar; - class ScrollWidget; -} - -class MicroBlog : public Plasma::PopupApplet -{ - Q_OBJECT - public: - MicroBlog(QObject *parent, const QVariantList &args); - ~MicroBlog(); - void init(); - void constraintsEvent(Plasma::Constraints constraints); - QGraphicsWidget *graphicsWidget(); - - - public slots: - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); - void createConfigurationInterface( KConfigDialog *parent ); - void configChanged(); - - /** - * read from the opened KWallet - * @param success whether we got to open it - */ - void readWallet(bool success); - /** - * write to the opened KWallet - * @param success whether we got to open it - */ - void writeWallet(bool success); - - protected Q_SLOTS: - void configAccepted(); - void updateStatus(); - void updateCompleted(Plasma::ServiceJob *job); - void retweetCompleted(Plasma::ServiceJob *job); - void favoriteCompleted(Plasma::ServiceJob *job); - void downloadHistory(); - void editTextChanged(); - void serviceFinished(Plasma::ServiceJob *job); - - void themeChanged(); - void scheduleShowTweets(); - void showTweets(); - void modeChanged(int index); - void openProfile(const QString &user = QString()); - void reply(const QString &replyToId, const QString &to); - void forward(const QString &rt); - void favorite(const QString &rt, const bool isFavourite); - - /** - * attempt to get the wallet from KWallet - * */ - void getWallet(); - - protected: - bool eventFilter(QObject *obj, QEvent *event); - void popupEvent(bool show); - void focusInEvent(QFocusEvent *event); - - private: - /** - * convenience function for setting the folder - */ - bool enterWalletFolder(const QString &folder); - /** - * disable the UI until user is authenticated - */ - void setAuthRequired(bool auth); - /** - * write the password to config instead of wallet - */ - void writeConfigPassword(); - - /** - * generates and sets the popup icon - */ - void paintIcon(); - - /** - * Sets up the timeline service object (m_service) - */ - void createTimelineService(); - - /** - * Returns a unique identifier for a username in a service URL - */ - inline QString identifier() const { return QString("%1@%2").arg(m_username, m_serviceUrl); } - - Plasma::Svg *m_theme; - Plasma::TextEdit *m_statusEdit; - Plasma::WebContent *m_historyEdit; - Plasma::FlashingLabel *m_flash; - Plasma::IconWidget *m_icon; - Plasma::ScrollWidget *m_scrollWidget; - Plasma::TabBar *m_tabBar; - QGraphicsWidget *m_tweetsWidget; - QGraphicsLinearLayout *m_tweetsLayout; - QGraphicsLinearLayout *m_layout; - QGraphicsAnchorLayout *m_headerLayout; - QGraphicsWidget *m_graphicsWidget; - QPixmap m_popupIcon; - - QString m_username; - QString m_password; - QString m_serviceUrl; - QString m_imageQuery; - //QHash m_statusUpdates; - int m_historySize; - int m_historyRefresh; - int m_newTweets; - bool m_includeFriends; - int m_lastMode; - - Plasma::DataEngine *m_engine; - QWeakPointer m_service; - Plasma::Service *m_profileService; - QSet m_updateJobs; - QSet m_retweetJobs; - QSet m_favoriteJobs; - QString m_curTimeline; - QString m_replyToId; - Plasma::Frame *m_headerFrame; - - QMap m_pictureMap; - QStringList m_avatarHistory; - QMap m_tweetMap; - QList m_tweetWidgets; - - qulonglong m_lastTweet; - KWallet::Wallet *m_wallet; - enum WalletWait { None=0, Read, Write }; - WalletWait m_walletWait; - - KColorScheme *m_colorScheme; - Ui::TwitterConfig configUi; - - QTimer *m_showTweetsTimer; - QTimer *m_getWalletDelayTimer; -}; - -K_EXPORT_PLASMA_APPLET(microblog, MicroBlog) - -#endif diff --git a/kdeplasma-addons/applets/microblog/microblog.svgz b/kdeplasma-addons/applets/microblog/microblog.svgz deleted file mode 100644 index 6649080d3b8ded85fc964758819337f8662c39a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7498 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 UDW?D9>glil5B#Q`e-mQ>0Evs?Y5)KL diff --git a/kdeplasma-addons/applets/microblog/plasma-applet-microblog.desktop b/kdeplasma-addons/applets/microblog/plasma-applet-microblog.desktop deleted file mode 100644 index 0f0ecbe6..00000000 --- a/kdeplasma-addons/applets/microblog/plasma-applet-microblog.desktop +++ /dev/null @@ -1,165 +0,0 @@ -[Desktop Entry] -Name=Microblogging -Name[ar]=التدوين المصغر -Name[ast]=Microblogging -Name[bs]=Microblogging -Name[ca]=Microblogs -Name[ca@valencia]=Microblogs -Name[cs]=Mikroblogování -Name[da]=Mikroblogning -Name[de]=Microblogging -Name[el]=Μικροϊστολόγιο -Name[en_GB]=Microblogging -Name[es]=Microblogs -Name[et]=Mikroblogimine -Name[eu]=Mikrobloggintza -Name[fi]=Mikroblogaussovelma -Name[fr]=Microblogging -Name[ga]=Micreabhlagadóireacht -Name[gl]=Microblog -Name[hr]=Microblogging -Name[hu]=Mikroblogolás -Name[is]=Míkróblogg -Name[it]=Microblogging -Name[ja]=マイクロブログ -Name[kk]=Микроблогинг -Name[km]=Microblogging -Name[ko]=마이크로블로깅 -Name[lt]=Mikrotinklaraštis -Name[lv]=Mikroblogi -Name[mr]=मायक्रो ब्लॉगिंग -Name[nb]=Mikroblogging -Name[nds]=Mikronettdagbook -Name[nl]=Microblogging -Name[nn]=Mikroblogging -Name[pa]=ਮਾਈਕਰੋਬਲੋਗ -Name[pl]=Mikroblog -Name[pt]=Micro-blog -Name[pt_BR]=Microblogging -Name[ro]=Microblogging -Name[ru]=Микроблоггинг -Name[sk]=Mikroblogovanie -Name[sl]=Mikrobloganje -Name[sq]=Microblogging -Name[sr]=микроблоговање -Name[sr@ijekavian]=микроблоговање -Name[sr@ijekavianlatin]=mikroblogovanje -Name[sr@latin]=mikroblogovanje -Name[sv]=Mikroblogg -Name[tr]=Mikrogünlük -Name[uk]=Міні-журнал -Name[wa]=Microblogaedje -Name[x-test]=xxMicrobloggingxx -Name[zh_CN]=微博客 -Name[zh_TW]=Microblogging -Comment=Update and view your microblog status. -Comment[ar]=حدث و شاهد حالة تدويناتك. -Comment[ast]=Anovar y ver l'estáu del to microblog. -Comment[bs]=Ažurirajte i prikažite stanje svog mikrobloga. -Comment[ca]=Actualitza i mostra l'estat del vostre microblog. -Comment[ca@valencia]=Actualitza i mostra l'estat del vostre microblog. -Comment[cs]=Aktualizujte a prohlížejte stav svého mikroblogování. -Comment[da]=Opdater og se status for din mikroblog. -Comment[de]=Status Ihres Microblogs aktualisieren und anzeigen. -Comment[el]=Ενημέρωση και προβολή της κατάστασης του μικροϊστολογίου σας. -Comment[en_GB]=Update and view your microblog status. -Comment[es]=Actualizar y ver el estado de su microblog. -Comment[et]=Oma mikroblogioleku uuendamine ja vaatamine. -Comment[eu]=Eguneratu eta ikusi zure mikroblog egoera. -Comment[fi]=Tarkastele ja päivitä mikroblogaustilaasi. -Comment[fr]=Afficher et mettre à jour l'état de votre mini-blogue. -Comment[ga]=Nuashonraigh agus féach ar do stádas micreabhlagadóireachta. -Comment[gl]=Actualizar e ver o estado do microblog. -Comment[hr]=Ažurirajte i prikažtete Vaš status na mikroblogu. -Comment[hu]=Frissíti és megjeleníti a mikroblogja állapotát. -Comment[is]=Uppfæra og skoða stöðu á míkróblogginu þínu. -Comment[it]=Aggiorna e visualizza lo stato del microblog. -Comment[ja]=あなたのマイクロブログの状態の表示と更新を行います -Comment[kk]=Микроблогыңыздың күй-жайын жаңарту әне көрсету -Comment[km]=ធ្វើបច្ចុប្បន្នភាព និង​មើល​ស្ថានភាព microblog របស់​អ្នក ។ -Comment[ko]=마이크로블로그 상태를 보고 갱신합니다. -Comment[lt]=Atnaujinkite ir peržiūrėkite savo minkrotinklaraščio būseną. -Comment[lv]=Atjaunina un rāda mikroblogu statusu. -Comment[mr]=मायक्रो ब्लॉग स्थिती बघा व अद्ययावत करा. -Comment[nb]=Oppdater og vis din mikroblogg-status. -Comment[nds]=Dien Mikronettdaagbook-Status opfrischen un ankieken -Comment[nl]=Werk uw microblogstatus bij bekijk deze. -Comment[nn]=Oppdater og vis mikrobloggstatusen din -Comment[pa]=ਆਪਣਾ ਮਾਈਕਰੋਬਲਾਗ ਹਾਲਤ ਅੱਪਡੇਟ ਕਰੋ ਅਤੇ ਵੇਖੋ। -Comment[pl]=Uaktualnianie i przeglądanie mikrobloga. -Comment[pt]=Actualizar e ver o estado do seu micro-blog. -Comment[pt_BR]=Atualiza e exibe o status do seu microblog. -Comment[ro]=Actualizați și vizualizați-vă starea pe microblog. -Comment[ru]=Показывает и позволяет обновлять статус в микроблоге. -Comment[sk]=Aktualizovanie a zobrazenie stavu svojho mikroblogu. -Comment[sl]=Posodobite in spremljajte stanje mikrobloganja. -Comment[sr]=Ажурирајте и прикажите стање свог микроблога. -Comment[sr@ijekavian]=Ажурирајте и прикажите стање свог микроблога. -Comment[sr@ijekavianlatin]=Ažurirajte i prikažite stanje svog mikrobloga. -Comment[sr@latin]=Ažurirajte i prikažite stanje svog mikrobloga. -Comment[sv]=Uppdatera och visa status för mikroblogg -Comment[tr]=Mikrogünlük durumunuzu güncelleyin ve görüntüleyin -Comment[uk]=Оновіть і перегляньте ваш стан у міні-журналі. -Comment[wa]=Metoz a djoû eyet voeyoz vosse sitatut microblog. -Comment[x-test]=xxUpdate and view your microblog status.xx -Comment[zh_CN]=更新并浏览您的微博客状态 -Comment[zh_TW]=更新並檢視您的 microblog 狀態。 -Keywords=identi.ca;twitter; -Keywords[ar]=identi.ca;twitter; -Keywords[bs]=identi.ca,twitter -Keywords[ca]=identi.ca;twitter; -Keywords[ca@valencia]=identi.ca;twitter; -Keywords[cs]=identi.ca,twitter; -Keywords[da]=identi.ca;twitter; -Keywords[de]=identi.ca;twitter; -Keywords[el]=identi.ca·twitter· -Keywords[en_GB]=identi.ca;twitter; -Keywords[es]=identi.ca;twitter; -Keywords[et]=identi.ca;twitter; -Keywords[fi]=identi.ca;twitter; -Keywords[fr]=identi.ca ; twitter ; -Keywords[gl]=identi.ca;twitter; -Keywords[hu]=identi.ca;twitter; -Keywords[it]=identi.ca;twitter; -Keywords[kk]=identi.ca;twitter; -Keywords[ko]=identi.ca;twitter;트위터 -Keywords[lt]=identi.ca;twitter; -Keywords[mr]=identi.ca;twitter; -Keywords[nb]=identi.ca;twitter; -Keywords[nds]=identi.ca,twitter; -Keywords[nl]=identi.ca;twitter; -Keywords[pa]=identi.ca;twitter; -Keywords[pl]=identi.ca;twitter; -Keywords[pt]=identi.ca;twitter; -Keywords[pt_BR]=identi.ca;twitter; -Keywords[ro]=identi.ca;twitter; -Keywords[ru]=identi.ca,twitter,твиттер -Keywords[sk]=identi.ca;twitter; -Keywords[sl]=identi.ca;twitter; -Keywords[sr]=identi.ca;twitter;Идентика;Твитер -Keywords[sr@ijekavian]=identi.ca;twitter;Идентика;Твитер -Keywords[sr@ijekavianlatin]=identi.ca;twitter;identi.ca;Twitter -Keywords[sr@latin]=identi.ca;twitter;identi.ca;Twitter -Keywords[sv]=identi.ca;twitter; -Keywords[tr]=identi.ca;twitter; -Keywords[uk]=identi.ca;twitter; -Keywords[x-test]=xxidenti.ca;twitter;xx -Keywords[zh_CN]=identi.ca;twitter; -Keywords[zh_TW]=identi.ca;twitter; -Type=Service -ServiceTypes=Plasma/Applet -Icon=view-pim-journal - -X-KDE-Library=plasma_applet_microblog -X-KDE-PluginInfo-Author=André Duffeck -X-KDE-PluginInfo-Email=andre@duffeck.de -X-KDE-PluginInfo-Name=twitter -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - - - diff --git a/kdeplasma-addons/applets/microblog/postwidget.cpp b/kdeplasma-addons/applets/microblog/postwidget.cpp deleted file mode 100644 index 9085836f..00000000 --- a/kdeplasma-addons/applets/microblog/postwidget.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2009 by Marco Martin - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License version 2, - * or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "postwidget.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -PostWidget::PostWidget(QGraphicsWidget *parent) - : Plasma::Frame(parent), - m_isFavorite(false), - m_tz(KTimeZone::utc()), - m_colorScheme(0) -{ - m_author = new Plasma::Label(this); - m_author->nativeWidget()->setWordWrap(false); - m_picture = new Plasma::IconWidget(this); - m_picture->setMinimumSize(m_picture->sizeFromIconSize(32)); - m_picture->setMaximumSize(m_picture->sizeFromIconSize(32)); - connect(m_picture, SIGNAL(clicked()), this, SLOT(askProfile())); - m_from = new Plasma::Label(this); - m_from->nativeWidget()->setWordWrap(false); - m_text = new Plasma::TextBrowser(this); - m_text->nativeWidget()->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard); - m_text->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - m_text->nativeWidget()->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - m_text->nativeWidget()->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - m_text->nativeWidget()->setCursor( Qt::ArrowCursor ); - m_favoriteButton = new Plasma::ToolButton(this); - //hearth - m_favoriteButton->setText(QChar(0x2665)); - connect(m_favoriteButton, SIGNAL(clicked()), this, SLOT(askFavorite())); - m_replyButton = new Plasma::ToolButton(this); - m_replyButton->setText("@"); - connect(m_replyButton, SIGNAL(clicked()), this, SLOT(askReply())); - m_forwardButton = new Plasma::ToolButton(this); - //recycle - m_forwardButton->setText(QChar(0x267B)); - connect(m_forwardButton, SIGNAL(clicked()), this, SLOT(askForward())); - - //corners - QGraphicsAnchorLayout *lay = new QGraphicsAnchorLayout(this); - lay->setSpacing(4); - lay->addCornerAnchors(lay, Qt::TopLeftCorner, m_picture, Qt::TopLeftCorner); - lay->addCornerAnchors(m_picture, Qt::TopRightCorner, m_author, Qt::TopLeftCorner); - lay->addCornerAnchors(m_author, Qt::BottomLeftCorner, m_from, Qt::TopLeftCorner); - - lay->addCornerAnchors(lay, Qt::TopRightCorner, m_forwardButton, Qt::TopRightCorner); - lay->addCornerAnchors(m_forwardButton, Qt::TopLeftCorner, m_replyButton, Qt::TopRightCorner); - lay->addCornerAnchors(m_replyButton, Qt::TopLeftCorner, m_favoriteButton, Qt::TopRightCorner); - lay->addCornerAnchors(m_favoriteButton, Qt::TopLeftCorner, m_author, Qt::TopRightCorner); - - //vertical - lay->addAnchor(m_from, Qt::AnchorBottom, m_text, Qt::AnchorTop); - lay->addAnchor(lay, Qt::AnchorBottom, m_text, Qt::AnchorBottom); - - //horizontal - lay->addAnchor(lay, Qt::AnchorRight, m_from, Qt::AnchorRight); - lay->addAnchors(lay, m_text, Qt::Horizontal); -} - -PostWidget::~PostWidget() -{ -} - -void PostWidget::setData(const Plasma::DataEngine::Data &data) -{ - m_messageId = data["Id"].toString(); - m_author->setText(data["User"].toString()); - QLocale english(QLocale::English, QLocale::UnitedStates); - QDateTime dt = english.toDateTime(data.value( "Date" ).toString(), "ddd MMM dd HH:mm:ss +0000 yyyy"); - dt.setTimeSpec(Qt::UTC); - m_from->setText(i18nc("%1 is a time string like '1 hour ago' - %2 is the name of a microblogging client","%1 from %2",timeDescription( dt ), data.value( "Source" ).toString())); - - QString status = data["Status"].toString(); - status.replace(QRegExp("((http|https)://[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]])"), "\\1"); - - m_text->setText(QString( "

%2

" ).arg( m_colorScheme->foreground().color().name()).arg( status )); - - m_isFavorite = (data["IsFavorite"].toString() == "true"); - m_favoriteButton->setDown(m_isFavorite); -} - -void PostWidget::setPicture(const QPixmap &picture) -{ - m_picture->setIcon(picture); -} - -void PostWidget::setColorScheme(KColorScheme *scheme) -{ - m_colorScheme = scheme; -} - -void PostWidget::askReply() -{ - emit reply(m_messageId, '@' + m_author->text() + ' '); -} - -void PostWidget::askForward() -{ - emit forward(m_messageId); -} - -void PostWidget::askFavorite() -{ - emit favorite(m_messageId, !m_isFavorite); -} - -void PostWidget::askProfile() -{ - emit openProfile(m_author->text()); -} - -void PostWidget::setActionsShown(bool show) -{ - m_favoriteButton->setVisible(show); - m_replyButton->setVisible(show); - m_forwardButton->setVisible(show); -} - -QString PostWidget::timeDescription( const QDateTime &dt ) -{ - int diff = dt.secsTo(KDateTime::currentDateTime(m_tz).dateTime()); - - if (diff < 60) { - return i18n("Less than a minute ago"); - } else if (diff < 60*60) { - return i18np("1 minute ago", "%1 minutes ago", diff/60); - } else if (diff < 2*60*60) { - return i18n("Over an hour ago"); - } else if (diff < 24*60*60) { - return i18np("1 hour ago", "%1 hours ago", diff/3600); - } - - return dt.toString(Qt::LocaleDate); -} - -#include "moc_postwidget.cpp" diff --git a/kdeplasma-addons/applets/microblog/postwidget.h b/kdeplasma-addons/applets/microblog/postwidget.h deleted file mode 100644 index c8ebe5b1..00000000 --- a/kdeplasma-addons/applets/microblog/postwidget.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2009 by Marco Martin - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License version 2, - * or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef POSTWIDGET_H -#define POSTWIDGET_H - -#include - -#include -#include - -class KColorScheme; - -namespace Plasma -{ -class Label; -class IconWidget; -class TextBrowser; -class ToolButton; -} - -class PostWidget : public Plasma::Frame -{ - Q_OBJECT -public: - PostWidget(QGraphicsWidget *parent); - ~PostWidget(); - - void setData(const Plasma::DataEngine::Data &data); - void setPicture(const QPixmap &picture); - void setColorScheme(KColorScheme *scheme); - void setActionsShown(bool show); - -protected: - QString timeDescription(const QDateTime &dt); - -protected Q_SLOTS: - void askReply(); - void askForward(); - void askFavorite(); - void askProfile(); - -Q_SIGNALS: - void reply(const QString messageId, const QString &reply); - void forward(const QString &messageId); - void favorite(const QString &messageId, const bool favorite); - void openProfile(const QString &profile); - -private: - QString m_messageId; - Plasma::Label *m_author; - Plasma::IconWidget *m_picture; - Plasma::Label *m_from; - Plasma::TextBrowser *m_text; - Plasma::ToolButton *m_replyButton; - Plasma::ToolButton *m_forwardButton; - Plasma::ToolButton *m_favoriteButton; - bool m_isFavorite; - KTimeZone m_tz; - KColorScheme *m_colorScheme; -}; - -#endif diff --git a/kdeplasma-addons/applets/news/CMakeLists.txt b/kdeplasma-addons/applets/news/CMakeLists.txt deleted file mode 100644 index 42546603..00000000 --- a/kdeplasma-addons/applets/news/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -project(plasma-news) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -set(news_SRCS - news.cpp - config.ui - feedsConfig.ui -) - -kde4_add_plugin(plasma_applet_news ${news_SRCS}) -target_link_libraries(plasma_applet_news - ${KDE4_PLASMA_LIBS} - ${KDE4_KIO_LIBS} - ${QT_QTWEBKIT_LIBRARY} -) - -install(TARGETS plasma_applet_news DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-applet-news.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES news.css DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/stylesheets/) diff --git a/kdeplasma-addons/applets/news/Messages.sh b/kdeplasma-addons/applets/news/Messages.sh deleted file mode 100755 index 2d1f52c0..00000000 --- a/kdeplasma-addons/applets/news/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_applet_news.pot -rm -f rc.cpp diff --git a/kdeplasma-addons/applets/news/config.ui b/kdeplasma-addons/applets/news/config.ui deleted file mode 100644 index 4d5bc13e..00000000 --- a/kdeplasma-addons/applets/news/config.ui +++ /dev/null @@ -1,215 +0,0 @@ - - - config - - - - 0 - 0 - 449 - 318 - - - - - 0 - 0 - - - - - - - - 75 - true - - - - News - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 25 - - - - - - - - - - Update interval: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - intervalSpinBox - - - - - - - - 0 - 0 - - - - - 130 - 0 - - - - 1 - - - 525600 - - - 30 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - - 75 - true - - - - Information - - - - - - - Show timestamps - - - - - - - Show titles - - - - - - - Show descriptions - - - - - - - - true - - - - QFrame::Raised - - - Note that timestamps, titles and descriptions are available only if they are provided by feed. - - - Qt::PlainText - - - true - - - - - - - Qt::Vertical - - - - 20 - 60 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - - KIntSpinBox - QSpinBox -
knuminput.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/news/feedsConfig.ui b/kdeplasma-addons/applets/news/feedsConfig.ui deleted file mode 100644 index f2125a99..00000000 --- a/kdeplasma-addons/applets/news/feedsConfig.ui +++ /dev/null @@ -1,102 +0,0 @@ - - feedsConfig - - - - 0 - 0 - 502 - 228 - - - - - - - - - &Add a feed: - - - feedComboBox - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - - - - - 1 - - - - - Add Feed - - - - - - - Remove Feed - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - KHistoryComboBox - KComboBox -
khistorycombobox.h
-
- - KListWidget - QListWidget -
klistwidget.h
-
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/news/news.cpp b/kdeplasma-addons/applets/news/news.cpp deleted file mode 100644 index 10603adc..00000000 --- a/kdeplasma-addons/applets/news/news.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Petri Damsten - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "news.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -static const char *BEGIN = -"\n" -"\n" -"\n" -"\n" -" \n" -" \n" -" Plasma News\n" -"\n" -"\n"; - -static const char *BEGIN_TABLE = "\n"; -static const char *HEADER_LINE = "" - "\n"; -static const char *DATE_LINE = "\n"; -static const char *LINE = "" - "\n"; -static const char *TIME_LINE = "" - "\n"; -static const char *TITLE = "%1"; -static const char *TITLE_DESC = "%1
"; -static const char *DESCRIPTION = "%1"; -static const char *END_TABLE = "
%2
%1
%3
%2%4
\n"; -static const char *END = "\n\n"; - -static const char *CSS = - ".header { font-size:11pt; font-weight:bold; color:%1; background-color:%2; }\n" - ".date { font-size:10pt; font-weight:bold; color:%1; background-color:%2; }\n" - ".line-0 { font-size:10pt; color:%1; background-color:%3; }\n" - ".line-1 { font-size:10pt; color:%1; background-color:%4; }\n" - ".time, .title, .description { }\n" - ".text { width:100%; }\n" - ".title_with_description { font-weight:bold; }\n" - "a { text-decoration:none; color:%1 }\n" - "table { width:100%; border-spacing:0px; }\n" - "td { vertical-align: top; }\n" - "body { margin:0px; background:none }\n"; - -News::News(QObject *parent, const QVariantList &args) - : Plasma::PopupApplet(parent, args), - m_graphicsWidget(0) -{ - setHasConfigurationInterface(true); - setAspectRatioMode(Plasma::IgnoreAspectRatio); - - setPopupIcon("application-rss+xml"); - - setAssociatedApplication("akregator"); - - resize(300,300); -} - -News::~News() -{ -} - - -QGraphicsWidget *News::graphicsWidget() -{ - if (m_graphicsWidget) { - return m_graphicsWidget; - } - - m_layout = new QGraphicsLinearLayout(); - m_layout->setContentsMargins(0, 0, 0, 0); - m_layout->setSpacing(0); - m_layout->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); - - m_news = new Plasma::WebView(this); - m_news->setDragToScroll(true); - m_news->installEventFilter(this); - m_news->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); - connect(m_news->page(), SIGNAL(linkClicked(QUrl)), - this, SLOT(linkActivated(QUrl))); - m_news->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - m_layout->addItem(m_news); - - - setAcceptDrops(true); - makeStylesheet(); - - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(makeStylesheet())); - - m_graphicsWidget = new QGraphicsWidget(this); - m_graphicsWidget->setLayout(m_layout); - m_graphicsWidget->setPreferredSize(370,440); - //a tiny minimum size, a panel 48px high is enough to display the whole applet - m_graphicsWidget->setMinimumSize(150, 150); - QPalette palette = m_graphicsWidget->palette(); - palette.setBrush(QPalette::Base, Qt::transparent); - m_graphicsWidget->setPalette(palette); - - configChanged(); - - return m_graphicsWidget; -} - -void News::configChanged() -{ - kDebug(); - KConfigGroup cg = config(); - m_interval = cg.readEntry("interval", 30); - m_showTimestamps = cg.readEntry("showTimestamps", true); - m_showTitles = cg.readEntry("showTitles", true); - m_showDescriptions = cg.readEntry("showDescriptions", false); - - m_feeds = cg.readEntry("feeds", QStringList("http://www.kde.org/dotkdeorg.rdf")); - - connectToEngine(); -} - -void News::connectToEngine() -{ - if (!m_feeds.isEmpty()) { - Plasma::DataEngine* engine = dataEngine("rss"); - if( engine) { - - QString feedstring; - - foreach (const QString& feed, m_feeds) { - QByteArray ba = QUrl::toPercentEncoding(feed, ":/&?="); - feedstring.append(ba); - feedstring.append(" "); - } - m_feedstring = feedstring; - kDebug() << feedstring; - engine->connectSource(feedstring, this, m_interval * 60 * 1000); - } - else - kDebug()<<"Can not connect to dataengine rss"; - } -} - -void News::makeStylesheet() -{ - const QString search = "desktoptheme/" + Plasma::Theme::defaultTheme()->themeName() + - "/stylesheets/news.css"; - const QString path = KStandardDirs::locate("data", search); - if (path.isEmpty()) { - QColor backgroundColor = - Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor); - QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor); - QColor altBackgroundColor = backgroundColor; - altBackgroundColor.setHsv(altBackgroundColor.hue(), altBackgroundColor.saturation(), - (altBackgroundColor.value() < 128) - ? backgroundColor.value() + 40 : backgroundColor.value() - 40, - altBackgroundColor.alpha()); - QString css = QString(CSS).arg(textColor.name()) - .arg(QString("rgba(%1, %2, %3, 0.45)").arg(backgroundColor.red()).arg( backgroundColor.green()).arg( backgroundColor.blue())) - .arg(QString("rgba(%1, %2, %3, 0.25)").arg(backgroundColor.red()).arg( backgroundColor.green()).arg( backgroundColor.blue())) - .arg(QString("rgba(%1, %2, %3, 0.25)").arg(altBackgroundColor.red()).arg( altBackgroundColor.green()).arg( altBackgroundColor.blue())); - KStandardDirs dirs; - m_cssDir = dirs.saveLocation("data", "plasma_applet_news"); - - QFile file(m_cssDir + "/news.css"); - if (file.open(QIODevice::WriteOnly)) { - file.write(css.toUtf8()); - } - } else { - m_cssDir = QFileInfo(path).absolutePath() + '/'; - } - - QWebFrame* frame = m_news->mainFrame(); - if (frame) { - frame->setHtml(frame->toHtml(), m_cssDir); - } -} - -QMap News::akregatorFeeds() -{ - QMap result; - const QString file = KStandardDirs::locate("data", "akregator/data/feeds.opml"); - if (!file.isEmpty()) { - QFile f(file); - if (f.open(QIODevice::ReadOnly)) { - QDomDocument doc; - if (doc.setContent(&f)) { - QDomNodeList nodes = doc.elementsByTagName("outline"); - for (int i = 0; i < nodes.count(); ++i) { - QDomElement element = nodes.item(i).toElement(); - QString title = element.attribute("title"); - if (!title.isEmpty()) { - result[title] = element.attribute("xmlUrl"); - } - } - } - f.close(); - } - } - return result; -} - -void News::createConfigurationInterface(KConfigDialog *parent) -{ - QWidget *widget = new QWidget(); - ui.setupUi(widget); - QWidget *fWidget = new QWidget(0); - feedsUi.setupUi(fWidget); - parent->addPage(widget, i18n("General"), icon()); - parent->addPage(fWidget, i18n("Feeds"), "application-rss+xml"); - - connect(feedsUi.feedComboBox, SIGNAL(editTextChanged(QString)), - this, SLOT(feedTextChanged(QString))); - connect(parent, SIGNAL(accepted()), this, SLOT(configAccepted())); - connect(feedsUi.addFeed, SIGNAL(clicked()), this, SLOT(addFeed())); - connect(feedsUi.removeFeed, SIGNAL(clicked()), this, SLOT(removeFeed())); - - m_defaultFeeds = akregatorFeeds(); - feedsUi.feedComboBox->clear(); - feedTextChanged(QString()); - feedsUi.feedList->clear(); - foreach (const QString& name, m_defaultFeeds.keys()) { - feedsUi.feedComboBox->addItem(name); - } - - ui.intervalSpinBox->setValue(m_interval); - ui.intervalSpinBox->setSuffix(ki18np(" minute", " minutes")); - - ui.timestampCheckBox->setChecked(m_showTimestamps); - ui.titlesCheckBox->setChecked(m_showTitles); - ui.descriptionsCheckBox->setChecked(m_showDescriptions); - - feedsUi.feedList->addItems(m_feeds); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - connect(ui.intervalSpinBox, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified())); - connect(ui.timestampCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(ui.titlesCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(ui.descriptionsCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(feedsUi.feedComboBox, SIGNAL(editTextChanged(QString)), parent, SLOT(settingsModified())); - connect(feedsUi.addFeed, SIGNAL(released()), parent, SLOT(settingsModified())); - connect(feedsUi.removeFeed, SIGNAL(released()), parent, SLOT(settingsModified())); - connect(feedsUi.feedList, SIGNAL(itemSelectionChanged()), parent, SLOT(settingsModified())); -} - -void News::feedTextChanged(const QString& text) -{ - feedsUi.addFeed->setEnabled(!text.isEmpty()); -} - -void News::addFeed() -{ - if (!feedsUi.feedComboBox->currentText().isEmpty()) { - QString url = feedsUi.feedComboBox->currentText(); - if (m_defaultFeeds.keys().contains(url)) { - url = m_defaultFeeds[url]; - } - bool found = false; - for (int i = 0; i < feedsUi.feedList->count(); i++) { - QString feed = feedsUi.feedList->item(i)->text(); - if (feed == url) { - found = true; - } - } - if (!found) { - feedsUi.feedList->addItem(url); - } - feedsUi.removeFeed->setEnabled(true); - } -} - -void News::removeFeed() -{ - int row = feedsUi.feedList->currentRow(); - if (row != -1) { - feedsUi.feedList->takeItem(row); - if (feedsUi.feedList->count() == 0) { - feedsUi.removeFeed->setEnabled(false); - } - } -} - -void News::configAccepted() -{ - m_interval = ui.intervalSpinBox->value(); - m_showTimestamps = ui.timestampCheckBox->isChecked(); - m_showTitles = ui.titlesCheckBox->isChecked(); - m_showDescriptions = ui.descriptionsCheckBox->isChecked(); - - m_feeds.clear(); - QString feed; - for (int i = 0; i < feedsUi.feedList->count(); i++) { - feed = feedsUi.feedList->item(i)->text(); - if (m_defaultFeeds.keys().contains(feed)) { - feed = m_defaultFeeds[feed]; - } - m_feeds.append(feed); - } - - KConfigGroup cg = config(); - cg.writeEntry("feeds", m_feeds); - cg.writeEntry("interval", m_interval); - cg.writeEntry("showTimestamps", m_showTimestamps); - cg.writeEntry("showTitles", m_showTitles); - cg.writeEntry("showDescriptions", m_showDescriptions); - - dataUpdated(m_feedstring, m_dataCache); -} - -void News::dropEvent(QGraphicsSceneDragDropEvent *event) -{ - if (KUrl::List::canDecode(event->mimeData())) { - KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); - - if (!urls.isEmpty()) { - event->accept(); - m_feeds.clear(); - foreach (const KUrl &feed, urls) { - m_feeds << feed.prettyUrl(); - } - m_interval = 30; - connectToEngine(); - } - } -} - -bool News::eventFilter(QObject *receiver, QEvent *event) -{ - if (receiver == m_news && event->type() == QEvent::GraphicsSceneContextMenu) { - return true; - } - - return false; -} - -void News::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data) -{ - if (source == m_feedstring && !data.isEmpty()) { - m_dataCache = data; - QDateTime previous = QDateTime::currentDateTime(); - QString html; - QVariantList items = data["items"].toList(); - uint columns = 1; - uint i = 0; - - html += BEGIN; - html += BEGIN_TABLE; - html += QString(HEADER_LINE).arg(data["link"].toString()) - .arg(data["title"].toString()); - - foreach (const QVariant &tmp, items) { - QMap item = tmp.toMap(); - if (item["time"].toUInt() != 0) { - columns = 2; - } else { - columns = 1; - } - uint timeStamp = item["time"].toUInt(); - QString title = item["title"].toString(); - QString description = item["description"].toString().remove(QRegExp("<[^>]*>")); - QString line; - - if (title != 0 && m_showTitles) { - if (description != 0 && m_showDescriptions) { - line += QString(TITLE_DESC).arg(title); - } else { - line += QString(TITLE).arg(title); - } - } - if (description != 0 && m_showDescriptions) { - line += QString(DESCRIPTION).arg(description); - } - if (timeStamp != 0 && m_showTimestamps) { - QDateTime time; - time.setTime_t(timeStamp); - if (previous.date() != time.date()) { - html += QString(DATE_LINE).arg(time.date().toString()); - i = 0; - } - html += QString(TIME_LINE).arg(i % 2) - .arg(time.time().toString("HH:mm")) - .arg(item["link"].toString()) - .arg(line); - previous = time; - } else { - html += QString(LINE).arg(i % 2) - .arg(item["link"].toString()) - .arg(line); - } - - ++i; - } - html += END_TABLE; - html += END; - m_graphicsWidget->setPreferredSize(-1, -1); - - m_news->setHtml(html, m_cssDir); - emit sizeHintChanged(Qt::PreferredSize); - } -} - -void News::linkActivated(const QUrl& link) -{ - KRun::runUrl(KUrl(link), "text/html", 0); -} - -#include "moc_news.cpp" diff --git a/kdeplasma-addons/applets/news/news.css b/kdeplasma-addons/applets/news/news.css deleted file mode 100644 index 56a0bcc7..00000000 --- a/kdeplasma-addons/applets/news/news.css +++ /dev/null @@ -1,13 +0,0 @@ -.header { font-size:11pt; font-weight:bold; color:#000; background-color:rgba(255,255,255,0.45); } -.date { font-size:10pt; font-weight:bold; color:#000; background-color:rgba(255,255,255,0.45); } -.line-0 { font-size:10pt; color:#000; background-color:rgba(255,255,255,0.25); } -.line-1 { font-size:10pt; color:#000; background-color:transparent; } -.time { font-size:7pt; color:#555; padding-top:3px; } -.title, .description { } -.description { font-size:9pt; } -.text { width:100%; } -.title_with_description { font-weight:bold; } -a { text-decoration:none; color:#222; } -table { width:100%; border-spacing:0px; } -td { vertical-align: top; } -body { margin:0px; background-color:transparent } diff --git a/kdeplasma-addons/applets/news/news.h b/kdeplasma-addons/applets/news/news.h deleted file mode 100644 index 3ab56da2..00000000 --- a/kdeplasma-addons/applets/news/news.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Petri Damsten - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef NEWS_HEADER -#define NEWS_HEADER - -#include -#include -#include "ui_config.h" -#include "ui_feedsConfig.h" - -namespace Plasma { - class WebView; -} -#include - -class News : public Plasma::PopupApplet -{ - Q_OBJECT - public: - News(QObject *parent, const QVariantList &args); - ~News(); - - QGraphicsWidget *graphicsWidget(); - - public Q_SLOTS: - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); - void configChanged(); - - protected: - virtual void createConfigurationInterface(KConfigDialog *parent); - void connectToEngine(); - QMap akregatorFeeds(); - bool eventFilter(QObject *receiver, QEvent *event); - - protected Q_SLOTS: - void dropEvent(QGraphicsSceneDragDropEvent *event); - void configAccepted(); - void linkActivated(const QUrl& link); - void addFeed(); - void removeFeed(); - void feedTextChanged(const QString& text); - void makeStylesheet(); - - private: - QStringList m_feeds; - QString m_feedstring; - uint m_interval; - bool m_showTimestamps; - bool m_showTitles; - bool m_showDescriptions; - Ui::config ui; - Ui::feedsConfig feedsUi; - QMap m_defaultFeeds; - Plasma::WebView* m_news; - QGraphicsLinearLayout* m_layout; - QGraphicsWidget *m_graphicsWidget; - QString m_cssDir; - Plasma::DataEngine::Data m_dataCache; -}; - -K_EXPORT_PLASMA_APPLET(news, News) - -#endif diff --git a/kdeplasma-addons/applets/news/plasma-applet-news.desktop b/kdeplasma-addons/applets/news/plasma-applet-news.desktop deleted file mode 100644 index 765b5edf..00000000 --- a/kdeplasma-addons/applets/news/plasma-applet-news.desktop +++ /dev/null @@ -1,128 +0,0 @@ -[Desktop Entry] -Name=News -Name[ar]=أخبار -Name[ast]=Noticies -Name[bs]=Novosti -Name[ca]=Notícies -Name[ca@valencia]=Notícies -Name[cs]=Novinky -Name[da]=Nyheder -Name[de]=News -Name[el]=Ειδήσεις -Name[en_GB]=News -Name[es]=Noticias -Name[et]=Uudised -Name[eu]=Berriak -Name[fi]=Uutiset -Name[fr]=Nouvelles -Name[ga]=Nuacht -Name[gl]=Novas -Name[he]=חדשות -Name[hr]=Novosti -Name[hu]=Hírek -Name[is]=Fréttir -Name[it]=Notizie -Name[ja]=ニュース -Name[kk]=Жаңалықтар -Name[km]=ព័ត៌មាន​ -Name[ko]=뉴스 -Name[ku]=Nûçe -Name[lt]=Naujienos -Name[lv]=Ziņas -Name[mr]=बातम्या -Name[nb]=Nyheter -Name[nds]=Narichten -Name[nl]=Nieuws -Name[nn]=Nyheiter -Name[pa]=ਖ਼ਬਰਾਂ -Name[pl]=Nowości -Name[pt]=Notícias -Name[pt_BR]=Notícias -Name[ro]=Știri -Name[ru]=Новости -Name[sk]=Novinky -Name[sl]=Novice -Name[sq]=Të rejat -Name[sr]=вести -Name[sr@ijekavian]=вијести -Name[sr@ijekavianlatin]=vijesti -Name[sr@latin]=vesti -Name[sv]=Nyheter -Name[th]=ข่าวต่าง ๆ -Name[tr]=Haberler -Name[ug]=خەۋەر -Name[uk]=Новини -Name[wa]=Noveles -Name[x-test]=xxNewsxx -Name[zh_CN]=新闻 -Name[zh_TW]=新聞 -Comment=Show news from various sources -Comment[ar]=أظهر الأخبار من مصادر متعددة -Comment[ast]=Amuesa noticies de delles fontes -Comment[bs]=Prikazuje vijesti iz različitih izvora -Comment[ca]=Mostra les notícies de diverses fonts -Comment[ca@valencia]=Mostra les notícies de diverses fonts -Comment[cs]=Zobrazit novinky z různých zdrojů -Comment[da]=Viser nyheder fra forskellige kilder. -Comment[de]=Neuigkeiten aus verschiedenen Quellen anzeigen -Comment[el]=Εμφάνιση ειδήσεων από διάφορες πηγές -Comment[en_GB]=Show news from various sources -Comment[es]=Muestra noticias de varias fuentes -Comment[et]=Mitmest allikast uudiste näitamine -Comment[eu]=Erakutsi iturburu desberdinetako berriak -Comment[fi]=Näyttää uutisia useista eri lähteistä -Comment[fr]=Affiche des nouvelles depuis diverses sources -Comment[ga]=Taispeáin nuacht ó fhoinsí éagsúla -Comment[gl]=Mostra as novas de varias fontes. -Comment[he]=מציג חדשות ממקורות שונים -Comment[hr]=Prikaži vijesti iz raznih izvora -Comment[hu]=Különböző forrásból származó hírek megjelenítése -Comment[is]=Sýna fréttir frá mismunandi uppruna -Comment[it]=Mostra notizie da varie fonti -Comment[ja]=さまざまなソースからニュースを表示します -Comment[kk]=Түрлі көздерден келген жаңалықтарды көрсету -Comment[km]=បង្ហាញ​ព័ត៌មាន​ពី​ប្រភព​ផ្សេងៗ -Comment[ko]=다양한 뉴스 보여주기 -Comment[ku]=Jê çavkaniyên cur bi cur nûçe yan nîşan bide -Comment[lt]=Rodo naujienas iš įvairių šaltinių -Comment[lv]=Rāda ziņas no dažādiem avotiem -Comment[mr]=विविध स्रोतातून बातम्या दर्शवा -Comment[nb]=Vis nyheter fra ymse kilder -Comment[nds]=Narichten vun verscheden Borns wiesen -Comment[nl]=Toont nieuws van verschillende bronnen -Comment[nn]=Vis nyheiter frå ulike kjelder -Comment[pa]=ਕਈ ਸਰੋਤਾਂ ਤੋਂ ਖ਼ਬਰਾਂ ਵੇਖੋ -Comment[pl]=Wyświetlanie nowości z różnych źródeł -Comment[pt]=Mostra as notícias de várias fontes -Comment[pt_BR]=Mostra notícias de várias fontes -Comment[ro]=Afișează noutăți din diverse surse -Comment[ru]=Показывает новости из различных источников -Comment[sk]=Zobrazenie noviniek z rôznych zdrojov -Comment[sl]=Prikaže novice iz različnih virov -Comment[sr]=Приказује вести из различитих извора -Comment[sr@ijekavian]=Приказује вијести из различитих извора -Comment[sr@ijekavianlatin]=Prikazuje vijesti iz različitih izvora -Comment[sr@latin]=Prikazuje vesti iz različitih izvora -Comment[sv]=Visa nyheter från olika källor -Comment[th]=แสดงข่าวต่าง ๆ จากแหล่งข่าวหลาย ๆ ที่ -Comment[tr]=Çeşitli kaynaklardan haberleri göster -Comment[uk]=Показати новини від різноманітних джерел -Comment[wa]=Mostrer des noveles a pårti d' sacwants sourdants -Comment[x-test]=xxShow news from various sourcesxx -Comment[zh_CN]=从多个来源显示新闻 -Comment[zh_TW]=顯示不同的來源的新聞 -Type=Service -Icon=application-rss+xml -ServiceTypes=Plasma/Applet - -X-KDE-Library=plasma_applet_news -X-KDE-PluginInfo-Author=Petri Damstén -X-KDE-PluginInfo-Email=damu@iki.fi -X-KDE-PluginInfo-Name=news -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - diff --git a/kdeplasma-addons/applets/rememberthemilk/CMakeLists.txt b/kdeplasma-addons/applets/rememberthemilk/CMakeLists.txt deleted file mode 100644 index dc6bb0c1..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -project(rememberthemilk-plasmoid) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${KDE4_INCLUDES} -) - -set(rememberthemilk-plasmoid_SRCS - rememberthemilk-plasmoid.cpp - taskitem.cpp - taskitemdelegate.cpp - taskeditor.cpp - taskmodel.cpp - tasksortfilter.cpp - authenticate.ui - general.ui -) - -kde4_add_plugin(plasma_applet_rtm ${rememberthemilk-plasmoid_SRCS}) -target_link_libraries(plasma_applet_rtm - ${KDE4_PLASMA_LIBS} - ${KDE4_SOLID_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KDEWEBKIT_LIBS} -) - -install(TARGETS plasma_applet_rtm - DESTINATION ${PLUGIN_INSTALL_DIR}) - -install(FILES plasma-applet-rememberthemilk.desktop - DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/kdeplasma-addons/applets/rememberthemilk/Messages.sh b/kdeplasma-addons/applets/rememberthemilk/Messages.sh deleted file mode 100644 index f6cee0f9..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_applet_rtm.pot diff --git a/kdeplasma-addons/applets/rememberthemilk/authenticate.ui b/kdeplasma-addons/applets/rememberthemilk/authenticate.ui deleted file mode 100644 index a87a562e..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/authenticate.ui +++ /dev/null @@ -1,144 +0,0 @@ - - - AuthWidget - - - - 0 - 0 - 517 - 477 - - - - - - - Displays the current authentication state of the KDE Remember The Milk applet. If the light is green, the applet is authenticated. If the light is red, you need to enter your username and password below to log in. - - - Current Authentication Status - - - - - - - - - 0 - 0 - - - - - - - - Authenticated - - - - - - - - - - - - Re-Authenticate - - - true - - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::AlignHCenter|Qt::AlignTop - - - - - - - - Authenticate with Remember The Milk Service - - - - - - - - - - - - No Remember The Milk Account? - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Register for one here. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - https://www.rememberthemilk.com/signup/ - - - - - - - - - Qt::Vertical - - - - 20 - 123 - - - - - - - - - QWebView - QWidget -
QtWebKit/QWebView
-
- - KWebView - QWebView -
kwebview.h
-
- - KUrlLabel - QLabel -
kurllabel.h
-
- - KLed - QWidget -
kled.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/rememberthemilk/general.ui b/kdeplasma-addons/applets/rememberthemilk/general.ui deleted file mode 100644 index 718e366e..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/general.ui +++ /dev/null @@ -1,73 +0,0 @@ - - - GeneralWidget - - - - 0 - 0 - 400 - 300 - - - - - - - - - - true - - - - - - Sort by: - - - sortType - - - - - - - Change the current sorting method. - -Priority: -Items are first sorted by their priority (1, 2, 3, none) and secondly by due date. - -Due Date: -Items are first sorted by their due date and secondly by priority. - - - - - - - - - - Qt::Vertical - - - - 20 - 123 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/rememberthemilk/plasma-applet-rememberthemilk.desktop b/kdeplasma-addons/applets/rememberthemilk/plasma-applet-rememberthemilk.desktop deleted file mode 100644 index ce675e5a..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/plasma-applet-rememberthemilk.desktop +++ /dev/null @@ -1,118 +0,0 @@ -[Desktop Entry] -Name=Remember The Milk -Name[ar]=Remember The Milk -Name[ast]=Remember The Milk -Name[bs]=Sjeti se mlijeka -Name[ca]=Remember The Milk -Name[ca@valencia]=Remember The Milk -Name[cs]=Remember The Milk -Name[da]=Remember The Milk -Name[de]=Remember The Milk -Name[el]=Remember The Milk -Name[en_GB]=Remember The Milk -Name[es]=Remember The Milk -Name[et]=Remember The Milk -Name[fi]=Remember The Milk -Name[fr]=Pense-bête -Name[ga]=Remember The Milk -Name[gl]=Acórdate do leite -Name[hr]=Remember The Milk -Name[hu]=Remember The Milk -Name[is]=Muna eftir mjólkinni -Name[it]=Remember The Milk -Name[ja]=Remember The Milk -Name[kk]=Remember The Milk -Name[km]=ចងចាំ Milk -Name[ko]=Remember The Milk -Name[lt]=Prisimink pieną -Name[lv]=Remember The Milk -Name[mr]=दूध लक्षात ठेवा -Name[nb]=Husk melk -Name[nds]=Dor-An-Denken -Name[nl]=Remember The Milk -Name[nn]=Remember The Milk -Name[pa]=ਰੀਮੈਂਬਰ ਦਾ ਮਿਲਕ -Name[pl]=Remember The Milk -Name[pt]=Recordar as Tarefas -Name[pt_BR]=Remember The Milk -Name[ro]=Nu uita laptele -Name[ru]=Remember The Milk -Name[sk]=Remember The Milk -Name[sl]=Remember The Milk -Name[sr]=Не заборави млеко -Name[sr@ijekavian]=Не заборави млијеко -Name[sr@ijekavianlatin]=Ne zaboravi mlijeko -Name[sr@latin]=Ne zaboravi mleko -Name[sv]=Remember The Milk -Name[tr]=Remember The Milk -Name[uk]=Remember The Milk -Name[wa]=Si sovni do laecea -Name[x-test]=xxRemember The Milkxx -Name[zh_CN]=Remember The Milk -Name[zh_TW]=Remember The Milk -Comment=Remember The Milk Todo list applet -Comment[ar]=بريمج قائمة المهام Remember The Milk -Comment[ast]=Miniaplicación de xeres pendientes Remember The Milk -Comment[bs]=Aplet spisak obaveza na Sjeti se mlijeka -Comment[ca]=Miniaplicació per la llista de coses pendents de «Remember The Milk» -Comment[ca@valencia]=Miniaplicació per la llista de coses pendents de «Remember The Milk» -Comment[cs]=Applet úkolů Remember The Milk -Comment[da]=Remember The Milk er en opgaveliste-applet. -Comment[de]=Aufgaben-Listen-Miniprogramm für „Remember The Milk“ -Comment[el]=Remember The Milk μικροεφαρμογή λίστας υλοποίησης -Comment[en_GB]=Remember The Milk Todo list applet -Comment[es]=Miniaplicación de tareas pendientes Remember The Milk -Comment[et]=Remember The Milk ülesannete nimekirja aplett -Comment[fi]=Remember The Milk -tehtävälistasovelma -Comment[fr]=Composant graphique de pense-bête pour une liste de tâches -Comment[ga]=Feidhmchláirín tascanna Remember The Milk -Comment[gl]=Applet de lista de tarefas pendentes «Acórdate do leite» -Comment[hu]=Remember The Milk teendőlista-kisalkalmazás -Comment[is]=Smáforritið 'Muna eftir mjólkinni' geralisti -Comment[it]=Applet delle cose da fare Remember The Milk -Comment[ja]=Remember The Milk の To-Do リストアプレット -Comment[kk]=Remember The Milk істейтін істер тізімі -Comment[km]=ចងចាំអាប់ភ្លេត​បញ្ជី​ការងារ​ត្រូវ​ធ្វើ Milk -Comment[ko]=Remember The Milk 할 일 목록 애플릿 -Comment[lt]=„Prisimink pieną“ užduočių sąrašo programėlė -Comment[lv]=Remember The Milk darāmo darbu saraksta sīkrīks -Comment[mr]=दूध लक्षात ठेवा कार्य यादी एप्लेट -Comment[nb]=Husk melk – miniprogram for gjøreliste -Comment[nds]=Opgavenlist-Lüttprogramm "Dor An Denken" -Comment[nl]=Applet voor takenlijst van Remember The Milk -Comment[nn]=Hugselista Remember The Milk -Comment[pa]=ਰੀਮੈਂਬਰ ਦਾ ਮਿਲਕ ਟੂ-ਡੂ ਲਿਸਟ ਐਪਲਿਟ -Comment[pl]=Lista rzeczy do zrobienia Remember The Milk -Comment[pt]='Applet' de lista de tarefas e itens por-fazer -Comment[pt_BR]=Miniaplicativo de lista de tarefas do Remember The Milk -Comment[ro]=Miniaplicație cu listă de sarcini Nu uita laptele -Comment[ru]=Список заданий Remember The Milk -Comment[sk]=Zoznam úloh z Remember The Milk -Comment[sl]=Aplet za opravila na Remember The Milk -Comment[sr]=Аплет списка обавеза на Не заборави млеку -Comment[sr@ijekavian]=Аплет списка обавеза на Не заборави млијеку -Comment[sr@ijekavianlatin]=Aplet spiska obaveza na Ne zaboravi mlijeku -Comment[sr@latin]=Aplet spiska obaveza na Ne zaboravi mleku -Comment[sv]=Miniprogram med lista över Remember The Milk-aktiviteter -Comment[tr]=Remember The Milk Yapılacaklar listesi programcığı -Comment[uk]=Аплет списку завдань Remember The Milk -Comment[wa]=Aplikete des afés Si sovni do laecea -Comment[x-test]=xxRemember The Milk Todo list appletxx -Comment[zh_CN]=Remember The Milk 待办清单小程序 -Comment[zh_TW]=Remember The Milk 待辦清單小程式 -Type=Service -X-KDE-ServiceTypes=Plasma/Applet -Icon=basket - -X-KDE-Library=plasma_applet_rtm -X-KDE-PluginInfo-Author=Andrew Stromme -X-KDE-PluginInfo-Email=astromme@chatonka.com -X-KDE-PluginInfo-Name=plasma_applet_rtm -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://blog.chatonka.com -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-Requires-FileDialog=Unused -X-Plasma-Requires-LaunchApp=Unused diff --git a/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.cpp b/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.cpp deleted file mode 100644 index 6a04ceca..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * Copyright 2012 Jeremy Whiting - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "rememberthemilk-plasmoid.h" - -// Qt Includes -#include -#include -#include - -// KDE Includes -#include -#include -#include - -// Plasma Includes -#include -#include -#include -#include -#include -#include -#include -#include - -// Local -#include "ui_authenticate.h" -#include "ui_general.h" -#include "taskmodel.h" -#include "tasksortfilter.h" -#include - -RememberTheMilkPlasmoid::RememberTheMilkPlasmoid(QObject* parent, const QVariantList& args) - : Plasma::PopupApplet(parent, args), - m_authenticated(false), - m_sortBy(SortDue), - m_taskEditor(0), - m_engine(0), - m_taskService(0), - m_graphicsWidget(0), - m_authService(0), - m_authWidgetUi(new Ui::AuthWidget), - m_generalOptionsUi(new Ui::GeneralWidget) -{ - setBackgroundHints(DefaultBackground); - setPopupIcon("view-pim-journal"); // TODO: Create/Find better item - m_authWidget = new QWidget(); - m_authWidgetUi->setupUi(m_authWidget); - m_authWidgetUi->webView->hide(); - m_generalOptions = new QWidget(); - connect(m_authWidgetUi->signupLabel, SIGNAL(leftClickedUrl(QString)), KToolInvocation::self(), SLOT(invokeBrowser(QString))); - m_generalOptionsUi->setupUi(m_generalOptions); - m_generalOptionsUi->sortType->addItem(i18n("Due Date")); - m_generalOptionsUi->sortType->addItem(i18n("Priority")); -} - -RememberTheMilkPlasmoid::~RememberTheMilkPlasmoid() { - if (hasFailedToLaunch()) { - kDebug() << "failed to launch"; - } - delete m_authWidget; - delete m_authWidgetUi; - - delete m_generalOptions; - delete m_generalOptionsUi; -} - -void RememberTheMilkPlasmoid::init() { - setAspectRatioMode(Plasma::IgnoreAspectRatio); - - graphicsWidget(); - - if (!m_engine || !m_engine->isValid()) { - return Plasma::Applet::init(); - } - - m_engine->connectSource("Auth", this); - - m_authService = m_engine->serviceForSource("Auth"); - m_authService->setParent(this); - connect(m_authService, SIGNAL(finished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*))); - - configChanged(); - - Plasma::Applet::init(); - setAssociatedApplicationUrls(KUrl("http://rememberthemilk.com")); -} - - -void RememberTheMilkPlasmoid::startAuth() -{ - disconnect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(startAuth())); - connect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(continueAuth())); - m_authWidgetUi->authenticateButton->setText(i18n("Click to finish authentication")); - - KConfigGroup cg = m_authService->operationDescription("StartLogin"); - Plasma::ServiceJob* authJob = m_authService->startOperationCall(cg); - connect(authJob, SIGNAL(finished(KJob*)), SLOT(authJobFinished(KJob*))); - busyUntil(authJob); - busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh - m_authenticated = false; -} - -void RememberTheMilkPlasmoid::authJobFinished(KJob* job) -{ - Plasma::ServiceJob *authJob = qobject_cast(job); - QString url = authJob->result().toString(); - m_authWidgetUi->webView->setUrl(QUrl(url)); - m_authWidgetUi->webView->show(); -} - -void RememberTheMilkPlasmoid::continueAuth() -{ - KConfigGroup cg = m_authService->operationDescription("Login"); - Plasma::ServiceJob* authJob = m_authService->startOperationCall(cg); - busyUntil(authJob); - busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh - m_authenticated = false; -} - -void RememberTheMilkPlasmoid::configAccepted() { - switch(m_generalOptionsUi->sortType->currentIndex()) { - case 0: - setSortBy(SortDue); - break; - case 1: - setSortBy(SortPriority); - break; - } -} - -void RememberTheMilkPlasmoid::configFinished() -{ - m_authWidget->setParent(0); // We don't want these widgets destroyed along with the configuration window - m_generalOptions->setParent(0); // They are reused later -} - -void RememberTheMilkPlasmoid::createConfigurationInterface(KConfigDialog* parent) { - connect(parent, SIGNAL(finished()), this, SLOT(configFinished())); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - connect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(startAuth())); - - m_generalOptionsUi->sortType->setCurrentIndex(m_sortBy); - - KPageWidgetItem* general = parent->addPage(m_generalOptions, i18n("General"), "configure", i18n("General Configuration Options")); - KPageWidgetItem* auth = parent->addPage(m_authWidget, i18n("Authentication"), icon(), i18n("Remember The Milk Authentication")); - - if (!m_authenticated) - parent->setCurrentPage(auth); - else - parent->setCurrentPage(general); - - connect(m_generalOptionsUi->sortType, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified())); - connect(this, SIGNAL(authenticated()), parent, SLOT(settingsModified())); -} - -void RememberTheMilkPlasmoid::setSortBy(SortBy sortBy) -{ - m_filterModel->setSortBy(sortBy); - m_model->setDropType(sortBy); - switch (sortBy) { - case SortPriority: - config().writeEntry("SortBy", "Priority"); - m_delegate->setSmallTasks(false); - break; - case SortDue: - config().writeEntry("SortBy", "Date"); - m_delegate->setSmallTasks(true); - break; - } - - m_sortBy = sortBy; -} - -void RememberTheMilkPlasmoid::dataUpdated(const QString& name, const Plasma::DataEngine::Data& data) { - if (name == "Auth") { - m_authenticated = data.value("ValidToken").toBool(); - kDebug() << "Auth: " << m_authenticated; - - m_authWidgetUi->webView->hide(); - if (m_authenticated) { - m_authWidgetUi->authStatus->setText(i18n("Authenticated")); - m_authWidgetUi->kled->setState(KLed::On); - m_authWidgetUi->kled->setColor(Qt::green); - } else { - m_authWidgetUi->authStatus->setText(i18n("Not Authenticated")); - m_authWidgetUi->kled->setState(KLed::Off); - m_authWidgetUi->kled->setColor(Qt::red); - m_busyUntil.clear(); // no longer trying to authenticate - setBusy(false); - } - - if (m_authenticated) { - setConfigurationRequired(false); - m_token = data.value("Token").toString(); - config().writeEntry("token", m_token); - m_engine->connectSource("Lists", this); - m_engine->connectSource("Tasks", this); - busyUntil(0); - - emit authenticated(); - } - else if (m_categoriesBar->count() == 1 && m_lists.isEmpty()) - m_categoriesBar->nativeWidget()->setTabText(0, i18n("Login Failed. Please try again.")); - } - else if (name == "Lists") { - if (m_categoriesBar->count() == 1 && m_lists.isEmpty()) - m_categoriesBar->removeTab(0); // remove "refreshing" tab; - //while (m_categoriesBar->count()) - // m_categoriesBar->removeTab(0); - //m_lists.clear(); //FIXME: What happens when a list is deleted? - foreach(const QString &key, data.keys()) { - if (!m_lists.contains(key.toULongLong())) { - m_categoriesBar->addTab(data.value(key).toString()); - m_lists.append(key.toULongLong()); - } - m_model->listUpdate(key.toULongLong()); - } - int current = config().readEntry("CurrentList").toInt(); - if (m_categoriesBar->count() >= current) { - m_categoriesBar->setCurrentIndex(current); - listChanged(current); // doesn't always update.. i.e if current is actually the current - } - - } - else if (name == "Tasks") { - if (data.keys().count() > 0) - jobFinished(0); // No longer busy. - } -} - -void RememberTheMilkPlasmoid::listChanged(int pos) -{ - if (pos < 0 || pos >= m_lists.size()) - return; - - config().writeEntry("CurrentList", pos); - m_model->switchToList(m_lists.at(pos)); -} - -void RememberTheMilkPlasmoid::createTask(const QString& task) -{ - if (!m_taskService) { - m_taskService = m_engine->serviceForSource("Tasks"); - m_taskService->setParent(this); - connect(m_taskService, SIGNAL(finished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*))); - } - KConfigGroup cg = m_taskService->operationDescription("create"); - cg.writeEntry("task", task); - kDebug() << "QString::number(m_model->currentList()->id)"; - cg.writeEntry("listid", m_model->currentList()->id); - busyUntil(m_taskService->startOperationCall(cg)); -} - -void RememberTheMilkPlasmoid::onTaskEditorHide() { - m_tasksView->nativeWidget()->setEnabled(true); - m_priorityLabel->setText(i18n("Remember The Milk Tasks")); -} - -void RememberTheMilkPlasmoid::showTaskEditor(QModelIndex index) { - if (index.data(Qt::RTMItemType).toInt() != RTMTaskItem) // We have a header rather than a task. - return; - m_taskEditor->setModelIndex(index); - m_taskEditor->hide(); - m_taskEditor->show(); - m_tasksView->nativeWidget()->setEnabled(false); - m_taskEditor->setEnabled(true); - m_taskEditor->startAnimation(m_tasksView->size()); - m_priorityLabel->setText(i18n("Editing Task: ") + index.data(Qt::RTMNameRole).toString()); - - geometryChanged(); -} - -void RememberTheMilkPlasmoid::busyUntil(Plasma::ServiceJob* job) -{ - setBusy(true); - m_busyUntil.append(job); -} - -void RememberTheMilkPlasmoid::jobFinished(Plasma::ServiceJob* job) -{ - if (m_busyUntil.contains(job)) { - m_busyUntil.removeAll(job); - } - if (m_busyUntil.isEmpty()) - setBusy(false); -} - -void RememberTheMilkPlasmoid::resizeEvent(QGraphicsSceneResizeEvent* event) { - if (m_taskEditor) - m_taskEditor->resize(m_tasksView->size()); - Plasma::Applet::resizeEvent(event); -} - -QGraphicsWidget* RememberTheMilkPlasmoid::graphicsWidget() { - if (m_graphicsWidget) - return m_graphicsWidget; - - m_engine = dataEngine("rtm"); - - if (!m_engine || !m_engine->isValid()) { - setFailedToLaunch(true, i18n("Failed to load the Remember The Milk DataEngine")); - return m_graphicsWidget; - } - - m_graphicsWidget = new QGraphicsWidget(this); - - m_model = new TaskModel(m_engine, this); - connect(m_model, SIGNAL(jobStarted(Plasma::ServiceJob*)), SLOT(busyUntil(Plasma::ServiceJob*))); - connect(m_model, SIGNAL(jobFinished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*))); - - m_priorityLabel = new Plasma::Label(this); - m_priorityLabel->setAlignment(Qt::AlignHCenter); - m_priorityLabel->setText(i18n("Remember The Milk Tasks")); - - m_categoriesBar = new Plasma::TabBar(this); - m_categoriesBar->addTab(i18n("No Data Yet. Refreshing...")); - - connect(m_categoriesBar, SIGNAL(currentChanged(int)), SLOT(listChanged(int))); - - QPalette palette; - palette.setBrush(QPalette::Background, Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - palette.setBrush(QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - - - m_delegate = new TaskItemDelegate(this); - - m_filterModel = new TaskSortFilter(m_model, this); - connect(m_model, SIGNAL(modelUpdated()), m_filterModel, SLOT(listChanged())); - - m_tasksView = new Plasma::TreeView(this); - m_tasksView->installEventFilter(m_delegate); - m_tasksView->setModel(m_filterModel); - m_tasksView->nativeWidget()->setItemDelegate(m_delegate); - m_tasksView->nativeWidget()->header()->setHidden(true); - m_tasksView->nativeWidget()->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - m_tasksView->nativeWidget()->setRootIsDecorated(false); - m_tasksView->nativeWidget()->setIndentation(0); - m_tasksView->nativeWidget()->viewport()->setAutoFillBackground(false); - m_tasksView->nativeWidget()->viewport()->setPalette( palette ); - m_tasksView->nativeWidget()->setSelectionMode(QAbstractItemView::SingleSelection); - m_tasksView->nativeWidget()->setDragEnabled(true); - m_tasksView->nativeWidget()->setAcceptDrops(true); - m_tasksView->nativeWidget()->viewport()->setAcceptDrops(true); - m_tasksView->nativeWidget()->setDropIndicatorShown(false); - m_tasksView->nativeWidget()->setDragDropMode(QAbstractItemView::DragDrop); - m_tasksView->nativeWidget()->setSortingEnabled(true); - m_tasksView->nativeWidget()->sortByColumn(0, Qt::AscendingOrder); - m_tasksView->nativeWidget()->expandAll(); - - connect(m_tasksView->nativeWidget(), SIGNAL(clicked(QModelIndex)), this, SLOT(showTaskEditor(QModelIndex))); - - m_searchLine = new Plasma::LineEdit(this); - m_searchLine->nativeWidget()->setClearButtonShown(true); - m_searchLine->nativeWidget()->setClickMessage(i18n("Filter Tasks...")); - connect(m_searchLine->nativeWidget(), SIGNAL(textChanged(QString)), m_filterModel, SLOT(setFilterWildcard(QString))); - - m_addTaskLine = new Plasma::LineEdit(this); // must wait for plasma theming (4.3?) to get a themed lineedit - - m_addTaskLine->nativeWidget()->setClearButtonShown(true); - m_addTaskLine->nativeWidget()->setClickMessage(i18n("Create New Task...")); - - connect(m_addTaskLine->nativeWidget(), SIGNAL(returnPressed(QString)), m_addTaskLine->nativeWidget(), SLOT(clear())); - connect(m_addTaskLine->nativeWidget(), SIGNAL(returnPressed(QString)), this, SLOT(createTask(QString))); - - kDebug() << "Creating layout"; - - m_mainLayout = new QGraphicsLinearLayout(Qt::Vertical, m_graphicsWidget); - - m_mainLayout->addItem(m_priorityLabel); - m_mainLayout->addItem(m_categoriesBar); - m_mainLayout->addItem(m_searchLine); - m_mainLayout->addItem(m_tasksView); - m_mainLayout->addItem(m_addTaskLine); - - m_graphicsWidget->setLayout(m_mainLayout); - m_graphicsWidget->setMinimumSize(250, 300); - m_graphicsWidget->setPreferredSize(300, 500); - - m_taskEditor = new TaskEditor(m_engine, m_tasksView); - m_taskEditor->hide(); - connect(m_taskEditor, SIGNAL(requestDiscardChanges()), this, SLOT(onTaskEditorHide())); - connect(m_taskEditor, SIGNAL(requestSaveChanges()), this, SLOT(onTaskEditorHide())); - connect(m_taskEditor, SIGNAL(jobStarted(Plasma::ServiceJob*)), SLOT(busyUntil(Plasma::ServiceJob*))); - connect(m_taskEditor, SIGNAL(jobFinished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*))); - - return m_graphicsWidget; -} - -void RememberTheMilkPlasmoid::configChanged() -{ - KConfigGroup cg = config(); - m_token = cg.readEntry("token"); - kDebug() << "Token from config: " << m_token; - - if (m_token.isNull()) - setConfigurationRequired(true, i18n("Authentication to Remember The Milk needed")); - else { - KConfigGroup cg = m_authService->operationDescription("AuthWithToken"); - cg.writeEntry("token", m_token); - busyUntil(m_authService->startOperationCall(cg)); - busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh - } - - QString sortBy = config().readEntry("SortBy").toLower(); - kDebug() << "Config says sort by " << sortBy; - if (sortBy == "date" || sortBy == "due") - setSortBy(SortDue); - else if (sortBy == "priority") - setSortBy(SortPriority); - else - setSortBy(SortDue); // Default -} - -#include "moc_rememberthemilk-plasmoid.cpp" diff --git a/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.h b/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.h deleted file mode 100644 index 1f7ebe1b..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/rememberthemilk-plasmoid.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * Copyright 2012 Jeremy Whiting - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef REMEMBERTHEMILK_PLASMOID_H -#define REMEMBERTHEMILK_PLASMOID_H - -#include - -#include -#include - -#include "taskitem.h" -#include "taskeditor.h" -#include "taskitemdelegate.h" -#include "tasksortfilter.h" - -class KJob; - -namespace Plasma { - class TabBar; - class Label; - class LineEdit; - class TreeView; - class ServiceJob; -} - -namespace Ui -{ - class AuthWidget; - class GeneralWidget; -} - -class TaskModel; - -class RememberTheMilkPlasmoid : public Plasma::PopupApplet -{ - Q_OBJECT - public: - RememberTheMilkPlasmoid(QObject *parent, const QVariantList &args); - ~RememberTheMilkPlasmoid(); - - virtual void resizeEvent(QGraphicsSceneResizeEvent* event); - QGraphicsWidget* graphicsWidget(); - void init(); - - public slots: - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); - - void showTaskEditor(QModelIndex index); - void onTaskEditorHide(); - - void busyUntil(Plasma::ServiceJob *job); - void jobFinished(Plasma::ServiceJob* job); - - void createConfigurationInterface(KConfigDialog *parent); - void configAccepted(); - void configFinished(); - void configChanged(); - - // Start the authentication process. - void startAuth(); - // Got a url, so let the user do their part. - void authJobFinished(KJob* job); - // Continue authentication process. - void continueAuth(); - - void setSortBy(SortBy sortBy); - - void listChanged(int pos); - void createTask(const QString &task); - - private: - QString m_token; - QList m_lists; - bool m_authenticated; - QList m_busyUntil; - SortBy m_sortBy; - TaskEditor *m_taskEditor; - Plasma::DataEngine *m_engine; - Plasma::Service *m_taskService; - Plasma::Label *m_priorityLabel; - Plasma::TabBar *m_categoriesBar; - Plasma::TreeView *m_tasksView; - Plasma::LineEdit *m_addTaskLine; - QGraphicsLinearLayout *m_mainLayout; - TaskModel *m_model; - TaskItemDelegate *m_delegate; - QGraphicsWidget *m_graphicsWidget; - Plasma::LineEdit *m_searchLine; - TaskSortFilter *m_filterModel; - - Plasma::Service *m_authService; - Ui::AuthWidget *m_authWidgetUi; - QWidget *m_authWidget; - - Ui::GeneralWidget *m_generalOptionsUi; - QWidget *m_generalOptions; - - signals: - void authenticated(); -}; - -// This links the .desktop file to the applet -K_EXPORT_PLASMA_APPLET(rtm, RememberTheMilkPlasmoid) - -#endif // REMEMBERTHEMILK-PLASMOID_H diff --git a/kdeplasma-addons/applets/rememberthemilk/taskeditor.cpp b/kdeplasma-addons/applets/rememberthemilk/taskeditor.cpp deleted file mode 100644 index c8e6dc2b..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskeditor.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskeditor.h" - -#include "taskitem.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -TaskEditor::TaskEditor(Plasma::DataEngine* engine, QGraphicsWidget* parent) - : QGraphicsWidget(parent), - m_engine(engine), - m_service(0) -{ - mainLayout = new QGraphicsGridLayout(this); - nameEdit = new Plasma::LineEdit(this); - dateEdit = new Plasma::LineEdit(this); - tagsEdit = new Plasma::LineEdit(this); - priorityEdit = new Plasma::ComboBox(this); - completeBox = new Plasma::CheckBox(this); - - nameLabel = new Plasma::Label(this); - nameLabel->setText(i18n("Name:")); - dateLabel = new Plasma::Label(this); - dateLabel->setText(i18n("Due:")); - tagsLabel = new Plasma::Label(this); - tagsLabel->setText(i18n("Tags:")); - priorityLabel = new Plasma::Label(this); - priorityLabel->setText(i18n("Priority:")); - completeLabel = new Plasma::Label(this); - completeLabel->setText(i18n("Complete:")); - - QStringList priorityStrings; - priorityStrings << i18n("Top Priority") << i18n("Medium Priority") << i18n("Low Priority") << i18n("No Priority"); - priorityEdit->nativeWidget()->addItems(priorityStrings); - - saveChangesButton = new Plasma::PushButton(this); - connect(saveChangesButton, SIGNAL(clicked()), this, SIGNAL(requestSaveChanges())); - connect(saveChangesButton, SIGNAL(clicked()), this, SLOT(saveChanges())); - discardChangesButton = new Plasma::PushButton(this); - connect(discardChangesButton, SIGNAL(clicked()), this, SIGNAL(requestDiscardChanges())); - connect(discardChangesButton, SIGNAL(clicked()), this, SLOT(discardChanges())); - - - saveChangesButton->setText(i18n("Update Task")); - saveChangesButton->nativeWidget()->setIcon(KIcon("dialog-ok-apply")); - - discardChangesButton->setText(i18n("Discard Changes")); - discardChangesButton->nativeWidget()->setIcon(KIcon("dialog-cancel")); - - mainLayout->addItem(nameLabel, 0, 0); - mainLayout->addItem(nameEdit, 0, 1); - - mainLayout->addItem(dateLabel, 1, 0); - mainLayout->addItem(dateEdit, 1, 1); - - mainLayout->addItem(tagsLabel, 2, 0); - mainLayout->addItem(tagsEdit, 2, 1); - - mainLayout->addItem(priorityLabel, 3, 0); - mainLayout->addItem(priorityEdit, 3, 1); - - - mainLayout->addItem(completeLabel, 4, 0); - mainLayout->addItem(completeBox, 4, 1); - - //mainLayout->setColumnStretchFactor(2, 1); - mainLayout->setRowStretchFactor(6, 1); - - mainLayout->addItem(saveChangesButton, 7, 0, 1, 2); - mainLayout->addItem(discardChangesButton, 8, 0, 1, 2); - - setLayout(mainLayout); -} - -TaskEditor::~TaskEditor() -{ - // Service is parented to the engine and is thus deleted automatically -} - - -void TaskEditor::keyPressEvent(QKeyEvent* event) { - kDebug() << event->key(); - if (event->key() == Qt::Key_Escape) { - //emit requestDiscardChanges(); // Only works when in line edits... i.e. not good - //discardChanges(); - } - QGraphicsItem::keyPressEvent(event); -} - - -void TaskEditor::setModelIndex(QModelIndex index) { - m_index = index.data(Qt::RTMTaskIdRole).toULongLong(); - - m_name = index.data(Qt::RTMNameRole).toString(); - nameEdit->nativeWidget()->clear(); - nameEdit->nativeWidget()->setText(m_name); - - m_date = index.data(Qt::RTMDueRole).toDate().toString(Qt::DefaultLocaleShortDate); //FIXME: Allow times within a date - dateEdit->nativeWidget()->clear(); - dateEdit->nativeWidget()->setText(m_date); - - m_tags = index.data(Qt::RTMTagsRole).toStringList().join(", "); - tagsEdit->nativeWidget()->clear(); - tagsEdit->nativeWidget()->setText(m_tags); - - priorityEdit->nativeWidget()->setCurrentIndex((index.data(Qt::RTMPriorityRole).toInt()-1) % 4); - m_priority = priorityEdit->nativeWidget()->currentIndex(); - completeBox->setChecked(index.data(Qt::RTMCompletedRole).toBool()); - - if (m_service) - m_service->deleteLater(); - m_service = m_engine->serviceForSource("Task:" + QString::number(m_index)); - connect(m_service, SIGNAL(finished(Plasma::ServiceJob*)), SIGNAL(jobFinished(Plasma::ServiceJob*))); -} - -void TaskEditor::discardChanges() { - startAnimation(fullSize, false); -} - -void TaskEditor::saveChanges() { - if (!m_service) - return; // No index (and hence no task) has been set, or something is really wrong. - - if (m_name != nameEdit->text()) { - kDebug() << "Name Change: " << nameEdit->text(); - KConfigGroup cg = m_service->operationDescription("setName"); - cg.writeEntry("name", nameEdit->text()); - emit jobStarted(m_service->startOperationCall(cg)); - } - - if (m_date != dateEdit->text()) { - kDebug() << "Date Change: " << dateEdit->text(); - KConfigGroup cg = m_service->operationDescription("setDueText"); - cg.writeEntry("dueText", dateEdit->text()); - emit jobStarted(m_service->startOperationCall(cg)); - } - - if (m_tags != tagsEdit->text()) { - QStringList tags = tagsEdit->text().split(','); - KConfigGroup cg = m_service->operationDescription("setTags"); - cg.writeEntry("tags", tags); - emit jobStarted(m_service->startOperationCall(cg)); - } - - if (priorityEdit->nativeWidget()->currentIndex() != m_priority) { - KConfigGroup cg = m_service->operationDescription("setPriority"); - cg.writeEntry("priority", priorityEdit->nativeWidget()->currentIndex() + 1); - emit jobStarted(m_service->startOperationCall(cg)); - } - - if (completeBox->isChecked()) { - KConfigGroup cg = m_service->operationDescription("setCompleted"); - cg.writeEntry("completed", true); - emit jobStarted(m_service->startOperationCall(cg)); - } - - startAnimation(fullSize, false); -} - - -void TaskEditor::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { - Q_UNUSED(widget) - QColor wash = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor); - painter->setBrush(wash); - painter->setPen(QPen(Qt::NoPen)); - painter->drawRect(option->exposedRect); -} - - -void TaskEditor::setFullSize(QSizeF size) { - fullSize = size; - resize(fullSize); -} - - -void TaskEditor::startAnimation(QSizeF endSize, bool show) { - appearing = show; - if (appearing) - foreach(QGraphicsItem* child, childItems()) - child->show(); - - this->show(); - - fullSize = endSize; - resize(fullSize); - - Plasma::Animation *animation = m_fadeAnimation.data(); - if (!animation) { - animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation); - animation->setTargetWidget(this); - animation->setProperty("startValue", 0.0); - animation->setProperty("endValue", 1.0); - animation->setProperty("duration", 100); - m_fadeAnimation = animation; - connect(animation, SIGNAL(finished()), this, SLOT(animationFinished())); - } else if (animation->state() == QAbstractAnimation::Running) { - animation->pause(); - } - - if (show) { - animation->setProperty("easingCurve", QEasingCurve::InQuad); - animation->setProperty("direction", QAbstractAnimation::Forward); - animation->start(QAbstractAnimation::KeepWhenStopped); - } else { - animation->setProperty("easingCurve", QEasingCurve::OutQuad); - animation->setProperty("direction", QAbstractAnimation::Backward); - animation->start(QAbstractAnimation::DeleteWhenStopped); - } -} - -void TaskEditor::animationFinished() { - if (appearing) { - setPos(0, 0); - resize(fullSize); - } - else { - hide(); - } - - update(); -} - -#include "moc_taskeditor.cpp" diff --git a/kdeplasma-addons/applets/rememberthemilk/taskeditor.h b/kdeplasma-addons/applets/rememberthemilk/taskeditor.h deleted file mode 100644 index 04e1cd2a..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskeditor.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKEDITOR_H -#define TASKEDITOR_H - - -namespace Plasma { - class ServiceJob; - class Animation; -} - -//#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -class TaskEditor : public QGraphicsWidget -{ -Q_OBJECT -public: - explicit TaskEditor(Plasma::DataEngine *engine, QGraphicsWidget *parent = 0); - ~TaskEditor(); - - void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); - void setFullSize(QSizeF size); - void setModelIndex(QModelIndex index); - -protected: - void keyPressEvent(QKeyEvent* event); - -signals: - void requestSaveChanges(); - void requestDiscardChanges(); - void jobStarted(Plasma::ServiceJob *job); - void jobFinished(Plasma::ServiceJob *job); - -public slots: - void startAnimation(QSizeF endSize, bool show = true); - void animationFinished(); - -protected slots: - void saveChanges(); - void discardChanges(); - -private: - Plasma::DataEngine *m_engine; - qulonglong m_index; - - QGraphicsGridLayout *mainLayout; - Plasma::Label *nameLabel; - Plasma::LineEdit *nameEdit; - - Plasma::Label *dateLabel; - Plasma::LineEdit *dateEdit; - - Plasma::Label *tagsLabel; - Plasma::LineEdit *tagsEdit; - - Plasma::Label *priorityLabel; - Plasma::ComboBox *priorityEdit; - - Plasma::Label *completeLabel; - Plasma::CheckBox *completeBox; - - Plasma::PushButton *saveChangesButton; - Plasma::PushButton *discardChangesButton; - - bool appearing; // used to know which direction to go in for the animation - QSizeF fullSize; - QString m_name; - QString m_date; - QString m_tags; - int m_priority; - Plasma::Service* m_service; - QWeakPointer m_fadeAnimation; -}; - -#endif // TASKEDITOR_H diff --git a/kdeplasma-addons/applets/rememberthemilk/taskitem.cpp b/kdeplasma-addons/applets/rememberthemilk/taskitem.cpp deleted file mode 100644 index b4648137..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskitem.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskitem.h" - - -#include - -TaskItem::TaskItem() -{ - setData(RTMTaskItem, Qt::RTMItemType); -} - -bool TaskItem::operator<(const QStandardItem& other) const { - return (data(Qt::RTMSortRole).toInt() < other.data(Qt::RTMSortRole).toInt()); -} - -int TaskItem::type() const { - return RTMTaskItem; // FIXME: Use the Qt macro to grab an unused number per app -} - - -HeaderItem::HeaderItem(RTMItemType type) -{ - setData(type, Qt::RTMItemType); - m_type = type; -} - -bool HeaderItem::operator<(const QStandardItem& other) const { - return (data(Qt::RTMSortRole).toInt() <= other.data(Qt::RTMSortRole).toInt()); // <= intentional. Allows PriorityItems to be above other items -} - -int HeaderItem::type() const { - return m_type; -} - - diff --git a/kdeplasma-addons/applets/rememberthemilk/taskitem.h b/kdeplasma-addons/applets/rememberthemilk/taskitem.h deleted file mode 100644 index d546d490..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskitem.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKITEM_H -#define TASKITEM_H - -#include -#include -#include -#include - -namespace Qt -{ - enum ItemUserDataRole { - RTMSortRole = 64, - RTMTaskIdRole = 65, - RTMPriorityRole = 66, - RTMNameRole = 67, - RTMTagsRole = 68, - RTMDueRole = 69, - RTMTimeTRole = 70, - RTMCompletedRole = 71, - RTMItemType = 72 - }; -} - -enum RTMItemType { - RTMTaskItem = 1001, - RTMPriorityHeader = 1002, - RTMDateHeader = 1003 -}; - -enum RTMSortType { - RTMSortByPriority, - RTMSortByDate -}; - -class TaskItem : public QStandardItem -{ -public: - TaskItem(); - virtual bool operator<( const QStandardItem & other ) const; - virtual int type() const; -}; - -class HeaderItem : public QStandardItem -{ -public: - HeaderItem(RTMItemType type); - virtual bool operator<(const QStandardItem& other) const; - virtual int type() const; - -private: - RTMItemType m_type; -}; - -#endif // TASKITEM_H diff --git a/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.cpp b/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.cpp deleted file mode 100644 index 93523e73..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskitemdelegate.h" - -#include "taskeditor.h" - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -const qreal TaskItemDelegate::MARGIN = 1.0; -const qreal TaskItemDelegate::MARGINH = 6.0; -const qreal TaskItemDelegate::COLORTAB = MARGIN*6; - -// These colors are hardcoded because they represent priorities and need to be the same for visual recognition purposes. -const QColor TaskItemDelegate::priority1 = QColor(255, 123, 0); // reddish-orange -const QColor TaskItemDelegate::priority2 = QColor(0, 132, 255); // Darker blue -const QColor TaskItemDelegate::priority3 = QColor(53, 201, 255); // Ligher Blue -const QColor TaskItemDelegate::priorityNone = QColor(241, 241, 241); // Almost white - -const QString TaskItemDelegate::tagsPrefix = i18n("Tags: "); - -TaskItemDelegate::TaskItemDelegate(QObject *parent) - : QStyledItemDelegate(parent), - dragging(false) -{ - setSmallTasks(false); -} - -void TaskItemDelegate::setSmallTasks(bool small) -{ - smallTasks = small; - leftMargin = small ? 0 : MARGIN; -} - - -bool TaskItemDelegate::eventFilter(QObject* object, QEvent* event) { - if (event->type() == QEvent::DragMove) - dragging = true; - if (event->type() == QEvent::Drop || QEvent::DragLeave) - dragging = false; - return QStyledItemDelegate::eventFilter(object, event); -} - -QColor TaskItemDelegate::itemPriorityColor(const QModelIndex &index) const -{ - switch (index.data(Qt::RTMPriorityRole).toInt()) { // Set color based on priority - case 1: - return priority1; - case 2: - return priority2; - case 3: - return priority3; - case 4: - return priorityNone; - } - return QColor(); -} - -void TaskItemDelegate::paintDueHeader(QPainter* painter, const QRectF& rect, const QModelIndex &index) const -{ - painter->save(); - - QFontMetrics fm = QApplication::fontMetrics(); - QString dueString = index.data(Qt::DisplayRole).toString(); - - QLinearGradient gradient(rect.bottomLeft(), rect.bottomRight()); - gradient.setColorAt(0, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - gradient.setColorAt((qreal)(0.9*fm.width(dueString)+2*MARGIN)/rect.width(), Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - gradient.setColorAt((qreal)(1.3*fm.width(dueString)+2*MARGIN)/rect.width(), Qt::transparent); - painter->setBrush(Qt::NoBrush); - painter->setPen(QPen(QBrush(gradient), 1)); - painter->drawLine(rect.bottomLeft()+QPoint(0, -MARGIN), rect.bottomRight()+QPoint(0, -MARGIN)); - - painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - painter->drawText(rect.bottomLeft()+QPoint(MARGIN, -2*MARGIN) ,dueString); - - painter->restore(); -} - -void TaskItemDelegate::paintPriorityHeader(QPainter* painter, const QRectF& rect, const QModelIndex &index) const -{ - painter->save(); - - //Draw colored gradient as priority background - QLinearGradient gradient(rect.topLeft(), rect.bottomRight()); - gradient.setColorAt(0, itemPriorityColor(index)); - gradient.setColorAt(1, Qt::transparent); - - int h = QApplication::fontMetrics().height(); - QPainterPath path; - path.moveTo(rect.bottomLeft()); - path.quadTo(rect.bottomLeft()+QPointF(0, -h), rect.bottomLeft()+QPointF(2, -h)); - path.lineTo(rect.bottomRight()-QPointF(2, h)); - path.quadTo(rect.bottomRight()+QPointF(0, -h), rect.bottomRight()); - painter->setBrush(Qt::NoBrush); - QPen thickPen(itemPriorityColor(index)); - thickPen.setWidth(2); - painter->setPen(thickPen); - painter->drawPath(path); - - // Draw priority text - QString priority = index.data(Qt::DisplayRole).toString(); - painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - painter->setBrush(Qt::NoBrush); - painter->drawText(rect.bottomLeft()+QPoint(MARGIN, -2*MARGIN) ,priority); - - painter->restore(); -} - -void TaskItemDelegate::paintTask(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex& index) const -{ - QRect rect = option.rect; - QFontMetrics fm = QApplication::fontMetrics(); - - // Painting Order: - // Background wash - // Mouseover highlight - // Priority Tab on left - // Bounding Box - // Task name - // If not small, other task information - - painter->save(); - if (smallTasks) { // Paint the background for a small task - painter->save(); - painter->setOpacity(0.5); - painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - painter->setPen(Qt::NoPen); - painter->drawRoundedRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3); - painter->restore(); - } - else { // Paint the background for a two row task - painter->save(); - painter->setOpacity(0.5); - painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - painter->drawRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN)); - - painter->restore(); - painter->drawRect(QRectF(option.rect.topLeft()+QPointF(leftMargin, MARGIN), option.rect.bottomLeft()+QPointF(COLORTAB, -MARGIN))); - } - - if (option.state & QStyle::State_MouseOver) { - painter->save(); - painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::HighlightColor)); - painter->setPen(Qt::NoPen); - if (smallTasks) - painter->drawRoundedRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3); - else - painter->drawRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN)); - painter->restore(); - } - - //Paint Priority tab on the left - painter->setPen(Qt::NoPen); - painter->setBrush(itemPriorityColor(index)); - painter->drawRoundedRect(QRectF(option.rect.topLeft()+QPointF(leftMargin, MARGIN), option.rect.bottomLeft()+QPointF(COLORTAB, 0)), 3, 3); - - - // Draw Bounding rect/box - painter->save(); - painter->setOpacity(.5); - painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - painter->setBrush(Qt::NoBrush); - if (smallTasks) - painter->drawRoundedRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3); - else - painter->drawRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN)); - painter->restore(); - - - // Draw Task information - painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - - QString task = index.data(Qt::RTMNameRole).toString(); - QString due = index.data(Qt::RTMDueRole).toDate().toString("MMM d"); - QString tags = index.data(Qt::RTMTagsRole).toStringList().join(", "); - if (!tags.isEmpty()) - tags.prepend(tagsPrefix); - - QFont font = painter->font(); - font.setPointSize(font.pointSize()); - QFontMetrics largerFM(font); - - QDate date = index.data(Qt::RTMDueRole).toDate(); - - if (smallTasks && date.isValid() && date < QDate::currentDate()) { - // Elide (text with dots like th...) if wider than view and draw - font.setBold(true); - QFontMetrics boldLargerFM(font); - due = due.append(" "); // So that we have a space after the date before the task name - task = largerFM.elidedText(task, Qt::ElideRight, option.rect.width()-COLORTAB-3*MARGIN - boldLargerFM.width(due)); - painter->setFont(font); - painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+MARGIN,largerFM.height()),due); - - font.setBold(false); - painter->setFont(font); - painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+3*MARGIN + boldLargerFM.width(due),boldLargerFM.height()),task); - } - else { - // Elide (text with dots like th...) if wider than view and draw - task = largerFM.elidedText(task, Qt::ElideRight, option.rect.width()-COLORTAB-3*MARGIN); - painter->setFont(font); - painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+MARGIN,largerFM.height()),task); - } - - if (smallTasks) { - painter->restore(); - return; - } - - // Set our smaller attributes and blue hue for additional text - font.setPointSize(font.pointSize()-1); - font.setItalic(true); - painter->setFont(font); - fm = QFontMetrics(font); - QColor moreText(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); - - qreal red = moreText.redF(); - qreal green = moreText.greenF(); - qreal blue = moreText.blueF(); - qreal colorChangeMult = 0.85; - if (blue < colorChangeMult) - blue /= colorChangeMult; - else { - red *= colorChangeMult; - green *= colorChangeMult; - } - moreText.setRgbF(red, green, blue); - painter->setPen(moreText); - - // Elide the due from the front because "Due on" isn't necessary - due = fm.elidedText(due, Qt::ElideLeft, option.rect.width() - COLORTAB+3*MARGIN - fm.width(tags)); - painter->drawText(option.rect.bottomLeft()+QPoint(COLORTAB+MARGIN, -MARGINH), tags); - painter->drawText(option.rect.bottomRight()+QPoint(-COLORTAB+MARGIN-fm.width(due), -MARGINH), due); - - painter->restore(); -} - -void TaskItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - switch (index.data(Qt::RTMItemType).toInt()) { - case RTMPriorityHeader: - paintPriorityHeader(painter, option.rect, index); - break; - case RTMDateHeader: - paintDueHeader(painter, option.rect, index); - break; - case RTMTaskItem: - paintTask(painter, option, index); - break; - } -} - -QSize TaskItemDelegate::sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - Q_UNUSED(option) - if (smallTasks || index.data(Qt::RTMItemType).toInt() != RTMTaskItem) { - QString priority = index.data(Qt::DisplayRole).toString(); - QSize size; - if (index.data(Qt::RTMItemType).toInt() == RTMDateHeader) - size.setHeight(QApplication::fontMetrics().height()+MARGINH*1.5); - else - size.setHeight(QApplication::fontMetrics().height()+MARGINH); - size.setWidth(QApplication::fontMetrics().width(priority)); - return size; - } - else { - QString task = index.data(Qt::RTMNameRole).toString(); - QString due = index.data(Qt::RTMDueRole).toDate().toString("MMM d"); - QString tags = index.data(Qt::RTMTagsRole).toStringList().join(", "); - if (!tags.isEmpty()) - tags.prepend(tagsPrefix); - - //QSize size = QStyledItemDelegate::sizeHint(option, index); - QSize size; - size.setHeight(MARGINH + MARGINH + QApplication::fontMetrics().height()*2); - size.setWidth(MARGIN + MARGIN + QApplication::fontMetrics().width(task+due)); - return size; - } -} diff --git a/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.h b/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.h deleted file mode 100644 index e70fa681..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskitemdelegate.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKITEMDELEGATE_H -#define TASKITEMDELEGATE_H - -#include -#include -#include -#include - -#include "taskitem.h" - -class TaskItemDelegate : public QStyledItemDelegate -{ -public: - TaskItemDelegate(QObject *parent = 0); - - virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - virtual QSize sizeHint (const QStyleOptionViewItem &option, - const QModelIndex &index) const; - - virtual bool eventFilter(QObject* object, QEvent* event); - - void setSmallTasks(bool small); - - void paintTask(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - void paintPriorityHeader(QPainter* painter, const QRectF &rect, const QModelIndex &index) const; - void paintDueHeader(QPainter* painter, const QRectF &rect, const QModelIndex &index) const; - - QColor itemPriorityColor(const QModelIndex &index) const; - - static const qreal MARGIN; - static const qreal MARGINH; - static const qreal COLORTAB; - static const QString tagsPrefix; - - static const QColor priority1; - static const QColor priority2; - static const QColor priority3; - static const QColor priorityNone; - -protected: - bool dragging; - bool smallTasks; - qreal leftMargin; -}; - -#endif // TASKITEMDELEGATE_H diff --git a/kdeplasma-addons/applets/rememberthemilk/taskmodel.cpp b/kdeplasma-addons/applets/rememberthemilk/taskmodel.cpp deleted file mode 100644 index 2670f2a4..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskmodel.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskmodel.h" -#include "taskitem.h" - -#include -#include -#include -#include -#include - - -TaskModel::TaskModel(Plasma::DataEngine* e, QObject* parent) - : QStandardItemModel(parent), - engine(e), - dropType(SortPriority) -{ - currentListIndex = 0; - - rootitem = invisibleRootItem(); - - refreshToplevel(); -} - - -TaskModel::~TaskModel() { -} - -void TaskModel::setDropType(SortBy dropType) -{ - this->dropType = dropType; -} - -void TaskModel::dayChanged() -{ - QDateTime nextMidnight = QDateTime(QDate::currentDate().addDays(1)); - int secsUntilMidnight = QDateTime::currentDateTime().secsTo(nextMidnight); - midnightAlarm.setInterval(1000*secsUntilMidnight+5000); // 5 secs over to ensure we're not under - midnightAlarm.start(); - - m_dateItems.at(0)->setData(0, Qt::RTMTimeTRole); // Overdue - m_dateItems.at(0)->setData(0, Qt::RTMSortRole); - - m_dateItems.at(1)->setData(QDateTime(QDate::currentDate()).toTime_t(), Qt::RTMTimeTRole); // Today - m_dateItems.at(1)->setData(QDateTime(QDate::currentDate()).toTime_t(), Qt::RTMSortRole); - - m_dateItems.at(2)->setData(QDateTime(QDate::currentDate()).addDays(1).toTime_t(), Qt::RTMTimeTRole); // Tomorrow - m_dateItems.at(2)->setData(QDateTime(QDate::currentDate()).addDays(1).toTime_t(), Qt::RTMSortRole); - - m_dateItems.at(3)->setData(QDateTime(QDate::currentDate()).addDays(2).toTime_t(), Qt::RTMTimeTRole); // Past Tomorrow/Never - m_dateItems.at(3)->setData(QDateTime(QDate::currentDate()).addDays(2).toTime_t(), Qt::RTMSortRole); - - emit modelUpdated(); -} - -void TaskModel::refreshToplevel() -{ - m_priorityItems.clear(); - m_dateItems.clear(); - rootitem->removeRows(0, rootitem->rowCount()); // FIXME: Crash candidate? - - QStringList priorityStrings; - priorityStrings.append(i18n("Top Priority:")); - priorityStrings.append(i18n("Medium Priority:")); - priorityStrings.append(i18n("Low Priority:")); - priorityStrings.append(i18n("No Priority:")); - - QStringList dateStrings; - dateStrings.append(i18n("Overdue")); - dateStrings.append(i18n("Today")); - dateStrings.append(i18n("Tomorrow")); - dateStrings.append(i18n("Anytime")); //FIXME: STRINGFREEZE: Consider a change to 'Later' - - for(int i=0;i<4;i++) { - HeaderItem *priority = new HeaderItem(RTMPriorityHeader); - priority->setData(i+1, Qt::RTMPriorityRole); - priority->setData(i+1, Qt::RTMSortRole); // Put it in both places so both the coloring and the sorting work - priority->setData(priorityStrings.at(i), Qt::DisplayRole); - priority->setEditable(false); - m_priorityItems.append(priority); - rootitem->insertRow(rootitem->rowCount(), priority); - - HeaderItem *date = new HeaderItem(RTMDateHeader); - date->setData(dateStrings.at(i), Qt::DisplayRole); - date->setEditable(false); - m_dateItems.append(date); - rootitem->insertRow(rootitem->rowCount(), date); - } - dayChanged(); - connect(&midnightAlarm, SIGNAL(timeout()), SLOT(dayChanged())); -} -QFlags< Qt::DropAction > TaskModel::supportedDropActions() const { - //kDebug() << "TaskModel::supportedDropActions()"; - - return Qt::MoveAction; -} - -QFlags< Qt::ItemFlag > TaskModel::flags(const QModelIndex& index) const { - Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index); - - if (defaultFlags.testFlag(Qt::ItemIsDragEnabled)) - defaultFlags ^= Qt::ItemIsDragEnabled; // bitwise xor, i.e. remove this flag if it is there. - - if (index.data(Qt::RTMItemType).toInt() != RTMTaskItem) //header item - return Qt::ItemIsDropEnabled | defaultFlags; - else - return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags; -} - -QStringList TaskModel::mimeTypes() const { - QStringList types; - types << "application/vnd.text.list"; - return types; -} - -QMimeData* TaskModel::mimeData(const QList< QModelIndex >& indexes) const { - kDebug() << "TaskModel::mimeData"; - QMimeData *mimeData = new QMimeData(); - QByteArray encodedData; - - QDataStream stream(&encodedData, QIODevice::WriteOnly); - - foreach(const QModelIndex &index, indexes) - if (index.isValid()) - stream << index.data(Qt::RTMTaskIdRole).toString(); - - mimeData->setData("application/vnd.text.list", encodedData); - return mimeData; -} - -bool TaskModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) { - Q_UNUSED(row); - if (action == Qt::IgnoreAction) - return true; - - if (!data->hasFormat("application/vnd.text.list")) - return false; - - if (column > 0) - return false; - - RTMItemType dropHeaderType; - - if (dropType == SortDue) - dropHeaderType = RTMDateHeader; - else if (dropType == SortPriority) - dropHeaderType = RTMPriorityHeader; - else - dropHeaderType = RTMDateHeader; // default it - - QModelIndex parentItem = parent; - - while (parentItem.data(Qt::RTMItemType).toInt() != dropHeaderType && parentItem.row() >= 0) - parentItem = index(parentItem.row()-1, 0, rootitem->index()); // This is buggy. going up rows doesn't always give the right headers... - - kDebug() << parentItem.data(Qt::RTMItemType).toInt(); - - QByteArray encodedData = data->data("application/vnd.text.list"); - QDataStream stream(&encodedData, QIODevice::ReadOnly); - QStringList newItems; - int rows = 0; - - while (!stream.atEnd()) { - QString text; - stream >> text; - newItems << text; - ++rows; - } - - //int beginRow = rowCount(priorityParent); - foreach(const QString &id, newItems) { - if (m_taskItems.contains(id.toULongLong())) { - TaskItem *item = taskFromId(id.toULongLong()); - if (item) { - Plasma::Service *service = engine->serviceForSource("Task:" + id); - connect(service, SIGNAL(finished(Plasma::ServiceJob*)), SIGNAL(jobFinished(Plasma::ServiceJob*))); - if (service) { - if (dropType == SortDue) { - QDate headerDate = QDateTime::fromTime_t(parentItem.data(Qt::RTMTimeTRole).toUInt()).date(); - kDebug() << headerDate; - if (headerDate < QDate::currentDate()) - headerDate = QDate::currentDate().addDays(-1); // set to due yesterday - else if (headerDate == QDate::currentDate().addDays(2)) // set to due never - headerDate = QDate(); - kDebug() << "Setting Item to be due: " << headerDate.toString(Qt::SystemLocaleShortDate); - KConfigGroup cg = service->operationDescription("setDueText"); - cg.writeEntry("dueText", headerDate.toString(Qt::SystemLocaleShortDate)); - emit jobStarted(service->startOperationCall(cg)); - } - else if (dropType == SortPriority) { - kDebug() << "Setting Item to priority: " << parentItem.data(Qt::RTMPriorityRole).toInt(); - KConfigGroup cg = service->operationDescription("setPriority"); - cg.writeEntry("priority", parentItem.data(Qt::RTMPriorityRole).toInt()); - emit jobStarted(service->startOperationCall(cg)); - } - } - } - } - } - return false; // We don't actually process the drop right now. We just send off the request and let the library->dataengine->plasmoid take care of it. -} - -TaskItem* TaskModel::taskFromId(qulonglong id) { - if (m_taskItems.contains(id)) - return m_taskItems.value(id); - - TaskItem *item = new TaskItem(); - item->setEditable(false); // We override the normal Qt editing structure because we provide TaskEditor overlay - m_taskItems.insert(id, item); - return item; -} - -ListItem* TaskModel::listFromId(qulonglong id) { - if (m_listItems.contains(id)) - return m_listItems.value(id); - - ListItem *item = new ListItem(); - m_listItems.insert(id, item); - listUpdate(id); - return item; -} - -void TaskModel::listUpdate(qulonglong listId) -{ - if (!m_listItems.contains(listId)) { - engine->connectSource("List:" + QString::number(listId), this); - } - else { - foreach(const qulonglong &taskid, m_listItems.value(listId)->tasks) { - engine->connectSource("Task:" + QString::number(taskid), this); - } - } -} - -void TaskModel::switchToList(qulonglong listId) { - m_currentList = listId; - emit listSwitched(listId); - emit modelUpdated(); -} - -const ListItem* TaskModel::currentList() { - return listFromId(m_currentList); -} - - -void TaskModel::dataUpdated(const QString& name, const Plasma::DataEngine::Data& data) { - //kDebug() << name; - if (name.startsWith(QLatin1String("List:"))) { - //kDebug() << data.value("id"); - qulonglong id = data.value("id").toULongLong(); - if (id == 0) - return; - ListItem *item = listFromId(id); - - item->id = id; - item->name = data.value("name").toString(); - item->smart = data.value("smart").toBool(); - - item->tasks.clear(); - - foreach(const QString &key, data.keys()) { - if (key != "id" && key != "name" && key != "smart") - item->tasks.append(key.toULongLong()); - } - if (!item->tasks.count()) { - kDebug() << "No tasks for: " << item->name << item->id << data.keys() << item->tasks; - } - if (id == m_currentList) - switchToList(m_currentList); - } - else if (name.startsWith(QLatin1String("Task:"))) { - qulonglong id = data.value("id").toULongLong(); - if (id == 0) // Seems to happen when multiple applets are running - return; - TaskItem *item = taskFromId(id); - - item->setData(data.value("id"), Qt::RTMTaskIdRole); - item->setData(data.value("priority"), Qt::RTMPriorityRole); - item->setData(data.value("name"), Qt::RTMNameRole); - item->setData(data.value("tags"), Qt::RTMTagsRole); - item->setData(data.value("due"), Qt::RTMDueRole); - item->setData(data.value("isCompleted"), Qt::RTMCompletedRole); - - QDateTime due = data.value("due").toDateTime(); - if (due.isValid()) - item->setData(due.toTime_t(), Qt::RTMTimeTRole); - else - item->setData(UINT_MAX, Qt::RTMTimeTRole); - - //item->setData(data.value("priority"), Qt::RTMSortRole); - - if (item->parent()) { - item->parent()->takeRow(item->row()); - } - insertTask(id); - } - else { - kDebug() << "Error, unknown source: " << name; - } - - emit modelUpdated(); -} - -void TaskModel::insertTask(qulonglong taskid) -{ - TaskItem *task = taskFromId(taskid); - if (!task->model()) - rootitem->insertRow(rootitem->rowCount(), task); -} - -#include "moc_taskmodel.cpp" diff --git a/kdeplasma-addons/applets/rememberthemilk/taskmodel.h b/kdeplasma-addons/applets/rememberthemilk/taskmodel.h deleted file mode 100644 index 08a7fda0..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/taskmodel.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_TASKMODEL_H -#define RTM_TASKMODEL_H - -#include -#include -#include - -#include "tasksortfilter.h" - -namespace Plasma { - class ServiceJob; -} - -class TaskItem; - -struct ListItem { - qulonglong id; - bool smart; - QString name; - QList tasks; - -}; - -class TaskModel : public QStandardItemModel -{ -Q_OBJECT -public: - explicit TaskModel(Plasma::DataEngine *engine, QObject *parent=0); - QFlags< Qt::DropAction > supportedDropActions() const; - QFlags< Qt::ItemFlag > flags(const QModelIndex& index) const; - QStringList mimeTypes() const; - QMimeData* mimeData(const QList< QModelIndex >& indexes) const; - bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent); - - void setDropType(SortBy dropType); - - void listUpdate(qulonglong listId); - void switchToList(qulonglong listId); - const ListItem* currentList(); - - ~TaskModel(); - -public slots: - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); - void dayChanged(); - -signals: - void listSwitched(qulonglong listId); - void modelUpdated(); - void jobStarted(Plasma::ServiceJob *job); - void jobFinished(Plasma::ServiceJob *job); - -protected: - void refreshToplevel(); - void insertTask(qulonglong task); - QMap m_taskItems; - QMap m_listItems; - int currentListIndex; - QList m_priorityItems; - QList m_dateItems; - QStandardItem *rootitem; - qulonglong m_currentList; - Plasma::DataEngine *engine; - SortBy dropType; - -private: - QTimer midnightAlarm; - TaskItem* taskFromId(qulonglong id); - ListItem* listFromId(qulonglong id); -}; - -#endif // RTM_TASKMODEL_H diff --git a/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.cpp b/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.cpp deleted file mode 100644 index d56328aa..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "tasksortfilter.h" -#include "taskitem.h" -#include "taskmodel.h" - -#include -#include - -TaskSortFilter::TaskSortFilter(TaskModel *model, QObject* parent) - : QSortFilterProxyModel(parent), - m_model(model), - filterOn(All), - sortBy(SortPriority) -{ - setSourceModel(model); - setDynamicSortFilter(true); - setFilterCaseSensitivity(Qt::CaseInsensitive); -} - -void TaskSortFilter::listChanged() -{ - invalidate(); -} - -void TaskSortFilter::setSortBy(SortBy sortBy) -{ - if (this->sortBy == sortBy) - return; - - this->sortBy = sortBy; - - invalidate(); - emit layoutChanged(); -} - -bool TaskSortFilter::lessThan(const QModelIndex& left, const QModelIndex& right) const -{ - uint leftTime = sourceModel()->data(left, Qt::RTMTimeTRole).toUInt(); - uint rightTime = sourceModel()->data(right, Qt::RTMTimeTRole).toUInt(); - - int leftPriority = sourceModel()->data(left, Qt::RTMPriorityRole).toInt(); - int rightPriority = sourceModel()->data(right, Qt::RTMPriorityRole).toInt(); - - if (sortBy == SortDue) { - if (sourceModel()->data(left, Qt::RTMItemType).toInt() == RTMPriorityHeader) - return leftTime <= rightTime; - else if (leftTime == rightTime) - return leftPriority < rightPriority; // Subsort by priority - else - return leftTime < rightTime; - } - - else if (sortBy == SortPriority) { - - - if (left.data(Qt::RTMItemType).toInt() != RTMTaskItem) - return leftPriority <= rightPriority; - else if (leftPriority == rightPriority) - return leftTime < rightTime; // Subsort by time - else - return leftPriority < rightPriority; - } - kDebug() << "Returning default"; - - return TaskSortFilter::lessThan(left, right); -} - -bool TaskSortFilter::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const { - Q_UNUSED(source_column) - Q_UNUSED(source_parent) - return true; -} - -bool TaskSortFilter::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const { - - QModelIndex item = sourceModel()->index(source_row, 0, source_parent); - if (item.data(Qt::RTMItemType).toInt() == RTMPriorityHeader) { //Priority header - return sortBy == SortPriority ? true : false; // same as an if (condition) true; else false; structure; - } - if (item.data(Qt::RTMItemType).toInt() == RTMDateHeader) { - return sortBy == SortDue ? true : false; - } - - - const ListItem *currentList = m_model->currentList(); - if (!currentList->tasks.contains(item.data(Qt::RTMTaskIdRole).toULongLong())) - return false; - - if (item.data(Qt::RTMCompletedRole).toBool()) - return false; - - if (item.isValid()) { - switch (filterOn) { - case Tags: - foreach(const QString &tag, item.data(Qt::RTMTagsRole).toStringList()) { - if (tag.contains(filterRegExp())) - return true; - } - break; - - case Name: - if (item.data(Qt::RTMNameRole).toString().contains(filterRegExp())) - return true; - break; - - case Due: - if (item.data(Qt::RTMDueRole).toDateTime().toString(Qt::LocalDate).contains(filterRegExp())) - return true; - break; - - case All: - if ((item.data(Qt::RTMNameRole).toString().contains(filterRegExp())) || - (item.data(Qt::RTMDueRole).toDateTime().toString(Qt::LocalDate).contains(filterRegExp())) - ) - return true; - foreach(const QString &tag, item.data(Qt::RTMTagsRole).toStringList()) { - if (tag.contains(filterRegExp())) - return true; - } - break; - } - } - return false; -} - - -void TaskSortFilter::setFilterWildcard(QString pattern) { - if (pattern.startsWith(QLatin1String("tag:"))) { - pattern.remove("tag:"); - filterOn = Tags; - } - else if (pattern.startsWith(QLatin1String("task:"))) { - pattern.remove("task:"); - filterOn = Name; - } - else if (pattern.startsWith(QLatin1String("name:"))) { - pattern.remove("name:"); - filterOn = Name; - } - else if (pattern.startsWith(QLatin1String("date:"))) { - pattern.remove("date:"); - filterOn = Due; - } - else if (pattern.startsWith(QLatin1String("due:"))) { - pattern.remove("due:"); - filterOn = Due; - } - else - filterOn = All; - - QSortFilterProxyModel::setFilterWildcard(pattern); -} diff --git a/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.h b/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.h deleted file mode 100644 index 11e68883..00000000 --- a/kdeplasma-addons/applets/rememberthemilk/tasksortfilter.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_TASKSORTFILTER_H -#define RTM_TASKSORTFILTER_H - -class TaskModel; - -#include - -enum FilterOn { All, Name, Tags, Due }; -enum SortBy { SortDue = 0, SortPriority = 1 }; - -class TaskSortFilter : public QSortFilterProxyModel -{ -Q_OBJECT -public: - explicit TaskSortFilter(TaskModel* model, QObject* parent = 0); - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const; - bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const; - bool lessThan(const QModelIndex& left, const QModelIndex& right) const; - - void setSortBy(SortBy sortBy); - -public slots: - void setFilterWildcard(QString filter); - void listChanged(); - -private: - TaskModel *m_model; - FilterOn filterOn; - SortBy sortBy; -}; - -#endif diff --git a/kdeplasma-addons/applets/webslice/CMakeLists.txt b/kdeplasma-addons/applets/webslice/CMakeLists.txt deleted file mode 100644 index 49cf9a4c..00000000 --- a/kdeplasma-addons/applets/webslice/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -project(webslice) - -include_directories( ${QT_INCLUDES} ) - -set(webslice_SRCS - main.cpp - kgraphicswebslice.cpp - kwebslice.cpp -) - -add_executable(webslice ${webslice_SRCS}) - -target_link_libraries(webslice - ${QT_QTCORE_LIBRARY} - ${QT_QTNETWORK_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTWEBKIT_LIBRARY} - ${QT_QTSCRIPT_LIBRARY} -) - -add_subdirectory(plasma) diff --git a/kdeplasma-addons/applets/webslice/kgraphicswebslice.cpp b/kdeplasma-addons/applets/webslice/kgraphicswebslice.cpp deleted file mode 100644 index ad923ff7..00000000 --- a/kdeplasma-addons/applets/webslice/kgraphicswebslice.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2009-2011 by Sebastian Kügler - * Copyright 2009 by Richard Moore - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kgraphicswebslice.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct KGraphicsWebSlicePrivate -{ - QString selector; - QRectF sliceGeometry; - QRectF originalGeometry; - QString loadingText; - QTimer* resizeTimer; - QSizeF resizeNew; - QRectF previewRect; - bool previewMode; - QColor previewMaskColor; - QSize fullContentSize; - QWebElementCollection elementCache; - QHash selectorGeometry; - QRect documentGeometry; -}; - -KGraphicsWebSlice::KGraphicsWebSlice( QGraphicsWidget *parent ) - : QGraphicsWebView( parent ) -{ - d = new KGraphicsWebSlicePrivate; - d->originalGeometry = QRectF(); - d->fullContentSize = QSize(1024,768); - d->previewMaskColor = QColor("black"); - connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finishedLoading(bool))); - - d->resizeTimer = new QTimer(this); - d->resizeTimer->setInterval(100); - d->resizeTimer->setSingleShot(true); - d->resizeNew = QSizeF(); - connect(d->resizeTimer, SIGNAL(timeout()), SLOT(resizeTimeout())); - - //resize(300, 300); -} - -KGraphicsWebSlice::~KGraphicsWebSlice() -{ - delete d; -} - -void KGraphicsWebSlice::loadSlice(const QUrl &u, const QString &selector) -{ - if ( d->selector == selector && url() == u) { - return; - } - setElement(selector); - if (url() != u) { - QGraphicsWebView::load(u); - } - setZoomFactor(1.0); -} - -void KGraphicsWebSlice::setLoadingText(const QString &html) -{ - d->loadingText = html; -} - -void KGraphicsWebSlice::setElement(const QString &selector) -{ - d->selector = selector; -} - -void KGraphicsWebSlice::setSliceGeometry(const QRectF geo) -{ - d->sliceGeometry = geo; -} - -void KGraphicsWebSlice::finishedLoading(bool ok) -{ - if (!ok) { - return; - } - // Normalize page - qDebug() << "loading finished" << ok << ", updating cache then slice or preview"; - QWebFrame *frame = page()->mainFrame(); - frame->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff ); - frame->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff ); - page()->setPreferredContentsSize(d->fullContentSize); - - // Update geometry caches - updateElementCache(); - - // Zoom to slice or preview - refresh(); -} - -void KGraphicsWebSlice::refresh() -{ - // TODO: optimize for non-changes - if (!d->previewMode) { - showSlice(d->selector); - } else { - showPage(); - } -} - -void KGraphicsWebSlice::updateElementCache() -{ - qDebug() << "updateElementCache()"; - d->elementCache = page()->mainFrame()->findAllElements("*"); - d->documentGeometry = page()->mainFrame()->documentElement().geometry(); - foreach(const QWebElement &el, d->elementCache) { - d->selectorGeometry[qHash(el.toOuterXml())] = el.geometry(); - } -} - -QRectF KGraphicsWebSlice::previewGeometry(const QString &selector) const -{ - return QRectF(page()->mainFrame()->findFirstElement(selector).geometry()); -} - -QRectF KGraphicsWebSlice::sliceGeometry(const QString &selector) const -{ - QWebElement el = page()->mainFrame()->findFirstElement(selector); - return d->selectorGeometry.value(qHash(el.toOuterXml())); -} - -void KGraphicsWebSlice::resizeEvent ( QGraphicsSceneResizeEvent * event ) -{ - setTiledBackingStoreFrozen(true); - d->resizeNew = event->newSize(); - d->resizeTimer->start(); - event->accept(); -} - -void KGraphicsWebSlice::resizeTimeout() -{ - QSizeF n = d->resizeNew; - // Prevent oopses. - if (n.width() > 2400 || n.height() > 2400) { - qDebug() << "giant size, what's going on???????" << n.width(); - return; - } - refresh(); - setTiledBackingStoreFrozen(false); -} - -void KGraphicsWebSlice::preview(const QString &selector) -{ - if (selector.isEmpty()) { - setPreviewMode(false); - refresh(); - return; - } - setPreviewMode(true); - d->previewRect = previewGeometry(selector); - update(); -} - -void KGraphicsWebSlice::setPreviewMode(bool on) -{ - showPage(); - if (on && !d->previewMode) { - d->previewMode = on; - refresh(); - } - if (!on && d->previewMode) { - d->previewMode = on; - setZoomFactor(1.0); - refresh(); - } -} - -void KGraphicsWebSlice::showSlice(const QString &selector) -{ - QRectF r = sliceGeometry(selector); - // qDebug() << "area=" << d->documentGeometry << ", viewportSize=" << page()->viewportSize() << ", contentsRect=" << contentsRect().size(); - if (!selector.isEmpty() && r.isValid()) { - zoom(r); - } else if (d->documentGeometry.width() != contentsRect().size().width()) { - // Change zoom level only if the current one isn't appropriate - // but reset to 1.0 first - setZoomFactor(1.0); - updateElementCache(); - zoom(d->documentGeometry); - } -} - -void KGraphicsWebSlice::zoom(const QRectF &area) -{ - if (!area.isValid()) { - qDebug() << "invalid zoom area" << area; - return; - } - - qreal f = contentsRect().size().width() / qMax((qreal)1.0, area.width()); - - // size: zoom page - if (f > 0.1 && f < 32) { // within sane bounds? - setZoomFactor(f); - } - - if (area != sliceGeometry(d->selector)) { - qDebug() << "different results."; - } - - // position: move origin according to zoom - QPointF viewPosition = area.topLeft(); - // We end up positioning too low, so move the new position up a little - viewPosition = QPointF(viewPosition.x() * f, (viewPosition.y() * f) - (16 * f)); - page()->mainFrame()->setScrollPosition(viewPosition.toPoint()); -} - -void KGraphicsWebSlice::showPage() -{ - qreal zoom = 1.0; - - QSizeF o = d->documentGeometry.size(); - QSizeF s = o; - s.scale(contentsRect().size(), Qt::KeepAspectRatio); - - zoom = s.width() / qMax((qreal)1.0, contentsRect().width()); - setZoomFactor(zoom); - page()->mainFrame()->setScrollPosition(QPoint(0, 0)); - update(); -} - -QPixmap KGraphicsWebSlice::elementPixmap() const -{ - QRectF rect = sliceGeometry(); - if (!rect.isValid()) { - return QPixmap(); - } - QPixmap result = QPixmap( rect.size().toSize() ); - result.fill( Qt::white ); - - QPainter painter( &result ); - painter.translate( -rect.x(), -rect.y() ); - QWebFrame *frame = page()->mainFrame(); - frame->render( &painter, QRegion(rect.toRect()) ); - - return result; -} - -void KGraphicsWebSlice::setPreviewMaskColor(const QColor &color) -{ - d->previewMaskColor = color; - if (d->previewMode) { - update(); - } -} - -void KGraphicsWebSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget) -{ - QGraphicsWebView::paint(painter, option, widget); - if (!d->previewMode) { - return; - } - d->previewMaskColor.setAlphaF(1.0); - painter->setPen(d->previewMaskColor); - d->previewMaskColor.setAlphaF(.5); - painter->setBrush(d->previewMaskColor); - - QPainterPath path; - path.addRect(boundingRect()); - path.addRect(d->previewRect); - painter->drawPath(path); - //painter->drawRect(d->previewRect); -} - -#include "moc_kgraphicswebslice.cpp" - diff --git a/kdeplasma-addons/applets/webslice/kgraphicswebslice.h b/kdeplasma-addons/applets/webslice/kgraphicswebslice.h deleted file mode 100644 index d071f1de..00000000 --- a/kdeplasma-addons/applets/webslice/kgraphicswebslice.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2009-2011 by Sebastian Kügler - * Copyright 2009 by Richard Moore - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KGRAPHICSWEBSLICE_H -#define KGRAPHICSWEBSLICE_H - -#include - -#include -#include -class QWebFrame; - -/** - * @class KGraphicsWebSlice plasma/kgraphicswebslice.h - * - * @short A QGraphicsWidget displaying a part of a webpage - * - * KGraphicsWebSlice provides a graphicswidget that displays a part of a - * webpage, based on a QRectF inside the webpage or a CSS selector. - * - * The KGraphicsWebSlice needs a URL set and either a slice geometry (using - * setSliceGeometry(QRectF) or directly a QRectF, for web pages missing the - * semantic information. When both options are given, element() takes - * precedence. - */ -class KGraphicsWebSlice : public QGraphicsWebView -{ - Q_OBJECT - -public: - KGraphicsWebSlice( QGraphicsWidget *parent=0 ); - ~KGraphicsWebSlice(); - - virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget = 0); - - /** - * Set the URL of the webpage the is being sliced. If you want - * to use the more flexible CSS selector to render your slice, - * the URL should point to the frame you're looking for, not to - * the mainframe of the page. If the page doesn't use frames, - * just the URL will work of course. - * - * @param url The page or frame URL to render - **/ - void loadSlice(const QUrl &url, const QString &selector = QString()); - - /** - * Specify the element of the webpage to be rendered. selector can - * be any CSS that is matched by WebKit's findElement() API. If you - * want to select a div with the id "mybox", specify "#mybox" here. - * The first element found will be used. - * - * @param selector the name of the group to access - **/ - void setElement(const QString &selector); - - /** - * Directly set the geometry of the piece that is cut out of the - * webpage. This option is only effective when element().isEmpty(). - * - * @param geo The QRectF to slice out of the webpage - **/ - void setSliceGeometry( const QRectF geo ); - - /** - * Returns the CSS selector used to identify the element that is being - * rendered. - * - * @return The CSS selector used to identify the element to render as - * the slice - **/ - QString element() const; - - /** - * Returns the manually set sliceGeometry inside the page. If you are using - * the CSS selector mechanism, this function is not what you want. Use the - * sizing mechanism of the widget instead. - * - * @param selector Specify a selector to find the geometry of a specific element - * @return The geometry of the slice within the page, if selector is empty, the current - * element is show, if the slice is not found, a zero-size rect will be returned. - **/ - QRectF sliceGeometry(const QString &selector = QString()) const; - - /** - * Returns a pixmap of the selected slice. Which slice to show is determined - * by setUrl(QUrl) or setSliceGeometry(QRectF). - * - * @return A QPixmap of a part of the webpage - **/ - QPixmap elementPixmap() const; - - /** - * Sets the text shown while the widget is loading. You can use HTML here, - * as it uses the same webview we use to display the slice. This has to be - * set before calling setUrl(url). - * - * @param text The HTML to display - **/ - void setLoadingText(const QString &html); - - /** - * Sets the color of the preview overlay mask, if nothing is set, default to black. - * - * @param color The color used to paint the preview mask - **/ - void setPreviewMaskColor(const QColor &color); - - /** - * Switches the widget to showing a specific slice. - * - * @param color The CSS selector used to identify the element of the webpage to show - **/ - void showSlice(const QString &selector = QString()); - - /** - * Shows the full page unsliced and zoomed out to fit into the widget. - **/ - void showPage(); - -public Q_SLOTS: - /** - * Renders a preview for a specific element as overlay over the body of the page. - * - **/ - void preview(const QString& = QString()); - - /** - * Refresh the position of the slice. This function can be needed if the - * geometry changes, or anything else that influences painting and - * rendering of the webpage. - * - **/ - void refresh(); - - void zoom(const QRectF &area); - -Q_SIGNALS: - /** - * Emitted when the webslice has found out its preferred geometry - */ - void sizeChanged(QSizeF); - -protected Q_SLOTS: - /** - * Slot to catch loading errors, and initiating showing the slice or preview - */ - void finishedLoading(bool ok); - - /** - * Reimplemented from QGraphicsWidget - */ - void resizeEvent ( QGraphicsSceneResizeEvent * event ); - - /** - * slot compressing resize events. - */ - void resizeTimeout(); - -private: - /** - * Initial creating of slice and setting of sizing information. - */ - void setPreviewMode(bool = true); - QRectF previewGeometry(const QString &selector) const; - void updateElementCache(); - QRectF mapFromPage(const QRectF &rectOnPage) const; - struct KGraphicsWebSlicePrivate *d; - -}; - -#endif // KGRAPHICSWEBSLICE_H - diff --git a/kdeplasma-addons/applets/webslice/kwebslice.cpp b/kdeplasma-addons/applets/webslice/kwebslice.cpp deleted file mode 100644 index c1eb9ea8..00000000 --- a/kdeplasma-addons/applets/webslice/kwebslice.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2009 by Sebastian Kügler - * Copyright 2009 by Richard Moore - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kwebslice.h" -#include "kgraphicswebslice.h" - -#include - -struct KWebSlicePrivate -{ - KGraphicsWebSlice *slice; - QString selector; -}; - -KWebSlice::KWebSlice( QWidget *parent ) - : QGraphicsView( parent ) -{ - d = new KWebSlicePrivate; - d->slice = new KGraphicsWebSlice; - connect(d->slice, SIGNAL(sizeChanged(QSizeF)), this, SLOT(sizeChanged(QSizeF))); - - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - QGraphicsScene *qgs = new QGraphicsScene(this); - qgs->addItem(d->slice); - qgs->setActiveWindow(d->slice); - setScene(qgs); - - setMinimumSize(20,20); - //setPreferedSize(20,80); -} - -KWebSlice::~KWebSlice() -{ - delete d; -} - -void KWebSlice::setUrl( const QUrl &url ) -{ - d->slice->setUrl( url ); -} - -void KWebSlice::setLoadingText(const QString &html) -{ - d->slice->setLoadingText(html); -} - -void KWebSlice::setElement( const QString &selector ) -{ - d->slice->setElement(selector); -} - -void KWebSlice::sizeChanged(QSizeF newsize) -{ - //qDebug() << "size changed" << newsize; - QRectF newgeometry = QRectF(QPointF(0, 0), newsize); - setSceneRect(newgeometry); - resize(newgeometry.toRect().size()); -} - -QSize KWebSlice::sizeHint () const -{ - return sceneRect().size().toSize(); -} - -void KWebSlice::resizeEvent ( QResizeEvent * event ) -{ - QRectF newgeometry = QRectF(QPointF(0, 0), event->size()); - //qDebug() << "KWebSlice::resizeEvent" << newgeometry << "(" << event->oldSize() << ")"; - setSceneRect(newgeometry); - d->slice->setGeometry(newgeometry); -} diff --git a/kdeplasma-addons/applets/webslice/kwebslice.h b/kdeplasma-addons/applets/webslice/kwebslice.h deleted file mode 100644 index d1253011..00000000 --- a/kdeplasma-addons/applets/webslice/kwebslice.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2009 by Sebastian Kügler - * Copyright 2009 by Richard Moore - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KWEBSLICE_H -#define KWEBSLICE_H - -#include - -#include - -/** - * @class KWebSlice - * - * @short A QWidget displaying a part of a webpage - * - * KWebSlice provides a graphicsview embedding the SliceGraphicsWidget - * graphicswidget that displays a part of a webpage, based on a QRectF - * inside the webpage or a CSS selector (preferred). - */ -class KWebSlice : public QGraphicsView -{ - Q_OBJECT - -public: - KWebSlice( QWidget *parent=0 ); - ~KWebSlice(); - - /** - * Set the URL of the webpage the is being sliced. If you want - * to use the more flexible CSS selector to render your slice, - * the URL should point to the frame you're looking for, not to - * the mainframe of the page. If the page doesn't use frames, - * just the URL will work of course. - * - * @param url The page or frame URL to render - **/ - void setUrl( const QUrl &url ); - - /** - * Specify the element of the webpage to be rendered. selector can - * be any CSS that is matched by WebKit's findElement() API. If you - * want to select a div with the id "mybox", specify "#mybox" here. - * The first element found will be used. - * - * @param selector the name of the group to access - **/ - void setElement( const QString &selector ); - - /** - * Sets the text shown while the widget is loading. You can use HTML here, - * as it uses the same webview we use to display the slice. This has to be - * set before calling setUrl(url). - * - * @param text The HTML to display - **/ - void setLoadingText(const QString &html); - -protected: - QSize sizeHint () const; - -protected slots: - void resizeEvent ( QResizeEvent * event ); - void sizeChanged ( QSizeF newsize ); - -private: - struct KWebSlicePrivate *d; -}; - -#endif // KWEBSLICE_H - diff --git a/kdeplasma-addons/applets/webslice/main.cpp b/kdeplasma-addons/applets/webslice/main.cpp deleted file mode 100644 index 85167f76..00000000 --- a/kdeplasma-addons/applets/webslice/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "kwebslice.h" - -int main( int argc, char **argv ) -{ - QApplication app( argc, argv ); - - KWebSlice slice; - slice.setElement( QString("#hotspot") ); - slice.setLoadingText("

Loading ...

"); - slice.setUrl( QUrl(QString("http://www.kde.org/")) ); - slice.show(); - - return app.exec(); -} diff --git a/kdeplasma-addons/applets/webslice/plasma/CMakeLists.txt b/kdeplasma-addons/applets/webslice/plasma/CMakeLists.txt deleted file mode 100644 index f2aa7382..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -project(plasma-webslice) - -include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/.. ) - -set(plasma-webslice_SRCS - webslice.cpp - ../kgraphicswebslice.cpp - websliceConfig.ui -) - -kde4_add_plugin(plasma_applet_webslice ${plasma-webslice_SRCS}) -target_link_libraries(plasma_applet_webslice - ${KDE4_PLASMA_LIBS} - ${KDE4_KIO_LIBS} - ${QT_QTWEBKIT_LIBRARY} -) - -install(TARGETS plasma_applet_webslice DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-applet-webslice.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - diff --git a/kdeplasma-addons/applets/webslice/plasma/Messages.sh b/kdeplasma-addons/applets/webslice/plasma/Messages.sh deleted file mode 100644 index 576b29cb..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_applet_webslice.pot diff --git a/kdeplasma-addons/applets/webslice/plasma/plasma-applet-webslice.desktop b/kdeplasma-addons/applets/webslice/plasma/plasma-applet-webslice.desktop deleted file mode 100644 index 3b006778..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/plasma-applet-webslice.desktop +++ /dev/null @@ -1,111 +0,0 @@ -[Desktop Entry] -Name=Web Slice -Name[bs]=Web Isječak -Name[ca]=Lliscador Web -Name[ca@valencia]=Lliscador Web -Name[cs]=Web Slice -Name[da]=Web Slice -Name[de]=Web-Scheibchen -Name[el]=Κομμάτι ιστού -Name[en_GB]=Web Slice -Name[es]=Web Slice -Name[et]=Veebilõik -Name[fi]=Web-siivu -Name[fr]=Tranche de Web -Name[ga]=Slis Ghréasáin -Name[gl]=Fragmento web -Name[hr]=Isječak weba -Name[hu]=Webszelet -Name[it]=Porzione di Web -Name[ja]=ウェブスライス -Name[kk]=Веб-үзіндісі -Name[km]=បន្ទះ​បណ្ដាញ -Name[ko]=웹 조각 -Name[lv]=Tīmekļa izgriezums -Name[mr]=वेब स्लाइज -Name[nb]=Nettstykke -Name[nds]=Nettstremel -Name[nl]=Web Slice -Name[nn]=Vevstykke -Name[pa]=ਵੈੱਬ ਟੁਕੜਾ -Name[pl]=Wycinek sieci -Name[pt]=Fatia Web -Name[pt_BR]=Web Slice -Name[ru]=Фрагмент веб-страницы -Name[sk]=Webový výsek -Name[sl]=Rezina spleta -Name[sr]=веб исечак -Name[sr@ijekavian]=веб исечак -Name[sr@ijekavianlatin]=veb isečak -Name[sr@latin]=veb isečak -Name[sv]=Webbutdrag -Name[tr]=Web Dilimi -Name[uk]=Вебзріз -Name[x-test]=xxWeb Slicexx -Name[zh_CN]=网页切片 -Name[zh_TW]=網頁切片 -Comment=Show a part of a webpage -Comment[ar]=اعرض جزءًا من صفحة الوِب -Comment[bs]=Prikazi dio internet stranice -Comment[ca]=Mostra una part d'una pàgina web -Comment[ca@valencia]=Mostra una part d'una pàgina web -Comment[cs]=Zobrazit část webové stránky -Comment[da]=Vis en del af en webside -Comment[de]=Einen Teil einer Webseite anzeigen -Comment[el]=Εμφάνιση ενός τμήματος μίας ιστοσελίδας -Comment[en_GB]=Show a part of a webpage -Comment[es]=Mostrar una parte de una página web -Comment[et]=Veebilehe osa näitamine -Comment[fi]=Näyttää osan web-sivusta -Comment[fr]=Affiche une partie d'une page Web -Comment[ga]=Taispeáin cuid de leathanach Gréasáin -Comment[gl]=Mostrar unha parte dunha páxina web. -Comment[hr]=Prikaži dio web stranice -Comment[hu]=Weboldalrészlet megjelenítése -Comment[it]=Mostra una parte di una pagina web -Comment[ja]=ウェブページの一部を表示 -Comment[kk]=Веб-парағының бір бөлігін көрсету -Comment[km]=បង្ហាញ​ផ្នែក​របស់​ទំព័រ​បណ្ដាញ -Comment[ko]=웹 페이지의 일부 표시 -Comment[lv]=Rāda daļu no tīmekļa lapas -Comment[mr]=वेब पानाचा भाग दर्शवितो -Comment[nb]=Vis en del av et nettside -Comment[nds]=Wiest en Deelrebeet vun en Nettsiet -Comment[nl]=Een deel van een webpagina tonen -Comment[nn]=Vis ein del av ei nettside -Comment[pa]=ਵੈੱਬ ਭੇਜ ਦਾ ਭਾਗ ਵੇਖੋ -Comment[pl]=Wyświetlacz wycinków stron internetowych -Comment[pt]=Mostrar uma parte de uma página Web -Comment[pt_BR]=Mostra parte de uma página Web -Comment[ro]=Arată o porțiune de pagină web -Comment[ru]=Показывает часть веб-страницы -Comment[sk]=Zobrazenie časti webovej stránky -Comment[sl]=Prikaži del spletne strani -Comment[sr]=Приказ дела веб странице -Comment[sr@ijekavian]=Приказ дијела веб странице -Comment[sr@ijekavianlatin]=Prikaz dijela veb stranice -Comment[sr@latin]=Prikaz dela veb stranice -Comment[sv]=Visa en del av en webbsida -Comment[tr]=Bir web sayfasının belirli bir bölümünü göster -Comment[uk]=Показ частини вебсторінки -Comment[x-test]=xxShow a part of a webpagexx -Comment[zh_CN]=显示网页的一部分 -Comment[zh_TW]=顯示一部份的網頁 - -Type=Service -Icon=internet-web-browser -ServiceTypes=Plasma/Applet - -X-KDE-Library=plasma_applet_webslice -X-KDE-PluginInfo-Author=Sebastian Kügler -X-KDE-PluginInfo-Email=sebas@kde.org -X-KDE-PluginInfo-Name=webslice -X-KDE-PluginInfo-Version=0.3 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-DefaultSize=200,150 -X-Plasma-Requires-FileDialog=Unused -X-Plasma-Requires-LaunchApp=Required diff --git a/kdeplasma-addons/applets/webslice/plasma/webslice.cpp b/kdeplasma-addons/applets/webslice/plasma/webslice.cpp deleted file mode 100644 index bbdc2f4c..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/webslice.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/*************************************************************************** - * Copyright 2009-2011 by Sebastian Kugler * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#include "webslice.h" - -#include -#include - -// Qt -#include -#include - -#include -#include -#include - -// KDE -#include -#include -#include -#include - -// Plasma -#include - -WebSlice::WebSlice(QObject *parent, const QVariantList &args) - : Plasma::PopupApplet(parent, args), - m_slice(0), - m_url(0) -{ - setPopupIcon("internet-web-browser"); - setAspectRatioMode(Plasma::IgnoreAspectRatio ); - setAcceptDrops(true); - setAcceptHoverEvents(true); - - setMinimumSize(64, 64); - resize(800, 600); - kDebug() << "0"; -} - -void WebSlice::init() -{ - const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(pluginName()); - const KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", - constraint); - foreach (const KService::Ptr &service, offers) { - QStringList args = service->property("X-Plasma-Args").toStringList(); - if (args.count() >= 1) { - m_url = KUrl(args[0]); - if (args.count() >= 2) { - m_element = args[1]; - if (args.count() >= 6) { - m_sliceGeometry = QRectF(args[2].toInt(), args[3].toInt(), - args[4].toInt(), args[5].toInt()); - } - } - } - } - void graphicsWidget(); -} - -WebSlice::~WebSlice () -{ -} - -void WebSlice::configChanged() -{ - kDebug(); - KConfigGroup cg = config(); - if (!m_url.isValid() || m_url.isEmpty()) { - m_url = cg.readEntry("url", "http://dot.kde.org/"); - m_element = cg.readEntry("element", "#block-views-planetkde-block_1"); - - // for testing geometry - //m_url = cg.readEntry("url", "http://buienradar.nl/"); - //m_sliceGeometry = cg.readEntry("size", QRectF(258, 102, 550, 511)); - m_sliceGeometry = cg.readEntry("sliceGeometry", QRectF()); - } - setAssociatedApplicationUrls(KUrl::List(m_url)); - if (m_slice) { - m_slice->preview(); - } - loadSlice(m_url, m_element); -} - -QGraphicsWidget* WebSlice::graphicsWidget() -{ - if (!m_slice) { - m_widget = new QGraphicsWidget(this); - QGraphicsLinearLayout *l = new QGraphicsLinearLayout(m_widget); - m_widget->setLayout(l); - - - m_slice = new KGraphicsWebSlice(m_widget); - m_slice->setMaximumSize(contentsRect().size()); - //m_slice->show(); - updateColors(); - //connect(m_slice, SIGNAL(sizeChanged(QSizeF)), this, SLOT(sizeChanged(QSizeF))); - connect(m_slice, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateColors())); - - setBusy(true); - m_slice->setLoadingText(i18nc("displayed in the widget while loading", "

Loading...

")); - //m_slice->hide(); - l->addItem(m_slice); - kDebug() << "slice set up"; - configChanged(); - } - return m_widget; -} - -void WebSlice::createConfigurationInterface(KConfigDialog *parent) -{ - //QLabel *info = new QLabel(parent); - QLabel* info = new QLabel(parent); - info->setWordWrap(true); - info->setTextInteractionFlags(Qt::TextBrowserInteraction); - info->setText(i18n("

The Webslice Widget allows you to display a part of a webpage on your desktop or in a panel. The webslice is fully interactive.

" - "

" - "Specify the URL of the webpage in the URL field." - "In the Element to Show field, fill in a CSS identifier (for example #mybox for elements with the id \"mybox\"). This is the preferred method as it works best with layout changes on the webpage." - "

" - "

" - "Alternatively, you can specify a rectangle on the webpage to use as slice. Use \"x,y,width,height\" in pixels, for example \"100,80,300,360\". This method is a fallback for webpages that do not provide enough semantic markup for the above mechanism." - "

" - "If both methods (element and geometry) are used, the element will take precedence.")); - parent->addPage(info, i18nc("informational page", "Info"), "help-hint"); - - QWidget *widget = new QWidget(parent); - ui.setupUi(widget); - parent->addPage(widget, i18nc("general config page", "Webpage"), Applet::icon()); - connect(ui.loadUrl, SIGNAL(clicked()), this, SLOT(loadUrl())); - connect(ui.elementCombo, SIGNAL(destroyed()), SLOT(disconnectLoadFinished())); - connect(ui.elementCombo, SIGNAL(activated(QString)), this, SLOT(preview(QString))); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - ui.urlEdit->setText(m_url.toString()); - ui.loadUrl->setIcon(KIcon("view-refresh")); - ui.geometryEdit->setText(sliceGeometryToString()); - ui.elementCombo->setEditable(true); - updateElements(); - preview(m_element); - connect(ui.urlEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified())); - connect(ui.loadUrl, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(ui.elementCombo, SIGNAL(editTextChanged(QString)), parent, SLOT(settingsModified())); - connect(ui.geometryEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified())); - connect(ui.elementCombo, SIGNAL(editTextChanged(QString)), this, SLOT(handleGeometryEdit())); - connect(parent, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, - SLOT(handleGeometryEdit())); -} - -void WebSlice::updateElements() -{ - ui.elementCombo->clear(); - ui.elementCombo->addItem(m_element, m_element); - ui.elementCombo->addItem(QString("body"), QString("body")); - foreach(const QWebElement el, m_slice->page()->mainFrame()->findAllElements("*")) { - QString elSelector; - QString elAttributeName; - if (el.attributeNames().contains("id")) { - elAttributeName = QString("id"); - elSelector = QString("#%1").arg(el.attribute("id")); // according to CSS selector syntax - } else { - /* don't add all elements for now, this really only clutters the combo - elSelector = el.localName(); - if (!el.attribute("class").isEmpty()) { - elSelector.append("." + el.attribute("class")); - } - */ - } - // Add Item? - if (!elSelector.isEmpty() && !(el.geometry().size().isNull())) { - ui.elementCombo->addItem(elSelector, elAttributeName); - } - } -} - -void WebSlice::disconnectLoadFinished() -{ - // we need to prevent the combo from being updated when it's gone - disconnect(m_slice, SIGNAL(loadFinished(bool)), this, SLOT(updateElements())); - m_slice->preview(); -} - -void WebSlice::preview(const QString &selector) -{ - ui.geometryEdit->setText(sliceGeometryToString(selector)); - - m_slice->preview(selector); -} - -void WebSlice::loadUrl() -{ - loadSlice(QUrl(ui.urlEdit->text())); - connect(m_slice, SIGNAL(loadFinished(bool)), SLOT(updateElements())); -} - -void WebSlice::loadSlice(const QUrl &url, const QString &selector) -{ - if (m_slice) { - m_slice->loadSlice(url, selector); - setAssociatedApplicationUrls(KUrl::List(url)); - } -} - -void WebSlice::configAccepted() -{ - if (m_url.toString() != ui.urlEdit->text() || - m_element != ui.elementCombo->currentText() || - ui.geometryEdit->text() != sliceGeometryToString()) { - - m_url = QUrl(ui.urlEdit->text()); - m_element = ui.elementCombo->currentText(); - - QString geo = ui.geometryEdit->text(); - QStringList gel = geo.split(','); - qreal x, y, w, h; - bool ok = true; - if (gel.length() == 4) { - x = (qreal)(gel[0].toDouble(&ok)); - y = (qreal)(gel[1].toDouble(&ok)); - w = (qreal)(gel[2].toDouble(&ok)); - h = (qreal)(gel[3].toDouble(&ok)); - if (!ok) { - kWarning() << "a conversion error occurred." << gel; - } else { - m_sliceGeometry = QRectF(x, y, w, h); - config().writeEntry("sliceGeometry", m_sliceGeometry); - } - } else { - if (m_element.isEmpty()) { - kWarning() << "format error, use x,y,w,h" << gel << gel.length(); - } - } - - KConfigGroup cg = config(); - cg.writeEntry("url", m_url.toString()); - cg.writeEntry("element", m_element); - if (!m_element.isEmpty()) { - m_sliceGeometry = QRectF(); - } - emit configNeedsSaving(); - configChanged(); - } -} - -QString WebSlice::sliceGeometryToString(const QString &selector) -{ - QString s = QString("%1,%2,%3,%4").arg(m_slice->sliceGeometry(selector).x()).arg(m_slice->sliceGeometry(selector).y()).arg(m_slice->sliceGeometry(selector).width()).arg(m_slice->sliceGeometry(selector).height()); - return s; -} - -void WebSlice::loadFinished(bool ok) -{ - setBusy(false); - - if (!ok) { - return; - } -} - -void WebSlice::updateColors() -{ - m_slice->setPreviewMaskColor( - Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); -} - -void WebSlice::handleGeometryEdit() -{ - if (ui.elementCombo->currentText().isEmpty()) { - ui.geometryEdit->setEnabled(true); - } else { - ui.geometryEdit->setEnabled(false); - } -} - -#include "moc_webslice.cpp" diff --git a/kdeplasma-addons/applets/webslice/plasma/webslice.h b/kdeplasma-addons/applets/webslice/plasma/webslice.h deleted file mode 100644 index bfb1833c..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/webslice.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright 2009-2011 by Sebastian Kügler * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef WEBSLICE_HEADER -#define WEBSLICE_HEADER - -#include -#include -#include "ui_websliceConfig.h" - -class KGraphicsWebSlice; -class KConfigDialog; - -class WebSlice: public Plasma::PopupApplet -{ - Q_OBJECT - public: - WebSlice(QObject *parent, const QVariantList &args); - ~WebSlice(); - void init(); - - protected: - QGraphicsWidget *graphicsWidget(); - KGraphicsWebSlice *m_slice; - - protected Q_SLOTS: - void createConfigurationInterface(KConfigDialog *parent); - void configAccepted(); - - public slots: - void configChanged(); - - private slots: - void loadFinished(bool); - void loadUrl(); - void updateElements(); - void disconnectLoadFinished(); - void preview(const QString &selector); - void updateColors(); - void handleGeometryEdit(); - - private: - QString sliceGeometryToString(const QString &selector = QString()); - void loadSlice(const QUrl &url, const QString &selector = QString("body")); - QUrl m_url; - QString m_element; - QRectF m_sliceGeometry; - Ui::websliceConfig ui; - QGraphicsWidget *m_widget; -}; - -K_EXPORT_PLASMA_APPLET(webslice, WebSlice) - -#endif diff --git a/kdeplasma-addons/applets/webslice/plasma/websliceConfig.ui b/kdeplasma-addons/applets/webslice/plasma/websliceConfig.ui deleted file mode 100644 index b3ac7760..00000000 --- a/kdeplasma-addons/applets/webslice/plasma/websliceConfig.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - websliceConfig - - - - 0 - 0 - 276 - 102 - - - - - 0 - 0 - - - - - 200 - 700 - - - - - - - URL: - - - - - - - - - - - - true - - - - - - - - - Element to show: - - - - - - - - - - Geometry: - - - - - - - - - - - KPushButton - QPushButton -
kpushbutton.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/kdeplasma-addons/applets/webslice/webslice.pro b/kdeplasma-addons/applets/webslice/webslice.pro deleted file mode 100644 index e23fe84e..00000000 --- a/kdeplasma-addons/applets/webslice/webslice.pro +++ /dev/null @@ -1,15 +0,0 @@ -###################################################################### -# This will only build the slicewidget and the graphicswidget -# -# You most likely want to use the cmake-based build. -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += /home/rich/src/project-silk/webslice/. . -QT += webkit - -# Input -HEADERS += kwebslice.h kgraphicswebslice.h -SOURCES += main.cpp kwebslice.cpp kgraphicswebslice.cpp diff --git a/kdeplasma-addons/cmake/FindQJSON.cmake b/kdeplasma-addons/cmake/FindQJSON.cmake deleted file mode 100644 index 49e73cdf..00000000 --- a/kdeplasma-addons/cmake/FindQJSON.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Find QJSON - JSON handling library for Qt -# -# This module defines -# QJSON_FOUND - whether the qsjon library was found -# QJSON_LIBRARIES - the qjson library -# QJSON_INCLUDE_DIR - the include path of the qjson library -# - -if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - # Already in cache - set (QJSON_FOUND TRUE) - -else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - if (NOT WIN32) - # use pkg-config to get the values of QJSON_INCLUDE_DIRS - # and QJSON_LIBRARY_DIRS to add as hints to the find commands. - include (FindPkgConfig) - pkg_check_modules (PC_QJSON QJson>=0.5) - endif (NOT WIN32) - - find_library (QJSON_LIBRARIES - NAMES - qjson - PATHS - ${PC_QJSON_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - ${KDE4_LIB_DIR} - ) - - find_path (QJSON_INCLUDE_DIR - NAMES - qjson/parser.h - PATHS - ${PC_QJSON_INCLUDE_DIRS} - ${INCLUDE_INSTALL_DIR} - ${KDE4_INCLUDE_DIR} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR) - -endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) \ No newline at end of file diff --git a/kdeplasma-addons/cmake/FindQtOAuth.cmake b/kdeplasma-addons/cmake/FindQtOAuth.cmake deleted file mode 100644 index 0d589f96..00000000 --- a/kdeplasma-addons/cmake/FindQtOAuth.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# - Try to find the QtOAuth library -# Once done this will define -# -# QTOAUTH_FOUND - system has the QtOAuth library -# QTOAUTH_INCLUDE_DIR - the QtOAuth include directory -# QTOAUTH_LIBRARY - Link this to use the QtOAuth -# QTOAUTH_DEFINITIONS - Compiler switches required for using QOAuth -# -# Copyright © 2010, Mehrdad Momeny -# Copyright © 2010, Harald Sitter -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -if (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) - # in cache already - set(QTOAUTH_FOUND TRUE) -else (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) - if (NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PC_QTOAUTH QUIET qoauth) - set(QTOAUTH_DEFINITIONS ${PC_QTOAUTH_CFLAGS_OTHER}) - endif(NOT WIN32) - - find_library(QTOAUTH_LIBRARY NAMES qoauth - HINTS ${PC_QTOAUTH_LIBDIR} ${PC_QTOAUTH_LIBRARY_DIRS} - ) - - find_path(QTOAUTH_INCLUDE_DIR QtOAuth/interface.h - HINTS ${PC_QTOAUTH_INCLUDEDIR} ${PC_QTOAUTH_INCLUDE_DIRS} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QtOAuth DEFAULT_MSG QTOAUTH_LIBRARY QTOAUTH_INCLUDE_DIR) - - mark_as_advanced(QTOAUTH_INCLUDE_DIR QTOAUTH_LIBRARY) -endif (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) diff --git a/kdeplasma-addons/dataengines/CMakeLists.txt b/kdeplasma-addons/dataengines/CMakeLists.txt index 5aa3ee2a..b38b7196 100644 --- a/kdeplasma-addons/dataengines/CMakeLists.txt +++ b/kdeplasma-addons/dataengines/CMakeLists.txt @@ -1,14 +1,8 @@ -if (QCA2_FOUND AND QJSON_FOUND AND QTOAUTH_FOUND) - add_subdirectory(microblog) -endif() - if(LIBATTICA_FOUND) add_subdirectory(ocs) endif() add_subdirectory(potd) -add_subdirectory(rememberthemilk) add_subdirectory(kdeobservatory) add_subdirectory(kimpanel) add_subdirectory(konsoleprofiles) -add_subdirectory(konqprofiles) diff --git a/kdeplasma-addons/dataengines/konqprofiles/CMakeLists.txt b/kdeplasma-addons/dataengines/konqprofiles/CMakeLists.txt deleted file mode 100644 index e5359077..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(konqprofilesengine_SRCS - konqprofilesengine.cpp - konqprofilesservice.cpp -) - -kde4_add_plugin(plasma_engine_konqprofiles ${konqprofilesengine_SRCS}) -target_link_libraries(plasma_engine_konqprofiles ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS}) - -install(TARGETS plasma_engine_konqprofiles DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-dataengine-konqprofiles.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -install(FILES org.kde.plasma.dataengine.konqprofiles.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) - diff --git a/kdeplasma-addons/dataengines/konqprofiles/Messages.sh b/kdeplasma-addons/dataengines/konqprofiles/Messages.sh deleted file mode 100755 index c835a729..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_engine_konqprofiles.pot diff --git a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.cpp b/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.cpp deleted file mode 100644 index 9245d82b..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************** -* Copyright (C) 2011 by Shaun Reich * -* Copyright (C) 2008 by Montel Laurent * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License as * -* published by the Free Software Foundation; either version 2 of * -* the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program. If not, see . * -*****************************************************************************/ - -#include "konqprofilesengine.h" -#include "konqprofilesservice.h" - -#include -#include -#include -#include -#include -#include - -KonqProfilesEngine::KonqProfilesEngine(QObject *parent, const QVariantList &args) - : Plasma::DataEngine(parent, args), - m_dirWatch(0) -{ - -} - -KonqProfilesEngine::~KonqProfilesEngine() -{ -} - -void KonqProfilesEngine::init() -{ - kDebug() << "KonqProfilesDataEngine init"; - - m_dirWatch = new KDirWatch( this ); - loadProfiles(); - connect(m_dirWatch, SIGNAL(dirty(QString)), this, SLOT(profilesChanged())); -} - -Plasma::Service *KonqProfilesEngine::serviceForSource(const QString &source) -{ - //create a new service for this profile's name, so it can be operated on. - return new KonqProfilesService(this, source); -} - -void KonqProfilesEngine::profilesChanged() -{ - //wipe the data clean, load it again. (there's not a better way of doing this but no big deal) - removeAllSources(); - loadProfiles(); -} - -void KonqProfilesEngine::loadProfiles() -{ - const QStringList lst = KGlobal::dirs()->findDirs( "data", "konqueror/profiles/" ); - for ( int i = 0; i < lst.count(); i++ ) - { - m_dirWatch->addDir( lst[i] ); - } - - const QStringList list = KGlobal::dirs()->findAllResources( "data", "konqueror/profiles/*", KStandardDirs::NoDuplicates ); - const QStringList::ConstIterator end = list.constEnd(); - - for (QStringList::ConstIterator it = list.constBegin(); it != end; ++it) - { - QFileInfo info(*it); - const QString profileName = KIO::decodeFileName(info.baseName()); - QString niceName=profileName; - KConfig cfg(*it, KConfig::SimpleConfig); - if (cfg.hasGroup("Profile")) { - - KConfigGroup grp(&cfg, "Profile"); - if (grp.hasKey( "Name" )) { - niceName = grp.readEntry("Name"); - } - - QString sourceName = "name:" + profileName; - kDebug() << "adding sourcename: " << profileName << " ++" << niceName; - setData(profileName, "prettyName", niceName); - } - } -} - -K_EXPORT_PLASMA_DATAENGINE(konqprofilesengine, KonqProfilesEngine) - -#include "moc_konqprofilesengine.cpp" diff --git a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.h b/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.h deleted file mode 100644 index 5ff636f1..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesengine.h +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** -* Copyright (C) 2011 by Shaun Reich * -* Copyright (C) 2008 by Montel Laurent * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License as * -* published by the Free Software Foundation; either version 2 of * -* the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program. If not, see . * -*****************************************************************************/ - -#ifndef KONQPROFILESENGINE_H -#define KONQPROFILESENGINE_H - -#include - -class KDirWatch; - -/** - * This engine provides the list of session applets for konqueror, as well - * as support to open/launch them. - */ -class KonqProfilesEngine : public Plasma::DataEngine -{ - Q_OBJECT - -public: - KonqProfilesEngine(QObject *parent, const QVariantList &args); - ~KonqProfilesEngine(); - - void init(); - Plasma::Service *serviceForSource(const QString &source); - -private Q_SLOTS: - void profilesChanged(); - -private: - void loadProfiles(); - - KDirWatch *m_dirWatch; -}; - -#endif diff --git a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.cpp b/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.cpp deleted file mode 100644 index 4cb7ea31..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** -* Copyright (C) 2011 by Shaun Reich * -* Copyright (C) 2008 by Montel Laurent * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License as * -* published by the Free Software Foundation; either version 2 of * -* the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program. If not, see . * -*****************************************************************************/ - -#include "konqprofilesservice.h" - -#include -#include -#include - -KonqProfilesService::KonqProfilesService(QObject* parent, const QString& profileName) - : Plasma::Service(parent) -{ - setName("org.kde.plasma.dataengine.konqprofiles"); - setDestination(profileName); -} - -Plasma::ServiceJob* KonqProfilesService::createJob(const QString& operation, QMap& parameters) -{ - return new ProfileJob(this, operation, parameters); -} - -ProfileJob::ProfileJob(KonqProfilesService *service, const QString &operation, const QMap ¶meters) - : Plasma::ServiceJob(service->destination(), operation, parameters, service) -{ -} - -void ProfileJob::start() -{ - //destination is the profile name, operation is e.g. "open" - // QMapjobParameters = parameters(); - const QString operation = operationName(); - -kDebug() << "SERVICE START...operation: " << operation << " dest: " << destination(); - if (operation == "open") { - // Q_ASSERT(!jobParameters.isEmpty()); - - QStringList args; - args << "--profile" << destination(); - KToolInvocation::kdeinitExec("konqueror", args); - - setResult(true); - } -} - -#include "moc_konqprofilesservice.cpp" diff --git a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.h b/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.h deleted file mode 100644 index 1ddfd1c8..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/konqprofilesservice.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** -* Copyright (C) 2011 by Shaun Reich * -* Copyright (C) 2008 by Montel Laurent * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License as * -* published by the Free Software Foundation; either version 2 of * -* the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program. If not, see . * -*****************************************************************************/ - -#ifndef KONQPROFILESSERVICE_H -#define KONQPROFILESSERVICE_H - -#include -#include - -class KonqProfilesService : public Plasma::Service -{ - Q_OBJECT - -public: - KonqProfilesService(QObject* parent, const QString& profileName); - -protected: - Plasma::ServiceJob* createJob(const QString& operation, QMap& parameters); -}; - -class ProfileJob : public Plasma::ServiceJob -{ - Q_OBJECT - -public: - ProfileJob(KonqProfilesService *service, const QString& operation, const QMap ¶meters); - void start(); -}; - -#endif diff --git a/kdeplasma-addons/dataengines/konqprofiles/org.kde.plasma.dataengine.konqprofiles.operations b/kdeplasma-addons/dataengines/konqprofiles/org.kde.plasma.dataengine.konqprofiles.operations deleted file mode 100644 index 98e7c492..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/org.kde.plasma.dataengine.konqprofiles.operations +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/kdeplasma-addons/dataengines/konqprofiles/plasma-dataengine-konqprofiles.desktop b/kdeplasma-addons/dataengines/konqprofiles/plasma-dataengine-konqprofiles.desktop deleted file mode 100644 index 4536d26f..00000000 --- a/kdeplasma-addons/dataengines/konqprofiles/plasma-dataengine-konqprofiles.desktop +++ /dev/null @@ -1,127 +0,0 @@ -[Desktop Entry] -Name=Konqueror Profiles -Name[ar]=تشكيلة كنيكر -Name[ast]=Perfiles de Konqueror -Name[bs]=Konqueror profili -Name[ca]=Perfils del Konqueror -Name[ca@valencia]=Perfils del Konqueror -Name[cs]=Profily Konqueroru -Name[da]=Konqueror-profiler -Name[de]=Konqueror-Profile -Name[el]=Προφίλ Konqueror -Name[en_GB]=Konqueror Profiles -Name[es]=Perfiles de Konqueror -Name[et]=Konquerori profiilid -Name[eu]=Konquerorren profilak -Name[fi]=Konqueror-profiilit -Name[fr]=Profils de Konqueror -Name[ga]=Próifílí Konqueror -Name[gl]=Perfís de Konqueror -Name[he]=הפרופילים של Konqueror -Name[hr]=Profili u Konqueroru -Name[hu]=Konqueror profilok -Name[is]=Konqueror snið -Name[it]=Profili di Konqueror -Name[ja]=Konqueror プロファイル -Name[kk]=Konqueror профильдері -Name[km]=ទម្រង់​របស់ Konqueror -Name[ko]=Konqueror 프로필 -Name[ku]=Profîlên Komqueror -Name[lt]=Konqueror profiliai -Name[lv]=Konqueror profili -Name[mr]=कॉन्करर रूपरेषा -Name[nb]=Konqueror-profiler -Name[nds]=Konqueror-Profilen -Name[nl]=Konqueror-profielen -Name[nn]=Konqueror-profilar -Name[pa]=ਕੋਨਕਿਊਰੋਰ ਪਰੋਫਾਇਲ -Name[pl]=Profile Konquerora -Name[pt]=Perfis do Konqueror -Name[pt_BR]=Perfis do Konqueror -Name[ro]=Profiluri Konqueror -Name[ru]=Konqueror: профили -Name[sk]=Profily Konquerora -Name[sl]=Profili za Konqueror -Name[sr]=К‑освајачеви профили -Name[sr@ijekavian]=К‑освајачеви профили -Name[sr@ijekavianlatin]=K‑osvajačevi profili -Name[sr@latin]=K‑osvajačevi profili -Name[sv]=Konquerorprofiler -Name[th]=โพรไฟล์ต่าง ๆ ของคอนเควอร์เรอร์ -Name[tr]=Konqueror Profilleri -Name[uk]=Профілі Konqueror -Name[wa]=Profils di Konqueror -Name[x-test]=xxKonqueror Profilesxx -Name[zh_CN]=Konqueror 配置集 -Name[zh_TW]=Konqueror 設定檔 -Comment=List and launch Konqueror profiles -Comment[ar]=تعرض و تطلق تشكيلات كنكير -Comment[ast]=Amuesa y anicia perfiles de Konqueror -Comment[bs]=Nabraja i pokreće profile Konquerora -Comment[ca]=Llista i executa els perfils del Konqueror -Comment[ca@valencia]=Llista i executa els perfils del Konqueror -Comment[cs]=Seznam a spouštění profilů Konqueroru -Comment[da]=Vis og start Konqueror-profiler. -Comment[de]=Konqueror-Profile anzeigen und starten -Comment[el]=Εμφάνιση και εκτέλεση προφίλ του Konqueror -Comment[en_GB]=List and launch Konqueror profiles -Comment[es]=Muestra e inicia perfiles de Konqueror -Comment[et]=Konquerori profiilide näitamine ja käivitamine -Comment[eu]=Zerrendatu eta jaurti Konquerorren profilak -Comment[fi]=Luettelee ja käynnistää Konqueror-profiileja -Comment[fr]=Permet d'afficher et de lancer des profils de Konqueror -Comment[ga]=Liostaigh agus tosaigh próifílí Konqueror -Comment[gl]=Enumera e inicia perfís de Konqueror -Comment[he]=הצג והפעל פרופילים של Konqueror -Comment[hr]=Navedi i pokreni profile u Konqueroru -Comment[hu]=Konqueror profilok listázása és indítása -Comment[is]=Listar upp og ræsir Konqueror snið -Comment[it]=Elenca ed esegue i profili di Konqueror -Comment[ja]=Konqueror のプロファイルを起動します -Comment[kk]=Konqueror профильдерін таңдап жегу -Comment[km]=រាយ និង​ចាប់ផ្ដើម​ទម្រង់​របស់ Konqueror -Comment[ko]=Konqueror 프로필을 보고 실행하기 -Comment[ku]=Profîlên Konqueror lîste bike û bide destpêkirin -Comment[lt]=Rikiuoti ir įkelti Konqueror profilius -Comment[lv]=Parāda un atver Konqueror profilus -Comment[mr]=कॉन्करर रूपरेषांची यादी व प्रक्षेपण करा -Comment[nb]=List opp og start Konqueror-profiler -Comment[nds]=Konqueror-Profilen oplisten un opropen -Comment[nl]=Toon en start Konqueror-profielen -Comment[nn]=Vis og start Konqueror-profilar -Comment[pa]=ਕੋਨਕਿਉਰੋਰ ਪਰੋਫਾਇਲ ਵੇਖੋ ਅਤੇ ਚਲਾਓ -Comment[pl]=Wypisywanie i uruchamianie profili Konquerora -Comment[pt]=Listar e invocar os perfis do Konqueror -Comment[pt_BR]=Lista e carrega os perfis do Konqueror -Comment[ro]=Enumeră și lansează profiluri Konqueror -Comment[ru]=Запуск Konqueror для разных задач -Comment[sk]=Zobrazenie a spustenie profilov Konquerora -Comment[sl]=Prikažite in zaženite profile Konquerorja -Comment[sr]=Набраја и покреће профиле К‑освајача -Comment[sr@ijekavian]=Набраја и покреће профиле К‑освајача -Comment[sr@ijekavianlatin]=Nabraja i pokreće profile K‑osvajača -Comment[sr@latin]=Nabraja i pokreće profile K‑osvajača -Comment[sv]=Lista och starta Konquerorprofiler -Comment[th]=เรียกรายการและเรียกใช้โพรไฟล์ต่าง ๆ ของคอนเควอร์เรอร์ -Comment[tr]=Konqueror profillerini listeleyin ve çalıştırın -Comment[uk]=Перегляньте список і запустіть профілі Konqueror -Comment[wa]=Fé l' djivêye des profils di Konqueror eyet ls enonder -Comment[x-test]=xxList and launch Konqueror profilesxx -Comment[zh_CN]=罗列和启动 Konqueror 配置集 -Comment[zh_TW]=列出並啟動 Konqueror 設定檔 - -Type=Service -Icon=konqueror - -X-KDE-ServiceTypes=Plasma/DataEngine -X-KDE-Library=plasma_engine_konqprofiles - -X-KDE-PluginInfo-Author=Shaun Reich -X-KDE-PluginInfo-Email=shaun.reich@kdemail.net -X-KDE-PluginInfo-Name=org.kde.konqprofiles -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Utiltities -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/kdeplasma-addons/dataengines/microblog/CMakeLists.txt b/kdeplasma-addons/dataengines/microblog/CMakeLists.txt deleted file mode 100644 index bd79ec88..00000000 --- a/kdeplasma-addons/dataengines/microblog/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ - -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} -${QT_QTNETWORK_INCLUDES} ${QT_QTXML_INCLUDES} ${QCA2_INCLUDE_DIR} -${QJSON_INCLUDE_DIR}) - -set(twitter_engine_SRCS - imagesource.cpp - usersource.cpp - timelinesource.cpp - timelineservice.cpp - tweetjob.cpp - twitterengine.cpp - koauth.cpp - koauthwebhelper.cpp -) - -kde4_add_plugin(plasma_engine_microblog ${twitter_engine_SRCS}) -target_link_libraries(plasma_engine_microblog - ${QTOAUTH_LIBRARY} - ${KDE4_KIO_LIBS} - ${KDE4_PLASMA_LIBS} - #${QT_QTXML_LIBS} - ${QT_QTNETWORK_LIBS} - ${QCA2_LIBRARIES} - ${QJSON_LIBRARIES} - ${QT_QTWEBKIT_LIBRARY} - #${KDE4_KDEUI_LIBS} - ${KDE4_KDEWEBKIT_LIBRARY} -) - -install(TARGETS plasma_engine_microblog DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-dataengine-microblog.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -install(FILES tweet.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) - diff --git a/kdeplasma-addons/dataengines/microblog/imagesource.cpp b/kdeplasma-addons/dataengines/microblog/imagesource.cpp deleted file mode 100644 index 20cc7818..00000000 --- a/kdeplasma-addons/dataengines/microblog/imagesource.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "imagesource.h" - -#include -#include -#include - -#include - -ImageSource::ImageSource(QObject* parent) - : Plasma::DataContainer(parent), - m_runningJobs(0) -{ - setObjectName(QLatin1String("UserImages")); -} - -ImageSource::~ImageSource() -{ -} - -void ImageSource::loadImage(const QString &who, const KUrl &url) -{ - if (who.isEmpty()) { - return; - } - - // Make sure we only start one job per user - if (m_loadedPersons.contains(who)) { - return; - } - - if (!url.isValid()) { - return; - } - m_loadedPersons << who; - //FIXME: since kio_http bombs the system with too many request put a temporary - // arbitrary limit here, revert as soon as BUG 192625 is fixed - // Note: seems fixed. - if (m_runningJobs < 500) { - m_runningJobs++; - KIO::Job *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo); - job->setAutoDelete(true); - m_jobs[job] = who; - connect(job, SIGNAL(data(KIO::Job*,QByteArray)), - this, SLOT(recv(KIO::Job*,QByteArray))); - connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*))); - job->start(); - } else { - m_queuedJobs.append(QPair(who, url)); - } -} - -void ImageSource::recv(KIO::Job* job, const QByteArray& data) -{ - m_jobData[job] += data; -} - -void ImageSource::result(KJob *job) -{ - if (!m_jobs.contains(job)) { - return; - } - - m_runningJobs--; - - if (m_queuedJobs.count() > 0) { - QPair jobDesc = m_queuedJobs.takeLast(); - loadImage(jobDesc.first, jobDesc.second); - } - - if (job->error()) { - // TODO: error handling - KIO::TransferJob* kiojob = dynamic_cast(job); - kError() << "Image job returned error: " << kiojob->errorString(); - } else { - QImage img; - img.loadFromData(m_jobData.value(job)); - const QString who = m_jobs.value(job); - - setData(who, polishImage(img)); - emit dataChanged(); - KIO::TransferJob* kiojob = dynamic_cast(job); - const QString cacheKey = who + "@" + kiojob->url().pathOrUrl(); - } - - m_jobs.remove(job); - m_jobData.remove(job); - checkForUpdate(); -} - -QImage ImageSource::polishImage(const QImage &img) -{ - QImage roundedImage = QImage(QSize(48*4, 48*4), QImage::Format_ARGB32_Premultiplied); - roundedImage.fill(Qt::transparent); - QPainter p; - p.begin(&roundedImage); - QPainterPath clippingPath; - QRectF imgRect = QRectF(QPoint(0,0), roundedImage.size()); - clippingPath.addRoundedRect(imgRect, 24, 24); - p.setClipPath(clippingPath); - p.setClipping(true); - p.drawImage(QRectF(QPointF(0, 0), roundedImage.size()), img); - return roundedImage; -} - -#include "moc_imagesource.cpp" diff --git a/kdeplasma-addons/dataengines/microblog/imagesource.h b/kdeplasma-addons/dataengines/microblog/imagesource.h deleted file mode 100644 index a2bb1fd0..00000000 --- a/kdeplasma-addons/dataengines/microblog/imagesource.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef IMAGESOURCE_H -#define IMAGESOURCE_H - -#include -#include - -#include - -#include - -// forward declarations -class KJob; - -namespace KIO -{ - class Job; -} // namespace KIO - -class ImageSource : public Plasma::DataContainer -{ -Q_OBJECT - -public: - ImageSource(QObject* parent); - ~ImageSource(); - - void loadStarted(); - void loadFinished(); - -public Q_SLOTS: - void loadImage(const QString &who, const KUrl &url = KUrl()); - -Q_SIGNALS: - void dataChanged(); - -private Q_SLOTS: - void recv(KIO::Job*, const QByteArray& data); - void result(KJob*); - -private: - QImage polishImage(const QImage &img); - QHash m_jobs; - QHash m_jobData; - int m_runningJobs; - QList > m_queuedJobs; - QStringList m_loadedPersons; - //Plasma::DataEngine::Data m_cachedData; -}; - -#endif - diff --git a/kdeplasma-addons/dataengines/microblog/koauth.cpp b/kdeplasma-addons/dataengines/microblog/koauth.cpp deleted file mode 100644 index c672d4de..00000000 --- a/kdeplasma-addons/dataengines/microblog/koauth.cpp +++ /dev/null @@ -1,660 +0,0 @@ -/* - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* - * QOAuth example - * http://blog.ayoy.net/2009/6/24/oauth - * - * Twitter OAuth Docs: - * https://dev.twitter.com/docs/auth/oauth - * - * How does OAuth work diagram: - * https://dev.twitter.com/sites/default/files/images_documentation/oauth_diagram.png - * - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "koauth.h" -#include "koauthwebhelper.h" - -#include -#include - -namespace KOAuth { - -class KOAuthPrivate { - -public: - KOAuthPrivate() - { - interface = new QOAuth::Interface(); - busy = false; - useWallet = true; - } - - QOAuth::Interface* interface; - - QString user; - QString password; - bool useWallet; - - bool busy; - - QString serviceBaseUrl; - QString requestTokenUrl; - QString accessTokenUrl; - QString authorizeUrl; - - QByteArray consumerKey; - QByteArray consumerSecret; - - QByteArray requestToken; - QByteArray requestTokenSecret; - - QByteArray accessToken; - QByteArray accessTokenSecret; - - QStringList authorizedAccounts; - - QString verifier; - - QCA::Initializer *qcaInitializer; - - KOAuthWebHelper *w; -}; - - -KOAuth::KOAuth(QObject* parent) - : QThread(parent), - d(0) -{ - - setObjectName(QLatin1String("KOAuth")); -// d = new KOAuthPrivate; - -} - -QByteArray KOAuth::accessToken() const -{ - return d->accessToken; -} - -QByteArray KOAuth::accessTokenSecret() const -{ - return d->accessTokenSecret; -} - -QString KOAuth::user() const -{ - return d->user; -} - -QString KOAuth::serviceBaseUrl() const -{ - return d->serviceBaseUrl; -} - -void KOAuth::setUser(const QString& user) -{ - if (user == d->user) { - return; - } - d->user = user; - updateState(); -} - -QString KOAuth::password() const -{ - return d->password; -} - -void KOAuth::init() -{ - //just create it to correctly initialize QCA and clean up when createSignature() returns - - if (!d) { - d = new KOAuthPrivate; - d->qcaInitializer = new QCA::Initializer(); -#ifndef NO_KIO - KIO::AccessManager *access = new KIO::AccessManager(this); - d->interface->setNetworkAccessManager(access); -#endif - d->w = new KOAuthWebHelper(); - connect(this, SIGNAL(authorizeApp(const QString&, const QString&, const QString&)), - d->w, SLOT(authorizeApp(const QString&, const QString&, const QString&))); - connect(d->w, SIGNAL(appAuthSucceeded(const QString&, const QString&)), - this, SLOT(appAuthorized(const QString&, const QString&))); - connect(d->w, SIGNAL(statusUpdated(const QString&, const QString&, const QString&, const QString&)), - SIGNAL(statusUpdated(const QString&, const QString&, const QString&, const QString&))); - } - -} - -void KOAuth::run() -{ - if (isAuthorized()) { - emit statusUpdated(d->user, d->serviceBaseUrl, "Ok", "User authorized"); - } else { - //authorize(d->serviceBaseUrl, d->user, d->password); - } -} - -void KOAuth::authorize(const QString &serviceBaseUrl, const QString &user, const QString &password) -{ - if (!user.isEmpty()) { - d->user = user; - } - d->password = password; - d->serviceBaseUrl = serviceBaseUrl; - d->accessToken = QByteArray(); - d->accessTokenSecret = QByteArray(); - - d->w->setUser(d->user); - d->w->setServiceBaseUrl(serviceBaseUrl); - d->w->setPassword(password); - - //run(); - if (!isAuthorized()) { - d->busy = true; - kDebug() << "request token"; - requestTokenFromService(); - } -} - -void KOAuth::requestTokenFromService() -{ - d->interface->setConsumerKey(d->consumerKey); - d->interface->setConsumerSecret(d->consumerSecret); - - d->interface->setRequestTimeout( 10000 ); - if (!QCA::isSupported("hmac(sha1)")) { - kError() << "Hashing algo not supported, update your QCA"; - return; - } - - QOAuth::ParamMap params; - params.insert("oauth_callback", "oob"); -// kDebug() << "starting token request ..."; - QOAuth::ParamMap reply = d->interface->requestToken(d->requestTokenUrl, - QOAuth::GET, QOAuth::HMAC_SHA1, params); -// kDebug() << "token request done......" << reply; - - QString e; - if (d->interface->error() == QOAuth::NoError) { - d->requestToken = reply.value(QOAuth::tokenParameterName()); - d->requestTokenSecret = reply.value(QOAuth::tokenSecretParameterName()); - - QString auth_url = QString("%1?oauth_token=%2").arg(d->authorizeUrl, QString(d->requestToken)); - - emit statusUpdated(d->user, d->serviceBaseUrl, "Busy", "Request token received."); - emit authorizeApp(d->serviceBaseUrl, d->authorizeUrl, auth_url); - - } else { - e += errorMessage(d->interface->error()); - kDebug() << "Request Token returned error:" << e; - emit statusUpdated(d->user, d->serviceBaseUrl, "Error", "Request Token Error: " + e); - d->busy = false; - - } -} - -void KOAuth::appAuthorized(const QString &authorizeUrl, const QString &verifier) -{ - Q_UNUSED(authorizeUrl); - d->verifier = verifier; - accessTokenFromService(); -} - -QString KOAuth::errorMessage(int e) { - // enum ErrorCode { - // NoError = 200, //!< No error occured (so far :-) ) - // BadRequest = 400, //!< Represents HTTP status code \c 400 (Bad Request) - // Unauthorized = 401, //!< Represents HTTP status code \c 401 (Unauthorized) - // Forbidden = 403, //!< Represents HTTP status code \c 403 (Forbidden) - // Timeout = 1001, //!< Represents a request timeout error - // ConsumerKeyEmpty, //!< Consumer key has not been provided - // ConsumerSecretEmpty, //!< Consumer secret has not been provided - // UnsupportedHttpMethod, /*!< The HTTP method is not supported by the request. - // \note \ref QOAuth::Interface::requestToken() and - // \ref QOAuth::Interface::accessToken() - // accept only HTTP GET and POST requests. */ - // - // RSAPrivateKeyEmpty = 1101, //!< RSA private key has not been provided - // // RSAPassphraseError, //!< RSA passphrase is incorrect (or has not been provided) - // RSADecodingError, /*!< There was a problem decoding the RSA private key - // (the key is invalid or the provided passphrase is incorrect)*/ - // RSAKeyFileError, //!< The provided key file either doesn't exist or is unreadable. - // OtherError //!< A network-related error not specified above - // }; - // - QString out; - if (e == QOAuth::BadRequest) { - out.append("Bad request"); - } else if (e == QOAuth::Unauthorized) { - out.append("Unauthorized"); - } else if (e == QOAuth::Forbidden) { - out.append("Forbidden"); - } else if (e == QOAuth::Timeout) { - out.append("Timeout"); - } else if (e == QOAuth::ConsumerKeyEmpty) { - out.append("ConsumerKeyEmpty"); - } else if (e == QOAuth::ConsumerSecretEmpty) { - out.append("ConsumerSecretEmpty"); - } else if (e == QOAuth::UnsupportedHttpMethod) { - out.append("UnsupportedHttpMethod"); - } else if (e == QOAuth::UnsupportedHttpMethod) { - out.append("ConsumerSecretEmpty"); - } else { - out.append("Other error." + e); - } - return out; -} - -void KOAuth::accessTokenFromService() -{ - QOAuth::ParamMap params = QOAuth::ParamMap(); - params.insert("oauth_callback", "oob"); - if (d->serviceBaseUrl.toLower().contains("identi.ca")) { - params.insert("oauth_verifier", d->verifier.toLocal8Bit()); - } - QOAuth::ParamMap reply = d->interface->accessToken(d->accessTokenUrl, QOAuth::GET, - d->requestToken, d->requestTokenSecret, - QOAuth::HMAC_SHA1, params); - - QString e; - if (d->interface->error() == QOAuth::NoError) { - d->accessToken = reply.value(QOAuth::tokenParameterName()); - d->accessTokenSecret = reply.value(QOAuth::tokenSecretParameterName()); - - //kDebug() << "Received Access Token OK!" << d->accessToken << d->accessTokenSecret; - emit accessTokenReceived(d->user, d->serviceBaseUrl, d->accessToken, d->accessTokenSecret); - d->busy = false; - - if (d->useWallet) { - saveCredentials(); - } else { - KSharedConfigPtr ptr = KSharedConfig::openConfig("koauthrc"); - KConfigGroup config = KConfigGroup(ptr, d->user+"@"+d->serviceBaseUrl); - config.writeEntry("accessToken", d->accessToken); - config.writeEntry("accessTokenSecret", d->accessTokenSecret); - config.sync(); - } - emit authorized(); - } else { - kError() << d->interface->error() << reply; - e += errorMessage(d->interface->error()); - kError() << "Request Not working" << e; - emit statusUpdated(d->user, d->serviceBaseUrl, "Error", "Access Token Error:" + e); - d->busy = false; - } -} - -QStringList KOAuth::authorizedAccounts() -{ -// KSharedConfigPtr ptr = KSharedConfig::openConfig("koauthrc", KConfig::SimpleConfig); - //KConfigGroup config = KConfigGroup(ptr); - KWallet::Wallet *wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), - 0, KWallet::Wallet::Synchronous); - QStringList aac; - if (wallet && wallet->isOpen() && wallet->setFolder("Plasma-MicroBlog")) { - - QMap > mapMap; - if (wallet->readMapList("*", mapMap) == 0) { -// kDebug() << "see my maps: " << mapMap; - aac = mapMap.keys(); - kDebug() << "!!! read accounts: " << aac; - } else { - kWarning() << "Unable to read grouplist from wallet"; - } - } else { - kWarning() << "Unable to open wallet"; - } - - return aac; -} - - -void KOAuth::setServiceBaseUrl(const QString &serviceBaseUrl) -{ - if (d->serviceBaseUrl == serviceBaseUrl) { - return; - } - d->serviceBaseUrl = serviceBaseUrl; - updateState(); -} - -void KOAuth::updateState() -{ - const QUrl u(d->serviceBaseUrl); - - if (u.host().endsWith("twitter.com")) { - //kDebug() << "Using twitter..."; - d->requestTokenUrl = "https://api.twitter.com/oauth/request_token"; - d->accessTokenUrl = "https://api.twitter.com/oauth/access_token"; - d->authorizeUrl = "https://api.twitter.com/oauth/authorize"; - d->consumerKey = "22kfJkztvOqb8WfihEjdg"; - d->consumerSecret = "RpGc0q0aGl0jMkeqMIawUpGyDkJ3DNBczFUyIQMR698"; - - } else { - //kDebug() << "Using identi.ca..."; - d->requestTokenUrl = "https://identi.ca/api/oauth/request_token"; - d->accessTokenUrl = "https://identi.ca/api/oauth/access_token"; - d->authorizeUrl = "https://identi.ca/api/oauth/authorize"; - d->consumerKey = "47a4650a6bd4026b1c4d55d641acdb64"; - d->consumerSecret = "49208b0a87832f4279f9d3742c623910"; - } - - - if (!d->user.isEmpty() && !d->serviceBaseUrl.isEmpty()) { - if (d->useWallet) { - retrieveCredentials(); - } else { - KSharedConfigPtr ptr = KSharedConfig::openConfig("koauthrc"); - KConfigGroup config = KConfigGroup(ptr, d->user+"@"+d->serviceBaseUrl); - d->accessToken = config.readEntry("accessToken", QByteArray()); - d->accessTokenSecret = config.readEntry("accessTokenSecret", QByteArray()); - } - //kDebug() << "oauthrc config for " << d->user+"@"+d->serviceBaseUrl << d->accessToken << d->accessTokenSecret; - if (isAuthorized()) { - emit accessTokenReceived(d->user, d->serviceBaseUrl, d->accessToken, d->accessTokenSecret); - d->busy = false; - } - } -} - -KOAuth::~KOAuth() -{ - if (!d) return; - delete d->w; - delete d->qcaInitializer; - delete d; -} - -bool KOAuth::isAuthorized() -{ - return !d->accessToken.isEmpty() && !d->accessTokenSecret.isEmpty(); -} - - -QByteArray KOAuth::authorizationHeader(const KUrl &requestUrl, QOAuth::HttpMethod method, QOAuth::ParamMap params) -{ - QByteArray auth; - auth = d->interface->createParametersString(requestUrl.url(), method, - d->accessToken, d->accessTokenSecret, - QOAuth::HMAC_SHA1, params, - QOAuth::ParseForHeaderArguments); - return auth; -} - -void KOAuth::sign(KIO::Job *job, const QString &url, QOAuth::ParamMap params, HttpMethod httpMethod) -{ - signRequest(job, url, httpMethod, accessToken(), accessTokenSecret(), params); -} - -QByteArray KOAuth::paramsToString(const QOAuth::ParamMap ¶meters, ParsingMode mode) -{ - QByteArray middleString; - QByteArray endString; - QByteArray prependString; - - switch (mode) { - case ParseForInlineQuery: - prependString = "?"; - case ParseForRequestContent: - case ParseForSignatureBaseString: - middleString = "="; - endString = "&"; - break; - case ParseForHeaderArguments: - prependString = "OAuth "; - middleString = "=\""; - endString = "\","; - break; - default: - qWarning() << __FUNCTION__ << "- Unrecognized mode"; - return QByteArray(); - } - - QByteArray parameter; - QByteArray parametersString; - - Q_FOREACH (parameter, parameters.uniqueKeys()) { - QList values = parameters.values(parameter); - if (values.size() > 1) { - qSort(values.begin(), values.end()); - } - QByteArray value; - Q_FOREACH (value, values) { - parametersString.append(parameter); - parametersString.append(middleString); - parametersString.append(value); - parametersString.append(endString); - } - } - - // remove the trailing end character (comma or ampersand) - parametersString.chop(1); - - // prepend with the suitable string (or none) - parametersString.prepend(prependString); - //kDebug() << "paramterString: " << parametersString; - return parametersString; -} - -QByteArray KOAuth::createSignature(const QString &requestUrl, HttpMethod method, const QByteArray &token, - const QByteArray &tokenSecret, QOAuth::ParamMap *params) -{ - if (!QCA::isSupported("hmac(sha1)")) { - kError() << "Your QCA2 does not support the HMAC-SHA1 algorithm. Signing requests using OAuth does not work"; - return QByteArray(); - } - - // create nonce - QCA::InitializationVector iv(16); - QByteArray nonce = iv.toByteArray().toHex(); - - // create timestamp - uint time = QDateTime::currentDateTime().toTime_t(); - QByteArray timestamp = QByteArray::number(time); - - QByteArray httpMethodString = (method == POST) ? "POST" : "GET"; - // create signature base string - // prepare percent-encoded request URL - QByteArray percentRequestUrl = requestUrl.toAscii().toPercentEncoding(); - // prepare percent-encoded parameters string - params->insert("oauth_consumer_key", d->consumerKey); - //params->insert("oauth_callback", "oob"); - params->insert("oauth_nonce", nonce); - params->insert("oauth_signature_method", "HMAC-SHA1"); - params->insert("oauth_timestamp", timestamp); - params->insert("oauth_version", "1.0"); - // append token only if it is defined (requestToken() doesn't use a token at all) - if (!token.isEmpty()) { - params->insert("oauth_token", token); - } - - foreach (const QByteArray &_b, params->keys()) { - if (params->count(_b) > 1) { - kWarning() << "Request argument " << _b << "multiple times. This might break."; - } - } - - QByteArray parametersString = paramsToString(*params, ParseForSignatureBaseString); // TODO use createSignature() - QByteArray percentParametersString = parametersString.toPercentEncoding(); - - QByteArray digest; - - // create signature base string - QByteArray signatureBaseString; - signatureBaseString.append(httpMethodString + "&"); - signatureBaseString.append(percentRequestUrl + "&"); - signatureBaseString.append(percentParametersString); - - if (!QCA::isSupported("hmac(sha1)")) { - kError() << "Hashing algo not supported, update your QCA"; - return QByteArray(); - } - // create key for HMAC-SHA1 hashing - QByteArray key(d->consumerSecret + "&" + tokenSecret); - - // create HMAC-SHA1 digest in Base64 - QCA::MessageAuthenticationCode hmac("hmac(sha1)", QCA::SymmetricKey(key)); - QCA::SecureArray array(signatureBaseString); - hmac.update(array); - QCA::SecureArray resultArray = hmac.final(); - digest = resultArray.toByteArray().toBase64(); - - // percent-encode the digest - QByteArray signature = digest.toPercentEncoding(); - return signature; -} - -void KOAuth::signRequest(KIO::Job *job, const QString &requestUrl, HttpMethod method, const QByteArray &token, - const QByteArray &tokenSecret, const QOAuth::ParamMap ¶ms) -{ - QOAuth::ParamMap parameters = params; - - // create signature - QByteArray signature = createSignature(requestUrl, method, token, tokenSecret, ¶meters); - - // add signature to parameters - parameters.insert("oauth_signature", signature); - foreach (QByteArray key, params.keys()) { - parameters.remove(key); - } - kDebug() << parameters; - - QByteArray authorizationHeader = paramsToString(parameters, ParseForHeaderArguments); - job->addMetaData("customHTTPHeader", QByteArray("Authorization: " + authorizationHeader)); -} - -QByteArray KOAuth::userParameters(const QOAuth::ParamMap& parameters) -{ - if (!parameters.count()) { - return QByteArray(); - } - return d->interface->inlineParameters(parameters, QOAuth::ParseForInlineQuery); -} - -void KOAuth::forgetAccount(const QString& user, const QString& serviceUrl) -{ - const QString &_id = user + "@" + serviceUrl; - KWallet::Wallet *wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), - 0, KWallet::Wallet::Synchronous); - wallet->setFolder("Plasma-MicroBlog"); - if (!wallet->removeEntry(_id)) { - kError() << "Error removing : " << _id; - } - - wallet->sync(); -} - - - -void KOAuth::saveCredentials() const -{ - QSharedPointer wallet(KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), - 0, KWallet::Wallet::Synchronous)); - const QString folder("Plasma-MicroBlog"); - if (wallet && wallet->isOpen() && - (wallet->hasFolder(folder) || - wallet->createFolder(folder)) && - wallet->setFolder(folder)) { - - //QStringList accounts = - QMap map; - map["accessToken"] = QString(d->accessToken); - map["accessTokenSecret"] = QString(d->accessTokenSecret); - - if (wallet->writeMap(identifier(), map) != 0) { - kWarning() << "Unable to write accessToken & Secret to wallet"; - } - } else { - kWarning() << "Unable to open Plasma-MicroBlog wallet"; - } -} - -QString KOAuth::identifier() const -{ - return QString("%1@%2").arg(d->user, d->serviceBaseUrl); -} - -bool KOAuth::retrieveCredentials() const -{ - KWallet::Wallet *wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), - 0, KWallet::Wallet::Synchronous); - if (wallet && wallet->isOpen() && wallet->setFolder("Plasma-MicroBlog")) { - -// QMap > mapMap; - QMap > mapMap; - if (wallet->readMapList("*", mapMap) == 0) { - d->authorizedAccounts = mapMap.keys(); - if (d->authorizedAccounts.contains(identifier())) { - d->accessToken = mapMap[identifier()]["accessToken"].toAscii(); - d->accessTokenSecret = mapMap[identifier()]["accessTokenSecret"].toAscii(); - return true; - } - return false; - } else { - //kWarning() << "Unable to read credentials from wallet"; - } - } else { - kWarning() << "Unable to open wallet"; - } - - return false; -} -void KOAuth::forgetCredentials() const -{ - d->user = QByteArray(); - d->serviceBaseUrl = QByteArray(); - d->password = QString(); - saveCredentials(); -} - -void KOAuth::configToWallet() -{ - KSharedConfigPtr gptr = KSharedConfig::openConfig("koauthrc", KConfig::SimpleConfig); - KSharedConfigPtr ptr = KSharedConfig::openConfig("koauthrc"); - foreach (const QString g, gptr->groupList()) { - KConfigGroup config = KConfigGroup(ptr, g); - d->user = g.split('@')[0]; - d->serviceBaseUrl = g.split('@')[1]; - d->accessToken = config.readEntry("accessToken", QByteArray()); - d->accessTokenSecret = config.readEntry("accessTokenSecret", QByteArray()); - saveCredentials(); - } -} - - - -} // namespace - -#include "moc_koauth.cpp" diff --git a/kdeplasma-addons/dataengines/microblog/koauth.h b/kdeplasma-addons/dataengines/microblog/koauth.h deleted file mode 100644 index ac510398..00000000 --- a/kdeplasma-addons/dataengines/microblog/koauth.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef QOAUTHHELPER_H -#define QOAUTHHELPER_H - -#include -#include - -#include - -#include - -namespace KIO { - class Job; -} - -namespace QOAuth { - typedef QMultiMap ParamMap; -} - -namespace KOAuth { - // OAuth methods -enum HttpMethod { POST, GET }; -enum ParsingMode { - ParseForRequestContent, //!< Inline query format (foo=bar&bar=baz&baz=foo ...), suitable for POST requests - ParseForInlineQuery, /*!< Same as ParseForRequestContent, but prepends the string with a question mark - - suitable for GET requests (appending parameters to the request URL) */ - ParseForHeaderArguments, //!< HTTP request header format (parameters to be put inside a request header) - ParseForSignatureBaseString //!< Signature Base String format, meant for internal use. -}; - -class KOAuthPrivate; - -class KOAuth : public QThread -{ -Q_OBJECT - -public: - - KOAuth(QObject* parent = 0); - ~KOAuth(); - - void init(); - void run(); - - static QStringList authorizedAccounts(); - - QString user() const; - void setUser(const QString &user); - - QString identifier() const; - - QString serviceBaseUrl() const; - void setServiceBaseUrl(const QString &url); - - QString password() const; - - QByteArray accessToken() const; - QByteArray accessTokenSecret() const; - bool isAuthorized(); - - void sign(KIO::Job *job, const QString &url, QOAuth::ParamMap params = QOAuth::ParamMap(), HttpMethod httpMethod = GET); - QByteArray userParameters(const QOAuth::ParamMap ¶meters); - QByteArray authorizationHeader(const KUrl &requestUrl, QOAuth::HttpMethod method, QOAuth::ParamMap params); - -Q_SIGNALS: - void authorizeApp(const QString &serviceBaseUrl, const QString &authorizeUrl, const QString &pageUrl); - void accessTokenReceived(const QString &userName, const QString &serviceBaseUrl, const QString &accessToken, const QString &accessTokenSecret); - void authorized(); // We're ready - void statusUpdated(const QString &userName, const QString &serviceBaseUrl, const QString &status, const QString &message = QString()); - -public Q_SLOTS: - void appAuthorized(const QString &authorizeUrl, const QString &verifier); - void authorize(const QString &serviceBaseUrl, const QString &user, const QString &password); - void forgetAccount(const QString &user, const QString &serviceUrl); - -private: - void updateState(); - void requestTokenFromService(); - void accessTokenFromService(); - QString errorMessage(int e); - - void saveCredentials() const; - void forgetCredentials() const; - bool retrieveCredentials() const; - void configToWallet(); - - QByteArray paramsToString(const QOAuth::ParamMap ¶meters, ParsingMode mode); - QByteArray createSignature(const QString &requestUrl, HttpMethod method, const QByteArray &token, - const QByteArray &tokenSecret, QOAuth::ParamMap *params); - void signRequest(KIO::Job *job, const QString &requestUrl, HttpMethod method, const QByteArray &token, - const QByteArray &tokenSecret, const QOAuth::ParamMap ¶ms); - - KOAuthPrivate* d; - //QString m_serviceBaseUrl; -}; - -} // namespace KOAuth - -#endif - diff --git a/kdeplasma-addons/dataengines/microblog/koauthwebhelper.cpp b/kdeplasma-addons/dataengines/microblog/koauthwebhelper.cpp deleted file mode 100644 index 66dee9a5..00000000 --- a/kdeplasma-addons/dataengines/microblog/koauthwebhelper.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* - * QOAuth example - * http://blog.ayoy.net/2009/6/24/oauth - * - * Twitter OAuth Docs: - * https://dev.twitter.com/docs/auth/oauth - * - * How does OAuth work diagram: - * https://dev.twitter.com/sites/default/files/images_documentation/oauth_diagram.png - * - * - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "koauthwebhelper.h" -#include - -namespace KOAuth { - -class KOAuthWebHelperPrivate { - -public: - KOAuthWebHelperPrivate() - { - webView = 0; - dialog = 0; - busy = false; - } - QString user; - QString password; - QString serviceBaseUrl; - QHash authorizeUrls; - - QWebView *webView; - KDialog *dialog; - bool busy; - QTimer *timer; -}; - - -KOAuthWebHelper::KOAuthWebHelper(QObject* parent) - : QObject(parent), - d(new KOAuthWebHelperPrivate) -{ - setObjectName(QLatin1String("QOAuthWebHelper")); - d->timer = new QTimer(); - d->timer->setInterval(3000); - d->timer->setSingleShot(true); - connect(d->timer, SIGNAL(timeout()), SLOT(showDialog())); -} - -KOAuthWebHelper::~KOAuthWebHelper() -{ - kDebug(); - delete d; -} - -void KOAuthWebHelper::setUser(const QString& user) -{ - d->user = user; -} - -void KOAuthWebHelper::setPassword(const QString& password) -{ - d->password = password; -} - -void KOAuthWebHelper::setServiceBaseUrl(const QString &url) -{ - d->serviceBaseUrl = url; -} - -void KOAuthWebHelper::showDialog() -{ - if (d->dialog) { - kDebug() << "Showing dialog for URL: " << d->webView->page()->mainFrame()->toHtml(); - d->dialog->show(); - } -} - -void KOAuthWebHelper::authorizeApp(const QString &serviceBaseUrl, const QString &authorizeUrl, const QString &pageUrl) -{ - Q_UNUSED(serviceBaseUrl); - Q_UNUSED(authorizeUrl); - if (d->serviceBaseUrl == "/" || d->serviceBaseUrl.isEmpty()) return; - if (!d->webView) { - d->dialog = new KDialog(); - d->dialog->setCaption( "authorize application" ); - d->dialog->setButtons( KDialog::Ok | KDialog::Cancel); - - //d->webView = new KWebView(d->dialog, KWebPage::KIOIntegration); - d->webView = new QWebView(d->dialog); - d->dialog->setMainWidget(d->webView); -// d->dialog->show(); // remove - connect(d->webView->page(), SIGNAL(loadFinished(bool)), SLOT(loadFinished())); - } - - // Set an empty cookiejar, we don't want to recycle already logged in users - QNetworkAccessManager *qnam = d->webView->page()->networkAccessManager(); - QNetworkCookieJar *jar = new QNetworkCookieJar(this); - qnam->setCookieJar(jar); - d->authorizeUrls[authorizeUrl] = d->serviceBaseUrl; - d->webView->page()->mainFrame()->load(pageUrl); -} - -bool KOAuthWebHelper::isIdentica() -{ - return d->serviceBaseUrl.toLower().contains("identi.ca"); -} - -void KOAuthWebHelper::loadFinished() -{ - QWebPage *page = dynamic_cast(sender()); - if (!page) { - return; - } - - QWebFrame* mf = page->mainFrame(); - QString u = page->mainFrame()->url().toString(); - if (d->authorizeUrls.contains(u)) { - QString pin; - foreach (const QWebElement &code, mf->findAllElements("CODE")) { - pin = code.toPlainText(); -// kDebug() << "tag:" << code.tagName() << "PIN:" << pin; - }; - - foreach (const QWebElement &code, mf->findAllElements("#oauth_pin")) { - pin = code.toPlainText(); -// kDebug() << "tag:" << code.tagName() << "PIN:" << pin; - }; - if (!isIdentica() || !pin.isEmpty()) { -// kDebug() << "We're done!" << u << pin; - d->timer->stop(); // No need to show the dialog. :) - emit statusUpdated(d->user, d->serviceBaseUrl, "Busy", "Application authorized"); - emit appAuthSucceeded(u, pin); - if (d->dialog) { - d->dialog->close(); - } - return; - } - } else { - // The remote service challenges app authorization, this means that the - // user has to log in to the remote site to retrieve a PIN back, which - // in turn will produce the accessToken and accessTokenSecret pair in - // the next, final authorization step. - emit statusUpdated(d->user, d->serviceBaseUrl, "Waiting", "App Authorization needed"); - - // we have to log in, let's see if we can do that automatically... - - // For Twitter, there are two cases: - // - the user is already logged in, we just have to click the accept button - // - the user is not logged in, in that case the user/password have to be - // be filled in. We happen to know that, as it's the argument to the "auth" - // operation in the dataengine. -// kDebug() << "logging in " << d->user << d->password; - if (!isIdentica()) { - // Try to fill in user/pass into the form - //kDebug() << "twitter.com hacks JavaScript hacks: " << u; - QString script = "var userName = document.getElementById(\"username_or_email\"); userName.value = \"" + d->user + "\";\n"; - script.append("var passWord = document.getElementById(\"password\"); passWord.value = \"" + d->password + "\";\n"); - mf->evaluateJavaScript(script); - //kDebug() << "ran script 1: " << script; - // Evaluate the button click separately, as the above script might abort, - // and not all lines are actually executed. - script = QString(); - script.append("var ackButton = document.getElementById(\"allow\"); ackButton.click();"); - mf->evaluateJavaScript(script); - //kDebug() << "ran script 2: " << script; - } else if (d->serviceBaseUrl.toLower().contains("identi.ca")) { - //kDebug() << "Identi.ca hacks JavaScript hacks"; - QVariant r; - QString script = "var userName = document.getElementById(\"nickname\"); userName.value = \"" + d->user + "\";\n"; - script.append("var passWord = document.getElementById(\"password\"); passWord.value = \"" + d->password + "\";\n"); - r = mf->evaluateJavaScript(script); - kDebug() << "Ran script 1" << script << r; - // Evaluate the button click separately, as the above script might abort, - // and not all lines are actually executed. - script = ""; - script.append("var ackButton = document.getElementById(\"allow_submit\"); ackButton.click();"); - r = mf->evaluateJavaScript(script); - kDebug() << "Ran script 2" << script << r; - } - d->timer->start(); - } -} - -} -#include "moc_koauthwebhelper.cpp" diff --git a/kdeplasma-addons/dataengines/microblog/koauthwebhelper.h b/kdeplasma-addons/dataengines/microblog/koauthwebhelper.h deleted file mode 100644 index c74e357c..00000000 --- a/kdeplasma-addons/dataengines/microblog/koauthwebhelper.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KOAUTHWEBHELPER_H -#define KOAUTHWEBHELPER_H - -#include - -#include - -namespace KOAuth { -class KOAuthWebHelperPrivate; - -class KOAuthWebHelper : public QObject -{ -Q_OBJECT - -public: - KOAuthWebHelper(QObject* parent = 0); - ~KOAuthWebHelper(); - - void setUser(const QString &user); - void setPassword(const QString &password); - void setServiceBaseUrl(const QString &url); - bool isIdentica(); - -Q_SIGNALS: - void appAuthSucceeded(const QString &authorizeUrl, const QString &verifier); - void statusUpdated(const QString &userName, const QString &serviceBaseUrl, const QString &status, const QString &message = QString()); - -private Q_SLOTS: - void loadFinished(); - void showDialog(); - void authorizeApp(const QString &serviceBaseUrl, const QString &authorizeUrl, const QString &pageUrl); - -private: - KOAuthWebHelperPrivate* d; -}; - - -} // namespace - -#endif - diff --git a/kdeplasma-addons/dataengines/microblog/plasma-dataengine-microblog.desktop b/kdeplasma-addons/dataengines/microblog/plasma-dataengine-microblog.desktop deleted file mode 100644 index 05b643f2..00000000 --- a/kdeplasma-addons/dataengines/microblog/plasma-dataengine-microblog.desktop +++ /dev/null @@ -1,117 +0,0 @@ -[Desktop Entry] -Name=Microblogging -Name[ar]=التدوين المصغر -Name[ast]=Microblogging -Name[bs]=Microblogging -Name[ca]=Microblogs -Name[ca@valencia]=Microblogs -Name[cs]=Mikroblogování -Name[da]=Mikroblogning -Name[de]=Microblogging -Name[el]=Μικροϊστολόγιο -Name[en_GB]=Microblogging -Name[es]=Microblogs -Name[et]=Mikroblogimine -Name[eu]=Mikrobloggintza -Name[fi]=Mikroblogaussovelma -Name[fr]=Microblogging -Name[ga]=Micreabhlagadóireacht -Name[gl]=Microblog -Name[hr]=Microblogging -Name[hu]=Mikroblogolás -Name[is]=Míkróblogg -Name[it]=Microblogging -Name[ja]=マイクロブログ -Name[kk]=Микроблогинг -Name[km]=Microblogging -Name[ko]=마이크로블로깅 -Name[lt]=Mikrotinklaraštis -Name[lv]=Mikroblogi -Name[mr]=मायक्रो ब्लॉगिंग -Name[nb]=Mikroblogging -Name[nds]=Mikronettdagbook -Name[nl]=Microblogging -Name[nn]=Mikroblogging -Name[pa]=ਮਾਈਕਰੋਬਲੋਗ -Name[pl]=Mikroblog -Name[pt]=Micro-blog -Name[pt_BR]=Microblogging -Name[ro]=Microblogging -Name[ru]=Микроблоггинг -Name[sk]=Mikroblogovanie -Name[sl]=Mikrobloganje -Name[sq]=Microblogging -Name[sr]=микроблоговање -Name[sr@ijekavian]=микроблоговање -Name[sr@ijekavianlatin]=mikroblogovanje -Name[sr@latin]=mikroblogovanje -Name[sv]=Mikroblogg -Name[tr]=Mikrogünlük -Name[uk]=Міні-журнал -Name[wa]=Microblogaedje -Name[x-test]=xxMicrobloggingxx -Name[zh_CN]=微博客 -Name[zh_TW]=Microblogging -Comment=identi.ca and twitter micro-blogging services -Comment[ar]=خدمات التدوين المصغر من تويتر و identi.ca -Comment[ast]=servicios de microblogging identi.ca y twitter -Comment[bs]=identi.ca i twitter micro-blogging servisi -Comment[ca]=Serveis de microblogs identi.ca i twitter -Comment[ca@valencia]=Serveis de microblogs identi.ca i twitter -Comment[cs]=Služby mikroblogování identi.ca a twitter -Comment[da]=identi.ca og twitter mikroblogningstjenester -Comment[de]=Micro-Blogging-Dienste identi.ca und Twitter -Comment[el]=Υπηρεσίες μικροϊστολογίου identi.ca και twitter -Comment[en_GB]=identi.ca and twitter micro-blogging services -Comment[es]=Servicios de microblog identi.ca y twitter -Comment[et]=identi.ca ja twitteri mikroblogiteenused -Comment[fi]=identi.ca- ja Twitter-mikroblogauspalvelut -Comment[fr]=Services de mini-blogue pour « identi.ca » et « twitter » -Comment[ga]=Seirbhísí micreablagadóireachta identi.ca agus twitter -Comment[gl]=servizos de microblogue identi.ca e twitter -Comment[hr]=Servisi mikroblogova identi.ca i twitter -Comment[hu]=identi.ca és twitter mikroblogszolgáltatások -Comment[is]=identi.ca og twitter míkróbloggþjónustur -Comment[it]=Servizi di microblog identi.ca e twitter -Comment[ja]=identi.ca と twitter マイクロブログサービス -Comment[kk]=identi.ca және twitter микроблогтар қызметтері -Comment[km]=សេវា identi.ca និង twitter micro-blogging -Comment[ko]=identi.ca 및 트위터 마이크로블로그 -Comment[lv]=identi.ca un twitter mikroblogošanas pakalpojumi -Comment[mr]=identi.ca व ट्वीटर करिता मायक्रो-ब्लॉगिंग सेवा -Comment[nb]=identi.ca og twitter mikro-bloggetjenester -Comment[nds]=Lüttdaagbookdeensten "identi.ca" un "twitter" -Comment[nl]=identi.ca en twitter micro-blogging-services -Comment[nn]=Mikrobloggingstenestene identi.ca og Twitter -Comment[pa]=identi.ca ਅਤੇ twitter ਮਾਈਕਰੋ-ਬਲੌਗ ਸਰਵਿਸਾਂ -Comment[pl]=Usługi mikrobloga identi.ca i twitter -Comment[pt]=serviços de micro-blogs identi.ca e twitter -Comment[pt_BR]=Serviços de microblogagem identi.ca e twitter -Comment[ro]=Servicii de micro-blogging identi.ca și twitter -Comment[ru]=Службы микроблоггинга Identi.ca и Twitter -Comment[sk]=Služby mikroblogovania identi.ca a twitter -Comment[sl]=Mikrobloganje prek storitev identi.ca in twitter -Comment[sr]=Микроблогерски сервиси Идентика и Твитер -Comment[sr@ijekavian]=Микроблогерски сервиси Идентика и Твитер -Comment[sr@ijekavianlatin]=Mikroblogerski servisi identi.ca i Twitter -Comment[sr@latin]=Mikroblogerski servisi identi.ca i Twitter -Comment[sv]=Mikrobloggtjänsterna identi.ca och twitter -Comment[tr]=identi.ca ve twitter mikrogünlük servisleri -Comment[uk]=Служби мікроблогів identi.ca і twitter -Comment[wa]=Siervices identi.ca eyet twitter microblogaedje -Comment[x-test]=xxidenti.ca and twitter micro-blogging servicesxx -Comment[zh_CN]=identi.ca 和 twitter 微播客吐槽服务 -Comment[zh_TW]=identi.ca 與 twitter 微部落格服務 -X-KDE-ServiceTypes=Plasma/DataEngine -Type=Service -Icon=twitter_microblog -X-KDE-Library=plasma_engine_microblog - -X-KDE-PluginInfo-Author= -X-KDE-PluginInfo-Email= -X-KDE-PluginInfo-Name=microblog -X-KDE-PluginInfo-Version= -X-KDE-PluginInfo-Website= -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= - diff --git a/kdeplasma-addons/dataengines/microblog/timelineservice.cpp b/kdeplasma-addons/dataengines/microblog/timelineservice.cpp deleted file mode 100644 index 5a6025d6..00000000 --- a/kdeplasma-addons/dataengines/microblog/timelineservice.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2009-2010 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "tweetjob.h" -#include "timelineservice.h" -#include "timelinesource.h" - -#include -#include - -#include "koauth.h" - -Q_DECLARE_METATYPE(Plasma::DataEngine::Data) - - -TimelineService::TimelineService(TimelineSource *parent) - : Plasma::Service(parent), - m_source(parent) -{ - setName("tweet"); - kDebug(); -} - -Plasma::ServiceJob* TimelineService::createJob(const QString &operation, QMap ¶meters) -{ - kDebug() << "Create Job: " << operation; - if (operation == "update" || operation == "statuses/retweet" || - operation == "favorites/create" || operation == "favorites/destroy" || - operation == "friendships/create" || operation == "friendships/destroy") { - TweetJob *tj = new TweetJob(m_source, operation, parameters); -// TimelineSource *src = qobject_cast(parent()); -// if (src) { - kDebug() << "Source found" << m_source; - connect(tj, SIGNAL(userData(const QByteArray&)), m_source, SIGNAL(userData(const QByteArray&))); -// } - return tj; - } else if (operation == "refresh") { - Plasma::ServiceJob *sjob = new Plasma::ServiceJob(m_source->account(), operation, parameters, this); - KIO::Job *getJob = m_source->update(true); - if (getJob) { - connect(getJob, SIGNAL(result(KJob*)), sjob, SIGNAL(finished(KJob*))); - } - return sjob; - } else if (operation == "auth") { - //m_source->setPassword(parameters.value("password").toString()); - const QString user = parameters.value("user").toString(); - const QString password = parameters.value("password").toString(); - kDebug() << "Start authorization for " << user << password; - m_source->startAuthorization(user, password); - } else if (operation == "forget") { - const QString user = parameters.value("user").toString(); - const QString serviceUrl = parameters.value("serviceUrl").toString(); - kDebug() << "Forgetting acount " << user << serviceUrl; - m_source->forgetAccount(user, serviceUrl); - } else if (operation == "loadMore") { - Plasma::ServiceJob *sjob = new Plasma::ServiceJob(m_source->account(), operation, parameters, this); - kDebug() << "load more "; - KIO::Job *getJob = m_source->loadMore(); - if (getJob) { - connect(getJob, SIGNAL(result(KJob*)), sjob, SIGNAL(finished(KJob*))); - } - return sjob; - } - - - return new Plasma::ServiceJob(m_source->account(), operation, parameters, this); -} - - -#include "moc_timelineservice.cpp" - diff --git a/kdeplasma-addons/dataengines/microblog/timelineservice.h b/kdeplasma-addons/dataengines/microblog/timelineservice.h deleted file mode 100644 index 9fa9cbee..00000000 --- a/kdeplasma-addons/dataengines/microblog/timelineservice.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright (C) 2009 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TIMELINESERVICE_H -#define TIMELINESERVICE_H - -#include - -#include -#include - -class TimelineSource; - -class TimelineService : public Plasma::Service -{ - Q_OBJECT - -public: - TimelineService(TimelineSource *parent); - -//Q_SIGNALS: - //authorize(const QString &password); - -protected: - Plasma::ServiceJob* createJob(const QString &operation, QMap ¶meters); - -private: - TimelineSource *m_source; -}; - - -#endif diff --git a/kdeplasma-addons/dataengines/microblog/timelinesource.cpp b/kdeplasma-addons/dataengines/microblog/timelinesource.cpp deleted file mode 100644 index 210a30f6..00000000 --- a/kdeplasma-addons/dataengines/microblog/timelinesource.cpp +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2009-2010 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "timelinesource.h" -#include "timelineservice.h" -#include "tweetjob.h" - -#include -#include - -#include - -#include -#include - -#include "imagesource.h" -#include "koauth.h" - -Q_DECLARE_METATYPE(Plasma::DataEngine::Data) - -class TimelineSourcePrivate { - -public: - TimelineSourcePrivate() - { - newestId = 0; - oldestId = 0; - } - qulonglong newestId; - qulonglong oldestId; - QString loadMoreUrl; - QString refreshUrl; -}; - -TimelineSource::TimelineSource(const QString &serviceUrl, RequestType requestType, KOAuth::KOAuth *oauthHelper, const QStringList ¶meters, QObject* parent) - : Plasma::DataContainer(parent), - m_serviceBaseUrl(serviceUrl), - m_needsAuthorization(true), - m_requestType(requestType), - m_job(0), - m_authHelper(oauthHelper), - m_parameters(parameters), - m_authJob(0), - m_qcaInitializer(0) -{ - d = new TimelineSourcePrivate; - setObjectName(QLatin1String("Timeline")); - // set up the url - QString query; - - m_params.clear(); -// if (m_parameters.count()) { -// m_params.insert("q", m_parameters[0].toLocal8Bit()); -// } - - // default arguments - m_params.insert("include_entities", "true"); - m_params.insert("include_rts", "true"); - m_params.insert("count", "50"); - m_params.insert("trim_user", "false"); - - // parse URL from QML runtime, possibly overwrite defaults - bool hasQuery = false; - const QString &pa = m_parameters[0].toLocal8Bit(); - if (!pa.isEmpty()) { - const QStringList &tokens = pa.split(QLatin1Char('&')); - foreach (const QString &t, tokens) { - const QStringList &pair = t.split(QLatin1Char('=')); - if (pair.count() == 2) { - const QByteArray &n = QUrl::toPercentEncoding(pair.at(0).toLocal8Bit()); - const QByteArray &v = QUrl::toPercentEncoding(pair.at(1).toLocal8Bit()); -// kDebug() << " inserted: " << n << v; - query.append(QString("%1=%2&").arg(QString(n), QString(v))); - m_params.insert(n, v); - if (n == QByteArray("q") && !v.isEmpty()) { - hasQuery = true; - } - //inserted = - } else { - kWarning() << "Parsing problem expected 2 values, got: " << pa << pair; - } - } - } - switch (m_requestType) { - case CustomTimeline: - case SearchTimeline: - if (!hasQuery) { - return; - } - if (m_serviceBaseUrl.host().endsWith("twitter.com")) { - m_url = KUrl("http://search.twitter.com/search.json"); - } else if (m_serviceBaseUrl.host().endsWith("identi.ca")) { - m_url = KUrl("http://identi.ca/api/search.json"); - } else { - - } - m_params.insert("show_user", "true"); - m_params.insert("rpp", "88"); - //m_params.insert("result_type", "mixed"); - m_needsAuthorization = false; -// kDebug() << "Search or Custom Url: " << m_url << m_serviceBaseUrl; - break; - case Profile: - m_url = KUrl(m_serviceBaseUrl, QString("users/show/%1.json").arg(parameters.at(0))); - m_needsAuthorization = false; - break; - case DirectMessages: - m_url = KUrl(m_serviceBaseUrl, "direct_messages.json"); - break; - case Replies: - m_url = KUrl(m_serviceBaseUrl, "statuses/mentions.json"); -// kDebug() << "XXXX " << m_url; - break; - case TimelineWithFriends: - m_url = KUrl(m_serviceBaseUrl, "statuses/home_timeline.json"); - break; - case Timeline: - default: - m_url = KUrl(m_serviceBaseUrl, "statuses/user_timeline.json"); - break; - } - //m_params.insert("count", QString("100").toLocal8Bit()); - -// kDebug() << "authorized." << m_authHelper->isAuthorized(); - if (!m_needsAuthorization || m_authHelper->isAuthorized()) { - update(); - } - if (m_needsAuthorization) { - connect(m_authHelper, SIGNAL(authorized()), SLOT(update())); - } -} - -TimelineSource::~TimelineSource() -{ -} - -bool TimelineSource::needsAuthorization() const -{ - return m_needsAuthorization; -} - -Plasma::Service* TimelineSource::createService() -{ - return new TimelineService(this); -} - -void TimelineSource::startAuthorization(const QString& user, const QString& password) -{ - emit authorize(m_serviceBaseUrl.pathOrUrl(), user, password); -} - -void TimelineSource::forgetAccount(const QString& user, const QString& serviceUrl) -{ - m_authHelper->forgetAccount(user, serviceUrl); - emit accountRemoved(user + "@" + serviceUrl); -} - - -void TimelineSource::setOAuthHelper(KOAuth::KOAuth* authHelper) -{ - m_authHelper = authHelper; -} - -KOAuth::KOAuth* TimelineSource::oAuthHelper() -{ - return m_authHelper; -} - -void TimelineSource::setPassword(const QString &password) -{ - m_authHelper->authorize(m_serviceBaseUrl.pathOrUrl(), m_user, password); -} - -QString TimelineSource::password() const -{ - return m_url.pass(); -} - -QString TimelineSource::account() const -{ - return m_user; -} - -KUrl TimelineSource::serviceBaseUrl() const -{ - return m_serviceBaseUrl; -} - -QByteArray TimelineSource::oauthToken() const -{ - return m_oauthToken; -} - -QByteArray TimelineSource::oauthTokenSecret() const -{ - return m_oauthTokenSecret; -} - -KIO::Job* TimelineSource::loadMore() -{ - m_params.replace("max_id", QString::number(d->oldestId).toLocal8Bit()); - kDebug() << "Loading tweets before " << QString::number(d->oldestId); - return update(true); -} - -KIO::Job* TimelineSource::update(bool forcedUpdate) -{ -// kDebug() << "Refresh() ... "; - if (!m_authHelper->isAuthorized()) { - return 0; - } - if (m_job) { - // We are already performing a fetch, let's not bother starting over - return 0; - } - - - // Create a KIO job to get the data from the web service - QByteArray ps; - ps = m_authHelper->userParameters(m_params); - - KUrl u = KUrl(m_url.pathOrUrl() + ps); -// kDebug() << "Creating job..." << u << " P: " << ps << " User: " << m_authHelper->user(); - m_job = KIO::get(u, KIO::Reload, KIO::HideProgressInfo); - if (m_needsAuthorization) { - m_authHelper->sign(m_job, m_url.pathOrUrl(), m_params); - } - - connect(m_job, SIGNAL(data(KIO::Job*,QByteArray)), - this, SLOT(recv(KIO::Job*,QByteArray))); - connect(m_job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*))); - - if (forcedUpdate) { - connect(m_job, SIGNAL(result(KJob*)), this, SLOT(forceImmediateUpdate())); - } - m_job->start(); - return m_job; -} - -void TimelineSource::recv(KIO::Job*, const QByteArray& data) -{ - m_xml += data; -} - -void TimelineSource::result(KJob *job) -{ - KIO::TransferJob *tj = dynamic_cast(job); - if (!job || job != m_job) { - kDebug() << "#fail job is not our job!"; - return; - } - - //removeAllData(); - //m_imageSource->loadStarted(); - if (job->error()) { - kDebug() << "job error! : " << job->errorString() << tj->url();// << m_xml; - // TODO: error handling - } else { - //QXmlStreamReader reader(m_xml); - kDebug() << "Timeline job returned: " << tj->url() << m_xml.count();// << m_xml; - if (m_requestType == TimelineSource::SearchTimeline) { - parseJsonSearchResult(m_xml); - } else { - //parse(reader); - parseJson(m_xml); - } - } - -// QFile file("/home/sebas/kdesvn/src/declarative-plasmoids/microblog/tmp/output.json"); -// if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { -// QTextStream out(&file); -// out << m_xml; -// file.flush(); -// file.close(); -// } - - checkForUpdate(); - m_xml.clear(); - m_job = 0; -} - -void TimelineSource::auth(KIO::Job*, const QByteArray& data) -{ - m_oauthTemp += data; -} - -void TimelineSource::authFinished(KJob *job) -{ - if (job != m_authJob) { - return; - } - - if (job->error()) { - kDebug() << "Authentication Error " << job->error() << ": " << job->errorText(); - } else { - QList pairs = m_oauthTemp.split('&'); - - foreach (QByteArray pair, pairs) { - QList data = pair.split('='); - if (data.at(0) == "oauth_token") { - m_oauthToken = data.at(1); - } else if (data.at(0) == "oauth_token_secret") { - m_oauthTokenSecret = data.at(1); - } - } - update(true); - } - m_oauthTemp.clear(); - m_authJob = 0; - //kDebug() << "Authentication succeeded, Token: " << QString(m_oauthToken); -} - -void TimelineSource::parseJson(const QByteArray &data) -{ - //kDebug() << "JSON: " << data; -// kDebug() << "JSON TIMELINE PARSER ONLINE"; - QJson::Parser parser; - const QVariantList resultsList = parser.parse(data).toList(); - const QVariantMap resultsMap = parser.parse(data).toMap(); - bool hasResult = false; - int i = 0; - foreach (const QVariant &v, resultsList) { - const QVariantMap &tweet = v.toMap(); - i++; - hasResult = true; - foreach (const QVariant &k, tweet.keys()) { - const QString _u = k.toString(); - if (_u != "user") { - m_tempData[_u] = tweet[_u]; - } - } - - QString st = tweet["text"].toString(); - if (tweet.keys().contains("entities")) { - const QVariantMap &entities = tweet["entities"].toMap(); - if (entities.keys().contains("urls")) { - const QVariantList &urls = entities["urls"].toList(); - foreach (const QVariant &_u, urls) { - const QVariantMap u = _u.toMap(); - const QString &shortUrl = u["url"].toString(); - const QString &expandedUrl = u["expanded_url"].toString(); - st.replace(shortUrl, expandedUrl); - } - } - } - m_tempData["Date"] = tweet["created_at"]; - m_id = tweet["id"].toString(); - m_tempData["Id"] = m_id; - m_tempData["Status"] = st; - m_tempData["Source"] = tweet["source"]; - m_tempData["IsFavorite"] = tweet["favorited"]; - - parseJsonUser(tweet["user"]); - - //m_tempData["ImageUrl"] = tweet["profile_image_url"]; - if (m_tempData.contains("User")) { - KUrl url(tweet["profile_image_url"].toString()); - m_imageSource->loadImage(m_tempData["User"].toString(), url); - } - emit userFound(tweet["user"], m_serviceBaseUrl.pathOrUrl()); - - qulonglong i = m_id.toULongLong(); - //qulonglong o = 0; - //qulonglong n = 0; - if (!d->oldestId || d->oldestId > i) { - d->oldestId = i; - } - if (!d->newestId || d->newestId < i) { - d->newestId = i; - } - //kDebug() << "m_id, id, oldest, newest: " << m_id << i << d->oldestId << d->newestId; - - if (!m_id.isEmpty()) { - QVariant v; - v.setValue(m_tempData); -// foreach (const QString &k, m_tempData.keys()) { -// kDebug() << "setting data" << m_id << k << m_tempData[k]; -// } - setData(m_id, v); - m_id.clear(); - } - } - kDebug() << "Found " << i << " Tweets."; - if (!hasResult) { - const QVariantList resultsList = parser.parse(data).toList(); - if (!resultsList.count()) { - const QVariantMap &map = parser.parse(data).toMap(); - const QString &e = map["error"].toString(); - const QString &r = map["request"].toString(); - //kDebug() << "Error? : " << m_xml; -// kDebug() << " E: " << e << " " << r; - m_tempData["Status"] = QVariant(e + " (" + r + ")"); - m_tempData["User"] = QVariant(i18n("Error")); - QVariant v; - v.setValue(m_tempData); - setData("1234", v); - - } - } - checkForUpdate(); - -} - -void TimelineSource::parseJsonUser(const QVariant& data) -{ - const QVariantMap &user = data.toMap(); -// foreach (const QVariant &k, user.keys()) { -// kDebug() << " user k : " << k << " :: " << user[k.toString()].toString(); -// //m_tempData[k.toString()] = user[k.toString()]; -// } - - // compatibility with old API - m_tempData["User"] = user["screen_name"]; - m_tempData["ImageUrl"] = user["profile_image_url"].toString(); - //kDebug() << " imageUrl: " << m_tempData["ImageUrl"]; - m_tempData["name"] = user["name"]; - if (m_tempData.contains("ImageUrl")) { - KUrl url(m_tempData["ImageUrl"].toString()); - m_imageSource->loadImage(m_tempData["User"].toString(), url); - } - m_tempData["Url"] = user["url"]; - - //kDebug() << "User done"; -} - - -void TimelineSource::parseJsonSearchResult(const QByteArray &data) -{ - QJson::Parser parser; - const QVariantMap resultsMap = parser.parse(data).toMap(); - bool hasResult = false; - foreach (QVariant v, resultsMap.keys()) { - if (v.toString() == "results") { - foreach (const QVariant &w, resultsMap[v.toString()].toList()) { - hasResult = true; - QVariantMap r = w.toMap(); - - foreach (const QVariant &k, r.keys()) { - const QString _u = k.toString(); - if (_u != "user") { - m_tempData[_u] = r[_u]; - } - } - // QML Model - // property string messageId: model["Id"] - // property string user: model["User"] - // property string source: model["source"] - // property string dateTime: model["created_at"] - // property bool isFavorite: model["favorited"] - // property string message: model["Status"] - - m_tempData["name"] = r["from_user_name"]; - m_tempData["Date"] = r["created_at"]; - m_id = r["id"].toString(); - m_tempData["Id"] = m_id; - m_tempData["Status"] = r["text"]; - m_tempData["Source"] = r["source"]; - m_tempData["User"] = r["from_user"]; - // not supported in search - m_tempData["IsFavorite"] = "false"; - m_tempData["retweet_count"] = "0"; - m_tempData["favorited"] = "false"; - m_tempData["ImageUrl"] = r["profile_image_url"]; - if (m_tempData.contains("User")) { - KUrl url(r["profile_image_url"].toString()); - m_imageSource->loadImage(m_tempData["User"].toString(), url); -// emit userFound(m_tempData["User"], m_serviceBaseUrl.pathOrUrl()); - } - if (!m_id.isEmpty()) { - QVariant v; - v.setValue(m_tempData); - setData(m_id, v); - m_id.clear(); - } - qulonglong i = m_id.toULongLong(); - if (!d->oldestId || d->oldestId > i) { - d->oldestId = i; - } - if (!d->newestId || d->newestId < i) { - d->newestId = i; - } - } - } - - } - if (!hasResult) { - const QVariantList resultsList = parser.parse(data).toList(); - kDebug() << "Found " << resultsList.count() << " search result tweets"; - if (!resultsList.count()) { - const QVariantMap &map = parser.parse(data).toMap(); - const QString &e = map["error"].toString(); - const QString &r = map["request"].toString(); - //kDebug() << "Error? : " << m_xml; - //kDebug() << " E: " << e << " " << r; - m_tempData["Status"] = QVariant(e + " (" + r + ")"); - QVariant v; - v.setValue(m_tempData); - setData("1234", v); - - } - } -} - -void TimelineSource::setImageSource(ImageSource *source) -{ - m_imageSource = source; -} - -ImageSource *TimelineSource::imageSource() const -{ - return m_imageSource; -} - -#include "moc_timelinesource.cpp" - diff --git a/kdeplasma-addons/dataengines/microblog/timelinesource.h b/kdeplasma-addons/dataengines/microblog/timelinesource.h deleted file mode 100644 index af1a5db7..00000000 --- a/kdeplasma-addons/dataengines/microblog/timelinesource.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright (C) 2009 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TIMELINESOURCE_H -#define TIMELINESOURCE_H - -#include "koauth.h" - -#include - -#include -#include -#include - -// forward declarations -//#include - -class KJob; - -namespace KIO -{ - class Job; -} // namespace KIO - -namespace QCA -{ - class Initializer; -} - -class TimelineSourcePrivate; -class ImageSource; - -class TimelineSource : public Plasma::DataContainer -{ - Q_OBJECT - -public: - enum RequestType { - Timeline = 0, - TimelineWithFriends, - Replies, - DirectMessages, - CustomTimeline, - SearchTimeline, - Profile, - User - }; - - TimelineSource(const QString &serviceUrl, RequestType requestType, KOAuth::KOAuth *oauthHelper, const QStringList ¶meters, QObject* parent); - ~TimelineSource(); - - void setPassword(const QString &password); - QString account() const; - QString password() const; - KUrl serviceBaseUrl() const; - bool needsAuthorization() const; - - QByteArray oauthToken() const; - QByteArray oauthTokenSecret() const; - void setOAuthHelper(KOAuth::KOAuth *authHelper); - KOAuth::KOAuth* oAuthHelper(); - - Plasma::Service* createService(); - void startAuthorization(const QString &user, const QString &password); - void forgetAccount(const QString &user, const QString &serviceUrl); - - ImageSource* imageSource() const; - void setImageSource(ImageSource *); - -public Q_SLOTS: - KIO::Job* update(bool forcedUpdate = false); - KIO::Job* loadMore(); - -Q_SIGNALS: - void authorize(const QString &serviceBaseUrl, const QString &user, const QString &password); - void userFound(const QVariant &userData, const QString &serviceBaseUrl); - void accountRemoved(const QString &account); - void userData(const QByteArray &data); - -private slots: - void recv(KIO::Job*, const QByteArray& data); - void result(KJob*); - - void auth(KIO::Job*, const QByteArray& data); - void authFinished(KJob*); - -private: -// void parse(QXmlStreamReader &xml); -// void readStatus(QXmlStreamReader &xml); -// void readUser(QXmlStreamReader &xml, const QString &tagName = "user"); -// void readDirectMessage(QXmlStreamReader &xml); - void parseJson(const QByteArray &data); - void parseJsonUser(const QVariant &data); - void parseJsonSearchResult(const QByteArray &data); -// void parseSearchResult(QXmlStreamReader &xml); -// void readSearchStatus(QXmlStreamReader &xml); -// void skipTag(QXmlStreamReader &xml, const QString &tagName); - - // OAuth constants - static const QString AccessTokenUrl; - - TimelineSourcePrivate* d; - - KUrl m_url; - KUrl m_serviceBaseUrl; - bool m_needsAuthorization; - RequestType m_requestType; - ImageSource *m_imageSource; - QByteArray m_xml; - Plasma::DataEngine::Data m_tempData; - KIO::Job *m_job; - QString m_id; - QOAuth::ParamMap m_params; - - KOAuth::KOAuth *m_authHelper; - QStringList m_parameters; - QString m_user; - QByteArray m_oauthTemp; - KIO::Job *m_authJob; - QByteArray m_oauthToken; - QByteArray m_oauthTokenSecret; - QCA::Initializer *m_qcaInitializer; -}; - -#endif diff --git a/kdeplasma-addons/dataengines/microblog/tweet.operations b/kdeplasma-addons/dataengines/microblog/tweet.operations deleted file mode 100644 index 510e0033..00000000 --- a/kdeplasma-addons/dataengines/microblog/tweet.operations +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kdeplasma-addons/dataengines/microblog/tweetjob.cpp b/kdeplasma-addons/dataengines/microblog/tweetjob.cpp deleted file mode 100644 index 885816c9..00000000 --- a/kdeplasma-addons/dataengines/microblog/tweetjob.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2009-2010 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "tweetjob.h" -#include "timelineservice.h" -#include "timelinesource.h" - - -#include -#include - -#include "koauth.h" - -Q_DECLARE_METATYPE(Plasma::DataEngine::Data) - - -TweetJob::TweetJob(TimelineSource *source, const QString &operation, const QMap ¶meters, QObject *parent) - : Plasma::ServiceJob(source->account(), operation, parameters, parent), - m_url(source->serviceBaseUrl()), - m_parameters(parameters), - m_source(source), - m_operation(operation) -{ - - if (operation == "statuses/retweet" || - operation == "favorites/create" || - operation == "favorites/destroy") { - m_url.setPath(m_url.path()+QString("%1/%2.xml").arg(operation).arg(parameters.value("id").toString())); - kDebug() << "Operation" << operation << m_url; - - } else if (operation == "friendships/create" || operation == "friendships/destroy") { - m_url.setPath(m_url.path()+operation+".json"); - kDebug() << "follow/unfollow: " << m_url; - } else if (operation == "update") { - m_url.setPath(m_url.path()+QString("statuses/%1.xml").arg(operation)); - kDebug() << "Updating status" << m_url; - } else { - m_url.setPath(m_url.path()+operation+".xml"); - } -} - -void TweetJob::start() -{ - kDebug() << "starting job" << m_url; - QByteArray data; - QOAuth::ParamMap params; - - data = "source=kdemicroblog"; - params.insert("source", "kdemicroblog"); - { - QMapIterator i(m_parameters); - while (i.hasNext()) { - i.next(); - if (!i.value().toString().isEmpty()) { - if (i.key() == "status") { - const QByteArray status = i.value().toString().toUtf8().toPercentEncoding(); - params.insert("status", status); - data = data.append("&status=" + status); - } else { - const QByteArray key = i.key().toLatin1(); - const QByteArray value = i.value().toString().toLatin1(); - params.insert(key, value); - data = data.append("&"+key+"="+value); - } - } - } - } - KIO::Job *job = KIO::http_post(m_url, data, KIO::HideProgressInfo); - job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded"); - - m_source->oAuthHelper()->sign(job, m_url.pathOrUrl(), params, KOAuth::POST); - connect(job, SIGNAL(data(KIO::Job*,QByteArray)), - this, SLOT(recv(KIO::Job*,QByteArray))); - connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*))); -} - -void TweetJob::recv(KIO::Job* , const QByteArray& data) -{ - kDebug() << "data " << m_url; - m_data.append(data); -} - -void TweetJob::result(KJob *job) -{ - kDebug() << "job returned " << m_url; - kDebug() << "Job returned... e:" << job->errorText(); - //kDebug() << "Job returned data:" << m_data; - if (m_operation.startsWith("friendships")) { - kDebug() << "emitting userdata"; - emit userData(m_data); - } - setError(job->error()); - setErrorText(job->errorText()); - setResult(!job->error()); - m_data.clear(); -} - - -#include "moc_tweetjob.cpp" - diff --git a/kdeplasma-addons/dataengines/microblog/tweetjob.h b/kdeplasma-addons/dataengines/microblog/tweetjob.h deleted file mode 100644 index 6f088207..00000000 --- a/kdeplasma-addons/dataengines/microblog/tweetjob.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright (C) 2009 Ryan P. Bitanga - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TWEETJOB_H -#define TWEETJOB_H - - -#include - -#include -#include -#include - -// forward declarations -//#include - -class KJob; - -namespace KIO -{ - class Job; -} // namespace KIO - -namespace QCA -{ - class Initializer; -} - -class TimelineSource; -class ImageSource; - -class TweetJob : public Plasma::ServiceJob -{ - Q_OBJECT - -public: - TweetJob(TimelineSource *source, const QString &operation, const QMap ¶meters, QObject *parent = 0); - void start(); - -Q_SIGNALS: - void userData(const QByteArray &data); - -private slots: - void result(KJob *job); - void recv(KIO::Job*, const QByteArray& data); - -private: - KUrl m_url; - QByteArray m_data; - QMap m_parameters; - TimelineSource *m_source; - QString m_operation; -}; - -#endif diff --git a/kdeplasma-addons/dataengines/microblog/twitterengine.cpp b/kdeplasma-addons/dataengines/microblog/twitterengine.cpp deleted file mode 100644 index b0441ea9..00000000 --- a/kdeplasma-addons/dataengines/microblog/twitterengine.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (C) 2007 Trever Fischer - * Copyright (C) 2007 André Duffeck - * Copyright (C) 2007 Chani Armitage - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License version 2 as - * published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "twitterengine.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include "timelinesource.h" -#include "imagesource.h" -#include "koauth.h" -#include "usersource.h" - -const QString TwitterEngine::timelinePrefix("Timeline:"); -const QString TwitterEngine::timelineWithFriendsPrefix("TimelineWithFriends:"); -const QString TwitterEngine::searchTimelinePrefix("SearchTimeline:"); -const QString TwitterEngine::customTimelinePrefix("CustomTimeline:"); -const QString TwitterEngine::profilePrefix("Profile:"); -const QString TwitterEngine::repliesPrefix("Replies:"); -const QString TwitterEngine::statusPrefix("Status:"); -const QString TwitterEngine::messagesPrefix("Messages:"); -const QString TwitterEngine::userPrefix("User:"); - -TwitterEngine::TwitterEngine(QObject* parent, const QVariantList& args) - : Plasma::DataEngine(parent, args) -{ - //setMinimumPollingInterval(2 * 60 * 1000); // 2 minutes minimum - - setData("Defaults", "UserImage", KIcon ("user-identity").pixmap(48, 48).toImage()); -} - -TwitterEngine::~TwitterEngine() -{ -} - -bool TwitterEngine::sourceRequestEvent(const QString &name) -{ -// kDebug() << name; - if (name.startsWith("UserImages:")) { - // these are updated by the engine itself, not consumers - return true; - } - if (name.startsWith(statusPrefix)) { - kDebug() << "!!!!! Status source : " << name; - setData(name, "Authorization", "Idle"); - setData(name, "AuthorizationMessage", QString()); - scheduleSourcesUpdated(); - return true; - } - if (name == "Accounts") { - return updateAccounts(); - } - if (!name.startsWith(timelinePrefix) && !name.startsWith(timelineWithFriendsPrefix) - && !name.startsWith(customTimelinePrefix) && !name.startsWith(searchTimelinePrefix) - && !name.startsWith(profilePrefix) && !name.startsWith(repliesPrefix) - && !name.startsWith(messagesPrefix) && !name.startsWith(userPrefix) - && !name.startsWith(statusPrefix)) { - return false; - } - - updateSourceEvent(name); //start a download - return true; -} - -Plasma::Service* TwitterEngine::serviceForSource(const QString &name) -{ - TimelineSource *source = dynamic_cast(containerForSource(name)); - if (!source) { - kWarning() << "service for non-timeline source requested." << name << sources(); - return Plasma::DataEngine::serviceForSource(name); - } - - Plasma::Service *service = source->createService(); - service->setParent(this); - connect(service, SIGNAL(finished(Plasma::ServiceJob *)), this, SLOT(serviceJobFinished(Plasma::ServiceJob *))); - - return service; -} - -void TwitterEngine::serviceJobFinished(Plasma::ServiceJob* job) -{ - kDebug() << "Service Job Done." << job->operationName() << job->result(); -} - -bool TwitterEngine::updateSourceEvent(const QString &name) -{ - //right now it only makes sense to do an update on timelines - // FIXME: needed? - if (!name.startsWith(timelinePrefix) && !name.startsWith(timelineWithFriendsPrefix) - && !name.startsWith(customTimelinePrefix) && !name.startsWith(searchTimelinePrefix) - && !name.startsWith(profilePrefix) && !name.startsWith(repliesPrefix) - && !name.startsWith(messagesPrefix) && !name.startsWith(userPrefix) - && !name.startsWith(statusPrefix)) { - return false; - } - - TimelineSource::RequestType requestType; - - QString who = name; - if (name.startsWith(timelineWithFriendsPrefix)) { - requestType = TimelineSource::TimelineWithFriends; - who.remove(timelineWithFriendsPrefix); - } else if (name.startsWith(profilePrefix)) { - requestType = TimelineSource::Profile; - who.remove(profilePrefix); - } else if (name.startsWith(repliesPrefix)) { - requestType = TimelineSource::Replies; - who.remove(repliesPrefix); - } else if (name.startsWith(messagesPrefix)) { - requestType = TimelineSource::DirectMessages; - who.remove(messagesPrefix); - } else if (name.startsWith(userPrefix)) { - requestType = TimelineSource::User; - who.remove(userPrefix); - } else if (name.startsWith(customTimelinePrefix)) { - requestType = TimelineSource::CustomTimeline; - who.remove(customTimelinePrefix); - } else if (name.startsWith(searchTimelinePrefix)) { - requestType = TimelineSource::SearchTimeline; - who.remove(searchTimelinePrefix); - //kDebug() << "Search Timeline requested: " << who; - } else { - requestType = TimelineSource::Timeline; - who.remove(timelinePrefix); - } - //we want just the service url to index the UserImages source - QString serviceBaseUrl; - QStringList account = who.split('@'); - const QString user = account.at(0); - QString parameter; - if (account.count() == 2) { - QStringList sbu = account.at(1).split(':'); - if (sbu.count() >= 2) { - serviceBaseUrl = sbu.at(0) + ':' + sbu.at(1); // http + urlpart - if (sbu.count() > 2) { - parameter = sbu.at(2); - } - } - } else { - kWarning() << "service not found. Please request a source such as \"TimelineWithFriends:UserName@ServiceUrl\""; - serviceBaseUrl = "https://api.twitter.com/1/"; - kWarning() << " Using " << serviceBaseUrl << " instead."; - } - if (name.startsWith(statusPrefix)) { - authorizationStatusUpdated(user, serviceBaseUrl, "Idle"); - return true; - - } - ImageSource *imageSource = dynamic_cast(containerForSource("UserImages:"+serviceBaseUrl)); - - if (!imageSource) { - imageSource = new ImageSource(this); - connect(imageSource, SIGNAL(dataChanged()), SLOT(imageDataChanged())); - imageSource->setStorageEnabled(true); - imageSource->setObjectName("UserImages:"+serviceBaseUrl); - addSource(imageSource); - } - - KOAuth::KOAuth *authHelper = addAuthHelper(user, serviceBaseUrl); - - if (requestType == TimelineSource::User) { - newUserSource(user, serviceBaseUrl); - } else { - TimelineSource *source = dynamic_cast(containerForSource(name)); - - if (!source) { - if (user.isEmpty()) { - return false; - } - source = new TimelineSource(serviceBaseUrl, requestType, authHelper, QStringList() << parameter, this); - connect(source, SIGNAL(authorize(const QString&, const QString&, const QString&)), - authHelper, SLOT(authorize(const QString&, const QString&, const QString&))); - connect(source, SIGNAL(userFound(const QVariant&, const QString&)), - this, SLOT(addUserSource(const QVariant&, const QString&))); - connect(source, SIGNAL(accountRemoved(const QString&)), SLOT(updateAccounts(const QString&))); - connect(source, SIGNAL(userData(const QByteArray&)), this, SIGNAL(userData(const QByteArray&))); - source->setObjectName(name); - source->setImageSource(imageSource); - source->setStorageEnabled(true); - - addSource(source); - } - source->update(); - } - return false; -} - -bool TwitterEngine::updateAccounts(const QString &removed) -{ - if (sources().contains("Status:" + removed)) { - setData("Status:" + removed, "Authorization", "Idle"); - setData("Status:" + removed, "AuthorizationMessage", i18n("Account forgotten")); - } - if (!sources().contains("Accounts")) { - //return true; - } - - foreach (const QString &grp, KOAuth::KOAuth::authorizedAccounts()) { - if (grp == removed) { - continue; - } - QVariantMap vm; - QStringList l = grp.split('@'); - if (l.count() < 2) { - continue; - } - - const QString user = l[0]; - const QString serviceBaseUrl = l[1]; - vm["accountUser"] = user; - vm["accountService"] = serviceBaseUrl; - vm["accountIdentifier"] = grp; - setData("Accounts", grp, vm); - QVariantMap m; - m["screen_name"] = user; - - addAuthHelper(user, serviceBaseUrl); - newUserSource(user, serviceBaseUrl); - } - scheduleSourcesUpdated(); - return true; -} - - -UserSource* TwitterEngine::newUserSource(const QString userName, const QString serviceBaseUrl) -{ - const QString name = userPrefix+userName+'@'+serviceBaseUrl; - UserSource *source = dynamic_cast(containerForSource(name)); - - if (!source && !userName.isEmpty()) { - source = new UserSource(userName, serviceBaseUrl, this); - source->setObjectName(name); - source->setStorageEnabled(true); - connect(this, SIGNAL(userData(const QByteArray&)), source, SLOT(parse(const QByteArray&))); - ImageSource *imageSource = dynamic_cast(containerForSource("UserImages:"+serviceBaseUrl)); - - if (!imageSource) { - imageSource = new ImageSource(this); - connect(imageSource, SIGNAL(dataChanged()), SLOT(imageDataChanged())); - imageSource->setStorageEnabled(true); - imageSource->setObjectName("UserImages:"+serviceBaseUrl); - addSource(imageSource); - } - - connect(source, SIGNAL(loadImage(const QString&, const KUrl&)), - imageSource, SLOT(loadImage(const QString&, const KUrl&))); - source->loadUserInfo(userName, serviceBaseUrl); - - if (imageSource) { - imageSource->loadImage(userName); - } - addSource(source); - } - return source; -} - -void TwitterEngine::addUserSource(const QVariant& userData, const QString &serviceBaseUrl) -{ - const QVariantMap m = userData.toMap(); - const QString screen_name = m["screen_name"].toString(); - const QString _s = "User:" + screen_name + "@" + serviceBaseUrl; - if (sources().contains(_s)) { - return; - } - - UserSource *source = new UserSource(screen_name, serviceBaseUrl, this); - source->setObjectName(_s); - source->setStorageEnabled(true); - source->parseJson(userData); - addSource(source); -} - -KOAuth::KOAuth* TwitterEngine::addAuthHelper(const QString& userName, const QString& serviceBaseUrl) -{ - KOAuth::KOAuth *authHelper = 0; - if (!m_authHelper.contains(serviceBaseUrl)) { - authorizationStatusUpdated(userName, serviceBaseUrl, "Idle"); - authHelper = new KOAuth::KOAuth(this); - authHelper->init(); - authHelper->setUser(userName); - authHelper->setServiceBaseUrl(serviceBaseUrl); - m_authHelper[serviceBaseUrl] = authHelper; - - connect(authHelper, SIGNAL(accessTokenReceived(const QString&, const QString&, const QString&, const QString&)), - this, SLOT(accessTokenReceived(const QString&, const QString&, const QString&, const QString&))); - connect(authHelper, SIGNAL(statusUpdated(const QString&, const QString&, const QString&, const QString&)), - SLOT(authorizationStatusUpdated(const QString&, const QString&, const QString&, const QString&))); - // Run start() instead of run() here to move to another thread. - // as we can't share pixmap, this won't work using an invisible webkit - //authHelper->start(); - authHelper->run(); - updateSourceEvent(userPrefix + userName + "@" + serviceBaseUrl); - } else { - authHelper = m_authHelper[serviceBaseUrl]; - - // FIXME: why oh why is this necessary? It seems authHelper lost the user name here - // timelines won't be loaded without this, anyway. - if (!userName.isEmpty()) { - authHelper->setUser(userName); - authHelper->setServiceBaseUrl(serviceBaseUrl); - if (authHelper->isAuthorized()) { - authorizationStatusUpdated(userName, serviceBaseUrl, "Ok"); - } - } - } - return authHelper; -} - - -void TwitterEngine::authorizationStatusUpdated(const QString &user, const QString& serviceBaseUrl, const QString& status, const QString &message) -{ - const QString src = "Status:" + user + "@" + serviceBaseUrl; - setData(src, "AuthorizationMessage", message); - setData(src, "Authorization", status); - //kDebug() << "Set status to " << status << "for" << src; - scheduleSourcesUpdated(); -} - -void TwitterEngine::accessTokenReceived(const QString &user, const QString& serviceBaseUrl, const QString& accessToken, const QString& accessTokenSecret) -{ - Q_UNUSED(accessToken); - Q_UNUSED(accessTokenSecret); - authorizationStatusUpdated(user, serviceBaseUrl, "Ok"); -} - -void TwitterEngine::imageDataChanged() -{ - scheduleSourcesUpdated(); -} - - -#include "moc_twitterengine.cpp" diff --git a/kdeplasma-addons/dataengines/microblog/twitterengine.h b/kdeplasma-addons/dataengines/microblog/twitterengine.h deleted file mode 100644 index aff22adb..00000000 --- a/kdeplasma-addons/dataengines/microblog/twitterengine.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2007 Trever Fischer - * Copyright (C) 2007 André Duffeck - * Copyright (C) 2007 Chani Armitage - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License version 2 as - * published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TWITTERENGINE_H -#define TWITTERENGINE_H - -#include - - -class ImageSource; -class UserSource; -namespace KOAuth { class KOAuth; } -class KWebView; -class KDialog; - -/** - * Twitter Data Engine - * - * This engine provides access to twitter.com timelines. - * There are two types of timeline you can connect to: - * Timeline: - * TimelineWithFriends: - * - * Timeline: shows only the tweets of that user. it currently requires a password. - * TimelineWithFriends: shows the normal timeline of that user and their - * friends. it requires a password to be configured for the user. - * - * To configure a password, use setConfig(user, password). - * - * For each source you connect to, you should also connect to Error: to see http errors. - * You should also connect to the Error source for general errors. - * - * If you need to display user images, the UserImages source provides a list of - * all images, and LatestImage provides just the most recently downloaded one. - **/ -class TwitterEngine : public Plasma::DataEngine -{ - Q_OBJECT - - public: - TwitterEngine(QObject* parent, const QVariantList& args); - ~TwitterEngine(); - - Plasma::Service* serviceForSource(const QString &name); - - Q_SIGNALS: - void appAuthSucceeded(const QString &authorizeUrl, const QString &verifier); - void userData(const QByteArray&); - - protected: - //from DataEngine - bool sourceRequestEvent(const QString &name); - - protected Q_SLOTS: - bool updateSourceEvent(const QString &name); - - private Q_SLOTS: - void imageDataChanged(); - bool updateAccounts(const QString &removed = QString()); -// void appAuthorized(); -// void authorizeApp(const QString &serviceBaseUrl, const QString &authorizeUrl, const QString &pageUrl); - void addUserSource(const QVariant &userData, const QString &serviceBaseUrl); - void accessTokenReceived(const QString &user, const QString &serviceBaseUrl, const QString &accessToken, const QString &accessTokenSecret); - void authorizationStatusUpdated(const QString &user, const QString &serviceBaseUrl, const QString &status, const QString &message = QString()); - void serviceJobFinished(Plasma::ServiceJob *job); - KOAuth::KOAuth* addAuthHelper(const QString &userName, const QString &serviceBaseUrl); - UserSource* newUserSource(const QString userName, const QString serviceBaseUrl); - - private: - static const QString timelinePrefix; - static const QString timelineWithFriendsPrefix; - static const QString customTimelinePrefix; - static const QString searchTimelinePrefix; - static const QString profilePrefix; - static const QString repliesPrefix; - static const QString statusPrefix; - static const QString messagesPrefix; - static const QString userPrefix; - ImageSource *m_imageSource; - - QHash m_authHelper; - QHash m_serviceBaseUrl; - //QStringList m_authorizeUrls; -}; - -K_EXPORT_PLASMA_DATAENGINE(twitter, TwitterEngine) - -#endif diff --git a/kdeplasma-addons/dataengines/microblog/usersource.cpp b/kdeplasma-addons/dataengines/microblog/usersource.cpp deleted file mode 100644 index c0a7ec3a..00000000 --- a/kdeplasma-addons/dataengines/microblog/usersource.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "usersource.h" - - -#include - -#include -#include - -class UserSourcePrivate { - -public: - UserSourcePrivate() - { - } - - QString user; - QString serviceBaseUrl; -}; - -UserSource::UserSource(const QString &who, const QString &serviceBaseUrl, QObject* parent) - : Plasma::DataContainer(parent), - m_user(who), - m_serviceBaseUrl(serviceBaseUrl) -{ - d = new UserSourcePrivate(); - d->user = who; - d->serviceBaseUrl = serviceBaseUrl; - setObjectName(QLatin1String("User")); - //emit loadImage(who, KUrl()); -} - -UserSource::~UserSource() -{ -} - -void UserSource::loadUserInfo(const QString &who, const QString &serviceBaseUrl) -{ - if (who.isEmpty() || serviceBaseUrl.isEmpty()) { - return; - } - - QString _s = serviceBaseUrl; - if (!_s.endsWith('/')) { - _s.append('/'); - } - //const QString u = _s + "users/show/" + who + ".xml"; - const QString u = _s + "users/show/" + who + ".json"; - if (m_currentUrl == u) { - return; - } - m_currentUrl = u; -// kDebug() << "Requesting user info for " << who << " from ... " << u; - //return; - //m_runningJobs++; -// kDebug() << "NEW JOB." << who << u; - KIO::Job *job = KIO::get(u, KIO::NoReload, KIO::HideProgressInfo); - job->setAutoDelete(true); - m_jobs[job] = who; - connect(job, SIGNAL(data(KIO::Job*,QByteArray)), - this, SLOT(recv(KIO::Job*,QByteArray))); - connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*))); -} - -void UserSource::recv(KIO::Job* job, const QByteArray& data) -{ - KIO::TransferJob* kiojob = dynamic_cast(job); - if (kiojob->url().pathOrUrl() == m_currentUrl) { - // Only consider the last job started, discard others. - m_xml += data; - } else { - kDebug() << "Discarding data of job" << kiojob->url().pathOrUrl(); - } -} - -void UserSource::result(KJob *job) -{ - if (!m_jobs.contains(job)) { - return; - } -// kDebug() << "job returned" << m_currentUrl; - KIO::TransferJob* kiojob = dynamic_cast(job); - //const QString cacheKey = who + "@" + kiojob->url().pathOrUrl(); - if (kiojob->url().pathOrUrl() == m_currentUrl) { - // Only consider the last job started, discard others. - if (job->error()) { - // TODO: error handling - } else { - if (kiojob->url().pathOrUrl().contains(".json")) { - //kDebug() << "parseJson ..." << m_xml; - parse(m_xml); - } else { -// QXmlStreamReader reader(m_xml); -// parse(reader); - } - checkForUpdate(); - m_xml.clear(); - } - } else { - kDebug() << "Discarding results of job" << kiojob->url().pathOrUrl() << m_currentUrl; - } - m_jobs.remove(job); - m_jobData.remove(job); - checkForUpdate(); -} - -void UserSource::parse(const QByteArray& jsonData) -{ -// kDebug() << "User parse()" << jsonData; - QJson::Parser parser; - //const QVariantList resultsList = parser.parse(data).toList(); - const QVariant &user = parser.parse(jsonData); - parseJson(user); -} - -void UserSource::parseJson(const QVariant &data) -{ - const QVariantMap &user = data.toMap(); - foreach (const QVariant &k, user.keys()) { - const QString _k = k.toString(); - // Exclude last status update for now, would be a QVariantMap though - if (_k != "status") { - setData(k.toString(), user[_k]); - } - } - - // compatibility with old API - setData("User", user["screen_name"]); - if (user["name"].toString().isEmpty()) { - kDebug() << "empty real name" << user["screen_name"].toString() << user; - setData("realName", user["screen_name"]); - - } else { - setData("realName", user["name"]); -// kDebug() << " user: " << user["name"].toString(); - - } - const QString imgUrl = user["profile_image_url"].toString(); - const QString userName = user["screen_name"].toString(); - setData("ImageUrl", imgUrl); - if (!imgUrl.isEmpty()) { -// kDebug() << "Got image url for: " << userName << imgUrl; - emit loadImage(userName, KUrl(imgUrl)); - } - checkForUpdate(); -} - -void UserSource::parseJsonStatus(const QVariant& data) -{ - Q_UNUSED(data); -} - - -#include "moc_usersource.cpp" - diff --git a/kdeplasma-addons/dataengines/microblog/usersource.h b/kdeplasma-addons/dataengines/microblog/usersource.h deleted file mode 100644 index 8536d78c..00000000 --- a/kdeplasma-addons/dataengines/microblog/usersource.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008 Aaron Seigo - * Copyright 2012 Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef USERSOURCE_H -#define USERSOURCE_H - -#include -#include -#include - -#include - -#include - -// forward declarations -class KJob; - -namespace KIO -{ - class Job; -} // namespace KIO - -class UserSourcePrivate; - -class UserSource : public Plasma::DataContainer -{ -Q_OBJECT - -public: - UserSource(const QString &who, const QString &serviceBaseUrl, QObject* parent); - ~UserSource(); - - void loadUserInfo(const QString &who, const QString &serviceBaseUrl); - void parseJson(const QVariant &data); - -public Q_SLOTS: - void parse(const QByteArray &jsonData); - -Q_SIGNALS: - void dataChanged(); - void loadImage(const QString &who, const KUrl&); - -private Q_SLOTS: - void recv(KIO::Job*, const QByteArray& data); - void result(KJob*); - -private: - void parseJsonStatus(const QVariant &data); - void parse(QXmlStreamReader &reader); - void readUser(QXmlStreamReader &reader); - - UserSourcePrivate* d; - - QString m_user; - QString m_serviceBaseUrl; - QByteArray m_xml; - QHash m_jobs; - QHash m_jobData; - int m_runningJobs; - QList > m_queuedJobs; - Plasma::DataEngine::Data m_cachedData; - QString m_currentUrl; -}; - -#endif - diff --git a/kdeplasma-addons/dataengines/potd/CMakeLists.txt b/kdeplasma-addons/dataengines/potd/CMakeLists.txt index 5174c31c..677c1a0c 100644 --- a/kdeplasma-addons/dataengines/potd/CMakeLists.txt +++ b/kdeplasma-addons/dataengines/potd/CMakeLists.txt @@ -45,17 +45,6 @@ target_link_libraries( plasma_potd_apodprovider plasmapotdprovidercore ${KDE4_KI install( TARGETS plasma_potd_apodprovider DESTINATION ${PLUGIN_INSTALL_DIR} ) install( FILES apodprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -set( potd_natgeo_provider_SRCS - natgeoprovider.cpp -) - -if(QT_QTWEBKIT_FOUND) - kde4_add_plugin( plasma_potd_natgeoprovider ${potd_natgeo_provider_SRCS} ) - target_link_libraries( plasma_potd_natgeoprovider plasmapotdprovidercore ${KDE4_KIO_LIBS} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KDEWEBKIT_LIBRARY}) - install( TARGETS plasma_potd_natgeoprovider DESTINATION ${PLUGIN_INSTALL_DIR} ) - install( FILES natgeoprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -endif() - set( potd_epod_provider_SRCS epodprovider.cpp ) diff --git a/kdeplasma-addons/dataengines/potd/natgeoprovider.cpp b/kdeplasma-addons/dataengines/potd/natgeoprovider.cpp deleted file mode 100644 index cb5ddb29..00000000 --- a/kdeplasma-addons/dataengines/potd/natgeoprovider.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2007 Tobias Koenig - * Copyright 2008 Anne-Marie Mahfouf - * Copyright 2013 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "natgeoprovider.h" - -#include -#include - -#include -#include - -#include -#include -#include -#include - -POTDPROVIDER_EXPORT_PLUGIN( NatGeoProvider, "NatGeoProvider", "" ) - -class NatGeoProvider::Private -{ - public: - Private( NatGeoProvider *parent ) - : mParent( parent ), - mPage( new KWebPage( parent, KWebPage::KIOIntegration ) ) - { - } - - void pageRequestFinished( bool ok ); - void imageRequestFinished( KJob* ); - void parsePage(); - - NatGeoProvider *mParent; - QImage mImage; - KWebPage *mPage; -}; - -void NatGeoProvider::Private::pageRequestFinished( bool ok ) -{ - if ( !ok ) { - emit mParent->error( mParent ); - return; - } - - QWebElementCollection links = mPage->mainFrame()->documentElement().findAll( QLatin1String( "div.download_link a" ) ); - if ( links.count() < 1 ) { - emit mParent->error( mParent ); - return; - } - - const QString url = links.at(0).attribute( QLatin1String( "href" ) ); - if (url.isEmpty()) { - emit mParent->error( mParent ); - return; - } - - - KIO::StoredTransferJob *imageJob = KIO::storedGet( url, KIO::NoReload, KIO::HideProgressInfo ); - mParent->connect( imageJob, SIGNAL(finished(KJob*)), SLOT(imageRequestFinished(KJob*)) ); -} - -void NatGeoProvider::Private::imageRequestFinished( KJob *_job ) -{ - KIO::StoredTransferJob *job = static_cast( _job ); - if ( job->error() ) { - emit mParent->error( mParent ); - return; - } - - mImage = QImage::fromData( job->data() ); - emit mParent->finished( mParent ); -} - -NatGeoProvider::NatGeoProvider( QObject *parent, const QVariantList &args ) - : PotdProvider( parent, args ), d( new Private( this ) ) -{ - const QUrl url( QLatin1String( "http://photography.nationalgeographic.com/photography/photo-of-the-day" ) ); - connect( d->mPage, SIGNAL(loadFinished(bool)), this, SLOT(pageRequestFinished(bool)) ); - d->mPage->mainFrame()->setUrl( url ); -} - -NatGeoProvider::~NatGeoProvider() -{ - delete d; -} - -QImage NatGeoProvider::image() const -{ - return d->mImage; -} - -#include "moc_natgeoprovider.cpp" diff --git a/kdeplasma-addons/dataengines/potd/natgeoprovider.desktop b/kdeplasma-addons/dataengines/potd/natgeoprovider.desktop deleted file mode 100644 index a727150b..00000000 --- a/kdeplasma-addons/dataengines/potd/natgeoprovider.desktop +++ /dev/null @@ -1,46 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=PlasmaPoTD/Plugin -X-KDE-Library=plasma_potd_natgeoprovider -X-KDE-PlasmaPoTDProvider-Identifier=natgeo -Icon= - -Name=National Geographic -Name[ar]=ناشونال جيوجرافيك -Name[bs]=National Geographic -Name[ca]=National Geographic -Name[ca@valencia]=National Geographic -Name[cs]=National Geographic -Name[da]=National Geographic -Name[de]=National Geographic -Name[el]=National Geographic -Name[en_GB]=National Geographic -Name[es]=National Geographic -Name[et]=National Geographic -Name[fi]=National Geographic -Name[fr]=National Geographic -Name[gl]=National Geographic -Name[hu]=National Geographic -Name[it]=National Geographic -Name[kk]=National Geographic -Name[ko]=내셔널 지오그래픽 -Name[nb]=National Geographic -Name[nds]=National Geographic -Name[nl]=National Geographic -Name[pl]=National Geographic -Name[pt]=National Geographic -Name[pt_BR]=National Geographic -Name[ro]=National Geographic -Name[ru]=National Geographic -Name[sk]=National Geographic -Name[sl]=National Geographic -Name[sr]=Нешонал џиографик -Name[sr@ijekavian]=Нешонал џиографик -Name[sr@ijekavianlatin]=National Geographic -Name[sr@latin]=National Geographic -Name[sv]=National Geographic -Name[tr]=National Geographic -Name[uk]=National Geographic -Name[x-test]=xxNational Geographicxx -Name[zh_CN]=国家地理 -Name[zh_TW]=國家地理頻道 diff --git a/kdeplasma-addons/dataengines/potd/natgeoprovider.h b/kdeplasma-addons/dataengines/potd/natgeoprovider.h deleted file mode 100644 index 4ce839b6..00000000 --- a/kdeplasma-addons/dataengines/potd/natgeoprovider.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2007 Tobias Koenig - * Copyright 2008 Anne-Marie Mahfouf - * Copyright 2013 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef NATGEOPROVIDER_H -#define NATGEOPROVIDER_H - -#include "potdprovider.h" - -/** - * This class provides the image for APOD - * "Astronomy Picture Of the Day" - * located at http://antwrp.gsfc.nasa.gov/apod. - * Direct link to the picture of the day page is - * http://antwrp.gsfc.nasa.gov/apod/apYYMMDD.html - * where YY is the year last 2 digits, - * MM is the month and DD the day, in 2 digits. - */ -class NatGeoProvider : public PotdProvider -{ - Q_OBJECT - - public: - /** - * Creates a new APOD provider. - * - * @param date The date for which the image shall be fetched. - * @param parent The parent object. - */ - NatGeoProvider( QObject *parent, const QVariantList &args ); - - /** - * Destroys the APOD provider. - */ - ~NatGeoProvider(); - - /** - * Returns the requested image. - * - * Note: This method returns only a valid image after the - * finished() signal has been emitted. - */ - virtual QImage image() const; - - private: - class Private; - Private* const d; - - Q_PRIVATE_SLOT( d, void pageRequestFinished( bool ) ) - Q_PRIVATE_SLOT( d, void imageRequestFinished( KJob* ) ) -}; - -#endif diff --git a/kdeplasma-addons/dataengines/rememberthemilk/CMakeLists.txt b/kdeplasma-addons/dataengines/rememberthemilk/CMakeLists.txt deleted file mode 100644 index 5c353b1a..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -project(plasma-engine-rtm) - -#find_package(RTM REQUIRED) # Will be needed again later -set(RTM_LIBRARY rtm) - -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${KDE4_INCLUDES} - #${RTM_INCLUDE_DIR} - ) - -set(rtm_engine_SRCS - rtmengine.cpp - - taskssource.cpp - listssource.cpp - tasksource.cpp - listsource.cpp - - authservice.cpp - tasksservice.cpp - taskservice.cpp - ) - -kde4_add_plugin(plasma_engine_rtm ${rtm_engine_SRCS}) -target_link_libraries(plasma_engine_rtm - ${KDE4_KDECORE_LIBS} - ${KDE4_PLASMA_LIBS} - ${QT_QTNETWORK_LIBRARY} - ${RTM_LIBRARY}) - -install(TARGETS plasma_engine_rtm - DESTINATION ${PLUGIN_INSTALL_DIR}) - -install(FILES plasma-engine-rtm.desktop - DESTINATION ${SERVICES_INSTALL_DIR}) - -install(FILES rtmauth.operations rtmtasks.operations rtmtask.operations - DESTINATION ${DATA_INSTALL_DIR}/plasma/services) diff --git a/kdeplasma-addons/dataengines/rememberthemilk/authservice.cpp b/kdeplasma-addons/dataengines/rememberthemilk/authservice.cpp deleted file mode 100644 index cb7e3186..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/authservice.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "authservice.h" - -#include -#include - -AuthService::AuthService(RTM::Session* session, QObject* parent) - : Plasma::Service(parent) -{ - m_session = session; - setName("rtmauth"); - setOperationEnabled("Login", true); - setOperationEnabled("AuthWithToken", true); -} - -Plasma::ServiceJob* AuthService::createJob(const QString& operation, QMap< QString, QVariant >& parameters) { - kDebug() << "Creating Job"; - return new AuthJob(m_session, operation, parameters, this); -} - - -AuthJob::AuthJob(RTM::Session* session, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent) - : Plasma::ServiceJob("Auth", operation, parameters, parent), - m_session(session) -{ - connect(m_session, SIGNAL(tokenCheck(bool)), SLOT(tokenReply(bool))); - kDebug() << m_session; - autoRetry = 0; -} - -void AuthJob::start() { - //FIXME: error handling? - if (operationName() == "StartLogin") { - setResult(m_session->getAuthUrl()); - this->deleteLater(); - } - else if (operationName() == "Login") { - m_session->continueAuthForToken(); - } - else if (operationName() == "AuthWithToken") { - m_session->setToken(parameters().value("token").toString()); - } -} - -void AuthJob::tokenReply(bool tokenValid) { - if (!tokenValid) { - if (autoRetry < 5) { - kDebug() << "Auto-retry" << autoRetry; - QTimer::singleShot(10*1000, this, SLOT(start())); - autoRetry++; - return; - } else { - setError(true); - setResult("TokenInvalid"); - } - } else { - setError(false); - setResult("TokenValid"); - } - this->deleteLater(); -} - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/authservice.h b/kdeplasma-addons/dataengines/rememberthemilk/authservice.h deleted file mode 100644 index dab1728d..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/authservice.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef AUTHSERVICE_H -#define AUTHSERVICE_H - -#include -#include -#include - -namespace RTM { - class Session; -} - -class TaskSource; - -class AuthService : public Plasma::Service -{ -public: - AuthService(RTM::Session *session, QObject* parent); -protected: - virtual Plasma::ServiceJob* createJob(const QString& operation, QMap< QString, QVariant >& parameters); - TaskSource* m_source; - RTM::Session* m_session; -}; - -class AuthJob : public Plasma::ServiceJob -{ - Q_OBJECT -public: - AuthJob(RTM::Session* session, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent); - -public slots: - void start(); - -signals: - void authUrlReady(QString url); - -private slots: - void tokenReply(bool tokenValid); - -protected: - RTM::Session* m_session; - int autoRetry; -}; - -#endif // AUTHSERVICE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/listsource.cpp b/kdeplasma-addons/dataengines/rememberthemilk/listsource.cpp deleted file mode 100644 index 8483b0e5..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/listsource.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "listsource.h" -#include -#include - -ListSource::ListSource(RTM::ListId i, RTM::Session *s, QObject* parent) - : DataContainer(parent), - id(i), - session(s), - list(0) -{ - connect(this, SIGNAL(updateRequested(DataContainer*)), SLOT(updateRequest(DataContainer*))); - setObjectName("List:" + QString::number(i)); - update(); -} - -ListSource::~ListSource() { - -} - - -void ListSource::updateRequest(Plasma::DataContainer* source) { - if (source == this) - update(); -} - -void ListSource::update() { - if (!list) { - list = session->listFromId(id); - if (!list) - return; - } - - removeAllData(); - - setData("name", list->name()); - setData("id", list->id()); - setData("smart", list->isSmart()); - setData("filter", list->filter()); - - foreach(RTM::Task *task, list->tasks()) - setData(QString::number(task->id()), task->name()); - - checkForUpdate(); -} - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/listsource.h b/kdeplasma-addons/dataengines/rememberthemilk/listsource.h deleted file mode 100644 index 803ec566..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/listsource.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef LISTSOURCE_H -#define LISTSOURCE_H - -#include - -#include - -class ListSource : public Plasma::DataContainer -{ -Q_OBJECT -public: - ListSource(RTM::ListId id, RTM::Session* session, QObject* parent); - ~ListSource(); - -public slots: - void updateRequest(DataContainer *source); - void update(); - -private: - RTM::ListId id; - RTM::Session *session; - RTM::List *list; -}; - -#endif // LISTSOURCE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/listssource.cpp b/kdeplasma-addons/dataengines/rememberthemilk/listssource.cpp deleted file mode 100644 index 84c7b541..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/listssource.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "listssource.h" - -#include -#include -#include - -#include -#include - -#include "rtmengine.h" - -ListsSource::ListsSource(RtmEngine* engine, RTM::Session* session) - : Plasma::DataContainer(engine), - m_engine(engine), - m_session(session) -{ - // Session should be an authenticated RTM Session. - connect(session, SIGNAL(listsChanged()), this, SLOT(listsChanged())); - connect(session, SIGNAL(listChanged(RTM::List*)), this, SLOT(listChanged(RTM::List*))); - connect(&timer, SIGNAL(timeout()), this, SLOT(refresh())); - timer.setInterval(1000*60*5); // 5 minute refresh. TODO: Make Configurable. - timer.start(); - setObjectName("Lists"); - loadCache(); -} - -ListsSource::~ListsSource() -{ -} - -ListSource* ListsSource::setupListSource(const QString& source) { - QString id = source; - ListSource *listsource = new ListSource(id.remove("List:").toLongLong(), m_session, this); - return listsource; -} - -void ListsSource::refresh() -{ - kDebug() << "Updating Lists"; - if (!m_session->authenticated()) - return; // We can't do anything with a non-authenticated session - m_session->refreshListsFromServer(); -} - -void ListsSource::listChanged(RTM::List* list) { - setData(QString::number(list->id()), list->name()); - m_engine->updateListSource(QString::number(list->id())); -} - - -void ListsSource::listsChanged() { - removeAllData(); - loadCache(); - - checkForUpdate(); -} - -void ListsSource::loadCache() { - foreach(RTM::List *list, m_session->cachedLists()) { - setData(QString::number(list->id()), list->name()); - } -} - -#include "moc_listssource.cpp" diff --git a/kdeplasma-addons/dataengines/rememberthemilk/listssource.h b/kdeplasma-addons/dataengines/rememberthemilk/listssource.h deleted file mode 100644 index 29bbc008..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/listssource.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef LISTSSOURCE_H -#define LISTSSOURCE_H - -#include - -#include - -#include -#include -#include - -#include "listsource.h" - -class RtmEngine; - -class ListsSource : public Plasma::DataContainer -{ -Q_OBJECT - -public: - ListsSource(RtmEngine* engine, RTM::Session *session); - ~ListsSource(); - - ListSource* setupListSource(const QString& source); - -public slots: - void refresh(); - -private slots: - void listsChanged(); - void listChanged(RTM::List*); - void loadCache(); - -private: - RtmEngine *m_engine; - RTM::Session *m_session; - QTimer timer; -}; - -#endif diff --git a/kdeplasma-addons/dataengines/rememberthemilk/plasma-engine-rtm.desktop b/kdeplasma-addons/dataengines/rememberthemilk/plasma-engine-rtm.desktop deleted file mode 100644 index 10a5499a..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/plasma-engine-rtm.desktop +++ /dev/null @@ -1,116 +0,0 @@ -[Desktop Entry] -Name=Remember The Milk Engine -Name[ar]=محرك Remember The Milk -Name[ast]=Motor de Remember The Milk -Name[bs]=Pogon "Sjeti se mlijeka" -Name[ca]=Motor per «Remember The Milk» -Name[ca@valencia]=Motor per «Remember The Milk» -Name[cs]=Nástroj Remember The Milk -Name[da]=Remember The Milk-motor -Name[de]=„Remember The Milk“-Datentreiber -Name[el]=Μηχανή Remember The Milk -Name[en_GB]=Remember The Milk Engine -Name[es]=Motor de Remember The Milk -Name[et]=Remember The Milk mootor -Name[fi]=Remember the Milk -moottori -Name[fr]=Moteur de « Remember The Milk » -Name[ga]=Inneall Remember The Milk -Name[gl]=Motor de «Acórdate do leite» -Name[hr]=Mehanizam za Remember The Milk -Name[hu]=Remember The Milk szolgáltatás -Name[is]='Muna eftir mjólkinni' vél -Name[it]=Motore Remember The Milk -Name[ja]=Remember The Milk エンジン -Name[kk]=Remember The Milk тетігі -Name[km]=ចងចាំ​ម៉ាស៊ីន Milk -Name[ko]=Remember The Milk 엔진 -Name[lt]=Prisimink pieną varikliukas -Name[lv]=Remember The Milk dzinējs -Name[mr]=दूध लक्षात ठेवा इंजिन -Name[nb]=Motor for Husk melk -Name[nds]=Dor-An-Denken-Karn -Name[nl]=Engine voor The Milk onthouden -Name[nn]=Datamotor for Remember The Milk -Name[pa]=ਰੀਮੈਂਬਰ ਦਾ ਮਿਲਕ ਇੰਜਣ -Name[pl]=Silnik Remember The Milk -Name[pt]=Motor para Recordar as Tarefas -Name[pt_BR]=Mecanismo Remember The Milk -Name[ro]=Motor Nu uita laptele -Name[ru]=Движок Remember the Milk. -Name[sk]=Nástroj Remember The Milk -Name[sl]=Podatkovni pogon Remember The Milk -Name[sr]=датомотор Не заборави млека -Name[sr@ijekavian]=датомотор Не заборави млијека -Name[sr@ijekavianlatin]=datomotor Ne zaboravi mlijeka -Name[sr@latin]=datomotor Ne zaboravi mleka -Name[sv]=Remember The Milk-gränssnitt -Name[tr]=Remember The Milk Motoru -Name[uk]=Рушій Remember The Milk -Name[wa]=Éndjin di Si sovni do laecea -Name[x-test]=xxRemember The Milk Enginexx -Name[zh_CN]=Remember The Milk 引擎 -Name[zh_TW]=Remember The Milk 引擎 -Comment=An engine to work with Remember the Milk. -Comment[ar]=محرك يعمل مع Remember the Milk . -Comment[ast]=Un motor pa trabayar con Remember The Milk. -Comment[bs]=Pogon za rad "Sjeti se mlijeka" -Comment[ca]=Un motor per treballar amb «Remember The Milk». -Comment[ca@valencia]=Un motor per treballar amb «Remember The Milk». -Comment[cs]=Nástroj pro práci s Remember the Milk. -Comment[da]=En motor der virker med Remember the Milk. -Comment[de]=Ein Datentreiber, der mit „Remember The Milk“ arbeitet. -Comment[el]=Μία μηχανή για εργασία με το Remember The Milk. -Comment[en_GB]=An engine to work with Remember the Milk. -Comment[es]=Un monitor para trabajar con Remember the Milk. -Comment[et]=Remember The Milk mootor. -Comment[fi]=Moottori Remember the Milk -palvelulle -Comment[fr]=Moteur fonctionnant avec « Remember the Milk ». -Comment[ga]=Inneall a oibríonn le Remember The Milk. -Comment[gl]=Un motor para traballar con Acórdate do leite. -Comment[hr]=Mehanizam za rad s Remember the Milk. -Comment[hu]=Egy rendszer a Remember the Milk használatához. -Comment[is]=Vél til að vinna með 'Muna eftir mjólkinni'. -Comment[it]=Un motore per lavorare con Remember The Milk. -Comment[ja]=Remember The Milk とやりとりするエンジン -Comment[kk]=Remember the Milk дегенмен істейтін тетік. -Comment[km]=ម៉ាស៊ីន​ដើម្បី​ដំណើរការ​ជា​មួយនឹង​ការចងចាំ​ Milk ។ -Comment[ko]=Remember the Milk와 통신하는 엔진입니다. -Comment[lv]=Dzinējs darbam ar Remember the Milk. -Comment[mr]=दूध लक्षात ठेवा बरोबर काम करणारे इंजिन. -Comment[nb]=En motor som samarbeider med Husk melk -Comment[nds]=En Karn, de mit Dor-An-Denken lopen schall -Comment[nl]=Een engine om samen te werken met Remember The Milk. -Comment[nn]=Datamotor for Remember The Milk -Comment[pl]=Silnik pracujący z Remember the Milk. -Comment[pt]=Um motor para funcionar com a 'applet' de recordação de tarefas. -Comment[pt_BR]=Um mecanismo para trabalhar com o Remember The Milk. -Comment[ro]=Motor pentru lucrul cu Remember the Milk. -Comment[ru]=Движок для работы с Remember the Milk. -Comment[sk]=Nástroj pre prácu s Remember the Milk. -Comment[sl]=Pogon za delo z Remember The Milk. -Comment[sr]=Мотор који ради с Не заборави млеком. -Comment[sr@ijekavian]=Мотор који ради с Не заборави млијеком. -Comment[sr@ijekavianlatin]=Motor koji radi s Ne zaboravi mlijekom. -Comment[sr@latin]=Motor koji radi s Ne zaboravi mlekom. -Comment[sv]=Ett gränssnitt för att arbeta med Remember the Milk. -Comment[tr]=Remember the Milk ile çalışan bir motor. -Comment[uk]=Рушій для роботи з Remember the Milk. -Comment[wa]=Èn éndjin a fé ovrer avou Si sovni do laecea. -Comment[x-test]=xxAn engine to work with Remember the Milk.xx -Comment[zh_CN]=一个与 Remember The Milk 工作的引擎。 -Comment[zh_TW]=用 Remember the Milk 工作的引擎 -Type=Service -Icon=korg-todo - -X-KDE-ServiceTypes=Plasma/DataEngine -X-KDE-Library=plasma_engine_rtm -X-Plasma-EngineName=rtm -X-KDE-PluginInfo-Author=Andrew Stromme -X-KDE-PluginInfo-Email=astromme@chatonka.com -X-KDE-PluginInfo-Name=rtm -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://blog.chatonka.com -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/kdeplasma-addons/dataengines/rememberthemilk/rtmauth.operations b/kdeplasma-addons/dataengines/rememberthemilk/rtmauth.operations deleted file mode 100644 index 218eacce..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/rtmauth.operations +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.cpp b/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.cpp deleted file mode 100644 index 125b6bf3..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "rtmengine.h" - -#include "taskssource.h" -#include "listssource.h" -#include "tasksource.h" - -#include "authservice.h" -#include "tasksservice.h" - - - -#include - -#include -#include - -const QString RtmEngine::apiKey = "631e881f0e5671d237c1a2a0a64d5b98"; -const QString RtmEngine::sharedSecret = "a1c48d8944bce414"; - - -RtmEngine::RtmEngine(QObject* parent, const QVariantList& args) - : Plasma::DataEngine(parent, args), - session(0) -{ - // We ignore any arguments - data engines do not have much use for them - Q_UNUSED(args) - - // This prevents applets from setting an unnecessarily high - // Polling interval and breaking the RTM ToS that say 1 poll per sec - setMinimumPollingInterval(1000); - - session = new RTM::Session(apiKey, sharedSecret, RTM::Delete, QString()); - connect(session, SIGNAL(tokenCheck(bool)), SLOT(tokenCheck(bool))); -} - -RtmEngine::~RtmEngine() { - if (session) - session->deleteLater(); -} - -bool RtmEngine::tokenCheck(bool success) -{ - if (success) { - if (sources().contains("Lists")) { - session->refreshListsFromServer(); - } - - if (sources().contains("Tasks")) { - session->refreshTasksFromServer(); - } - } - return updateSourceEvent("Auth"); -} - - -bool RtmEngine::authenticated() const -{ - return session->authenticated(); -} - -void RtmEngine::updateTaskSource(const QString &taskid) { - updateSourceEvent("Task:" + taskid); -} - -void RtmEngine::updateListSource(const QString &listid) { - updateSourceEvent("List:" + listid); -} - -bool RtmEngine::sourceRequestEvent(const QString &name) -{ - if (name == "Lists") { - ListsSource *lsource = new ListsSource(this, session); - addSource(lsource); - } else if (name == "Tasks") { - TasksSource *tsource = new TasksSource(this, session); - addSource(tsource); - } else if (name.startsWith("Task:") && authenticated()) { - TasksSource *taskssource = dynamic_cast(containerForSource("Tasks")); - if (!taskssource) { - sourceRequestEvent("Lists"); - sourceRequestEvent("Tasks"); // we need a Tasks source to get any info about an individual task - taskssource = dynamic_cast(containerForSource("Tasks")); - } - addSource(taskssource->setupTaskSource(name)); - } else if (name.startsWith("List:") && authenticated()) { - ListsSource *listssource = dynamic_cast(containerForSource("Lists")); - if (!listssource) { - sourceRequestEvent("Lists"); - sourceRequestEvent("Tasks"); - listssource = dynamic_cast(containerForSource("Lists")); - } - addSource(listssource->setupListSource(name)); - } - return updateSourceEvent(name); -} - -bool RtmEngine::updateSourceEvent(const QString& source) { - if (source == "Auth") { - setData(source, "ValidToken", session->authenticated()); - setData(source, "Token", session->token()); - setData(source, "Permissions", session->permissions()); - return true; - } - else if (source.startsWith("Lists")) { - ListsSource *listssource = static_cast(containerForSource(source)); - listssource->refresh(); - return true; - } - else if (source.startsWith("Tasks")) { - TasksSource *taskssource = static_cast(containerForSource(source)); - taskssource->refresh(); - return true; - } - else if (source.startsWith("List:")) { - ListSource *listsource = static_cast(containerForSource(source)); - if (listsource) - listsource->update(); - return true; - } - else if (source.startsWith("Task:")) { - TaskSource *tasksource = static_cast(containerForSource(source)); - if (tasksource) - tasksource->update(); - return true; - } - return false; -} - -void RtmEngine::dataUpdate(const QString& source, const Plasma::DataEngine::Data& data) { - setData(source, data); -} - - -Plasma::Service* RtmEngine::serviceForSource(const QString& source) { - if (source.startsWith("Task:") && authenticated()) { - TaskSource *tasksource = dynamic_cast(containerForSource(source)); - if (tasksource) - return tasksource->createService(); - } - else if (source == "Auth") { - return new AuthService(session, this); - } - else if (source == "Tasks") { - return new TasksService(session, this); - } - return 0; // Return 0 pointer if source is invalid -} - - -K_EXPORT_PLASMA_DATAENGINE(rtm, RtmEngine) - -#include "moc_rtmengine.cpp" diff --git a/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.h b/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.h deleted file mode 100644 index f6d0450d..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/rtmengine.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTMENGINE_H -#define RTMENGINE_H - -#include - -#include - -class TaskSource; -namespace RTM -{ - class Session; -} - -class RtmEngine : public Plasma::DataEngine -{ -Q_OBJECT - -public: - RtmEngine(QObject* parent, const QVariantList& args); - virtual ~RtmEngine(); - - bool authenticated() const; - - void updateTaskSource(const QString &taskid); - void updateListSource(const QString &listid); - -protected slots: - void dataUpdate(const QString &source, const Plasma::DataEngine::Data &data); - bool tokenCheck(bool success); - -protected: - void setupSource(Plasma::DataContainer* source); - bool sourceRequestEvent(const QString& name); - bool updateSourceEvent(const QString& source); - - Plasma::Service* serviceForSource(const QString& source); - - static const QString apiKey; - static const QString sharedSecret; - - RTM::Session *session; - -}; - -#endif // RTMENGINE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/rtmtask.operations b/kdeplasma-addons/dataengines/rememberthemilk/rtmtask.operations deleted file mode 100644 index 1b17a11c..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/rtmtask.operations +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/rtmtasks.operations b/kdeplasma-addons/dataengines/rememberthemilk/rtmtasks.operations deleted file mode 100644 index c2d2e710..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/rtmtasks.operations +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/taskservice.cpp b/kdeplasma-addons/dataengines/rememberthemilk/taskservice.cpp deleted file mode 100644 index b489ea0a..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/taskservice.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskservice.h" -#include "tasksource.h" - -#include -#include -#include - -TaskService::TaskService(RTM::Session* session, RTM::Task* task, TaskSource* parent) - : Plasma::Service(parent) -{ - m_session = session; - m_task = task; - setName("rtmtask"); - setOperationEnabled("modify", true); -} - -Plasma::ServiceJob* TaskService::createJob(const QString& operation, QMap< QString, QVariant >& parameters) { - kDebug() << "Creating Job for " << operation; - return new ModifyTaskJob(m_session, m_task, operation, parameters, this); -} - - -ModifyTaskJob::ModifyTaskJob(RTM::Session* session, RTM::Task* task, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent) - : Plasma::ServiceJob("Tasks", operation, parameters, parent), - m_session(session) -{ - m_task = task; -} - -void ModifyTaskJob::start() { - connect(m_session, SIGNAL(taskChanged(RTM::Task*)), SLOT(result(RTM::Task*))); - - //FIXME: error handling? - if (operationName() == "setListId") { - m_task->setList(parameters().value("listId").toULongLong()); - } - else if (operationName() == "setCompleted") { - m_task->setCompleted(parameters().value("completed").toBool()); - } - else if (operationName() == "setDeleted") { - m_task->setDeleted(parameters().value("deleted").toBool()); - } - else if (operationName() == "setPriority") { - m_task->setPriority(parameters().value("priority").toInt()); - } - else if (operationName() == "setDue") { - m_task->setDue(parameters().value("due").toDateTime()); - } - else if (operationName() == "setDueText") { - m_task->setDue(parameters().value("dueText").toString()); - } - else if (operationName() == "setName") { - m_task->setName(parameters().value("name").toString()); - } - else if (operationName() == "setEstimate") { - m_task->setEstimate(parameters().value("estimate").toString()); - } - else if (operationName() == "setLocationId") { - m_task->setLocationId(parameters().value("locationId").toULongLong()); - } - else if (operationName() == "setRepeatString") { - m_task->setRepeatString(parameters().value("repeatString").toString()); - } - else if (operationName() == "setUrl") { - m_task->setUrl(parameters().value("url").toString()); - } - else if (operationName() == "setTags") { - m_task->setTags(parameters().value("tags").toStringList()); - } - else { - kDebug() << "Operation not recognized"; - } -} - -void ModifyTaskJob::result(RTM::Task* task) { - //kDebug() << task->id() << m_task->id(); - if (task->id() != m_task->id()) - return; - - setError(false); - setResult(true); - this->deleteLater(); -} diff --git a/kdeplasma-addons/dataengines/rememberthemilk/taskservice.h b/kdeplasma-addons/dataengines/rememberthemilk/taskservice.h deleted file mode 100644 index f590267d..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/taskservice.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKSERVICE_H -#define TASKSERVICE_H - -#include -#include - -class TaskSource; - -namespace RTM { - class Session; - class Task; -} - -class TaskService : public Plasma::Service -{ -public: - TaskService(RTM::Session *session, RTM::Task* task, TaskSource* parent); - -protected: - virtual Plasma::ServiceJob* createJob(const QString& operation, QMap< QString, QVariant >& parameters); - public: - TaskSource* m_source; - RTM::Task* m_task; - RTM::Session* m_session; -}; - -class ModifyTaskJob : public Plasma::ServiceJob -{ - Q_OBJECT - RTM::Session* m_session; - RTM::Task* m_task; - -public: - ModifyTaskJob(RTM::Session* session, RTM::Task* source, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent); - void start(); - -private slots: - void result(RTM::Task *task); -}; - -#endif // TASKSERVICE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/tasksource.cpp b/kdeplasma-addons/dataengines/rememberthemilk/tasksource.cpp deleted file mode 100644 index ee6216aa..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/tasksource.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "tasksource.h" -#include -#include -#include "taskservice.h" - -#include -#include - -TaskSource::TaskSource(RTM::TaskId i, RTM::Session* s, QObject* parent) - : DataContainer(parent), - id(i), - session(s), - task(0) -{ - connect(this, SIGNAL(updateRequested(DataContainer*)), SLOT(updateRequest(DataContainer*))); - setObjectName("Task:" + QString::number(i)); - update(); -} - -TaskSource::~TaskSource() -{ -} - -void TaskSource::updateRequest(Plasma::DataContainer* source) { - Q_UNUSED(source) - kDebug() << "Update request of task: " << task->id(); - update(); -} - -Plasma::Service* TaskSource::createService() { - kDebug(); - return new TaskService(session, task, this); -} - - -void TaskSource::update() { - if (!task) { - task = session->taskFromId(id); - if (!task) - return; - } - - for (int i = 0; i < task->metaObject()->propertyCount(); i++) { - QMetaProperty prop = task->metaObject()->property(i); - setData(prop.name(), prop.read(task)); - } - - checkForUpdate(); -} diff --git a/kdeplasma-addons/dataengines/rememberthemilk/tasksource.h b/kdeplasma-addons/dataengines/rememberthemilk/tasksource.h deleted file mode 100644 index 78b87a7a..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/tasksource.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKSOURCE_H -#define TASKSOURCE_H - -#include -#include - -namespace RTM { -class Task; -class Session; -} - -class TaskSource : public Plasma::DataContainer -{ -Q_OBJECT -public: - TaskSource(RTM::TaskId id, RTM::Session *session, QObject* parent); - ~TaskSource(); - - Plasma::Service* createService(); - -public slots: - void updateRequest(DataContainer *source); - void update(); - -private: - RTM::TaskId id; - RTM::Session* session; - RTM::Task* task; - -}; - -#endif // TASKSOURCE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.cpp b/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.cpp deleted file mode 100644 index 511e024c..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "tasksservice.h" - -#include -#include - -TasksService::TasksService(RTM::Session* session, QObject* parent) - : Plasma::Service(parent) -{ - m_session = session; - setName("rtmtasks"); - setOperationEnabled("create", true); -} - -Plasma::ServiceJob* TasksService::createJob(const QString& operation, QMap< QString, QVariant >& parameters) { - kDebug() << "Creating Job for" << operation; - return new TasksJob(m_session, operation, parameters, this); -} - - -TasksJob::TasksJob(RTM::Session* session, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent) - : Plasma::ServiceJob("Auth", operation, parameters, parent), - m_session(session) -{ -} - -void TasksJob::start() { - connect(m_session, SIGNAL(tasksChanged()), SLOT(result())); - //FIXME: error handling? - if (operationName() == "create") { - m_session->addTask(parameters().value("task").toString(), parameters().value("listid").toULongLong()); - } -} - -void TasksJob::result() { - - setError(false); - setResult(true); - - this->deleteLater(); -} - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.h b/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.h deleted file mode 100644 index 6086a10c..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/tasksservice.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKSSERVICE_H -#define TASKSSERVICE_H - -#include -#include - -namespace RTM { - class Session; -} - -class TaskSource; - -class TasksService : public Plasma::Service -{ -public: - TasksService(RTM::Session *session, QObject* parent); -protected: - virtual Plasma::ServiceJob* createJob(const QString& operation, QMap< QString, QVariant >& parameters); - TaskSource* m_source; - RTM::Session* m_session; -}; - -class TasksJob : public Plasma::ServiceJob -{ - Q_OBJECT -public: - TasksJob(RTM::Session* session, const QString& operation, QMap< QString, QVariant >& parameters, QObject* parent); - void start(); - -private slots: - void result(); - -protected: - RTM::Session* m_session; -}; - -#endif // AUTHSERVICE_H diff --git a/kdeplasma-addons/dataengines/rememberthemilk/taskssource.cpp b/kdeplasma-addons/dataengines/rememberthemilk/taskssource.cpp deleted file mode 100644 index 17b0c226..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/taskssource.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "taskssource.h" - -#include -#include -#include -#include - -#include -#include -#include "rtmengine.h" -#include "tasksource.h" -#include "taskservice.h" - - -TasksSource::TasksSource(RtmEngine* engine, RTM::Session* session) - : Plasma::DataContainer(engine), - m_engine(engine), - m_session(session) -{ - connect(session, SIGNAL(taskChanged(RTM::Task*)), this, SLOT(taskChanged(RTM::Task*))); - connect(session, SIGNAL(tasksChanged()), this, SLOT(tasksChanged())); - connect(&timer, SIGNAL(timeout()), this, SLOT(refresh())); - timer.setInterval(1000*60*2); // 5 minute refresh. TODO: Make Configurable. - timer.start(); - setObjectName("Tasks"); - loadCache(); -} - -TasksSource::~TasksSource() -{ -} - -TaskSource* TasksSource::setupTaskSource(const QString& source) { - QString id = source; - TaskSource *tasksource = new TaskSource(id.remove("Task:").toULongLong(), m_session, this); - return tasksource; -} - -void TasksSource::refresh() -{ - if (!m_session->authenticated()) - return; // We can't do anything with a non-authenticated session - m_session->refreshTasksFromServer(); -} - -void TasksSource::tasksChanged() { - removeAllData(); - loadCache(); -} - - -void TasksSource::taskChanged(RTM::Task* task) { - setData(QString::number(task->id()), task->name()); - m_engine->updateTaskSource(QString::number(task->id())); -} - -void TasksSource::loadCache() { - kDebug() << "Updating Tasks. " << m_session->cachedTasks().count(); - foreach(RTM::Task* task, m_session->cachedTasks()) { - setData(QString::number(task->id()), task->name()); // ids are unique, names are not - } -} - -#include "moc_taskssource.cpp" - diff --git a/kdeplasma-addons/dataengines/rememberthemilk/taskssource.h b/kdeplasma-addons/dataengines/rememberthemilk/taskssource.h deleted file mode 100644 index 92cd5b9f..00000000 --- a/kdeplasma-addons/dataengines/rememberthemilk/taskssource.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TASKSSOURCE_H -#define TASKSSOURCE_H - -#include -#include -#include - -#include - -#include -#include -#include - -// forward declarations -class TaskSource; -class TasksSource; -class RtmEngine; - -class TasksSource : public Plasma::DataContainer -{ - Q_OBJECT - -public: - - TasksSource(RtmEngine* engine, RTM::Session* session); - ~TasksSource(); - - TaskSource* setupTaskSource(const QString& source); - Plasma::Service *createService(); - RTM::Session* session() const { return m_session; } - -public slots: - void refresh(); - -private slots: - void taskChanged(RTM::Task* task); - void tasksChanged(); - void loadCache(); - -private: - RtmEngine *m_engine; - RTM::Session *m_session; - QString m_cdata; - Plasma::DataEngine::Data m_tempData; - QString m_id; - QTimer timer; -}; - -#endif - diff --git a/kdeplasma-addons/libs/CMakeLists.txt b/kdeplasma-addons/libs/CMakeLists.txt index 9d89b926..c4b1b0ef 100644 --- a/kdeplasma-addons/libs/CMakeLists.txt +++ b/kdeplasma-addons/libs/CMakeLists.txt @@ -1,6 +1,4 @@ - add_subdirectory(plasmaweather) -add_subdirectory(rtm) add_subdirectory(lancelot) if(KDE4WORKSPACE_FOUND) diff --git a/kdeplasma-addons/libs/lancelot-datamodels/CMakeLists.txt b/kdeplasma-addons/libs/lancelot-datamodels/CMakeLists.txt index 418a7126..6bda4870 100644 --- a/kdeplasma-addons/libs/lancelot-datamodels/CMakeLists.txt +++ b/kdeplasma-addons/libs/lancelot-datamodels/CMakeLists.txt @@ -2,38 +2,11 @@ project(liblancelot-datamodels) find_package(Lancelot REQUIRED) -set (ADDITIONAL_LINK_LIBRARIES) - -########### are akonadi and pimlibs available? ########## - -# find_package(KdepimLibs) - -if (KDEPIMLIBS_FOUND) - set( LANCELOT_DATAMODELS_HAS_PIMLIBS 1 ) - - include_directories( - ${KDEPIMLIBS_INCLUDE_DIRS} - ) - - set (ADDITIONAL_LINK_LIBRARIES - ${ADDITIONAL_LINK_LIBRARIES} - ) -endif(KDEPIMLIBS_FOUND) - -macro_log_feature(LANCELOT_DATAMODELS_HAS_PIMLIBS - "Akonadi and KDE PIM Libs" - "Support for unread messages model" - "http://www.kde.org/" - FALSE - "" - "STRONGLY_RECOMMENDED: Akonadi and KDE PIM libraries are required for messages datamodel and kmail support" +configure_file( + config-lancelot-datamodels.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config-lancelot-datamodels.h ) -configure_file(config-lancelot-datamodels.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/config-lancelot-datamodels.h ) - - - ########### define variables ########## set(LANCELOT_DATAMODELS_INCLUDE_DIR @@ -108,7 +81,6 @@ target_link_libraries( ${KDE4_SOLID_LIBS} ${KDE4WORKSPACE_TASKMANAGER_LIBRARY} ${LANCELOT_LIBS} - ${ADDITIONAL_LINK_LIBRARIES} kworkspace ) diff --git a/kdeplasma-addons/libs/rtm/CMakeLists.txt b/kdeplasma-addons/libs/rtm/CMakeLists.txt deleted file mode 100644 index 0cdb33fe..00000000 --- a/kdeplasma-addons/libs/rtm/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -project(librtm) - -set( rtm_LIB_HEADERS - rtm_export.h - rtm.h - request.h - auth.h - task.h - session.h - list.h - note.h - xmlreaders.h - ) - -set( rtm_LIB_SRCS - session.cpp - task.cpp - list.cpp - request.cpp - auth.cpp - xmlreaders.cpp - ) - -add_library(rtm SHARED ${rtm_LIB_SRCS}) -set_target_properties(rtm PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) -target_link_libraries(rtm ${QT_QTCORE_LIBRARY} - ${QT_QTNETWORK_LIBRARY} - ${KDE4_KDECORE_LIBS} - ${KDE4_SOLID_LIBS}) - - -#### FOR 4.3 we are not including the library as a stable platform, hence no exporting of headers - -install(TARGETS rtm ${INSTALL_TARGETS_DEFAULT_ARGS}) -#install(TARGETS rtm EXPORT RtmExports ${INSTALL_TARGETS_DEFAULT_ARGS}) -#install(EXPORT RtmExports DESTINATION ${DATA_INSTALL_DIR}/cmake/modules -# FILE RtmExportedLibraryTargets.cmake ) - -#install( FILES ${rtm_LIB_HEADERS} -# DESTINATION ${INCLUDE_INSTALL_DIR}/rtm -# COMPONENT Devel -#) - -#install(FILES FindRTM.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules) - -add_subdirectory(tests) diff --git a/kdeplasma-addons/libs/rtm/FindRTM.cmake b/kdeplasma-addons/libs/rtm/FindRTM.cmake deleted file mode 100644 index 50646fbc..00000000 --- a/kdeplasma-addons/libs/rtm/FindRTM.cmake +++ /dev/null @@ -1,12 +0,0 @@ -FIND_PATH(RTM_INCLUDE_DIR rtm/rtm.h) - -SET(RTM_NAMES ${RTM_NAMES} rtm) -FIND_LIBRARY(RTM_LIBRARY NAMES ${RTM_NAMES}) - -# handle the QUIETLY and REQUIRED arguments and set RTM_FOUND to TRUE if -# all listed variables are TRUE - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTM DEFAULT_MSG RTM_LIBRARY RTM_INCLUDE_DIR) - -MARK_AS_ADVANCED(RTM_INCLUDE_DIR RTM_LIBRARY ) diff --git a/kdeplasma-addons/libs/rtm/INSTALL b/kdeplasma-addons/libs/rtm/INSTALL deleted file mode 100644 index 87e28204..00000000 --- a/kdeplasma-addons/libs/rtm/INSTALL +++ /dev/null @@ -1,3 +0,0 @@ -Build instructions can be found at -http://techbase.kde.org/Getting_Started/Build/KDE4 - diff --git a/kdeplasma-addons/libs/rtm/Messages.sh b/kdeplasma-addons/libs/rtm/Messages.sh deleted file mode 100755 index fda1af3a..00000000 --- a/kdeplasma-addons/libs/rtm/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT *.cpp -o $podir/librtm.pot diff --git a/kdeplasma-addons/libs/rtm/README b/kdeplasma-addons/libs/rtm/README deleted file mode 100644 index 270c54f5..00000000 --- a/kdeplasma-addons/libs/rtm/README +++ /dev/null @@ -1,2 +0,0 @@ -librtm is a KDE/Qt api for the online Remember The Milk service. - diff --git a/kdeplasma-addons/libs/rtm/auth.cpp b/kdeplasma-addons/libs/rtm/auth.cpp deleted file mode 100644 index 48f5139f..00000000 --- a/kdeplasma-addons/libs/rtm/auth.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "auth.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include "request.h" - -class RTM::AuthPrivate { -public: - AuthPrivate() - : frobRequest(0), - tokenRequest(0) - { - } - - ~AuthPrivate() - { - if (frobRequest) - frobRequest->deleteLater(); - if (tokenRequest) - tokenRequest->deleteLater(); - } - - QString frob; - Request *frobRequest; - Request *tokenRequest; - -}; - -RTM::Auth::Auth(RTM::Permissions permissions, const QString& apiKey, const QString& sharedSecret) -: Request(QString(), apiKey, sharedSecret, RTM::baseAuthUrl), - d(new RTM::AuthPrivate()) -{ - d->frobRequest = new RTM::Request("rtm.auth.getFrob", Request::apiKey(), Request::sharedSecret()); - connect(d->frobRequest, SIGNAL(replyReceived(RTM::Request*)), SLOT(onFrobRequestFinished(RTM::Request*))); - d->frobRequest->sendRequest(); - - addArgument("perms", getTextPermissions(permissions)); -} - -RTM::Auth::~Auth() { -} - -void RTM::Auth::onFrobRequestFinished(RTM::Request *reply) -{ - QString data = reply->data(); - d->frob = data.remove(0, data.indexOf("")+6); - d->frob.truncate(d->frob.indexOf("")); - addArgument("frob", d->frob); - emit authUrlReady(getAuthUrl()); -} - -QString RTM::Auth::getAuthUrl() { - // TODO: don't return until we get a frob? - while (d->frob.isEmpty()) - QCoreApplication::processEvents(); - return requestUrl(); -} - -QString RTM::Auth::getTextPermissions(RTM::Permissions permissions) -{ - QString textPermissions; - switch (permissions) - { - case RTM::None: - textPermissions = "none"; - break; - case RTM::Read: - textPermissions = "read"; - break; - case RTM::Write: - textPermissions = "write"; - break; - case RTM::Delete: - textPermissions = "delete"; - break; - default: - qDebug() << "ERROR: No Permissions"; - break; - } - return textPermissions; -} - -void RTM::Auth::continueAuthForToken() -{ - qDebug() << "Token Time"; - if (d->tokenRequest) - d->tokenRequest->deleteLater(); - - d->tokenRequest = new RTM::Request("rtm.auth.getToken", Request::apiKey(), Request::sharedSecret()); - d->tokenRequest->addArgument("frob", d->frob); - connect(d->tokenRequest, SIGNAL(replyReceived(RTM::Request*)), SLOT(tokenResponse(RTM::Request*))); - d->tokenRequest->sendRequest(); -} - - -void RTM::Auth::tokenResponse(RTM::Request* response) -{ - QString reply = response->data(); - qDebug() << "Reply: " << reply; - QString token = reply.remove(0, reply.indexOf("")+7); - token.truncate(token.indexOf("")); - qDebug() << "Token: " << token; - emit tokenReceived(token); -} - diff --git a/kdeplasma-addons/libs/rtm/auth.h b/kdeplasma-addons/libs/rtm/auth.h deleted file mode 100644 index e8105fb3..00000000 --- a/kdeplasma-addons/libs/rtm/auth.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_AUTH_H -#define RTM_AUTH_H - -#include "request.h" - -namespace RTM { - -class AuthPrivate; - -class Auth : public Request -{ -Q_OBJECT - public: - Auth(RTM::Permissions permissions, const QString &apiKey, const QString &sharedSecret); - QString getAuthUrl(); - void continueAuthForToken(); - - ~Auth(); - protected: - QString getTextPermissions(RTM::Permissions permissions); - - signals: - void authUrlReady(QString authUrl); - void tokenReceived(QString token); - - protected slots: - void onFrobRequestFinished(RTM::Request* reply); -public slots: - void tokenResponse(RTM::Request*); - private: - AuthPrivate * const d; -}; - -} // Namespace RTM - -#endif diff --git a/kdeplasma-addons/libs/rtm/list.cpp b/kdeplasma-addons/libs/rtm/list.cpp deleted file mode 100644 index 46bc0d2d..00000000 --- a/kdeplasma-addons/libs/rtm/list.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "list.h" -#include "task.h" - -namespace RTM { - -class ListPrivate { - ListPrivate(List *parent) - : q(parent) - {} - - friend class List; - List *q; - - QString name; - RTM::ListId listId; - bool smart; - QString filter; - QHash tasks; - QHash incompleteTally; - - // none of the following are used yet. However, they exsist in the - // list example and so I thought that they should be included. - bool deleted; - bool locked; - bool archived; - int position; - List::SortOrder sortOrder; -}; - -List::List(Session* session) - : QObject(session), - d(new ListPrivate(this)) -{ - for (int i = 0; i <= 4; ++i) - { - d->incompleteTally.insert(i, 0); - } -} - -List::~List() -{ - delete d; -} - -QString List::name() const { - return d->name; -} - -ListId List::id() const { - return d->listId; -} - -bool List::isSmart() const { - return d->smart; -} - -QString List::filter() const { - return d->filter; -} - -List::SortOrder List::sortOrder() const -{ - return d->sortOrder; -} - -int List::position() const -{ - return d->position; -} - -int List::incompleteTasks(int priority) const -{ - if (priority >= 0 && priority < d->incompleteTally.size()) - return d->incompleteTally.value(priority); - else - return 0; -} - -int List::taskCount() const -{ - return d->tasks.size(); -} - -RTM::Task *List::task(int row) -{ - RTM::Task *retval = 0; - if (row >= 0 && row < d->tasks.size()) - { - QHash::iterator i = d->tasks.begin(); - i += row; - retval = i.value(); - } - return retval; -} - -QList List::tasks() const -{ - return d->tasks.values(); -} - -void List::setName(const QString& name) { - d->name = name; -} - -void List::setId(qulonglong id) { - d->listId = id; -} - -void List::setSmart(bool smart) { - d->smart = smart; -} - -void List::setFilter(const QString& filter) { - d->filter = filter; -} - -void List::setSortOrder(List::SortOrder order) { - d->sortOrder = order; -} - -void List::setPosition(int position) { - d->position = position; -} - -void List::setTasks(QList &tasks) -{ - // Reset the list and tallies. - d->tasks.clear(); - for (int i = 0; i <= 4; ++i) - { - d->incompleteTally.insert(i, 0); - } - - foreach(RTM::Task* task, tasks) - { - addTask(task); - } -} - -void List::addTask(Task *task) -{ - if (!d->tasks.contains(task->id())) - { - d->tasks.insert(task->id(), task); - if (!task->isCompleted() && !task->isDeleted()) - { - d->incompleteTally[task->priority()]++; - } - } -} - -void List::removeTask(Task *task) -{ - d->tasks.remove(task->id()); - int priority = task->priority(); - if (d->incompleteTally.value(priority) > 0 && - !task->isCompleted() && - !task->isDeleted()) - { - d->incompleteTally[priority]--; - } -} -} -#include "moc_list.cpp" diff --git a/kdeplasma-addons/libs/rtm/list.h b/kdeplasma-addons/libs/rtm/list.h deleted file mode 100644 index 2a68e02b..00000000 --- a/kdeplasma-addons/libs/rtm/list.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_LIST_H -#define RTM_LIST_H - -// Qt Includes -#include - -// Local Includes -#include "rtm.h" -#include "session.h" - -namespace RTM { - -class ListPrivate; - -class RTM_EXPORT List : public QObject{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(qulonglong id READ id WRITE setId) - Q_PROPERTY(bool smart READ isSmart WRITE setSmart) - Q_PROPERTY(QString filter READ filter WRITE setFilter) - -public: - enum SortOrder { - ByPriority, - ByDueDate, - ByName - }; - - static List* uninitializedList(RTM::Session* session) { return new List(session); } - ~List(); - - QString name() const; - RTM::ListId id() const; - bool isSmart() const; - QString filter() const; - SortOrder sortOrder() const; - int position() const; - - /** - * Get the number of incomplete tasks of a given priority. - * - * @param priority the priority to get the count for. - * @returns the number of incomplete tasks. - */ - int incompleteTasks(int priority) const; - - /** - * Get the total number of tasks for this list. - * - * @returns the number of tasks in this list. - */ - int taskCount() const; - - /** - * Get a task for a given row. - * - * @param row the index of the task in the list. - * @returns the task at the given row. - */ - RTM::Task* task(int row); - - /** - * Get all the tasks - * - * @returns the tasks as a list - */ - QList tasks() const; - - void setName(const QString &name); - void setId(qulonglong id); - void setSmart(bool smart); - void setFilter(const QString &filter); - void setSortOrder(SortOrder order); - void setPosition(int position); - - /** - * Set the tasks for this list. - * - * @param tasks the tasks for this list. - */ - void setTasks(QList& tasks); - - /** - * Add a task to this list. - * - * @param task the task to add to the list. - */ - void addTask(RTM::Task* task); - - /** - * Remove a task from the list. - * - * @param task the task to remove. - */ - void removeTask(RTM::Task* task); - -protected: - List(RTM::Session* session); - -private: - friend class TasksReader; - friend class ListPrivate; - ListPrivate * const d; -}; - -} // rtm namespace - -#endif diff --git a/kdeplasma-addons/libs/rtm/note.h b/kdeplasma-addons/libs/rtm/note.h deleted file mode 100644 index fb0e7d25..00000000 --- a/kdeplasma-addons/libs/rtm/note.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_NOTE_H -#define RTM_NOTE_H - -// Qt Includes -#include -#include - -// Local Includes -#include "rtm.h" - -typedef QHash Notes; - -namespace RTM { - -class RTM_EXPORT Note { -public: - Note(RTM::NoteId id, const QString& title, const QString& text) - { - noteId = id; - m_title = title; - m_text = text; - } - - RTM::NoteId id() const { return noteId; } - QString title() const { return m_title; } - QString text() const { return m_text; } - -protected: - RTM::NoteId noteId; - QString m_text; - QString m_title; -}; - -} // rtm namespace - -#endif diff --git a/kdeplasma-addons/libs/rtm/request.cpp b/kdeplasma-addons/libs/rtm/request.cpp deleted file mode 100644 index 1ccea2c8..00000000 --- a/kdeplasma-addons/libs/rtm/request.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "request.h" -#include "request_p.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -RTM::Request::Request() -: d(new RTM::RequestPrivate(this)) -{ -} - -RTM::Request::Request(const QString &method, const QString &apiKey, const QString &sharedSecret, const QString&baseUrl) -: d(new RTM::RequestPrivate(this)) -{ - if (!method.isEmpty()) - d->arguments.insert("method", method); - d->baseUrl = baseUrl; - d->apiKey = apiKey; - d->sharedSecret = sharedSecret; - d->arguments.insert("api_key", apiKey); - d->m_state = RTM::Mutable; - d->retries = 0; -} - -QString RTM::Request::response() const -{ - return d->m_response; -} - -RTM::State RTM::Request::state() const -{ - return d->m_state; -} - -void RTM::Request::setReadOnly(bool readOnly) -{ - d->m_readOnly = readOnly; -} - -bool RTM::Request::readOnly() const -{ - return d->m_readOnly; -} - -void RTM::Request::addArgument(const QString &name, const QString &value) { - d->arguments.insert(name, value); -} - -void RTM::Request::sendRequest() -{ - static QDateTime lastRequest = QDateTime::fromMSecsSinceEpoch(QDateTime::currentMSecsSinceEpoch() - 1050); - static unsigned int queueSize = 0; - - qint64 margin = lastRequest.msecsTo(QDateTime::currentDateTime()); - - // Follow RTM's TOS and only do 1 request per second. - if (margin <= 1000) { - const int timeout = 1000 * (queueSize + 1) - margin + queueSize * 2 + 1; - QTimer::singleShot(timeout, this, SLOT(sendRequest())); - //qDebug() << "Postponing Job for"<accessManager->get(QNetworkRequest(url)); - - lastRequest = QDateTime::currentDateTime(); -} - -QString RTM::Request::method() const { - return d->arguments.value("method"); -} - -void RTM::Request::sign() { - QString unistring = d->sharedSecret; - QStringList keys = d->arguments.keys(); - qSort(keys); - - Q_FOREACH (const QString& key, keys) { - unistring.append(key); - unistring.append(d->arguments.value(key)); - } - - QString hash = QCryptographicHash::hash(unistring.toUtf8(), QCryptographicHash::Md5).toHex(); - d->arguments.insert("api_sig", hash); - d->m_state = RTM::Hashed; -} - -void RTM::Request::unsign() { - d->arguments.remove("api_sig"); -} - -QString RTM::Request::requestUrl() -{ - switch(d->m_state) { - case RTM::Mutable: - sign(); - break; - case RTM::Hashed: - unsign(); - sign(); - break; - case RTM::RequestSent: - break; - case RTM::RequestReceived: - break; - } - //qDebug() << "Creating url"; - QString url = d->baseUrl; - QStringList keys = d->arguments.keys(); - foreach (const QString &key, keys) - url.append('&' + key + '=' + d->arguments.value(key)); - return url; -} - -QString RTM::Request::apiKey() const -{ - return d->apiKey; -} - -QString RTM::Request::sharedSecret() const -{ - return d->sharedSecret; -} - -RTM::Request::~Request() { -} - -#include "moc_request.cpp" - diff --git a/kdeplasma-addons/libs/rtm/request.h b/kdeplasma-addons/libs/rtm/request.h deleted file mode 100644 index 77b7bcd0..00000000 --- a/kdeplasma-addons/libs/rtm/request.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_REQUEST_H -#define RTM_REQUEST_H - -#include - -#include "rtm.h" - -#include - -namespace RTM { - -class RequestPrivate; - -class RTM_EXPORT Request : public QBuffer -{ -Q_OBJECT - public: - Request(const QString &method, - const QString &apiKey, - const QString &sharedSecret, - const QString &baseUrl = RTM::baseMethodUrl); - ~Request(); - - void addArgument(const QString &name, const QString &value); - - QString response() const; - RTM::State state() const; - - void setReadOnly(bool readOnly); - bool readOnly() const; - - virtual QString requestUrl(); // Convenience - QString method() const; - - signals: - void replyReceived(RTM::Request *request); - void offlineError(); - - public slots: - void sendRequest(); - - protected: - Request(); - void sign(); - void unsign(); - QString apiKey() const; - QString sharedSecret() const; - - private: - friend class RequestPrivate; - RequestPrivate * const d; - - Q_PRIVATE_SLOT(d, void finished(QNetworkReply*)); -}; - -} // namespace RTM - -#endif diff --git a/kdeplasma-addons/libs/rtm/request_p.h b/kdeplasma-addons/libs/rtm/request_p.h deleted file mode 100644 index cd6164c7..00000000 --- a/kdeplasma-addons/libs/rtm/request_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * Copyright 2012 Jeremy Whiting - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_REQUEST_P_H -#define RTM_REQUEST_P_H - -#include "request.h" - -#include -#include -#include -#include - -class RTM::RequestPrivate -{ -public: - RequestPrivate(Request *parent) - : q(parent), - m_readOnly(true), - accessManager(new QNetworkAccessManager(q)) - { - QObject::connect(accessManager, SIGNAL(finished(QNetworkReply*)), - q, SLOT(finished(QNetworkReply*))); - } - - void finished(QNetworkReply* reply) - { - if (reply->error()) { - qDebug() << "Network Error: " << reply->error(); - if (retries >= RTM::RequestPrivate::MAX_RETRIES) { - qDebug() << "ABORT: Maximum Retries reached for " << reply->url(); - return; - } - switch (reply->error()) { - case QNetworkReply::TimeoutError: - default: - // If the connection is broken, resend the request - qDebug() << "Connection Error, retrying connection"; - retries++; - q->sendRequest(); - return; - case QNetworkReply::HostNotFoundError: // Guess that we're offline - qDebug() << "Unknown host, we're probably offline"; - emit q->offlineError(); - q->deleteLater(); - return; - //TODO: Handle other error cases. - } - } - q->buffer().append(reply->readAll()); - emit q->replyReceived(q); - } - - RTM::Request *q; - QMap arguments; - QString m_response; - - QString baseUrl; - int retries; - static const int MAX_RETRIES; - bool m_readOnly; - - RTM::State m_state; - QString apiKey; - QString sharedSecret; - QNetworkAccessManager *accessManager; -}; - -const int RTM::RequestPrivate::MAX_RETRIES = 10; - -#endif diff --git a/kdeplasma-addons/libs/rtm/rtm.h b/kdeplasma-addons/libs/rtm/rtm.h deleted file mode 100644 index 7e7d9672..00000000 --- a/kdeplasma-addons/libs/rtm/rtm.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_H -#define RTM_H - -#include "rtm_export.h" - -#include - -namespace RTM { - enum State { Mutable, Hashed, RequestSent, RequestReceived }; - enum Permissions { None , Read, Write, Delete }; - const QString baseAuthUrl = "https://www.rememberthemilk.com/services/auth/?"; - const QString baseMethodUrl = "https://api.rememberthemilk.com/services/rest/?"; - - /** Timlines are unsigned longs that map to a "session" in which - actions are undoable */ - typedef unsigned long Timeline; - - typedef qulonglong ListId; - typedef qulonglong TaskId; - typedef qulonglong NoteId; - typedef qulonglong TaskSeriesId; - typedef qulonglong ListSeriesId; - typedef qulonglong LocationId; - typedef QString Tag; - - class List; - class Request; - class Auth; - class Task; - class Note; - - - class Location - { - }; - class Contact - { - }; - class Group - { - }; -} - - -#endif diff --git a/kdeplasma-addons/libs/rtm/rtm.pro b/kdeplasma-addons/libs/rtm/rtm.pro deleted file mode 100644 index 71fd6255..00000000 --- a/kdeplasma-addons/libs/rtm/rtm.pro +++ /dev/null @@ -1,39 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Tue Aug 14 08:28:25 2012 -###################################################################### - -TEMPLATE = lib -TARGET = rtm -DEPENDPATH += . tests -INCLUDEPATH += . -DEFINES += QTONLY MAKE_RTM_LIB -QT += network xml -isEmpty(PREFIX) { - PREFIX=/usr/local -} - -# Input -HEADERS += auth.h \ - list.h \ - note.h \ - request.h \ - request_p.h \ - rtm.h \ - rtm_export.h \ - session.h \ - session_p.h \ - task.h \ - task_p.h \ - xmlreaders.h -SOURCES += auth.cpp \ - list.cpp \ - request.cpp \ - session.cpp \ - task.cpp \ - xmlreaders.cpp \ - -contains(MEEGO_EDITION,harmattan) { - target.path = $$PREFIX/lib - INSTALLS += target -} - diff --git a/kdeplasma-addons/libs/rtm/rtm_export.h b/kdeplasma-addons/libs/rtm/rtm_export.h deleted file mode 100644 index 60dfc536..00000000 --- a/kdeplasma-addons/libs/rtm/rtm_export.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_EXPORT_H -#define RTM_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#ifdef QTONLY -#define KDE_EXPORT -#define KDE_IMPORT -#define KDE_DEPRECATED -#else -#include -#endif - -#ifndef RTM_EXPORT -# if defined(MAKE_RTM_LIB) - /* We are building this library */ -# define RTM_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define RTM_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef RTM_EXPORT_DEPRECATED -# define RTM_EXPORT_DEPRECATED KDE_DEPRECATED RTM_EXPORT -# endif - -#endif diff --git a/kdeplasma-addons/libs/rtm/session.cpp b/kdeplasma-addons/libs/rtm/session.cpp deleted file mode 100644 index 29ac8b45..00000000 --- a/kdeplasma-addons/libs/rtm/session.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "session.h" -#include "session_p.h" - -#include "xmlreaders.h" -#include "request.h" -#include "auth.h" -#include "task.h" - -#include -#include -#include -#include -#include -#include - - - - -#include - -#include - -RTM::Session::Session(QString apiKey, QString sharedSecret, RTM::Permissions permissions, QString token, QObject* parent) - : QObject(parent), - d(new SessionPrivate(this)) -{ - d->apiKey = apiKey; - d->sharedSecret = sharedSecret; - d->permissions = permissions; - - connect(this, SIGNAL(tokenCheck(bool)), SLOT(handleValidToken(bool))); - connect(this, SIGNAL(settingsUpdated()), SLOT(createTimeline())); - - setToken(token); -} - -RTM::Session::~Session() -{ - delete d; -} - -bool RTM::Session::currentlyOnline() const { - return d->online; -} - -QString RTM::Session::getAuthUrl() const { - return d->authUrl; -} - -bool RTM::Session::authenticated() const { - return !d->token.isEmpty(); -} - -QString RTM::Session::apiKey() const { - return d->apiKey; -} - -QHash< RTM::ListId, RTM::List* > RTM::Session::cachedLists() const { - return d->lists; -} - -QHash< RTM::TaskId, RTM::Task* > RTM::Session::cachedTasks() const { - return d->tasks; -} - -QStringList RTM::Session::allTags() const { - return d->tags.toList(); -} - -RTM::Permissions RTM::Session::permissions() const { - return d->permissions; -} - -QString RTM::Session::dateFormat() const { - return d->dateFormat; -} - -QString RTM::Session::timeFormat() const { - return d->timeFormat; -} - -QString RTM::Session::sharedSecret() const { - return d->sharedSecret; -} - -RTM::Timeline RTM::Session::getTimeline() const { - return d->timeline; -} - -QString RTM::Session::token() const { - return d->token; -} - -void RTM::Session::setToken(const QString& token) -{ - d->token = token; - d->tasks.clear(); //FIXME: Leak? Tasks/Lists are pointers. - d->lists.clear(); - - checkToken(); -} - -void RTM::Session::handleValidToken(bool valid) -{ - if (d->auth) { - d->auth->deleteLater(); - d->auth = 0; - } - if (!valid) { - d->token.clear(); - d->auth = new RTM::Auth(d->permissions, d->apiKey, d->sharedSecret); - d->authUrl = d->auth->getAuthUrl(); - connect(d->auth, SIGNAL(tokenReceived(QString)), this, SLOT(setToken(QString))); - connect(d->auth, SIGNAL(tokenReceived(QString)), this, SIGNAL(tokenReceived(QString))); - } - else { - d->refreshSettings(); - } -} - - -void RTM::Session::setTimeline(const RTM::Timeline& timeline) { - d->timeline = timeline; -} - -void RTM::Session::continueAuthForToken() -{ - d->auth->continueAuthForToken(); -} - -void RTM::Session::checkToken() { - if (d->token.isEmpty() || !currentlyOnline()) { - emit tokenCheck(false); - return; - } - - RTM::Request *tokenRequest = new RTM::Request("rtm.auth.checkToken", d->apiKey, d->sharedSecret); - d->connectOfflineSignal(tokenRequest); - tokenRequest->addArgument("auth_token", d->token); - connect(tokenRequest, SIGNAL(replyReceived(RTM::Request*)), SLOT(tokenCheckReply(RTM::Request*))); - connect(tokenRequest, SIGNAL(replyReceived(RTM::Request*)), tokenRequest, SLOT(deleteLater())); - tokenRequest->sendRequest(); -} - - -void RTM::Session::tokenCheckReply(RTM::Request* response) -{ - QString reply = response->data(); - - if (!reply.contains(d->token)) { - qDebug() << "Failed Token Check: " << reply; - emit tokenCheck(false); - } else { - qDebug() << "Successful Token Check: " << reply; - emit tokenCheck(true); - } -} - - -void RTM::Session::createTimeline() { - RTM::Request *request = new RTM::Request("rtm.timelines.create", d->apiKey, d->sharedSecret); - request->addArgument("auth_token", d->token); - connect(request, SIGNAL(replyReceived(RTM::Request*)), SLOT(timelineReply(RTM::Request*))); - connect(request, SIGNAL(replyReceived(RTM::Request*)), request, SLOT(deleteLater())); - request->sendRequest(); -} - -void RTM::Session::timelineReply(RTM::Request* response) -{ - QString reply = response->data(); - QString timeline = reply.remove(0, reply.indexOf("")+10); - timeline.truncate(timeline.indexOf("")); - qDebug() << "Timeline: " << timeline; - d->timeline = timeline.toLong(); - d->lastRefresh = QDateTime(); - emit timelineCreated(getTimeline()); -} - - - -void RTM::Session::handleResponse() -{ - //TODO: Move data from buffer to response, then clear buffer. -} - -void RTM::Session::refreshTasksFromServer() { - if (!currentlyOnline()) - return; - - RTM::Request *allTasks = request("rtm.tasks.getList"); - if (d->lastRefresh.isValid()) - allTasks->addArgument("last_sync", d->lastRefresh.toUTC().toString(Qt::ISODate)); - allTasks->setReadOnly(false); - allTasks->sendRequest(); -} - -void RTM::Session::refreshListsFromServer() { - if (!currentlyOnline()) - return; - - RTM::Request *allLists = new RTM::Request("rtm.lists.getList", d->apiKey, d->sharedSecret); - allLists->addArgument("auth_token", d->token); - connectListRequest(allLists); - allLists->sendRequest(); -} - -RTM::Task* RTM::Session::taskFromId(RTM::TaskId id) const { - if (cachedTasks().contains(id)) - return cachedTasks().value(id); - return 0; -} - -RTM::Task* RTM::Session::newBlankTask(RTM::TaskId id) const { - RTM::Task *newTask = Task::uninitializedTask(d->q); //HACK d->q == this but not const - d->tasks.insert(id, newTask); - return newTask; -} - -RTM::List* RTM::Session::listFromId(RTM::ListId id) const { - if (cachedLists().contains(id)) - return cachedLists().value(id); - return 0; -} - -RTM::List* RTM::Session::newBlankList(RTM::ListId id) const { - RTM::List *newList = List::uninitializedList(d->q); //HACK d->q == this but not const - d->lists.insert(id, newList); - return newList; -} - -void RTM::Session::connectTaskRequest(RTM::Request* request) { - connect(request, SIGNAL(replyReceived(RTM::Request*)), this, SLOT(taskUpdate(RTM::Request*))); -} - -void RTM::Session::connectListRequest(RTM::Request* request) { - connect(request, SIGNAL(replyReceived(RTM::Request*)), this, SLOT(listUpdate(RTM::Request*))); -} - -RTM::Request* RTM::Session::request(const QString& method) { - RTM::Request *request = new RTM::Request(method, apiKey(), sharedSecret()); - d->connectOfflineSignal(request); - request->addArgument("auth_token", token()); - connectTaskRequest(request); - return request; -} - -void RTM::Session::addTask(const QString& task, RTM::ListId listId) -{ - if (!currentlyOnline()) - return; - - RTM::List* list = listFromId(listId); - - qDebug() << "Adding Task: " << task << "to list with id: " << listId; - RTM::Request *newTask = request("rtm.tasks.add"); // auth token is done for us - newTask->addArgument("name", task); - newTask->addArgument("parse", "1"); - if (list && !list->isSmart()) - newTask->addArgument("list_id", QString::number(listId)); - newTask->addArgument("timeline", QString::number(getTimeline())); - newTask->setReadOnly(false); - - newTask->sendRequest(); -} - -void RTM::Session::addList(const QString &list, const QString &filter) -{ - if (!currentlyOnline()) - return; - - qDebug() << "Adding List: " << list << " to lists"; - RTM::Request *newList = request("rtm.lists.add"); - newList->addArgument("name", list); - newList->addArgument("timeline", QString::number(getTimeline())); - if (!filter.isEmpty()) - newList->addArgument("filter", filter); - newList->setReadOnly(false); - - newList->sendRequest(); -} - -#include "moc_session.cpp" diff --git a/kdeplasma-addons/libs/rtm/session.h b/kdeplasma-addons/libs/rtm/session.h deleted file mode 100644 index d39e18f4..00000000 --- a/kdeplasma-addons/libs/rtm/session.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * Copyright 2012 Jeremy Whiting - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_SESSION_H -#define RTM_SESSION_H - -#include -#include - -#include "rtm.h" - -#ifndef QTONLY -#include -#endif - -/** @file - * This file is part of librtm. It defines - * the RTM::Session which is the main high-level - * interface to a Remember The Milk session - * - * @author Andrew Stromme - */ - -/** - * Provides a set of classes for interacting with the Remember The Milk online todo management service - */ -namespace RTM { - -class Request; -class SessionPrivate; -class Task; -class TasksReader; - -/** - * @brief The Session class provides a high level interface to a Remember The Milk session - * - * @author Andrew Stromme - */ -class RTM_EXPORT Session : public QObject -{ -Q_OBJECT - public: - Session(QString apiKey, QString sharedSecret, RTM::Permissions permissions, QString token = QString(), QObject *parent = 0); - virtual ~Session(); - - Q_INVOKABLE QString getAuthUrl() const; - bool authenticated() const; - - RTM::Request* request(const QString& method); - void connectTaskRequest(RTM::Request *request); - void connectListRequest(RTM::Request *request); - - void setTimeline(const RTM::Timeline& timeline); - RTM::Timeline getTimeline() const; - - void checkToken(); - bool currentlyOnline() const; - - QString apiKey() const; - QString sharedSecret() const; - QString token() const; - RTM::Permissions permissions() const; - - Q_INVOKABLE QString dateFormat() const; - Q_INVOKABLE QString timeFormat() const; - - void refreshTasksFromServer(); - void refreshListsFromServer(); - QHash cachedTasks() const; - QHash cachedLists() const; - /** - * Get all known tags. - */ - QStringList allTags() const; - - RTM::Task* taskFromId(RTM::TaskId id) const; - RTM::Task* newBlankTask(RTM::TaskId id) const; - - RTM::List* listFromId(RTM::ListId id) const; - RTM::List* newBlankList(RTM::ListId id) const; - - public Q_SLOTS: - void setToken(const QString &token); - void handleResponse(); - void continueAuthForToken(); - void addTask(const QString &task, RTM::ListId listId); - void addList(const QString &list, const QString &filter = QString()); - void tokenCheckReply(RTM::Request*); - void handleValidToken(bool); - void timelineReply(RTM::Request*); - void createTimeline(); - - Q_SIGNALS: - void tokenReceived(const QString& token); - void tokenCheck(bool success); - - void settingsUpdated(); - void timelineCreated(RTM::Timeline timeline); - - void taskChanged(RTM::Task* task); - void listChanged(RTM::List* list); - - void tasksChanged(); - void listsChanged(); - - private: - friend class TasksReader; - friend class SessionPrivate; - SessionPrivate * const d; - - Q_PRIVATE_SLOT(d, void taskUpdate(RTM::Request* reply)) - Q_PRIVATE_SLOT(d, void listUpdate(RTM::Request* reply)) - Q_PRIVATE_SLOT(d, void smartListReply(RTM::Request* reply)) - Q_PRIVATE_SLOT(d, void settingsReply(RTM::Request* reply)) -#ifndef QTONLY - Q_PRIVATE_SLOT(d, void networkStatusChanged(Solid::Networking::Status)) -#endif - Q_PRIVATE_SLOT(d, void offlineError()) - Q_PRIVATE_SLOT(d, void retestOfflineStatus()) -}; - -} // Namespace RTM -#endif diff --git a/kdeplasma-addons/libs/rtm/session_p.h b/kdeplasma-addons/libs/rtm/session_p.h deleted file mode 100644 index 464401d5..00000000 --- a/kdeplasma-addons/libs/rtm/session_p.h +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_SESSION_P_H -#define RTM_SESSION_P_H - -#include "session.h" - -#include "xmlreaders.h" -#include "request.h" -#include "auth.h" -#include "task.h" - -#include -#include -#include -#include -#include -#include -#include - - - -#include -#include -#include - -#ifndef QTONLY -#include -#include -#include -#endif - -class RTM::SessionPrivate { - SessionPrivate(Session *parent) - : q(parent), - auth(0), - online(true), - tasksChanged(false), - listsChanged(false) - { -#ifndef QTONLY - QObject::connect(Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)), q, SLOT(networkStatusChanged(Solid::Networking::Status))); - if (Solid::Networking::status() == Solid::Networking::Unconnected) { - online = false; - qDebug() << "We are NOT Online :("; - } -#endif - } - ~SessionPrivate() { - if (auth) - auth->deleteLater(); - } - -#ifndef QTONLY - void networkStatusChanged(Solid::Networking::Status status) { - switch (status) { - case Solid::Networking::Connected: - case Solid::Networking::Unknown: - if (online) - return; - - online = true; - q->checkToken(); - refreshSettings(); - break; - case Solid::Networking::Unconnected: - case Solid::Networking::Disconnecting: - case Solid::Networking::Connecting: - if (!online) - return; - - online = false; - break; - } - } -#endif - - void offlineError() { - online = false; - qDebug() << "retesting offline status in 60 seconds"; - QTimer::singleShot(60*1000, q, SLOT(retestOfflineStatus())); - } - - void retestOfflineStatus() { - online = true; - qDebug() << "retesting offline status"; - q->checkToken(); - } - - void connectOfflineSignal(RTM::Request *request) { - QObject::connect(request, SIGNAL(offlineError()), q, SLOT(offlineError())); - } - - void populateSmartList(List * list) - { - if (!online) - return; - - qDebug() << "Populating Smart List: " << list->name() << " with id " << list->id(); - // We do this next bit manually so it doesn't get auto-connected to taskUpdate() - RTM::Request *smartListRequest = new RTM::Request("rtm.tasks.getList", q->apiKey(), q->sharedSecret()); - smartListRequest->addArgument("auth_token", q->token()); - smartListRequest->addArgument("list_id", QString::number(list->id())); - smartListRequest->addArgument("filter", list->filter()); - - QObject::connect(smartListRequest, SIGNAL(replyReceived(RTM::Request*)), q, SLOT(smartListReply(RTM::Request*))); - - smartListRequest->sendRequest(); - } - - void updateSmartLists() { - if (!online) - return; - - foreach (RTM::List* list, lists) { - if (list->isSmart()) { - populateSmartList(list); - } - } - } - - void taskUpdate(RTM::Request* reply) { - TasksReader reader(reply, q); - reader.read(); - lastRefresh = QDateTime::currentDateTime(); - reply->deleteLater(); - applyTaskChanges(); - if (!reply->readOnly()) { - updateSmartLists(); - } else { - completeTaskChanges(); - } - } - - void listUpdate(RTM::Request* reply) { - TasksReader reader(reply, q); - reader.read(); - reply->deleteLater(); - applyListChanges(); - if (reply->readOnly()) { - completeListChanges(); - } - } - - void applyTaskChanges() { - foreach(RTM::Task* task, changedTasks) { - tags.unite(task->tags().toSet()); - emit q->taskChanged(task); - } - - if (changedTasks.count() > 0) { - tasksChanged = true; - } - - changedTasks.clear(); - qDebug() << "taskchanges complete, tags contains " << tags; - } - - void completeTaskChanges() { - if (tasksChanged) { - emit q->tasksChanged(); - } - - tasksChanged = false; - } - - void applyListChanges() { - foreach(RTM::List* list, changedLists) { - emit q->listChanged(list); - } - - if (changedLists.count() > 0) { - listsChanged = true; - } - - changedLists.clear(); - } - - void completeListChanges() { - if (listsChanged) { - emit q->listsChanged(); - } - - listsChanged = false; - } - - void applyChanges() { - applyTaskChanges(); - completeTaskChanges(); - applyListChanges(); - completeListChanges(); - } - - void smartListReply(RTM::Request* reply) { - QStringList parts = reply->requestUrl().split("&"); - RTM::ListId id = 0; - foreach(const QString &part, parts) - if (part.contains("list_id")) - id = part.split("=").last().toLongLong(); - - qDebug() << id; - TasksReader reader(reply, q); - reader.read(); - RTM::List* list = lists.value(id); - if (list) { - list->setTasks(changedTasks); - changedLists.push_back(list); - } - applyChanges(); - - reply->deleteLater(); - } - - void settingsReply(RTM::Request* request) { - QString reply = request->data(); // Get the full data of the reply, readAll() doesn't guarentee that. - - // We're basically assuming no error here.... FIXME - QString timezone = reply.remove(0, reply.indexOf("")+10); - timezone.truncate(timezone.indexOf("")); - QString dateformat = reply.remove(0, reply.indexOf(""+12)); - dateformat.truncate(dateformat.indexOf("")); - this->dateFormat = (dateformat.toInt() == 0 ? "dd/MM/yy" : "MM/dd/yy"); - QString timeformat = reply.remove(0, reply.indexOf(""+12)); - timeformat.truncate(timeformat.indexOf("")); - this->timeFormat = (timeformat.toInt() == 0 ? "hh:mm ap" : "hh:mm"); - QString defaultlist = reply.remove(0, reply.indexOf(""+13)); - defaultlist.truncate(defaultlist.indexOf("")); - -#ifndef QTONLY - this->timezone = KSystemTimeZones::zone(timezone); - qDebug() << "Timezone Set To: " << timezone << " i.e. " << this->timezone.name(); -#endif - - request->deleteLater(); - emit q->settingsUpdated(); - } - void refreshSettings() { - if (!online) - return; - - RTM::Request *settingsRequest = new RTM::Request("rtm.settings.getList", q->apiKey(), q->sharedSecret()); - settingsRequest->addArgument("auth_token", q->token()); - - QObject::connect(settingsRequest, SIGNAL(replyReceived(RTM::Request*)), q, SLOT(settingsReply(RTM::Request*))); - settingsRequest->sendRequest(); - } - - - friend class TasksReader; - friend class Session; - Session *q; - RTM::Auth *auth; - QString authUrl; - QString frob; - QString apiKey; - QString sharedSecret; - QString token; - QDateTime lastRefresh; - bool online; - RTM::Permissions permissions; -#ifndef QTONLY - KTimeZone timezone; -#endif - QString dateFormat; // user's dateformat choice: 0 - DD/MM/YY ,1 - MM/DD/YY - QString timeFormat; // user's timeformat choice: 0 - hh:mm ap ,1 - hh:mm - - RTM::Timeline timeline; - - QHash tasks; - QHash lists; - QSet tags; - - QList changedTasks; - QList changedLists; - - bool tasksChanged; - bool listsChanged; -}; - -#endif diff --git a/kdeplasma-addons/libs/rtm/task.cpp b/kdeplasma-addons/libs/rtm/task.cpp deleted file mode 100644 index e9c1d2b2..00000000 --- a/kdeplasma-addons/libs/rtm/task.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "task.h" -#include "task_p.h" - -#include - -#include "request.h" -#include "session.h" -#include "xmlreaders.h" - -RTM::Task::Task(RTM::Session* session) - : QObject(session), - d(new TaskPrivate(this)) -{ - d->session = session; -} - -RTM::Task::~Task() { - delete d; -} - -QDateTime RTM::Task::completed() const { - return d->completed; -} -QDateTime RTM::Task::deleted() const { - return d->deleted; -} -QDateTime RTM::Task::due() const { - return d->due; -} -QString RTM::Task::estimate() const { - return d->estimate; -} -RTM::TaskId RTM::Task::id() const { - return d->taskId; -} -bool RTM::Task::isCompleted() const { - return d->completed.isValid(); -} -bool RTM::Task::isDeleted() const { - return d->deleted.isValid(); -} -RTM::ListId RTM::Task::listId() const { - return d->listId; -} -RTM::LocationId RTM::Task::locationId() const { - return d->locationId; -} -QString RTM::Task::name() const { - return d->name; -} -Notes RTM::Task::notes() const { - return d->notes; -} -int RTM::Task::priority() const { - return d->priority; -} -QString RTM::Task::repeatString() const { - return d->repeatString; -} -RTM::TaskSeriesId RTM::Task::seriesId() const { - return d->seriesId; -} -QStringList RTM::Task::tags() const { - return QStringList(d->tags); -} -QString RTM::Task::url() const { - return d->url; -} - -int RTM::Task::decreasePriority() { - d->priority--; - RTM::Request *request = d->standardRequest("rtm.tasks.movePriority"); - request->addArgument("direction", "down"); - request->sendRequest(); - return d->priority; -} -int RTM::Task::increasePriority() { - d->priority++; - RTM::Request *request = d->standardRequest("rtm.tasks.movePriority"); - request->addArgument("direction", "up"); - request->sendRequest(); - return d->priority; -} -void RTM::Task::setCompleted(bool completed) { - if (isCompleted() == completed) - return; - - RTM::Request *request; - if (completed) { - d->completed = QDateTime::currentDateTime(); - request = d->standardRequest("rtm.tasks.complete"); - } - else { - d->completed = QDateTime(); - request = d->standardRequest("rtm.tasks.uncomplete"); - } - - request->sendRequest(); -} -void RTM::Task::setDeleted(bool deleted) { - if (isDeleted() == deleted) - return; - - RTM::Request *request; - if (deleted) { - d->deleted = QDateTime::currentDateTime(); - request = d->standardRequest("rtm.tasks.delete"); - } - else { - qDebug() << "ERROR: RTM Does not allow undeleting tasks!"; - d->deleted = QDateTime(); - request = d->standardRequest("rtm.tasks.undelete"); - } - - request->sendRequest(); -} -void RTM::Task::setList(RTM::ListId listId) { - RTM::ListId oldlist = d->listId; - d->listId = listId; - - RTM::Request *request = d->session->request("rtm.tasks.moveTo"); - request->addArgument("timeline", QString::number(d->session->getTimeline())); - request->addArgument("from_list_id", QString::number(oldlist)); - request->addArgument("to_list_id", QString::number(listId)); - request->addArgument("taskseries_id", QString::number(d->seriesId)); - request->addArgument("task_id", QString::number(d->taskId)); -} -void RTM::Task::postpone() { - //WARNING: Doesn't update task, only sends network request - RTM::Request *request = d->standardRequest("rtm.tasks.postpone"); - request->sendRequest(); -} -void RTM::Task::addTag(const RTM::Tag& tag) { - if (d->tags.contains(tag)) - return; - d->tags.append(tag); - - RTM::Request *request = d->standardRequest("rtm.tasks.addTags"); - request->addArgument("tags", tag); - request->sendRequest(); -} -void RTM::Task::removeAllTags() { - d->tags.clear(); - RTM::Request *request = d->standardRequest("rtm.tasks.setTags"); - request->addArgument("tags", ""); - request->sendRequest(); -} -bool RTM::Task::removeTag(const RTM::Tag& tag) { - if (!d->tags.contains(tag)) - return false; - d->tags.removeAll(tag); - - RTM::Request *request = d->standardRequest("rtm.tasks.removeTags"); - request->addArgument("tags", tag); - request->sendRequest(); - return true; -} -void RTM::Task::setTags(const QStringList &tags) { - RTM::Request *request = d->standardRequest("rtm.tasks.setTags"); - request->addArgument("tags", tags.join(",")); - request->sendRequest(); -} -void RTM::Task::setNotes(const Notes& notes) { - Q_UNUSED(notes) - qDebug() << "NOT IMPLEMENTED"; //FIXME Implement -} -void RTM::Task::addNote(const QString& title, const QString& text) { - //notes.insert(note.getId(), note); - - RTM::Request *request = d->standardRequest("rtm.tasks.notes.add"); - request->addArgument("note_title", title); - request->addArgument("note_text", text); - request->sendRequest(); -} -bool RTM::Task::editNote(RTM::NoteId noteid, const QString& newTitle, const QString& newText) { - if (!d->notes.contains(noteid)) - return false; - - RTM::Request *request = d->session->request("rtm.tasks.notes.edit"); // Only a simple request is needed - request->addArgument("timeline", QString::number(d->session->getTimeline())); - request->addArgument("note_id", QString::number(noteid)); - request->addArgument("note_title", newTitle); - request->addArgument("note_text", newText); - request->sendRequest(); - return true; -} -void RTM::Task::removeAllNotes() { - QList keys = d->notes.keys(); - foreach(const RTM::NoteId &id, keys) - removeNote(id); -} -bool RTM::Task::removeNote(RTM::NoteId noteid) { - if (!d->notes.contains(noteid)) - return false; - - RTM::Request *request = d->session->request("rtm.tasks.notes.delete"); // Only a simple request is needed - request->addArgument("timeline", QString::number(d->session->getTimeline())); - request->addArgument("note_id", QString::number(noteid)); - request->sendRequest(); - return true; -} -void RTM::Task::setDue(const QDateTime& due) { - if (d->due == due) - return; - d->due = due; - - RTM::Request *request = d->standardRequest("rtm.tasks.setDueDate"); - if (due.isValid()) { - request->addArgument("due", d->due.toString(Qt::ISODate)); - request->addArgument("parse", "1"); - if (due.time().isValid()) - request->addArgument("has_due_time", "1"); - } - request->sendRequest(); -} -void RTM::Task::setDue(const QString& date) { - RTM::Request *request = d->standardRequest("rtm.tasks.setDueDate"); - request->addArgument("due", date); - request->addArgument("parse", "1"); - request->sendRequest(); -} - -void RTM::Task::removeDue() -{ - RTM::Request *request = d->standardRequest("rtm.tasks.setDueDate"); - request->sendRequest(); -} - -void RTM::Task::setEstimate(const QString& estimate) { - if (d->estimate == estimate) - return; - d->estimate = estimate; - - qDebug() << "Setting Estimate to: " << estimate; - - RTM::Request *request = d->standardRequest("rtm.tasks.setEstimate"); - request->addArgument("estimate", estimate); - request->sendRequest(); -} -void RTM::Task::setLocationId(RTM::LocationId locationid) { - d->locationId = locationid; - - RTM::Request *request = d->standardRequest("rtm.tasks.setLocation"); - request->addArgument("location_id", QString::number(locationid)); -} -void RTM::Task::setName(const QString& name) { - if (d->name == name) - return; - d->name = name; - - RTM::Request *request = d->standardRequest("rtm.tasks.setName"); - request->addArgument("name", name); - request->sendRequest(); -} -void RTM::Task::setPriority(int priority) { - if (d->priority == priority) - return; - d->priority = priority; - - RTM::Request *request = d->standardRequest("rtm.tasks.setPriority"); - request->addArgument("priority", QString::number(priority)); - request->sendRequest(); -} -void RTM::Task::setRepeatString(const QString& repeatString) { - if (d->repeatString == repeatString) - return; - d->repeatString = repeatString; - - RTM::Request *request = d->standardRequest("rtm.tasks.setRecurrence"); - request->addArgument("repeat", repeatString); -} -void RTM::Task::setUrl(const QString& url) { - if (d->url == url) - return; - d->url = url; - - RTM::Request *request = d->standardRequest("rtm.tasks.setUrl"); - request->addArgument("url", url); -} - -void RTM::Task::undoLastAction() { - //TODO: Implement -} - -RTM::Task* RTM::Task::uninitializedTask(RTM::Session* session) { - return new Task(session); -} - -#include "moc_task.cpp" diff --git a/kdeplasma-addons/libs/rtm/task.h b/kdeplasma-addons/libs/rtm/task.h deleted file mode 100644 index 1e0a3d93..00000000 --- a/kdeplasma-addons/libs/rtm/task.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_TASK_H -#define RTM_TASK_H - -// Qt Includes - -#include -#include -#include -#include - -// Local Includes -#include "rtm.h" -#include "note.h" -#include - -namespace RTM { - -class TaskPrivate; -class Session; - -class RTM_EXPORT Task : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QStringList tags READ tags WRITE setTags) - Q_PROPERTY(qulonglong listId READ listId WRITE setList) - Q_PROPERTY(QDateTime completedTime READ completed) - Q_PROPERTY(bool isCompleted READ isCompleted WRITE setCompleted) - Q_PROPERTY(bool isDeleted READ isDeleted WRITE setDeleted) - Q_PROPERTY(QDateTime deletedTime READ deleted) - Q_PROPERTY(int priority READ priority WRITE setPriority) - Q_PROPERTY(QDateTime due READ due WRITE setDue) - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(qulonglong seriesId READ seriesId) - Q_PROPERTY(QString estimate READ estimate WRITE setEstimate) - Q_PROPERTY(qulonglong locationId READ locationId WRITE setLocationId) - Q_PROPERTY(QString repeatString READ repeatString WRITE setRepeatString) - Q_PROPERTY(QString url READ url WRITE setUrl) - Q_PROPERTY(qulonglong id READ id) - //Q_PROPERTY(Notes notes READ notes WRITE setNotes) - - public: - virtual ~Task(); - - static Task* uninitializedTask(RTM::Session* session); - - QStringList tags() const; - RTM::ListId listId() const; - QDateTime completed() const; - bool isCompleted() const; - bool isDeleted() const; - QDateTime deleted() const; - int priority() const; - QDateTime due() const; - QString name() const; - RTM::TaskSeriesId seriesId() const; - QString estimate() const; - LocationId locationId() const; - QString repeatString() const; - QString url() const; - RTM::TaskId id() const; - Notes notes() const; - - void setTags(const QStringList &tags); - void setList(ListId listId); - void setCompleted(bool completed); - void setDeleted(bool deleted); - void setPriority(int priority); - void setDue(const QDateTime& dueDate); - void setDue(const QString& date); - void setName(const QString& name); - void setEstimate(const QString& estimate); - void setLocationId(LocationId locationid); - void setRepeatString(const QString& repeatString); - void setUrl(const QString& url); - void setNotes(const Notes& notes); - - void addTag(const Tag& tag); - bool removeTag(const Tag& tag); - void removeAllTags(); - Q_INVOKABLE void removeDue(); - - void addNote(const QString& title, const QString& text); - bool editNote(RTM::NoteId noteid, const QString& newTitle, const QString& newText); - bool removeNote(RTM::NoteId noteid); - void removeAllNotes(); - - void postpone(); - - int increasePriority(); // Returns priority - int decreasePriority(); - - void undoLastAction(); - - private: - Task(RTM::Session* session); - - friend class TasksReader; - friend class TaskPrivate; - TaskPrivate * const d; -}; - -} // namespace RTM - -#endif diff --git a/kdeplasma-addons/libs/rtm/task_p.h b/kdeplasma-addons/libs/rtm/task_p.h deleted file mode 100644 index 1e7d9d5c..00000000 --- a/kdeplasma-addons/libs/rtm/task_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef RTM_TASK_P_H -#define RTM_TASK_P_H - -#include "task.h" - -#include "request.h" -#include "session.h" - - -class RTM::TaskPrivate { - TaskPrivate(Task *parent) - : q(parent) - { - - } - - RTM::Request *standardRequest(const QString& method) - { - RTM::Request *request = session->request(method); // auth token is done for us - request->addArgument("timeline", QString::number(session->getTimeline())); - request->addArgument("list_id", QString::number(listId)); - request->addArgument("taskseries_id", QString::number(seriesId)); - request->addArgument("task_id", QString::number(taskId)); - request->setReadOnly(false); - return request; - } - - friend class Task; - friend class TasksReader; - Task *q; - - RTM::Session *session; - - RTM::TaskId taskId; - QList tags; - ListId listId; - int priority; - RTM::TaskSeriesId seriesId; - QDateTime due; - QDateTime completed; - QDateTime deleted; - QString estimate; - LocationId locationId; - QString name; - QString repeatString; - QString url; - - QHash notes; - -}; - -#endif // RTM_TASK_P_H diff --git a/kdeplasma-addons/libs/rtm/tests/CMakeLists.txt b/kdeplasma-addons/libs/rtm/tests/CMakeLists.txt deleted file mode 100644 index 5ede10a5..00000000 --- a/kdeplasma-addons/libs/rtm/tests/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) - -if(QT_QTWEBKIT_FOUND) - add_executable(rtmlogin login.cpp) - target_link_libraries(rtmlogin - ${KDE4_KDEUI_LIBS} - ${KDE4_KDEWEBKIT_LIBS} - rtm - ${QT_QTSCRIPT_LIBRARY} - ) -endif() - -#add_executable(rtmrefresh refresh.cpp) -#target_link_libraries(rtmrefresh ${KDE4_KDEUI_LIBS} rtm ${QT_QTSCRIPT_LIBRARY}) diff --git a/kdeplasma-addons/libs/rtm/tests/login.cpp b/kdeplasma-addons/libs/rtm/tests/login.cpp deleted file mode 100644 index 81732d8f..00000000 --- a/kdeplasma-addons/libs/rtm/tests/login.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "session.h" - -#include "loginwidget.cpp" - -#include -#include -#include -#include -#include - -int main(int argc, char* argv[]) { - KAboutData about("login", 0, ki18n("RTM Login Test"), "1.0", ki18n("A Simple RTM Login Test"), - KAboutData::License_GPL, ki18n("(C) 2009 Andrew Stromme"), KLocalizedString(), 0, "astromme@chatonka.com"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - RTM::Session *session = new RTM::Session("myapikey", "mysharedsecret", RTM::Delete, QString(), &app); - - LoginWidget *login = new LoginWidget(); - login->setWebUrl(session->getAuthUrl()); - login->show(); - - return app.exec(); -} - diff --git a/kdeplasma-addons/libs/rtm/tests/loginwidget.cpp b/kdeplasma-addons/libs/rtm/tests/loginwidget.cpp deleted file mode 100644 index e31e6921..00000000 --- a/kdeplasma-addons/libs/rtm/tests/loginwidget.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include -#include -#include - -class LoginWidget: public QWidget -{ - public: - LoginWidget(QObject *parent = 0) - { - webview = new KWebView(this); - button = new QPushButton("Press after authenticating", this); - - QVBoxLayout *layout = new QVBoxLayout(this); - layout->addWidget(webview); - layout->addWidget(button); - } - - void setWebUrl(const QString &url) - { - webview->setUrl(url); - } - - private: - KWebView *webview; - QPushButton *button; -}; - diff --git a/kdeplasma-addons/libs/rtm/tests/refresh.cpp b/kdeplasma-addons/libs/rtm/tests/refresh.cpp deleted file mode 100644 index 7b26079a..00000000 --- a/kdeplasma-addons/libs/rtm/tests/refresh.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -#include "session.h" - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - - -class Refresher : public QObject -{ - Q_OBJECT - - public: - Refresher() {} - ~Refresher() {} - - RTM::Session *session; - - public slots: - void refresh() { - qDebug() << "Refreshing"; - session->refreshListsFromServer(); - session->refreshTasksFromServer(); - } -}; - -int main(int argc, char* argv[]) { - KAboutData about("login", 0, ki18n("RTM Refresh Test"), "1.0", ki18n("A Simple RTM Refresh Test"), - KAboutData::License_GPL, ki18n("(C) 2009 Andrew Stromme"), KLocalizedString(), 0, "astromme@chatonka.com"); - - KCmdLineArgs::init(argc, argv, &about); - KApplication app; - - RTM::Session *session = new RTM::Session("myapikey", "mysharedsecret", RTM::Delete, QString(), &app); - - session->showLoginWindow(); - - Refresher refresher; - refresher.session = session; - - QTimer timer; - QObject::connect(&timer, SIGNAL(timeout()), &refresher, SLOT(refresh())); - timer.start(3000); - - QTimer quit; - QObject::connect(&quit, SIGNAL(timeout()), &app, SLOT(quit())); - timer.start(4000); - - app.exec(); -} - -#include "refresh.moc" diff --git a/kdeplasma-addons/libs/rtm/xmlreaders.cpp b/kdeplasma-addons/libs/rtm/xmlreaders.cpp deleted file mode 100644 index b2c262e9..00000000 --- a/kdeplasma-addons/libs/rtm/xmlreaders.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "xmlreaders.h" - -#include "note.h" -#include "request.h" - -#include "session.h" -#include "session_p.h" - -#include "task.h" -#include "task_p.h" - -#include -#include -#include - - -struct TempProps { - QString name; - RTM::TaskSeriesId seriesId; - RTM::ListId listId; - QHash notes; - QList tags; -}; - - -RTM::TasksReader::TasksReader(RTM::Request* r, RTM::Session* s) - : QXmlStreamReader(r), - session(s), - request(r) -{ - Q_ASSERT(r); - Q_ASSERT(s); - - request->open(QIODevice::ReadOnly); - request->seek(0); -} - - -QDateTime RTM::TasksReader::parseDateTime(const QString& datetime) -{ - QDateTime offsetTime = QDateTime::fromString(datetime, Qt::ISODate); - return localizedTime(offsetTime); -} - -QDateTime RTM::TasksReader::localizedTime(const QDateTime& datetime) -{ - QDateTime dt = QDateTime(datetime.date(), datetime.time(), Qt::LocalTime); -#ifndef QTONLY - KTimeZone utc = KSystemTimeZones::zone("UTC"); - KTimeZone rtm = session->d->timezone; - //qDebug() << datetime << dt << utc.convert(rtm, dt); - return utc.convert(rtm, dt); -#else - return datetime; -#endif -} - -bool RTM::TasksReader::read() { - while (!atEnd()) { - readNext(); - // if (isEndElement()) - // Do I need to close/save my task? - if (isStartElement()) { - if (name().toString() == "rsp") - readResponse(); - else - readUnknownElement(); - } - } - - this->device()->close(); - return true; // !error(); -} - - -bool RTM::TasksReader::readResponse() { - if (attributes().value("stat") != "ok") { - //TODO: Provide more meaningful error - return false; - } - - while (!atEnd()) { - readNext(); - if (isEndElement()) { - return true; - } - - if (isStartElement()) { - if (name() == "tasks") - readTasksHeader(); - else if (name() == "lists") - readListsHeader(); - else if (name() == "transaction") - readTransaction(); - else - readUnknownElement(); - } - } - qDebug() << "Reached the end of readResponse() where we shouldn't have" << name().toString() << text().toString(); - qDebug() << "Attributes:"; - - for(int i=0; i < attributes().count(); i++) - { qDebug() << attributes().at(i).name().toString() << attributes().at(i).value().toString(); } - return false; -} - -void RTM::TasksReader::readTransaction() { - // If we're not using a getList method we need to jump to the correct spot - QStringList splitMethod = request->method().split('.'); - - readNext(); - - if (splitMethod.at(splitMethod.count() - 2) == "tasks") - readTasksHeader(); - else if (splitMethod.at(splitMethod.count() - 2) == "lists") - readListsHeader(); - else { - qDebug() << "Unknown Method: " << splitMethod.join("."); - readUnknownElement(); - } -} - - -void RTM::TasksReader::readUnknownElement() { - qDebug() << "Unknown Element: " << tokenString() << name().toString() << text().toString(); - qDebug() << "Attributes:"; - - for(int i=0; i < attributes().count(); i++) - { qDebug() << attributes().at(i).name().toString() << attributes().at(i).value().toString(); } - - while(!atEnd()) { - readNext(); - - if (isEndElement()) - break; - - if (isStartElement()) - readUnknownElement(); - } -} - -void RTM::TasksReader::readFilter(RTM::List* list) { - list->setFilter(readElementText()); - qDebug() << "Filter for list: " << list->name() << " is " << list->filter(); -// while (!atEnd()) { -// readNext(); -// if (isEndElement()) -// return; -// if (isStartElement()) -// readUnknownElement(); -// } -} - -void RTM::TasksReader::readList() { - RTM::List *list = session->listFromId(attributes().value("id").toString().toULong()); - if (!list) - list = session->newBlankList(attributes().value("id").toString().toULong()); - list->setId(attributes().value("id").toString().toULong()); - list->setName(attributes().value("name").toString()); - list->setSmart(attributes().value("smart").toString() == "1" ? true : false); - list->setSortOrder(RTM::List::SortOrder(attributes().value("sort_order").toString().toUInt())); - list->setPosition(attributes().value("position").toString().toULong()); - - if (!session->d->changedLists.contains(list)) { - session->d->changedLists.append(list); - } - - while (!atEnd()) { - readNext(); - if (isEndElement()) { - session->d->lists.insert(list->id(), list); - return; - } - if (isStartElement()) { - if (name() == "filter") - readFilter(list); - else - readUnknownElement(); - } - } -} - -void RTM::TasksReader::readListsHeader() { - while (!atEnd()) { - readNext(); - if (isEndElement()) { - return; - } - - if (isStartElement()) { - if (name() == "list") - readList(); - else - readUnknownElement(); - } - } -} - - -void RTM::TasksReader::readNotes(TempProps* props) { - //qDebug() << "Notes not supported yet"; - if (isEndElement()) - return; - - while (!atEnd()) { - readNext(); - if ((isEndElement()) && (name().toString() == "notes")) - break; - - if (isEndElement()) - continue; // end of a note - - if ((isStartElement()) && (name().toString() == "note")) { - RTM::Note note(attributes().value("id").toString().toULong(), attributes().value("title").toString(), readElementText()); - props->notes.insert(note.id(), note); - } - else - readUnknownElement(); - } -} - -void RTM::TasksReader::readParticipants(TempProps* props) { - Q_UNUSED(props); - //qDebug() << "Participants not supported yet"; - if (isEndElement()) - return; - - while (!atEnd()) { - readNext(); - if ((isEndElement()) && (name().toString() == "participants")) - break; - } -} - -void RTM::TasksReader::readTags(TempProps* props) { - if (isEndElement()) - return; - - while (!atEnd()) { - readNext(); - if ((isEndElement()) && (name().toString() == "tags")) - break; - if (isEndElement()) - continue; - - if ((isStartElement()) && (name().toString() == "tag")) - props->tags.append(readElementText()); - else - readUnknownElement(); - } -} - -void RTM::TasksReader::readTask(TempProps *props) { - RTM::Task *task = session->taskFromId(attributes().value("id").toString().toLongLong()); - if (!task) - task = session->newBlankTask(attributes().value("id").toString().toLongLong()); - - task->d->name = props->name; - task->d->seriesId = props->seriesId; - task->d->listId = props->listId; - - task->d->notes = props->notes; - task->d->tags = props->tags; - - RTM::List *list = session->listFromId(props->listId); - if (!list) - list = session->newBlankList(props->listId); - - if (!session->d->changedTasks.contains(task)) { - session->d->changedTasks.append(task); - } - - if (!session->d->changedLists.contains(list)) { - session->d->changedLists.append(list); - } - - // Grab ID - task->d->taskId = attributes().value("id").toString().toULong(); - - // Grab Priority - if (attributes().value("priority") == "N") - task->d->priority = 4; - else - task->d->priority = attributes().value("priority").toString().toInt(); - - // Grab Due Date/Time - task->d->due = parseDateTime(attributes().value("due").toString()); - // if (attributes().value("has_due_time") == "0") BUG: FIXME: Re-Implement time support - - // Grab Estimate - task->d->estimate = attributes().value("estimate").toString(); - - // Grab Completed/Deleted - task->d->completed = parseDateTime(attributes().value("completed").toString()); - task->d->deleted = parseDateTime(attributes().value("deleted").toString()); - if (!task->d->deleted.isNull()) - task->setDeleted(true); - - // TODO:: Grab Postponed - // TODO: Parse rest of fields - - //qDebug() << "Adding Task: " << task->id() << " to list " << list->id() << "(" << list << ")"; - if (!task->isDeleted()) - list->addTask(task); - else - list->removeTask(task); - - session->d->tasks.insert(task->id(), task); - - while (!atEnd()) { - readNext(); - if (isEndElement()) - break; - if (isStartElement()) - { qDebug() << "readTask().readNext(): " << name().toString(); } - } -} - -void RTM::TasksReader::readTaskSeries(RTM::ListId listId) { - - TempProps props; - props.name = attributes().value("name").toString(); - props.seriesId = attributes().value("id").toString().toULong(); - props.listId = listId; - - while(!atEnd()) { - readNext(); - - if ((isEndElement()) && (name().toString() == "taskseries")) { - break; - } - if (isEndElement()) { - qDebug() << "Error in readTaskSeries() with end element: " << name().toString(); - break; - } - - if (isStartElement()) { - if (name().toString() == "tags") - readTags(&props); - else if (name().toString() == "participants") - readParticipants(&props); - else if (name().toString() == "notes") - readNotes(&props); - else if (name().toString() == "task") - readTask(&props); - else if (name().toString() == "tasks") // in case 'deleted' branch - readTask(&props); - else - readUnknownElement(); - } - } - -} - -void RTM::TasksReader::readTasksHeader() { - while (!atEnd()) { - readNext(); - if (isEndElement()) { - return; - } - if (isStartElement()) { - if (name() == "list") - readTasksList(); - else - readUnknownElement(); - } - } -} - -void RTM::TasksReader::readTasksList() { - RTM::ListId currentListId = attributes().value("id").toString().toULong(); - while(!atEnd()) { - readNext(); - if ((isEndElement()) && (name() == "list")) { - break; - } - if (isEndElement()) { - //Error in readTasksList() with end element: name() - break; - } - - if (isStartElement()) { - if (name() == "taskseries") - readTaskSeries(currentListId); - else if (name() == "deleted") - readDeleted(currentListId); - else - readUnknownElement(); - } - } -} - -void RTM::TasksReader::readDeleted(RTM::ListId listId) { - while(!atEnd()) { - readNext(); - if ((isEndElement()) && (name() == "deleted")) { - break; - } - if (isEndElement()) { - //Error in readDeleted() with end element: name() - break; - } - - if (isStartElement()) { - if (name() == "taskseries") - readTaskSeries(listId); - else - readUnknownElement(); - } - } -} diff --git a/kdeplasma-addons/libs/rtm/xmlreaders.h b/kdeplasma-addons/libs/rtm/xmlreaders.h deleted file mode 100644 index 449b80d7..00000000 --- a/kdeplasma-addons/libs/rtm/xmlreaders.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2009 Andrew Stromme - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef XMLREADERS_H -#define XMLREADERS_H - -#include -#include - -#include "rtm.h" -#include "list.h" - -class TempProps; - -namespace RTM { - -class Request; -class Session; -class Task; - -class TasksReader : public QXmlStreamReader -{ -public: - TasksReader(RTM::Request *request, RTM::Session *session); - - bool read(); - -private: - Session * const session; - Request * const request; - - QDateTime parseDateTime(const QString &datetime); - QDateTime localizedTime(const QDateTime &datetime); - - void readUnknownElement(); - bool readResponse(); - void readTransaction(); - - void readTasksHeader(); - void readTasksList(); - void readDeleted(RTM::ListId listId); - void readTaskSeries(RTM::ListId listId); - void readTags(TempProps* props); - void readParticipants(TempProps* props); - void readNotes(TempProps* props); - void readTask(TempProps* props); - - void readListsHeader(); - void readList(); - void readFilter(RTM::List* list); -}; - -} // Namespace RTM -#endif // TASKSREADER_H diff --git a/kdeplasma-addons/runners/CMakeLists.txt b/kdeplasma-addons/runners/CMakeLists.txt index a45bb3dd..a601bb29 100644 --- a/kdeplasma-addons/runners/CMakeLists.txt +++ b/kdeplasma-addons/runners/CMakeLists.txt @@ -3,18 +3,11 @@ add_subdirectory(browserhistory) add_subdirectory(converter) add_subdirectory(datetime) add_subdirectory(katesessions) -add_subdirectory(konquerorsessions) add_subdirectory(kopete) add_subdirectory(mediawiki) add_subdirectory(spellchecker) add_subdirectory(characters) add_subdirectory(dictionary) - -if(NOT WIN32) - add_subdirectory(konsolesessions) -endif(NOT WIN32) - -if(QJSON_FOUND) - add_subdirectory(youtube) - add_subdirectory(translator) -endif(QJSON_FOUND) +add_subdirectory(konsolesessions) +add_subdirectory(youtube) +add_subdirectory(translator) diff --git a/kdeplasma-addons/runners/konquerorsessions/CMakeLists.txt b/kdeplasma-addons/runners/konquerorsessions/CMakeLists.txt deleted file mode 100644 index be2ea9d8..00000000 --- a/kdeplasma-addons/runners/konquerorsessions/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(krunner_konquerorsessions_SRCS - konquerorsessions.cpp -) - -kde4_add_plugin(krunner_konquerorsessions ${krunner_konquerorsessions_SRCS}) -target_link_libraries(krunner_konquerorsessions ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS}) - -install(TARGETS krunner_konquerorsessions DESTINATION ${PLUGIN_INSTALL_DIR} ) - -install(FILES konquerorsessions.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - diff --git a/kdeplasma-addons/runners/konquerorsessions/Messages.sh b/kdeplasma-addons/runners/konquerorsessions/Messages.sh deleted file mode 100755 index 0720e1e5..00000000 --- a/kdeplasma-addons/runners/konquerorsessions/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT *.cpp -o $podir/plasma_runner_konquerorsessions.pot diff --git a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.cpp b/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.cpp deleted file mode 100644 index c5712945..00000000 --- a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2008 Montel Laurent - * based on kate session from sebas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "konquerorsessions.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - - -KonquerorSessions::KonquerorSessions(QObject *parent, const QVariantList& args) - : Plasma::AbstractRunner(parent, args) -{ - Q_UNUSED(args); - setObjectName(QLatin1String( "Konqueror Sessions" )); - setIgnoredTypes(Plasma::RunnerContext::FileSystem | Plasma::RunnerContext::NetworkLocation); - m_icon = KIcon(QLatin1String( "konqueror" )); - loadSessions(); - - KDirWatch *historyWatch = new KDirWatch(this); - const QStringList sessiondirs = KGlobal::dirs()->findDirs("data", QLatin1String( "konqueror/profiles/" )); - foreach (const QString &dir, sessiondirs) { - historyWatch->addDir(dir); - } - - connect(historyWatch,SIGNAL(dirty(QString)),this,SLOT(loadSessions())); - connect(historyWatch,SIGNAL(created(QString)),this,SLOT(loadSessions())); - connect(historyWatch,SIGNAL(deleted(QString)),this,SLOT(loadSessions())); - - Plasma::RunnerSyntax s(QLatin1String( ":q:" ), i18n("Finds Konqueror profiles matching :q:.")); - s.addExampleQuery(QLatin1String( "konqueror :q:" )); - addSyntax(s); - - addSyntax(Plasma::RunnerSyntax(QLatin1String( "konqueror" ), i18n("Lists all the Konqueror profiles in your account."))); -} - -KonquerorSessions::~KonquerorSessions() -{ -} - -void KonquerorSessions::loadSessions() -{ - const QStringList list = KGlobal::dirs()->findAllResources( "data", QLatin1String( "konqueror/profiles/*" ), KStandardDirs::NoDuplicates ); - QStringList::ConstIterator end = list.constEnd(); - for (QStringList::ConstIterator it = list.constBegin(); it != end; ++it) { - QFileInfo info(*it); - const QString profileName = KIO::decodeFileName(info.baseName()); - - QString niceName=profileName; - //kDebug()<<" loadSessions :"; - KConfig _config(*it, KConfig::SimpleConfig); - if (_config.hasGroup("Profile")) { - KConfigGroup cfg(&_config, "Profile"); - if (cfg.hasKey("Name")) { - niceName = cfg.readEntry("Name"); - } - m_sessions.insert(profileName, niceName); - //kDebug()<<" profileName :"< i(m_sessions); - while (i.hasNext()) { - i.next(); - Plasma::QueryMatch match(this); - match.setType(Plasma::QueryMatch::PossibleMatch); - match.setRelevance(0.8); - match.setIcon(m_icon); - match.setData(i.key()); - match.setText(QLatin1String( "Konqueror: " ) + i.value()); - context.addMatch(term, match); - } - } else { - // we could just return here, but the kate hackers might have a session kate, - // so everybody else will suffer. And rightfully so! ;-) - QHashIterator i(m_sessions); - while (i.hasNext()) { - i.next(); - if (i.value().contains(term, Qt::CaseInsensitive)) { - Plasma::QueryMatch match(this); - match.setType(Plasma::QueryMatch::PossibleMatch); - match.setIcon(m_icon); - match.setData(i.key()); - match.setText(QLatin1String( "Konqueror: " ) + i.value()); - - if (i.value().toLower() == term) { - match.setRelevance(1.0); - } else { - match.setRelevance(0.6); - } - - context.addMatch(term, match); - } - } - } -} - -void KonquerorSessions::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) -{ - Q_UNUSED(context) - const QString session = match.data().toString(); - //kDebug() << "Open Konqueror Session " << session; - - if (!session.isEmpty()) { - QStringList args; - args << QLatin1String( "--profile" ); - args << session; - //kDebug() << "=== START: konqueror" << args; - KToolInvocation::kdeinitExec(QLatin1String( "konqueror" ), args); - } -} - -#include "moc_konquerorsessions.cpp" diff --git a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.desktop b/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.desktop deleted file mode 100644 index 6acc63c8..00000000 --- a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.desktop +++ /dev/null @@ -1,121 +0,0 @@ -[Desktop Entry] -Name=Konqueror Sessions -Name[ar]=جلسات كنكير -Name[ast]=Sesiones de Konqueror -Name[bs]=Konqueror sesija -Name[ca]=Sessions del Konqueror -Name[ca@valencia]=Sessions del Konqueror -Name[cs]=Sezení Konqueroru -Name[da]=Konqueror-sessioner -Name[de]=Konqueror-Sitzungen -Name[el]=Συνεδρίες Konqueror -Name[en_GB]=Konqueror Sessions -Name[es]=Sesiones de Konqueror -Name[et]=Konquerori seansid -Name[eu]=Konqueror saioak -Name[fi]=Konqueror-istunnot -Name[fr]=Sessions Konqueror -Name[ga]=Seisiúin Konqueror -Name[gl]=Sesións de Konqueror -Name[he]=הפעלות Konqueror -Name[hr]=Sesije u Konqueroru -Name[hu]=Konqueror munkamenetek -Name[is]=Konqueror setur -Name[it]=Sessioni di Konqueror -Name[ja]=Konqueror セッション -Name[kk]=Konqueror сеанстары -Name[km]=សម័យ​របស់ Konqueror -Name[ko]=Konqueror 세션 -Name[ku]=Danişînên Konqueror -Name[lt]=Konqueror sesijos -Name[lv]=Konqueror sesijas -Name[mr]=कॉन्करर सत्र -Name[nb]=Konqueror-økter -Name[nds]=Konqueror-Törns -Name[nl]=Konquerorsessies -Name[nn]=Konqueror-øktveljar -Name[pa]=ਕੋਨਕਿਊਰੋਰ ਸ਼ੈਸ਼ਨ -Name[pl]=Sesje Konquerora -Name[pt]=Sessões do Konqueror -Name[pt_BR]=Sessões do Konqueror -Name[ro]=Sesiuni Konqueror -Name[ru]=Konqueror: сеансы -Name[sk]=Sedenia Konquerora -Name[sl]=Seje programa Konqueror -Name[sr]=К‑освајачеве сесије -Name[sr@ijekavian]=К‑освајачеве сесије -Name[sr@ijekavianlatin]=K‑osvajačeve sesije -Name[sr@latin]=K‑osvajačeve sesije -Name[sv]=Konquerorsessioner -Name[th]=วาระการใช้งานของคอนเควอร์เรอร์ -Name[tr]=Konqueror Oturumları -Name[uk]=Сеанси Konqueror -Name[wa]=Sessions di Konqueror -Name[x-test]=xxKonqueror Sessionsxx -Name[zh_CN]=Konqueror 会话 -Name[zh_TW]=Konqueror 工作階段 -Comment=Matches Konqueror Sessions -Comment[ar]=تطابق جلسات كنكير -Comment[ast]=Gueta sesiones de Konqueror que concasen -Comment[bs]=Odgovarajuće Konqueror sesije -Comment[ca]=Correspon amb sessions del Konqueror -Comment[ca@valencia]=Correspon amb sessions del Konqueror -Comment[cs]=Vyhledávání v sezeních Konqueroru -Comment[da]=Matcher Konqueror-sessioner. -Comment[de]=Findet Konqueror-Sitzungen -Comment[el]=Αντιστοίχηση συνεδριών Konqueror -Comment[en_GB]=Matches Konqueror Sessions -Comment[es]=Busca sesiones de Konqueror que coincidan -Comment[et]=Konquerori seansid -Comment[eu]=Bat datozen Konqueror saioak -Comment[fi]=Täsmää Konqueror-istuntoihin -Comment[fr]=Retrouve des sessions Konqueror -Comment[ga]=Comhoiriúnach do Sheisiúin Konqueror -Comment[gl]=Equivale ás sesión de Konqueror -Comment[he]=מתאים הפעלות Konqueror -Comment[hr]=Odgovara sesijama u Konqueroru -Comment[hu]=Konqueror munkamenetek listázása -Comment[is]=Samsvarar Konqueror setum -Comment[it]=Abbina sessioni di Konqueror -Comment[ja]=Konqueror のセッションを探します -Comment[kk]=Konqueror сеанстарды салыстыру -Comment[km]=ផ្គូផ្គង​សម័យ​របស់​ Konqueror -Comment[ko]=Konqueror 세션과 일치 -Comment[ku]=Danişînên Konqueror yên Hevgirtî -Comment[lv]=Meklē Konqueror sesijas -Comment[mr]=कॉन्करर सत्र जुळवितो -Comment[nb]=Treffer Konqueror-økter -Comment[nds]=Kiekt na passen Konqueror-Törns -Comment[nl]=Zoekt Konquerorsessies -Comment[nn]=Start Konqueror-økter -Comment[pa]=ਰਲਦੇ ਕੋਨਕਿਉਰੋਰ ਸ਼ੈਸ਼ਨ -Comment[pl]=Dopasowanie sesji Konquerora -Comment[pt]=Corresponder às Sessões do Konqueror -Comment[pt_BR]=Corresponder às sessões do Konqueror -Comment[ro]=Potrivește sesiuni Konqueror -Comment[ru]=Открытие сеансов Konqueror -Comment[sk]=Vyhľadávanie v sedeniach Konquerora -Comment[sl]=Prikazuje ujemanja s sejami programa Konqueror -Comment[sr]=Поклапа К‑освајачеве сесије -Comment[sr@ijekavian]=Поклапа К‑освајачеве сесије -Comment[sr@ijekavianlatin]=Poklapa K‑osvajačeve sesije -Comment[sr@latin]=Poklapa K‑osvajačeve sesije -Comment[sv]=Matchar Konquerorsessioner -Comment[th]=จับคู่ให้ตรงกับวาระการใช้งานของคอนเควอร์เรอร์ -Comment[tr]=Konqueror Oturumlarını Eşleştirir -Comment[uk]=Порівнює сеанси Konqueror -Comment[wa]=Fwait coresponde les sessions d' Konqueror -Comment[x-test]=xxMatches Konqueror Sessionsxx -Comment[zh_CN]=匹配 Konqueror 会话 -Comment[zh_TW]=符合 Konqueror 工作階段 -Icon=konqueror - -X-KDE-ServiceTypes=Plasma/Runner -Type=Service -X-KDE-Library=krunner_konquerorsessions -X-KDE-PluginInfo-Author=Laurent Montel -X-KDE-PluginInfo-Email=montel@kde.org -X-KDE-PluginInfo-Name=konquerorsessions -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.h b/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.h deleted file mode 100644 index 957f9766..00000000 --- a/kdeplasma-addons/runners/konquerorsessions/konquerorsessions.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008 Montel Laurent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KONQUERORSESSIONS_H -#define KONQUERORSESSIONS_H - -#include - -#include - -class KonquerorSessions : public Plasma::AbstractRunner { - Q_OBJECT - -public: - KonquerorSessions( QObject *parent, const QVariantList& args ); - ~KonquerorSessions(); - - void match(Plasma::RunnerContext &context); - void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match); -protected slots: - void loadSessions(); -private: - KIcon m_icon; - QHash m_sessions; -}; - -K_EXPORT_PLASMA_RUNNER(konquerorsessions, KonquerorSessions) - -#endif diff --git a/kdeplasma-addons/runners/translator/CMakeLists.txt b/kdeplasma-addons/runners/translator/CMakeLists.txt index c20710ea..96553410 100644 --- a/kdeplasma-addons/runners/translator/CMakeLists.txt +++ b/kdeplasma-addons/runners/translator/CMakeLists.txt @@ -1,12 +1,20 @@ -include_directories(${QJSON_INCLUDE_DIR}) - set (krunner_translator_SRCS translator.cpp translatorjob.cpp ) kde4_add_plugin(krunner_translator ${krunner_translator_SRCS}) -target_link_libraries(krunner_translator ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QJSON_LIBRARIES}) +target_link_libraries(krunner_translator + ${KDE4_KDEUI_LIBS} + ${KDE4_PLASMA_LIBS} + ${KDE4_KIO_LIBS} +) -install(TARGETS krunner_translator DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-runner-translator.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install( + TARGETS krunner_translator + DESTINATION ${PLUGIN_INSTALL_DIR} +) +install( + FILES plasma-runner-translator.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) diff --git a/kdeplasma-addons/runners/youtube/CMakeLists.txt b/kdeplasma-addons/runners/youtube/CMakeLists.txt index d15c31d5..9daeb424 100644 --- a/kdeplasma-addons/runners/youtube/CMakeLists.txt +++ b/kdeplasma-addons/runners/youtube/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${QJSON_INCLUDE_DIR} ${qjson_INCLUDE_DIR}) - set(krunner_youtube_SRCS imageiconengine.cpp youtube.cpp @@ -12,10 +10,14 @@ kde4_add_plugin(krunner_youtube ${krunner_youtube_SRCS}) target_link_libraries(krunner_youtube ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} - ${QJSON_LIBRARIES} - ${qjson_LIBRARIES} ${KDE4_SOLID_LIBS}) -install(TARGETS krunner_youtube DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( + TARGETS krunner_youtube + DESTINATION ${PLUGIN_INSTALL_DIR} +) -install(FILES plasma-runner-youtube.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install( + FILES plasma-runner-youtube.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) diff --git a/kgpg/CMakeLists.txt b/kgpg/CMakeLists.txt index d7ea9e95..4754097c 100644 --- a/kgpg/CMakeLists.txt +++ b/kgpg/CMakeLists.txt @@ -10,80 +10,84 @@ endif() # only headers are used find_package( Gpgme REQUIRED ) -add_subdirectory( icons ) -include_directories( ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} ) +add_subdirectory(icons) +include_directories(${KDE4_INCLUDES} ${GPGME_INCLUDES}) option(KGPG_DEBUG_TRANSACTIONS "show commands and results of gpg calls in debug log" Off) set(core_SRCS - core/convert.cpp - core/images.cpp - core/emailvalidator.cpp - core/kgpgkey.cpp - core/KGpgExpandableNode.cpp - core/KGpgKeyNode.cpp - core/KGpgGroupMemberNode.cpp - core/KGpgGroupNode.cpp - core/KGpgNode.cpp - core/KGpgOrphanNode.cpp - core/KGpgRefNode.cpp - core/KGpgRootNode.cpp - core/KGpgSignableNode.cpp - core/KGpgSignNode.cpp - core/KGpgSubkeyNode.cpp - core/KGpgUatNode.cpp - core/KGpgUidNode.cpp + core/convert.cpp + core/images.cpp + core/emailvalidator.cpp + core/kgpgkey.cpp + core/KGpgExpandableNode.cpp + core/KGpgKeyNode.cpp + core/KGpgGroupMemberNode.cpp + core/KGpgGroupNode.cpp + core/KGpgNode.cpp + core/KGpgOrphanNode.cpp + core/KGpgRefNode.cpp + core/KGpgRootNode.cpp + core/KGpgSignableNode.cpp + core/KGpgSignNode.cpp + core/KGpgSubkeyNode.cpp + core/KGpgUatNode.cpp + core/KGpgUidNode.cpp ) set(kgpg_editor_SRCS - editor/kgpgmd5widget.cpp - editor/kgpgeditor.cpp - editor/kgpgtextedit.cpp + editor/kgpgmd5widget.cpp + editor/kgpgeditor.cpp + editor/kgpgtextedit.cpp ) set(kgpg_model_SRCS - model/gpgservermodel.cpp - model/kgpgitemmodel.cpp - model/groupeditproxymodel.cpp - model/keylistproxymodel.cpp - model/kgpgsearchresultmodel.cpp - model/selectkeyproxymodel.cpp + model/gpgservermodel.cpp + model/kgpgitemmodel.cpp + model/groupeditproxymodel.cpp + model/keylistproxymodel.cpp + model/kgpgsearchresultmodel.cpp + model/selectkeyproxymodel.cpp ) set(kgpg_transaction_SRCS - transactions/kgpgtransaction.cpp - transactions/kgpgtransactionjob.cpp - transactions/kgpguidtransaction.cpp - transactions/kgpgeditkeytransaction.cpp - transactions/kgpgsigntransactionhelper.cpp - transactions/kgpgchangedisable.cpp - transactions/kgpgchangeexpire.cpp - transactions/kgpgchangepass.cpp - transactions/kgpgchangetrust.cpp - transactions/kgpgdelsign.cpp - transactions/kgpgdeluid.cpp - transactions/kgpgencrypt.cpp - transactions/kgpgexport.cpp - transactions/kgpgaddphoto.cpp - transactions/kgpgadduid.cpp - transactions/kgpggeneratekey.cpp - transactions/kgpggeneraterevoke.cpp - transactions/kgpgdecrypt.cpp - transactions/kgpgdelkey.cpp - transactions/kgpgimport.cpp - transactions/kgpgkeyservertransaction.cpp - transactions/kgpgkeyservergettransaction.cpp - transactions/kgpgkeyserversearchtransaction.cpp - transactions/kgpgprimaryuid.cpp - transactions/kgpgsendkeys.cpp - transactions/kgpgsignkey.cpp - transactions/kgpgsigntext.cpp - transactions/kgpgsignuid.cpp - transactions/kgpgtextorfiletransaction.cpp - transactions/kgpgverify.cpp + transactions/kgpgtransaction.cpp + transactions/kgpgtransactionjob.cpp + transactions/kgpguidtransaction.cpp + transactions/kgpgeditkeytransaction.cpp + transactions/kgpgsigntransactionhelper.cpp + transactions/kgpgchangedisable.cpp + transactions/kgpgchangeexpire.cpp + transactions/kgpgchangepass.cpp + transactions/kgpgchangetrust.cpp + transactions/kgpgdelsign.cpp + transactions/kgpgdeluid.cpp + transactions/kgpgencrypt.cpp + transactions/kgpgexport.cpp + transactions/kgpgaddphoto.cpp + transactions/kgpgadduid.cpp + transactions/kgpggeneratekey.cpp + transactions/kgpggeneraterevoke.cpp + transactions/kgpgdecrypt.cpp + transactions/kgpgdelkey.cpp + transactions/kgpgimport.cpp + transactions/kgpgkeyservertransaction.cpp + transactions/kgpgkeyservergettransaction.cpp + transactions/kgpgkeyserversearchtransaction.cpp + transactions/kgpgprimaryuid.cpp + transactions/kgpgsendkeys.cpp + transactions/kgpgsignkey.cpp + transactions/kgpgsigntext.cpp + transactions/kgpgsignuid.cpp + transactions/kgpgtextorfiletransaction.cpp + transactions/kgpgverify.cpp ) -set(kgpg_SRCS ${core_SRCS} ${kgpg_editor_SRCS} ${kgpg_model_SRCS} ${kgpg_transaction_SRCS} +set(kgpg_SRCS + ${core_SRCS} + ${kgpg_editor_SRCS} + ${kgpg_model_SRCS} + ${kgpg_transaction_SRCS} selectpublickeydialog.cpp selectsecretkey.cpp kgpgoptions.cpp @@ -123,34 +127,54 @@ kde4_add_kcfg_files(kgpg_SRCS kgpgsettings.kcfgc ) add_executable(kgpg ${kgpg_SRCS}) if (KGPG_DEBUG_TRANSACTIONS) - get_target_property(KGPG_FLAGS kgpg COMPILE_DEFINITIONS) - if (NOT KGPG_FLAGS) - # get rid of the NOTFOUND - set(KGPG_FLAGS) - endif (NOT KGPG_FLAGS) - list(APPEND KGPG_FLAGS KGPG_DEBUG_TRANSACTIONS) - set_target_properties(kgpg PROPERTIES COMPILE_DEFINITIONS "${KGPG_FLAGS}") + get_target_property(KGPG_FLAGS kgpg COMPILE_DEFINITIONS) + if (NOT KGPG_FLAGS) + # get rid of the NOTFOUND + set(KGPG_FLAGS) + endif (NOT KGPG_FLAGS) + list(APPEND KGPG_FLAGS KGPG_DEBUG_TRANSACTIONS) + set_target_properties(kgpg PROPERTIES COMPILE_DEFINITIONS "${KGPG_FLAGS}") endif (KGPG_DEBUG_TRANSACTIONS) target_link_libraries(kgpg - ${KDE4_KIO_LIBS} - ${KDE4_KABC_LIBS} - ${KDE4_KUTILS_LIBS} - ${KDE4_KPIMUTILS_LIBRARY} - ${KDE4_SOLID_LIBS} + ${KDE4_KIO_LIBS} + ${KDE4_KABC_LIBS} + ${KDE4_KUTILS_LIBS} + ${KDE4_KPIMUTILS_LIBRARY} + ${KDE4_SOLID_LIBS} ) -install(TARGETS kgpg ${INSTALL_TARGETS_DEFAULT_ARGS} ) +install(TARGETS kgpg ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### -install( FILES editor/kgpgeditor.rc keysmanager.rc tips DESTINATION ${DATA_INSTALL_DIR}/kgpg) -install( PROGRAMS kgpg.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install( FILES kgpg.appdata.xml DESTINATION share/appdata/ ) -install( FILES kgpg.kcfg DESTINATION ${KCFG_INSTALL_DIR}) -install( FILES kgpg.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} ) -install( FILES encryptfile.desktop encryptfolder.desktop viewdecrypted.desktop DESTINATION -${SERVICES_INSTALL_DIR}/ServiceMenus) -install( FILES org.kde.kgpg.Key.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) +install( + FILES editor/kgpgeditor.rc keysmanager.rc tips + DESTINATION ${DATA_INSTALL_DIR}/kgpg +) +install( + PROGRAMS kgpg.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) +install( + FILES kgpg.appdata.xml + DESTINATION share/appdata/ +) +install( + FILES kgpg.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) +install( + FILES kgpg.desktop + DESTINATION ${AUTOSTART_INSTALL_DIR} +) +install( + FILES encryptfile.desktop encryptfolder.desktop viewdecrypted.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus +) +install( + FILES org.kde.kgpg.Key.xml + DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} +) -kde4_install_icons( ${ICON_INSTALL_DIR} ) +kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/kolourpaint/.krazy b/kolourpaint/.krazy deleted file mode 100644 index d850d7bb..00000000 --- a/kolourpaint/.krazy +++ /dev/null @@ -1 +0,0 @@ -EXTRA multiclasses diff --git a/kolourpaint/AUTHORS b/kolourpaint/AUTHORS deleted file mode 100644 index 9822db57..00000000 --- a/kolourpaint/AUTHORS +++ /dev/null @@ -1,38 +0,0 @@ - -Authors -======= - -Clarence Dang -Project Founder - -Thurston Dang -Chief Investigator - -Kristof Borrey -Icons - -Kazuki Ohta -InputMethod Support - -Nuno Pinheiro -Icons - -Danny Allen -Icons - -Mike Gashler -Imaqe Effects - -Laurent Montel -KDE 4 Porting - -Martin Koller -Scanning Support, Current Maintainer - -Tasuku Suzuki -InputMethod Support - -Thanks To -========= - -Thanks to the many others who have helped to make this program possible. diff --git a/kolourpaint/BUGS b/kolourpaint/BUGS deleted file mode 100644 index 93c622f1..00000000 --- a/kolourpaint/BUGS +++ /dev/null @@ -1,138 +0,0 @@ - -Please send bug reports and feature requests to http://bugs.kde.org/. -Don't hesitate to report bugs nor hesitate to send us your wishes - it -provides valuable feedback that will help to improve future versions of -KolourPaint and you will not receive flames for reporting duplicates. - - -This file lists known bugs in this version that are not considered -"release critical" and are difficult to fix: - - -3. Tool Box & Colour Box RMB ToolBar Menus do not work. - -4. Image dialog spinboxes should accept Enter Key (instead of the dialog's - OK button) after the user has typed something. - - OR - - Spinboxes should signal that their values have changed every time the - user changes the text (rather than after pressing Enter or clicking on - another spinbox etc.). - - The need for the "Update Preview" button and the difficulty of keeping - the percentages and dimensions in sync in the Resize / Scale dialog are - manifestations of the current QSpinBox behaviour. - - Update: Text input is broken in KDE4. - -6. a) The undo history and document modified state are not updated during - the drawing of multi-segment shapes (Polygon, Connected Lines, - Curve). They are however updated after shapes' completion. - - b) The brush-like tools set the document modified flag even if - user cancels the draw operation. - - c) Select a region, manipulate it (e.g. move), undo - the document is - still marked as modified (because 2 commands - the create selection - and the move - were added but only one was undone). - -7. Certain shapes may have the wrong size (usually only a pixel off and - only in extreme cases). This is a Qt bug. - -8. At zoom levels that aren't multiples of 100%, parts of the image may - appear to move when the user interacts with it. Other minor redraw - glitches may also occur at such zoom levels. - -9. Keyboard shortcut changes do not propagate to other KolourPaint windows - (but will propagate to future windows). - -10. "File/Open Recent" entries are not updated interprocess. - -11. The blinking text cursor will "disappear" if you type more text than - you can fit in a text box. - -12. You cannot select only parts of the text you write. - -14. The text cursor may be momentarily misrendered when scrolling the view. - -17. a) Using KolourPaint on a remote X display may result in redraw errors - and pixel data corruption. - -19. Read support for EPS files is extremely slow. You should not enable - the "Save Preview" dialog when saving to EPS. This is an issue with - KDE. - -20. Pasting a large image (esp. one that doesn't compress well as PNG) - into an image editor (not necessarily KolourPaint) running as - different process from the KolourPaint which was the source of the - image, on a sufficiently slow computer, may fail with the following - output to STDERR: - - "kolourpaint: ERROR: kpMainWindow::paste() with sel without pixmap - QClipboard: timed out while sending data" - - This is a Qt bug. - -21. It is not always possible to copy and paste between 2 instances of - KolourPaint running different Qt versions. See - QDataStream::setVersion(). - -23. Changing tool options while in the middle of a drawing option should - work but confuses KolourPaint instead. For instance: - - a) With the brush tools, the cursor incorrectly appears. - - b) With the rectangle-based tools, the temporary pixmap does not resize - when the line width increases. - -25. Sometimes when you take a screenshot of a window, and then paste in a - new window, it will be greyscale. When pasting again, it will still be - greyscale. Cannot consistently reproduce. [Thurston] - -26. Drawing with the keyboard is unreliable. Depending on the X server, - either holding down Enter may continually switch between drawing and - not drawing or KolourPaint may fail to detect the release of the Enter - key. - -27. InputMethod had not been tested at zoom levels other than 100%. - -28. KolourPaint has not been tested against invalid or malicious clipboard - data. - -29. The Tool Box and Color Tool Bar are no longer movable or floatable. - -30. The "Skew", "Rotate" and "Smooth Scale" effects produce low quality - results. - -31. The rendering quality of a text box with opaque text but a see-through - background, on top of transparent document areas, is lower than in KDE 3 - versions of KolourPaint. - - -Issue with XFree86 <= 3.3.6 with the "Emulate3Buttons" Option -============================================================= - -When drawing, clicking the left or right mouse button that did not -initiate the current operation will, in this order: - -1. finalise the current drawing operation -2. attempt to paste the contents of the middle-mouse-button clipboard - -instead of canceling the current drawing operation. - -This is due to XFree86 sending a release notification for the button that -initiated the drawing operation, followed by a press notification for the -emulated 3rd button; instead of just a single press notification for the -button that is intended to cancel the operation. This works correctly in -XFree86 4.x with "Emulate3Buttons" on because it is harder to trigger the -emulation for the 3rd button as it is only invoked if the left and right -buttons are pressed at almost the same time. - -Possible solutions: - -a) Use XFree86 4.x or an X server from another vendor (e.g. X.org). -b) Press Escape in KolourPaint to cancel the current drawing operation - instead of using the problematic click method described above. -c) Disable "Emulate3Buttons". - diff --git a/kolourpaint/CMakeLists.txt b/kolourpaint/CMakeLists.txt deleted file mode 100644 index d4b61c4a..00000000 --- a/kolourpaint/CMakeLists.txt +++ /dev/null @@ -1,358 +0,0 @@ -project(kolourpaint) - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - find_package(KDE4 4.18.0 REQUIRED) - include(KDE4Defaults) - include_directories(${KDE4_INCLUDES}) - add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -endif() - -find_package(QImageBlitz) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/commands - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/transforms - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/flow - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/polygonal - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/rectangular - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text - ${CMAKE_CURRENT_SOURCE_DIR}/cursors - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/effects - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms - ${CMAKE_CURRENT_SOURCE_DIR}/document - ${CMAKE_CURRENT_SOURCE_DIR}/environments - ${CMAKE_CURRENT_SOURCE_DIR}/environments/commands - ${CMAKE_CURRENT_SOURCE_DIR}/environments/dialogs - ${CMAKE_CURRENT_SOURCE_DIR}/environments/dialogs/imagelib - ${CMAKE_CURRENT_SOURCE_DIR}/environments/dialogs/imagelib/transforms - ${CMAKE_CURRENT_SOURCE_DIR}/environments/document - ${CMAKE_CURRENT_SOURCE_DIR}/environments/tools - ${CMAKE_CURRENT_SOURCE_DIR}/environments/tools/selection - ${CMAKE_CURRENT_SOURCE_DIR}/generic - ${CMAKE_CURRENT_SOURCE_DIR}/generic/widgets - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/transforms - ${CMAKE_CURRENT_SOURCE_DIR}/layers - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text - ${CMAKE_CURRENT_SOURCE_DIR}/layers/tempImage - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl/generic - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl/generic/widgets - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow - ${CMAKE_CURRENT_SOURCE_DIR}/pixmapfx - ${CMAKE_CURRENT_SOURCE_DIR}/tools - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal - ${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangular - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text - ${CMAKE_CURRENT_SOURCE_DIR}/views - ${CMAKE_CURRENT_SOURCE_DIR}/views/manager - ${CMAKE_CURRENT_SOURCE_DIR}/widgets - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/colorSimilarity - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options - - ${KDE4_INCLUDES} -) - -add_subdirectory( pics ) - - -########### next target ############### -macro(CREATE_VERSION _in_FILE _out_FILE) - FILE(READ ${_in_FILE} _contents) - FILE(WRITE ${_out_FILE} "static const char * const kpVersionText =") - STRING(REGEX REPLACE "\n" "" _contents "${_contents}" ) - FILE(APPEND ${_out_FILE} "${_contents}") - FILE(APPEND ${_out_FILE} ";\n") -endmacro(CREATE_VERSION) - - -#macro_additional_clean_files( ${CMAKE_CURRENT_BINARY_DIR}/kolourpaintversion.h ) - -create_version(${CMAKE_CURRENT_SOURCE_DIR}/VERSION ${CMAKE_CURRENT_BINARY_DIR}/kolourpaintversion.h) - - -macro(CREATE_LICENSE _in_FILE _out_FILE) - FILE(READ ${_in_FILE} _contents) - FILE(WRITE ${_out_FILE} "static const char * const kpLicenseText =") - STRING(REGEX REPLACE "\"" "\\\\\"" _contents "${_contents}" ) - STRING(REGEX REPLACE "\n" "\\\\n\"\n\"" _contents "${_contents}" ) - FILE(APPEND ${_out_FILE} "\"${_contents}\"") - FILE(APPEND ${_out_FILE} ";\n") -endmacro(CREATE_LICENSE) - -#macro_additional_clean_files( ${CMAKE_CURRENT_BINARY_DIR}/kolourpaintlicense.h ) - -create_license(${CMAKE_CURRENT_SOURCE_DIR}/COPYING ${CMAKE_CURRENT_BINARY_DIR}/kolourpaintlicense.h) - - -# GENERATED BY ./gen_cmake_srcs | fgrep -v /lgpl/ - -set(kolourpaint_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectBalanceCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectClearCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectCommandBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectGrayscaleCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectHSVCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectInvertCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectReduceColorsCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectToneEnhanceCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/kpDocumentMetaInfoCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/transforms/kpTransformFlipCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/transforms/kpTransformRotateCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/transforms/kpTransformSkewCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpCommandHistoryBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpCommandHistory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpCommandSize.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpMacroCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/kpNamedCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/flow/kpToolFlowCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/kpToolColorPickerCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/kpToolFloodFillCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/polygonal/kpToolPolygonalCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/rectangular/kpToolRectangularCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpAbstractSelectionContentCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolImageSelectionTransparencyCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolSelectionCreateCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolSelectionDestroyCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolSelectionMoveCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/kpToolSelectionResizeScaleCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextBackspaceCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextDeleteCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextEnterCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextGiveContentCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/tools/selection/text/kpToolTextInsertCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cursors/kpCursorLightCross.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cursors/kpCursorProvider.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/effects/kpEffectsDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/kpDocumentMetaInfoDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformPreviewDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpColorSimilarityDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument_Open.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument_Save.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocumentSaveOptions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument_Selection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/commands/kpCommandEnvironment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/document/kpDocumentEnvironment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/kpEnvironmentBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/tools/kpToolEnvironment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/environments/tools/selection/kpToolSelectionEnvironment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/generic/kpSetOverrideCursorSaver.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/generic/kpWidgetMapper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/generic/widgets/kpResizeSignallingLabel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/generic/widgets/kpSubWindow.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectBalance.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectGrayscale.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectHSV.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectInvert.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectReduceColors.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectToneEnhance.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/kpColor_Constants.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/kpColor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/kpDocumentMetaInfo.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/kpFloodFill.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/kpPainter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/transforms/kpTransformAutoCrop.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/transforms/kpTransformCrop.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/transforms/kpTransformCrop_ImageSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/transforms/kpTransformCrop_TextSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kolourpaint.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kpThumbnail.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kpViewScrollableContainer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image/kpAbstractImageSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image/kpEllipticalImageSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image/kpFreeFormImageSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image/kpImageSelectionTransparency.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/image/kpRectangularImageSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/kpAbstractSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/kpSelectionDrag.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/kpSelectionFactory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text/kpTextSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text/kpTextSelection_Cursor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text/kpTextSelection_Paint.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text/kpTextStyle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/selections/text/kpPreeditText.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/layers/tempImage/kpTempImage.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Colors.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Edit.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_File.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Image.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Settings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_StatusBar.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Text.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_Tools.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_View.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_View_Thumbnail.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mainWindow/kpMainWindow_View_Zoom.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/pixmapfx/kpPixmapFX_DrawShapes.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/pixmapfx/kpPixmapFX_Transforms.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolBrush.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolColorEraser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolEraser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolFlowBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolFlowPixmapBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolPen.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/flow/kpToolSpraycan.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpToolAction.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpToolColorPicker.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_Drawing.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpToolFloodFill.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_KeyboardEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_MouseEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_OtherEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_UserNotifications.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpTool_Utilities.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpToolZoom.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal/kpToolCurve.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal/kpToolLine.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal/kpToolPolygonalBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal/kpToolPolygon.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/polygonal/kpToolPolyline.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangular/kpToolEllipse.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangular/kpToolRectangle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangular/kpToolRectangularBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangular/kpToolRoundedRectangle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image/kpAbstractImageSelectionTool.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image/kpAbstractImageSelectionTool_Transparency.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image/kpToolEllipticalSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image/kpToolFreeFormSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/image/kpToolRectSelection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/kpAbstractSelectionTool.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/kpAbstractSelectionTool_Create.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/kpAbstractSelectionTool_KeyboardEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/kpAbstractSelectionTool_Move.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/kpAbstractSelectionTool_ResizeScale.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_Commands.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_Create.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_CursorCalc.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_InputMethodEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_KeyboardEvents.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_KeyboardEvents_HandleTypingKeys.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_Move.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_ResizeScale.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_SelectText.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tools/selection/text/kpToolText_TextStyle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpThumbnailView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpUnzoomedThumbnailView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpView_Events.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpView_Paint.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpView_Selections.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpZoomedThumbnailView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/kpZoomedView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/manager/kpViewManager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/manager/kpViewManager_TextCursor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/views/manager/kpViewManager_ViewUpdates.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/colorSimilarity/kpColorSimilarityFrame.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/colorSimilarity/kpColorSimilarityHolder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/colorSimilarity/kpColorSimilarityToolBarItem.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectBalanceWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectHSVWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectInvertWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectReduceColorsWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectWidgetBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpColorCells.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpColorPalette.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDefaultColorCollection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDocumentSaveOptionsWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDualColorButton.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpPrintDialogPage.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpTransparentColorCell.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/kpColorToolBar.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/kpToolToolBar.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetBase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetBrush.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetEraserSize.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetFillStyle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetLineWidth.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/toolbars/options/kpToolWidgetSpraycanSize.cpp -) # set(kolourpaint_SRCS - -set(kolourpaint_lgpl_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl/generic/kpUrlFormatter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl/generic/kpColorCollection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/lgpl/generic/widgets/kpColorCellsBase.cpp -) - -if(QIMAGEBLITZ_FOUND) - set(kolourpaint_SRCS - ${kolourpaint_SRCS} - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectBlurSharpenCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectEmbossCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/commands/imagelib/effects/kpEffectFlattenCommand.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectBlurSharpenWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectEmbossWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/imagelib/effects/kpEffectFlattenWidget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectBlurSharpen.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectEmboss.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imagelib/effects/kpEffectFlatten.cpp - ) - include_directories(${QIMAGEBLITZ_INCLUDES}) - add_definitions(-DHAVE_QIMAGEBLITZ) -endif() - -# -# LGPL Library -# -# This MUST be a dynamic link library to avoid LGPL license infection. -# - -add_library(kolourpaint_lgpl SHARED ${kolourpaint_lgpl_SRCS}) - -target_link_libraries(kolourpaint_lgpl ${KDE4_KIO_LIBS}) -set_target_properties(kolourpaint_lgpl PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} DEFINE_SYMBOL MAKE_KOLOURPAINT4_LGPL_LIB ) - -install(TARGETS kolourpaint_lgpl ${INSTALL_TARGETS_DEFAULT_ARGS} ) - - -# -# Executable -# - -add_executable(kolourpaint ${kolourpaint_SRCS}) - -target_link_libraries(kolourpaint ${KDE4_KIO_LIBS} ${KDE4_KPRINTUTILS_LIBS} kolourpaint_lgpl) -if(QIMAGEBLITZ_FOUND) - target_link_libraries(kolourpaint ${QIMAGEBLITZ_LIBRARIES}) -endif() - -install(TARGETS kolourpaint ${INSTALL_TARGETS_DEFAULT_ARGS}) - - -########### install files ############### - -install(PROGRAMS kolourpaint.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install(FILES kolourpaint.appdata.xml DESTINATION share/appdata/) -install(FILES kolourpaintui.rc DESTINATION ${DATA_INSTALL_DIR}/kolourpaint) diff --git a/kolourpaint/COPYING b/kolourpaint/COPYING deleted file mode 100644 index 6b56fcf6..00000000 --- a/kolourpaint/COPYING +++ /dev/null @@ -1,139 +0,0 @@ -Copyright (c) 2003-2007 Clarence Dang -Portions Copyright (c) 2005 Kazuki Ohta -Portions Copyright (c) 2006-2007 Mike Gashler -Portions Copyright (c) 2007,2011 Martin Koller -Portions Copyright (c) 2007 John Layt -Portions Copyright (c) 2010 Tasuku Suzuki -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -"libkolourpaint" Library -~~~~~~~~~~~~~~~~~~~~~~~~ - -The "libkolourpaint" dynamic link library contains various pieces of code, -each with a different license: - - -License 1 ---------- - -Copyright (C) 1999 Waldo Bastian (bastian@kde.org) -Copyright (C) 2007 Clarence Dang (dang@kde.org) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. - - -License 2 ---------- - -Copyright (C) 2007 David Faure - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. - - -License 3 ---------- - -Copyright (c) 2003-2007 Clarence Dang -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -License 4 ---------- - -Copyright (C) 1997 Martin Jones (mjones@kde.org) -Copyright (C) 2007 Roberto Raggi (roberto@kdevelop.org) -Copyright (C) 2007 Clarence Dang (dang@kde.org) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. - - -Icons -~~~~~ - -Copyright (c) Nuno Pinheiro -Copyright (c) Danny Allen -Portions Copyright (c) Clarence Dang -Portions Copyright (c) Kristof Borrey - diff --git a/kolourpaint/COPYING.DOC b/kolourpaint/COPYING.DOC deleted file mode 100644 index 4a0fe1c8..00000000 --- a/kolourpaint/COPYING.DOC +++ /dev/null @@ -1,397 +0,0 @@ - GNU Free Documentation License - Version 1.2, November 2002 - - - Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - -0. PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -functional and useful document "free" in the sense of freedom: to -assure everyone the effective freedom to copy and redistribute it, -with or without modifying it, either commercially or noncommercially. -Secondarily, this License preserves for the author and publisher a way -to get credit for their work, while not being considered responsible -for modifications made by others. - -This License is a kind of "copyleft", which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - - -1. APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work, in any medium, that -contains a notice placed by the copyright holder saying it can be -distributed under the terms of this License. Such a notice grants a -world-wide, royalty-free license, unlimited in duration, to use that -work under the conditions stated herein. The "Document", below, -refers to any such manual or work. Any member of the public is a -licensee, and is addressed as "you". You accept the license if you -copy, modify or distribute the work in a way requiring permission -under copyright law. - -A "Modified Version" of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A "Secondary Section" is a named appendix or a front-matter section of -the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall subject -(or to related matters) and contains nothing that could fall directly -within that overall subject. (Thus, if the Document is in part a -textbook of mathematics, a Secondary Section may not explain any -mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The "Invariant Sections" are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. If a -section does not fit the above definition of Secondary then it is not -allowed to be designated as Invariant. The Document may contain zero -Invariant Sections. If the Document does not identify any Invariant -Sections then there are none. - -The "Cover Texts" are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. A Front-Cover Text may -be at most 5 words, and a Back-Cover Text may be at most 25 words. - -A "Transparent" copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, that is suitable for revising the document -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup, or absence of markup, has been arranged to thwart -or discourage subsequent modification by readers is not Transparent. -An image format is not Transparent if used for any substantial amount -of text. A copy that is not "Transparent" is called "Opaque". - -Examples of suitable formats for Transparent copies include plain -ASCII without markup, Texinfo input format, LaTeX input format, SGML -or XML using a publicly available DTD, and standard-conforming simple -HTML, PostScript or PDF designed for human modification. Examples of -transparent image formats include PNG, XCF and JPG. Opaque formats -include proprietary formats that can be read and edited only by -proprietary word processors, SGML or XML for which the DTD and/or -processing tools are not generally available, and the -machine-generated HTML, PostScript or PDF produced by some word -processors for output purposes only. - -The "Title Page" means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, "Title Page" means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - -A section "Entitled XYZ" means a named subunit of the Document whose -title either is precisely XYZ or contains XYZ in parentheses following -text that translates XYZ in another language. (Here XYZ stands for a -specific section name mentioned below, such as "Acknowledgements", -"Dedications", "Endorsements", or "History".) To "Preserve the Title" -of such a section when you modify the Document means that it remains a -section "Entitled XYZ" according to this definition. - -The Document may include Warranty Disclaimers next to the notice which -states that this License applies to the Document. These Warranty -Disclaimers are considered to be included by reference in this -License, but only as regards disclaiming warranties: any other -implication that these Warranty Disclaimers may have is void and has -no effect on the meaning of this License. - - -2. VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - - -3. COPYING IN QUANTITY - -If you publish printed copies (or copies in media that commonly have -printed covers) of the Document, numbering more than 100, and the -Document's license notice requires Cover Texts, you must enclose the -copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a computer-network location from which the general network-using -public has access to download using public-standard network protocols -a complete Transparent copy of the Document, free of added material. -If you use the latter option, you must take reasonably prudent steps, -when you begin distribution of Opaque copies in quantity, to ensure -that this Transparent copy will remain thus accessible at the stated -location until at least one year after the last time you distribute an -Opaque copy (directly or through your agents or retailers) of that -edition to the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - - -4. MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -A. Use in the Title Page (and on the covers, if any) a title distinct - from that of the Document, and from those of previous versions - (which should, if there were any, be listed in the History section - of the Document). You may use the same title as a previous version - if the original publisher of that version gives permission. -B. List on the Title Page, as authors, one or more persons or entities - responsible for authorship of the modifications in the Modified - Version, together with at least five of the principal authors of the - Document (all of its principal authors, if it has fewer than five), - unless they release you from this requirement. -C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. -D. Preserve all the copyright notices of the Document. -E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. -F. Include, immediately after the copyright notices, a license notice - giving the public permission to use the Modified Version under the - terms of this License, in the form shown in the Addendum below. -G. Preserve in that license notice the full lists of Invariant Sections - and required Cover Texts given in the Document's license notice. -H. Include an unaltered copy of this License. -I. Preserve the section Entitled "History", Preserve its Title, and add - to it an item stating at least the title, year, new authors, and - publisher of the Modified Version as given on the Title Page. If - there is no section Entitled "History" in the Document, create one - stating the title, year, authors, and publisher of the Document as - given on its Title Page, then add an item describing the Modified - Version as stated in the previous sentence. -J. Preserve the network location, if any, given in the Document for - public access to a Transparent copy of the Document, and likewise - the network locations given in the Document for previous versions - it was based on. These may be placed in the "History" section. - You may omit a network location for a work that was published at - least four years before the Document itself, or if the original - publisher of the version it refers to gives permission. -K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the section all - the substance and tone of each of the contributor acknowledgements - and/or dedications given therein. -L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section titles. -M. Delete any section Entitled "Endorsements". Such a section - may not be included in the Modified Version. -N. Do not retitle any existing section to be Entitled "Endorsements" - or to conflict in title with any Invariant Section. -O. Preserve any Warranty Disclaimers. - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section Entitled "Endorsements", provided it contains -nothing but endorsements of your Modified Version by various -parties--for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - - -5. COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice, and that you preserve all their Warranty Disclaimers. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections Entitled "History" -in the various original documents, forming one section Entitled -"History"; likewise combine any sections Entitled "Acknowledgements", -and any sections Entitled "Dedications". You must delete all sections -Entitled "Endorsements". - - -6. COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - - -7. AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, is called an "aggregate" if the copyright -resulting from the compilation is not used to limit the legal rights -of the compilation's users beyond what the individual works permit. -When the Document is included in an aggregate, this License does not -apply to the other works in the aggregate which are not themselves -derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one half of -the entire aggregate, the Document's Cover Texts may be placed on -covers that bracket the Document within the aggregate, or the -electronic equivalent of covers if the Document is in electronic form. -Otherwise they must appear on printed covers that bracket the whole -aggregate. - - -8. TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License, and all the license notices in the -Document, and any Warranty Disclaimers, provided that you also include -the original English version of this License and the original versions -of those notices and disclaimers. In case of a disagreement between -the translation and the original version of this License or a notice -or disclaimer, the original version will prevail. - -If a section in the Document is Entitled "Acknowledgements", -"Dedications", or "History", the requirement (section 4) to Preserve -its Title (section 1) will typically require changing the actual -title. - - -9. TERMINATION - -You may not copy, modify, sublicense, or distribute the Document except -as expressly provided for under this License. Any other attempt to -copy, modify, sublicense or distribute the Document is void, and will -automatically terminate your rights under this License. However, -parties who have received copies, or rights, from you under this -License will not have their licenses terminated so long as such -parties remain in full compliance. - - -10. FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. See -http://www.gnu.org/copyleft/. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License "or any later version" applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. - - -ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - - Copyright (c) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - A copy of the license is included in the section entitled "GNU - Free Documentation License". - -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the "with...Texts." line with this: - - with the Invariant Sections being LIST THEIR TITLES, with the - Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. - -If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. diff --git a/kolourpaint/COPYING.LIB b/kolourpaint/COPYING.LIB deleted file mode 100644 index 2676d08a..00000000 --- a/kolourpaint/COPYING.LIB +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/kolourpaint/Messages.sh b/kolourpaint/Messages.sh deleted file mode 100644 index 5ac09ab7..00000000 --- a/kolourpaint/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -$EXTRACTRC `find . -name "*.rc" -o -name "*.ui" ` >> rc.cpp -$XGETTEXT `find . -name "*.cpp" -o -name "*.h"` -o $podir/kolourpaint.pot diff --git a/kolourpaint/NEWS b/kolourpaint/NEWS deleted file mode 100644 index 4f32e104..00000000 --- a/kolourpaint/NEWS +++ /dev/null @@ -1,383 +0,0 @@ - -KolourPaint 4 Series (trunk/KDE/) -==================== - -KolourPaint 4.0.0 BETA (Frozen 2007-10-26) - - * Port to KDE 4 (Clarence Dang, Laurent Montel) - - Note: This is a beta release and has not been through a full QA review. - If you want stability, use KolourPaint/KDE3, which can be - installed in parallel with KolourPaint4 BETA and runs under KDE4. - - * Configurable Color Palette - - * Add "Hue, Saturation, Value" effect (Mike Gashler) - - * Add "Histogram Equalizer" effect (Mike Gashler) - - * Add Zoom Tool - - * Add "File / Properties..." - - * Rectangles, rounded rectangles and ellipsed are now bounded by - the dimensions of the dragged out rectangle - - * Add, to the print dialog, a choice between printing the image at the - top-left of the page or at the center (this was previously a hidden - configuration option) - (Bug #33481) - - * Add hidden configuration option "Open Images in the Same Window" - (Bug #125116) - - * Add "Rotate Left" (CTRL+SHIFT+Left) and "Rotate Right" (CTRL+SHIFT+R) - to "Image" menu as a quick way to access the common types of "Rotate..." - (Bug #135184, #141530)) - - * Add "Fit to Page", "Fit to Page Width" and "Fit to Page Height" to the - "View" Menu - - * Add "Image / Draw Opaque" menu item since some users expect it. - It duplicates the functionality of the already existent Tool Box widget. - - * Animate the Color Similarity Tool Bar Item, to highlight the existence - of the feature - - And make the configuration more accessible - - Also add "Image / Draw With Color Similarity" to duplicate the tool - bar item - - * Make the Tool Box use as much vertical space as possible, since it - needs it for the option widgets. - - * Save local files atomically - KolourPaint will no longer truncate - an existing file if the KImageIO plugin for the file format is - missing or if you run out of disk space. - [also in branches/KDE/3.5] - - * Add "File / Scan..." feature (Martin Koller) - [also in branches/KDE/3.5/] - - * Fix crash triggered by rapidly deselecting a selection after - drag-scaling the selection (Bug #117866) - [also in branches/KDE/3.[345]/, branches/kolourpaint/1.2_kde3/] - - * Add global session save/restore (Bug #94651) - [also in branches/KDE/3.5/] - - * Make "File / Open Recent" consistently work when multiple windows are - open - [also in branches/KDE/3.5/] - - * CTRL+C'ing a text box also places the text in the middle-mouse-button - clipboard, in lieu of being able to highlight the text to do this - [also in branches/KDE/3.5/] - - * Change minimum allowed zoom level for the grid from 600% to 400% - [also in branches/KDE/3.5/] - - * Printing improvements (Bug #108976) - - Respect image DPI - - Fit image to page if image is too big - - Center image on page - [also in branches/KDE/3.5/] - - * Paste transparent pixels as black instead of uninitialized colors, - when the app does not support pasting transparent pixels (such as - OpenOffice.org) - [also in branches/KDE/3.5/] - - * Make "Edit / Paste in New Window" always paste white pixels as white - (it used to paste them as transparent when the selection transparency - mode was set to Transparent) - [also in branches/KDE/3.5/] - - * REGRESSION: The "Skew", "Rotate" and "Smooth Scale" effects produce - low quality results - (Bug #30) - - * REGRESSION: The rendering quality of a text box with opaque text but - a see-through background, on top of transparent document - areas, is lower than in KDE 3 versions of KolourPaint - (Bug #31) - - * REGRESSION: Spinboxes do not support text input - (see the "Update" part of Bug #4) - - * REGRESSION: InputMethod support was not ported to Qt4 so has been disabled - (Bug #27) - - * REGRESSION: The Tool Box and Color Tool Bar are no longer movable or - floatable - (Bug #29) - - KolourPaint 4.0.0 BETA contains all the fixes and features in KolourPaint - 1.4.8_relight (KDE 3.5.8), even though not all of them were listed - above. - - -KolourPaint 1.4_relight Series (branches/KDE/3.5/) -=============================== - -KolourPaint 1.4.1_relight (Frozen 2006-01-15) - - * Updated documentation (Thurston) - -KolourPaint 1.4_relight (Frozen 2005-11-08) - - * New icons (Danny Allen, Nuno Pinheiro) - - * Tool Box icon size is 22x22, not 16x16, at screen resolution >= 1024x768 - - * CTRL + Mouse Wheel = Zoom - - * While freehand selection scaling, holding Shift maintains aspect ratio - - * Prevent accidental drags in the Colour Palette from pasting text - containing the colour code - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Cells in the bottom row and cells in the rightmost column of the Colour - Palette are now the same size as the other cells - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Text drops to the empty part of the scrollview will not be placed - outside the document - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Rename icons from "hi" to "cr" - back to the state of 1.0 (Danny Allen) - but leave application icons as "hi" (Jonathan Riddell) - - * Enforce text box font height to prevent e.g. Chinese characters in - buggy fonts from enlarging the text box and putting the cursor out of - sync with the text - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Clicking in a text box selects a character based on its midpoint - - not leftmost point - to be consistent with all text editors - (esp. noticeable with big fonts) - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Return and Numpad 5 Key now draw - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Tool Actions placed outside the Tool Box resize with their toolbars - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Ensure Color Similarity maximum is 30, not 29 due to gcc4 - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Tool Box traps right clicks (for the RMB Menu) on top of tool options - widgets and the empty part of the Tool Box - [also in branches/KDE/3.[34]/, branches/kolourpaint/1.2_kde3/] - - * Correct and update image format associations to all formats supported - by KDE 3.5 (kdelibs/kimgio/:r466654) - - * String fixes (Stefan Winter) - [also in branches/KDE/3.4/] - - * Other string fixes (Malcolm Hunter, Clarence Dang, Stephan Binner) - - -KolourPaint 1.4_light Series (branches/KDE/3.4/) -============================ - -KolourPaint 1.4_light (Frozen 2005-02-22) - * Antialias text when the text box has a transparent background (Bug #24) - [later backported to branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Add Unzoomed Thumbnail Mode and Thumbnail Rectangle - * Add RMB context menu for when a selection tool is active (closing KDE - Bug #92882) - * More intuitive "Set as Image" behaviour (esp. with selection borders). - Thanks to Michael Lake for the feedback. - [later backported to branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * InputMethod support - [later backported to branches/kolourpaint/1.2_kde3/] - * Save "More Effects" dialog's last effect to config file - * Save "Resize / Scale" dialog's last "Keep aspect ratio" setting to - config file - * Add "Help / Acquiring Screenshots" - * Fix selection regressions introduced in 1.2: - - Make selection dragging with CTRL work again (copies selection onto - document) - - When creating freeform selections, include the starting point; also - avoids a QRegion crash with constructing 1-point regions - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Fix other selection bugs: - - When the user drags very quickly on a resize handle, resize the - selection instead of moving it - - Draw resize handles above the grid lines - not below - so that the - handles are always visible if they are supposed to be there - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Smaller selection and text box resize handles (visually not - actually) - covers up fewer selected pixels, doesn't cover up text - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Restore mouse cursor after deselecting selection/text tools - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Empty text clipboard fixes: - - Don't get stuck on a wait cursor after attempting to paste empty - text into a text box - - Prevent pasting text from creating a new text box if text is empty - - Prevent copying of empty text box - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Speed up renderer (most noticeable with diagonal drag-scrolling at - high zoom) - - Don't paint anything outside of the view's visible region - (previously, clipped only on view _widget_ region) - - Region-aware: paint component rectangles of the update region, - rather than the bounding rectangle - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * When changing between colour depth and quality widgets in the save - filedialog, make sure "Convert to:" and "Quality:" are correctly - rendered (hacking around a Qt redraw glitch) - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Fix crash after using the Colour Picker if it was the first used tool - [kolourpaint-1.2.2_kde3-color_picker_crash.diff] - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Fix crash due to text box when scaling image behind it - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Even when the thumbnail has focus (and not the main window), blink the - text cursor in all views - [kolourpaint-1.2.2_kde3-thumbnail_blink_text_cursor.diff] - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Correct "Soften" and "Sharpen" commands' command history names - * Correct invert commands' command history names - * Fix remaining untranslatable strings (closing KDE Bug #85785) - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Update image format associations to all formats supported by KDE 3.4 - * Remove unused images in doc directory - [also in branches/KDE/3.3/, branches/kolourpaint/1.2_kde3/] - * Correct kolourpaint.desktop "Terminal=" and "Categories=" syntax - (Benjamin Meyer) - - -KolourPaint 1.2 Series (branches/KDE/3.3/) -====================== - -Version 1.2 "ByFiat Everytime" (2004-08-18) - * Add up to 500 levels of Undo/Redo (minimum of 10 levels, maximum of - 500 as long as the total history size < 16MB) - * Add freehand resizing of image - * Add freehand smooth scaling of selections - * [also in 1.0 branch] New icons (Kristof Borrey) - * [also in 1.0 branch] Prefer Crystal SVG text icons over KolourPaint's - * [also in 1.0 branch] Add documentation in the KDE Help Centre - * Add drag scrolling - * Add "More Effects" dialog: - - Balance (Brightness, Contrast, Gamma) - - Emboss - - Flatten - - Invert (with choice of channels) - - Reduce Colours - - Soften & Sharpen - * File saving improvements: - - Support colour depths (optional dithering) and "colour monochrome" - - Support JPEG quality - - Realtime file dialog preview with estimated file size - - Retain PNG metadata - - Prompt when attempting lossy save - - Correctly save transparent selections (not as opaque) - * Dither more often when loading (and pasting) images for better quality - * Single key shortcuts for all tools and tool options (automatically - turned off when editing text but can then use Alt+Shift+) - * Arrow keys now move one document pixel - not view pixel - at a time - (more usable when zoomed in) - * Fix selection bugs: - - Fix duplicate "Selection: Create" undo entries (Bug #5a) - - Allow redoing of selection operation if border deselected (Bug #5b) - - Don't print to STDERR when undoing a selection border create - operation and border has already been deselected - - [also in 1.0 branch] When pulling a selection from the document, - only set the bits of the document to the background colour where the - transparent selection is opaque in the same place (this is only - noticeable with colour similarity turned on). Now moving a - selection away and then back to its original place is always a NOP - as it should be. - * Selections can be deselected using Esc or clicking on icon in Tool Box - * Accidental drag detection when deselecting selections or text boxes - * Prevent selection from being moved completely offscreen (at least 1 - pixel of the selection will stay within the view) - * Speed up copying selection when transparency is on - * Improve Text Tool usability: - - Allow single click creation of text box with a sane default size - - Allow freehand resizing of text boxes - - Add Opaque/Transparent selector for greater usability and - consistency with selections - - Minimum size is now 7x7 document pixels (1x1 - not 4x4 - border) - - Text cursor doesn't overlap border anymore - - When dropping text, paste at drop point - - When MMB pasting creates a new text box, do so at mouse position - * When MMB pasting text in an existing box, correctly paste multiline - clipboard contents - * Improve text quality: - - With a transparent background, don't antialias foreground opaque - text with arbitrarily chosen black - - Make sure transparent text shows up on opaque (usually, grey was - problematic) background - * Improve Resize/Scale dialog usability: - - Add Smooth Scale (useful for creating screenshot thumbnails) - - Allow manipulating image when selection is active - - Operation choices stand out as massive, easily clickable buttons - - Default focus on operation choices - * Warn if Resize/Scale, Rotate or Skew will take lots of memory - * Limit startup image size to 2048x2048 - * Eliminate flicker when scrolling - * Thumbnail fixes: - - Reduce flicker when appearing (Bug #2) - - More reasonable minimum size (actually enforce it) - - [also in 1.0 branch] Use deleteLater() - - [also in 1.0 branch] Save geometry even if it's closed very quickly - after a geometry change - * Restore last used tool and tool options on startup - * Add Export, Copy To File, Paste From File, Paste in New Window, - Full Screen Mode - * Add Zoom In/Out buttons to main toolbar - * Rename Crop options in an attempt to reduce confusion: - - "Autocrop" --> "Remove Internal Border" when selection active - - "Crop Outside Selection" --> "Set as Image (Crop)" - * "Set as Image" changes: - - Enable for text boxes - - Underneath transparent bits of selection, fill image with - transparent rather than with background colour - * Permit "reloading" of an empty document - * Fixes when the current URL doesn't exist: - - Don't reload if underlying file disappeared - - Don't add non-existent file to Recent Files history - - Ask to save before mailing or setting as wallpaper - * Only enable Show Path when there is a URL - * Pop up dialog (instead of printing to STDERR) and disable Edit/Paste - on CTRL+V if the clipboard contents disappeared due to the source - application quitting (and Klipper didn't retain clipboard contents) - * Image/Clear now always sets _everything_ within the selection boundary - to the background colour - including transparent pixels - * Add Preview button to Colour Similarity Dialog to work around Bug #4 - regarding spinboxes and enter key - * Colour Picker disallows trying to pick colour outside of image - * Make sure colour palette contains valid and visible colours at 8-bit - * [also in 1.0 branch] Fix (big) memory leak on kpSelection destruction - (Albert Astals Cid) - * Don't leak image dialogs' memory - * [also in 1.0 branch] Don't let C++ destruct the mask bitmap before its - painter when dbl-clicking the color eraser does NOP (avoids - QPaintDevice and X error) - * [also in 1.0 branch] Check for QImageDrag::canDecode() before calling - QImageDrag::decode() (prevents X and valgrind errors) - * [also in 1.0 branch] Fix compilation problem with QT_NO_ASCII_CAST - (Waldo Bastian) - * [also in 1.0 branch] Decrease application preference to below that of - a viewer (Stephan Kulow) - * Remember dialog dimensions - * Remove double dialog margins - * Fix missing i18n()'s - * Fix some untranslatable strings - * [also in 1.0 branch] Corrected several strings - * Remove unused icons - - -KolourPaint 1.0 Series (branches/kolourpaint/1.0/) -====================== - -Version 1.0 "Seagull" (2004-02-29) - * First stable release - diff --git a/kolourpaint/README b/kolourpaint/README deleted file mode 100644 index f281e628..00000000 --- a/kolourpaint/README +++ /dev/null @@ -1,105 +0,0 @@ - -KolourPaint Version 4.0.0 BETA (KDE 4.0.0 Release Frozen 2007-10-26) -http://www.kolourpaint.org/ - -Copyright (c) 2003-2007 Clarence Dang - - -For licensing and warranty information, read COPYING. -For known problems with this release of KolourPaint, read BUGS. -For what changes have been made, read NEWS. -For developer information, checkout branches/kolourpaint/control/. -For general information, read this file (README): - - -1. What is KolourPaint? -======================= - -KolourPaint is a free, easy-to-use paint program for KDE. - -It aims to be conceptually simple to understand; providing a level of -functionality targeted towards the average user. It's designed for daily -tasks like: - -* Painting - drawing diagrams and "finger painting" -* Image Manipulation - editing screenshots and photos; applying effects -* Icon Editing - drawing clipart and logos with transparency - -It's not an unusable and monolithic program where simple tasks like drawing -lines become near impossible. Nor is it so simple that it lacks essential -features like Undo/Redo. - -KolourPaint is opensource software written in C++ using the Qt and KDE -libraries. - - -2. Features -=========== - -* Undo/Redo Support (10-500 levels of history depending on memory usage) - -* Tools (single key shortcuts available for all tools) - - Brush, Color Eraser, Color Picker, Connected Lines a.k.a. Polyline - - Curve, Ellipse, Eraser, Flood Fill, Line, Pen, Polygon, Rectangle - - Rounded Rectangle, Spraycan, Text, Zoom - -* Selections (fully undo- and redo-able) - - Rectangular, Elliptical, Free-Form shapes - - Choice between Opaque and Transparent selections - - Full Clipboard/Edit Menu support - - Freehand resizeable - -* Configurable Color Palette - -* Color Similarity means that you can fill regions in dithered images and - photos - -* Transparency - - Draw transparent icons and logos on a checkerboard background - - All tools can draw in the "Transparent Color" - -* Image Effects - - Autocrop / Remove Internal Border - - Balance (Brightness, Contrast, Gamma) - - Clear, Emboss, Flatten, Flip, Histogram Equalizer - - Hue, Saturation, Value - - Invert (with choice of channels) - - Reduce Colors, Reduce to Grayscale, Resize, Rotate - - Scale, Set as Image (Crop), Skew, Smooth Scale, Soften & Sharpen - -* Close-up Editing - - Zoom (from 0.01x to 16x) - - Grid - - Thumbnail - -* File Operations - - Open/Save in all file formats provided by KImageIO - (PNG, JPEG, BMP, ICO, PCX, TIFF,...) with preview - - Print, Print Preview - - Mail - - Set as Wallpaper - - -3. Updates & More Information -============================= - -Visit: http://www.kolourpaint.org/ - - -4. Support -========== - -Visit: http://www.kolourpaint.org/ - -If you have any questions about compiling, installing or using KolourPaint, -don't be afraid to contact us. We try to support all versions of -KolourPaint and even issues with 3rd party binary packages. - - -5. Feedback -=========== - -Please send bug reports and feature requests to http://bugs.kde.org/. -Don't hesitate to report bugs nor hesitate to send us your wishes -- it -provides valuable feedback that will help to improve future versions of -KolourPaint and you will not receive flames for reporting duplicates. diff --git a/kolourpaint/VERSION b/kolourpaint/VERSION deleted file mode 100644 index 641b3a0f..00000000 --- a/kolourpaint/VERSION +++ /dev/null @@ -1 +0,0 @@ -KDE_VERSION_STRING diff --git a/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.cpp deleted file mode 100644 index 33b4122c..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BALANCE 0 - - -#include - -#include -#include - -#include - - -kpEffectBalanceCommand::kpEffectBalanceCommand (int channels, - int brightness, int contrast, int gamma, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Balance"), actOnSelection, environ), - m_channels (channels), - m_brightness (brightness), m_contrast (contrast), m_gamma (gamma) -{ -} - -kpEffectBalanceCommand::~kpEffectBalanceCommand () -{ -} - - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectBalanceCommand::applyEffect (const kpImage &image) -{ - return kpEffectBalance::applyEffect (image, m_channels, - m_brightness, m_contrast, m_gamma); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.h deleted file mode 100644 index c5053c12..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectBalanceCommand.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBalanceCommand_H -#define kpEffectBalanceCommand_H - - -#include -#include - - -class kpEffectBalanceCommand : public kpEffectCommandBase -{ -public: - // (, & are from -50 to 50) - kpEffectBalanceCommand (int channels, - int brightness, int contrast, int gamma, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectBalanceCommand (); - -protected: - virtual kpImage applyEffect (const kpImage &image); - -protected: - int m_channels; - int m_brightness, m_contrast, m_gamma; -}; - - -#endif // kpEffectBalanceCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.cpp deleted file mode 100644 index d2f0a70f..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BLUR_SHARPEN 0 - - -#include - -#include -#include - - -kpEffectBlurSharpenCommand::kpEffectBlurSharpenCommand (kpEffectBlurSharpen::Type type, - int strength, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (kpEffectBlurSharpenCommand::nameForType (type), - actOnSelection, environ), - m_type (type), - m_strength (strength) -{ -} - -kpEffectBlurSharpenCommand::~kpEffectBlurSharpenCommand () -{ -} - - -// public static -QString kpEffectBlurSharpenCommand::nameForType (kpEffectBlurSharpen::Type type) -{ - if (type == kpEffectBlurSharpen::Blur) - return i18n ("Soften"); - else if (type == kpEffectBlurSharpen::Sharpen) - return i18n ("Sharpen"); - else - return QString(); -} - - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectBlurSharpenCommand::applyEffect (const kpImage &image) -{ - return kpEffectBlurSharpen::applyEffect (image, m_type, m_strength); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.h deleted file mode 100644 index b2358371..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectBlurSharpenCommand.h +++ /dev/null @@ -1,58 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBlurSharpenCommand_H -#define kpEffectBlurSharpenCommand_H - - -#include -#include -#include - - -class kpEffectBlurSharpenCommand : public kpEffectCommandBase -{ -public: - kpEffectBlurSharpenCommand (kpEffectBlurSharpen::Type type, - int strength, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectBlurSharpenCommand (); - - static QString nameForType (kpEffectBlurSharpen::Type type); - -protected: - virtual kpImage applyEffect (const kpImage &image); - -protected: - kpEffectBlurSharpen::Type m_type; - int m_strength; -}; - - -#endif // kpEffectBlurSharpenCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.cpp deleted file mode 100644 index dafdb73a..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.cpp +++ /dev/null @@ -1,113 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include -#include -#include - - -kpEffectClearCommand::kpEffectClearCommand (bool actOnSelection, - const kpColor &newColor, - kpCommandEnvironment *environ) - : kpCommand (environ), - m_actOnSelection (actOnSelection), - m_newColor (newColor), - m_oldImagePtr (0) -{ -} - -kpEffectClearCommand::~kpEffectClearCommand () -{ - delete m_oldImagePtr; -} - - -// public virtual [base kpCommand] -QString kpEffectClearCommand::name () const -{ - QString opName = i18n ("Clear"); - - if (m_actOnSelection) - return i18n ("Selection: %1", opName); - else - return opName; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpEffectClearCommand::size () const -{ - return ImageSize (m_oldImagePtr); -} - - -// public virtual [base kpCommand] -void kpEffectClearCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - m_oldImagePtr = new kpImage (); - *m_oldImagePtr = doc->image (m_actOnSelection); - - - // REFACTOR: Would like to derive entire class from kpEffectCommandBase but - // this code makes it difficult since it's not just acting on pixels - // (kpAbstractImageSelection::fill() takes into account the shape of a selection). - if (m_actOnSelection) - { - // OPT: could just edit pixmap directly and signal change - kpAbstractImageSelection *sel = doc->imageSelection (); - Q_ASSERT (sel); - sel->fill (m_newColor); - } - else - doc->fill (m_newColor); -} - -// public virtual [base kpCommand] -void kpEffectClearCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - doc->setImage (m_actOnSelection, *m_oldImagePtr); - - - delete m_oldImagePtr; - m_oldImagePtr = 0; -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.h deleted file mode 100644 index 6578e260..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectClearCommand.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectClearCommand_H -#define kpEffectClearCommand_H - - -#include - -#include -#include - - -class kpEffectClearCommand : public kpCommand -{ -public: - kpEffectClearCommand (bool actOnSelection, - const kpColor &newColor, - kpCommandEnvironment *environ); - virtual ~kpEffectClearCommand (); - - virtual QString name () const; - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - bool m_actOnSelection; - - kpColor m_newColor; - kpImage *m_oldImagePtr; -}; - - -#endif // kpEffectClearCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.cpp b/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.cpp deleted file mode 100644 index d43d82df..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.cpp +++ /dev/null @@ -1,127 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include -#include - - -struct kpEffectCommandBasePrivate -{ - QString name; - bool actOnSelection; - - kpImage oldImage; -}; - -kpEffectCommandBase::kpEffectCommandBase (const QString &name, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpCommand (environ), - d (new kpEffectCommandBasePrivate ()) -{ - d->name = name; - d->actOnSelection = actOnSelection; -} - -kpEffectCommandBase::~kpEffectCommandBase () -{ - delete d; -} - - -// public virtual [base kpCommand] -QString kpEffectCommandBase::name () const -{ - if (d->actOnSelection) - return i18n ("Selection: %1", d->name); - else - return d->name; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpEffectCommandBase::size () const -{ - return ImageSize (d->oldImage); -} - - -// public virtual [base kpCommand] -void kpEffectCommandBase::execute () -{ - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - kpDocument *doc = document (); - Q_ASSERT (doc); - - - const kpImage oldImage = doc->image (d->actOnSelection); - - if (!isInvertible ()) - { - d->oldImage = oldImage; - } - - - kpImage newImage = /*pure virtual*/applyEffect (oldImage); - - doc->setImage (d->actOnSelection, newImage); -} - -// public virtual [base kpCommand] -void kpEffectCommandBase::unexecute () -{ - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - kpDocument *doc = document (); - Q_ASSERT (doc); - - - kpImage newImage; - - if (!isInvertible ()) - { - newImage = d->oldImage; - } - else - { - newImage = /*pure virtual*/applyEffect (doc->image (d->actOnSelection)); - } - - doc->setImage (d->actOnSelection, newImage); - - - d->oldImage = kpImage (); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.h b/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.h deleted file mode 100644 index 3cf15e69..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectCommandBase.h +++ /dev/null @@ -1,67 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectCommandBase_H -#define kpEffectCommandBase_H - - -#include - -#include -#include - - -class kpEffectCommandBase : public kpCommand -{ -public: - kpEffectCommandBase (const QString &name, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectCommandBase (); - - virtual QString name () const; - virtual SizeType size () const; - -public: - virtual void execute (); - virtual void unexecute (); - -public: - // Return true if applyEffect(applyEffect(image)) == image - // to avoid storing the old image, saving memory. - virtual bool isInvertible () const { return false; } - -protected: - virtual kpImage applyEffect (const kpImage &image) = 0; - -private: - struct kpEffectCommandBasePrivate *d; -}; - - -#endif // kpEffectCommandBase_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.cpp deleted file mode 100644 index 473db0f7..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_EMBOSS 0 - - -#include - -#include -#include - -#include - - -kpEffectEmbossCommand::kpEffectEmbossCommand (int strength, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Emboss"), actOnSelection, environ), - m_strength (strength) -{ -} - -kpEffectEmbossCommand::~kpEffectEmbossCommand () -{ -} - - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectEmbossCommand::applyEffect (const kpImage &image) -{ - return kpEffectEmboss::applyEffect (image, m_strength); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.h deleted file mode 100644 index b97d9f02..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectEmbossCommand.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectEmbossCommand_H -#define kpEffectEmbossCommand_H - - -#include -#include - - -class kpEffectEmbossCommand : public kpEffectCommandBase -{ -public: - kpEffectEmbossCommand (int strength, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectEmbossCommand (); - -protected: - virtual kpImage applyEffect (const kpImage &image); - -protected: - int m_strength; -}; - - -#endif // kpEffectEmbossCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.cpp deleted file mode 100644 index 1188e76d..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_FLATTEN 0 - - -#include - -#include -#include - -#include - - -kpEffectFlattenCommand::kpEffectFlattenCommand (const QColor &color1, - const QColor &color2, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Flatten"), actOnSelection, environ), - m_color1 (color1), m_color2 (color2) -{ -} - -kpEffectFlattenCommand::~kpEffectFlattenCommand () -{ -} - - -// -// kpEffectFlattenCommand implements kpEffectCommandBase interface -// - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectFlattenCommand::applyEffect (const kpImage &image) -{ - return kpEffectFlatten::applyEffect (image, m_color1, m_color2); -} - - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.h deleted file mode 100644 index a69716a3..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectFlattenCommand.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectFlattenCommand_H -#define kpEffectFlattenCommand_H - - -#include - -#include -#include - - -class kpEffectFlattenCommand : public kpEffectCommandBase -{ -public: - kpEffectFlattenCommand (const QColor &color1, const QColor &color2, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectFlattenCommand (); - - - // - // kpEffectCommandBase interface - // - -protected: - virtual kpImage applyEffect (const kpImage &image); - - QColor m_color1, m_color2; -}; - - -#endif // kpEffectFlattenCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.cpp deleted file mode 100644 index e4659f90..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - -#include - - -kpEffectGrayscaleCommand::kpEffectGrayscaleCommand ( - bool actOnSelection, - kpCommandEnvironment *environ) - - : kpEffectCommandBase ( - i18n ("Reduce to Grayscale"), - actOnSelection, - environ) -{ -} - -kpEffectGrayscaleCommand::~kpEffectGrayscaleCommand () -{ -} - - -// -// kpEffectGrayscaleCommand implements kpEffectCommandBase interface -// - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectGrayscaleCommand::applyEffect (const kpImage &image) -{ - return kpEffectGrayscale::applyEffect (image); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.h deleted file mode 100644 index 56c92590..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectGrayscaleCommand.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectGrayscaleCommand_H -#define kpEffectGrayscaleCommand_H - - -#include -#include - - -class kpEffectGrayscaleCommand : public kpEffectCommandBase -{ -public: - kpEffectGrayscaleCommand (bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectGrayscaleCommand (); - - - // - // kpEffectCommandBase interface - // - -public: - virtual bool isInvertible () const { return false; } - -protected: - virtual kpImage applyEffect (const kpImage &image); -}; - - -#endif // kpEffectGrayscaleCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.cpp deleted file mode 100644 index 5f9b327f..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpEffectHSVCommand::kpEffectHSVCommand (double hue, double saturation, double value, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Hue, Saturation, Value"), actOnSelection, environ), - m_hue (hue), m_saturation (saturation), m_value (value) -{ -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectHSVCommand::applyEffect (const kpImage &image) -{ - return kpEffectHSV::applyEffect (image, m_hue, m_saturation, m_value); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.h deleted file mode 100644 index 9c293358..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectHSVCommand.h +++ /dev/null @@ -1,51 +0,0 @@ - -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectHSVCommand_H -#define kpEffectHSVCommand_H - - -#include - - -class kpEffectHSVCommand : public kpEffectCommandBase -{ -public: - kpEffectHSVCommand (double hue, double saturation, double value, - bool actOnSelection, - kpCommandEnvironment *environ); - -protected: - virtual kpImage applyEffect (const kpImage &image); - -protected: - double m_hue, m_saturation, m_value; -}; - - -#endif // kpEffectHSVCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.cpp deleted file mode 100644 index 373c8470..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_INVERT 0 - - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - - -kpEffectInvertCommand::kpEffectInvertCommand (int channels, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (channels == kpEffectInvert::RGB ? - i18n ("Invert Colors") : i18n ("Invert"), - actOnSelection, environ), - m_channels (channels) -{ -} - -kpEffectInvertCommand::kpEffectInvertCommand (bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Invert Colors"), actOnSelection, environ), - m_channels (kpEffectInvert::RGB) -{ -} - -kpEffectInvertCommand::~kpEffectInvertCommand () -{ -} - - -// -// kpEffectInvertCommand implements kpEffectCommandBase interface -// - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectInvertCommand::applyEffect (const kpImage &image) -{ - return kpEffectInvert::applyEffect (image, m_channels); -} - - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.h deleted file mode 100644 index f5eee36e..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectInvertCommand.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectInvertCommand_H -#define kpEffectInvertCommand_H - - -#include -#include - - - -class kpEffectInvertCommand : public kpEffectCommandBase -{ -public: - kpEffectInvertCommand (int channels, - bool actOnSelection, - kpCommandEnvironment *environ); - kpEffectInvertCommand (bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectInvertCommand (); - - - // - // kpEffectCommandBase interface - // - -public: - virtual bool isInvertible () const { return true; } - -protected: - virtual kpImage applyEffect (const kpImage &image); - - int m_channels; -}; - - -#endif // kpEffectInvertCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.cpp deleted file mode 100644 index 4e5f5bf7..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_REDUCE_COLORS 0 - - -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpEffectReduceColorsCommand::kpEffectReduceColorsCommand (int depth, bool dither, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (commandName (depth, dither), actOnSelection, environ), - m_depth (depth), m_dither (dither) -{ -} - -//--------------------------------------------------------------------- - -// public -QString kpEffectReduceColorsCommand::commandName (int depth, int dither) const -{ - if (depth == 1) - { - if (dither) - return i18n ("Reduce to Monochrome (Dithered)"); - else - return i18n ("Reduce to Monochrome"); - } - else if (depth == 8) - { - if (dither) - return i18n ("Reduce to 256 Color (Dithered)"); - else - return i18n ("Reduce to 256 Color"); - } - else - { - return QString(); - } -} - -//--------------------------------------------------------------------- - -// -// kpEffectReduceColorsCommand implements kpEffectCommandBase interface -// - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectReduceColorsCommand::applyEffect (const kpImage &image) -{ - return kpEffectReduceColors::applyEffect (image, m_depth, m_dither); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.h deleted file mode 100644 index 06ecac6f..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectReduceColorsCommand.h +++ /dev/null @@ -1,60 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectReduceColorsCommand_H -#define kpEffectReduceColorsCommand_H - - -#include -#include - - - -class kpEffectReduceColorsCommand : public kpEffectCommandBase -{ -public: - // depth must be 1 or 8 - kpEffectReduceColorsCommand (int depth, bool dither, - bool actOnSelection, - kpCommandEnvironment *environ); - - QString commandName (int depth, int dither) const; - - // - // kpEffectCommandBase interface - // - -protected: - virtual kpImage applyEffect (const kpImage &image); - - int m_depth; - bool m_dither; -}; - - -#endif // kpEffectReduceColorsCommand_H diff --git a/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.cpp b/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.cpp deleted file mode 100644 index 1d6d2892..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include - - -kpEffectToneEnhanceCommand::kpEffectToneEnhanceCommand (double granularity, double amount, - bool actOnSelection, - kpCommandEnvironment *environ) - : kpEffectCommandBase (i18n ("Histogram Equalizer"), actOnSelection, environ), - m_granularity (granularity), m_amount (amount) -{ -} - -kpEffectToneEnhanceCommand::~kpEffectToneEnhanceCommand () -{ -} - - -// protected virtual [base kpEffectCommandBase] -kpImage kpEffectToneEnhanceCommand::applyEffect (const kpImage &image) -{ - return kpEffectToneEnhance::applyEffect (image, m_granularity, m_amount); -} - diff --git a/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.h b/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.h deleted file mode 100644 index 7a29da80..00000000 --- a/kolourpaint/commands/imagelib/effects/kpEffectToneEnhanceCommand.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectToneEnhanceCommand_H -#define kpEffectToneEnhanceCommand_H - - -#include - - -class kpEffectToneEnhanceCommand : public kpEffectCommandBase -{ -public: - kpEffectToneEnhanceCommand (double granularity, double amount, - bool actOnSelection, - kpCommandEnvironment *environ); - virtual ~kpEffectToneEnhanceCommand (); - -protected: - virtual kpImage applyEffect (const kpImage &image); - -protected: - double m_granularity, m_amount; -}; - - -#endif // kpEffectToneEnhanceCommand_H diff --git a/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.cpp b/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.cpp deleted file mode 100644 index 78384822..00000000 --- a/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.cpp +++ /dev/null @@ -1,89 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include -#include - - -struct kpDocumentMetaInfoCommandPrivate -{ - kpDocumentMetaInfo metaInfo, oldMetaInfo; -}; - -kpDocumentMetaInfoCommand::kpDocumentMetaInfoCommand (const QString &name, - const kpDocumentMetaInfo &metaInfo, - const kpDocumentMetaInfo &oldMetaInfo, - kpCommandEnvironment *environ) - - : kpNamedCommand (name, environ), - d (new kpDocumentMetaInfoCommandPrivate ()) -{ - d->metaInfo = metaInfo; - d->oldMetaInfo = oldMetaInfo; -} - -kpDocumentMetaInfoCommand::~kpDocumentMetaInfoCommand () -{ - delete d; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpDocumentMetaInfoCommand::size () const -{ - return d->metaInfo.size () + d->oldMetaInfo.size (); -} - - -// public virtual [base kpCommand] -void kpDocumentMetaInfoCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - doc->setMetaInfo (d->metaInfo); - doc->setModified (); -} - -// public virtual [base kpCommand] -void kpDocumentMetaInfoCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - // REFACTOR: Document in kpDocument.h that kpDocument::setMetaInfo() does not mutate modified state - doc->setMetaInfo (d->oldMetaInfo); - doc->setModified (); -} - diff --git a/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.h b/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.h deleted file mode 100644 index c7c40e2c..00000000 --- a/kolourpaint/commands/imagelib/kpDocumentMetaInfoCommand.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentMetaInfoCommand_H -#define kpDocumentMetaInfoCommand_H - - -#include - - -class kpDocumentMetaInfo; - - -class kpDocumentMetaInfoCommand : public kpNamedCommand -{ -public: - kpDocumentMetaInfoCommand (const QString &name, - const kpDocumentMetaInfo &metaInfo, - const kpDocumentMetaInfo &oldMetaInfo, - kpCommandEnvironment *environ); - virtual ~kpDocumentMetaInfoCommand (); - - virtual SizeType size () const; - -public: - virtual void execute (); - virtual void unexecute (); - -private: - struct kpDocumentMetaInfoCommandPrivate * const d; -}; - - -#endif // kpDocumentMetaInfoCommand_H diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.cpp b/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.cpp deleted file mode 100644 index b8228bfa..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.cpp +++ /dev/null @@ -1,141 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpTransformFlipCommand::kpTransformFlipCommand (bool actOnSelection, - bool horiz, bool vert, - kpCommandEnvironment *environ) - : kpCommand (environ), - m_actOnSelection (actOnSelection), - m_horiz (horiz), m_vert (vert) -{ -} - -//--------------------------------------------------------------------- - -kpTransformFlipCommand::~kpTransformFlipCommand () -{ -} - -//--------------------------------------------------------------------- -// public virtual [base kpCommand] - -QString kpTransformFlipCommand::name () const -{ - QString opName; - - -#if 1 - opName = i18n ("Flip"); -#else // re-enable when giving full descriptions for all actions - if (m_horiz && m_vert) - opName = i18n ("Flip horizontally and vertically"); - else if (m_horiz) - opName = i18n ("Flip horizontally"); - else if (m_vert) - opName = i18n ("Flip vertically"); - else - { - kError () << "kpTransformFlipCommand::name() not asked to flip" << endl; - return QString(); - } -#endif - - - if (m_actOnSelection) - return i18n ("Selection: %1", opName); - else - return opName; -} - -//--------------------------------------------------------------------- -// public virtual [base kpCommand] - -kpCommandSize::SizeType kpTransformFlipCommand::size () const -{ - return 0; -} - -//--------------------------------------------------------------------- -// public virtual [base kpCommand] - -void kpTransformFlipCommand::execute () -{ - flip (); -} - -//--------------------------------------------------------------------- -// public virtual [base kpCommand] - -void kpTransformFlipCommand::unexecute () -{ - flip (); -} - -//--------------------------------------------------------------------- -// private - -void kpTransformFlipCommand::flip () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - QApplication::setOverrideCursor (Qt::WaitCursor); - - if (m_actOnSelection) - { - Q_ASSERT (doc->imageSelection ()); - doc->imageSelection ()->flip (m_horiz, m_vert); - environ ()->somethingBelowTheCursorChanged (); - } - else - { - doc->setImage(doc->image().mirrored(m_horiz, m_vert)); - } - - QApplication::restoreOverrideCursor (); -} diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.h b/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.h deleted file mode 100644 index fd11483f..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformFlipCommand.h +++ /dev/null @@ -1,60 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformFlipCommand_H -#define kpTransformFlipCommand_H - - -#include - - -class kpTransformFlipCommand : public kpCommand -{ -public: - kpTransformFlipCommand (bool actOnSelection, - bool horiz, bool vert, - kpCommandEnvironment *environ); - - virtual ~kpTransformFlipCommand (); - - virtual QString name () const; - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - void flip (); - - bool m_actOnSelection; - bool m_horiz, m_vert; -}; - - -#endif // kpTransformFlipCommand_H diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp b/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp deleted file mode 100644 index bdc33e65..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp +++ /dev/null @@ -1,486 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_RESIZE_SCALE_COMMAND 0 -#define DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG 0 - - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -kpTransformResizeScaleCommand::kpTransformResizeScaleCommand (bool actOnSelection, - int newWidth, int newHeight, - Type type, - kpCommandEnvironment *environ) - : kpCommand (environ), - m_actOnSelection (actOnSelection), - m_type (type), - m_backgroundColor (environ->backgroundColor ()), - m_oldSelectionPtr (0) -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - m_oldWidth = doc->width (m_actOnSelection); - m_oldHeight = doc->height (m_actOnSelection); - - m_actOnTextSelection = (m_actOnSelection && - doc->textSelection ()); - - resize (newWidth, newHeight); - - // If we have a selection _border_ (but not a floating selection), - // then scale the selection with the document - m_scaleSelectionWithImage = (!m_actOnSelection && - (m_type == Scale || m_type == SmoothScale) && - document ()->selection () && - !document ()->selection ()->hasContent ()); -} - -kpTransformResizeScaleCommand::~kpTransformResizeScaleCommand () -{ - delete m_oldSelectionPtr; -} - - -// public virtual [base kpCommand] -QString kpTransformResizeScaleCommand::name () const -{ - if (m_actOnSelection) - { - if (m_actOnTextSelection) - { - if (m_type == Resize) - return i18n ("Text: Resize Box"); - } - else - { - if (m_type == Scale) - return i18n ("Selection: Scale"); - else if (m_type == SmoothScale) - return i18n ("Selection: Smooth Scale"); - } - } - else - { - switch (m_type) - { - case Resize: - return i18n ("Resize"); - case Scale: - return i18n ("Scale"); - case SmoothScale: - return i18n ("Smooth Scale"); - } - } - - return QString (); -} - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpTransformResizeScaleCommand::size () const -{ - return ImageSize (m_oldImage) + - ImageSize (m_oldRightImage) + - ImageSize (m_oldBottomImage) + - SelectionSize (m_oldSelectionPtr); -} - - -// public -int kpTransformResizeScaleCommand::newWidth () const -{ - return m_newWidth; -} - -// public -void kpTransformResizeScaleCommand::setNewWidth (int width) -{ - resize (width, newHeight ()); -} - - -// public -int kpTransformResizeScaleCommand::newHeight () const -{ - return m_newHeight; -} - -// public -void kpTransformResizeScaleCommand::setNewHeight (int height) -{ - resize (newWidth (), height); -} - - -// public -QSize kpTransformResizeScaleCommand::newSize () const -{ - return QSize (newWidth (), newHeight ()); -} - -// public virtual -void kpTransformResizeScaleCommand::resize (int width, int height) -{ - m_newWidth = width; - m_newHeight = height; - - m_isLosslessScale = ((m_type == Scale) && - (m_newWidth / m_oldWidth * m_oldWidth == m_newWidth) && - (m_newHeight / m_oldHeight * m_oldHeight == m_newHeight)); -} - - -// public -bool kpTransformResizeScaleCommand::scaleSelectionWithImage () const -{ - return m_scaleSelectionWithImage; -} - - -// private -void kpTransformResizeScaleCommand::scaleSelectionRegionWithDocument () -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_COMMAND - kDebug () << "kpTransformResizeScaleCommand::scaleSelectionRegionWithDocument" - << endl; -#endif - - Q_ASSERT (m_oldSelectionPtr); - Q_ASSERT (!m_oldSelectionPtr->hasContent ()); - - - const double horizScale = double (m_newWidth) / double (m_oldWidth); - const double vertScale = double (m_newHeight) / double (m_oldHeight); - - const int newX = (int) (m_oldSelectionPtr->x () * horizScale); - const int newY = (int) (m_oldSelectionPtr->y () * vertScale); - - - QPolygon currentPoints = m_oldSelectionPtr->calculatePoints (); - currentPoints.translate (-currentPoints.boundingRect ().x (), - -currentPoints.boundingRect ().y ()); - - // TODO: refactor into kpPixmapFX - // TODO: Can we get to size 0x0 accidently? - QMatrix scaleMatrix; - scaleMatrix.scale (horizScale, vertScale); - currentPoints = scaleMatrix.map (currentPoints); - - currentPoints.translate ( - -currentPoints.boundingRect ().x () + newX, - -currentPoints.boundingRect ().y () + newY); - - kpAbstractImageSelection *imageSel = - dynamic_cast (m_oldSelectionPtr); - kpTextSelection *textSel = - dynamic_cast (m_oldSelectionPtr); - if (imageSel) - { - document ()->setSelection ( - kpFreeFormImageSelection (currentPoints, kpImage (), - imageSel->transparency ())); - } - else if (textSel) - { - document ()->setSelection ( - kpTextSelection (currentPoints.boundingRect (), - textSel->textLines (), - textSel->textStyle ())); - } - else - Q_ASSERT (!"Unknown selection type"); - - - environ ()->somethingBelowTheCursorChanged (); -} - - -// public virtual [base kpCommand] -void kpTransformResizeScaleCommand::execute () -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_COMMAND - kDebug () << "kpTransformResizeScaleCommand::execute() type=" - << (int) m_type - << " oldWidth=" << m_oldWidth - << " oldHeight=" << m_oldHeight - << " newWidth=" << m_newWidth - << " newHeight=" << m_newHeight - << endl; -#endif - - if (m_oldWidth == m_newWidth && m_oldHeight == m_newHeight) - return; - - if (m_type == Resize) - { - if (m_actOnSelection) - { - if (!m_actOnTextSelection) - Q_ASSERT (!"kpTransformResizeScaleCommand::execute() resizing sel doesn't make sense"); - - QApplication::setOverrideCursor (Qt::WaitCursor); - - kpTextSelection *textSel = textSelection (); - Q_ASSERT (textSel); - - kpTextSelection *newSel = textSel->resized (m_newWidth, m_newHeight); - document ()->setSelection (*newSel); - delete newSel; - - environ ()->somethingBelowTheCursorChanged (); - - QApplication::restoreOverrideCursor (); - } - else - { - QApplication::setOverrideCursor (Qt::WaitCursor); - - - if (m_newWidth < m_oldWidth) - { - m_oldRightImage = document ()->getImageAt ( - QRect (m_newWidth, 0, - m_oldWidth - m_newWidth, m_oldHeight)); - } - - if (m_newHeight < m_oldHeight) - { - m_oldBottomImage = document ()->getImageAt ( - QRect (0, m_newHeight, - m_newWidth, m_oldHeight - m_newHeight)); - } - - document ()->resize (m_newWidth, m_newHeight, m_backgroundColor); - - - QApplication::restoreOverrideCursor (); - } - } - // Scale - else - { - QApplication::setOverrideCursor (Qt::WaitCursor); - - - kpImage oldImage = document ()->image (m_actOnSelection); - - if (!m_isLosslessScale) - m_oldImage = oldImage; - - kpImage newImage = kpPixmapFX::scale (oldImage, m_newWidth, m_newHeight, - m_type == SmoothScale); - - - if (!m_oldSelectionPtr && document ()->selection ()) - { - // Save sel border - m_oldSelectionPtr = document ()->selection ()->clone (); - m_oldSelectionPtr->deleteContent (); - } - - if (m_actOnSelection) - { - if (m_actOnTextSelection) - Q_ASSERT (!"kpTransformResizeScaleCommand::execute() scaling text sel doesn't make sense"); - - Q_ASSERT (m_oldSelectionPtr); - if ( !m_oldSelectionPtr ) // make coverity happy - return; - - QRect newRect = QRect (m_oldSelectionPtr->x (), m_oldSelectionPtr->y (), - newImage.width (), newImage.height ()); - - // Not possible to retain non-rectangular selection borders on scale - // (think about e.g. a 45 deg line as part of the border & 2x scale) - Q_ASSERT (dynamic_cast (m_oldSelectionPtr)); - document ()->setSelection ( - kpRectangularImageSelection (newRect, newImage, - static_cast (m_oldSelectionPtr) - ->transparency ())); - - environ ()->somethingBelowTheCursorChanged (); - } - else - { - document ()->setImage (newImage); - - if (m_scaleSelectionWithImage) - { - scaleSelectionRegionWithDocument (); - } - } - - - QApplication::restoreOverrideCursor (); - } -} - -// public virtual [base kpCommand] -void kpTransformResizeScaleCommand::unexecute () -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_COMMAND - kDebug () << "kpTransformResizeScaleCommand::unexecute() type=" - << m_type << endl; -#endif - - if (m_oldWidth == m_newWidth && m_oldHeight == m_newHeight) - return; - - kpDocument *doc = document (); - Q_ASSERT (doc); - - if (m_type == Resize) - { - if (m_actOnSelection) - { - if (!m_actOnTextSelection) - Q_ASSERT (!"kpTransformResizeScaleCommand::unexecute() resizing sel doesn't make sense"); - - QApplication::setOverrideCursor (Qt::WaitCursor); - - kpTextSelection *textSel = textSelection (); - Q_ASSERT (textSel); - - kpTextSelection *newSel = textSel->resized (m_oldWidth, m_oldHeight); - document ()->setSelection (*newSel); - delete newSel; - - environ ()->somethingBelowTheCursorChanged (); - - QApplication::restoreOverrideCursor (); - } - else - { - QApplication::setOverrideCursor (Qt::WaitCursor); - - - kpImage newImage (m_oldWidth, m_oldHeight, QImage::Format_ARGB32_Premultiplied); - - kpPixmapFX::setPixmapAt (&newImage, QPoint (0, 0), - doc->image ()); - - if (m_newWidth < m_oldWidth) - { - kpPixmapFX::setPixmapAt (&newImage, - QPoint (m_newWidth, 0), - m_oldRightImage); - } - - if (m_newHeight < m_oldHeight) - { - kpPixmapFX::setPixmapAt (&newImage, - QPoint (0, m_newHeight), - m_oldBottomImage); - } - - doc->setImage (newImage); - - - QApplication::restoreOverrideCursor (); - } - } - // Scale - else - { - QApplication::setOverrideCursor (Qt::WaitCursor); - - - kpImage oldImage; - - if (!m_isLosslessScale) - oldImage = m_oldImage; - else - oldImage = kpPixmapFX::scale (doc->image (m_actOnSelection), - m_oldWidth, m_oldHeight); - - - if (m_actOnSelection) - { - if (m_actOnTextSelection) - Q_ASSERT (!"kpTransformResizeScaleCommand::unexecute() scaling text sel doesn't make sense"); - - Q_ASSERT (dynamic_cast (m_oldSelectionPtr)); - kpAbstractImageSelection *oldImageSel = - static_cast (m_oldSelectionPtr); - - kpAbstractImageSelection *oldSelection = oldImageSel->clone (); - oldSelection->setBaseImage (oldImage); - doc->setSelection (*oldSelection); - delete oldSelection; - - environ ()->somethingBelowTheCursorChanged (); - } - else - { - doc->setImage (oldImage); - - if (m_scaleSelectionWithImage) - { - doc->setSelection (*m_oldSelectionPtr); - - environ ()->somethingBelowTheCursorChanged (); - } - } - - - QApplication::restoreOverrideCursor (); - } -} - diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.h b/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.h deleted file mode 100644 index fd1b0c2d..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformResizeScaleCommand.h +++ /dev/null @@ -1,102 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformResizeScaleCommand_H -#define kpTransformResizeScaleCommand_H - - -#include - -#include - -#include -#include -#include - - -#include - -class kpAbstractSelection; - - -// REFACTOR: Split into multiple classes, each doing a different thing -// e.g. resize, scale and smooth scale. -// REFACTOR: Replace kpToolSelectionResizeScaleCommand with us. -class kpTransformResizeScaleCommand : public kpCommand -{ -public: - enum Type - { - Resize, Scale, SmoothScale - }; - - kpTransformResizeScaleCommand (bool actOnSelection, - int newWidth, int newHeight, - Type type, - kpCommandEnvironment *environ); - virtual ~kpTransformResizeScaleCommand (); - - virtual QString name () const; - virtual SizeType size () const; - -public: - int newWidth () const; - void setNewWidth (int width); - - int newHeight () const; - void setNewHeight (int height); - - QSize newSize () const; - virtual void resize (int width, int height); - -public: - bool scaleSelectionWithImage () const; - -private: - void scaleSelectionRegionWithDocument (); - -public: - virtual void execute (); - virtual void unexecute (); - -protected: - bool m_actOnSelection; - int m_newWidth, m_newHeight; - Type m_type; - bool m_isLosslessScale; - bool m_scaleSelectionWithImage; - kpColor m_backgroundColor; - - int m_oldWidth, m_oldHeight; - bool m_actOnTextSelection; - kpImage m_oldImage, m_oldRightImage, m_oldBottomImage; - kpAbstractSelection *m_oldSelectionPtr; -}; - - -#endif // kpTransformResizeScaleCommand_H diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.cpp b/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.cpp deleted file mode 100644 index 4eb96b1d..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.cpp +++ /dev/null @@ -1,223 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_ROTATE 0 - - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -kpTransformRotateCommand::kpTransformRotateCommand (bool actOnSelection, - double angle, - kpCommandEnvironment *environ) - : kpCommand (environ), - m_actOnSelection (actOnSelection), - m_angle (angle), - m_backgroundColor (environ->backgroundColor (actOnSelection)), - m_losslessRotation (kpPixmapFX::isLosslessRotation (angle)), - m_oldSelectionPtr (0) -{ -} - -kpTransformRotateCommand::~kpTransformRotateCommand () -{ - delete m_oldSelectionPtr; -} - - -// public virtual [base kpCommand] -QString kpTransformRotateCommand::name () const -{ - QString opName = i18n ("Rotate"); - - if (m_actOnSelection) - return i18n ("Selection: %1", opName); - else - return opName; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpTransformRotateCommand::size () const -{ - return ImageSize (m_oldImage) + - SelectionSize (m_oldSelectionPtr); -} - - -// public virtual [base kpCommand] -void kpTransformRotateCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - QApplication::setOverrideCursor (Qt::WaitCursor); - - - if (!m_losslessRotation) - m_oldImage = doc->image (m_actOnSelection); - - - kpImage newImage = kpPixmapFX::rotate (doc->image (m_actOnSelection), - m_angle, - m_backgroundColor); - - if (!m_actOnSelection) - doc->setImage (newImage); - else - { - kpAbstractImageSelection *sel = doc->imageSelection (); - Q_ASSERT (sel); - - // Save old selection - m_oldSelectionPtr = sel->clone (); - - // Conserve memmory: - // - // 1. If it's a lossless rotation, we don't need to the store old - // image anywhere at all, as we can reconstruct it by rotating in - // reverse. - // 2. If it's not a lossless rotation, "m_oldImage" already holds - // a copy of the old image. In this case, we actually save very - // little with this line (just, the computed transpareny mask) since - // kpImage is copy-on-write. - m_oldSelectionPtr->setBaseImage (kpImage ()); - - - // Calculate new top left (so selection rotates about center) - // (the Times2 trickery is used to reduce integer division error without - // resorting to the troublesome world of floating point) - QPoint oldCenterTimes2 (sel->x () * 2 + sel->width (), - sel->y () * 2 + sel->height ()); - QPoint newTopLeftTimes2 (oldCenterTimes2 - QPoint (newImage.width (), newImage.height ())); - QPoint newTopLeft (newTopLeftTimes2.x () / 2, newTopLeftTimes2.y () / 2); - - - // Calculate rotated points - QPolygon currentPoints = sel->calculatePoints (); - currentPoints.translate (-currentPoints.boundingRect ().x (), - -currentPoints.boundingRect ().y ()); - QMatrix rotateMatrix = kpPixmapFX::rotateMatrix (doc->image (m_actOnSelection), m_angle); - currentPoints = rotateMatrix.map (currentPoints); - currentPoints.translate (-currentPoints.boundingRect ().x () + newTopLeft.x (), - -currentPoints.boundingRect ().y () + newTopLeft.y ()); - - - if (currentPoints.boundingRect ().width () == newImage.width () && - currentPoints.boundingRect ().height () == newImage.height ()) - { - doc->setSelection ( - kpFreeFormImageSelection ( - currentPoints, newImage, - m_oldSelectionPtr->transparency ())); - } - else - { - // TODO: fix the latter "victim of" problem in kpAbstractImageSelection by - // allowing the border width & height != pixmap width & height - // Or maybe autocrop? - #if DEBUG_KP_TOOL_ROTATE - kDebug () << "kpTransformRotateCommand::execute() currentPoints.boundingRect=" - << currentPoints.boundingRect () - << " newPixmap: w=" << newImage.width () - << " h=" << newImage.height () - << " (victim of rounding error and/or rotated-a-(rectangular)-pixmap-that-was-transparent-in-the-corners-making-sel-uselessly-bigger-than-needs-be)" - << endl; - #endif - doc->setSelection ( - kpRectangularImageSelection ( - QRect (newTopLeft.x (), newTopLeft.y (), - newImage.width (), newImage.height ()), - newImage, - m_oldSelectionPtr->transparency ())); - } - - environ ()->somethingBelowTheCursorChanged (); - } - - - QApplication::restoreOverrideCursor (); -} - -// public virtual [base kpCommand] -void kpTransformRotateCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - QApplication::setOverrideCursor (Qt::WaitCursor); - - - kpImage oldImage; - - if (!m_losslessRotation) - { - oldImage = m_oldImage; - m_oldImage = kpImage (); - } - else - { - oldImage = kpPixmapFX::rotate (doc->image (m_actOnSelection), - 360 - m_angle, - m_backgroundColor); - } - - - if (!m_actOnSelection) - doc->setImage (oldImage); - else - { - m_oldSelectionPtr->setBaseImage (oldImage); - doc->setSelection (*m_oldSelectionPtr); - delete m_oldSelectionPtr; m_oldSelectionPtr = 0; - - environ ()->somethingBelowTheCursorChanged (); - } - - - QApplication::restoreOverrideCursor (); -} - diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.h b/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.h deleted file mode 100644 index 40c903a7..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformRotateCommand.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformRotateCommand_H -#define kpTransformRotateCommand_H - - -#include -#include -#include - - -class kpAbstractImageSelection; - - -class kpTransformRotateCommand : public kpCommand -{ -public: - kpTransformRotateCommand (bool actOnSelection, - double angle, // 0 <= angle < 360 (clockwise) - kpCommandEnvironment *environ); - virtual ~kpTransformRotateCommand (); - - virtual QString name () const; - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - bool m_actOnSelection; - double m_angle; - - kpColor m_backgroundColor; - - bool m_losslessRotation; - kpImage m_oldImage; - kpAbstractImageSelection *m_oldSelectionPtr; -}; - - -#endif // kpTransformRotateCommand_H diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.cpp b/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.cpp deleted file mode 100644 index acf74c32..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.cpp +++ /dev/null @@ -1,199 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SKEW 0 -#define DEBUG_KP_TOOL_SKEW_DIALOG 0 - - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -// TODO: nasty, should avoid using GUI class in this command class -#include - - -kpTransformSkewCommand::kpTransformSkewCommand (bool actOnSelection, - int hangle, int vangle, - kpCommandEnvironment *environ) - : kpCommand (environ), - m_actOnSelection (actOnSelection), - m_hangle (hangle), m_vangle (vangle), - m_backgroundColor (environ->backgroundColor (actOnSelection)), - m_oldSelectionPtr (0) -{ -} - -kpTransformSkewCommand::~kpTransformSkewCommand () -{ - delete m_oldSelectionPtr; -} - - -// public virtual [base kpCommand] -QString kpTransformSkewCommand::name () const -{ - QString opName = i18n ("Skew"); - - if (m_actOnSelection) - return i18n ("Selection: %1", opName); - else - return opName; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpTransformSkewCommand::size () const -{ - return ImageSize (m_oldImage) + - SelectionSize (m_oldSelectionPtr); -} - - -// public virtual [base kpCommand] -void kpTransformSkewCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - QApplication::setOverrideCursor (Qt::WaitCursor); - - - kpImage newImage = kpPixmapFX::skew (doc->image (m_actOnSelection), - kpTransformSkewDialog::horizontalAngleForPixmapFX (m_hangle), - kpTransformSkewDialog::verticalAngleForPixmapFX (m_vangle), - m_backgroundColor); - - if (!m_actOnSelection) - { - m_oldImage = doc->image (m_actOnSelection); - - doc->setImage (newImage); - } - else - { - kpAbstractImageSelection *sel = doc->imageSelection (); - Q_ASSERT (sel); - - // Save old selection - m_oldSelectionPtr = sel->clone (); - - - // Calculate skewed points - QPolygon currentPoints = sel->calculatePoints (); - currentPoints.translate (-currentPoints.boundingRect ().x (), - -currentPoints.boundingRect ().y ()); - QMatrix skewMatrix = kpPixmapFX::skewMatrix ( - doc->image (m_actOnSelection), - kpTransformSkewDialog::horizontalAngleForPixmapFX (m_hangle), - kpTransformSkewDialog::verticalAngleForPixmapFX (m_vangle)); - currentPoints = skewMatrix.map (currentPoints); - currentPoints.translate (-currentPoints.boundingRect ().x () + m_oldSelectionPtr->x (), - -currentPoints.boundingRect ().y () + m_oldSelectionPtr->y ()); - - - if (currentPoints.boundingRect ().width () == newImage.width () && - currentPoints.boundingRect ().height () == newImage.height ()) - { - doc->setSelection ( - kpFreeFormImageSelection ( - currentPoints, newImage, - m_oldSelectionPtr->transparency ())); - } - else - { - // TODO: fix the latter "victim of" problem in kpAbstractImageSelection by - // allowing the border width & height != pixmap width & height - // Or maybe autocrop? - #if DEBUG_KP_TOOL_SKEW - kDebug () << "kpTransformSkewCommand::execute() currentPoints.boundingRect=" - << currentPoints.boundingRect () - << " newPixmap: w=" << newImage.width () - << " h=" << newImage.height () - << " (victim of rounding error and/or skewed-a-(rectangular)-pixmap-that-was-transparent-in-the-corners-making-sel-uselessly-bigger-than-needs-be))" - << endl; - #endif - doc->setSelection ( - kpRectangularImageSelection ( - QRect (currentPoints.boundingRect ().x (), - currentPoints.boundingRect ().y (), - newImage.width (), - newImage.height ()), - newImage, - m_oldSelectionPtr->transparency ())); - } - - environ ()->somethingBelowTheCursorChanged (); - } - - - QApplication::restoreOverrideCursor (); -} - -// public virtual [base kpCommand] -void kpTransformSkewCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - - QApplication::setOverrideCursor (Qt::WaitCursor); - - - if (!m_actOnSelection) - { - doc->setImage (m_oldImage); - m_oldImage = kpImage (); - } - else - { - doc->setSelection (*m_oldSelectionPtr); - delete m_oldSelectionPtr; m_oldSelectionPtr = 0; - - environ ()->somethingBelowTheCursorChanged (); - } - - - QApplication::restoreOverrideCursor (); -} - diff --git a/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.h b/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.h deleted file mode 100644 index 4f96ece4..00000000 --- a/kolourpaint/commands/imagelib/transforms/kpTransformSkewCommand.h +++ /dev/null @@ -1,66 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformSkewCommand_H -#define kpTransformSkewCommand_H - - -#include -#include -#include - - -class kpAbstractSelection; - - -class kpTransformSkewCommand : public kpCommand -{ -public: - kpTransformSkewCommand (bool actOnSelection, - int hangle, int vangle, - kpCommandEnvironment *environ); - virtual ~kpTransformSkewCommand (); - - virtual QString name () const; - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - bool m_actOnSelection; - int m_hangle, m_vangle; - - kpColor m_backgroundColor; - kpImage m_oldImage; - kpAbstractImageSelection *m_oldSelectionPtr; -}; - - -#endif // kpTransformSkewCommand_H diff --git a/kolourpaint/commands/kpCommand.cpp b/kolourpaint/commands/kpCommand.cpp deleted file mode 100644 index 6a2b028f..00000000 --- a/kolourpaint/commands/kpCommand.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COMMAND_HISTORY 0 - - -#include - -#include - - -kpCommand::kpCommand (kpCommandEnvironment *environ) - : m_environ (environ) -{ - Q_ASSERT (environ); -} - -kpCommand::~kpCommand () -{ -} - - -kpCommandEnvironment *kpCommand::environ () const -{ - return m_environ; -} - - -// protected -kpDocument *kpCommand::document () const -{ - return m_environ->document (); -} - - -// protected -kpAbstractSelection *kpCommand::selection () const -{ - return m_environ->selection (); -} - -// protected -kpAbstractImageSelection *kpCommand::imageSelection () const -{ - return m_environ->imageSelection (); -} - -// protected -kpTextSelection *kpCommand::textSelection () const -{ - return m_environ->textSelection (); -} - - -// protected -kpViewManager *kpCommand::viewManager () const -{ - return m_environ->viewManager (); -} - diff --git a/kolourpaint/commands/kpCommand.h b/kolourpaint/commands/kpCommand.h deleted file mode 100644 index d2d35552..00000000 --- a/kolourpaint/commands/kpCommand.h +++ /dev/null @@ -1,91 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpCommand_H -#define kpCommand_H - - -#include -#undef environ // macro on win32 - - -#include - -class kpAbstractImageSelection; -class kpAbstractSelection; -class kpCommandEnvironment; -class kpDocument; -class kpMainWindow; -class kpTextSelection; -class kpViewManager; - - -class kpCommand : public kpCommandSize -{ -public: - kpCommand (kpCommandEnvironment *environ); - virtual ~kpCommand (); - -public: - virtual QString name () const = 0; - - // Returns the estimated size in bytes. - // - // You only have to factor in the size of variables that change according - // to the amount of input e.g. pixmap size, text size. There is no need - // to include the size of O(1) variables unless they are huge. - // - // If in doubt, return the largest possible amount of memory that your - // command will take. This is better than making the user unexpectedly - // run out of memory. - // - // Implement this by measuring the size of all of your fields, using - // kpCommandSize. - virtual SizeType size () const = 0; - - virtual void execute () = 0; - virtual void unexecute () = 0; - -protected: - kpCommandEnvironment *environ () const; - - // Commonly used accessors - simply forwards to environ(). - kpDocument *document () const; - - kpAbstractSelection *selection () const; - kpAbstractImageSelection *imageSelection () const; - kpTextSelection *textSelection () const; - - kpViewManager *viewManager () const; - -private: - kpCommandEnvironment * const m_environ; -}; - - -#endif // kpCommand_H diff --git a/kolourpaint/commands/kpCommandHistory.cpp b/kolourpaint/commands/kpCommandHistory.cpp deleted file mode 100644 index d4e9ef22..00000000 --- a/kolourpaint/commands/kpCommandHistory.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COMMAND_HISTORY 0 - - -#include - -#include -#include -#include -#include - - -kpCommandHistory::kpCommandHistory (bool doReadConfig, kpMainWindow *mainWindow) - : kpCommandHistoryBase (doReadConfig, mainWindow->actionCollection ()), - m_mainWindow (mainWindow) -{ -} - -kpCommandHistory::~kpCommandHistory () -{ -} - - -static bool NextUndoCommandIsCreateBorder (kpCommandHistory *commandHistory) -{ - Q_ASSERT (commandHistory); - - kpCommand *cmd = commandHistory->nextUndoCommand (); - if (!cmd) - return false; - - kpToolSelectionCreateCommand *c = dynamic_cast (cmd); - if (!c) - return false; - - const kpAbstractSelection *sel = c->fromSelection (); - Q_ASSERT (sel); - - return (!sel->hasContent ()); -} - -// public -void kpCommandHistory::addCreateSelectionCommand (kpToolSelectionCreateCommand *cmd, - bool execute) -{ - if (cmd->fromSelection ()->hasContent ()) - { - addCommand (cmd, execute); - return; - } - - if (::NextUndoCommandIsCreateBorder (this)) - { - setNextUndoCommand (cmd); - if (execute) - cmd->execute (); - } - else - addCommand (cmd, execute); -} - -//--------------------------------------------------------------------- - -// public slot virtual [base KCommandHistory] -void kpCommandHistory::undo () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistory::undo() CALLED!"; -#endif - if (m_mainWindow && m_mainWindow->toolHasBegunShape ()) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\thas begun shape - cancel draw"; - #endif - m_mainWindow->tool ()->cancelShapeInternal (); - } - else - kpCommandHistoryBase::undo (); -} - -//--------------------------------------------------------------------- - -// public slot virtual [base KCommandHistory] -void kpCommandHistory::redo () -{ - if (m_mainWindow && m_mainWindow->toolHasBegunShape ()) - { - // Not completely obvious but what else can we do? - // - // Ignoring the request would not be intuitive for tools like - // Polygon & Polyline (where it's not always apparent to the user - // that s/he's still drawing a shape even though the mouse isn't - // down). - m_mainWindow->tool ()->cancelShapeInternal (); - } - else - kpCommandHistoryBase::redo (); -} - - -#include "moc_kpCommandHistory.cpp" diff --git a/kolourpaint/commands/kpCommandHistory.h b/kolourpaint/commands/kpCommandHistory.h deleted file mode 100644 index 199eed1e..00000000 --- a/kolourpaint/commands/kpCommandHistory.h +++ /dev/null @@ -1,105 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpCommandHistory_H -#define kpCommandHistory_H - - -#include - - -class kpToolSelectionCreateCommand; - - -// -// KolourPaint-specific command history functionality. -// -// Intercepts Undo/Redo requests: -// -// If the user is currently drawing a shape, it cancels it. -// Else it passes on the Undo/Redo request to kpCommandHistoryBase. -// -// TODO: This is wrong. It won't work if the Undo action is disabled, -// for instance. Later: What about kpToolText::viewEvent()'s use of -// QEvent::ShortcutOverride? -// -// Maybe the real solution is to call kpCommandHistoryBase::addCommand() -// as _soon_ as the shape starts - not after it ends. But the -// trouble with this solution is that if the user Undoes/cancels -// the shape s/he's currently drawing, it would replace a Redo -// slot in the history. Arguably you shouldn't be able to Redo -// something you never finished drawing. -// -// The solution is to add this functionality to kpCommandHistoryBase. -// -class kpCommandHistory : public kpCommandHistoryBase -{ -Q_OBJECT - -public: - kpCommandHistory (bool doReadConfig, kpMainWindow *mainWindow); - virtual ~kpCommandHistory (); - -public: - // Same as addCommand(), except that this has a more desirable behavior - // when adding a selection border creation command: If the next undo command - // also creates a selection border, it overwrites that command - // with the given , instead of adding to the undo history. - // - // This helps to reduce the number of consecutive selection border - // creation commands in the history. Exactly one border creation - // command before each "real" selection command is useful as it allows - // users to undo just that "real" operation and then do a different "real" - // operation with the same border (as sometimes, exact borders are difficult - // to recreate). However, multiple consecutive border creation - // commands get annoying since none of them mutate the document, - // so if the user has not done a "real" command with the last selection - // border (i.e. the next undo command), what this method is saying is - // that the user wanted to throw away that border drag anyway. - // - // This special behavior is perfectly safe since border creation commands - // do not mutate the document. - // - // If creates a selection that is not just a border, this - // method has the same effect as addCommand(). - // - // REFACTOR: Why not just override addCommand() and test if it was given a - // kpToolSelectionCreateCommand? - void addCreateSelectionCommand (kpToolSelectionCreateCommand *cmd, - bool execute = true); - -public slots: - virtual void undo (); - virtual void redo (); - -protected: - kpMainWindow *m_mainWindow; -}; - - -#endif // kpCommandHistory_H diff --git a/kolourpaint/commands/kpCommandHistoryBase.cpp b/kolourpaint/commands/kpCommandHistoryBase.cpp deleted file mode 100644 index 627c72ff..00000000 --- a/kolourpaint/commands/kpCommandHistoryBase.cpp +++ /dev/null @@ -1,753 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COMMAND_HISTORY 0 - - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -//template -static void ClearPointerList (QLinkedList *listPtr) -{ - if (!listPtr) - return; - - qDeleteAll (listPtr->begin (), listPtr->end ()); - - listPtr->clear (); -} - - -struct kpCommandHistoryBasePrivate -{ -}; - - -kpCommandHistoryBase::kpCommandHistoryBase (bool doReadConfig, - KActionCollection *ac) - : d (new kpCommandHistoryBasePrivate ()) -{ - m_actionUndo = new KToolBarPopupAction (KIcon ("edit-undo"), undoActionText (), this); - ac->addAction (KStandardAction::name (KStandardAction::Undo), m_actionUndo); - m_actionUndo->setShortcuts (KStandardShortcut::shortcut (KStandardShortcut::Undo)); - connect (m_actionUndo, SIGNAL(triggered(bool)), this, SLOT (undo ())); - - m_actionRedo = new KToolBarPopupAction (KIcon ("edit-redo"), redoActionText (), this); - ac->addAction (KStandardAction::name (KStandardAction::Redo), m_actionRedo); - m_actionRedo->setShortcuts (KStandardShortcut::shortcut (KStandardShortcut::Redo)); - connect (m_actionRedo, SIGNAL(triggered(bool)), this, SLOT (redo ())); - - - m_actionUndo->setEnabled (false); - m_actionRedo->setEnabled (false); - - - connect (m_actionUndo->menu (), SIGNAL (triggered (QAction *)), - this, SLOT (undoUpToNumber (QAction *))); - connect (m_actionRedo->menu (), SIGNAL (triggered (QAction *)), - this, SLOT (redoUpToNumber (QAction *))); - - - m_undoMinLimit = 10; - m_undoMaxLimit = 500; - m_undoMaxLimitSizeLimit = 16 * 1048576; - - - m_documentRestoredPosition = 0; - - - if (doReadConfig) - readConfig (); -} - -kpCommandHistoryBase::~kpCommandHistoryBase () -{ - ::ClearPointerList (&m_undoCommandList); - ::ClearPointerList (&m_redoCommandList); - - delete d; -} - - -// public -int kpCommandHistoryBase::undoLimit () const -{ - return undoMinLimit (); -} - -// public -void kpCommandHistoryBase::setUndoLimit (int limit) -{ - setUndoMinLimit (limit); -} - - -// public -int kpCommandHistoryBase::undoMinLimit () const -{ - return m_undoMinLimit; -} - -// public -void kpCommandHistoryBase::setUndoMinLimit (int limit) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::setUndoMinLimit(" - << limit << ")" - << endl; -#endif - - if (limit < 1 || limit > 5000/*"ought to be enough for anybody"*/) - { - kError () << "kpCommandHistoryBase::setUndoMinLimit(" - << limit << ")" - << endl; - return; - } - - if (limit == m_undoMinLimit) - return; - - m_undoMinLimit = limit; - trimCommandListsUpdateActions (); -} - - -// public -int kpCommandHistoryBase::undoMaxLimit () const -{ - return m_undoMaxLimit; -} - -// public -void kpCommandHistoryBase::setUndoMaxLimit (int limit) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::setUndoMaxLimit(" - << limit << ")" - << endl; -#endif - - if (limit < 1 || limit > 5000/*"ought to be enough for anybody"*/) - { - kError () << "kpCommandHistoryBase::setUndoMaxLimit(" - << limit << ")" - << endl; - return; - } - - if (limit == m_undoMaxLimit) - return; - - m_undoMaxLimit = limit; - trimCommandListsUpdateActions (); -} - - -// public -kpCommandSize::SizeType kpCommandHistoryBase::undoMaxLimitSizeLimit () const -{ - return m_undoMaxLimitSizeLimit; -} - -// public -void kpCommandHistoryBase::setUndoMaxLimitSizeLimit (kpCommandSize::SizeType sizeLimit) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::setUndoMaxLimitSizeLimit(" - << sizeLimit << ")" - << endl; -#endif - - if (sizeLimit < 0 || - sizeLimit > (500 * 1048576)/*"ought to be enough for anybody"*/) - { - kError () << "kpCommandHistoryBase::setUndoMaxLimitSizeLimit(" - << sizeLimit << ")" - << endl; - return; - } - - if (sizeLimit == m_undoMaxLimitSizeLimit) - return; - - m_undoMaxLimitSizeLimit = sizeLimit; - trimCommandListsUpdateActions (); -} - - -// public -void kpCommandHistoryBase::readConfig () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::readConfig()"; -#endif - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupUndoRedo); - - setUndoMinLimit (cfg.readEntry (kpSettingUndoMinLimit, undoMinLimit ())); - setUndoMaxLimit (cfg.readEntry (kpSettingUndoMaxLimit, undoMaxLimit ())); - setUndoMaxLimitSizeLimit ( - cfg.readEntry (kpSettingUndoMaxLimitSizeLimit, - undoMaxLimitSizeLimit ())); - - trimCommandListsUpdateActions (); -} - -// public -void kpCommandHistoryBase::writeConfig () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::writeConfig()"; -#endif - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupUndoRedo); - - cfg.writeEntry (kpSettingUndoMinLimit, undoMinLimit ()); - cfg.writeEntry (kpSettingUndoMaxLimit, undoMaxLimit ()); - cfg.writeEntry ( - kpSettingUndoMaxLimitSizeLimit, undoMaxLimitSizeLimit ()); - - cfg.sync (); -} - - -// public -void kpCommandHistoryBase::addCommand (kpCommand *command, bool execute) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::addCommand(" - << command - << ",execute=" << execute << ")" - << endl; -#endif - - if (execute) - command->execute (); - - m_undoCommandList.push_front (command); - ::ClearPointerList (&m_redoCommandList); - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; -#endif - if (m_documentRestoredPosition != INT_MAX) - { - if (m_documentRestoredPosition > 0) - m_documentRestoredPosition = INT_MAX; - else - m_documentRestoredPosition--; - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; - #endif - } - - trimCommandListsUpdateActions (); -} - -// public -void kpCommandHistoryBase::clear () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::clear()"; -#endif - - ::ClearPointerList (&m_undoCommandList); - ::ClearPointerList (&m_redoCommandList); - - m_documentRestoredPosition = 0; - - updateActions (); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpCommandHistoryBase::undoInternal () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::undoInternal()"; -#endif - - kpCommand *undoCommand = nextUndoCommand (); - if (!undoCommand) - return; - - undoCommand->unexecute (); - - - m_undoCommandList.erase (m_undoCommandList.begin ()); - m_redoCommandList.push_front (undoCommand); - - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; -#endif - if (m_documentRestoredPosition != INT_MAX) - { - m_documentRestoredPosition++; - if (m_documentRestoredPosition == 0) - emit documentRestored (); - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; - #endif - } -} - -//--------------------------------------------------------------------- - -// protected slot -void kpCommandHistoryBase::redoInternal () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::redoInternal()"; -#endif - - kpCommand *redoCommand = nextRedoCommand (); - if (!redoCommand) - return; - - redoCommand->execute (); - - - m_redoCommandList.erase (m_redoCommandList.begin ()); - m_undoCommandList.push_front (redoCommand); - - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; -#endif - if (m_documentRestoredPosition != INT_MAX) - { - m_documentRestoredPosition--; - if (m_documentRestoredPosition == 0) - emit documentRestored (); - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; - #endif - } -} - -//--------------------------------------------------------------------- - -// public slot virtual -void kpCommandHistoryBase::undo () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::undo()"; -#endif - - undoInternal (); - trimCommandListsUpdateActions (); -} - -//--------------------------------------------------------------------- - -// public slot virtual -void kpCommandHistoryBase::redo () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::redo()"; -#endif - - redoInternal (); - trimCommandListsUpdateActions (); -} - -//--------------------------------------------------------------------- - -// public slot virtual -void kpCommandHistoryBase::undoUpToNumber (QAction *which) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::undoUpToNumber(" << which << ")"; -#endif - - for (int i = 0; - i <= which->data().toInt() && !m_undoCommandList.isEmpty (); - i++) - { - undoInternal (); - } - - trimCommandListsUpdateActions (); -} - -// public slot virtual -void kpCommandHistoryBase::redoUpToNumber (QAction *which) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::redoUpToNumber(" << which << ")"; -#endif - - for (int i = 0; - i <= which->data().toInt() && !m_redoCommandList.isEmpty (); - i++) - { - redoInternal (); - } - - trimCommandListsUpdateActions (); -} - - -// protected -QString kpCommandHistoryBase::undoActionText () const -{ - kpCommand *undoCommand = nextUndoCommand (); - - if (undoCommand) - return i18n ("&Undo: %1", undoCommand->name ()); - else - return i18n ("&Undo"); -} - -// protected -QString kpCommandHistoryBase::redoActionText () const -{ - kpCommand *redoCommand = nextRedoCommand (); - - if (redoCommand) - return i18n ("&Redo: %1", redoCommand->name ()); - else - return i18n ("&Redo"); -} - - -// protected -QString kpCommandHistoryBase::undoActionToolTip () const -{ - kpCommand *undoCommand = nextUndoCommand (); - - if (undoCommand) - return i18n ("Undo: %1", undoCommand->name ()); - else - return i18n ("Undo"); -} - -// protected -QString kpCommandHistoryBase::redoActionToolTip () const -{ - kpCommand *redoCommand = nextRedoCommand (); - - if (redoCommand) - return i18n ("Redo: %1", redoCommand->name ()); - else - return i18n ("Redo"); -} - - -// protected -void kpCommandHistoryBase::trimCommandListsUpdateActions () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::trimCommandListsUpdateActions()"; -#endif - - trimCommandLists (); - updateActions (); -} - -// protected -void kpCommandHistoryBase::trimCommandList (QLinkedList *commandList) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::trimCommandList()"; - QTime timer; timer.start (); -#endif - - if (!commandList) - { - kError () << "kpCommandHistoryBase::trimCommandList() passed 0 commandList" - << endl; - return; - } - - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tsize=" << commandList->size () - << " undoMinLimit=" << m_undoMinLimit - << " undoMaxLimit=" << m_undoMaxLimit - << " undoMaxLimitSizeLimit=" << m_undoMaxLimitSizeLimit - << endl; -#endif - if ((int) commandList->size () <= m_undoMinLimit) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\tsize under undoMinLimit - done"; - #endif - return; - } - - -#if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\tsize over undoMinLimit - iterating thru cmds:"; -#endif - - QLinkedList ::iterator it = commandList->begin (); - int upto = 0; - - kpCommandSize::SizeType sizeSoFar = 0; - - while (it != commandList->end ()) - { - bool advanceIt = true; - - if (sizeSoFar <= m_undoMaxLimitSizeLimit) - { - sizeSoFar += (*it)->size (); - } - - #if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\t\t" << upto << ":" - << " name='" << (*it)->name () - << "' size=" << (*it)->size () - << " sizeSoFar=" << sizeSoFar - << endl; - #endif - - if (upto >= m_undoMinLimit) - { - if (upto >= m_undoMaxLimit || - sizeSoFar > m_undoMaxLimitSizeLimit) - { - #if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\t\t\tkill"; - #endif - delete (*it); - it = m_undoCommandList.erase (it); - advanceIt = false; - } - } - - if (advanceIt) - it++; - upto++; - } - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\ttook " << timer.elapsed () << "ms"; -#endif -} - -// protected -void kpCommandHistoryBase::trimCommandLists () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::trimCommandLists()"; -#endif - - trimCommandList (&m_undoCommandList); - trimCommandList (&m_redoCommandList); - -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tdocumentRestoredPosition=" << m_documentRestoredPosition - << endl; -#endif - if (m_documentRestoredPosition != INT_MAX) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\tundoCmdList.size=" << m_undoCommandList.size () - << " redoCmdList.size=" << m_redoCommandList.size () - << endl; - #endif - if (m_documentRestoredPosition > (int) m_redoCommandList.size () || - -m_documentRestoredPosition > (int) m_undoCommandList.size ()) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\t\t\tinvalidate documentRestoredPosition"; - #endif - m_documentRestoredPosition = INT_MAX; - } - } -} - - -static void populatePopupMenu (KMenu *popupMenu, - const QString &undoOrRedo, - const QLinkedList &commandList) -{ - if (!popupMenu) - return; - - popupMenu->clear (); - - QLinkedList ::const_iterator it = commandList.begin (); - int i = 0; - while (i < 10 && it != commandList.end ()) - { - QAction *action = new QAction(i18n ("%1: %2", undoOrRedo, (*it)->name ()), popupMenu); - action->setData(i); - popupMenu->addAction (action); - i++, it++; - } - - if (it != commandList.end ()) - { - // TODO: maybe have a scrollview show all the items instead, like KOffice in KDE 3 - // LOCOMPAT: should be centered text. - popupMenu->addTitle (i18np ("%1 more item", "%1 more items", - commandList.size () - i)); - } -} - - -// protected -void kpCommandHistoryBase::updateActions () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::updateActions()"; -#endif - - m_actionUndo->setEnabled ((bool) nextUndoCommand ()); - // Don't want to keep changing toolbar text. - // TODO: As a bad side-effect, the menu doesn't have "Undo: " - // anymore. In any case, the KDE4 KToolBarPopupAction - // sucks in menus as it forces the clicking of a submenu. IMO, - // there should be no submenu in the menu. - //m_actionUndo->setText (undoActionText ()); - - // But in icon mode, a tooltip with context is useful. - m_actionUndo->setToolTip (undoActionToolTip ()); -#if DEBUG_KP_COMMAND_HISTORY - QTime timer; timer.start (); -#endif - populatePopupMenu (qobject_cast (m_actionUndo->menu ()), - i18n ("Undo"), - m_undoCommandList); -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tpopuplatePopupMenu undo=" << timer.elapsed () - << "ms" << endl;; -#endif - - m_actionRedo->setEnabled ((bool) nextRedoCommand ()); - // Don't want to keep changing toolbar text. - // TODO: As a bad side-effect, the menu doesn't have "Undo: " - // anymore. In any case, the KDE4 KToolBarPopupAction - // sucks in menus as it forces the clicking of a submenu. IMO, - // there should be no submenu in the menu. - //m_actionRedo->setText (redoActionText ()); - - // But in icon mode, a tooltip with context is useful. - m_actionRedo->setToolTip (redoActionToolTip ()); -#if DEBUG_KP_COMMAND_HISTORY - timer.restart (); -#endif - populatePopupMenu (qobject_cast (m_actionRedo->menu ()), - i18n ("Redo"), - m_redoCommandList); -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tpopuplatePopupMenu redo=" << timer.elapsed () - << "ms" << endl; -#endif -} - - -// public -kpCommand *kpCommandHistoryBase::nextUndoCommand () const -{ - if (m_undoCommandList.isEmpty ()) - return 0; - - return m_undoCommandList.first (); -} - -// public -kpCommand *kpCommandHistoryBase::nextRedoCommand () const -{ - if (m_redoCommandList.isEmpty ()) - return 0; - - return m_redoCommandList.first (); -} - - -// public -void kpCommandHistoryBase::setNextUndoCommand (kpCommand *command) -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::setNextUndoCommand(" - << command - << ")" - << endl; -#endif - - if (m_undoCommandList.isEmpty ()) - return; - - - delete *m_undoCommandList.begin (); - *m_undoCommandList.begin () = command; - - - trimCommandListsUpdateActions (); -} - - -// public slot virtual -void kpCommandHistoryBase::documentSaved () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpCommandHistoryBase::documentSaved()"; -#endif - - m_documentRestoredPosition = 0; -} - - -#include "moc_kpCommandHistoryBase.cpp" diff --git a/kolourpaint/commands/kpCommandHistoryBase.h b/kolourpaint/commands/kpCommandHistoryBase.h deleted file mode 100644 index 0bbcf08f..00000000 --- a/kolourpaint/commands/kpCommandHistoryBase.h +++ /dev/null @@ -1,155 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpCommandHistoryBase_H -#define kpCommandHistoryBase_H - - -#include -#include -#include - -#include - -#include - -class KActionCollection; -class KToolBarPopupAction; - -class kpAbstractImageSelection; -class kpAbstractSelection; -class kpCommand; -class kpCommandEnvironment; -class kpDocument; -class kpMainWindow; -class kpTextSelection; -class kpViewManager; - - -// Clone of KCommandHistory with features required by KolourPaint but which -// could also be useful for other apps: -// - nextUndoCommand()/nextRedoCommand() -// - undo/redo history limited by both number and size -// -// Features not required by KolourPaint (e.g. commandExecuted()) are not -// implemented and undo limit == redo limit. So compared to -// KCommandHistory, this is only "almost source compatible". -class kpCommandHistoryBase : public QObject -{ -Q_OBJECT - -public: - kpCommandHistoryBase (bool doReadConfig, KActionCollection *ac); - virtual ~kpCommandHistoryBase (); - -public: - // (provided for compatibility with KCommandHistory) - int undoLimit () const; - void setUndoLimit (int limit); - - - int undoMinLimit () const; - void setUndoMinLimit (int limit); - - int undoMaxLimit () const; - void setUndoMaxLimit (int limit); - - kpCommandSize::SizeType undoMaxLimitSizeLimit () const; - void setUndoMaxLimitSizeLimit (kpCommandSize::SizeType sizeLimit); - -public: - // Read and write above config - void readConfig (); - void writeConfig (); - -public: - void addCommand (kpCommand *command, bool execute = true); - void clear (); - -protected slots: - // (same as undo() & redo() except they don't call - // trimCommandListsUpdateActions()) - void undoInternal (); - void redoInternal (); - -public slots: - virtual void undo (); - virtual void redo (); - - virtual void undoUpToNumber (QAction *which); - virtual void redoUpToNumber (QAction *which); - -protected: - QString undoActionText () const; - QString redoActionText () const; - - QString undoActionToolTip () const; - QString redoActionToolTip () const; - - void trimCommandListsUpdateActions (); - void trimCommandList (QLinkedList *commandList); - void trimCommandLists (); - void updateActions (); - -public: - kpCommand *nextUndoCommand () const; - kpCommand *nextRedoCommand () const; - - void setNextUndoCommand (kpCommand *command); - -public slots: - virtual void documentSaved (); - -signals: - void documentRestored (); - -protected: - KToolBarPopupAction *m_actionUndo, *m_actionRedo; - - // (Front element is the next one) - QLinkedList m_undoCommandList; - QLinkedList m_redoCommandList; - - int m_undoMinLimit, m_undoMaxLimit; - kpCommandSize::SizeType m_undoMaxLimitSizeLimit; - - // What you have to do to get back to the document's unmodified state: - // * -x: must Undo x times - // * 0: unmodified - // * +x: must Redo x times - // * INT_MAX: can never become unmodified again - // - // ASSUMPTION: will never have INT_MAX commands in any list. - int m_documentRestoredPosition; - -private: - struct kpCommandHistoryBasePrivate * const d; -}; - - -#endif // kpCommandHistoryBase_H diff --git a/kolourpaint/commands/kpCommandSize.cpp b/kolourpaint/commands/kpCommandSize.cpp deleted file mode 100644 index 65481f54..00000000 --- a/kolourpaint/commands/kpCommandSize.cpp +++ /dev/null @@ -1,157 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COMMAND_SIZE 0 - - -#include - -#include -#include -#include - -#include - - -// public static -kpCommandSize::SizeType kpCommandSize::PixmapSize (const QImage &image) -{ - return kpCommandSize::PixmapSize (image.width (), image.height (), image.depth ()); -} - -// public static -kpCommandSize::SizeType kpCommandSize::PixmapSize (const QImage *image) -{ - return (image ? kpCommandSize::PixmapSize (*image) : 0); -} - -// public static -kpCommandSize::SizeType kpCommandSize::PixmapSize (int width, int height, int depth) -{ - // handle 15bpp - int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); - kpCommandSize::SizeType ret = - (kpCommandSize::SizeType) width * height * roundedDepth / 8; - -#if DEBUG_KP_COMMAND_SIZE && 0 - kDebug () << "kpCommandSize::PixmapSize() w=" << width - << " h=" << height - << " d=" << depth - << " roundedDepth=" << roundedDepth - << " ret=" << ret - << endl; -#endif - return ret; -} - - -// public static -kpCommandSize::SizeType kpCommandSize::QImageSize (const QImage &image) -{ - return kpCommandSize::QImageSize (image.width (), image.height (), image.depth ()); -} - -// public static -kpCommandSize::SizeType kpCommandSize::QImageSize (const QImage *image) -{ - return (image ? kpCommandSize::QImageSize (*image) : 0); -} - -// public static -kpCommandSize::SizeType kpCommandSize::QImageSize (int width, int height, int depth) -{ - // handle 15bpp - int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); - kpCommandSize::SizeType ret = - (kpCommandSize::SizeType) width * height * roundedDepth / 8; - -#if DEBUG_KP_COMMAND_SIZE && 0 - kDebug () << "kpCommandSize::QImageSize() w=" << width - << " h=" << height - << " d=" << depth - << " roundedDepth=" << roundedDepth - << " ret=" << ret - << endl; -#endif - - return ret; -} - - -// public static -kpCommandSize::SizeType kpCommandSize::ImageSize (const kpImage &image) -{ - return kpCommandSize::PixmapSize (image); -} - -// public static -kpCommandSize::SizeType kpCommandSize::ImageSize (const kpImage *image) -{ - return kpCommandSize::PixmapSize (image); -} - - -// public static -kpCommandSize::SizeType kpCommandSize::SelectionSize (const kpAbstractSelection &sel) -{ - return sel.size (); -} - -// public static -kpCommandSize::SizeType kpCommandSize::SelectionSize (const kpAbstractSelection *sel) -{ - return (sel ? sel->size () : 0); -} - - -// public static -kpCommandSize::SizeType kpCommandSize::StringSize (const QString &string) -{ -#if DEBUG_KP_COMMAND_SIZE && 1 - kDebug () << "kpCommandSize::StringSize(" << string << ")" - << " len=" << string.length () - << " sizeof(QChar)=" << sizeof (QChar) - << endl; -#endif - return ((SizeType) string.length () * sizeof (QChar)); -} - - -// public static -kpCommandSize::SizeType kpCommandSize::PolygonSize (const QPolygon &points) -{ -#if DEBUG_KP_COMMAND_SIZE && 1 - kDebug () << "kpCommandSize::PolygonSize() points.size=" - << points.size () - << " sizeof(QPoint)=" << sizeof (QPoint) - << endl; -#endif - - return ((SizeType) points.size () * sizeof (QPoint)); -} - diff --git a/kolourpaint/commands/kpCommandSize.h b/kolourpaint/commands/kpCommandSize.h deleted file mode 100644 index 92b9fafa..00000000 --- a/kolourpaint/commands/kpCommandSize.h +++ /dev/null @@ -1,87 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpCommandSize_H -#define kpCommandSize_H - - -#include - - -#include -#include -#include - -class kpAbstractSelection; - - -// -// Estimates the size of the object being pointed to, in bytes. -// -// This is used by the command history to trim stored commands, once a -// certain amount of memory is used by those commands. -// -class kpCommandSize -{ -public: - // Force 64-bit arithmetic, instead of 32-bit, to prevent overflow - // when determining whether to clip the command history -- we might be - // adding a large number of large sizes. This will eventually help - // KolourPaint support more than 2GB of image data. - // - // For some reason, GCC doesn't warn of accidental casts to smaller types - // (e.g. 32-bit). An easy way to get around this is to change "SizeType" - // to be "double" temporarily and recompile - every time an implicit cast to - // "int" (32-bit) is made, we'll be warned. - // - // TODO: Exhaustively test that we're not accidentally doing intermediate - // calculations using 32-bit in some places (mainly inside - // implementations of kpCommand::size()). - typedef qlonglong SizeType; - - static SizeType PixmapSize (const QImage &image); - static SizeType PixmapSize (const QImage *image); - static SizeType PixmapSize (int width, int height, int depth); - - static SizeType QImageSize (const QImage &image); - static SizeType QImageSize (const QImage *image); - static SizeType QImageSize (int width, int height, int depth); - - static SizeType ImageSize (const kpImage &image); - static SizeType ImageSize (const kpImage *image); - - static SizeType SelectionSize (const kpAbstractSelection &sel); - static SizeType SelectionSize (const kpAbstractSelection *sel); - - static SizeType StringSize (const QString &string); - - static SizeType PolygonSize (const QPolygon &points); -}; - - -#endif // kpCommandSize_H diff --git a/kolourpaint/commands/kpMacroCommand.cpp b/kolourpaint/commands/kpMacroCommand.cpp deleted file mode 100644 index b5ec76d2..00000000 --- a/kolourpaint/commands/kpMacroCommand.cpp +++ /dev/null @@ -1,148 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COMMAND_HISTORY 0 - - -#include -#include - -#include - -#include - -//--------------------------------------------------------------------- - -struct kpMacroCommandPrivate -{ -}; - - -kpMacroCommand::kpMacroCommand (const QString &name, kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - d (new kpMacroCommandPrivate ()) -{ -} - -//--------------------------------------------------------------------- - -kpMacroCommand::~kpMacroCommand () -{ - qDeleteAll (m_commandList.begin (), m_commandList.end ()); - delete d; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpMacroCommand::size () const -{ -#if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "kpMacroCommand::size()"; -#endif - SizeType s = 0; - -#if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\tcalculating:"; -#endif - foreach (kpCommand *cmd, m_commandList) - { - #if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\t\tcurrentSize=" << s << " + " - << cmd->name () << ".size=" << cmd->size () - << endl; - #endif - s += cmd->size (); - } - -#if DEBUG_KP_COMMAND_HISTORY && 0 - kDebug () << "\treturning " << s; -#endif - return s; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpMacroCommand::execute () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpMacroCommand::execute()"; -#endif - - viewManager()->setQueueUpdates(); - - for (QLinkedList ::const_iterator it = m_commandList.begin (); - it != m_commandList.end (); - ++it) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\texecuting " << (*it)->name (); - #endif - (*it)->execute (); - } - - viewManager()->restoreQueueUpdates(); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpMacroCommand::unexecute () -{ -#if DEBUG_KP_COMMAND_HISTORY - kDebug () << "kpMacroCommand::unexecute()"; -#endif - - viewManager()->setQueueUpdates(); - - QLinkedList ::const_iterator it = m_commandList.end (); - it--; - - while (it != m_commandList.end ()) - { - #if DEBUG_KP_COMMAND_HISTORY - kDebug () << "\tunexecuting " << (*it)->name (); - #endif - (*it)->unexecute (); - - it--; - } - - viewManager()->restoreQueueUpdates(); -} - -//--------------------------------------------------------------------- - -// public -void kpMacroCommand::addCommand (kpCommand *command) -{ - m_commandList.push_back (command); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/kpMacroCommand.h b/kolourpaint/commands/kpMacroCommand.h deleted file mode 100644 index 1283615e..00000000 --- a/kolourpaint/commands/kpMacroCommand.h +++ /dev/null @@ -1,69 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpMacroCommand_H -#define kpMacroCommand_H - - -#include - -#include - - -class kpMacroCommand : public kpNamedCommand -{ -public: - kpMacroCommand (const QString &name, kpCommandEnvironment *environ); - virtual ~kpMacroCommand (); - - - // - // kpCommand Interface - // - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - - - // - // Interface - // - - void addCommand (kpCommand *command); - -protected: - QLinkedList m_commandList; - -private: - struct kpMacroCommandPrivate * const d; -}; - - -#endif // kpMacroCommand_H diff --git a/kolourpaint/commands/kpNamedCommand.cpp b/kolourpaint/commands/kpNamedCommand.cpp deleted file mode 100644 index e8aec642..00000000 --- a/kolourpaint/commands/kpNamedCommand.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -//--------------------------------------------------------------------- - -kpNamedCommand::kpNamedCommand (const QString &name, kpCommandEnvironment *environ) - : kpCommand (environ), - m_name (name) -{ -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -QString kpNamedCommand::name () const -{ - return m_name; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/kpNamedCommand.h b/kolourpaint/commands/kpNamedCommand.h deleted file mode 100644 index 2d3416a0..00000000 --- a/kolourpaint/commands/kpNamedCommand.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpNamedCommand_H -#define kpNamedCommand_H - - -#include - -#include - - -class kpNamedCommand : public kpCommand -{ -public: - kpNamedCommand (const QString &name, kpCommandEnvironment *environ); - - virtual QString name () const; - -protected: - QString m_name; -}; - - -#endif // kpNamedCommand_H diff --git a/kolourpaint/commands/tools/flow/kpToolFlowCommand.cpp b/kolourpaint/commands/tools/flow/kpToolFlowCommand.cpp deleted file mode 100644 index ef6caeca..00000000 --- a/kolourpaint/commands/tools/flow/kpToolFlowCommand.cpp +++ /dev/null @@ -1,141 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_FLOW_COMMAND 0 - - -#include - -#include - -#include -#include -#include -#include -#include - - -struct kpToolFlowCommandPrivate -{ - kpImage image; - QRect boundingRect; -}; - - -kpToolFlowCommand::kpToolFlowCommand (const QString &name, kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - d (new kpToolFlowCommandPrivate ()) -{ - d->image = document ()->image (); -} - -kpToolFlowCommand::~kpToolFlowCommand () -{ - delete d; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolFlowCommand::size () const -{ - return ImageSize (d->image); -} - - -// public virtual [base kpCommand] -void kpToolFlowCommand::execute () -{ - swapOldAndNew (); -} - -// public virtual [base kpCommand] -void kpToolFlowCommand::unexecute () -{ - swapOldAndNew (); -} - - -// private -void kpToolFlowCommand::swapOldAndNew () -{ - if (d->boundingRect.isValid ()) - { - const kpImage oldImage = document ()->getImageAt (d->boundingRect); - - document ()->setImageAt (d->image, d->boundingRect.topLeft ()); - - d->image = oldImage; - } -} - -// public -void kpToolFlowCommand::updateBoundingRect (const QPoint &point) -{ - updateBoundingRect (QRect (point, point)); -} - -// public -void kpToolFlowCommand::updateBoundingRect (const QRect &rect) -{ -#if DEBUG_KP_TOOL_FLOW_COMMAND & 0 - kDebug () << "kpToolFlowCommand::updateBoundingRect() existing=" - << d->boundingRect - << " plus=" - << rect - << endl; -#endif - d->boundingRect = d->boundingRect.united (rect); -#if DEBUG_KP_TOOL_FLOW_COMMAND & 0 - kDebug () << "\tresult=" << d->boundingRect; -#endif -} - -// public -void kpToolFlowCommand::finalize () -{ - if (d->boundingRect.isValid ()) - { - // Store only the needed part of doc image. - d->image = kpTool::neededPixmap (d->image, d->boundingRect); - } - else - { - d->image = kpImage (); - } -} - -// public -void kpToolFlowCommand::cancel () -{ - if (d->boundingRect.isValid ()) - { - viewManager ()->setFastUpdates (); - document ()->setImageAt (d->image, d->boundingRect.topLeft ()); - viewManager ()->restoreFastUpdates (); - } -} diff --git a/kolourpaint/commands/tools/flow/kpToolFlowCommand.h b/kolourpaint/commands/tools/flow/kpToolFlowCommand.h deleted file mode 100644 index 4e960b8d..00000000 --- a/kolourpaint/commands/tools/flow/kpToolFlowCommand.h +++ /dev/null @@ -1,64 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_FLOW_COMMAND_H -#define KP_TOOL_FLOW_COMMAND_H - - -#include - - -#include -#include - - -class kpToolFlowCommand : public kpNamedCommand -{ -public: - kpToolFlowCommand (const QString &name, kpCommandEnvironment *environ); - virtual ~kpToolFlowCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - - // interface for kpToolFlowBase - void updateBoundingRect (const QPoint &point); - void updateBoundingRect (const QRect &rect); - void finalize (); - void cancel (); - -private: - void swapOldAndNew (); - - struct kpToolFlowCommandPrivate * const d; -}; - - -#endif // KP_TOOL_FLOW_COMMAND_H diff --git a/kolourpaint/commands/tools/kpToolColorPickerCommand.cpp b/kolourpaint/commands/tools/kpToolColorPickerCommand.cpp deleted file mode 100644 index e9f5e333..00000000 --- a/kolourpaint/commands/tools/kpToolColorPickerCommand.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_COLOR_PICKER 0 - - -#include - -#include - -#include -#include - - -kpToolColorPickerCommand::kpToolColorPickerCommand ( - int mouseButton, - const kpColor &newColor, - const kpColor &oldColor, - kpCommandEnvironment *environ) - - : kpCommand (environ), - m_mouseButton (mouseButton), - m_newColor (newColor), - m_oldColor (oldColor) -{ -} - -kpToolColorPickerCommand::~kpToolColorPickerCommand () -{ -} - - -// public virtual [base kpCommand] -QString kpToolColorPickerCommand::name () const -{ - return i18n ("Color Picker"); -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolColorPickerCommand::size () const -{ - return 0; -} - - -// public virtual [base kpCommand] -void kpToolColorPickerCommand::execute () -{ - environ ()->setColor (m_mouseButton, m_newColor); -} - -// public virtual [base kpCommand] -void kpToolColorPickerCommand::unexecute () -{ - environ ()->setColor (m_mouseButton, m_oldColor); -} - diff --git a/kolourpaint/commands/tools/kpToolColorPickerCommand.h b/kolourpaint/commands/tools/kpToolColorPickerCommand.h deleted file mode 100644 index 25707489..00000000 --- a/kolourpaint/commands/tools/kpToolColorPickerCommand.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolColorPickerCommand_H -#define kpToolColorPickerCommand_H - - -#include -#include - - -class kpToolColorPickerCommand : public kpCommand -{ -public: - kpToolColorPickerCommand (int mouseButton, - const kpColor &newColor, const kpColor &oldColor, - kpCommandEnvironment *environ); - virtual ~kpToolColorPickerCommand (); - - virtual QString name () const; - - virtual SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - int m_mouseButton; - kpColor m_newColor; - kpColor m_oldColor; -}; - - -#endif // kpToolColorPickerCommand_H diff --git a/kolourpaint/commands/tools/kpToolFloodFillCommand.cpp b/kolourpaint/commands/tools/kpToolFloodFillCommand.cpp deleted file mode 100644 index 3387dd49..00000000 --- a/kolourpaint/commands/tools/kpToolFloodFillCommand.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_FLOOD_FILL 0 - - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -struct kpToolFloodFillCommandPrivate -{ - kpImage oldImage; - bool fillEntireImage; -}; - -//--------------------------------------------------------------------- - -kpToolFloodFillCommand::kpToolFloodFillCommand (int x, int y, - const kpColor &color, int processedColorSimilarity, - kpCommandEnvironment *environ) - - : kpCommand (environ), - kpFloodFill (document ()->imagePointer (), x, y, color, processedColorSimilarity), - d (new kpToolFloodFillCommandPrivate ()) -{ - d->fillEntireImage = false; -} - -//--------------------------------------------------------------------- - -kpToolFloodFillCommand::~kpToolFloodFillCommand () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -QString kpToolFloodFillCommand::name () const -{ - return i18n ("Flood Fill"); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolFloodFillCommand::size () const -{ - return kpFloodFill::size () + ImageSize (d->oldImage); -} - -//--------------------------------------------------------------------- - -// public -void kpToolFloodFillCommand::setFillEntireImage (bool yes) -{ - d->fillEntireImage = yes; -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpCommand] -void kpToolFloodFillCommand::execute () -{ -#if DEBUG_KP_TOOL_FLOOD_FILL && 1 - kDebug () << "kpToolFloodFillCommand::execute() fillEntireImage=" - << d->fillEntireImage << endl; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - - if (d->fillEntireImage) - { - doc->fill (kpFloodFill::color ()); - } - else - { - QRect rect = kpFloodFill::boundingRect (); - if (rect.isValid ()) - { - QApplication::setOverrideCursor (Qt::WaitCursor); - { - d->oldImage = doc->getImageAt (rect); - - kpFloodFill::fill (); - doc->slotContentsChanged (rect); - } - QApplication::restoreOverrideCursor (); - } - else - { - #if DEBUG_KP_TOOL_FLOOD_FILL && 1 - kDebug () << "\tinvalid boundingRect - must be NOP case"; - #endif - } - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpCommand] -void kpToolFloodFillCommand::unexecute () -{ -#if DEBUG_KP_TOOL_FLOOD_FILL && 1 - kDebug () << "kpToolFloodFillCommand::unexecute() fillEntireImage=" - << d->fillEntireImage << endl; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - - if (d->fillEntireImage) - { - doc->fill (kpFloodFill::colorToChange ()); - } - else - { - QRect rect = kpFloodFill::boundingRect (); - if (rect.isValid ()) - { - doc->setImageAt (d->oldImage, rect.topLeft ()); - - d->oldImage = kpImage (); - - doc->slotContentsChanged (rect); - } - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/tools/kpToolFloodFillCommand.h b/kolourpaint/commands/tools/kpToolFloodFillCommand.h deleted file mode 100644 index 094b9e60..00000000 --- a/kolourpaint/commands/tools/kpToolFloodFillCommand.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolFloodFillCommand_H -#define kpToolFloodFillCommand_H - - -#include -#include - - -class kpColor; -class kpCommandEnvironment; - - -struct kpToolFloodFillCommandPrivate; - -class kpToolFloodFillCommand : public kpCommand, public kpFloodFill -{ -public: - kpToolFloodFillCommand (int x, int y, - const kpColor &color, int processedColorSimilarity, - kpCommandEnvironment *environ); - virtual ~kpToolFloodFillCommand (); - - virtual QString name () const; - - virtual kpCommandSize::SizeType size () const; - - // Optimization hack: filling a fresh, unmodified document does not require - // reading any pixels - just set the whole document to - // . - void setFillEntireImage (bool yes = true); - - virtual void execute (); - virtual void unexecute (); - -private: - kpToolFloodFillCommandPrivate * const d; -}; - - -#endif // kpToolFloodFillCommand_H diff --git a/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.cpp b/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.cpp deleted file mode 100644 index e21eb7cb..00000000 --- a/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.cpp +++ /dev/null @@ -1,145 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_POLYGON 0 - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -struct kpToolPolygonalCommandPrivate -{ - kpToolPolygonalBase::DrawShapeFunc drawShapeFunc; - - QPolygon points; - QRect boundingRect; - - kpColor fcolor; - int penWidth; - kpColor bcolor; - - kpImage oldImage; -}; - -kpToolPolygonalCommand::kpToolPolygonalCommand (const QString &name, - kpToolPolygonalBase::DrawShapeFunc drawShapeFunc, - const QPolygon &points, - const QRect &boundingRect, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - kpCommandEnvironment *environ) - - : kpNamedCommand (name, environ), - d (new kpToolPolygonalCommandPrivate ()) -{ - d->drawShapeFunc = drawShapeFunc; - - d->points = points; - d->boundingRect = boundingRect; - - d->fcolor = fcolor; - d->penWidth = penWidth; - d->bcolor = bcolor; -} - -kpToolPolygonalCommand::~kpToolPolygonalCommand () -{ - delete d; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolPolygonalCommand::size () const -{ - return PolygonSize (d->points) + - ImageSize (d->oldImage); -} - -// public virtual [base kpCommand] -void kpToolPolygonalCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - // Store Undo info. - Q_ASSERT (d->oldImage.isNull ()); - d->oldImage = doc->getImageAt (d->boundingRect); - - // Invoke shape drawing function passed in ctor. - kpImage image = d->oldImage; - - QPolygon pointsTranslated = d->points; - pointsTranslated.translate (-d->boundingRect.x (), -d->boundingRect.y ()); - - (*d->drawShapeFunc) (&image, - pointsTranslated, - d->fcolor, d->penWidth, - d->bcolor, - true/*final shape*/); - - doc->setImageAt (image, d->boundingRect.topLeft ()); -} - -// public virtual [base kpCommand] -void kpToolPolygonalCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - Q_ASSERT (!d->oldImage.isNull ()); - doc->setImageAt (d->oldImage, d->boundingRect.topLeft ()); - - d->oldImage = kpImage (); -} - diff --git a/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.h b/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.h deleted file mode 100644 index 03d59daa..00000000 --- a/kolourpaint/commands/tools/polygonal/kpToolPolygonalCommand.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolPolygonalCommand_H -#define kpToolPolygonalCommand_H - - -#include -#include - - -#include -#include - -class kpColor; - - -// TODO: merge with kpToolRectangularCommand due to code duplication. -class kpToolPolygonalCommand : public kpNamedCommand -{ -public: - // = the bounding rectangle for including . - kpToolPolygonalCommand (const QString &name, - kpToolPolygonalBase::DrawShapeFunc drawShapeFunc, - const QPolygon &points, - const QRect &boundingRect, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - kpCommandEnvironment *environ); - virtual ~kpToolPolygonalCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - struct kpToolPolygonalCommandPrivate * const d; - kpToolPolygonalCommand &operator= (const kpToolPolygonalCommand &) const; -}; - - -#endif // kpToolPolygonalCommand_H diff --git a/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.cpp b/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.cpp deleted file mode 100644 index 1c0ab84a..00000000 --- a/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_RECTANGULAR_COMMAND 0 - - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -struct kpToolRectangularCommandPrivate -{ - kpToolRectangularBase::DrawShapeFunc drawShapeFunc; - - QRect rect; - - kpColor fcolor; - int penWidth; - kpColor bcolor; - - kpImage oldImage; -}; - -kpToolRectangularCommand::kpToolRectangularCommand (const QString &name, - kpToolRectangularBase::DrawShapeFunc drawShapeFunc, - const QRect &rect, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - kpCommandEnvironment *environ) - - : kpNamedCommand (name, environ), - d (new kpToolRectangularCommandPrivate ()) -{ - d->drawShapeFunc = drawShapeFunc; - - d->rect = rect; - - d->fcolor = fcolor; - d->penWidth = penWidth; - d->bcolor = bcolor; -} - -kpToolRectangularCommand::~kpToolRectangularCommand () -{ - delete d; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolRectangularCommand::size () const -{ - return ImageSize (d->oldImage); -} - - -// public virtual [base kpCommand] -void kpToolRectangularCommand::execute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - // Store Undo info. - // OPT: For a pure rectangle, can do better if there is no bcolor, by only - // saving 4 pixmaps corresponding to the pixels dirtied by the 4 edges. - Q_ASSERT (d->oldImage.isNull ()); - d->oldImage = doc->getImageAt (d->rect); - - // Invoke shape drawing function passed in ctor. - kpImage image = d->oldImage; - (*d->drawShapeFunc) (&image, - 0, 0, d->rect.width (), d->rect.height (), - d->fcolor, d->penWidth, - d->bcolor); - - doc->setImageAt (image, d->rect.topLeft ()); -} - -// public virtual [base kpCommand] -void kpToolRectangularCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - Q_ASSERT (!d->oldImage.isNull ()); - doc->setImageAt (d->oldImage, d->rect.topLeft ()); - - d->oldImage = kpImage (); -} - diff --git a/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.h b/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.h deleted file mode 100644 index f4710127..00000000 --- a/kolourpaint/commands/tools/rectangular/kpToolRectangularCommand.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_RECTANGULAR_COMMAND_H -#define KP_TOOL_RECTANGULAR_COMMAND_H - - -#include -#include - - -class kpColor; - - -class kpToolRectangularCommand : public kpNamedCommand -{ -public: - kpToolRectangularCommand (const QString &name, - kpToolRectangularBase::DrawShapeFunc drawShapeFunc, - const QRect &rect, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - kpCommandEnvironment *environ); - virtual ~kpToolRectangularCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - struct kpToolRectangularCommandPrivate * const d; - kpToolRectangularCommand &operator= (const kpToolRectangularCommand &) const; -}; - - -#endif // KP_TOOL_RECTANGULAR_COMMAND_H diff --git a/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.cpp b/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.cpp deleted file mode 100644 index 66669a06..00000000 --- a/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - - -struct kpAbstractSelectionContentCommandPrivate -{ - const kpAbstractSelection *orgSelBorder; -}; - -kpAbstractSelectionContentCommand::kpAbstractSelectionContentCommand ( - const kpAbstractSelection &originalSelBorder, - const QString &name, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - d (new kpAbstractSelectionContentCommandPrivate ()) -{ - Q_ASSERT (!originalSelBorder.hasContent ()); - - d->orgSelBorder = originalSelBorder.clone (); -} - -kpAbstractSelectionContentCommand::~kpAbstractSelectionContentCommand () -{ - delete d->orgSelBorder; - delete d; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpAbstractSelectionContentCommand::size () const -{ - return d->orgSelBorder->size (); -} - - -// public -const kpAbstractSelection *kpAbstractSelectionContentCommand::originalSelection () const -{ - return d->orgSelBorder; -} diff --git a/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.h b/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.h deleted file mode 100644 index 173f91da..00000000 --- a/kolourpaint/commands/tools/selection/kpAbstractSelectionContentCommand.h +++ /dev/null @@ -1,71 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAbstractSelectionContentCommand_H -#define kpAbstractSelectionContentCommand_H - - -#include - - -// Converts a selection border to a selection with content. -// This must be executed before any manipulations can be made -// to a selection. -// -// Its construction and execution always follows that of a -// kpToolSelectionCreateCommand, which must be given a selection with -// no content. -// -// It's always the first subcommand of a kpMacroCommand, with the following -// subcommands being whatever the selection operation is (e.g. movement, -// resizing). -class kpAbstractSelectionContentCommand : public kpNamedCommand -{ -// LOREFACTOR: Pull up more methods into here? Looking at the code, not -// much could be dragged up without unnecessarily complicated -// abstraction. -public: - // must be a border i.e. have no content. - kpAbstractSelectionContentCommand ( - const kpAbstractSelection &originalSelBorder, - const QString &name, - kpCommandEnvironment *environ); - virtual ~kpAbstractSelectionContentCommand (); - - virtual kpCommandSize::SizeType size () const; - - // Note: Returned pointer is only valid for as long as this command is - // alive. - const kpAbstractSelection *originalSelection () const; - -private: - struct kpAbstractSelectionContentCommandPrivate * const d; -}; - - -#endif // kpAbstractSelectionContentCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.cpp b/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.cpp deleted file mode 100644 index de8048a6..00000000 --- a/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include - -#include -#include - -#include -#include -#include -#include - - -kpToolImageSelectionTransparencyCommand::kpToolImageSelectionTransparencyCommand ( - const QString &name, - const kpImageSelectionTransparency &st, - const kpImageSelectionTransparency &oldST, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_st (st), - m_oldST (oldST) -{ -} - -kpToolImageSelectionTransparencyCommand::~kpToolImageSelectionTransparencyCommand () -{ -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolImageSelectionTransparencyCommand::size () const -{ - return 0; -} - - -// public virtual [base kpCommand] -void kpToolImageSelectionTransparencyCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolImageSelectionTransparencyCommand::execute()"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - environ ()->setImageSelectionTransparency (m_st, true/*force colour change*/); - - if (imageSelection ()) - imageSelection ()->setTransparency (m_st); -} - -// public virtual [base kpCommand] -void kpToolImageSelectionTransparencyCommand::unexecute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolImageSelectionTransparencyCommand::unexecute()"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - environ ()->setImageSelectionTransparency (m_oldST, true/*force colour change*/); - - if (imageSelection ()) - imageSelection ()->setTransparency (m_oldST); -} - diff --git a/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.h b/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.h deleted file mode 100644 index cd6054b1..00000000 --- a/kolourpaint/commands/tools/selection/kpToolImageSelectionTransparencyCommand.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolImageSelectionTransparencyCommand_H -#define kpToolImageSelectionTransparencyCommand_H - - -#include -#include - - -class kpToolImageSelectionTransparencyCommand : public kpNamedCommand -{ -public: - kpToolImageSelectionTransparencyCommand (const QString &name, - const kpImageSelectionTransparency &st, - const kpImageSelectionTransparency &oldST, - kpCommandEnvironment *environ); - virtual ~kpToolImageSelectionTransparencyCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - kpImageSelectionTransparency m_st, m_oldST; -}; - - -#endif // kpToolImageSelectionTransparencyCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.cpp b/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.cpp deleted file mode 100644 index 7cfbad22..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.cpp +++ /dev/null @@ -1,159 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -kpToolSelectionCreateCommand::kpToolSelectionCreateCommand (const QString &name, - const kpAbstractSelection &fromSelection, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_fromSelection (0), - m_textRow (0), m_textCol (0) -{ - setFromSelection (fromSelection); -} - -kpToolSelectionCreateCommand::~kpToolSelectionCreateCommand () -{ - delete m_fromSelection; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolSelectionCreateCommand::size () const -{ - return SelectionSize (m_fromSelection); -} - - -// public -const kpAbstractSelection *kpToolSelectionCreateCommand::fromSelection () const -{ - return m_fromSelection; -} - -// public -void kpToolSelectionCreateCommand::setFromSelection (const kpAbstractSelection &fromSelection) -{ - delete m_fromSelection; - m_fromSelection = fromSelection.clone (); -} - -// public virtual [base kpCommand] -void kpToolSelectionCreateCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionCreateCommand::execute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - if (m_fromSelection) - { - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "\tusing fromSelection"; - kDebug () << "\t\thave sel=" << doc->selection () - << endl; - #endif - kpAbstractImageSelection *imageSel = - dynamic_cast (m_fromSelection); - kpTextSelection *textSel = - dynamic_cast (m_fromSelection); - if (imageSel) - { - if (imageSel->transparency () != environ ()->imageSelectionTransparency ()) - environ ()->setImageSelectionTransparency (imageSel->transparency ()); - } - else if (textSel) - { - if (textSel->textStyle () != environ ()->textStyle ()) - environ ()->setTextStyle (textSel->textStyle ()); - } - else - Q_ASSERT (!"Unknown selection type"); - - viewManager ()->setTextCursorPosition (m_textRow, m_textCol); - doc->setSelection (*m_fromSelection); - - environ ()->somethingBelowTheCursorChanged (); - } -} - -// public virtual [base kpCommand] -void kpToolSelectionCreateCommand::unexecute () -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - if (!doc->selection ()) - { - // Was just a border that got deselected? - if (m_fromSelection && !m_fromSelection->hasContent ()) - return; - - Q_ASSERT (!"kpToolSelectionCreateCommand::unexecute() without sel region"); - return; - } - - m_textRow = viewManager ()->textCursorRow (); - m_textCol = viewManager ()->textCursorCol (); - - doc->selectionDelete (); - - environ ()->somethingBelowTheCursorChanged (); -} - diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.h b/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.h deleted file mode 100644 index 6a286efd..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionCreateCommand.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionCreateCommand_H -#define kpToolSelectionCreateCommand_H - - -#include - - -class kpAbstractSelection; -class kpCommandHistory; - - -class kpToolSelectionCreateCommand : public kpNamedCommand -{ -public: - // (if fromSelection doesn't have a pixmap, it will only recreate the region) - kpToolSelectionCreateCommand (const QString &name, const kpAbstractSelection &fromSelection, - kpCommandEnvironment *environ); - virtual ~kpToolSelectionCreateCommand (); - - virtual kpCommandSize::SizeType size () const; - - const kpAbstractSelection *fromSelection () const; - void setFromSelection (const kpAbstractSelection &fromSelection); - - virtual void execute (); - virtual void unexecute (); - -private: - kpAbstractSelection *m_fromSelection; - - int m_textRow, m_textCol; -}; - - -#endif // kpToolSelectionCreateCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.cpp b/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.cpp deleted file mode 100644 index b556a05f..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.cpp +++ /dev/null @@ -1,185 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolSelectionDestroyCommand::kpToolSelectionDestroyCommand (const QString &name, - bool pushOntoDocument, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_pushOntoDocument (pushOntoDocument), - m_oldSelectionPtr (0), - m_textRow(0), m_textCol(0) -{ -} - -//--------------------------------------------------------------------- - -kpToolSelectionDestroyCommand::~kpToolSelectionDestroyCommand () -{ - delete m_oldSelectionPtr; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolSelectionDestroyCommand::size () const -{ - return ImageSize (m_oldDocImage) + - SelectionSize (m_oldSelectionPtr); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpToolSelectionDestroyCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionDestroyCommand::execute () CALLED"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - Q_ASSERT (doc->selection ()); - - m_textRow = viewManager ()->textCursorRow (); - m_textCol = viewManager ()->textCursorCol (); - - Q_ASSERT (!m_oldSelectionPtr); - m_oldSelectionPtr = doc->selection ()->clone (); - - if (m_pushOntoDocument) - { - m_oldDocImage = doc->getImageAt (doc->selection ()->boundingRect ()); - doc->selectionPushOntoDocument (); - } - else - doc->selectionDelete (); - - environ ()->somethingBelowTheCursorChanged (); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpToolSelectionDestroyCommand::unexecute () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionDestroyCommand::unexecute () CALLED"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - if (doc->selection ()) - { - // not error because it's possible that the user dragged out a new - // region (without pulling image), and then CTRL+Z - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionDestroyCommand::unexecute() already has sel region"; - #endif - - if (doc->selection ()->hasContent ()) - { - Q_ASSERT (!"kpToolSelectionDestroyCommand::unexecute() already has sel content"); - return; - } - } - - Q_ASSERT (m_oldSelectionPtr); - - if (m_pushOntoDocument) - { - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "\tunpush oldDocImage onto doc first"; - #endif - doc->setImageAt (m_oldDocImage, m_oldSelectionPtr->topLeft ()); - } - -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\tsetting selection to: rect=" << m_oldSelectionPtr->boundingRect () - << " hasContent=" << m_oldSelectionPtr->hasContent () - << endl; -#endif - kpAbstractImageSelection *imageSel = - dynamic_cast (m_oldSelectionPtr); - kpTextSelection *textSel = - dynamic_cast (m_oldSelectionPtr); - if (imageSel) - { - if (imageSel->transparency () != environ ()->imageSelectionTransparency ()) - environ ()->setImageSelectionTransparency (imageSel->transparency ()); - if (dynamic_cast (doc->selection())) - doc->selectionPushOntoDocument(); - } - else if (textSel) - { - if (textSel->textStyle () != environ ()->textStyle ()) - environ ()->setTextStyle (textSel->textStyle ()); - if (dynamic_cast (doc->selection())) - doc->selectionPushOntoDocument(); - } - else - Q_ASSERT (!"Unknown selection type"); - - viewManager ()->setTextCursorPosition (m_textRow, m_textCol); - doc->setSelection (*m_oldSelectionPtr); - - environ ()->somethingBelowTheCursorChanged (); - - delete m_oldSelectionPtr; - m_oldSelectionPtr = 0; -} - diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.h b/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.h deleted file mode 100644 index 07f2ca94..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionDestroyCommand.h +++ /dev/null @@ -1,61 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionDestroyCommand_H -#define kpToolSelectionDestroyCommand_H - - -#include -#include - - -class kpAbstractSelection; - - -class kpToolSelectionDestroyCommand : public kpNamedCommand -{ -public: - kpToolSelectionDestroyCommand (const QString &name, bool pushOntoDocument, - kpCommandEnvironment *environ); - virtual ~kpToolSelectionDestroyCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -private: - bool m_pushOntoDocument; - kpImage m_oldDocImage; - kpAbstractSelection *m_oldSelectionPtr; - - int m_textRow, m_textCol; -}; - - -#endif // kpToolSelectionDestroyCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.cpp b/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.cpp deleted file mode 100644 index 9203f80f..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.cpp +++ /dev/null @@ -1,229 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -kpToolSelectionMoveCommand::kpToolSelectionMoveCommand (const QString &name, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ) -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - Q_ASSERT (doc->selection ()); - - m_startPoint = m_endPoint = doc->selection ()->topLeft (); -} - -kpToolSelectionMoveCommand::~kpToolSelectionMoveCommand () -{ -} - - -// public -kpAbstractSelection *kpToolSelectionMoveCommand::originalSelectionClone () const -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - Q_ASSERT (doc->selection ()); - - kpAbstractSelection *selection = doc->selection ()->clone (); - selection->moveTo (m_startPoint); - - return selection; -} - - -// public virtual [base kpComand] -kpCommandSize::SizeType kpToolSelectionMoveCommand::size () const -{ - return ImageSize (m_oldDocumentImage) + - PolygonSize (m_copyOntoDocumentPoints); -} - - -// public virtual [base kpCommand] -void kpToolSelectionMoveCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolSelectionMoveCommand::execute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpAbstractSelection *sel = doc->selection (); - // Must have content before it can be moved. - Q_ASSERT (sel && sel->hasContent ()); - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - - vm->setQueueUpdates (); - { - foreach (const QPoint &p, m_copyOntoDocumentPoints) - { - sel->moveTo (p); - doc->selectionCopyOntoDocument (); - } - - sel->moveTo (m_endPoint); - - environ ()->somethingBelowTheCursorChanged (); - } - vm->restoreQueueUpdates (); -} - -// public virtual [base kpCommand] -void kpToolSelectionMoveCommand::unexecute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolSelectionMoveCommand::unexecute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpAbstractSelection *sel = doc->selection (); - // Must have content before it can be un-moved. - Q_ASSERT (sel && sel->hasContent ()); - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - - vm->setQueueUpdates (); - - if (!m_oldDocumentImage.isNull ()) - doc->setImageAt (m_oldDocumentImage, m_documentBoundingRect.topLeft ()); -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\tmove to startPoint=" << m_startPoint; -#endif - sel->moveTo (m_startPoint); - - environ ()->somethingBelowTheCursorChanged (); - - vm->restoreQueueUpdates (); -} - -// public -void kpToolSelectionMoveCommand::moveTo (const QPoint &point, bool moveLater) -{ -#if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "kpToolSelectionMoveCommand::moveTo" << point - << " moveLater=" << moveLater - <selection (); - // Must have content before it can be moved. - Q_ASSERT (sel && sel->hasContent ()); - - if (point == sel->topLeft ()) - return; - - sel->moveTo (point); - } - - m_endPoint = point; -} - -// public -void kpToolSelectionMoveCommand::moveTo (int x, int y, bool moveLater) -{ - moveTo (QPoint (x, y), moveLater); -} - -// public -void kpToolSelectionMoveCommand::copyOntoDocument () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionMoveCommand::copyOntoDocument()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpAbstractSelection *sel = doc->selection (); - // Must have content before we allow it be stamped onto the document, - // to be consistent with the requirement on other selection operations. - Q_ASSERT (sel && sel->hasContent ()); - - if (m_oldDocumentImage.isNull ()) - m_oldDocumentImage = doc->image (); - - QRect selBoundingRect = sel->boundingRect (); - m_documentBoundingRect.united (selBoundingRect); - - doc->selectionCopyOntoDocument (); - - m_copyOntoDocumentPoints.putPoints (m_copyOntoDocumentPoints.count (), - 1, - selBoundingRect.x (), - selBoundingRect.y ()); -} - -// public -void kpToolSelectionMoveCommand::finalize () -{ - if (!m_oldDocumentImage.isNull () && !m_documentBoundingRect.isNull ()) - { - m_oldDocumentImage = kpTool::neededPixmap (m_oldDocumentImage, - m_documentBoundingRect); - } -} - diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.h b/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.h deleted file mode 100644 index 584555d9..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionMoveCommand.h +++ /dev/null @@ -1,74 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionMoveCommand_H -#define kpToolSelectionMoveCommand_H - - -#include -#include -#include - -#include -#include - - -class kpAbstractSelection; - - -class kpToolSelectionMoveCommand : public kpNamedCommand -{ -public: - kpToolSelectionMoveCommand (const QString &name, kpCommandEnvironment *environ); - virtual ~kpToolSelectionMoveCommand (); - - kpAbstractSelection *originalSelectionClone () const; - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - - void moveTo (const QPoint &point, bool moveLater = false); - void moveTo (int x, int y, bool moveLater = false); - void copyOntoDocument (); - void finalize (); - -private: - QPoint m_startPoint, m_endPoint; - - kpImage m_oldDocumentImage; - - // area of document affected (not the bounding rect of the sel) - QRect m_documentBoundingRect; - - QPolygon m_copyOntoDocumentPoints; -}; - - -#endif // kpToolSelectionMoveCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp b/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp deleted file mode 100644 index 4079a978..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.cpp +++ /dev/null @@ -1,144 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include - -#include -#include -#include -#include - - -kpToolSelectionPullFromDocumentCommand::kpToolSelectionPullFromDocumentCommand ( - const kpAbstractImageSelection &originalSelBorder, - const kpColor &backgroundColor, - const QString &name, - kpCommandEnvironment *environ) - : kpAbstractSelectionContentCommand (originalSelBorder, name, environ), - m_backgroundColor (backgroundColor) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolSelectionPullFromDocumentCommand::() environ=" - << environ - << endl; -#endif -} - -kpToolSelectionPullFromDocumentCommand::~kpToolSelectionPullFromDocumentCommand () -{ -} - - -// public virtual [base kpCommand] -void kpToolSelectionPullFromDocumentCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolSelectionPullFromDocumentCommand::execute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - - vm->setQueueUpdates (); - { - // - // Recreate border - // - - // The previously executed command is required to have been a - // kpToolSelectionCreateCommand, which must have been given an image - // selection with no content. - // - // However, there is a tricky case. Suppose we are called for the first - // time, where the above precondition holds. We would add content - // to the selection as expected. But the user then undoes (CTRL+Z) the - // operation, calling unexecute(). There is now no content again. - // Since selection is only a border, the user can freely deselect it - // and/or select another region without changing the command history - // or document modified state. Therefore, if they now call us again - // by redoing (CTRL+Shift+Z), there is potentially no selection at all - // or it is at an arbitrary location. - // - // This assertion covers all 3 possibilities: - // - // 1. First call: image selection with no content - // 2. Later calls: - // a) no image selection (due to deselection) - // b) image selection with no content, at an arbitrary location - Q_ASSERT (!imageSelection () || !imageSelection ()->hasContent ()); - - const kpAbstractImageSelection *originalImageSel = - static_cast (originalSelection ()); - if (originalImageSel->transparency () != - environ ()->imageSelectionTransparency ()) - { - environ ()->setImageSelectionTransparency (originalImageSel->transparency ()); - } - - doc->setSelection (*originalSelection ()); - - - // - // Add content - // - - doc->imageSelectionPullFromDocument (m_backgroundColor); - } - vm->restoreQueueUpdates (); -} - -// public virtual [base kpCommand] -void kpToolSelectionPullFromDocumentCommand::unexecute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolSelectionPullFromDocumentCommand::unexecute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - // Must have selection image content. - Q_ASSERT (doc->imageSelection () && doc->imageSelection ()->hasContent ()); - - - // We can have faith that this is the state of the selection after - // execute(), rather than after the user tried to throw us off by - // simply selecting another region as to do that, a destroy command - // must have been used. - doc->selectionCopyOntoDocument (false/*use opaque pixmap*/); - doc->imageSelection ()->deleteContent (); -} - diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.h b/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.h deleted file mode 100644 index d07241fb..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionPullFromDocumentCommand.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionPullFromDocumentCommand_H -#define kpToolSelectionPullFromDocumentCommand_H - - -#include -#include - - -class kpAbstractImageSelection; - - -class kpToolSelectionPullFromDocumentCommand : - public kpAbstractSelectionContentCommand -{ -public: - kpToolSelectionPullFromDocumentCommand ( - const kpAbstractImageSelection &originalSelBorder, - const kpColor &backgroundColor, - const QString &name, - kpCommandEnvironment *environ); - virtual ~kpToolSelectionPullFromDocumentCommand (); - - virtual void execute (); - virtual void unexecute (); - -private: - kpColor m_backgroundColor; -}; - - -#endif // kpToolSelectionPullFromDocumentCommand_H diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.cpp b/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.cpp deleted file mode 100644 index b25564f1..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.cpp +++ /dev/null @@ -1,277 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -kpToolSelectionResizeScaleCommand::kpToolSelectionResizeScaleCommand ( - kpCommandEnvironment *environ) - : kpNamedCommand (environ->textSelection () ? - i18n ("Text: Resize Box") : - i18n ("Selection: Smooth Scale"), - environ), - m_smoothScaleTimer (new QTimer (this)) -{ - m_originalSelectionPtr = selection ()->clone (); - - m_newTopLeft = selection ()->topLeft (); - m_newWidth = selection ()->width (); - m_newHeight = selection ()->height (); - - m_smoothScaleTimer->setSingleShot (true); - connect (m_smoothScaleTimer, SIGNAL (timeout ()), - this, SLOT (resizeScaleAndMove ())); -} - -kpToolSelectionResizeScaleCommand::~kpToolSelectionResizeScaleCommand () -{ - delete m_originalSelectionPtr; -} - - -// public virtual -kpCommandSize::SizeType kpToolSelectionResizeScaleCommand::size () const -{ - return SelectionSize (m_originalSelectionPtr); -} - - -// public -const kpAbstractSelection *kpToolSelectionResizeScaleCommand::originalSelection () const -{ - return m_originalSelectionPtr; -} - - -// public -QPoint kpToolSelectionResizeScaleCommand::topLeft () const -{ - return m_newTopLeft; -} - -// public -void kpToolSelectionResizeScaleCommand::moveTo (const QPoint &point) -{ - if (point == m_newTopLeft) - return; - - m_newTopLeft = point; - selection ()->moveTo (m_newTopLeft); -} - - -// public -int kpToolSelectionResizeScaleCommand::width () const -{ - return m_newWidth; -} - -// public -int kpToolSelectionResizeScaleCommand::height () const -{ - return m_newHeight; -} - -// public -void kpToolSelectionResizeScaleCommand::resize (int width, int height, - bool delayed) -{ - if (width == m_newWidth && height == m_newHeight) - return; - - m_newWidth = width; - m_newHeight = height; - - resizeScaleAndMove (delayed); -} - - -// public -void kpToolSelectionResizeScaleCommand::resizeAndMoveTo (int width, int height, - const QPoint &point, - bool delayed) -{ - if (width == m_newWidth && height == m_newHeight && - point == m_newTopLeft) - { - return; - } - - m_newWidth = width; - m_newHeight = height; - m_newTopLeft = point; - - resizeScaleAndMove (delayed); -} - - -// protected -void kpToolSelectionResizeScaleCommand::killSmoothScaleTimer () -{ - m_smoothScaleTimer->stop (); -} - - -// protected -void kpToolSelectionResizeScaleCommand::resizeScaleAndMove (bool delayed) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionResizeScaleCommand::resizeScaleAndMove(delayed=" - << delayed << ")" << endl; -#endif - - killSmoothScaleTimer (); - - kpAbstractSelection *newSelPtr = 0; - - if (textSelection ()) - { - Q_ASSERT (dynamic_cast (m_originalSelectionPtr)); - kpTextSelection *orgTextSel = - static_cast (m_originalSelectionPtr); - - newSelPtr = orgTextSel->resized (m_newWidth, m_newHeight); - } - else - { - Q_ASSERT (dynamic_cast (m_originalSelectionPtr)); - kpAbstractImageSelection *imageSel = - static_cast (m_originalSelectionPtr); - - newSelPtr = new kpRectangularImageSelection ( - QRect (imageSel->x (), - imageSel->y (), - m_newWidth, - m_newHeight), - kpPixmapFX::scale (imageSel->baseImage (), - m_newWidth, m_newHeight, - !delayed/*if not delayed, smooth*/), - imageSel->transparency ()); - - if (delayed) - { - // Call self (once) with delayed==false in 200ms - m_smoothScaleTimer->start (200/*ms*/); - } - } - - Q_ASSERT (newSelPtr); - newSelPtr->moveTo (m_newTopLeft); - - document ()->setSelection (*newSelPtr); - - delete newSelPtr; -} - -// protected slots -void kpToolSelectionResizeScaleCommand::resizeScaleAndMove () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionResizeScaleCommand::resizeScaleAndMove()"; -#endif - resizeScaleAndMove (false/*no delay*/); -} - - -// public -void kpToolSelectionResizeScaleCommand::finalize () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpToolSelectionResizeScaleCommand::finalize()" - << " smoothScaleTimer->isActive=" - << m_smoothScaleTimer->isActive () - << endl; -#endif - - // Make sure the selection contains the final image and the timer won't - // fire afterwards. - if (m_smoothScaleTimer->isActive ()) - { - resizeScaleAndMove (); - Q_ASSERT (!m_smoothScaleTimer->isActive ()); - } -} - - -// public virtual [base kpToolResizeScaleCommand] -void kpToolSelectionResizeScaleCommand::execute () -{ - QApplication::setOverrideCursor (Qt::WaitCursor); - - killSmoothScaleTimer (); - - resizeScaleAndMove (); - - environ ()->somethingBelowTheCursorChanged (); - - QApplication::restoreOverrideCursor (); -} - -// public virtual [base kpToolResizeScaleCommand] -void kpToolSelectionResizeScaleCommand::unexecute () -{ - QApplication::setOverrideCursor (Qt::WaitCursor); - - killSmoothScaleTimer (); - - document ()->setSelection (*m_originalSelectionPtr); - - environ ()->somethingBelowTheCursorChanged (); - - QApplication::restoreOverrideCursor (); -} - - -#include "moc_kpToolSelectionResizeScaleCommand.cpp" diff --git a/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.h b/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.h deleted file mode 100644 index 6e3b41ca..00000000 --- a/kolourpaint/commands/tools/selection/kpToolSelectionResizeScaleCommand.h +++ /dev/null @@ -1,107 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionResizeScaleCommand_H -#define kpToolSelectionResizeScaleCommand_H - - -#include -#include - -#include - - -#include - -class kpAbstractSelection; - - -// You could subclass kpToolResizeScaleCommand and/or -// kpToolSelectionMoveCommand instead if want a disaster. -// This is different to kpToolResizeScaleCommand in that: -// -// 1. This only works for selections. -// 2. This is designed for the size and position to change several times -// before execute(). -// -// REFACTOR: Later: I take that all back. We should merge with -// kpToolResizeScaleCommand to reduce code duplication. -class kpToolSelectionResizeScaleCommand : public QObject, - public kpNamedCommand -{ -Q_OBJECT - -public: - kpToolSelectionResizeScaleCommand (kpCommandEnvironment *environ); - virtual ~kpToolSelectionResizeScaleCommand (); - - virtual kpCommandSize::SizeType size () const; - -public: - const kpAbstractSelection *originalSelection () const; - - QPoint topLeft () const; - void moveTo (const QPoint &point); - - int width () const; - int height () const; - void resize (int width, int height, bool delayed = false); - - // (equivalent to resize() followed by moveTo() but faster) - void resizeAndMoveTo (int width, int height, const QPoint &point, - bool delayed = false); - -protected: - void killSmoothScaleTimer (); - - // If , does a fast, low-quality scale and then calls itself - // with unset for a smooth scale, a short time later. - // If acting on a text box, is ignored. - void resizeScaleAndMove (bool delayed); - -protected slots: - void resizeScaleAndMove (/*delayed = false*/); - -public: - void finalize (); - -public: - virtual void execute (); - virtual void unexecute (); - -protected: - kpAbstractSelection *m_originalSelectionPtr; - - QPoint m_newTopLeft; - int m_newWidth, m_newHeight; - - QTimer *m_smoothScaleTimer; -}; - - -#endif // kpToolSelectionResizeScaleCommand_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.cpp deleted file mode 100644 index 85090dfd..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.cpp +++ /dev/null @@ -1,151 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include - -#include -#include - - -kpToolTextBackspaceCommand::kpToolTextBackspaceCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_row (row), m_col (col), - m_numBackspaces (0) -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - if (action == AddBackspaceNow) - addBackspace (); -} - -kpToolTextBackspaceCommand::~kpToolTextBackspaceCommand () -{ -} - - -// public -void kpToolTextBackspaceCommand::addBackspace () -{ - QList textLines = textSelection ()->textLines (); - - if (m_col > 0) - { - m_deletedText.prepend (textLines [m_row][m_col - 1]); - - textLines [m_row] = textLines [m_row].left (m_col - 1) + - textLines [m_row].mid (m_col); - m_col--; - } - else - { - if (m_row > 0) - { - int newCursorRow = m_row - 1; - int newCursorCol = textLines [newCursorRow].length (); - - m_deletedText.prepend ('\n'); - - textLines [newCursorRow] += textLines [m_row]; - - textLines.erase (textLines.begin () + m_row); - - m_row = newCursorRow; - m_col = newCursorCol; - } - } - - textSelection ()->setTextLines (textLines); - - viewManager ()->setTextCursorPosition (m_row, m_col); - - m_numBackspaces++; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolTextBackspaceCommand::size () const -{ - return (kpCommandSize::SizeType) m_deletedText.length () * sizeof (QChar); -} - - -// public virtual [base kpCommand] -void kpToolTextBackspaceCommand::execute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - m_deletedText.clear (); - int oldNumBackspaces = m_numBackspaces; - m_numBackspaces = 0; - - for (int i = 0; i < oldNumBackspaces; i++) - addBackspace (); -} - -// public virtual [base kpCommand] -void kpToolTextBackspaceCommand::unexecute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - QList textLines = textSelection ()->textLines (); - - for (int i = 0; i < (int) m_deletedText.length (); i++) - { - if (m_deletedText [i] == '\n') - { - const QString rightHalf = textLines [m_row].mid (m_col); - - textLines [m_row].truncate (m_col); - textLines.insert (textLines.begin () + m_row + 1, rightHalf); - - m_row++; - m_col = 0; - } - else - { - const QString leftHalf = textLines [m_row].left (m_col); - const QString rightHalf = textLines [m_row].mid (m_col); - - textLines [m_row] = leftHalf + m_deletedText [i] + rightHalf; - m_col++; - } - } - - m_deletedText.clear (); - - textSelection ()->setTextLines (textLines); - - viewManager ()->setTextCursorPosition (m_row, m_col); -} - diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.h deleted file mode 100644 index 4c557f2c..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextBackspaceCommand.h +++ /dev/null @@ -1,64 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_BACKSPACE_COMMAND_H -#define KP_TOOL_TEXT_BACKSPACE_COMMAND_H - - -#include - - -class kpToolTextBackspaceCommand : public kpNamedCommand -{ -public: - enum Action - { - DontAddBackspaceYet, - AddBackspaceNow - }; - - kpToolTextBackspaceCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ); - virtual ~kpToolTextBackspaceCommand (); - - void addBackspace (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -protected: - int m_row, m_col; - int m_numBackspaces; - QString m_deletedText; -}; - - -#endif // KP_TOOL_TEXT_BACKSPACE_COMMAND_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp deleted file mode 100644 index 10f9b954..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include - -#include -#include - - -kpToolTextChangeStyleCommand::kpToolTextChangeStyleCommand (const QString &name, - const kpTextStyle &newTextStyle, const kpTextStyle &oldTextStyle, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_newTextStyle (newTextStyle), - m_oldTextStyle (oldTextStyle) -{ -} - -kpToolTextChangeStyleCommand::~kpToolTextChangeStyleCommand () -{ -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolTextChangeStyleCommand::size () const -{ - return 0; -} - - -// public virtual [base kpCommand] -void kpToolTextChangeStyleCommand::execute () -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "kpToolTextChangeStyleCommand::execute()" - << " font=" << m_newTextStyle.fontFamily () - << " fontSize=" << m_newTextStyle.fontSize () - << " isBold=" << m_newTextStyle.isBold () - << " isItalic=" << m_newTextStyle.isItalic () - << " isUnderline=" << m_newTextStyle.isUnderline () - << " isStrikeThru=" << m_newTextStyle.isStrikeThru () - << endl; -#endif - - environ ()->setTextStyle (m_newTextStyle); - - if (textSelection ()) - textSelection ()->setTextStyle (m_newTextStyle); -} - -// public virtual [base kpCommand] -void kpToolTextChangeStyleCommand::unexecute () -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "kpToolTextChangeStyleCommand::unexecute()" - << " font=" << m_newTextStyle.fontFamily () - << " fontSize=" << m_newTextStyle.fontSize () - << " isBold=" << m_newTextStyle.isBold () - << " isItalic=" << m_newTextStyle.isItalic () - << " isUnderline=" << m_newTextStyle.isUnderline () - << " isStrikeThru=" << m_newTextStyle.isStrikeThru () - << endl; -#endif - - environ ()->setTextStyle (m_oldTextStyle); - - if (textSelection ()) - textSelection ()->setTextStyle (m_oldTextStyle); -} - diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.h deleted file mode 100644 index 9dda7495..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextChangeStyleCommand.h +++ /dev/null @@ -1,55 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_CHANGE_STYLE_COMMAND_H -#define KP_TOOL_TEXT_CHANGE_STYLE_COMMAND_H - - -#include -#include - - -class kpToolTextChangeStyleCommand : public kpNamedCommand -{ -public: - kpToolTextChangeStyleCommand (const QString &name, - const kpTextStyle &newTextStyle, const kpTextStyle &oldTextStyle, - kpCommandEnvironment *environ); - virtual ~kpToolTextChangeStyleCommand (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -protected: - kpTextStyle m_newTextStyle, m_oldTextStyle; -}; - - -#endif // KP_TOOL_TEXT_CHANGE_STYLE_COMMAND_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.cpp deleted file mode 100644 index a248f6f2..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.cpp +++ /dev/null @@ -1,139 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include - -#include -#include - - -kpToolTextDeleteCommand::kpToolTextDeleteCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_row (row), m_col (col), - m_numDeletes (0) -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - if (action == AddDeleteNow) - addDelete (); -} - -kpToolTextDeleteCommand::~kpToolTextDeleteCommand () -{ -} - - -// public -void kpToolTextDeleteCommand::addDelete () -{ - QList textLines = textSelection ()->textLines (); - - if (m_col < (int) textLines [m_row].length ()) - { - m_deletedText.prepend (textLines [m_row][m_col]); - - textLines [m_row] = textLines [m_row].left (m_col) + - textLines [m_row].mid (m_col + 1); - } - else - { - if (m_row < (int) textLines.size () - 1) - { - m_deletedText.prepend ('\n'); - - textLines [m_row] += textLines [m_row + 1]; - textLines.erase (textLines.begin () + m_row + 1); - } - } - - textSelection ()->setTextLines (textLines); - - viewManager ()->setTextCursorPosition (m_row, m_col); - - m_numDeletes++; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolTextDeleteCommand::size () const -{ - return (kpCommandSize::SizeType) m_deletedText.length () * sizeof (QChar); -} - - -// public virtual [base kpCommand] -void kpToolTextDeleteCommand::execute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - m_deletedText.clear (); - int oldNumDeletes = m_numDeletes; - m_numDeletes = 0; - - for (int i = 0; i < oldNumDeletes; i++) - addDelete (); -} - -// public virtual [base kpCommand] -void kpToolTextDeleteCommand::unexecute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - QList textLines = textSelection ()->textLines (); - - for (int i = 0; i < (int) m_deletedText.length (); i++) - { - if (m_deletedText [i] == '\n') - { - const QString rightHalf = textLines [m_row].mid (m_col); - - textLines [m_row].truncate (m_col); - textLines.insert (textLines.begin () + m_row + 1, rightHalf); - } - else - { - const QString leftHalf = textLines [m_row].left (m_col); - const QString rightHalf = textLines [m_row].mid (m_col); - - textLines [m_row] = leftHalf + m_deletedText [i] + rightHalf; - } - } - - m_deletedText.clear (); - - textSelection ()->setTextLines (textLines); - - viewManager ()->setTextCursorPosition (m_row, m_col); -} - diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.h deleted file mode 100644 index 2d820363..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextDeleteCommand.h +++ /dev/null @@ -1,64 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_DELETE_COMMAND_H -#define KP_TOOL_TEXT_DELETE_COMMAND_H - - -#include - - -class kpToolTextDeleteCommand : public kpNamedCommand -{ -public: - enum Action - { - DontAddDeleteYet, - AddDeleteNow - }; - - kpToolTextDeleteCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ); - virtual ~kpToolTextDeleteCommand (); - - void addDelete (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -protected: - int m_row, m_col; - int m_numDeletes; - QString m_deletedText; -}; - - -#endif // KP_TOOL_TEXT_DELETE_COMMAND_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.cpp deleted file mode 100644 index 6c4a82e2..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include - -#include -#include - - -kpToolTextEnterCommand::kpToolTextEnterCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_row (row), m_col (col), - m_numEnters (0) -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - if (action == AddEnterNow) - addEnter (); -} - -kpToolTextEnterCommand::~kpToolTextEnterCommand () -{ -} - - -// public -void kpToolTextEnterCommand::addEnter () -{ - QList textLines = textSelection ()->textLines (); - - const QString rightHalf = textLines [m_row].mid (m_col); - - textLines [m_row].truncate (m_col); - textLines.insert (textLines.begin () + m_row + 1, rightHalf); - - textSelection ()->setTextLines (textLines); - - m_row++; - m_col = 0; - - viewManager ()->setTextCursorPosition (m_row, m_col); - - m_numEnters++; -} - - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolTextEnterCommand::size () const -{ - return 0; -} - - -// public virtual [base kpCommand] -void kpToolTextEnterCommand::execute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - int oldNumEnters = m_numEnters; - m_numEnters = 0; - - for (int i = 0; i < oldNumEnters; i++) - addEnter (); -} - -// public virtual [base kpCommand] -void kpToolTextEnterCommand::unexecute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - QList textLines = textSelection ()->textLines (); - - for (int i = 0; i < m_numEnters; i++) - { - Q_ASSERT (m_col == 0); - - if (m_row <= 0) - break; - - int newRow = m_row - 1; - int newCol = textLines [newRow].length (); - - textLines [newRow] += textLines [m_row]; - - textLines.erase (textLines.begin () + m_row); - - m_row = newRow; - m_col = newCol; - } - - textSelection ()->setTextLines (textLines); - - viewManager ()->setTextCursorPosition (m_row, m_col); -} - diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.h deleted file mode 100644 index babf968e..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextEnterCommand.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_ENTER_COMMAND_H -#define KP_TOOL_TEXT_ENTER_COMMAND_H - - -#include - - -class kpToolTextEnterCommand : public kpNamedCommand -{ -public: - enum Action - { - DontAddEnterYet, - AddEnterNow - }; - - kpToolTextEnterCommand (const QString &name, - int row, int col, Action action, - kpCommandEnvironment *environ); - virtual ~kpToolTextEnterCommand (); - - void addEnter (); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -protected: - int m_row, m_col; - int m_numEnters; -}; - - -#endif // KP_TOOL_TEXT_ENTER_COMMAND_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.cpp deleted file mode 100644 index ab2347ff..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.cpp +++ /dev/null @@ -1,154 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -#include -#include - -#include -#include -#include -#include - - -kpToolTextGiveContentCommand::kpToolTextGiveContentCommand ( - const kpTextSelection &originalSelBorder, - const QString &name, - kpCommandEnvironment *environ) - : kpAbstractSelectionContentCommand (originalSelBorder, name, environ) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolTextGiveContentCommand::() environ=" - << environ - << endl; -#endif -} - -kpToolTextGiveContentCommand::~kpToolTextGiveContentCommand () -{ -} - - -// public virtual [base kpCommand] -void kpToolTextGiveContentCommand::execute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolTextGiveContentCommand::execute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - - // See API Doc for kpViewManager::textCursorRow() & textCursorCol(). - Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0); - - vm->setQueueUpdates (); - { - // - // Recreate border - // - - // The previously executed command is required to have been a - // kpToolSelectionCreateCommand, which must have been given a text - // selection with no content. - // - // However, there is a tricky case. Suppose we are called for the first - // time, where the above precondition holds. We would add content - // to the selection as expected. But the user then undoes (CTRL+Z) the - // operation, calling unexecute(). There is now no content again. - // Since selection is only a border, the user can freely deselect it - // and/or select another region without changing the command history - // or document modified state. Therefore, if they now call us again - // by redoing (CTRL+Shift+Z), there is potentially no selection at all - // or it is at an arbitrary location. - // - // This assertion covers all 3 possibilities: - // - // 1. First call: text selection with no content - // 2. Later calls: - // a) no text selection (due to deselection) - // b) text selection with no content, at an arbitrary location - Q_ASSERT (!textSelection () || !textSelection ()->hasContent ()); - - const kpTextSelection *originalTextSel = - static_cast (originalSelection ()); - if (originalTextSel->textStyle () != environ ()->textStyle ()) - environ ()->setTextStyle (originalTextSel->textStyle ()); - - doc->setSelection (*originalSelection ()); - - - // - // Add Content - // - - QList listOfOneEmptyString; - listOfOneEmptyString.append (QString ()); - textSelection ()->setTextLines (listOfOneEmptyString); - } - vm->restoreQueueUpdates (); - - // This should not have changed from the start of the method. - Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0); -} - -// public virtual [base kpCommand] -void kpToolTextGiveContentCommand::unexecute () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpToolTextGiveContentCommand::unexecute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - // Must have selection text content. - Q_ASSERT (doc->textSelection () && doc->textSelection ()->hasContent ()); - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - // All the commands after us have been unexecuted, so we must be back - // to the state we were after our execute(). - Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0); - - // We can have faith that this is the state of the selection after - // execute(), rather than after the user tried to throw us off by - // simply selecting another region as to do that, a destroy command - // must have been used. - doc->textSelection ()->deleteContent (); - - // This should not have changed from the start of the method. - Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0); -} - diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.h deleted file mode 100644 index 796aa18e..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextGiveContentCommand.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolTextGiveContentCommand_H -#define kpToolTextGiveContentCommand_H - - -#include - - -class kpTextSelection; - - -// Converts a text border (no text lines) to a text selection with 1 empty -// text line. This must be executed before any manipulations can be made -// to a text selection. -// -// Text analogue of kpToolSelectionPullFromDocumentCommand. -class kpToolTextGiveContentCommand : - public kpAbstractSelectionContentCommand -{ -public: - kpToolTextGiveContentCommand ( - const kpTextSelection &originalSelBorder, - const QString &name, - kpCommandEnvironment *environ); - virtual ~kpToolTextGiveContentCommand (); - - virtual void execute (); - virtual void unexecute (); -}; - - -#endif // kpToolTextGiveContentCommand_H diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.cpp b/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.cpp deleted file mode 100644 index a946a37f..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include - -#include -#include - -//--------------------------------------------------------------------- - -kpToolTextInsertCommand::kpToolTextInsertCommand (const QString &name, - int row, int col, QString newText, - kpCommandEnvironment *environ) - : kpNamedCommand (name, environ), - m_row (row), m_col (col) -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - addText (newText); -} - -//--------------------------------------------------------------------- - -// public -void kpToolTextInsertCommand::addText (const QString &moreText) -{ - if (moreText.isEmpty ()) - return; - - QList textLines = textSelection ()->textLines (); - const QString leftHalf = textLines [m_row].left (m_col); - const QString rightHalf = textLines [m_row].mid (m_col); - textLines [m_row] = leftHalf + moreText + rightHalf; - textSelection ()->setTextLines (textLines); - - m_newText += moreText; - m_col += moreText.length (); - - viewManager ()->setTextCursorPosition (m_row, m_col); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -kpCommandSize::SizeType kpToolTextInsertCommand::size () const -{ - return (kpCommandSize::SizeType) m_newText.length () * sizeof (QChar); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpToolTextInsertCommand::execute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - QString text = m_newText; - m_newText.clear (); - addText (text); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void kpToolTextInsertCommand::unexecute () -{ - viewManager ()->setTextCursorPosition (m_row, m_col); - - QList textLines = textSelection ()->textLines (); - const QString leftHalf = textLines [m_row].left (m_col - m_newText.length ()); - const QString rightHalf = textLines [m_row].mid (m_col); - textLines [m_row] = leftHalf + rightHalf; - textSelection ()->setTextLines (textLines); - - m_col -= m_newText.length (); - - viewManager ()->setTextCursorPosition (m_row, m_col); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.h b/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.h deleted file mode 100644 index b2bc3a57..00000000 --- a/kolourpaint/commands/tools/selection/text/kpToolTextInsertCommand.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_INSERT_COMMAND_H -#define KP_TOOL_TEXT_INSERT_COMMAND_H - - -#include - - -class kpToolTextInsertCommand : public kpNamedCommand -{ -public: - kpToolTextInsertCommand (const QString &name, - int row, int col, QString newText, - kpCommandEnvironment *environ); - - void addText (const QString &moreText); - - virtual kpCommandSize::SizeType size () const; - - virtual void execute (); - virtual void unexecute (); - -protected: - int m_row, m_col; - QString m_newText; -}; - - -#endif // KP_TOOL_TEXT_INSERT_COMMAND_H diff --git a/kolourpaint/cursors/kpCursorLightCross.cpp b/kolourpaint/cursors/kpCursorLightCross.cpp deleted file mode 100644 index 10f11e82..00000000 --- a/kolourpaint/cursors/kpCursorLightCross.cpp +++ /dev/null @@ -1,130 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_CURSOR_LIGHT_CROSS 0 - - -#include - -#include -#include - -#include - - -enum PixelValue -{ - White, Black, Transparent -}; - -static void setPixel (unsigned char *colorBitmap, - unsigned char *maskBitmap, - int width, - int y, int x, enum PixelValue pv) -{ - const int ColorBlack = 1; - const int ColorWhite = 0; - - const int MaskOpaque = 1; - const int MaskTransparent = 0; - - int colorValue, maskValue; - - switch (pv) - { - case White: - colorValue = ColorWhite; - maskValue = MaskOpaque; - break; - - case Black: - colorValue = ColorBlack; - maskValue = MaskOpaque; - break; - - case Transparent: - default: - colorValue = ColorWhite; - maskValue = MaskTransparent; - break; - } - - if (colorValue) - colorBitmap [y * (width / 8) + (x / 8)] |= (1 << (x % 8)); - - if (maskValue) - maskBitmap [y * (width / 8) + (x / 8)] |= (1 << (x % 8)); -} - - -const QCursor *kpCursorLightCrossCreate () -{ -#if DEBUG_KP_CURSOR_LIGHT_CROSS - kDebug () << "kpCursorLightCrossCreate() "; -#endif - - const int side = 24; - const int byteSize = (side * side) / 8; - unsigned char *colorBitmap = new unsigned char [byteSize]; - unsigned char *maskBitmap = new unsigned char [byteSize]; - - memset (colorBitmap, 0, byteSize); - memset (maskBitmap, 0, byteSize); - - const int oddSide = side - 1; - const int strokeLen = oddSide * 3 / 8; - - for (int i = 0; i < strokeLen; i++) - { - const enum PixelValue pv = (i % 2) ? Black : White; - - #define X_(val) (val) - #define Y_(val) (val) - #define DRAW(y,x) setPixel (colorBitmap, maskBitmap, side, (y), (x), pv) - // horizontal - DRAW (Y_(side / 2), X_(1 + i)); - DRAW (Y_(side / 2), X_(side - 1 - i)); - - // vertical - DRAW (Y_(1 + i), X_(side / 2)); - DRAW (Y_(side - 1 - i), X_(side / 2)); - #undef DRAW - #undef Y_ - #undef X_ - } - - const QSize size (side, side); - QCursor *cursor = new QCursor ( - QBitmap::fromData (size, colorBitmap, QImage::Format_MonoLSB), - QBitmap::fromData (size, maskBitmap, QImage::Format_MonoLSB)); - - delete [] maskBitmap; - delete [] colorBitmap; - - return cursor; -} - diff --git a/kolourpaint/cursors/kpCursorLightCross.h b/kolourpaint/cursors/kpCursorLightCross.h deleted file mode 100644 index a5c9e4ce..00000000 --- a/kolourpaint/cursors/kpCursorLightCross.h +++ /dev/null @@ -1,39 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_CURSOR_LIGHT_CROSS_H -#define KP_CURSOR_LIGHT_CROSS_H - - -#include - - -const QCursor *kpCursorLightCrossCreate (); - - -#endif // KP_CURSOR_LIGHT_CROSS_H diff --git a/kolourpaint/cursors/kpCursorProvider.cpp b/kolourpaint/cursors/kpCursorProvider.cpp deleted file mode 100644 index 96c4e69b..00000000 --- a/kolourpaint/cursors/kpCursorProvider.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - -#include - - -static const QCursor *TheLightCursor = 0; - - -// public static -QCursor kpCursorProvider::lightCross () -{ - // TODO: don't leak (although it's cleaned up on exit by OS anyway) - if (!::TheLightCursor) - ::TheLightCursor = kpCursorLightCrossCreate (); - - return *::TheLightCursor; -} diff --git a/kolourpaint/cursors/kpCursorProvider.h b/kolourpaint/cursors/kpCursorProvider.h deleted file mode 100644 index 95e2e9e7..00000000 --- a/kolourpaint/cursors/kpCursorProvider.h +++ /dev/null @@ -1,43 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_CURSOR_PROVIDER_H -#define KP_CURSOR_PROVIDER_H - - -#include - - -class kpCursorProvider -{ -public: - static QCursor lightCross (); -}; - - -#endif // KP_CURSOR_PROVIDER_H diff --git a/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.cpp b/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.cpp deleted file mode 100644 index 49736548..00000000 --- a/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.cpp +++ /dev/null @@ -1,370 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECTS_DIALOG 0 - - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected static -int kpEffectsDialog::s_lastWidth = 640; -int kpEffectsDialog::s_lastHeight = 620; - - -kpEffectsDialog::kpEffectsDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, - QWidget *parent, - int defaultSelectedEffect) - : kpTransformPreviewDialog (kpTransformPreviewDialog::Preview, - true/*reserve top row*/, - QString()/*caption*/, - QString()/*afterActionText (no Dimensions Group Box)*/, - actOnSelection, - _env, - parent), - m_delayedUpdateTimer (new QTimer (this)), - m_effectsComboBox (0), - m_settingsGroupBox (0), - m_settingsLayout (0), - m_effectWidget (0) -{ -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "kpEffectsDialog::kpEffectsDialog()"; -#endif - const bool e = updatesEnabled (); - setUpdatesEnabled (false); - - - if (actOnSelection) - setWindowTitle (i18nc ("@title:window", "More Image Effects (Selection)")); - else - setWindowTitle (i18nc ("@title:window", "More Image Effects")); - - - m_delayedUpdateTimer->setSingleShot (true); - connect (m_delayedUpdateTimer, SIGNAL (timeout ()), - this, SLOT (slotUpdateWithWaitCursor ())); - - - KHBox *effectContainer = new KHBox (mainWidget ()); - effectContainer->setSpacing (spacingHint () * 4 - /*need more space for QGroupBox titles*/); - effectContainer->setMargin (0); - - QLabel *label = new QLabel (i18n ("&Effect:"), effectContainer); - - m_effectsComboBox = new KComboBox (effectContainer); - // Keep in alphabetical order. - // TODO: What about translations? - // sync: order in selectEffect(). - m_effectsComboBox->addItem (i18n ("Balance")); - m_effectsComboBox->addItem (i18n ("Histogram Equalizer")); - m_effectsComboBox->addItem (i18n ("Hue, Saturation, Value")); - m_effectsComboBox->addItem (i18n ("Invert")); - m_effectsComboBox->addItem (i18n ("Reduce Colors")); -#ifdef HAVE_QIMAGEBLITZ - m_effectsComboBox->addItem (i18n ("Soften & Sharpen")); - m_effectsComboBox->addItem (i18n ("Emboss")); - m_effectsComboBox->addItem (i18n ("Flatten")); -#endif - - label->setBuddy (m_effectsComboBox); - effectContainer->setStretchFactor (m_effectsComboBox, 1); - - addCustomWidgetToFront (effectContainer); - - - m_settingsGroupBox = new QGroupBox (mainWidget ()); - m_settingsLayout = new QVBoxLayout ( m_settingsGroupBox ); - m_settingsLayout->setMargin( marginHint () * 2 ); - m_settingsLayout->setSpacing( spacingHint () ); - addCustomWidgetToBack (m_settingsGroupBox); - - - connect (m_effectsComboBox, SIGNAL (activated (int)), - this, SLOT (selectEffect (int))); - selectEffect (defaultSelectedEffect); - - - resize (s_lastWidth, s_lastHeight); - - -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "about to setUpdatesEnabled()"; -#endif - // OPT: The preview pixmap gets recalculated here and then possibly - // again when QResizeEvent fires, when the dialog is shown. - setUpdatesEnabled (e); -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << endl - << endl - << endl; -#endif -} - -kpEffectsDialog::~kpEffectsDialog () -{ - s_lastWidth = width (); - s_lastHeight = height (); -} - - -// public virtual [base kpTransformPreviewDialog] -bool kpEffectsDialog::isNoOp () const -{ - if (!m_effectWidget) - return true; - - return m_effectWidget->isNoOp (); -} - -// public -kpEffectCommandBase *kpEffectsDialog::createCommand () const -{ - if (!m_effectWidget) - return 0; - - return m_effectWidget->createCommand (m_environ->commandEnvironment ()); -} - - -// protected virtual [base kpTransformPreviewDialog] -QSize kpEffectsDialog::newDimensions () const -{ - kpDocument *doc = document (); - if (!doc) - return QSize (); - - return QSize (doc->width (m_actOnSelection), - doc->height (m_actOnSelection)); -} - -// protected virtual [base kpTransformPreviewDialog] -QImage kpEffectsDialog::transformPixmap (const QImage &pixmap, - int targetWidth, int targetHeight) const -{ - QImage pixmapWithEffect; - - if (m_effectWidget && !m_effectWidget->isNoOp ()) - pixmapWithEffect = m_effectWidget->applyEffect (pixmap); - else - pixmapWithEffect = pixmap; - - return kpPixmapFX::scale (pixmapWithEffect, targetWidth, targetHeight); -} - - -// public -int kpEffectsDialog::selectedEffect () const -{ - return m_effectsComboBox->currentIndex (); -} - -// public slot -void kpEffectsDialog::selectEffect (int which) -{ -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "kpEffectsDialog::selectEffect(" << which << ")"; -#endif - - if (which < 0 || - which >= m_effectsComboBox->count ()) - { - return; - } - - if (which != m_effectsComboBox->currentIndex ()) - m_effectsComboBox->setCurrentIndex (which); - - - delete m_effectWidget; - m_effectWidget = 0; - - - m_settingsGroupBox->setWindowTitle(QString()); - -#define CREATE_EFFECT_WIDGET(name) \ - m_effectWidget = new name (m_actOnSelection, m_settingsGroupBox) - // sync: order in constructor. - switch (which) - { - case 0: - CREATE_EFFECT_WIDGET (kpEffectBalanceWidget); - break; - - case 1: - CREATE_EFFECT_WIDGET (kpEffectToneEnhanceWidget); - break; - - case 2: - CREATE_EFFECT_WIDGET (kpEffectHSVWidget); - break; - - case 3: - CREATE_EFFECT_WIDGET (kpEffectInvertWidget); - break; - - case 4: - CREATE_EFFECT_WIDGET (kpEffectReduceColorsWidget); - break; - -#ifdef HAVE_QIMAGEBLITZ - case 5: - CREATE_EFFECT_WIDGET (kpEffectEmbossWidget); - break; - - case 6: - CREATE_EFFECT_WIDGET (kpEffectFlattenWidget); - break; - - case 7: - CREATE_EFFECT_WIDGET (kpEffectBlurSharpenWidget); - break; -#endif - } -#undef CREATE_EFFECT_WIDGET - - - if (m_effectWidget) - { - const bool e = updatesEnabled (); - setUpdatesEnabled (false); - - #if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "widget exists for effect #"; - #endif - m_settingsGroupBox->setTitle (m_effectWidget->caption ()); - - // Show widget. - // - // Don't resize the whole dialog when doing this. - // This seems to work magically without any extra code with Qt4. - #if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "addWidget"; - #endif - m_settingsLayout->addWidget (m_effectWidget); - #if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "show widget"; - #endif - m_effectWidget->show (); - - connect (m_effectWidget, SIGNAL (settingsChangedNoWaitCursor ()), - this, SLOT (slotUpdate ())); - connect (m_effectWidget, SIGNAL (settingsChanged ()), - this, SLOT (slotUpdateWithWaitCursor ())); - connect (m_effectWidget, SIGNAL (settingsChangedDelayed ()), - this, SLOT (slotDelayedUpdate ())); - - #if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "about to setUpdatesEnabled()"; - #endif - setUpdatesEnabled (e); - } - - -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "done" - << endl - << endl - << endl; -#endif -} - - -// protected slot virtual [base kpTransformPreviewDialog] -void kpEffectsDialog::slotUpdate () -{ -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "kpEffectsDialog::slotUpdate()" - << " timerActive=" << m_delayedUpdateTimer->isActive () - << endl; -#endif - - m_delayedUpdateTimer->stop (); - - kpTransformPreviewDialog::slotUpdate (); -} - -// protected slot virtual [base kpTransformPreviewDialog] -void kpEffectsDialog::slotUpdateWithWaitCursor () -{ -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "kpEffectsDialog::slotUpdateWithWaitCursor()" - << " timerActive=" << m_delayedUpdateTimer->isActive () - << endl; -#endif - - m_delayedUpdateTimer->stop (); - - kpTransformPreviewDialog::slotUpdateWithWaitCursor (); -} - - -// protected slot -void kpEffectsDialog::slotDelayedUpdate () -{ -#if DEBUG_KP_EFFECTS_DIALOG - kDebug () << "kpEffectsDialog::slotDelayedUpdate()" - << " timerActive=" << m_delayedUpdateTimer->isActive () - << endl; -#endif - m_delayedUpdateTimer->stop (); - - // (single shot) - m_delayedUpdateTimer->start (400/*ms*/); -} - - -#include "moc_kpEffectsDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.h b/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.h deleted file mode 100644 index 80f2ffca..00000000 --- a/kolourpaint/dialogs/imagelib/effects/kpEffectsDialog.h +++ /dev/null @@ -1,92 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_EFFECTS_DIALOG_H -#define KP_EFFECTS_DIALOG_H - - -#include - - -#include -#include -#include -#include - -class KComboBox; - -class kpEffectCommandBase; -class kpEffectWidgetBase; - - -class kpEffectsDialog : public kpTransformPreviewDialog -{ -Q_OBJECT - -public: - // Specifying is more efficient than leaving it - // as 0 and then calling selectEffect() afterwards. - kpEffectsDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, - QWidget *parent, - int defaultSelectedEffect = 0); - virtual ~kpEffectsDialog (); - - virtual bool isNoOp () const; - kpEffectCommandBase *createCommand () const; - -protected: - virtual QSize newDimensions () const; - virtual QImage transformPixmap (const QImage &pixmap, - int targetWidth, int targetHeight) const; - -public: - int selectedEffect () const; -public slots: - void selectEffect (int which); - -protected slots: - virtual void slotUpdate (); - virtual void slotUpdateWithWaitCursor (); - - void slotDelayedUpdate (); - -protected: - static int s_lastWidth, s_lastHeight; - - QTimer *m_delayedUpdateTimer; - - KComboBox *m_effectsComboBox; - QGroupBox *m_settingsGroupBox; - QVBoxLayout *m_settingsLayout; - - kpEffectWidgetBase *m_effectWidget; -}; - - -#endif // KP_EFFECTS_DIALOG_H diff --git a/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.cpp b/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.cpp deleted file mode 100644 index 7db7f336..00000000 --- a/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.cpp +++ /dev/null @@ -1,793 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT_META_INFO_DIALOG 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -struct kpDocumentMetaInfoDialogPrivate -{ - const kpDocumentMetaInfo *originalMetaInfoPtr; - - KDoubleNumInput *horizDpiInput, *vertDpiInput; - KIntNumInput *horizOffsetInput, *vertOffsetInput; - - QTableWidget *fieldsTableWidget; - QPushButton *fieldsAddRowButton, *fieldsDeleteRowButton, *fieldsResetButton; -}; - - -// (shared by all dialogs, across all main windows, in a KolourPaint instance) -static int LastWidth = -1, LastHeight = -1; - - -// sync: You must keep DpiMinStep = 10 ^ (-DpiPrecision). -// -// You can increase the precision to reduce the chance of inadvertently changing -// the resolution when converting from kpDocumentMetaInfo's "dots per meter" -// to our "dots per inch" and back. It would be bad if simply going into this -// dialog and pressing OK changed the resolution (it's unlikely but I still think -// it might happen with the current precision). -// TODO: On a related note, for many particular resolutions, if the user enters -// one of them into the UI, presses OK and then comes back to the dialog, -// s/he is presented with a different resolution to the one typed in. -// Maybe make DotsPerMeter[XY] be of type "double" instead of "int" to -// solve this problem? -// -// Of course, if you increase the precision too much, the minimum step will -// become so small that it will start experiencing floating point inaccuracies -// esp. since we use it for the "DpiUnspecified" hack. -static const int DpiPrecision = 3; -static const double DpiMinStep = 0.001; - -static const double DpiLegalMin = - kpDocumentMetaInfo::MinDotsPerMeter / KP_INCHES_PER_METER; - -// Out of range represents unspecified DPI. -static const double DpiUnspecified = ::DpiLegalMin - ::DpiMinStep; - -static const double DpiInputMin = ::DpiUnspecified; -static const double DpiInputMax = - kpDocumentMetaInfo::MaxDotsPerMeter / KP_INCHES_PER_METER; - -// The increment the DPI spinboxes jump by when they're clicked. -// -// We make this relatively big since people don't usually just increase their -// DPIs by 1 or so -- they are usually changing from say, 72, to 96. -// -// Obviously, making it equal to DpiMinStep is too slow a UI. Therefore, with -// our big setting, the user will still have to manually change the value in -// the spinbox, using the keyboard, after all their clicking to ensure it is -// exactly the value they want. -static const double DpiInputStep = 10; - - -// TODO: Halve groupbox layout margins in every other file since it doesn't -// seem to be need in Qt4. -kpDocumentMetaInfoDialog::kpDocumentMetaInfoDialog ( - const kpDocumentMetaInfo *docMetaInfo, - QWidget *parent) - - : KDialog (parent), - d (new kpDocumentMetaInfoDialogPrivate ()) -{ - d->originalMetaInfoPtr = docMetaInfo; - - - setCaption (i18nc ("@title:window", "Document Properties")); - setButtons (KDialog::Ok | KDialog::Cancel); - - QWidget *baseWidget = new QWidget (this); - setMainWidget (baseWidget); - - - // - // DPI Group Box - // - - - Q_ASSERT (::DpiInputMin < ::DpiInputMax); - - QGroupBox *dpiGroupBox = new QGroupBox (i18n ("Dots &Per Inch (DPI)"), - baseWidget); - - d->horizDpiInput = new KDoubleNumInput ( - ::DpiInputMin/*lower*/, - ::DpiInputMax/*upper*/, - 0/*value*/, - dpiGroupBox, - ::DpiInputStep/*step*/, - ::DpiPrecision/*precision*/); - d->horizDpiInput->setLabel (i18n ("Horizontal:"), - Qt::AlignTop | Qt::AlignHCenter); - d->horizDpiInput->setSpecialValueText (i18n ("Unspecified")); - - QLabel *dpiXLabel = new QLabel ( - i18nc ("Horizontal DPI 'x' Vertical DPI", " x "), dpiGroupBox); - dpiXLabel->setAlignment (Qt::AlignCenter); - - d->vertDpiInput = new KDoubleNumInput ( - ::DpiInputMin/*lower*/, - ::DpiInputMax/*upper*/, - 0/*value*/, - dpiGroupBox, - ::DpiInputStep/*step*/, - ::DpiPrecision/*precision*/); - d->vertDpiInput->setLabel (i18n ("Vertical:"), - Qt::AlignTop | Qt::AlignHCenter); - d->vertDpiInput->setSpecialValueText (i18n ("Unspecified")); - - - QGridLayout *dpiLay = new QGridLayout (dpiGroupBox); - dpiLay->setSpacing (spacingHint ()); - dpiLay->setMargin (marginHint ()); - - dpiLay->addWidget (d->horizDpiInput, 0, 0); - dpiLay->addWidget (dpiXLabel, 0, 1); - dpiLay->addWidget (d->vertDpiInput, 0, 2); - - dpiLay->addItem (new QSpacerItem (0/*width*/, 0/*height*/), - 1, 0, 1/*row span*/, 3/*col span*/); - dpiLay->setRowStretch (1, 1); - - - dpiGroupBox->setWhatsThis ( - i18n ( - "" - "

Dots Per Inch (DPI) specifies the number of pixels" - " of the image that should be printed inside one inch (2.54cm).

" - - "

The higher the image's DPI, the smaller the printed image." - " Note that your printer is unlikely to produce high" - " quality prints if you increase this to more than 300 or 600 DPI," - " depending on the printer.

" - - "

If you would like to print the image so that it is the same" - " size as it is displayed on the screen, set the image's DPI" - " values to be the same as the screen's.

" - - // TODO: This is currently not true! - // See "96dpi" TODO in kpMainWindow::sendPixmapToPrinter(). - // This also why we don't try to report the current screen DPI - // for the above paragraph. - "

If either DPI value is Unspecified, the image will also" - " be printed to be the same size as on the screen.

" - - "

Not all image formats support DPI values. If the format you" - " save in does not support them, they will not be saved.

" - "
" - )); - - - // - // Offset Group Box - // - - - QGroupBox *offsetGroupBox = new QGroupBox (i18n ("O&ffset"), baseWidget); - - d->horizOffsetInput = new KIntNumInput (offsetGroupBox); - d->horizOffsetInput->setLabel (i18n ("Horizontal:"), - Qt::AlignTop | Qt::AlignHCenter); - d->horizOffsetInput->setRange ( - kpDocumentMetaInfo::MinOffset, - kpDocumentMetaInfo::MaxOffset); - d->horizOffsetInput->setSliderEnabled(false); - - d->vertOffsetInput = new KIntNumInput (offsetGroupBox); - d->vertOffsetInput->setLabel (i18n ("Vertical:"), - Qt::AlignTop | Qt::AlignHCenter); - d->vertOffsetInput->setRange ( - kpDocumentMetaInfo::MinOffset, - kpDocumentMetaInfo::MaxOffset); - d->vertOffsetInput->setSliderEnabled(false); - - - QGridLayout *offsetLay = new QGridLayout (offsetGroupBox); - offsetLay->setSpacing (spacingHint ()); - offsetLay->setMargin (marginHint ()); - - offsetLay->addWidget (d->horizOffsetInput, 0, 0); - offsetLay->addWidget (d->vertOffsetInput, 0, 1); - - offsetLay->addItem (new QSpacerItem (0/*width*/, 0/*height*/), - 1, 0, 1/*row span*/, 2/*col span*/); - offsetLay->setRowStretch (1, 1); - - - offsetGroupBox->setWhatsThis ( - i18n ( - "" - "

The Offset is the relative position where this image" - " should be placed, compared to other images.

" - - "

Not all image formats support the Offset feature." - " If the format you save in does not support it, the values" - " specified here will not be saved.

" - "
" - )); - - - // - // Fields Group Box - // - - - QGroupBox *fieldsGroupBox = new QGroupBox (i18n ("&Text Fields"), - baseWidget); - - d->fieldsTableWidget = new QTableWidget (fieldsGroupBox); - d->fieldsTableWidget->setEditTriggers(QAbstractItemView::AllEditTriggers); - - connect (d->fieldsTableWidget, SIGNAL (currentCellChanged (int, int, int, int)), - SLOT (slotFieldsCurrentCellChanged (int, int, int, int))); - - connect (d->fieldsTableWidget, SIGNAL (itemChanged (QTableWidgetItem *)), - SLOT (slotFieldsItemChanged (QTableWidgetItem *))); - - KHBox *fieldsAddDeleteButtonsBox = new KHBox (fieldsGroupBox); - fieldsAddDeleteButtonsBox->setMargin (0); - fieldsAddDeleteButtonsBox->setSpacing (spacingHint ()); - - d->fieldsAddRowButton = new QPushButton (i18n ("&Add Row"), - fieldsAddDeleteButtonsBox); - connect (d->fieldsAddRowButton, SIGNAL (clicked ()), - SLOT (slotFieldsAddRowButtonClicked ())); - - d->fieldsDeleteRowButton = new QPushButton (i18n ("&Delete Row"), - fieldsAddDeleteButtonsBox); - connect (d->fieldsDeleteRowButton, SIGNAL (clicked ()), - SLOT (slotFieldsDeleteRowButtonClicked ())); - - - d->fieldsResetButton = new QPushButton (i18n ("&Reset"), - fieldsGroupBox); - connect (d->fieldsResetButton, SIGNAL (clicked ()), - SLOT (setUIToOriginalMetaInfo ())); - - - QGridLayout *fieldsLayout = new QGridLayout (fieldsGroupBox); - fieldsLayout->setSpacing (spacingHint ()); - fieldsLayout->setMargin (marginHint ()); - - fieldsLayout->addWidget (d->fieldsTableWidget, 0, 0, 1/*row span*/, 2/*col span*/); - fieldsLayout->addWidget (fieldsAddDeleteButtonsBox, 1, 0, Qt::AlignLeft); - fieldsLayout->addWidget (d->fieldsResetButton, 1, 1, Qt::AlignRight); - - - fieldsGroupBox->setWhatsThis ( - i18n ( - "" - "

Text Fields provide extra information about the image." - " This is probably a comment area that you can freely write any text in.

" - - "

However, this is format-specific so the fields could theoretically be" - " computer-interpreted data - that you should not modify -" - " but this is unlikely.

" - - "

Not all image formats support Text Fields. If the format" - " you save in does not support them, they will not be saved.

" - "
" - )); - - - // - // Global Layout - // - - - QGridLayout *baseLayout = new QGridLayout (baseWidget); - baseLayout->setSpacing (spacingHint ()); - baseLayout->setMargin (0); - - // Col 0 - baseLayout->addWidget (dpiGroupBox, 0, 0); - baseLayout->addWidget (offsetGroupBox, 1, 0); - - // Col 1 - baseLayout->addWidget (fieldsGroupBox, 0, 1, 2/*row span*/, 1/*col span*/); - baseLayout->setColumnStretch (1, 1/*stretch*/); - - - // - // Remaining UI Setup - // - - - setUIToOriginalMetaInfo (); - - - if (::LastWidth > 0 && ::LastHeight > 0) - resize (::LastWidth, ::LastHeight); -} - -//--------------------------------------------------------------------- - -kpDocumentMetaInfoDialog::~kpDocumentMetaInfoDialog () -{ - ::LastWidth = width (), ::LastHeight = height (); - - delete d; -} - -//--------------------------------------------------------------------- -// private - -void kpDocumentMetaInfoDialog::editCell (int r, int c) -{ - d->fieldsTableWidget->setCurrentCell (r, c); - d->fieldsTableWidget->editItem (d->fieldsTableWidget->item (r, c)); -} - -//--------------------------------------------------------------------- -// private slot - -void kpDocumentMetaInfoDialog::setUIToOriginalMetaInfo () -{ - // Set DPI spinboxes. - d->horizDpiInput->setValue (d->originalMetaInfoPtr->dotsPerMeterX () / - KP_INCHES_PER_METER); - d->vertDpiInput->setValue (d->originalMetaInfoPtr->dotsPerMeterY () / - KP_INCHES_PER_METER); - - - // Set Offset spinboxes. - d->horizOffsetInput->setValue (d->originalMetaInfoPtr->offset ().x ()); - d->vertOffsetInput->setValue (d->originalMetaInfoPtr->offset ().y ()); - - - // Set Text Fields. - // - // Block itemChanged() signal as slotFieldsItemChanged() should not get called - // when rows are half-created. - const bool b = d->fieldsTableWidget->blockSignals (true); - { - d->fieldsTableWidget->clear (); - - d->fieldsTableWidget->setRowCount (d->originalMetaInfoPtr->textKeys ().size ()); - d->fieldsTableWidget->setColumnCount (2); - - QStringList fieldsHeader; - fieldsHeader << i18n ("Key") << i18n ("Value"); - d->fieldsTableWidget->setHorizontalHeaderLabels (fieldsHeader); - - int row = 0; - foreach (const QString &key, d->originalMetaInfoPtr->textKeys ()) - { - d->fieldsTableWidget->setItem (row, 0/*1st col*/, - new QTableWidgetItem (key)); - d->fieldsTableWidget->setItem (row, 1/*2nd col*/, - new QTableWidgetItem (d->originalMetaInfoPtr->text (key))); - - row++; - } - - fieldsAppendEmptyRow (); - } - d->fieldsTableWidget->blockSignals (b); - - - editCell (0/*row*/, 0/*col*/); - - - enableFieldsDeleteRowButtonIfShould (); -} - -//--------------------------------------------------------------------- -// public - -bool kpDocumentMetaInfoDialog::isNoOp () const -{ - return (metaInfo () == *d->originalMetaInfoPtr); -} - -//--------------------------------------------------------------------- - -// public -kpDocumentMetaInfo kpDocumentMetaInfoDialog::originalMetaInfo () const -{ - return *d->originalMetaInfoPtr; -} - -// public -kpDocumentMetaInfo kpDocumentMetaInfoDialog::metaInfo ( - QString *errorMessage) const -{ - if (errorMessage) - { - // No errors to start with. - *errorMessage = QString (); - } - - - kpDocumentMetaInfo ret; - - - if (d->horizDpiInput->value () < ::DpiLegalMin) - ret.setDotsPerMeterX (0/*unspecified*/); - else - ret.setDotsPerMeterX (qRound (d->horizDpiInput->value () * KP_INCHES_PER_METER)); - - if (d->vertDpiInput->value () < ::DpiLegalMin) - ret.setDotsPerMeterY (0/*unspecified*/); - else - ret.setDotsPerMeterY (qRound (d->vertDpiInput->value () * KP_INCHES_PER_METER)); - - - ret.setOffset (QPoint (d->horizOffsetInput->value (), - d->vertOffsetInput->value ())); - - - for (int r = 0; r < d->fieldsTableWidget->rowCount (); r++) - { - const QString key = d->fieldsTableWidget->item (r, 0)->text (); - const QString value = d->fieldsTableWidget->item (r, 1)->text (); - - // Empty key? - if (key.isEmpty ()) - { - // Empty value too? - if (value.isEmpty ()) - { - // Ignore empty row. - continue; - } - // Value without a key? - else - { - if (errorMessage) - { - *errorMessage = - ki18n ("The text value \"%1\" on line %2 requires a key.") - .subs (value).subs (r + 1/*count from 1*/).toString (); - - // Print only 1 error message per method invocation. - errorMessage = 0; - } - - // Ignore. - continue; - } - } - - // Duplicate key? - if (ret.textKeys ().contains (key)) - { - if (errorMessage) - { - int q; - for (q = 0; q < r; q++) - { - if (d->fieldsTableWidget->item (q, 0)->text () == key) - break; - } - Q_ASSERT (q != r); - - *errorMessage = - ki18n ("All text keys must be unique. The text key \"%1\"" - " on lines %2 and %3 are identical.") - .subs (key) - .subs (q + 1/*count from 1*/) - .subs (r + 1/*count from 1*/) - .toString (); - - // Print only 1 error message per method invocation. - errorMessage = 0; - } - - // Ignore this duplicate - keep the first value of the key. - continue; - } - - ret.setText (key, value); - - } // for (r = 0; r < table widget rows; r++) { - - - return ret; -} - - -// private -void kpDocumentMetaInfoDialog::fieldsUpdateVerticalHeader () -{ - QStringList vertLabels; - for (int r = 1; r <= d->fieldsTableWidget->rowCount (); r++) - vertLabels << QString::number (r); - - d->fieldsTableWidget->setVerticalHeaderLabels (vertLabels); -} - - -// private -void kpDocumentMetaInfoDialog::fieldsAddEmptyRow (int atRow) -{ - // Block itemChanged() signal as slotFieldsItemChanged() should not get called - // when rows are half-created. - const bool b = d->fieldsTableWidget->blockSignals (true); - { - d->fieldsTableWidget->insertRow (atRow); - - d->fieldsTableWidget->setItem (atRow, 0, new QTableWidgetItem (QString ())); - d->fieldsTableWidget->setItem (atRow, 1, new QTableWidgetItem (QString ())); - } - d->fieldsTableWidget->blockSignals (b); - - // Hack around Qt's failure to redraw these sometimes. - fieldsUpdateVerticalHeader (); - - enableFieldsDeleteRowButtonIfShould (); -} - -// private -void kpDocumentMetaInfoDialog::fieldsAppendEmptyRow () -{ - fieldsAddEmptyRow (d->fieldsTableWidget->rowCount ()); -} - - -// private -bool kpDocumentMetaInfoDialog::isFieldsRowDeleteable (int row) const -{ - // Can't delete no row and can't delete last (always blank) row, which - // is used to make it easy for the user to add rows without pressing - // the "Add" button explicitly. - return (row >= 0 && row < d->fieldsTableWidget->rowCount () - 1); -} - -// private -void kpDocumentMetaInfoDialog::fieldsDeleteRow (int r) -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::fieldsDeleteRow(" - << "row=" << r << ")" - << " currentRow=" << d->fieldsTableWidget->currentRow () << endl; -#endif - - Q_ASSERT (isFieldsRowDeleteable (r)); - - if (r == d->fieldsTableWidget->currentRow ()) - { - // Assertion follows from previous assertion. - const int newRow = r + 1; - #if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tnewRow=" << newRow; - #endif - Q_ASSERT (newRow < d->fieldsTableWidget->rowCount ()); - - int newCol = d->fieldsTableWidget->currentColumn (); - #if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tnewCol=" << newCol; - #endif - if (newCol != 0 && newCol != 1) - { - newCol = 0; - #if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\t\tcorrecting to " << newCol; - #endif - } - - // WARNING: You must call this _before_ deleting the row. Else, you'll - // trigger a Qt bug where if the editor is active on the row to - // be deleted, it might crash. To reproduce, move this line to - // after removeRow() (and subtract 1 from newRow) and - // press the "Delete Row" button several times in succession - // very quickly. - // - // TODO: This usually results in a redraw error if the scrollbar scrolls - // after deleting the 2nd last row. Qt bug. - editCell (newRow, newCol); - } - - - d->fieldsTableWidget->removeRow (r); - - - fieldsUpdateVerticalHeader (); - - enableFieldsDeleteRowButtonIfShould (); -} - - -// private -void kpDocumentMetaInfoDialog::enableFieldsDeleteRowButtonIfShould () -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::enableFieldsDeleteRowButtonIfShould()"; -#endif - - const int r = d->fieldsTableWidget->currentRow (); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tr=" << r; -#endif - - d->fieldsDeleteRowButton->setEnabled (isFieldsRowDeleteable (r)); -} - - -// private slot -void kpDocumentMetaInfoDialog::slotFieldsCurrentCellChanged (int row, int col, - int oldRow, int oldCol) -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::slotFieldsCurrentCellChanged(" - << "row=" << row << ",col=" << col - << ",oldRow=" << oldRow << ",oldCol=" << oldCol - << ")" << endl; -#endif - - (void) row; - (void) col; - (void) oldRow; - (void) oldCol; - - enableFieldsDeleteRowButtonIfShould (); -} - -//--------------------------------------------------------------------- -// private slot - -void kpDocumentMetaInfoDialog::slotFieldsItemChanged (QTableWidgetItem *it) -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::slotFieldsItemChanged(" - << "item=" << it << ") rows=" << d->fieldsTableWidget->rowCount () - << endl; -#endif - - const int r = d->fieldsTableWidget->row (it); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tr=" << r; -#endif - Q_ASSERT (r >= 0 && r < d->fieldsTableWidget->rowCount ()); - - const QString key = d->fieldsTableWidget->item (r, 0)->text (); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << " key='" << key << "'"; -#endif - - const QString value = d->fieldsTableWidget->item (r, 1)->text (); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << " value='" << value << "'"; -#endif - - // At the last row? - if (r == d->fieldsTableWidget->rowCount () - 1) - { - // Typed some text? - if (!key.isEmpty () || !value.isEmpty ()) - { - // LOTODO: If we're called due to the cell's text being finalized - // as a result of the user pressing the "Add Row" button, - // should this really append a row since - // slotFieldsAddRowButtonClicked() button is going to add - // another one? That's two rows when the user only clicked - // that button once! - fieldsAppendEmptyRow (); - } - } -// Deletes a row if it is emptied of text. -#if 0 - // At any normal row? - else - { // Emptied all the text? - if (key.isEmpty () && value.isEmpty ()) - { - // This crashes when the user tabs away after the text is deleted. - // We could use a single shot but that's asking for trouble depending - // on what happens between us and the single shot. - // - // In any case, disabling this makes us more consistent with - // "Add Row" which allows us to add empty rows. - //fieldsDeleteRow (r); - } - } -#endif -} - -//--------------------------------------------------------------------- -// private slot - -void kpDocumentMetaInfoDialog::slotFieldsAddRowButtonClicked () -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::slotFieldsAddRowButtonClicked()" - << endl; -#endif - - const int r = d->fieldsTableWidget->currentRow (); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tr=" << r; -#endif - - // (if no row is selected, r = -1) - fieldsAddEmptyRow (r + 1); - - // Edit the key of this new row (column 0). - // No one edits the value first (column 1). - editCell ((r + 1)/*row*/, 0/*col*/); -} - -//--------------------------------------------------------------------- - -// private slot -void kpDocumentMetaInfoDialog::slotFieldsDeleteRowButtonClicked () -{ -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "kpDocumentMetaInfoDialog::slotFieldsDeleteRowButtonClicked()" - << endl; -#endif - - const int r = d->fieldsTableWidget->currentRow (); -#if DEBUG_KP_DOCUMENT_META_INFO_DIALOG - kDebug () << "\tr=" << r; -#endif - - Q_ASSERT (isFieldsRowDeleteable (r)); - fieldsDeleteRow (r); -} - - -// private slot virtual [base QDialog] -void kpDocumentMetaInfoDialog::accept () -{ - // Validate text fields. - QString errorMessage; - (void) metaInfo (&errorMessage); - if (!errorMessage.isEmpty ()) - { - KMessageBox::sorry (this, errorMessage, i18nc ("@title:window", "Invalid Text Fields")); - return; - } - - KDialog::accept (); -} - - -#include "moc_kpDocumentMetaInfoDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.h b/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.h deleted file mode 100644 index 7c357bd3..00000000 --- a/kolourpaint/dialogs/imagelib/kpDocumentMetaInfoDialog.h +++ /dev/null @@ -1,114 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentMetaInfoDialog_H -#define kpDocumentMetaInfoDialog_H - - -#include - - -#include - -class kpDocumentMetaInfo; - - -// Dialog for editing document meta information (see kpDocumentMetaInfo). -// It contains: -// -// 1. DPI spinboxes -// 2. Offset spinboxes -// 3. Text Fields -// -// The Text Fields widget always keeps an empty key-value row at the bottom. -// If text is entered in this row, a new one is created. This allows users -// to add new rows without pressing any pushbuttons. -class kpDocumentMetaInfoDialog : public KDialog -{ -Q_OBJECT - -public: - kpDocumentMetaInfoDialog (const kpDocumentMetaInfo *docMetaInfo, - QWidget *parent); - virtual ~kpDocumentMetaInfoDialog (); - -public: - bool isNoOp () const; - - kpDocumentMetaInfo originalMetaInfo () const; - - // Returns the meta information gathered from all the UI. - // - // If there is any invalid data in the UI (e.g. duplicate text field - // keys), the returned meta information will still be valid but will not - // contain the complete contents of the UI (this description is - // deliberately vague so that you don't use the return value in such a - // situation). In this situation, if is set, a non-empty, - // translated error message will be returned through it. - // - // If all data in the UI is valid and is set, an empty - // string will be returned through it. - // - // If KDialog::exec() succeeded, all data in the UI was valid so the - // returned meta information will be complete and correct. - // - // This is a slow method as it recalculates the meta information each - // time it's called. - kpDocumentMetaInfo metaInfo (QString *errorMessage = 0) const; - -private: - void editCell (int r, int c); - void fieldsUpdateVerticalHeader (); - - void fieldsAddEmptyRow (int atRow); - void fieldsAppendEmptyRow (); - - bool isFieldsRowDeleteable (int row) const; - void fieldsDeleteRow (int r); - - void enableFieldsDeleteRowButtonIfShould (); - -private slots: - void setUIToOriginalMetaInfo (); - void slotFieldsCurrentCellChanged (int row, int col, int oldRow, int oldCol); - - // Allows the user to add a row without pressing any pushbuttons: - // Appends a new, blank row when text has been added to the last row. - void slotFieldsItemChanged (QTableWidgetItem *item); - - void slotFieldsAddRowButtonClicked (); - void slotFieldsDeleteRowButtonClicked (); - - virtual void accept (); - -private: - struct kpDocumentMetaInfoDialogPrivate * const d; -}; - - -#endif // kpDocumentMetaInfoDialog_H diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.cpp b/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.cpp deleted file mode 100644 index 7c81c8cc..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.cpp +++ /dev/null @@ -1,459 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TRANSFORM_PREVIEW_DIALOG 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - - -kpTransformPreviewDialog::kpTransformPreviewDialog (Features features, - bool reserveTopRow, - const QString &caption, - const QString &afterActionText, - bool actOnSelection, - kpTransformDialogEnvironment *_env, - QWidget *parent) - : KDialog (parent), - m_afterActionText (afterActionText), - m_actOnSelection (actOnSelection), - m_dimensionsGroupBox (0), - m_afterTransformDimensionsLabel (0), - m_previewGroupBox (0), - m_previewPixmapLabel (0), - m_gridLayout (0), - m_environ (_env) -{ - setCaption (caption); - setButtons (KDialog::Ok | KDialog::Cancel); - QWidget *baseWidget = new QWidget (this); - setMainWidget (baseWidget); - - - if (document ()) - { - m_oldWidth = document ()->width (actOnSelection); - m_oldHeight = document ()->height (actOnSelection); - } - else - { - m_oldWidth = m_oldHeight = 1; - } - - - if (features & Dimensions) - createDimensionsGroupBox (); - - if (features & Preview) - createPreviewGroupBox (); - - - m_gridLayout = new QGridLayout (baseWidget ); - m_gridLayout->setSpacing (spacingHint ()); - m_gridNumRows = reserveTopRow ? 1 : 0; - if (m_dimensionsGroupBox || m_previewGroupBox) - { - if (m_dimensionsGroupBox && m_previewGroupBox) - { - m_gridLayout->addWidget (m_dimensionsGroupBox, m_gridNumRows, 0); - m_gridLayout->addWidget (m_previewGroupBox, m_gridNumRows, 1); - - m_gridLayout->setColumnStretch (1, 1); - } - else if (m_dimensionsGroupBox) - { - m_gridLayout->addWidget (m_dimensionsGroupBox, - m_gridNumRows, 0, 1, 2); - } - else if (m_previewGroupBox) - { - m_gridLayout->addWidget (m_previewGroupBox, - m_gridNumRows, 0, 1, 2); - } - - m_gridLayout->setRowStretch (m_gridNumRows, 1); - m_gridNumRows++;; - } -} - -kpTransformPreviewDialog::~kpTransformPreviewDialog () -{ -} - - -// private -void kpTransformPreviewDialog::createDimensionsGroupBox () -{ - m_dimensionsGroupBox = new QGroupBox (i18n ("Dimensions"), mainWidget ()); - - QLabel *originalLabel = new QLabel (i18n ("Original:"), m_dimensionsGroupBox); - QString originalDimensions; - if (document ()) - { - originalDimensions = i18n ("%1 x %2", - m_oldWidth, - m_oldHeight); - - // Stop the Dimensions Group Box from resizing so often - const QString minimumLengthString ("100000 x 100000"); - const int padLength = minimumLengthString.length (); - for (int i = originalDimensions.length (); i < padLength; i++) - originalDimensions += ' '; - } - QLabel *originalDimensionsLabel = new QLabel (originalDimensions, m_dimensionsGroupBox); - - QLabel *afterTransformLabel = new QLabel (m_afterActionText, m_dimensionsGroupBox); - m_afterTransformDimensionsLabel = new QLabel (m_dimensionsGroupBox); - - - QGridLayout *dimensionsLayout = new QGridLayout (m_dimensionsGroupBox ); - dimensionsLayout->setMargin( marginHint () * 2 ); - dimensionsLayout->setSpacing( spacingHint ()); - - dimensionsLayout->addWidget (originalLabel, 0, 0, Qt::AlignBottom); - dimensionsLayout->addWidget (originalDimensionsLabel, 0, 1, Qt::AlignBottom); - dimensionsLayout->addWidget (afterTransformLabel, 1, 0, Qt::AlignTop); - dimensionsLayout->addWidget (m_afterTransformDimensionsLabel, 1, 1, Qt::AlignTop); -} - -// private -void kpTransformPreviewDialog::createPreviewGroupBox () -{ - m_previewGroupBox = new QGroupBox (i18n ("Preview"), mainWidget ()); - - m_previewPixmapLabel = new kpResizeSignallingLabel (m_previewGroupBox); - m_previewPixmapLabel->setMinimumSize (150, 110); - connect (m_previewPixmapLabel, SIGNAL (resized ()), - this, SLOT (updatePreview ())); - - QPushButton *updatePushButton = new QPushButton (i18n ("&Update"), - m_previewGroupBox); - connect (updatePushButton, SIGNAL (clicked ()), - this, SLOT (slotUpdateWithWaitCursor ())); - - - QVBoxLayout *previewLayout = new QVBoxLayout (m_previewGroupBox); - previewLayout->setMargin (marginHint () * 2); - previewLayout->setSpacing (qMax (1, spacingHint () / 2)); - - previewLayout->addWidget (m_previewPixmapLabel, 1/*stretch*/); - previewLayout->addWidget (updatePushButton, 0/*stretch*/, Qt::AlignHCenter); -} - - -// protected -kpDocument *kpTransformPreviewDialog::document () const -{ - return m_environ->document (); -} - - -// protected -void kpTransformPreviewDialog::addCustomWidgetToFront (QWidget *w) -{ - m_gridLayout->addWidget (w, 0, 0, 1, 2); -} - -// protected -void kpTransformPreviewDialog::addCustomWidget (QWidget *w) -{ - m_gridLayout->addWidget (w, m_gridNumRows, 0, 1, 2); - m_gridNumRows++; -} - - -// public override [base QWidget] -void kpTransformPreviewDialog::setUpdatesEnabled (bool enable) -{ - KDialog::setUpdatesEnabled (enable); - - if (enable) - slotUpdateWithWaitCursor (); -} - - -// private -void kpTransformPreviewDialog::updateDimensions () -{ - if (!m_dimensionsGroupBox) - return; - - kpDocument *doc = document (); - if (!doc) - return; - - if (!updatesEnabled ()) - { - #if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "updates not enabled - aborting"; - #endif - return; - } - - QSize newDim = newDimensions (); -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::updateDimensions(): newDim=" << newDim; -#endif - - QString newDimString = i18n ("%1 x %2", - newDim.width (), - newDim.height ()); - m_afterTransformDimensionsLabel->setText (newDimString); -} - - -// public static -double kpTransformPreviewDialog::aspectScale (int newWidth, int newHeight, - int oldWidth, int oldHeight) -{ - double widthScale = double (newWidth) / double (oldWidth); - double heightScale = double (newHeight) / double (oldHeight); - - // Keeps aspect ratio - return qMin (widthScale, heightScale); -} - -// public static -int kpTransformPreviewDialog::scaleDimension (int dimension, double scale, int min, int max) -{ - return qMax (min, - qMin (max, - qRound (dimension * scale))); -} - - -// private -void kpTransformPreviewDialog::updateShrunkenDocumentPixmap () -{ -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::updateShrunkenDocumentPixmap()" - << " shrunkenDocPixmap.size=" - << m_shrunkenDocumentPixmap.size () - << " previewPixmapLabelSizeWhenUpdatedPixmap=" - << m_previewPixmapLabelSizeWhenUpdatedPixmap - << " previewPixmapLabel.size=" - << m_previewPixmapLabel->size () - << endl; -#endif - - if (!m_previewGroupBox) - return; - - - kpDocument *doc = document (); - Q_ASSERT (doc && !doc->image ().isNull ()); - - if (m_shrunkenDocumentPixmap.isNull () || - m_previewPixmapLabel->size () != m_previewPixmapLabelSizeWhenUpdatedPixmap) - { - #if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "\tupdating shrunkenDocPixmap"; - #endif - - // TODO: Why the need to keep aspect ratio here? - // Isn't scaling the skewed result maintaining aspect enough? - double keepsAspectScale = aspectScale (m_previewPixmapLabel->width (), - m_previewPixmapLabel->height (), - m_oldWidth, - m_oldHeight); - - kpImage image; - - if (m_actOnSelection) - { - kpAbstractImageSelection *sel = doc->imageSelection ()->clone (); - if (!sel->hasContent ()) - sel->setBaseImage (doc->getSelectedBaseImage ()); - - image = sel->transparentImage (); - delete sel; - } - else - { - image = doc->image (); - } - - m_shrunkenDocumentPixmap = kpPixmapFX::scale ( - image, - scaleDimension (m_oldWidth, - keepsAspectScale, - 1, m_previewPixmapLabel->width ()), - scaleDimension (m_oldHeight, - keepsAspectScale, - 1, m_previewPixmapLabel->height ())); - #if 0 - m_shrunkenDocumentPixmap = kpPixmapFX::scale ( - m_actOnSelection ? doc->getSelectedPixmap () : *doc->pixmap (), - m_previewPixmapLabel->width (), - m_previewPixmapLabel->height ()); - #endif - - m_previewPixmapLabelSizeWhenUpdatedPixmap = m_previewPixmapLabel->size (); - } -} - - -// private -void kpTransformPreviewDialog::updatePreview () -{ -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::updatePreview()"; -#endif - - if (!m_previewGroupBox) - return; - - - kpDocument *doc = document (); - if (!doc) - return; - - - if (!updatesEnabled ()) - { - #if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "updates not enabled - aborting"; - #endif - return; - } - - - updateShrunkenDocumentPixmap (); - - if (!m_shrunkenDocumentPixmap.isNull ()) - { - QSize newDim = newDimensions (); - double keepsAspectScale = aspectScale (m_previewPixmapLabel->width (), - m_previewPixmapLabel->height (), - newDim.width (), - newDim.height ()); - - int targetWidth = scaleDimension (newDim.width (), - keepsAspectScale, - 1, // min - m_previewPixmapLabel->width ()); // max - int targetHeight = scaleDimension (newDim.height (), - keepsAspectScale, - 1, // min - m_previewPixmapLabel->height ()); // max - - // TODO: Some effects work directly on QImage; so could cache the - // QImage so that transformPixmap() is faster - QImage transformedShrunkenDocumentPixmap = - transformPixmap (m_shrunkenDocumentPixmap, targetWidth, targetHeight); - - QImage previewPixmap (m_previewPixmapLabel->width (), - m_previewPixmapLabel->height (), QImage::Format_ARGB32_Premultiplied); - previewPixmap.fill(QColor(Qt::transparent).rgba()); - kpPixmapFX::setPixmapAt (&previewPixmap, - (previewPixmap.width () - transformedShrunkenDocumentPixmap.width ()) / 2, - (previewPixmap.height () - transformedShrunkenDocumentPixmap.height ()) / 2, - transformedShrunkenDocumentPixmap); - -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::updatePreview ():" - << " shrunkenDocumentPixmap: w=" - << m_shrunkenDocumentPixmap.width () - << " h=" - << m_shrunkenDocumentPixmap.height () - << " previewPixmapLabel: w=" - << m_previewPixmapLabel->width () - << " h=" - << m_previewPixmapLabel->height () - << " transformedShrunkenDocumentPixmap: w=" - << transformedShrunkenDocumentPixmap.width () - << " h=" - << transformedShrunkenDocumentPixmap.height () - << " previewPixmap: w=" - << previewPixmap.width () - << " h=" - << previewPixmap.height () - << endl; -#endif - - m_previewPixmapLabel->setPixmap (QPixmap::fromImage(previewPixmap)); - - // immediate update esp. for expensive previews - m_previewPixmapLabel->repaint (); - -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "\tafter QLabel::setPixmap() previewPixmapLabel: w=" - << m_previewPixmapLabel->width () - << " h=" - << m_previewPixmapLabel->height () - << endl; -#endif - } -} - - -// protected slot virtual -void kpTransformPreviewDialog::slotUpdate () -{ -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::slotUpdate()"; -#endif - updateDimensions (); - updatePreview (); -} - -// protected slot virtual -void kpTransformPreviewDialog::slotUpdateWithWaitCursor () -{ -#if DEBUG_KP_TRANSFORM_PREVIEW_DIALOG - kDebug () << "kpTransformPreviewDialog::slotUpdateWithWaitCursor()"; -#endif - - QApplication::setOverrideCursor (Qt::WaitCursor); - - slotUpdate (); - - QApplication::restoreOverrideCursor (); -} - - -#include "moc_kpTransformPreviewDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.h b/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.h deleted file mode 100644 index a3f5b57e..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformPreviewDialog.h +++ /dev/null @@ -1,144 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformPreviewDialog_H -#define kpTransformPreviewDialog_H - - -#include - -#include - - -#include -#include -#include - -class kpColor; -class kpDocument; -class kpResizeSignallingLabel; -class kpTransformDialogEnvironment; - - -class kpTransformPreviewDialog : public KDialog -{ -Q_OBJECT - -public: - enum Features - { - Dimensions = 1, Preview = 2, - AllFeatures = Dimensions | Preview - }; - - // You must call slotUpdate() in your constructor - kpTransformPreviewDialog (Features features, - bool reserveTopRow, - // e.g. "Skew (Image|Selection)" - const QString &caption, - // (in the Dimensions Group Box) e.g. "After Skew:" - const QString &afterActionText, - bool actOnSelection, - kpTransformDialogEnvironment *_env, - QWidget *parent); - virtual ~kpTransformPreviewDialog (); - -private: - void createDimensionsGroupBox (); - void createPreviewGroupBox (); - -public: - virtual bool isNoOp () const = 0; - -protected: - kpDocument *document () const; - - // All widgets must have mainWidget() as their parent - void addCustomWidgetToFront (QWidget *w); // see in ctor - void addCustomWidget (QWidget *w); - void addCustomWidgetToBack (QWidget *w) - { - addCustomWidget (w); - } - - virtual QSize newDimensions () const = 0; - virtual QImage transformPixmap (const QImage &pixmap, - int targetWidth, int targetHeight) const = 0; - -public: - // Use to avoid excessive, expensive preview pixmap label recalcuations, - // during init and widget relayouts. - // - // Setting to true automatically calls slotUpdateWithWaitCursor(). - // - // WARNING: This overrides a non-virtual method in QWidget. - void setUpdatesEnabled (bool enable); - -private: - void updateDimensions (); - -public: - static double aspectScale (int newWidth, int newHeight, - int oldWidth, int oldHeight); - static int scaleDimension (int dimension, double scale, int min, int max); - -private: - void updateShrunkenDocumentPixmap (); - -protected slots: - void updatePreview (); - - // Call this whenever a value (e.g. an angle) changes - // and the Dimensions & Preview need to be updated - virtual void slotUpdate (); - - virtual void slotUpdateWithWaitCursor (); - -protected: - // REFACTOR: Use d-ptr - QString m_afterActionText; - bool m_actOnSelection; - - int m_oldWidth, m_oldHeight; - - QGroupBox *m_dimensionsGroupBox; - QLabel *m_afterTransformDimensionsLabel; - - QGroupBox *m_previewGroupBox; - kpResizeSignallingLabel *m_previewPixmapLabel; - QSize m_previewPixmapLabelSizeWhenUpdatedPixmap; - QImage m_shrunkenDocumentPixmap; - - QGridLayout *m_gridLayout; - int m_gridNumRows; - - kpTransformDialogEnvironment *m_environ; -}; - - -#endif // kpTransformPreviewDialog_H diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp b/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp deleted file mode 100644 index 3ac816af..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp +++ /dev/null @@ -1,817 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG 0 - - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -#define kpSettingResizeScaleLastKeepAspect "Resize Scale - Last Keep Aspect" -#define kpSettingResizeScaleScaleType "Resize Scale - ScaleType" - -//--------------------------------------------------------------------- - -#define SET_VALUE_WITHOUT_SIGNAL_EMISSION(knuminput_instance,value) \ -{ \ - knuminput_instance->blockSignals (true); \ - knuminput_instance->setValue (value); \ - knuminput_instance->blockSignals (false); \ -} - -#define IGNORE_KEEP_ASPECT_RATIO(cmd) \ -{ \ - m_ignoreKeepAspectRatio++; \ - cmd; \ - m_ignoreKeepAspectRatio--; \ -} - -//--------------------------------------------------------------------- - -kpTransformResizeScaleDialog::kpTransformResizeScaleDialog ( - kpTransformDialogEnvironment *_env, QWidget *parent) - : KDialog (parent), - m_environ (_env), - m_ignoreKeepAspectRatio (0), - m_lastType(kpTransformResizeScaleCommand::Resize) -{ - setCaption( i18nc ("@title:window", "Resize / Scale") ); - setButtons( KDialog::Ok | KDialog::Cancel); - - QWidget *baseWidget = new QWidget (this); - setMainWidget (baseWidget); - - KHBox *actOnBox = createActOnBox(baseWidget); - QGroupBox *operationGroupBox = createOperationGroupBox(baseWidget); - QGroupBox *dimensionsGroupBox = createDimensionsGroupBox(baseWidget); - - QVBoxLayout *baseLayout = new QVBoxLayout (baseWidget); - baseLayout->setSpacing (spacingHint ()); - baseLayout->setMargin(0/*margin*/); - baseLayout->addWidget(actOnBox); - baseLayout->addWidget(operationGroupBox); - baseLayout->addWidget(dimensionsGroupBox); - - KConfigGroup cfg(KGlobal::config(), kpSettingsGroupGeneral); - setKeepAspectRatio(cfg.readEntry(kpSettingResizeScaleLastKeepAspect, false)); - m_lastType = static_cast - (cfg.readEntry(kpSettingResizeScaleScaleType, - static_cast(kpTransformResizeScaleCommand::Resize))); - - slotActOnChanged (); - - m_newWidthInput->setEditFocus (); - - //enableButtonOk (!isNoOp ()); -} - -//--------------------------------------------------------------------- -// private - -kpDocument *kpTransformResizeScaleDialog::document () const -{ - return m_environ->document (); -} - -//--------------------------------------------------------------------- -// private - -kpAbstractSelection *kpTransformResizeScaleDialog::selection () const -{ - Q_ASSERT (document ()); - return document ()->selection (); -} - -//--------------------------------------------------------------------- -// private - -kpTextSelection *kpTransformResizeScaleDialog::textSelection () const -{ - Q_ASSERT (document ()); - return document ()->textSelection (); -} - -//--------------------------------------------------------------------- -// private - -KHBox *kpTransformResizeScaleDialog::createActOnBox(QWidget *baseWidget) -{ - KHBox *actOnBox = new KHBox (baseWidget); - actOnBox->setSpacing (spacingHint () * 2); - - - QLabel *actOnLabel = new QLabel (i18n ("Ac&t on:"), actOnBox); - m_actOnCombo = new KComboBox (actOnBox); - - - actOnLabel->setBuddy (m_actOnCombo); - - m_actOnCombo->insertItem (Image, i18n ("Entire Image")); - if (selection ()) - { - QString selName = i18n ("Selection"); - - if (textSelection ()) - selName = i18n ("Text Box"); - - m_actOnCombo->insertItem (Selection, selName); - m_actOnCombo->setCurrentIndex (Selection); - } - else - { - actOnLabel->setEnabled (false); - m_actOnCombo->setEnabled (false); - } - - - actOnBox->setStretchFactor (m_actOnCombo, 1); - - - connect (m_actOnCombo, SIGNAL (activated (int)), - this, SLOT (slotActOnChanged ())); - - return actOnBox; -} - -//--------------------------------------------------------------------- - -static void toolButtonSetLook (QToolButton *button, - const QString &iconName, - const QString &name) -{ - QPixmap icon = UserIcon (iconName); - button->setIconSize (QSize (icon.width (), icon.height ())); - button->setIcon (icon); - - button->setToolButtonStyle (Qt::ToolButtonTextUnderIcon); - button->setText (name); - button->setFocusPolicy (Qt::StrongFocus); - button->setCheckable (true); -} - -//--------------------------------------------------------------------- -// private - -QGroupBox *kpTransformResizeScaleDialog::createOperationGroupBox (QWidget *baseWidget) -{ - QGroupBox *operationGroupBox = new QGroupBox (i18n ("Operation"), baseWidget); - operationGroupBox->setWhatsThis( - i18n ("" - "
    " - "
  • Resize: The size of the picture will be" - " increased" - " by creating new areas to the right and/or bottom" - " (filled in with the background color) or" - " decreased by cutting" - " it at the right and/or bottom.
  • " - - "
  • Scale: The picture will be expanded" - " by duplicating pixels or squashed by dropping pixels.
  • " - - "
  • Smooth Scale: This is the same as" - " Scale except that it blends neighboring" - " pixels to produce a smoother looking picture.
  • " - "
" - "
")); - - m_resizeButton = new QToolButton (operationGroupBox); - toolButtonSetLook (m_resizeButton, - QLatin1String ("resize"), - i18n ("&Resize")); - - m_scaleButton = new QToolButton (operationGroupBox); - toolButtonSetLook (m_scaleButton, - QLatin1String ("scale"), - i18n ("&Scale")); - - m_smoothScaleButton = new QToolButton (operationGroupBox); - toolButtonSetLook (m_smoothScaleButton, - QLatin1String ("smooth_scale"), - i18n ("S&mooth Scale")); - - QButtonGroup *resizeScaleButtonGroup = new QButtonGroup (baseWidget); - resizeScaleButtonGroup->addButton (m_resizeButton); - resizeScaleButtonGroup->addButton (m_scaleButton); - resizeScaleButtonGroup->addButton (m_smoothScaleButton); - - - QGridLayout *operationLayout = new QGridLayout (operationGroupBox ); - operationLayout->setMargin (marginHint () * 2/*don't overlap groupbox title*/); - operationLayout->setSpacing (spacingHint ()); - - operationLayout->addWidget (m_resizeButton, 0, 0, Qt::AlignCenter); - operationLayout->addWidget (m_scaleButton, 0, 1, Qt::AlignCenter); - operationLayout->addWidget (m_smoothScaleButton, 0, 2, Qt::AlignCenter); - - connect (m_resizeButton, SIGNAL (toggled (bool)), - this, SLOT (slotTypeChanged ())); - connect (m_scaleButton, SIGNAL (toggled (bool)), - this, SLOT (slotTypeChanged ())); - connect (m_smoothScaleButton, SIGNAL (toggled (bool)), - this, SLOT (slotTypeChanged ())); - - return operationGroupBox; -} - -//--------------------------------------------------------------------- -// private - -QGroupBox *kpTransformResizeScaleDialog::createDimensionsGroupBox(QWidget *baseWidget) -{ - QGroupBox *dimensionsGroupBox = new QGroupBox (i18n ("Dimensions"), baseWidget); - - QLabel *widthLabel = new QLabel (i18n ("Width:"), dimensionsGroupBox); - widthLabel->setAlignment (widthLabel->alignment () | Qt::AlignHCenter); - QLabel *heightLabel = new QLabel (i18n ("Height:"), dimensionsGroupBox); - heightLabel->setAlignment (heightLabel->alignment () | Qt::AlignHCenter); - - QLabel *originalLabel = new QLabel (i18n ("Original:"), dimensionsGroupBox); - m_originalWidthInput = new KIntNumInput ( - document ()->width ((bool) selection ()), - dimensionsGroupBox); - QLabel *xLabel0 = new QLabel (i18n ("x"), dimensionsGroupBox); - m_originalHeightInput = new KIntNumInput ( - document ()->height ((bool) selection ()), - dimensionsGroupBox); - - QLabel *newLabel = new QLabel (i18n ("&New:"), dimensionsGroupBox); - m_newWidthInput = new KIntNumInput (dimensionsGroupBox); - QLabel *xLabel1 = new QLabel (i18n ("x"), dimensionsGroupBox); - m_newHeightInput = new KIntNumInput (dimensionsGroupBox); - - QLabel *percentLabel = new QLabel (i18n ("&Percent:"), dimensionsGroupBox); - m_percentWidthInput = new KDoubleNumInput (0.01/*lower*/, 1000000/*upper*/, - 100/*value*/, - dimensionsGroupBox, - 1/*step*/, - 2/*precision*/); - m_percentWidthInput->setSuffix (i18n ("%")); - QLabel *xLabel2 = new QLabel (i18n ("x"), dimensionsGroupBox); - m_percentHeightInput = new KDoubleNumInput (0.01/*lower*/, 1000000/*upper*/, - 100/*value*/, - dimensionsGroupBox, - 1/*step*/, - 2/*precision*/); - m_percentHeightInput->setSuffix (i18n ("%")); - - m_keepAspectRatioCheckBox = new QCheckBox (i18n ("Keep &aspect ratio"), - dimensionsGroupBox); - - - m_originalWidthInput->setEnabled (false); - m_originalHeightInput->setEnabled (false); - originalLabel->setBuddy (m_originalWidthInput); - newLabel->setBuddy (m_newWidthInput); - m_percentWidthInput->setValue (100); - m_percentHeightInput->setValue (100); - percentLabel->setBuddy (m_percentWidthInput); - - - QGridLayout *dimensionsLayout = new QGridLayout (dimensionsGroupBox); - dimensionsLayout->setMargin (marginHint () * 2); - dimensionsLayout->setSpacing (spacingHint ()); - dimensionsLayout->setColumnStretch (1/*column*/, 1); - dimensionsLayout->setColumnStretch (3/*column*/, 1); - - - dimensionsLayout->addWidget (widthLabel, 0, 1); - dimensionsLayout->addWidget (heightLabel, 0, 3); - - dimensionsLayout->addWidget (originalLabel, 1, 0); - dimensionsLayout->addWidget (m_originalWidthInput, 1, 1); - dimensionsLayout->addWidget (xLabel0, 1, 2); - dimensionsLayout->addWidget (m_originalHeightInput, 1, 3); - - dimensionsLayout->addWidget (newLabel, 2, 0); - dimensionsLayout->addWidget (m_newWidthInput, 2, 1); - dimensionsLayout->addWidget (xLabel1, 2, 2); - dimensionsLayout->addWidget (m_newHeightInput, 2, 3); - - dimensionsLayout->addWidget (percentLabel, 3, 0); - dimensionsLayout->addWidget (m_percentWidthInput, 3, 1); - dimensionsLayout->addWidget (xLabel2, 3, 2); - dimensionsLayout->addWidget (m_percentHeightInput, 3, 3); - - dimensionsLayout->addWidget (m_keepAspectRatioCheckBox, 4, 0, 1, 4); - dimensionsLayout->setRowStretch (4/*row*/, 1); - dimensionsLayout->setRowMinimumHeight (4/*row*/, dimensionsLayout->rowMinimumHeight (4) * 2); - - - connect (m_newWidthInput, SIGNAL (valueChanged (int)), - this, SLOT (slotWidthChanged (int))); - connect (m_newHeightInput, SIGNAL (valueChanged (int)), - this, SLOT (slotHeightChanged (int))); - - // COMPAT: KDoubleNumInput only fires valueChanged(double) once per - // edit. It should either fire: - // - // 1. At the end of the edit (triggered by clicking or tabbing - // away), like with KDE 3. - // - // OR - // - // 2. Once per keystroke. - // - // Bug in KDoubleNumInput. - connect (m_percentWidthInput, SIGNAL (valueChanged (double)), - this, SLOT (slotPercentWidthChanged (double))); - connect (m_percentHeightInput, SIGNAL (valueChanged (double)), - this, SLOT (slotPercentHeightChanged (double))); - - connect (m_keepAspectRatioCheckBox, SIGNAL (toggled (bool)), - this, SLOT (setKeepAspectRatio (bool))); - - return dimensionsGroupBox; -} - -//--------------------------------------------------------------------- -// private - -void kpTransformResizeScaleDialog::widthFitHeightToAspectRatio () -{ - if (m_keepAspectRatioCheckBox->isChecked () && !m_ignoreKeepAspectRatio) - { - // width / height = oldWidth / oldHeight - // height = width * oldHeight / oldWidth - const int newHeight = qRound (double (imageWidth ()) * double (originalHeight ()) - / double (originalWidth ())); - IGNORE_KEEP_ASPECT_RATIO (m_newHeightInput->setValue (newHeight)); - } -} - -//--------------------------------------------------------------------- -// private - -void kpTransformResizeScaleDialog::heightFitWidthToAspectRatio () -{ - if (m_keepAspectRatioCheckBox->isChecked () && !m_ignoreKeepAspectRatio) - { - // width / height = oldWidth / oldHeight - // width = height * oldWidth / oldHeight - const int newWidth = qRound (double (imageHeight ()) * double (originalWidth ()) - / double (originalHeight ())); - IGNORE_KEEP_ASPECT_RATIO (m_newWidthInput->setValue (newWidth)); - } -} - -//--------------------------------------------------------------------- -// private - -bool kpTransformResizeScaleDialog::resizeEnabled () const -{ - return (!actOnSelection () || - (actOnSelection () && textSelection ())); -} - -//--------------------------------------------------------------------- -// private - -bool kpTransformResizeScaleDialog::scaleEnabled () const -{ - return (!(actOnSelection () && textSelection ())); -} - -//--------------------------------------------------------------------- -// private - -bool kpTransformResizeScaleDialog::smoothScaleEnabled () const -{ - return scaleEnabled (); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::slotActOnChanged () -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::slotActOnChanged()"; -#endif - - m_resizeButton->setEnabled (resizeEnabled ()); - m_scaleButton->setEnabled (scaleEnabled ()); - m_smoothScaleButton->setEnabled (smoothScaleEnabled ()); - - // TODO: somehow share logic with (resize|*scale)Enabled() - if (actOnSelection ()) - { - if (textSelection ()) - { - m_resizeButton->setChecked (true); - } - else - { - if (m_lastType == kpTransformResizeScaleCommand::Scale) - m_scaleButton->setChecked (true); - else - m_smoothScaleButton->setChecked (true); - } - } - else - { - if (m_lastType == kpTransformResizeScaleCommand::Resize) - m_resizeButton->setChecked (true); - else if (m_lastType == kpTransformResizeScaleCommand::Scale) - m_scaleButton->setChecked (true); - else - m_smoothScaleButton->setChecked (true); - } - - - m_originalWidthInput->setValue (originalWidth ()); - m_originalHeightInput->setValue (originalHeight ()); - - - m_newWidthInput->blockSignals (true); - m_newHeightInput->blockSignals (true); - - m_newWidthInput->setMinimum (actOnSelection () ? - selection ()->minimumWidth () : - 1); - m_newHeightInput->setMinimum (actOnSelection () ? - selection ()->minimumHeight () : - 1); - - m_newWidthInput->blockSignals (false); - m_newHeightInput->blockSignals (false); - - - IGNORE_KEEP_ASPECT_RATIO (slotPercentWidthChanged (m_percentWidthInput->value ())); - IGNORE_KEEP_ASPECT_RATIO (slotPercentHeightChanged (m_percentHeightInput->value ())); - - setKeepAspectRatio (m_keepAspectRatioCheckBox->isChecked ()); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::slotTypeChanged () -{ - m_lastType = type (); -} - -//--------------------------------------------------------------------- - -// public slot -void kpTransformResizeScaleDialog::slotWidthChanged (int width) -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::slotWidthChanged(" - << width << ")" << endl; -#endif - const double newPercentWidth = double (width) * 100 / double (originalWidth ()); - - SET_VALUE_WITHOUT_SIGNAL_EMISSION (m_percentWidthInput, newPercentWidth); - - widthFitHeightToAspectRatio (); - - //enableButtonOk (!isNoOp ()); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::slotHeightChanged (int height) -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::slotHeightChanged(" - << height << ")" << endl; -#endif - const double newPercentHeight = double (height) * 100 / double (originalHeight ()); - - SET_VALUE_WITHOUT_SIGNAL_EMISSION (m_percentHeightInput, newPercentHeight); - - heightFitWidthToAspectRatio (); - - //enableButtonOk (!isNoOp ()); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::slotPercentWidthChanged (double percentWidth) -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::slotPercentWidthChanged(" - << percentWidth << ")" << endl; -#endif - - SET_VALUE_WITHOUT_SIGNAL_EMISSION (m_newWidthInput, - qRound (percentWidth * originalWidth () / 100.0)); - - widthFitHeightToAspectRatio (); - - //enableButtonOk (!isNoOp ()); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::slotPercentHeightChanged (double percentHeight) -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::slotPercentHeightChanged(" - << percentHeight << ")" << endl; -#endif - - SET_VALUE_WITHOUT_SIGNAL_EMISSION (m_newHeightInput, - qRound (percentHeight * originalHeight () / 100.0)); - - heightFitWidthToAspectRatio (); - - //enableButtonOk (!isNoOp ()); -} - -//--------------------------------------------------------------------- -// public slot - -void kpTransformResizeScaleDialog::setKeepAspectRatio (bool on) -{ -#if DEBUG_KP_TOOL_RESIZE_SCALE_DIALOG && 1 - kDebug () << "kpTransformResizeScaleDialog::setKeepAspectRatio(" - << on << ")" << endl; -#endif - if (on != m_keepAspectRatioCheckBox->isChecked ()) - m_keepAspectRatioCheckBox->setChecked (on); - - if (on) - widthFitHeightToAspectRatio (); -} - -//--------------------------------------------------------------------- - -#undef IGNORE_KEEP_ASPECT_RATIO -#undef SET_VALUE_WITHOUT_SIGNAL_EMISSION - - -//--------------------------------------------------------------------- -// private - -int kpTransformResizeScaleDialog::originalWidth () const -{ - return document ()->width (actOnSelection ()); -} - -//--------------------------------------------------------------------- -// private - -int kpTransformResizeScaleDialog::originalHeight () const -{ - return document ()->height (actOnSelection ()); -} - -//--------------------------------------------------------------------- -// public - -int kpTransformResizeScaleDialog::imageWidth () const -{ - return m_newWidthInput->value (); -} - -//--------------------------------------------------------------------- -// public - -int kpTransformResizeScaleDialog::imageHeight () const -{ - return m_newHeightInput->value (); -} - -//--------------------------------------------------------------------- -// public - -bool kpTransformResizeScaleDialog::actOnSelection () const -{ - return (m_actOnCombo->currentIndex () == Selection); -} - -//--------------------------------------------------------------------- -// public - -kpTransformResizeScaleCommand::Type kpTransformResizeScaleDialog::type () const -{ - if (m_resizeButton->isChecked ()) - return kpTransformResizeScaleCommand::Resize; - else if (m_scaleButton->isChecked ()) - return kpTransformResizeScaleCommand::Scale; - else - return kpTransformResizeScaleCommand::SmoothScale; -} - -//--------------------------------------------------------------------- -// public - -bool kpTransformResizeScaleDialog::isNoOp () const -{ - return (imageWidth () == originalWidth () && - imageHeight () == originalHeight ()); -} - -//--------------------------------------------------------------------- -// private slot virtual [base QDialog] - -void kpTransformResizeScaleDialog::accept () -{ - enum { eText, eSelection, eImage } actionTarget = eText; - - if (actOnSelection ()) - { - if (textSelection ()) - { - actionTarget = eText; - } - else - { - actionTarget = eSelection; - } - } - else - { - actionTarget = eImage; - } - - - KLocalizedString message; - QString caption, continueButtonText; - - // Note: If eText, can't Scale nor SmoothScale. - // If eSelection, can't Resize. - - switch (type ()) - { - default: - case kpTransformResizeScaleCommand::Resize: - if (actionTarget == eText) - { - message = - ki18n ("

Resizing the text box to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to resize the text box?

"); - - caption = i18nc ("@title:window", "Resize Text Box?"); - continueButtonText = i18n ("R&esize Text Box"); - } - else if (actionTarget == eImage) - { - message = - ki18n ("

Resizing the image to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to resize the image?

"); - - caption = i18nc ("@title:window", "Resize Image?"); - continueButtonText = i18n ("R&esize Image"); - } - - break; - - case kpTransformResizeScaleCommand::Scale: - if (actionTarget == eImage) - { - message = - ki18n ("

Scaling the image to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to scale the image?

"); - - caption = i18nc ("@title:window", "Scale Image?"); - continueButtonText = i18n ("Scal&e Image"); - } - else if (actionTarget == eSelection) - { - message = - ki18n ("

Scaling the selection to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to scale the selection?

"); - - caption = i18nc ("@title:window", "Scale Selection?"); - continueButtonText = i18n ("Scal&e Selection"); - } - - break; - - case kpTransformResizeScaleCommand::SmoothScale: - if (actionTarget == eImage) - { - message = - ki18n ("

Smooth Scaling the image to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to smooth scale the image?

"); - - caption = i18nc ("@title:window", "Smooth Scale Image?"); - continueButtonText = i18n ("Smooth Scal&e Image"); - } - else if (actionTarget == eSelection) - { - message = - ki18n ("

Smooth Scaling the selection to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure you want to smooth scale the selection?

"); - - caption = i18nc ("@title:window", "Smooth Scale Selection?"); - continueButtonText = i18n ("Smooth Scal&e Selection"); - } - - break; - } - - - if (kpTool::warnIfBigImageSize (originalWidth (), - originalHeight (), - imageWidth (), imageHeight (), - message.subs (imageWidth ()).subs (imageHeight ()).toString (), - caption, - continueButtonText, - this)) - { - KDialog::accept (); - } - - // store settings - KConfigGroup cfg(KGlobal::config(), kpSettingsGroupGeneral); - - cfg.writeEntry(kpSettingResizeScaleLastKeepAspect, m_keepAspectRatioCheckBox->isChecked()); - cfg.writeEntry(kpSettingResizeScaleScaleType, static_cast(m_lastType)); - cfg.sync(); -} - -//--------------------------------------------------------------------- - -#include "moc_kpTransformResizeScaleDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.h b/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.h deleted file mode 100644 index 8b1ab32a..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformResizeScaleDialog_H -#define kpTransformResizeScaleDialog_H - -#include - -#include -#include - - -#include -#include -#include - -class KComboBox; -class KDoubleNumInput; -class KHBox; -class KIntNumInput; - -class kpAbstractSelection; -class kpDocument; -class kpTextSelection; -class kpTransformDialogEnvironment; - - -class kpTransformResizeScaleDialog : public KDialog -{ -Q_OBJECT - - public: - kpTransformResizeScaleDialog(kpTransformDialogEnvironment *_env, QWidget *parent); - - enum ActOn - { - Image, Selection - }; - - int imageWidth () const; - int imageHeight () const; - bool actOnSelection () const; - kpTransformResizeScaleCommand::Type type () const; - - bool isNoOp () const; - - public slots: - void slotActOnChanged (); - void slotTypeChanged (); - - void slotWidthChanged (int width); - void slotHeightChanged (int height); - - void slotPercentWidthChanged (double percentWidth); - void slotPercentHeightChanged (double percentHeight); - - private: - kpDocument *document () const; - kpAbstractSelection *selection () const; - kpTextSelection *textSelection () const; - - KHBox *createActOnBox(QWidget *baseWidget); - QGroupBox *createOperationGroupBox(QWidget *baseWidget); - QGroupBox *createDimensionsGroupBox(QWidget *baseWidget); - - void widthFitHeightToAspectRatio (); - void heightFitWidthToAspectRatio (); - - bool resizeEnabled () const; - bool scaleEnabled () const; - bool smoothScaleEnabled () const; - int originalWidth () const; - int originalHeight () const; - - private slots: - virtual void accept(); - void setKeepAspectRatio(bool on); - - private: - kpTransformDialogEnvironment *m_environ; - - KComboBox *m_actOnCombo; - - QToolButton *m_resizeButton, - *m_scaleButton, - *m_smoothScaleButton; - - KIntNumInput *m_originalWidthInput, *m_originalHeightInput, - *m_newWidthInput, *m_newHeightInput; - KDoubleNumInput *m_percentWidthInput, *m_percentHeightInput; - QCheckBox *m_keepAspectRatioCheckBox; - - int m_ignoreKeepAspectRatio; - - kpTransformResizeScaleCommand::Type m_lastType; -}; - - -#endif // kpTransformResizeScaleDialog_H diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp b/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp deleted file mode 100644 index a048478a..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp +++ /dev/null @@ -1,315 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_ROTATE 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -// private static -int kpTransformRotateDialog::s_lastWidth = -1, - kpTransformRotateDialog::s_lastHeight = -1; - -// private static -bool kpTransformRotateDialog::s_lastIsClockwise = true; -int kpTransformRotateDialog::s_lastAngleCustom = 0; - - -kpTransformRotateDialog::kpTransformRotateDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, QWidget *parent) - : kpTransformPreviewDialog (kpTransformPreviewDialog::AllFeatures, - false/*don't reserve top row*/, - actOnSelection ? i18nc ("@title:window", "Rotate Selection") : i18nc ("@title:window", "Rotate Image"), - i18n ("After rotate:"), - actOnSelection, - _env, parent) -{ - s_lastAngleCustom = 0; - - - createDirectionGroupBox (); - createAngleGroupBox (); - - - if (s_lastWidth > 0 && s_lastHeight > 0) - resize (s_lastWidth, s_lastHeight); - - - slotAngleCustomRadioButtonToggled (m_angleCustomRadioButton->isChecked ()); - slotUpdate (); -} - -kpTransformRotateDialog::~kpTransformRotateDialog () -{ - s_lastWidth = width (), s_lastHeight = height (); -} - - -// private -void kpTransformRotateDialog::createDirectionGroupBox () -{ - QGroupBox *directionGroupBox = new QGroupBox (i18n ("Direction"), mainWidget ()); - addCustomWidget (directionGroupBox); - - - QLabel *antiClockwisePixmapLabel = new QLabel (directionGroupBox); - antiClockwisePixmapLabel->setPixmap (UserIcon ("image_rotate_anticlockwise")); - - QLabel *clockwisePixmapLabel = new QLabel (directionGroupBox); - clockwisePixmapLabel->setPixmap (UserIcon ("image_rotate_clockwise")); - - - m_antiClockwiseRadioButton = new QRadioButton (i18n ("Cou&nterclockwise"), directionGroupBox); - m_clockwiseRadioButton = new QRadioButton (i18n ("C&lockwise"), directionGroupBox); - - - m_antiClockwiseRadioButton->setChecked (!s_lastIsClockwise); - m_clockwiseRadioButton->setChecked (s_lastIsClockwise); - - - QGridLayout *directionLayout = new QGridLayout (directionGroupBox ); - directionLayout->setSpacing( spacingHint() ); - directionLayout->setMargin( marginHint () * 2 ); - directionLayout->addWidget (antiClockwisePixmapLabel, 0, 0, Qt::AlignCenter); - directionLayout->addWidget (clockwisePixmapLabel, 0, 1, Qt::AlignCenter); - directionLayout->addWidget (m_antiClockwiseRadioButton, 1, 0, Qt::AlignCenter); - directionLayout->addWidget (m_clockwiseRadioButton, 1, 1, Qt::AlignCenter); - - - connect (m_antiClockwiseRadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); - connect (m_clockwiseRadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); -} - -// private -void kpTransformRotateDialog::createAngleGroupBox () -{ - QGroupBox *angleGroupBox = new QGroupBox (i18n ("Angle"), mainWidget ()); - addCustomWidget (angleGroupBox); - - - m_angle90RadioButton = new QRadioButton (i18n ("90 °rees"), angleGroupBox); - m_angle180RadioButton = new QRadioButton (i18n ("180 d&egrees"), angleGroupBox); - m_angle270RadioButton = new QRadioButton (i18n ("270 de&grees"), angleGroupBox); - - m_angleCustomRadioButton = new QRadioButton (i18n ("C&ustom:"), angleGroupBox); - m_angleCustomInput = new KIntNumInput (s_lastAngleCustom, angleGroupBox); - m_angleCustomInput->setMinimum (-359); - m_angleCustomInput->setMaximum (+359); - QLabel *degreesLabel = new QLabel (i18n ("degrees"), angleGroupBox); - - - m_angleCustomRadioButton->setChecked (true); - - - QGridLayout *angleLayout = new QGridLayout (angleGroupBox ); - angleLayout->setMargin( marginHint () * 2 ); - angleLayout->setSpacing( spacingHint ()); - - angleLayout->addWidget (m_angle90RadioButton, 0, 0, 1, 3); - angleLayout->addWidget (m_angle180RadioButton, 1, 0, 1, 3); - angleLayout->addWidget (m_angle270RadioButton, 2, 0, 1, 3); - - angleLayout->addWidget (m_angleCustomRadioButton, 3, 0); - angleLayout->addWidget (m_angleCustomInput, 3, 1); - angleLayout->addWidget (degreesLabel, 3, 2); - - angleLayout->setColumnStretch (1, 2); // Stretch Custom Angle Input - - - connect (m_angle90RadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); - connect (m_angle180RadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); - connect (m_angle270RadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); - - connect (m_angleCustomRadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotAngleCustomRadioButtonToggled (bool))); - connect (m_angleCustomRadioButton, SIGNAL (toggled (bool)), - this, SLOT (slotUpdate ())); - - connect (m_angleCustomInput, SIGNAL (valueChanged (int)), - this, SLOT (slotUpdate ())); -} - - -// public virtual [base kpTransformPreviewDialog] -bool kpTransformRotateDialog::isNoOp () const -{ - return (angle () == 0); -} - -// public -int kpTransformRotateDialog::angle () const -{ - int retAngle; - - - if (m_angle90RadioButton->isChecked ()) - retAngle = 90; - else if (m_angle180RadioButton->isChecked ()) - retAngle = 180; - else if (m_angle270RadioButton->isChecked ()) - retAngle = 270; - else // if (m_angleCustomRadioButton->isChecked ()) - retAngle = m_angleCustomInput->value (); - - - if (m_antiClockwiseRadioButton->isChecked ()) - retAngle *= -1; - - - if (retAngle < 0) - retAngle += ((0 - retAngle) / 360 + 1) * 360; - - if (retAngle >= 360) - retAngle -= ((retAngle - 360) / 360 + 1) * 360; - - - return retAngle; -} - - -// private virtual [base kpTransformPreviewDialog] -QSize kpTransformRotateDialog::newDimensions () const -{ - QMatrix matrix = kpPixmapFX::rotateMatrix (m_oldWidth, m_oldHeight, angle ()); - QRect rect = matrix.mapRect (QRect (0, 0, m_oldWidth, m_oldHeight)); - return rect.size (); -} - -// private virtual [base kpTransformPreviewDialog] -QImage kpTransformRotateDialog::transformPixmap (const QImage &image, - int targetWidth, int targetHeight) const -{ - return kpPixmapFX::rotate (image, angle (), - m_environ->backgroundColor (m_actOnSelection), - targetWidth, targetHeight); -} - - -// private slot -void kpTransformRotateDialog::slotAngleCustomRadioButtonToggled (bool isChecked) -{ - m_angleCustomInput->setEnabled (isChecked); - - if (isChecked) - m_angleCustomInput->setEditFocus (); -} - -// private slot virtual [base kpTransformPreviewDialog] -void kpTransformRotateDialog::slotUpdate () -{ - s_lastIsClockwise = m_clockwiseRadioButton->isChecked (); - s_lastAngleCustom = m_angleCustomInput->value (); - - kpTransformPreviewDialog::slotUpdate (); -} - - -// private slot virtual [base QDialog] -void kpTransformRotateDialog::accept () -{ - KLocalizedString message; - QString caption, continueButtonText; - - if (document ()->selection ()) - { - if (!document ()->textSelection ()) - { - message = - ki18n ("

Rotating the selection to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure want to rotate the selection?

"); - - caption = i18nc ("@title:window", "Rotate Selection?"); - continueButtonText = i18n ("Rotat&e Selection"); - } - } - else - { - message = - ki18n ("

Rotating the image to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure want to rotate the image?

"); - - caption = i18nc ("@title:window", "Rotate Image?"); - continueButtonText = i18n ("Rotat&e Image"); - } - - - const int newWidth = newDimensions ().width (); - const int newHeight = newDimensions ().height (); - - if (kpTool::warnIfBigImageSize (m_oldWidth, - m_oldHeight, - newWidth, newHeight, - message.subs (newWidth).subs (newHeight).toString (), - caption, - continueButtonText, - this)) - { - KDialog::accept (); - } -} - - -#include "moc_kpTransformRotateDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.h b/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.h deleted file mode 100644 index ea1bd0f4..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformRotateDialog.h +++ /dev/null @@ -1,93 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformRotateDialog_H -#define kpTransformRotateDialog_H - - -#include -#include - -#include -#include - - -#include -#include - -class KIntNumInput; - - -class kpTransformRotateDialog : public kpTransformPreviewDialog -{ -Q_OBJECT - -public: - kpTransformRotateDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, - QWidget *parent); - virtual ~kpTransformRotateDialog (); - -private: - static int s_lastWidth, s_lastHeight; - static bool s_lastIsClockwise; - static int s_lastAngleCustom; - - void createDirectionGroupBox (); - void createAngleGroupBox (); - -public: - virtual bool isNoOp () const; - int angle () const; // 0 <= angle < 360 (clockwise); - -private: - virtual QSize newDimensions () const; - virtual QImage transformPixmap (const QImage &pixmap, - int targetWidth, int targetHeight) const; - -private slots: - void slotAngleCustomRadioButtonToggled (bool isChecked); - virtual void slotUpdate (); - -private slots: - virtual void accept (); - -private: - QRadioButton *m_antiClockwiseRadioButton, - *m_clockwiseRadioButton; - - QButtonGroup *m_angleButtonGroup; - QRadioButton *m_angle90RadioButton, - *m_angle180RadioButton, - *m_angle270RadioButton, - *m_angleCustomRadioButton; - KIntNumInput *m_angleCustomInput; -}; - - -#endif // kpTransformRotateDialog_H diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp b/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp deleted file mode 100644 index 602005c9..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp +++ /dev/null @@ -1,296 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SKEW 0 -#define DEBUG_KP_TOOL_SKEW_DIALOG 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -// private static -int kpTransformSkewDialog::s_lastWidth = -1, - kpTransformSkewDialog::s_lastHeight = -1; - -// private static -int kpTransformSkewDialog::s_lastHorizontalAngle = 0, - kpTransformSkewDialog::s_lastVerticalAngle = 0; - - -kpTransformSkewDialog::kpTransformSkewDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, QWidget *parent) - : kpTransformPreviewDialog (kpTransformPreviewDialog::AllFeatures, - false/*don't reserve top row*/, - actOnSelection ? i18nc ("@title:window", "Skew Selection") : i18nc ("@title:window", "Skew Image"), - i18n ("After skew:"), - actOnSelection, - _env, parent) -{ - // Too confusing - disable for now - s_lastHorizontalAngle = s_lastVerticalAngle = 0; - - - createAngleGroupBox (); - - - if (s_lastWidth > 0 && s_lastHeight > 0) - resize (s_lastWidth, s_lastHeight); - - - slotUpdate (); - - - m_horizontalSkewInput->setEditFocus (); -} - -kpTransformSkewDialog::~kpTransformSkewDialog () -{ - s_lastWidth = width (), s_lastHeight = height (); -} - - -// private -void kpTransformSkewDialog::createAngleGroupBox () -{ - QGroupBox *angleGroupBox = new QGroupBox (i18n ("Angle"), mainWidget ()); - addCustomWidget (angleGroupBox); - - - QLabel *horizontalSkewPixmapLabel = new QLabel (angleGroupBox); - horizontalSkewPixmapLabel->setPixmap (UserIcon ("image_skew_horizontal")); - - QLabel *horizontalSkewLabel = new QLabel (i18n ("&Horizontal:"), angleGroupBox); - m_horizontalSkewInput = new KIntNumInput (s_lastHorizontalAngle, angleGroupBox); - m_horizontalSkewInput->setMinimum (-89); - m_horizontalSkewInput->setMaximum (+89); - - QLabel *horizontalSkewDegreesLabel = new QLabel (i18n ("degrees"), angleGroupBox); - - - QLabel *verticalSkewPixmapLabel = new QLabel (angleGroupBox); - verticalSkewPixmapLabel->setPixmap (UserIcon ("image_skew_vertical")); - - QLabel *verticalSkewLabel = new QLabel (i18n ("&Vertical:"), angleGroupBox); - m_verticalSkewInput = new KIntNumInput (s_lastVerticalAngle, angleGroupBox); - m_verticalSkewInput->setMinimum (-89); - m_verticalSkewInput->setMaximum (+89); - - QLabel *verticalSkewDegreesLabel = new QLabel (i18n ("degrees"), angleGroupBox); - - - horizontalSkewLabel->setBuddy (m_horizontalSkewInput); - verticalSkewLabel->setBuddy (m_verticalSkewInput); - - - QGridLayout *angleLayout = new QGridLayout (angleGroupBox); - angleLayout->setMargin (marginHint () * 2); - angleLayout->setSpacing (spacingHint ()); - - angleLayout->addWidget (horizontalSkewPixmapLabel, 0, 0); - angleLayout->addWidget (horizontalSkewLabel, 0, 1); - angleLayout->addWidget (m_horizontalSkewInput, 0, 2, Qt::AlignVCenter); - angleLayout->addWidget (horizontalSkewDegreesLabel, 0, 3); - - angleLayout->addWidget (verticalSkewPixmapLabel, 1, 0); - angleLayout->addWidget (verticalSkewLabel, 1, 1); - angleLayout->addWidget (m_verticalSkewInput, 1, 2, Qt::AlignVCenter); - angleLayout->addWidget (verticalSkewDegreesLabel, 1, 3); - - - connect (m_horizontalSkewInput, SIGNAL (valueChanged (int)), - this, SLOT (slotUpdate ())); - connect (m_verticalSkewInput, SIGNAL (valueChanged (int)), - this, SLOT (slotUpdate ())); -} - - -// private virtual [base kpTransformPreviewDialog] -QSize kpTransformSkewDialog::newDimensions () const -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - QMatrix skewMatrix = kpPixmapFX::skewMatrix (doc->image (), - horizontalAngleForPixmapFX (), - verticalAngleForPixmapFX ()); - QRect skewRect = skewMatrix.mapRect (doc->rect (m_actOnSelection)); - - return QSize (skewRect.width (), skewRect.height ()); -} - -// private virtual [base kpTransformPreviewDialog] -QImage kpTransformSkewDialog::transformPixmap (const QImage &image, - int targetWidth, int targetHeight) const -{ - return kpPixmapFX::skew (image, - horizontalAngleForPixmapFX (), - verticalAngleForPixmapFX (), - m_environ->backgroundColor (m_actOnSelection), - targetWidth, - targetHeight); -} - - -// private -void kpTransformSkewDialog::updateLastAngles () -{ - s_lastHorizontalAngle = horizontalAngle (); - s_lastVerticalAngle = verticalAngle (); -} - -// private slot virtual [base kpTransformPreviewDialog] -void kpTransformSkewDialog::slotUpdate () -{ - updateLastAngles (); - kpTransformPreviewDialog::slotUpdate (); -} - - -// public -int kpTransformSkewDialog::horizontalAngle () const -{ - return m_horizontalSkewInput->value (); -} - -// public -int kpTransformSkewDialog::verticalAngle () const -{ - return m_verticalSkewInput->value (); -} - - -// public static -int kpTransformSkewDialog::horizontalAngleForPixmapFX (int hangle) -{ - return -hangle; -} - -// public static -int kpTransformSkewDialog::verticalAngleForPixmapFX (int vangle) -{ - return -vangle; -} - - -// public -int kpTransformSkewDialog::horizontalAngleForPixmapFX () const -{ - return kpTransformSkewDialog::horizontalAngleForPixmapFX (horizontalAngle ()); -} - -// public -int kpTransformSkewDialog::verticalAngleForPixmapFX () const -{ - return kpTransformSkewDialog::verticalAngleForPixmapFX (verticalAngle ()); -} - - -// public virtual [base kpTransformPreviewDialog] -bool kpTransformSkewDialog::isNoOp () const -{ - return (horizontalAngle () == 0) && (verticalAngle () == 0); -} - - -// private slot virtual [base QDialog] -void kpTransformSkewDialog::accept () -{ - KLocalizedString message; - QString caption, continueButtonText; - - if (document ()->selection ()) - { - if (!document ()->textSelection ()) - { - message = - ki18n ("

Skewing the selection to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure want to skew the selection?

"); - - caption = i18nc ("@title:window", "Skew Selection?"); - continueButtonText = i18n ("Sk&ew Selection"); - } - } - else - { - message = - ki18n ("

Skewing the image to %1x%2" - " may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure want to skew the image?

"); - - caption = i18nc ("@title:window", "Skew Image?"); - continueButtonText = i18n ("Sk&ew Image"); - } - - - const int newWidth = newDimensions ().width (); - const int newHeight = newDimensions ().height (); - - if (kpTool::warnIfBigImageSize (m_oldWidth, - m_oldHeight, - newWidth, newHeight, - message.subs (newWidth).subs (newHeight).toString (), - caption, - continueButtonText, - this)) - { - KDialog::accept (); - } -} - - -#include "moc_kpTransformSkewDialog.cpp" diff --git a/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.h b/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.h deleted file mode 100644 index 2b3bea50..00000000 --- a/kolourpaint/dialogs/imagelib/transforms/kpTransformSkewDialog.h +++ /dev/null @@ -1,90 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformSkewDialog_H -#define kpTransformSkewDialog_H - - -#include - -#include -#include - - -#include - -class KIntNumInput; - - -class kpTransformSkewDialog : public kpTransformPreviewDialog -{ -Q_OBJECT - -public: - kpTransformSkewDialog (bool actOnSelection, - kpTransformDialogEnvironment *_env, QWidget *parent); - virtual ~kpTransformSkewDialog (); - -private: - static int s_lastWidth, s_lastHeight; - static int s_lastHorizontalAngle, s_lastVerticalAngle; - - void createAngleGroupBox (); - - virtual QSize newDimensions () const; - virtual QImage transformPixmap (const QImage &image, - int targetWidth, int targetHeight) const; - - void updateLastAngles (); - -private slots: - virtual void slotUpdate (); - -public: - // These are the angles the users sees in the dialog and... - int horizontalAngle () const; - int verticalAngle () const; - - // ...these functions translate them for use in kpPixmapFX::skew(). - static int horizontalAngleForPixmapFX (int hangle); - static int verticalAngleForPixmapFX (int vangle); - - int horizontalAngleForPixmapFX () const; - int verticalAngleForPixmapFX () const; - - virtual bool isNoOp () const; - -private slots: - virtual void accept (); - -private: - KIntNumInput *m_horizontalSkewInput, *m_verticalSkewInput; -}; - - -#endif // kpTransformSkewDialog_H diff --git a/kolourpaint/dialogs/kpColorSimilarityDialog.cpp b/kolourpaint/dialogs/kpColorSimilarityDialog.cpp deleted file mode 100644 index 7220b633..00000000 --- a/kolourpaint/dialogs/kpColorSimilarityDialog.cpp +++ /dev/null @@ -1,156 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - - -kpColorSimilarityDialog::kpColorSimilarityDialog (QWidget *parent) - : KDialog (parent) -{ - setCaption (i18nc ("@title:window", "Color Similarity")); - setButtons (KDialog::Ok | KDialog::Cancel); - QWidget *baseWidget = new QWidget (this); - setMainWidget (baseWidget); - - - QGroupBox *cubeGroupBox = new QGroupBox (i18n ("Preview"), baseWidget); - - m_colorSimilarityFrame = new kpColorSimilarityFrame(cubeGroupBox); - m_colorSimilarityFrame->setMinimumSize (240, 180); - - QPushButton *updatePushButton = new QPushButton (i18n ("&Update"), cubeGroupBox); - - - QVBoxLayout *cubeLayout = new QVBoxLayout (cubeGroupBox); - cubeLayout->setSpacing(spacingHint ()); - cubeLayout->setMargin (marginHint () * 2); - cubeLayout->addWidget (m_colorSimilarityFrame, 1/*stretch*/); - cubeLayout->addWidget (updatePushButton, 0/*stretch*/, Qt::AlignHCenter); - - - connect (updatePushButton, SIGNAL (clicked ()), - this, SLOT (slotColorSimilarityValueChanged ())); - - - QGroupBox *inputGroupBox = new QGroupBox (i18n ("&RGB Color Cube Distance"), - baseWidget); - - m_colorSimilarityInput = new KIntNumInput (inputGroupBox); - m_colorSimilarityInput->setRange (0, int (kpColorSimilarityHolder::MaxColorSimilarity * 100 + .1/*don't floor below target int*/), - 5/*step*/); - m_colorSimilarityInput->setSliderEnabled (true); - m_colorSimilarityInput->setSuffix (i18n ("%")); - m_colorSimilarityInput->setSpecialValueText (i18n ("Exact Match")); - - // TODO: We have a good handbook section on this, which we should - // somehow link to. - m_whatIsLabel = new QLabel ( - i18n ("" - "What is Color Similarity?"), - inputGroupBox); - m_whatIsLabel->setAlignment (Qt::AlignHCenter); - connect (m_whatIsLabel, SIGNAL (linkActivated (const QString &)), - SLOT (slotWhatIsLabelClicked ())); - - - QVBoxLayout *inputLayout = new QVBoxLayout (inputGroupBox); - inputLayout->setSpacing (spacingHint () * 4); - inputLayout->setMargin (marginHint () * 2); - - inputLayout->addWidget (m_colorSimilarityInput); - inputLayout->addWidget (m_whatIsLabel); - - - // COMPAT: This is not firing properly when the user is typing in a - // new value. - connect (m_colorSimilarityInput, SIGNAL (valueChanged (int)), - this, SLOT (slotColorSimilarityValueChanged ())); - - - QVBoxLayout *baseLayout = new QVBoxLayout (baseWidget); - baseLayout->setSpacing (spacingHint () * 2); - baseLayout->setMargin (0/*margin*/); - baseLayout->addWidget (cubeGroupBox, 1/*stretch*/); - baseLayout->addWidget (inputGroupBox); -} - -kpColorSimilarityDialog::~kpColorSimilarityDialog () -{ -} - - -// public -double kpColorSimilarityDialog::colorSimilarity () const -{ - return m_colorSimilarityFrame->colorSimilarity (); -} - -// public -void kpColorSimilarityDialog::setColorSimilarity (double similarity) -{ - m_colorSimilarityInput->setValue (qRound (similarity * 100)); -} - - -// private slot -void kpColorSimilarityDialog::slotColorSimilarityValueChanged () -{ - m_colorSimilarityFrame->setColorSimilarity (double (m_colorSimilarityInput->value ()) / 100); -} - - -// private slot -void kpColorSimilarityDialog::slotWhatIsLabelClicked () -{ - QWhatsThis::showText (QCursor::pos (), m_colorSimilarityFrame->whatsThis (), - this); - - // LOTODO: It looks weird with the focus rectangle. - // It's also very hard for the user to make it lose focus for some reason - // (you must click on the label - nowhere else will work). - // - // This doesn't work - I don't know why: - // m_whatIsLabel->clearFocus (); - // - // Maybe it's a weird kind of focus? -} - - -#include "moc_kpColorSimilarityDialog.cpp" diff --git a/kolourpaint/dialogs/kpColorSimilarityDialog.h b/kolourpaint/dialogs/kpColorSimilarityDialog.h deleted file mode 100644 index c2bc6fe9..00000000 --- a/kolourpaint/dialogs/kpColorSimilarityDialog.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_COLOR_SIMILARITY_DIALOG_H -#define KP_COLOR_SIMILARITY_DIALOG_H - - -#include - - -#include - -class KIntNumInput; - -class kpColorSimilarityFrame; - - -// LOTODO: Why doesn't this dialog automatically enforce a minimum size -// based on layout magic, like Image -> Resize / Scale? -class kpColorSimilarityDialog : public KDialog -{ -Q_OBJECT - -public: - kpColorSimilarityDialog (QWidget *parent); - virtual ~kpColorSimilarityDialog (); - - double colorSimilarity () const; - void setColorSimilarity (double similarity); - -private slots: - void slotColorSimilarityValueChanged (); - - void slotWhatIsLabelClicked (); - -private: - kpColorSimilarityFrame *m_colorSimilarityFrame; - KIntNumInput *m_colorSimilarityInput; - QLabel *m_whatIsLabel; -}; - - -#endif // KP_COLOR_SIMILARITY_DIALOG_H diff --git a/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp b/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp deleted file mode 100644 index 3a97fcac..00000000 --- a/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp +++ /dev/null @@ -1,249 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET 0 - - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -// protected static -const QSize kpDocumentSaveOptionsPreviewDialog::s_pixmapLabelMinimumSize (25, 25); - - -kpDocumentSaveOptionsPreviewDialog::kpDocumentSaveOptionsPreviewDialog ( - QWidget *parent ) - : kpSubWindow (parent), -#if 0 -KDialogBase (parent, name, false/*non-modal*/, - i18n ("Save Preview"), - 0/*no buttons*/), -#endif - m_filePixmap (0), - m_fileSize (0) -{ - setWindowTitle (i18nc ("@title:window", "Save Preview")); - - QWidget *baseWidget = this;//new QWidget (this); - //setMainWidget (baseWidget); - - - QGridLayout *lay = new QGridLayout ( baseWidget ); - lay->setMargin( KDialog::marginHint () ); - lay->setSpacing( KDialog::spacingHint ()); - - m_filePixmapLabel = new kpResizeSignallingLabel (baseWidget); - m_fileSizeLabel = new QLabel (baseWidget); - - - m_filePixmapLabel->setMinimumSize (s_pixmapLabelMinimumSize); - - - lay->addWidget (m_filePixmapLabel, 0, 0); - lay->addWidget (m_fileSizeLabel, 1, 0, Qt::AlignHCenter); - - - lay->setRowStretch (0, 1); - - - connect (m_filePixmapLabel, SIGNAL (resized ()), - this, SLOT (updatePixmapPreview ())); -} - -kpDocumentSaveOptionsPreviewDialog::~kpDocumentSaveOptionsPreviewDialog () -{ - delete m_filePixmap; -} - - -// public -QSize kpDocumentSaveOptionsPreviewDialog::preferredMinimumSize () const -{ - const int contentsWidth = 180; - const int totalMarginsWidth = 2 * KDialog::marginHint (); - - return QSize (contentsWidth + totalMarginsWidth, - contentsWidth * 3 / 4 + totalMarginsWidth); -} - - -// public slot -void kpDocumentSaveOptionsPreviewDialog::setFilePixmapAndSize (const QImage &pixmap, - qint64 fileSize) -{ - delete m_filePixmap; - m_filePixmap = new QImage (pixmap); - - updatePixmapPreview (); - - m_fileSize = fileSize; - - const kpCommandSize::SizeType pixmapSize = kpCommandSize::PixmapSize (pixmap); - // (int cast is safe as long as the file size is not more than 20 million - // -- i.e. INT_MAX / 100 -- times the pixmap size) - const int percent = pixmapSize ? - qMax (1, - (int) ((kpCommandSize::SizeType) fileSize * 100 / pixmapSize)) : - 0; -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsPreviewDialog::setFilePixmapAndSize()" - << " pixmapSize=" << pixmapSize - << " fileSize=" << fileSize - << " raw fileSize/pixmapSize%=" - << (pixmapSize ? (kpCommandSize::SizeType) fileSize * 100 / pixmapSize : 0) - << endl; -#endif - - m_fileSizeLabel->setText (i18np ("1 byte (approx. %2%)", "%1 bytes (approx. %2%)", - m_fileSize, percent)); -} - -// public slot -void kpDocumentSaveOptionsPreviewDialog::updatePixmapPreview () -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsPreviewDialog::updatePreviewPixmap()" - << " filePixmapLabel.size=" << m_filePixmapLabel->size () - << " filePixmap.size=" << m_filePixmap->size () - << endl; -#endif - - if (m_filePixmap) - { - int maxNewWidth = qMin (m_filePixmap->width (), - m_filePixmapLabel->width ()), - maxNewHeight = qMin (m_filePixmap->height (), - m_filePixmapLabel->height ()); - - double keepsAspect = kpTransformPreviewDialog::aspectScale ( - maxNewWidth, maxNewHeight, - m_filePixmap->width (), m_filePixmap->height ()); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tmaxNewWidth=" << maxNewWidth - << " maxNewHeight=" << maxNewHeight - << " keepsAspect=" << keepsAspect - << endl; - #endif - - - const int newWidth = kpTransformPreviewDialog::scaleDimension ( - m_filePixmap->width (), - keepsAspect, - 1, - maxNewWidth); - const int newHeight = kpTransformPreviewDialog::scaleDimension ( - m_filePixmap->height (), - keepsAspect, - 1, - maxNewHeight); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tnewWidth=" << newWidth - << " newHeight=" << newHeight - << endl; - #endif - - - QImage transformedPixmap = - kpPixmapFX::scale (*m_filePixmap, - newWidth, newHeight); - - - QImage labelPixmap (m_filePixmapLabel->width (), - m_filePixmapLabel->height (), QImage::Format_ARGB32_Premultiplied); - labelPixmap.fill(QColor(Qt::transparent).rgba()); - kpPixmapFX::setPixmapAt (&labelPixmap, - (labelPixmap.width () - transformedPixmap.width ()) / 2, - (labelPixmap.height () - transformedPixmap.height ()) / 2, - transformedPixmap); - - - m_filePixmapLabel->setPixmap (QPixmap::fromImage(labelPixmap)); - } - else - { - m_filePixmapLabel->setPixmap (QPixmap ()); - } -} - - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::closeEvent (QCloseEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsPreviewDialog::closeEvent()"; -#endif - - QWidget::closeEvent (e); - - emit finished (); -} - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::moveEvent (QMoveEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsPreviewDialog::moveEvent()"; -#endif - - QWidget::moveEvent (e); - - emit moved (); -} - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsPreviewDialog::resizeEvent()"; -#endif - - QWidget::resizeEvent (e); - - emit resized (); -} - - -#include "moc_kpDocumentSaveOptionsPreviewDialog.cpp" diff --git a/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.h b/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.h deleted file mode 100644 index 47dfbbd5..00000000 --- a/kolourpaint/dialogs/kpDocumentSaveOptionsPreviewDialog.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentSaveOptionsPreviewDialog_H -#define kpDocumentSaveOptionsPreviewDialog_H - - -#include - -#include - - -#include -#include -#include -#include -#include - -class kpResizeSignallingLabel; - - -class kpDocumentSaveOptionsPreviewDialog : public kpSubWindow -{ -Q_OBJECT - -public: - kpDocumentSaveOptionsPreviewDialog (QWidget *parent); - virtual ~kpDocumentSaveOptionsPreviewDialog (); - - QSize preferredMinimumSize () const; - -protected: - static const QSize s_pixmapLabelMinimumSize; - -signals: - void moved (); - void resized (); - void finished (); - -public slots: - void setFilePixmapAndSize (const QImage &filePixmap, qint64 fileSize); - void updatePixmapPreview (); - -protected: - virtual void closeEvent (QCloseEvent *e); - virtual void moveEvent (QMoveEvent *e); - virtual void resizeEvent (QResizeEvent *e); - -protected: - QImage *m_filePixmap; - qint64 m_fileSize; - - kpResizeSignallingLabel *m_filePixmapLabel; - QLabel *m_fileSizeLabel; -}; - - -#endif // kpDocumentSaveOptionsPreviewDialog_H diff --git a/kolourpaint/document/kpDocument.cpp b/kolourpaint/document/kpDocument.cpp deleted file mode 100644 index 18607aca..00000000 --- a/kolourpaint/document/kpDocument.cpp +++ /dev/null @@ -1,467 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT 0 - - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpDocument::kpDocument (int w, int h, - kpDocumentEnvironment *environ) - : QObject (), - m_constructorWidth (w), m_constructorHeight (h), - m_isFromURL (false), - m_savedAtLeastOnceBefore (false), - m_saveOptions (new kpDocumentSaveOptions ()), - m_metaInfo (new kpDocumentMetaInfo ()), - m_modified (false), - m_selection (0), - m_oldWidth (-1), m_oldHeight (-1), - d (new kpDocumentPrivate ()) -{ -#if DEBUG_KP_DOCUMENT && 0 - kDebug () << "kpDocument::kpDocument (" << w << "," << h << ")"; -#endif - - m_image = new kpImage(w, h, QImage::Format_ARGB32_Premultiplied); - m_image->fill(QColor(Qt::white).rgb()); - - d->environ = environ; -} - -//--------------------------------------------------------------------- - -kpDocument::~kpDocument () -{ - delete d; - - delete m_image; - - delete m_saveOptions; - delete m_metaInfo; - - delete m_selection; -} - -//--------------------------------------------------------------------- - -// public -kpDocumentEnvironment *kpDocument::environ () const -{ - return d->environ; -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setEnviron (kpDocumentEnvironment *environ) -{ - d->environ = environ; -} - -//--------------------------------------------------------------------- - -// public -bool kpDocument::savedAtLeastOnceBefore () const -{ - return m_savedAtLeastOnceBefore; -} - -//--------------------------------------------------------------------- - -// public -KUrl kpDocument::url () const -{ - return m_url; -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setURL (const KUrl &url, bool isFromURL) -{ - m_url = url; - m_isFromURL = isFromURL; -} - -//--------------------------------------------------------------------- - -// public -bool kpDocument::isFromURL (bool checkURLStillExists) const -{ - if (!m_isFromURL) - return false; - - if (!checkURLStillExists) - return true; - - return (!m_url.isEmpty () && - KIO::NetAccess::exists (m_url, KIO::NetAccess::SourceSide/*open*/, - d->environ->dialogParent ())); -} - -//--------------------------------------------------------------------- - -// public -QString kpDocument::prettyUrl () const -{ - return kpUrlFormatter::PrettyUrl (m_url); -} - -//--------------------------------------------------------------------- - -// public -QString kpDocument::prettyFilename () const -{ - return kpUrlFormatter::PrettyFilename (m_url); -} - -//--------------------------------------------------------------------- - -// public -const kpDocumentSaveOptions *kpDocument::saveOptions () const -{ - return m_saveOptions; -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setSaveOptions (const kpDocumentSaveOptions &saveOptions) -{ - *m_saveOptions = saveOptions; -} - -//--------------------------------------------------------------------- - -// public -const kpDocumentMetaInfo *kpDocument::metaInfo () const -{ - return m_metaInfo; -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setMetaInfo (const kpDocumentMetaInfo &metaInfo) -{ - *m_metaInfo = metaInfo; -} - -//--------------------------------------------------------------------- - -/* - * Properties - */ - -void kpDocument::setModified (bool yes) -{ - if (yes == m_modified) - return; - - m_modified = yes; - - if (yes) - emit documentModified (); -} - -//--------------------------------------------------------------------- - -bool kpDocument::isModified () const -{ - return m_modified; -} - -//--------------------------------------------------------------------- - -bool kpDocument::isEmpty () const -{ - return url ().isEmpty () && !isModified (); -} - -//--------------------------------------------------------------------- - -int kpDocument::constructorWidth () const -{ - return m_constructorWidth; -} - -//--------------------------------------------------------------------- - -int kpDocument::width (bool ofSelection) const -{ - if (ofSelection && m_selection) - return m_selection->width (); - else - return m_image->width (); -} - -//--------------------------------------------------------------------- - -int kpDocument::oldWidth () const -{ - return m_oldWidth; -} - -//--------------------------------------------------------------------- - -void kpDocument::setWidth (int w, const kpColor &backgroundColor) -{ - resize (w, height (), backgroundColor); -} - -//--------------------------------------------------------------------- - -int kpDocument::constructorHeight () const -{ - return m_constructorHeight; -} - -//--------------------------------------------------------------------- - -int kpDocument::height (bool ofSelection) const -{ - if (ofSelection && m_selection) - return m_selection->height (); - else - return m_image->height (); -} - -//--------------------------------------------------------------------- - -int kpDocument::oldHeight () const -{ - return m_oldHeight; -} - -//--------------------------------------------------------------------- - -void kpDocument::setHeight (int h, const kpColor &backgroundColor) -{ - resize (width (), h, backgroundColor); -} - -//--------------------------------------------------------------------- - -QRect kpDocument::rect (bool ofSelection) const -{ - if (ofSelection && m_selection) - return m_selection->boundingRect (); - else - return m_image->rect (); -} - -//--------------------------------------------------------------------- - -// public -kpImage kpDocument::getImageAt (const QRect &rect) const -{ - return kpPixmapFX::getPixmapAt (*m_image, rect); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setImageAt (const kpImage &image, const QPoint &at) -{ -#if DEBUG_KP_DOCUMENT && 0 - kDebug () << "kpDocument::setImageAt (image (w=" - << image.width () - << ",h=" << image.height () - << "), x=" << at.x () - << ",y=" << at.y () - << endl; -#endif - - kpPixmapFX::setPixmapAt (m_image, at, image); - slotContentsChanged (QRect (at.x (), at.y (), image.width (), image.height ())); -} - -//--------------------------------------------------------------------- - -// public -kpImage kpDocument::image (bool ofSelection) const -{ - kpImage ret; - - if (ofSelection) - { - kpAbstractImageSelection *imageSel = imageSelection (); - Q_ASSERT (imageSel); - - ret = imageSel->baseImage (); - } - else - ret = *m_image; - - return ret; -} - -//--------------------------------------------------------------------- - -// public -kpImage *kpDocument::imagePointer () const -{ - return m_image; -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setImage (const kpImage &image) -{ - m_oldWidth = width (), m_oldHeight = height (); - - *m_image = image; - - if (m_oldWidth == width () && m_oldHeight == height ()) - slotContentsChanged (image.rect ()); - else - slotSizeChanged (width (), height ()); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setImage (bool ofSelection, const kpImage &image) -{ - if (ofSelection) - { - kpAbstractImageSelection *imageSel = imageSelection (); - - // Have to have an image selection in order to set its pixmap. - Q_ASSERT (imageSel); - - imageSel->setBaseImage (image); - } - else - setImage (image); -} - -//--------------------------------------------------------------------- - -void kpDocument::fill (const kpColor &color) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::fill ()"; -#endif - - m_image->fill(color.toQRgb()); - slotContentsChanged (m_image->rect ()); -} - -//--------------------------------------------------------------------- - -void kpDocument::resize (int w, int h, const kpColor &backgroundColor) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::resize (" << w << "," << h << ")"; -#endif - - m_oldWidth = width (), m_oldHeight = height (); - -#if DEBUG_KP_DOCUMENT && 1 - kDebug () << "\toldWidth=" << m_oldWidth - << " oldHeight=" << m_oldHeight - << endl; -#endif - - if (w == m_oldWidth && h == m_oldHeight) - return; - - kpPixmapFX::resize (m_image, w, h, backgroundColor); - - slotSizeChanged (width (), height ()); -} - -//--------------------------------------------------------------------- - -void kpDocument::slotContentsChanged (const QRect &rect) -{ - setModified (); - emit contentsChanged (rect); -} - -//--------------------------------------------------------------------- - -void kpDocument::slotSizeChanged (int newWidth, int newHeight) -{ - setModified (); - emit sizeChanged (newWidth, newHeight); - emit sizeChanged (QSize (newWidth, newHeight)); -} - -//--------------------------------------------------------------------- - -void kpDocument::slotSizeChanged (const QSize &newSize) -{ - slotSizeChanged (newSize.width (), newSize.height ()); -} - -//--------------------------------------------------------------------- - - -#include "moc_kpDocument.cpp" - diff --git a/kolourpaint/document/kpDocument.h b/kolourpaint/document/kpDocument.h deleted file mode 100644 index e3c0f5db..00000000 --- a/kolourpaint/document/kpDocument.h +++ /dev/null @@ -1,362 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_DOCUMENT_H -#define KP_DOCUMENT_H - - -#include -#include -#include - -#include - -#include -#include -#undef environ - -#include -#include -#include -#include -#include -#include - -class kpColor; -class kpDocumentEnvironment; -class kpDocumentSaveOptions; -class kpDocumentMetaInfo; -class kpAbstractImageSelection; -class kpAbstractSelection; -class kpTextSelection; - - -// REFACTOR: rearrange method order to make sense and reflect kpDocument_*.cpp split. -class kpDocument : public QObject -{ -Q_OBJECT - -public: - // REFACTOR: Hide constructor and have 2 factory methods: - // - // Method 1. Creates a blank document with dimensions x. - // - // Method 2. Calls open(). and (aka constructorWidth() - // and constructorHeight()) need not be specified. - // - // ? - kpDocument (int w, int h, kpDocumentEnvironment *environ); - ~kpDocument (); - - kpDocumentEnvironment *environ () const; - void setEnviron (kpDocumentEnvironment *environ); - - - // - // File I/O - Open - // - - - static QImage getPixmapFromFile (const KUrl &url, bool suppressDoesntExistDialog, - QWidget *parent, - kpDocumentSaveOptions *saveOptions = 0, - kpDocumentMetaInfo *metaInfo = 0); - // REFACTOR: fix: open*() should only be called once. - // Create a new kpDocument() if you want to open again. - void openNew (const KUrl &url); - bool open (const KUrl &url, bool newDocSameNameIfNotExist = false); - - static void getDataFromImage(const QImage &image, - kpDocumentSaveOptions &saveOptions, - kpDocumentMetaInfo &metaInfo); - - // - // File I/O - Save - // - - static bool lossyPromptContinue (const QImage &pixmap, - const kpDocumentSaveOptions &saveOptions, - QWidget *parent); - static bool savePixmapToDevice (const QImage &pixmap, - QIODevice *device, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - bool lossyPrompt, - QWidget *parent, - bool *userCancelled = 0); - static bool savePixmapToFile (const QImage &pixmap, - const KUrl &url, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - bool overwritePrompt, - bool lossyPrompt, - QWidget *parent); - bool save (bool overwritePrompt = false, bool lossyPrompt = false); - bool saveAs (const KUrl &url, - const kpDocumentSaveOptions &saveOptions, - bool overwritePrompt = true, - bool lossyPrompt = true); - - - // Returns whether save() or saveAs() have ever been called and returned true - bool savedAtLeastOnceBefore () const; - - KUrl url () const; - void setURL (const KUrl &url, bool isFromURL); - - // Returns whether the document's image was successfully opened from - // or saved to the URL returned by url(). This is not true for a - // new kpDocument and in the case of open() being passed - // "newDocSameNameIfNotExist = true" when the URL doesn't exist. - // - // If this returns true and the kpDocument hasn't been modified, - // this gives a pretty good indication that the image stored at url() - // is equal to image() (unless the something has happened to that url - // outside of KolourPaint). - // - // e.g. If the user types "kolourpaint doesnotexist.png" to start - // KolourPaint, this method will return false. - bool isFromURL (bool checkURLStillExists = true) const; - - // (will convert: empty Url --> "Untitled") - QString prettyUrl () const; - - // (will convert: empty Url --> "Untitled") - QString prettyFilename () const; - - // (guaranteed to return valid pointer) - - const kpDocumentSaveOptions *saveOptions () const; - void setSaveOptions (const kpDocumentSaveOptions &saveOptions); - - const kpDocumentMetaInfo *metaInfo () const; - void setMetaInfo (const kpDocumentMetaInfo &metaInfo); - - - /* - * Properties (modified, width, height, color depth...) - */ - - void setModified (bool yes = true); - bool isModified () const; - bool isEmpty () const; - - // REFACTOR: Rename to originalWidth()? - int constructorWidth () const; // as passed to the constructor - int width (bool ofSelection = false) const; - int oldWidth () const; // only valid in a slot connected to sizeChanged() - void setWidth (int w, const kpColor &backgroundColor); - - // REFACTOR: Rename to originalHeight()? - int constructorHeight () const; // as passed to the constructor - int height (bool ofSelection = false) const; - int oldHeight () const; // only valid in a slot connected to sizeChanged() - void setHeight (int h, const kpColor &backgroundColor); - - QRect rect (bool ofSelection = false) const; - - - // - // Image access - // - - // Returns a copy of part of the document's image (not including the - // selection). - kpImage getImageAt (const QRect &rect) const; - - void setImageAt (const kpImage &image, const QPoint &at); - - // "image(false)" returns a copy of the document's image, ignoring any - // floating selection. - // - // "image(true)" returns a copy of a floating image selection's base - // image (i.e. before selection transparency is applied), which may be - // null if the image selection is a just a border. - // - // ASSUMPTION: For == true only, an image selection exists. - kpImage image (bool ofSelection = false) const; - kpImage *imagePointer () const; - - void setImage (const kpImage &image); - // ASSUMPTION: If setting the selection's image, the selection must be - // an image selection. - void setImage (bool ofSelection, const kpImage &image); - - - // - // Selections - // - -public: - kpAbstractSelection *selection () const; - kpAbstractImageSelection *imageSelection () const; - kpTextSelection *textSelection () const; - - // Sets the document's selection to the given one and changes to the - // matching selection tool. Tool changes occur in the following situations: - // - // 1. Setting a when a selection tool is not active. - // - // 2. Setting an image when the text tool is active. - // ASSUMPTION: There is no text selection active when calling this - // method (push it onto the document before calling this, - // to avoid this problem). - // - // 3. Setting a text when an image selection tool is active. - // ASSUMPTION: There is no image selection active when calling this - // method (push it onto the document before calling this, - // to avoid this problem). - // - // The justification for the above assumptions are to reduce the complexity - // of this method's implementation -- changing from an image selection tool - // to a text selection tool, or vice-versa, calls the end() method of the - // current tool, which pushes any active selection onto the document. Since - // this method sets the selection, losing the old selection in the middle of - // the method would be tricky to work around. - // - // WARNING: Before calling this, you must ensure that the UI (kpMainWindow) - // has the 's selection transparency or - // for a text selection, its text style, selected. - // TODO: Why can't we change it for them, if we change tool automatically for them already? - void setSelection (const kpAbstractSelection &selection); - - // Returns the base image of the current image selection. If this is - // null (because the selection is still a border), it extracts the - // pixels of the document marked out by the border of the selection. - // - // ASSUMPTION: There is an imageSelection(). - // - // TODO: this always returns base image - need ver that applies selection - // transparency. - kpImage getSelectedBaseImage () const; - - // Sets the base image of the current image selection to the pixels - // of the document marked out by the border of the selection. - // - // ASSUMPTION: There is an imageSelection() that is just a border - // (no base image). - void imageSelectionPullFromDocument (const kpColor &backgroundColor); - - // Deletes the current selection, if there is a selection(), else NOP - void selectionDelete (); - - // Stamps a copy of the selection onto the document. - // - // For image selections, set to true, means that - // the transparent image of the selection is used. If set to false, - // the base image of the selection is used. This argument is ignored - // for non-image selections. - // - // ASSUMPTION: There is a selection() with content, else NOP - void selectionCopyOntoDocument (bool applySelTransparency = true); - - // Same as selectionCopyOntoDocument() but deletes the selection - // afterwards. - void selectionPushOntoDocument (bool applySelTransparency = true); - - // - // Same as image() but returns a _copy_ of the document image - // + any (even non-image) selection pasted on top. - // - // Even if the selection has no content, it is still pasted: - // - // 1. For an image selection, this makes no difference. - // - // 2. For a text selection: - // - // a) with an opaque background: the background rectangle is - // included -- this is necessary since the rectangle is visually - // there after all, and the intention of this method is to report - // everything. - // - // b) with a transparent background: this makes no difference. - // - kpImage imageWithSelection () const; - - - /* - * Transformations - * (convenience only - you could achieve the same effect (and more) with - * kpPixmapFX: these functions do not affect the selection) - */ - - void fill (const kpColor &color); - void resize (int w, int h, const kpColor &backgroundColor); - - -public slots: - // these will emit signals! - void slotContentsChanged (const QRect &rect); - void slotSizeChanged (int newWidth, int newHeight); - void slotSizeChanged (const QSize &newSize); - -signals: - void documentOpened (); - void documentSaved (); - - // Emitted whenever the isModified() flag changes from false to true. - // This is the _only_ signal that may be emitted in addition to the others. - void documentModified (); - - void contentsChanged (const QRect &rect); - void sizeChanged (int newWidth, int newHeight); // see oldWidth(), oldHeight() - void sizeChanged (const QSize &newSize); - - void selectionEnabled (bool on); - - // Emitted when setSelection() is given a selection such that we change - // from a non-text-selection tool to the text selection tool or vice-versa. - // reports whether the new selection is text (and therefore, - // whether we've switched to the text tool). - void selectionIsTextChanged (bool isText); - -private: - int m_constructorWidth, m_constructorHeight; - kpImage *m_image; - - KUrl m_url; - bool m_isFromURL; - bool m_savedAtLeastOnceBefore; - - kpDocumentSaveOptions *m_saveOptions; - kpDocumentMetaInfo *m_metaInfo; - - bool m_modified; - - kpAbstractSelection *m_selection; - - int m_oldWidth, m_oldHeight; - - // There is no need to maintain binary compatibility at this stage. - // The d-pointer is just so that you can experiment without recompiling - // the kitchen sink. - struct kpDocumentPrivate *d; -}; - - -#endif // KP_DOCUMENT_H diff --git a/kolourpaint/document/kpDocumentPrivate.h b/kolourpaint/document/kpDocumentPrivate.h deleted file mode 100644 index 0fb564b3..00000000 --- a/kolourpaint/document/kpDocumentPrivate.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentPrivate_H -#define kpDocumentPrivate_H - - -class kpDocumentEnvironment; - - -struct kpDocumentPrivate -{ - kpDocumentPrivate () - : environ(0) - { - } - - kpDocumentEnvironment *environ; -}; - - -#endif // kpDocumentPrivate_H diff --git a/kolourpaint/document/kpDocumentSaveOptions.cpp b/kolourpaint/document/kpDocumentSaveOptions.cpp deleted file mode 100644 index ac589554..00000000 --- a/kolourpaint/document/kpDocumentSaveOptions.cpp +++ /dev/null @@ -1,628 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_DOCUMENT_SAVE_OPTIONS 0 - - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -//--------------------------------------------------------------------- - -class kpDocumentSaveOptionsPrivate -{ -public: - QString m_mimeType; - int m_colorDepth; - bool m_dither; - int m_quality; -}; - -//--------------------------------------------------------------------- - -kpDocumentSaveOptions::kpDocumentSaveOptions () - : d (new kpDocumentSaveOptionsPrivate ()) -{ - d->m_mimeType = invalidMimeType (); - d->m_colorDepth = invalidColorDepth (); - d->m_dither = initialDither (); - d->m_quality = invalidQuality (); -} - -//--------------------------------------------------------------------- - -kpDocumentSaveOptions::kpDocumentSaveOptions (const kpDocumentSaveOptions &rhs) - : d (new kpDocumentSaveOptionsPrivate ()) -{ - d->m_mimeType = rhs.mimeType (); - d->m_colorDepth = rhs.colorDepth (); - d->m_dither = rhs.dither (); - d->m_quality = rhs.quality (); -} - -//--------------------------------------------------------------------- - -kpDocumentSaveOptions::kpDocumentSaveOptions (QString mimeType, int colorDepth, bool dither, int quality) - : d (new kpDocumentSaveOptionsPrivate ()) -{ - d->m_mimeType = mimeType; - d->m_colorDepth = colorDepth; - d->m_dither = dither; - d->m_quality = quality; -} - -//--------------------------------------------------------------------- - -kpDocumentSaveOptions::~kpDocumentSaveOptions () -{ - delete d; -} - -//--------------------------------------------------------------------- - - -// public -bool kpDocumentSaveOptions::operator== (const kpDocumentSaveOptions &rhs) const -{ - return (mimeType () == rhs.mimeType () && - colorDepth () == rhs.colorDepth () && - dither () == rhs.dither () && - quality () == rhs.quality ()); -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentSaveOptions::operator!= (const kpDocumentSaveOptions &rhs) const -{ - return !(*this == rhs); -} - -//--------------------------------------------------------------------- - - -// public -kpDocumentSaveOptions &kpDocumentSaveOptions::operator= (const kpDocumentSaveOptions &rhs) -{ - setMimeType (rhs.mimeType ()); - setColorDepth (rhs.colorDepth ()); - setDither (rhs.dither ()); - setQuality (rhs.quality ()); - - return *this; -} - -//--------------------------------------------------------------------- - - -// public -void kpDocumentSaveOptions::printDebug (const QString &prefix) const -{ - const QString usedPrefix = !prefix.isEmpty () ? - prefix + QLatin1String (": ") : - QString(); - - kDebug () << usedPrefix - << "mimeType=" << mimeType () - << " colorDepth=" << colorDepth () - << " dither=" << dither () - << " quality=" << quality () - << endl; -} - -//--------------------------------------------------------------------- - - -// public -QString kpDocumentSaveOptions::mimeType () const -{ - return d->m_mimeType; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentSaveOptions::setMimeType (const QString &mimeType) -{ - d->m_mimeType = mimeType; -} - -//--------------------------------------------------------------------- - - -// public static -QString kpDocumentSaveOptions::invalidMimeType () -{ - return QString(); -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocumentSaveOptions::mimeTypeIsInvalid (const QString &mimeType) -{ - return (mimeType == invalidMimeType ()); -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentSaveOptions::mimeTypeIsInvalid () const -{ - return mimeTypeIsInvalid (mimeType ()); -} - -//--------------------------------------------------------------------- - - -// public -int kpDocumentSaveOptions::colorDepth () const -{ - return d->m_colorDepth; -} - -// public -void kpDocumentSaveOptions::setColorDepth (int depth) -{ - d->m_colorDepth = depth; -} - - -// public static -int kpDocumentSaveOptions::invalidColorDepth () -{ - return -1; -} - -// public static -bool kpDocumentSaveOptions::colorDepthIsInvalid (int colorDepth) -{ - return (colorDepth != 1 && colorDepth != 8 && colorDepth != 32); -} - -// public -bool kpDocumentSaveOptions::colorDepthIsInvalid () const -{ - return colorDepthIsInvalid (colorDepth ()); -} - - -// public -bool kpDocumentSaveOptions::dither () const -{ - return d->m_dither; -} - -// public -void kpDocumentSaveOptions::setDither (bool dither) -{ - d->m_dither = dither; -} - - -// public static -int kpDocumentSaveOptions::initialDither () -{ - return false; // to avoid accidental double dithering -} - - -// public -int kpDocumentSaveOptions::quality () const -{ - return d->m_quality; -} - -// public -void kpDocumentSaveOptions::setQuality (int quality) -{ - d->m_quality = quality; -} - - -// public static -int kpDocumentSaveOptions::invalidQuality () -{ - return -2; -} - -// public static -bool kpDocumentSaveOptions::qualityIsInvalid (int quality) -{ - return (quality < -1 || quality > 100); -} - -// public -bool kpDocumentSaveOptions::qualityIsInvalid () const -{ - return qualityIsInvalid (quality ()); -} - - -// public static -QString kpDocumentSaveOptions::defaultMimeType (const KConfigGroup &config) -{ - return config.readEntry (kpSettingForcedMimeType, - QString::fromLatin1 ("image/png")); -} - -// public static -void kpDocumentSaveOptions::saveDefaultMimeType (KConfigGroup &config, - const QString &mimeType) -{ - config.writeEntry (kpSettingForcedMimeType, mimeType); -} - - -// public static -int kpDocumentSaveOptions::defaultColorDepth (const KConfigGroup &config) -{ - int colorDepth = - config.readEntry (kpSettingForcedColorDepth, -1); - - if (colorDepthIsInvalid (colorDepth)) - { - // (not screen depth, in case of transparency) - colorDepth = 32; - } - - return colorDepth; -} - -//--------------------------------------------------------------------- - -// public static -void kpDocumentSaveOptions::saveDefaultColorDepth (KConfigGroup &config, int colorDepth) -{ - config.writeEntry (kpSettingForcedColorDepth, colorDepth); -} - -//--------------------------------------------------------------------- - - -// public static -int kpDocumentSaveOptions::defaultDither (const KConfigGroup &config) -{ - return config.readEntry (kpSettingForcedDither, initialDither ()); -} - -//--------------------------------------------------------------------- - -// public static -void kpDocumentSaveOptions::saveDefaultDither (KConfigGroup &config, bool dither) -{ - config.writeEntry (kpSettingForcedDither, dither); -} - -//--------------------------------------------------------------------- - - -// public static -int kpDocumentSaveOptions::defaultQuality (const KConfigGroup &config) -{ - int val = config.readEntry (kpSettingForcedQuality, -1); - if (qualityIsInvalid (val)) - val = -1; - - return val; -} - -//--------------------------------------------------------------------- - -// public static -void kpDocumentSaveOptions::saveDefaultQuality (KConfigGroup &config, int quality) -{ - config.writeEntry (kpSettingForcedQuality, quality); -} - -//--------------------------------------------------------------------- - - -// public static -kpDocumentSaveOptions kpDocumentSaveOptions::defaultDocumentSaveOptions (const KConfigGroup &config) -{ - kpDocumentSaveOptions saveOptions; - saveOptions.setMimeType (defaultMimeType (config)); - saveOptions.setColorDepth (defaultColorDepth (config)); - saveOptions.setDither (defaultDither (config)); - saveOptions.setQuality (defaultQuality (config)); - -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS - saveOptions.printDebug ("kpDocumentSaveOptions::defaultDocumentSaveOptions()"); -#endif - - return saveOptions; -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocumentSaveOptions::saveDefaultDifferences (KConfigGroup &config, - const kpDocumentSaveOptions &oldDocInfo, - const kpDocumentSaveOptions &newDocInfo) -{ - bool savedSomething = false; - -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS - kDebug () << "kpDocumentSaveOptions::saveDefaultDifferences()"; - oldDocInfo.printDebug ("\told"); - newDocInfo.printDebug ("\tnew"); -#endif - - if (newDocInfo.mimeType () != oldDocInfo.mimeType ()) - { - saveDefaultMimeType (config, newDocInfo.mimeType ()); - savedSomething = true; - } - - if (newDocInfo.colorDepth () != oldDocInfo.colorDepth ()) - { - saveDefaultColorDepth (config, newDocInfo.colorDepth ()); - savedSomething = true; - } - - if (newDocInfo.dither () != oldDocInfo.dither ()) - { - saveDefaultDither (config, newDocInfo.dither ()); - savedSomething = true; - } - - if (newDocInfo.quality () != oldDocInfo.quality ()) - { - saveDefaultQuality (config, newDocInfo.quality ()); - savedSomething = true; - } - - return savedSomething; -} - -//--------------------------------------------------------------------- - - -static QStringList mimeTypesSupportingProperty (const QString &property, - const QStringList &defaultMimeTypesWithPropertyList) -{ - QStringList mimeTypeList; - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupMimeTypeProperties); - - if (cfg.hasKey (property)) - { - mimeTypeList = cfg.readEntry (property, QStringList ()); - } - else - { - mimeTypeList = defaultMimeTypesWithPropertyList; - - cfg.writeEntry (property, mimeTypeList); - cfg.sync (); - } - - return mimeTypeList; -} - -//--------------------------------------------------------------------- - -static bool mimeTypeSupportsProperty (const QString &mimeType, - const QString &property, const QStringList &defaultMimeTypesWithPropertyList) -{ - const QStringList mimeTypeList = mimeTypesSupportingProperty ( - property, defaultMimeTypesWithPropertyList); - - return mimeTypeList.contains (mimeType); -} - -//--------------------------------------------------------------------- - - -// SYNC: update mime info -// -// Only care about writable mimetypes. -// -// Run: -// -// branches/kolourpaint/control/scripts/gen_mimetype_line.sh Write | -// branches/kolourpaint/control/scripts/split_mimetype_line.pl -// -// in the version of kdelibs/kimgio/ (e.g. KDE 4.0) KolourPaint is shipped with, -// to check for any new mimetypes to add info for. In the methods below, -// you can specify this info (maximum color depth, whether it's lossy etc.). -// -// Update the below list and if you do change any of that info, bump up -// "kpSettingsGroupMimeTypeProperties" in kpDefs.h. -// -// Currently, Depth and Quality settings are mutually exclusive with -// Depth overriding Quality. I've currently favoured Quality with the -// below mimetypes (i.e. all lossy mimetypes are only given Quality settings, -// no Depth settings). -// -// Mimetypes done: -// image/bmp -// image/jpeg -// image/jp2 -// image/png -// image/tiff -// image/x-eps -// image/x-pcx -// image/x-portable-bitmap -// image/x-portable-graymap -// image/x-portable-pixmap -// image/x-rgb -// image/x-tga -// image/x-xbitmap -// image/x-xpixmap -// video/x-mng [COULD NOT TEST] -// -// To test whether depth is configurable, write an image in the new -// mimetype with all depths and read each one back. See what -// kpDocument thinks the depth is when it gets QImage to read it. - - -// public static -int kpDocumentSaveOptions::mimeTypeMaximumColorDepth (const QString &mimeType) -{ - QStringList defaultList; - - // SYNC: update mime info here - - // Grayscale actually (unenforced since depth not set to configurable) - defaultList << QLatin1String ("image/x-eps:32"); - - defaultList << QLatin1String ("image/x-portable-bitmap:1"); - - // Grayscale actually (unenforced since depth not set to configurable) - defaultList << QLatin1String ("image/x-portable-graymap:8"); - - defaultList << QLatin1String ("image/x-xbitmap:1"); - - const QStringList mimeTypeList = mimeTypesSupportingProperty ( - kpSettingMimeTypeMaximumColorDepth, defaultList); - - const QString mimeTypeColon = mimeType + QLatin1String (":"); - for (QStringList::const_iterator it = mimeTypeList.begin (); - it != mimeTypeList.end (); - ++it) - { - if ((*it).startsWith (mimeTypeColon)) - { - int number = (*it).mid (mimeTypeColon.length ()).toInt (); - if (!colorDepthIsInvalid (number)) - { - return number; - } - } - } - - return 32; -} - -//--------------------------------------------------------------------- - -// public -int kpDocumentSaveOptions::mimeTypeMaximumColorDepth () const -{ - return mimeTypeMaximumColorDepth (mimeType ()); -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocumentSaveOptions::mimeTypeHasConfigurableColorDepth (const QString &mimeType) -{ - QStringList defaultMimeTypes; - - // SYNC: update mime info here - defaultMimeTypes << QLatin1String ("image/png"); - defaultMimeTypes << QLatin1String ("image/bmp"); - defaultMimeTypes << QLatin1String ("image/x-pcx"); - - // TODO: Only 1, 24 not 8; Qt only sees 32 but "file" cmd realises - // it's either 1 or 24. - defaultMimeTypes << QLatin1String ("image/x-rgb"); - - // TODO: Only 8 and 24 - no 1. - defaultMimeTypes << QLatin1String ("image/x-xpixmap"); - - return mimeTypeSupportsProperty (mimeType, - kpSettingMimeTypeHasConfigurableColorDepth, - defaultMimeTypes); -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentSaveOptions::mimeTypeHasConfigurableColorDepth () const -{ - return mimeTypeHasConfigurableColorDepth (mimeType ()); -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocumentSaveOptions::mimeTypeHasConfigurableQuality (const QString &mimeType) -{ - QStringList defaultMimeTypes; - - // SYNC: update mime info here - defaultMimeTypes << QLatin1String ("image/jp2"); - defaultMimeTypes << QLatin1String ("image/jpeg"); - defaultMimeTypes << QLatin1String ("image/x-webp"); - - return mimeTypeSupportsProperty (mimeType, - kpSettingMimeTypeHasConfigurableQuality, - defaultMimeTypes); -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentSaveOptions::mimeTypeHasConfigurableQuality () const -{ - return mimeTypeHasConfigurableQuality (mimeType ()); -} - -//--------------------------------------------------------------------- - -// public -int kpDocumentSaveOptions::isLossyForSaving (const QImage &image) const -{ - int ret = 0; - - if (mimeTypeMaximumColorDepth () < image.depth ()) - { - ret |= MimeTypeMaximumColorDepthLow; - } - - if (mimeTypeHasConfigurableColorDepth () && - !colorDepthIsInvalid () /*REFACTOR: guarantee it is valid*/ && - ((colorDepth () < image.depth ()) || - (colorDepth () < 32 && image.hasAlphaChannel()))) - { - ret |= ColorDepthLow; - } - - if (mimeTypeHasConfigurableQuality () && - !qualityIsInvalid ()) - { - ret |= Quality; - } - - return ret; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/document/kpDocumentSaveOptions.h b/kolourpaint/document/kpDocumentSaveOptions.h deleted file mode 100644 index d4d026bd..00000000 --- a/kolourpaint/document/kpDocumentSaveOptions.h +++ /dev/null @@ -1,150 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_DOCUMENT_SAVE_OPTIONS_H -#define KP_DOCUMENT_SAVE_OPTIONS_H - - -#include -#include - -class KConfigGroup; - - -class kpDocumentSaveOptions -{ -public: - kpDocumentSaveOptions (); - kpDocumentSaveOptions (const kpDocumentSaveOptions &rhs); - kpDocumentSaveOptions (QString mimeType, int colorDepth, bool dither, int quality); - virtual ~kpDocumentSaveOptions (); - - bool operator== (const kpDocumentSaveOptions &rhs) const; - bool operator!= (const kpDocumentSaveOptions &rhs) const; - - kpDocumentSaveOptions &operator= (const kpDocumentSaveOptions &rhs); - - - void printDebug (const QString &prefix) const; - - - QString mimeType () const; - void setMimeType (const QString &mimeType); - - static QString invalidMimeType (); - static bool mimeTypeIsInvalid (const QString &mimeType); - bool mimeTypeIsInvalid () const; - - - int colorDepth () const; - void setColorDepth (int depth); - - static int invalidColorDepth (); - static bool colorDepthIsInvalid (int colorDepth); - bool colorDepthIsInvalid () const; - - - bool dither () const; - void setDither (bool dither); - - static int initialDither (); - - - int quality () const; - void setQuality (int quality); - - static int invalidQuality (); - static bool qualityIsInvalid (int quality); - bool qualityIsInvalid () const; - - - // (All assume that 's group has been set) - // (None of them call KConfigBase::reparseConfig() nor KConfigBase::sync()) - - static QString defaultMimeType (const KConfigGroup &config); - static void saveDefaultMimeType (KConfigGroup &config, const QString &mimeType); - - static int defaultColorDepth (const KConfigGroup &config); - static void saveDefaultColorDepth (KConfigGroup &config, int colorDepth); - - static int defaultDither (const KConfigGroup &config); - static void saveDefaultDither (KConfigGroup &config, bool dither); - - static int defaultQuality (const KConfigGroup &config); - static void saveDefaultQuality (KConfigGroup &config, int quality); - - - static kpDocumentSaveOptions defaultDocumentSaveOptions (const KConfigGroup &config); - // (returns true if it encountered a difference (and saved it to )) - static bool saveDefaultDifferences (KConfigGroup &config, - const kpDocumentSaveOptions &oldDocInfo, - const kpDocumentSaveOptions &newDocInfo); - - -public: - // (purely for informational purposes - not enforced by this class) - static int mimeTypeMaximumColorDepth (const QString &mimeType); - int mimeTypeMaximumColorDepth () const; - - - static bool mimeTypeHasConfigurableColorDepth (const QString &mimeType); - bool mimeTypeHasConfigurableColorDepth () const; - - static bool mimeTypeHasConfigurableQuality (const QString &mimeType); - bool mimeTypeHasConfigurableQuality () const; - - - // TODO: checking for mask loss due to format e.g. BMP - enum LossyType - { - LossLess = 0, - - // mimeTypeMaximumColorDepth() < .depth() - MimeTypeMaximumColorDepthLow = 1, - // i.e. colorDepth() < .depth() || - // colorDepth() < 32 && .mask() - ColorDepthLow = 2, - // i.e. mimeTypeHasConfigurableQuality() - Quality = 4 - }; - - // Returns whether saving with these options will result in - // loss of information. Returned value is the bitwise OR of - // LossType enum possiblities. - int isLossyForSaving (const QImage &image) const; - - -private: - // There is no need to maintain binary compatibility at this stage. - // The d-pointer is just so that you can experiment without recompiling - // the kitchen sink. - class kpDocumentSaveOptionsPrivate *d; -}; - - -#endif // KP_DOCUMENT_SAVE_OPTIONS_H diff --git a/kolourpaint/document/kpDocument_Open.cpp b/kolourpaint/document/kpDocument_Open.cpp deleted file mode 100644 index a56a92ab..00000000 --- a/kolourpaint/document/kpDocument_Open.cpp +++ /dev/null @@ -1,268 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT 0 - - -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include // TODO: isn't this in KIO? -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -void kpDocument::getDataFromImage(const QImage &image, - kpDocumentSaveOptions &saveOptions, - kpDocumentMetaInfo &metaInfo) -{ - saveOptions.setColorDepth(image.depth()); - saveOptions.setDither(false); // avoid double dithering when saving - - metaInfo.setDotsPerMeterX(image.dotsPerMeterX()); - metaInfo.setDotsPerMeterY(image.dotsPerMeterY()); - metaInfo.setOffset(image.offset()); - - QStringList keys = image.textKeys(); - for (int i = 0; i < keys.count(); i++) - metaInfo.setText(keys[i], image.text(keys[i])); -} - -//--------------------------------------------------------------------- - -// public static -QImage kpDocument::getPixmapFromFile(const KUrl &url, bool suppressDoesntExistDialog, - QWidget *parent, - kpDocumentSaveOptions *saveOptions, - kpDocumentMetaInfo *metaInfo) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::getPixmapFromFile(" << url << "," << parent << ")"; -#endif - - if (saveOptions) - *saveOptions = kpDocumentSaveOptions (); - - if (metaInfo) - *metaInfo = kpDocumentMetaInfo (); - - QString tempFile; - if (url.isEmpty () || !KIO::NetAccess::download (url, tempFile, parent)) - { - if (!suppressDoesntExistDialog) - { - // TODO: Use "Cannot" instead of "Could not" in all dialogs in KolourPaint. - // Or at least choose one consistently. - // - // TODO: Have captions for all dialogs in KolourPaint. - KMessageBox::sorry (parent, - i18n ("Could not open \"%1\".", - kpUrlFormatter::PrettyFilename (url))); - } - - return QImage (); - } - - QImage image; - - // sync: remember to "KIO::NetAccess::removeTempFile (tempFile)" in all exit paths - { - QString detectedMimeType; - - KMimeType::Ptr detectedMimeTypePtr = KMimeType::findByUrl (url); - if(detectedMimeTypePtr && - detectedMimeTypePtr != KMimeType::defaultMimeTypePtr ()) - { - detectedMimeType = detectedMimeTypePtr->name (); - } else { - detectedMimeTypePtr = KMimeType::findByPath (tempFile); - if(detectedMimeTypePtr && - detectedMimeTypePtr != KMimeType::defaultMimeTypePtr ()) - { - detectedMimeType = detectedMimeTypePtr->name (); - } - } - - if (saveOptions) - saveOptions->setMimeType (detectedMimeType); - - #if DEBUG_KP_DOCUMENT - kDebug () << "\ttempFile=" << tempFile; - kDebug () << "\tmimetype=" << detectedMimeType; - kDebug () << "\tsrc=" << url.path (); - #endif - - if (detectedMimeType.isEmpty ()) - { - KMessageBox::sorry (parent, - i18n ("Could not open \"%1\" - unknown mimetype.", - kpUrlFormatter::PrettyFilename (url))); - KIO::NetAccess::removeTempFile (tempFile); - return QImage (); - } - - - // TODO: might be different. - // Should we feed it into QImage to solve this problem? - // - // If so, should we have used KMimeType::findByContent() - // instead? Are some image types not detectable by findByContent() - // (e.g. image types that are only detected by extension)? - // - // Currently, opening a PNG with a ".jpg" extension does not - // work -- QImage and findByUrl() both think it's a JPG based - // on the extension, but findByContent() correctly detects - // it as a PNG. - image = QImage (tempFile); - KIO::NetAccess::removeTempFile (tempFile); - } - - if (image.isNull ()) - { - KMessageBox::sorry (parent, - i18n ("Could not open \"%1\" - unsupported image format.\n" - "The file may be corrupt.", - kpUrlFormatter::PrettyFilename (url))); - return QImage (); - } - -#if DEBUG_KP_DOCUMENT - kDebug () << "\tpixmap: depth=" << image.depth () - << " hasAlphaChannel=" << image.hasAlphaChannel () - << endl; -#endif - - if ( saveOptions && metaInfo ) - getDataFromImage(image, *saveOptions, *metaInfo); - - // make sure we always have Format_ARGB32_Premultiplied as this is the fastest to draw on - // and Qt can not draw onto Format_Indexed8 (Qt-4.7) - if ( image.format() != QImage::Format_ARGB32_Premultiplied ) - image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - return image; -} - -//--------------------------------------------------------------------- - -void kpDocument::openNew (const KUrl &url) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::openNew (" << url << ")"; -#endif - - m_image->fill(QColor(Qt::white).rgb()); - - setURL (url, false/*not from url*/); - // TODO: Maybe we should guess the mimetype from "url"'s filename - // extension. - // - // That way "kolourpaint doesnotexist.bmp" would automatically - // select the BMP file format when the save dialog comes up for - // the first time. - *m_saveOptions = kpDocumentSaveOptions (); - *m_metaInfo = kpDocumentMetaInfo (); - m_modified = false; - - emit documentOpened (); -} - -//--------------------------------------------------------------------- - -bool kpDocument::open (const KUrl &url, bool newDocSameNameIfNotExist) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::open (" << url << ")"; -#endif - - kpDocumentSaveOptions newSaveOptions; - kpDocumentMetaInfo newMetaInfo; - QImage newPixmap = kpDocument::getPixmapFromFile (url, - newDocSameNameIfNotExist/*suppress "doesn't exist" dialog*/, - d->environ->dialogParent (), - &newSaveOptions, - &newMetaInfo); - - if (!newPixmap.isNull ()) - { - delete m_image; - m_image = new kpImage (newPixmap); - - setURL (url, true/*is from url*/); - *m_saveOptions = newSaveOptions; - *m_metaInfo = newMetaInfo; - m_modified = false; - - emit documentOpened (); - return true; - } - - if (newDocSameNameIfNotExist) - { - if (!url.isEmpty () && - // not just a permission error? - !KIO::NetAccess::exists (url, KIO::NetAccess::SourceSide/*open*/, d->environ->dialogParent ())) - { - openNew (url); - } - else - { - openNew (KUrl ()); - } - - return true; - } - else - { - return false; - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/document/kpDocument_Save.cpp b/kolourpaint/document/kpDocument_Save.cpp deleted file mode 100644 index 5f441660..00000000 --- a/kolourpaint/document/kpDocument_Save.cpp +++ /dev/null @@ -1,514 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT 0 - - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include // TODO: isn't this in KIO? -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -bool kpDocument::save (bool overwritePrompt, bool lossyPrompt) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::save(" - << "overwritePrompt=" << overwritePrompt - << ",lossyPrompt=" << lossyPrompt - << ") url=" << m_url - << " savedAtLeastOnceBefore=" << savedAtLeastOnceBefore () - << endl; -#endif - - // TODO: check feels weak - if (m_url.isEmpty () || m_saveOptions->mimeType ().isEmpty ()) - { - KMessageBox::detailedError (d->environ->dialogParent (), - i18n ("Could not save image - insufficient information."), - i18n ("URL: %1\n" - "Mimetype: %2", - prettyUrl (), - m_saveOptions->mimeType ().isEmpty () ? - i18n ("") : - m_saveOptions->mimeType ()), - i18nc ("@title:window", "Internal Error")); - return false; - } - - return saveAs (m_url, *m_saveOptions, - overwritePrompt, - lossyPrompt); -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocument::lossyPromptContinue (const QImage &pixmap, - const kpDocumentSaveOptions &saveOptions, - QWidget *parent) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::lossyPromptContinue()"; -#endif - -#define QUIT_IF_CANCEL(messageBoxCommand) \ -{ \ - if (messageBoxCommand != KMessageBox::Continue) \ - { \ - return false; \ - } \ -} - - const int lossyType = saveOptions.isLossyForSaving (pixmap); - if (lossyType & (kpDocumentSaveOptions::MimeTypeMaximumColorDepthLow | - kpDocumentSaveOptions::Quality)) - { - QUIT_IF_CANCEL ( - KMessageBox::warningContinueCancel (parent, - i18n ("

The %1 format may not be able" - " to preserve all of the image's color information.

" - - "

Are you sure you want to save in this format?

", - KMimeType::mimeType (saveOptions.mimeType ())->comment ()), - // TODO: caption misleading for lossless formats that have - // low maximum colour depth - i18nc ("@title:window", "Lossy File Format"), - KStandardGuiItem::save (), - KStandardGuiItem::cancel(), - QLatin1String ("SaveInLossyMimeTypeDontAskAgain"))); - } - else if (lossyType & kpDocumentSaveOptions::ColorDepthLow) - { - QUIT_IF_CANCEL ( - KMessageBox::warningContinueCancel (parent, - i18n ("

Saving the image at the low color depth of %1-bit" - " may result in the loss of color information." - - // TODO: It looks like 8-bit QImage's now support alpha. - // Update kpDocumentSaveOptions::isLossyForSaving() - // and change "might" to "will". - " Any transparency might also be removed.

" - - "

Are you sure you want to save at this color depth?

", - saveOptions.colorDepth ()), - i18nc ("@title:window", "Low Color Depth"), - KStandardGuiItem::save (), - KStandardGuiItem::cancel(), - QLatin1String ("SaveAtLowColorDepthDontAskAgain"))); - } -#undef QUIT_IF_CANCEL - - return true; -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocument::savePixmapToDevice (const QImage &image, - QIODevice *device, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - bool lossyPrompt, - QWidget *parent, - bool *userCancelled) -{ - if (userCancelled) - *userCancelled = false; - - QStringList types = KImageIO::typeForMime (saveOptions.mimeType ()); -#if DEBUG_KP_DOCUMENT - kDebug () << "\ttypes=" << types; -#endif - if (types.isEmpty ()) - return false; - - // It's safe to arbitrarily choose the 0th type as any type in the list - // should invoke the same KImageIO image loader. - const QString type = types [0]; - -#if DEBUG_KP_DOCUMENT - kDebug () << "\tmimeType=" << saveOptions.mimeType () - << " type=" << type << endl; -#endif - - if (lossyPrompt && !lossyPromptContinue (image, saveOptions, parent)) - { - if (userCancelled) - *userCancelled = true; - - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because of lossyPrompt"; - #endif - return false; - } - - - // TODO: fix dup with kpDocumentSaveOptions::isLossyForSaving() - const bool useSaveOptionsColorDepth = - (saveOptions.mimeTypeHasConfigurableColorDepth () && - !saveOptions.colorDepthIsInvalid ()); - const bool useSaveOptionsQuality = - (saveOptions.mimeTypeHasConfigurableQuality () && - !saveOptions.qualityIsInvalid ()); - - - // - // Reduce colors if required - // - -#if DEBUG_KP_DOCUMENT - kDebug () << "\tuseSaveOptionsColorDepth=" << useSaveOptionsColorDepth - << "current image depth=" << image.depth () - << "save options depth=" << saveOptions.colorDepth (); -#endif - QImage imageToSave(image); - - if (useSaveOptionsColorDepth && - imageToSave.depth () != saveOptions.colorDepth ()) - { - // TODO: I think this erases the mask! - // - // I suspect this doesn't matter since this is only called to - // reduce color depth and QImage's with depth < 32 don't - // support masks anyway. - // - // Later: I think the mask is preserved for 8-bit since Qt4 - // seems to support it for QImage. - imageToSave = kpEffectReduceColors::convertImageDepth (imageToSave, - saveOptions.colorDepth (), - saveOptions.dither ()); - } - - - // - // Write Meta Info - // - - imageToSave.setDotsPerMeterX (metaInfo.dotsPerMeterX ()); - imageToSave.setDotsPerMeterY (metaInfo.dotsPerMeterY ()); - imageToSave.setOffset (metaInfo.offset ()); - - QList keyList = metaInfo.textKeys (); - for (QList ::const_iterator it = keyList.constBegin (); - it != keyList.constEnd (); - ++it) - { - imageToSave.setText (*it, metaInfo.text (*it)); - } - - - // - // Save at required quality - // - - int quality = -1; // default - - if (useSaveOptionsQuality) - quality = saveOptions.quality (); - -#if DEBUG_KP_DOCUMENT - kDebug () << "\tsaving"; -#endif - if (!imageToSave.save (device, type.toLatin1 (), quality)) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\tQImage::save() returned false"; - #endif - return false; - } - - -#if DEBUG_KP_DOCUMENT - kDebug () << "\tsave OK"; -#endif - return true; -} - -//--------------------------------------------------------------------- - -static void CouldNotCreateTemporaryFileDialog (QWidget *parent) -{ - KMessageBox::error (parent, - i18n ("Could not save image - unable to create temporary file.")); -} - -//--------------------------------------------------------------------- - -static void CouldNotSaveDialog (const KUrl &url, QWidget *parent) -{ - // TODO: use file.errorString() - KMessageBox::error (parent, - i18n ("Could not save as \"%1\".", - kpUrlFormatter::PrettyFilename (url))); -} - -//--------------------------------------------------------------------- - -// public static -bool kpDocument::savePixmapToFile (const QImage &pixmap, - const KUrl &url, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - bool overwritePrompt, - bool lossyPrompt, - QWidget *parent) -{ - // TODO: Use KIO::NetAccess:mostLocalURL() for accessing home:/ (and other - // such local URLs) for efficiency and because only local writes - // are atomic. -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::savePixmapToFile (" - << url - << ",overwritePrompt=" << overwritePrompt - << ",lossyPrompt=" << lossyPrompt - << ")" << endl; - saveOptions.printDebug (QLatin1String ("\tsaveOptions")); - metaInfo.printDebug (QLatin1String ("\tmetaInfo")); -#endif - - if (overwritePrompt && - KIO::NetAccess::exists (url, KIO::NetAccess::DestinationSide/*write*/, parent)) - { - int result = KMessageBox::warningContinueCancel (parent, - i18n ("A document called \"%1\" already exists.\n" - "Do you want to overwrite it?", - kpUrlFormatter::PrettyFilename (url)), - QString(), - KGuiItem(i18n ("Overwrite"))); - - if (result != KMessageBox::Continue) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\tuser doesn't want to overwrite"; - #endif - - return false; - } - } - - - if (lossyPrompt && !lossyPromptContinue (pixmap, saveOptions, parent)) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because of lossyPrompt"; - #endif - return false; - } - - - // Local file? - if (url.isLocalFile ()) - { - const QString filename = url.toLocalFile (); - - // sync: All failure exit paths _must_ call KSaveFile::abort() or - // else, the KSaveFile destructor will overwrite the file, - // , despite the failure. - KSaveFile atomicFileWriter (filename); - { - if (!atomicFileWriter.open ()) - { - // We probably don't need this as has not been - // opened. - atomicFileWriter.abort (); - - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not open KSaveFile" - << " error=" << atomicFileWriter.error () << endl; - #endif - ::CouldNotCreateTemporaryFileDialog (parent); - return false; - } - - // Write to local temporary file. - if (!savePixmapToDevice (pixmap, &atomicFileWriter, - saveOptions, metaInfo, - false/*no lossy prompt*/, - parent)) - { - atomicFileWriter.abort (); - - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not save pixmap to device" - << endl; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Atomically overwrite local file with the temporary file - // we saved to. - if (!atomicFileWriter.finalize ()) - { - atomicFileWriter.abort (); - - #if DEBUG_KP_DOCUMENT - kDebug () << "\tcould not close KSaveFile"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - } // sync KSaveFile.abort() - } - // Remote file? - else - { - // Create temporary file that is deleted when the variable goes - // out of scope. - KTemporaryFile tempFile; - if (!tempFile.open ()) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not open tempFile"; - #endif - ::CouldNotCreateTemporaryFileDialog (parent); - return false; - } - - // Write to local temporary file. - if (!savePixmapToDevice (pixmap, &tempFile, - saveOptions, metaInfo, - false/*no lossy prompt*/, - parent)) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not save pixmap to device" - << endl; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Collect name of temporary file now, as QTemporaryFile::fileName() - // stops working after close() is called. - const QString tempFileName = tempFile.fileName (); - #if DEBUG_KP_DOCUMENT - kDebug () << "\ttempFileName='" << tempFileName << "'"; - #endif - Q_ASSERT (!tempFileName.isEmpty ()); - - tempFile.close (); - if (tempFile.error () != QFile::NoError) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not close"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Copy local temporary file to overwrite remote. - // TODO: No one seems to know how to do this atomically - // [http://lists.kde.org/?l=kde-core-devel&m=117845162728484&w=2]. - // At least, fish:// (ssh) is definitely not atomic. - if (!KIO::NetAccess::upload (tempFileName, url, parent)) - { - #if DEBUG_KP_DOCUMENT - kDebug () << "\treturning false because could not upload"; - #endif - KMessageBox::error (parent, - i18n ("Could not save image - failed to upload.")); - return false; - } - } - - - return true; -} - -//--------------------------------------------------------------------- - -bool kpDocument::saveAs (const KUrl &url, - const kpDocumentSaveOptions &saveOptions, - bool overwritePrompt, - bool lossyPrompt) -{ -#if DEBUG_KP_DOCUMENT - kDebug () << "kpDocument::saveAs (" << url << "," - << saveOptions.mimeType () << ")" << endl; -#endif - - if (kpDocument::savePixmapToFile (imageWithSelection (), - url, - saveOptions, *metaInfo (), - overwritePrompt, - lossyPrompt, - d->environ->dialogParent ())) - { - setURL (url, true/*is from url*/); - *m_saveOptions = saveOptions; - m_modified = false; - - m_savedAtLeastOnceBefore = true; - - emit documentSaved (); - return true; - } - else - { - return false; - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/document/kpDocument_Selection.cpp b/kolourpaint/document/kpDocument_Selection.cpp deleted file mode 100644 index bbb96a20..00000000 --- a/kolourpaint/document/kpDocument_Selection.cpp +++ /dev/null @@ -1,341 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT 0 - - -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -// public -kpAbstractSelection *kpDocument::selection () const -{ - return m_selection; -} - -//--------------------------------------------------------------------- - -// public -kpAbstractImageSelection *kpDocument::imageSelection () const -{ - return dynamic_cast (m_selection); -} - -//--------------------------------------------------------------------- - -// public -kpTextSelection *kpDocument::textSelection () const -{ - return dynamic_cast (m_selection); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::setSelection (const kpAbstractSelection &selection) -{ -#if DEBUG_KP_DOCUMENT && 1 - kDebug () << "kpDocument::setSelection() sel boundingRect=" - << selection.boundingRect () - << endl; -#endif - - d->environ->setQueueViewUpdates (); - { - const bool hadSelection = (bool) m_selection; - kpAbstractSelection *oldSelection = m_selection; - - - // (must be called before giving the document a new selection, to - // avoid a potential mess where switchToCompatibleTool() ends - // the current selection tool, killing the new selection) - bool isTextChanged = false; - d->environ->switchToCompatibleTool (selection, &isTextChanged); - Q_ASSERT (m_selection == oldSelection); - - - m_selection = selection.clone (); - - // There's no need to uninitialize the old selection - // (e.g. call disconnect()) since we delete it later. - connect (m_selection, SIGNAL (changed (const QRect &)), - this, SLOT (slotContentsChanged (const QRect &))); - - - // - // Now all kpDocument state has been set. - // We can _only_ change the environment after that, as the environment - // may access the document. Exception is above with - // switchToCompatibleTool(). - // - - d->environ->assertMatchingUIState (selection); - - - // - // Now all kpDocument and environment state has been set. - // We can _only_ fire signals after that, as the signal receivers (the - // "wider environment") may access the document and the environment. - // - - #if DEBUG_KP_DOCUMENT && 1 - kDebug () << "\tcheck sel " << (int *) m_selection - << " boundingRect=" << m_selection->boundingRect () - << endl; - #endif - if (oldSelection) - { - if (oldSelection->hasContent ()) - slotContentsChanged (oldSelection->boundingRect ()); - else - emit contentsChanged (oldSelection->boundingRect ()); - - delete oldSelection; - oldSelection = 0; - } - - if (m_selection->hasContent ()) - slotContentsChanged (m_selection->boundingRect ()); - else - emit contentsChanged (m_selection->boundingRect ()); - - - if (!hadSelection) - emit selectionEnabled (true); - - if (isTextChanged) - emit selectionIsTextChanged (textSelection ()); - } - d->environ->restoreQueueViewUpdates (); - -#if DEBUG_KP_DOCUMENT && 1 - kDebug () << "\tkpDocument::setSelection() ended"; -#endif -} - -//--------------------------------------------------------------------- - -// public -kpImage kpDocument::getSelectedBaseImage () const -{ - kpAbstractImageSelection *imageSel = imageSelection (); - Q_ASSERT (imageSel); - - // Easy if we already have it :) - const kpImage image = imageSel->baseImage (); - if (!image.isNull ()) - return image; - - - const QRect boundingRect = imageSel->boundingRect (); - Q_ASSERT (boundingRect.isValid ()); - - // OPT: This is very slow. Image / More Effects ... calls us twice - // unnecessarily. - return imageSel->givenImageMaskedByShape (getImageAt (boundingRect)); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::imageSelectionPullFromDocument (const kpColor &backgroundColor) -{ - kpAbstractImageSelection *imageSel = imageSelection (); - Q_ASSERT (imageSel); - - // Should not already have an image or we would not be pulling. - Q_ASSERT (!imageSel->hasContent ()); - - const QRect boundingRect = imageSel->boundingRect (); - Q_ASSERT (boundingRect.isValid ()); - - // - // Get selection image from document - // - - kpImage selectedImage = getSelectedBaseImage (); - - d->environ->setQueueViewUpdates (); - - imageSel->setBaseImage (selectedImage); - - // - // Fill opaque bits of the hole in the document - // - -#if !defined (QT_NO_DEBUG) && !defined (NDEBUG) - if (imageSel->transparency ().isTransparent ()) - { - Q_ASSERT (backgroundColor == imageSel->transparency ().transparentColor ()); - } - else - { - // If this method is begin called by a tool, the assert does not - // have to hold since transparentColor() might not be defined in Opaque - // Mode. - // - // If we were called by a tricky sequence of undo/redo commands, the assert - // does not have to hold for additional reason, which is that - // kpMainWindow::setImageSelectionTransparency() does not have to - // set in Opaque Mode. - // - // In practice, it probably does hold but I wouldn't bet on it. - } -#endif - - kpImage eraseImage(boundingRect.size(), QImage::Format_ARGB32_Premultiplied); - eraseImage.fill(backgroundColor.toQRgb()); - - // only paint the region of the shape of the selection - QPainter painter(m_image); - painter.setClipRegion(imageSel->shapeRegion()); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.drawImage(boundingRect.topLeft(), eraseImage); - slotContentsChanged(boundingRect); - - d->environ->restoreQueueViewUpdates (); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::selectionDelete () -{ - if ( !m_selection ) - return; - - const QRect boundingRect = m_selection->boundingRect (); - Q_ASSERT (boundingRect.isValid ()); - - const bool selectionHadContent = m_selection->hasContent (); - - delete m_selection; - m_selection = 0; - - - // HACK to prevent document from being modified when - // user cancels dragging out a new selection - // REFACTOR: Extract this out into a method. - if (selectionHadContent) - slotContentsChanged (boundingRect); - else - emit contentsChanged (boundingRect); - - emit selectionEnabled (false); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::selectionCopyOntoDocument (bool applySelTransparency) -{ - // Empty selection, just doing nothing - if ( !m_selection || !m_selection->hasContent() ) - return; - - const QRect boundingRect = m_selection->boundingRect (); - Q_ASSERT (boundingRect.isValid ()); - - if (imageSelection ()) - { - if (applySelTransparency) - imageSelection ()->paint (m_image, rect ()); - else - imageSelection ()->paintWithBaseImage (m_image, rect ()); - } - else - { - // (for antialiasing with background) - m_selection->paint (m_image, rect ()); - } - - slotContentsChanged (boundingRect); -} - -//--------------------------------------------------------------------- - -// public -void kpDocument::selectionPushOntoDocument (bool applySelTransparency) -{ - selectionCopyOntoDocument (applySelTransparency); - selectionDelete (); -} - -//--------------------------------------------------------------------- - -// public -kpImage kpDocument::imageWithSelection () const -{ -#if DEBUG_KP_DOCUMENT && 1 - kDebug () << "kpDocument::imageWithSelection()"; -#endif - - // Have selection? - // - // It need not have any content because e.g. a text box with an opaque - // background, but no content, is still visually there. - if (m_selection) - { - #if DEBUG_KP_DOCUMENT && 1 - kDebug () << "\tselection @ " << m_selection->boundingRect (); - #endif - kpImage output = *m_image; - - // (this is a NOP for image selections without content) - m_selection->paint (&output, rect ()); - - return output; - } - else - { - #if DEBUG_KP_DOCUMENT && 1 - kDebug () << "\tno selection"; - #endif - return *m_image; - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/environments/commands/kpCommandEnvironment.cpp b/kolourpaint/environments/commands/kpCommandEnvironment.cpp deleted file mode 100644 index 95831a9e..00000000 --- a/kolourpaint/environments/commands/kpCommandEnvironment.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include -#include -#include -#include - - -struct kpCommandEnvironmentPrivate -{ -}; - -kpCommandEnvironment::kpCommandEnvironment (kpMainWindow *mainWindow) - : kpEnvironmentBase (mainWindow), - d (new kpCommandEnvironmentPrivate ()) -{ -} - -kpCommandEnvironment::~kpCommandEnvironment () -{ - delete d; -} - - -// public -void kpCommandEnvironment::setColor (int which, const kpColor &color) const -{ - kpColorToolBar *toolBar = mainWindow ()->colorToolBar (); - Q_ASSERT (toolBar); - - toolBar->setColor (which, color); -} - - -// public -void kpCommandEnvironment::somethingBelowTheCursorChanged () const -{ - kpTool *tool = mainWindow ()->tool (); - Q_ASSERT (tool); - - tool->somethingBelowTheCursorChanged (); -} - - -// public -kpImageSelectionTransparency kpCommandEnvironment::imageSelectionTransparency () const -{ - return mainWindow ()->imageSelectionTransparency (); -} - -// public -void kpCommandEnvironment::setImageSelectionTransparency ( - const kpImageSelectionTransparency &transparency, - bool forceColorChange) -{ - mainWindow ()->setImageSelectionTransparency (transparency, forceColorChange); -} - - -// public -kpTextStyle kpCommandEnvironment::textStyle () const -{ - return mainWindow ()->textStyle (); -} - -// public -void kpCommandEnvironment::setTextStyle (const kpTextStyle &textStyle) -{ - mainWindow ()->setTextStyle (textStyle); -} - - -#include "moc_kpCommandEnvironment.cpp" diff --git a/kolourpaint/environments/commands/kpCommandEnvironment.h b/kolourpaint/environments/commands/kpCommandEnvironment.h deleted file mode 100644 index fb2b0ad6..00000000 --- a/kolourpaint/environments/commands/kpCommandEnvironment.h +++ /dev/null @@ -1,80 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpCommandEnvironment_H -#define kpCommandEnvironment_H - - -#include - - -class kpMainWindow; -class kpImageSelectionTransparency; -class kpTextStyle; -class kpViewManager; - - -// Facade for kpCommand clients. -class kpCommandEnvironment : public kpEnvironmentBase -{ -Q_OBJECT - -public: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpCommandEnvironment (kpMainWindow *mainWindow); - virtual ~kpCommandEnvironment (); - - - void somethingBelowTheCursorChanged () const; - - - // Sets the foreground and background drawing colors in the UI. - void setColor (int which, const kpColor &color) const; - - - // - // Selections - // - - kpImageSelectionTransparency imageSelectionTransparency () const; - void setImageSelectionTransparency (const kpImageSelectionTransparency &transparency, - bool forceColorChange = false); - - kpTextStyle textStyle () const; - void setTextStyle (const kpTextStyle &textStyle); - - -private: - struct kpCommandEnvironmentPrivate * const d; -}; - - -#endif // kpCommandEnvironment_H - diff --git a/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.cpp b/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.cpp deleted file mode 100644 index f23c6be9..00000000 --- a/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - - -//--------------------------------------------------------------------- - -kpTransformDialogEnvironment::kpTransformDialogEnvironment(kpMainWindow *mainWindow) - : kpEnvironmentBase(mainWindow) -{ -} - -//--------------------------------------------------------------------- - -#include "moc_kpTransformDialogEnvironment.cpp" diff --git a/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.h b/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.h deleted file mode 100644 index a3f4b218..00000000 --- a/kolourpaint/environments/dialogs/imagelib/transforms/kpTransformDialogEnvironment.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformDialogEnvironment_H -#define kpTransformDialogEnvironment_H - - -#include - - -class kpCommandEnvironment; - - -// Facade for kpTransformDialog* clients. -class kpTransformDialogEnvironment : public kpEnvironmentBase -{ -Q_OBJECT - -public: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpTransformDialogEnvironment (kpMainWindow *mainWindow); -}; - - -#endif // kpTransformDialogEnvironment_H - diff --git a/kolourpaint/environments/document/kpDocumentEnvironment.cpp b/kolourpaint/environments/document/kpDocumentEnvironment.cpp deleted file mode 100644 index 8dbe5f9d..00000000 --- a/kolourpaint/environments/document/kpDocumentEnvironment.cpp +++ /dev/null @@ -1,213 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DOCUMENT_ENVIRONMENT 0 - - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if DEBUG_KP_DOCUMENT_ENVIRONMENT - #include -#endif -#include - - -struct kpDocumentEnvironmentPrivate -{ -}; - -kpDocumentEnvironment::kpDocumentEnvironment (kpMainWindow *mainWindow) - : kpEnvironmentBase (mainWindow), - d (new kpDocumentEnvironmentPrivate ()) -{ -} - -kpDocumentEnvironment::~kpDocumentEnvironment () -{ - delete d; -} - - -// public -QWidget *kpDocumentEnvironment::dialogParent () const -{ - return mainWindow (); -} - - -static kpViewManager *ViewManager (kpMainWindow *mw) -{ - return mw->viewManager (); -} - -// public -void kpDocumentEnvironment::setQueueViewUpdates () const -{ - ::ViewManager (mainWindow ())->setQueueUpdates (); -} - -// public -void kpDocumentEnvironment::restoreQueueViewUpdates () const -{ - ::ViewManager (mainWindow ())->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentEnvironment::switchToCompatibleTool (const kpAbstractSelection &selection, - bool *isTextChanged) const -{ -#if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "kpDocumentEnvironment::switchToCompatibleTool(" - << &selection << ")" - << " mainwindow.tool=" - << (mainWindow ()->tool () ? mainWindow ()->tool ()->objectName () : 0) - << " mainWindow.toolIsTextTool=" << mainWindow ()->toolIsTextTool () - << " current selection=" - << document ()->selection () - << " new selection is text=" - << dynamic_cast (&selection) - << endl; -#endif - - *isTextChanged = (mainWindow ()->toolIsTextTool () != - (dynamic_cast (&selection) != 0)); - - // We don't change the Selection Tool if the new selection's - // shape is merely different to the current tool's (e.g. rectangular - // vs elliptical) because: - // - // 1. All image selection tools support editing selections of all the - // different shapes anyway. - // 2. Suppose the user is trying out different drags of selection borders - // and then decides to paste a differently shaped selection before continuing - // to try out different borders. If the pasting were to switch to - // a differently shaped tool, the borders drawn after the paste would - // be using a new shape rather than the shape before the paste. This - // could get irritating so we don't do the switch. - if (!mainWindow ()->toolIsASelectionTool () || *isTextChanged) - { - // See kpDocument::setSelection() APIDoc for this assumption. - Q_ASSERT (!document ()->selection ()); - - // Switch to the appropriately shaped selection tool - // _before_ we change the selection - // (all selection tool's ::end() functions nuke the current selection) - if (dynamic_cast (&selection)) - { - #if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "\tswitch to rect selection tool"; - #endif - mainWindow ()->slotToolRectSelection (); - } - else if (dynamic_cast (&selection)) - { - #if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "\tswitch to elliptical selection tool"; - #endif - mainWindow ()->slotToolEllipticalSelection (); - } - else if (dynamic_cast (&selection)) - { - #if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "\tswitch to free form selection tool"; - #endif - mainWindow ()->slotToolFreeFormSelection (); - } - else if (dynamic_cast (&selection)) - { - #if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "\tswitch to text selection tool"; - #endif - mainWindow ()->slotToolText (); - } - else - Q_ASSERT (!"Unknown selection type"); - } - -#if DEBUG_KP_DOCUMENT_ENVIRONMENT - kDebug () << "kpDocumentEnvironment::switchToCompatibleTool(" << &selection << ") finished"; -#endif -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentEnvironment::assertMatchingUIState (const kpAbstractSelection &selection) const -{ - // Trap and try to recover from bugs. - // TODO: See kpDocument::setSelection() API comment and determine best fix. - const kpAbstractImageSelection *imageSelection = - dynamic_cast (&selection); - const kpTextSelection *textSelection = - dynamic_cast (&selection); - if (imageSelection) - { - if (imageSelection->transparency () != mainWindow ()->imageSelectionTransparency ()) - { - kError () << "kpDocument::setSelection() sel's transparency differs " - "from mainWindow's transparency - setting mainWindow's transparency " - "to sel" - << endl; - kError () << "\tisOpaque: sel=" << imageSelection->transparency ().isOpaque () - << " mainWindow=" << mainWindow ()->imageSelectionTransparency ().isOpaque () - << endl; - mainWindow ()->setImageSelectionTransparency (imageSelection->transparency ()); - } - } - else if (textSelection) - { - if (textSelection->textStyle () != mainWindow ()->textStyle ()) - { - kError () << "kpDocument::setSelection() sel's textStyle differs " - "from mainWindow's textStyle - setting mainWindow's textStyle " - "to sel" - << endl; - mainWindow ()->setTextStyle (textSelection->textStyle ()); - } - } - else - { - Q_ASSERT (!"Unknown selection type"); - } -} - - -#include "moc_kpDocumentEnvironment.cpp" diff --git a/kolourpaint/environments/document/kpDocumentEnvironment.h b/kolourpaint/environments/document/kpDocumentEnvironment.h deleted file mode 100644 index 3eb4b36d..00000000 --- a/kolourpaint/environments/document/kpDocumentEnvironment.h +++ /dev/null @@ -1,72 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentEnvironment_H -#define kpDocumentEnvironment_H - - -#include - - -#include -#include - -class kpAbstractSelection; - - -// Facade for kpDocument clients. -class kpDocumentEnvironment : public kpEnvironmentBase -{ -Q_OBJECT - -public: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpDocumentEnvironment (kpMainWindow *mainWindow); - virtual ~kpDocumentEnvironment (); - - - QWidget *dialogParent () const; - - void setQueueViewUpdates () const; - void restoreQueueViewUpdates () const; - - void switchToCompatibleTool (const kpAbstractSelection &selection, - // REFACTOR: This is horrible API and terribly named. - bool *isTextChanged) const; - void assertMatchingUIState (const kpAbstractSelection &selection) const; - - -private: - struct kpDocumentEnvironmentPrivate * const d; -}; - - -#endif // kpDocumentEnvironment_H - diff --git a/kolourpaint/environments/kpEnvironmentBase.cpp b/kolourpaint/environments/kpEnvironmentBase.cpp deleted file mode 100644 index 38cfd2a1..00000000 --- a/kolourpaint/environments/kpEnvironmentBase.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include -#include -#include - - -struct kpEnvironmentBasePrivate -{ - kpMainWindow *mainWindow; -}; - -kpEnvironmentBase::kpEnvironmentBase (kpMainWindow *mainWindow) - : QObject (mainWindow), - d (new kpEnvironmentBasePrivate ()) -{ - Q_ASSERT (mainWindow); - - d->mainWindow = mainWindow; -} - -kpEnvironmentBase::~kpEnvironmentBase () -{ - delete d; -} - - -// public -kpDocument *kpEnvironmentBase::document () const -{ - return d->mainWindow->document (); -} - - -// public -kpAbstractSelection *kpEnvironmentBase::selection () const -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - return doc->selection (); -} - -// public -kpAbstractImageSelection *kpEnvironmentBase::imageSelection () const -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - return doc->imageSelection (); -} - -// public -kpTextSelection *kpEnvironmentBase::textSelection () const -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - - return doc->textSelection (); -} - - -// public -kpViewManager *kpEnvironmentBase::viewManager () const -{ - return mainWindow ()->viewManager (); -} - - -// public -kpCommandEnvironment *kpEnvironmentBase::commandEnvironment () const -{ - return mainWindow ()->commandEnvironment (); -} - - -// public -kpColor kpEnvironmentBase::backgroundColor (bool ofSelection) const -{ - return d->mainWindow->backgroundColor (ofSelection); -} - - -// protected -kpMainWindow *kpEnvironmentBase::mainWindow () const -{ - return d->mainWindow; -} - - -#include "moc_kpEnvironmentBase.cpp" diff --git a/kolourpaint/environments/kpEnvironmentBase.h b/kolourpaint/environments/kpEnvironmentBase.h deleted file mode 100644 index d460fbc2..00000000 --- a/kolourpaint/environments/kpEnvironmentBase.h +++ /dev/null @@ -1,99 +0,0 @@ - -// LOREFACTOR: The files in this folder duplicate too much code. -// Use mixin multiple inheritance to get around this. -// -// LOREFACTOR: Move as much kpMainWindow code as possible into these classes -// to reduce the size of kpMainWindow. But do not split concerns / -// "aspects" in kpMainWindow, with half the code there and half here, -// as that would be confusing. - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEnvironmentBase_H -#define kpEnvironmentBase_H - - -#include - - -class kpAbstractImageSelection; -class kpAbstractSelection; -class kpColor; -class kpCommandEnvironment; -class kpDocument; -class kpMainWindow; -class kpTextSelection; -class kpViewManager; - - -// Abstract facade bridging kpMainWindow and other suppliers (e.g. kpTool, -// kpToolToolBar, kpColorToolBar) to clients. -// -// This decouples as many classes as possible from clients, for maintainability. -// If adding new methods to this class, it is preferable to expose additional -// functionality, rather than expose additional classes. -// -// This class also avoids cramming excessive functionality into kpMainWindow. -// -// If this interface gets too bloated, push down the specialized methods into -// a new class. -class kpEnvironmentBase : public QObject -{ -Q_OBJECT - -// (must derive from) -protected: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpEnvironmentBase (kpMainWindow *mainWindow); - virtual ~kpEnvironmentBase (); - -public: - kpDocument *document () const; - - kpAbstractSelection *selection () const; - kpAbstractImageSelection *imageSelection () const; - kpTextSelection *textSelection () const; - - kpViewManager *viewManager () const; - - kpCommandEnvironment *commandEnvironment () const; - - kpColor backgroundColor (bool ofSelection = false) const; - -protected: - kpMainWindow *mainWindow () const; - -private: - struct kpEnvironmentBasePrivate * const d; -}; - - -#endif // kpEnvironmentBase_H - diff --git a/kolourpaint/environments/tools/kpToolEnvironment.cpp b/kolourpaint/environments/tools/kpToolEnvironment.cpp deleted file mode 100644 index abf91516..00000000 --- a/kolourpaint/environments/tools/kpToolEnvironment.cpp +++ /dev/null @@ -1,212 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - - -struct kpToolEnvironmentPrivate -{ -}; - -kpToolEnvironment::kpToolEnvironment (kpMainWindow *mainWindow) - : kpEnvironmentBase (mainWindow), - d (new kpToolEnvironmentPrivate ()) -{ -} - -kpToolEnvironment::~kpToolEnvironment () -{ - delete d; -} - - -// public -KActionCollection *kpToolEnvironment::actionCollection () const -{ - return mainWindow ()->actionCollection (); -} - -// public -kpCommandHistory *kpToolEnvironment::commandHistory () const -{ - return mainWindow ()->commandHistory (); -} - - -// public -QActionGroup *kpToolEnvironment::toolsActionGroup () const -{ - return mainWindow ()->toolsActionGroup (); -} - -// public -kpToolToolBar *kpToolEnvironment::toolToolBar () const -{ - return mainWindow ()->toolToolBar (); -} - -// public -void kpToolEnvironment::hideAllToolWidgets () const -{ - toolToolBar ()->hideAllToolWidgets (); -} - -// public -bool kpToolEnvironment::selectPreviousTool () const -{ - kpToolToolBar *tb = toolToolBar (); - - // (don't end up with no tool selected) - if (!tb->previousTool ()) - return false; - - // endInternal() will be called by kpMainWindow (thanks to this line) - // so we won't have the view anymore - // TODO: Update comment. - tb->selectPreviousTool (); - return true; -} - - -static kpColorToolBar *ColorToolBar (kpMainWindow *mw) -{ - return mw->colorToolBar (); -} - -// public -kpColor kpToolEnvironment::color (int which) const -{ - return ::ColorToolBar (mainWindow ())->color (which); -} - -// public -double kpToolEnvironment::colorSimilarity () const -{ - return ::ColorToolBar (mainWindow ())->colorSimilarity (); -} - -// public -int kpToolEnvironment::processedColorSimilarity () const -{ - return ::ColorToolBar (mainWindow ())->processedColorSimilarity (); -} - -// public -kpColor kpToolEnvironment::oldForegroundColor () const -{ - return ::ColorToolBar (mainWindow ())->oldForegroundColor (); -} - -// public -kpColor kpToolEnvironment::oldBackgroundColor () const -{ - return ::ColorToolBar (mainWindow ())->oldBackgroundColor (); -} - -// public -double kpToolEnvironment::oldColorSimilarity () const -{ - return ::ColorToolBar (mainWindow ())->oldColorSimilarity (); -} - - -// public -void kpToolEnvironment::flashColorSimilarityToolBarItem () const -{ - ::ColorToolBar (mainWindow ())->flashColorSimilarityToolBarItem (); -} - - -// public -void kpToolEnvironment::setColor (int which, const kpColor &color) const -{ - kpColorToolBar *toolBar = mainWindow ()->colorToolBar (); - Q_ASSERT (toolBar); - - toolBar->setColor (which, color); -} - - -// public -void kpToolEnvironment::deleteSelection () const -{ - mainWindow ()->slotDelete (); -} - -// public -void kpToolEnvironment::pasteTextAt (const QString &text, const QPoint &point, - bool allowNewTextSelectionPointShift) const -{ - mainWindow ()->pasteTextAt (text, point, allowNewTextSelectionPointShift); -} - - -// public -void kpToolEnvironment::zoomIn (bool centerUnderCursor) const -{ - mainWindow ()->zoomIn (centerUnderCursor); -} - -// public -void kpToolEnvironment::zoomOut (bool centerUnderCursor) const -{ - mainWindow ()->zoomOut (centerUnderCursor); -} - - -// public -void kpToolEnvironment::zoomToRect ( - const QRect &normalizedDocRect, - bool accountForGrips, - bool careAboutWidth, bool careAboutHeight) const -{ - mainWindow ()->zoomToRect ( - normalizedDocRect, - accountForGrips, - careAboutWidth, careAboutHeight); -} - -// public -void kpToolEnvironment::fitToPage () const -{ - mainWindow ()->slotFitToPage (); -} - - -#include "moc_kpToolEnvironment.cpp" diff --git a/kolourpaint/environments/tools/kpToolEnvironment.h b/kolourpaint/environments/tools/kpToolEnvironment.h deleted file mode 100644 index edc9594c..00000000 --- a/kolourpaint/environments/tools/kpToolEnvironment.h +++ /dev/null @@ -1,161 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolEnvironment_H -#define kpToolEnvironment_H - - -#include - - -#include -#include -#include -#include - -class KActionCollection; - -class kpColor; -class kpCommandHistory; -class kpToolToolBar; - - -// Facade for kpTool clients. -class kpToolEnvironment : public kpEnvironmentBase -{ -Q_OBJECT - -public: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpToolEnvironment (kpMainWindow *mainWindow); - virtual ~kpToolEnvironment (); - - - KActionCollection *actionCollection () const; - - kpCommandHistory *commandHistory () const; - - QActionGroup *toolsActionGroup () const; - kpToolToolBar *toolToolBar () const; - void hideAllToolWidgets () const; - bool selectPreviousTool () const; - - kpColor color (int which) const; - double colorSimilarity () const; - int processedColorSimilarity () const; - - // (only valid in kpTool::slotForegroundColorChanged()) - kpColor oldForegroundColor () const; - // (only valid in kpTool::slotBackgroundColorChanged()) - kpColor oldBackgroundColor () const; - - // (only valid in kpTool::slotColorSimilarityChanged()) - double oldColorSimilarity () const; - - // Flashes the Color Similarity Tool Bar Item to highlight to the user, - // the existence of the Color Similarity feature. - // - // This should be used in only 3 circumstances: - // - // 1. Tools not acting on the selection but using Color Similarity - // e.g. Color Eraser, Flood Fill, Auto Crop. Note that Auto Crop - // becomes Remove Internal Border when a selection is active but - // the flashing still occurs because the extent of the effect is - // directly dependent on Color Similarity. - // - // 2. A change to selection transparency (background color, color similarity - // percentage, change from opaque to transparent). - // - // It is not used when the transpareny is opaque or when changing from - // transparent to opaque, as you're not using Color Similarity in these - // cases. - // - // Similarly, it is not used when there is no image selection or the - // image selection is just a border, as changing the selection - // transparency also does nothing in these cases. - // - // 3. Pulling a selection from the document, when selection transparency - // is transparent. - // - // Except for any pulling phase, it is not used for effects that use - // the "transparent image" of a selection (e.g. smearing a transparent - // selection). This is to minimize distractions and because the flashing - // has already been done by pulling. - // - // This should always be called _before_ an operation related to Color - // Similarity, to indicate that the Color Similarity was applied throughout - // the operation -- not at the end. This aspect is most noticeable for - // the time-consuming Autocrop feature, which may fail with a dialog -- - // it would look wrong to only flash the Color Similarity Tool Bar Item when - // the dialog comes up after the failed operation, as it implies that Color - // Similarity was not used during the operation. Having said all this, - // currently the flashing still happens afterwards because the flashing is - // not done in a separate thread. However, assume that the implementation - // will be fixed later. - // - // It is tempting to simply disable the Color Similarity Tool Bar Item - // if the current tool does not use Color Similarity - this change in - // enabled state would be enough to highlight the existence of Color - // Similarity, without the need for this flashing. However, Auto Crop - // is always available - independent of the current tool - and it uses - // Color Similarity, so we can never disable the Tool Bar Item. - // - // We flash in tools but not commands as else it would be very distracting - // Undo/Redo - this flashing in the tools is distracting enough already :) - void flashColorSimilarityToolBarItem () const; - - void setColor (int which, const kpColor &color) const; - - void deleteSelection () const; - void pasteTextAt (const QString &text, const QPoint &point, - // Allow tiny adjustment of so that mouse - // pointer is not exactly on top of the topLeft of - // any new text selection (so that it doesn't look - // weird by being on top of a resize handle just after - // a paste). - bool allowNewTextSelectionPointShift = false) const; - - void zoomIn (bool centerUnderCursor = false) const; - void zoomOut (bool centerUnderCursor = false) const; - - void zoomToRect (const QRect &normalizedDocRect, - bool accountForGrips, - bool careAboutWidth, bool careAboutHeight) const; - - void fitToPage () const; - - -private: - struct kpToolEnvironmentPrivate * const d; -}; - - -#endif // kpToolEnvironment_H - diff --git a/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.cpp b/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.cpp deleted file mode 100644 index f57084bd..00000000 --- a/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include - - -struct kpToolSelectionEnvironmentPrivate -{ -}; - -kpToolSelectionEnvironment::kpToolSelectionEnvironment (kpMainWindow *mainWindow) - : kpToolEnvironment (mainWindow), - d (new kpToolSelectionEnvironmentPrivate ()) -{ -} - -kpToolSelectionEnvironment::~kpToolSelectionEnvironment () -{ - delete d; -} - - -// public -kpImageSelectionTransparency kpToolSelectionEnvironment::imageSelectionTransparency () const -{ - return mainWindow ()->imageSelectionTransparency (); -} - -// public -int kpToolSelectionEnvironment::settingImageSelectionTransparency () const -{ - return mainWindow ()->settingImageSelectionTransparency (); -} - - -// public -void kpToolSelectionEnvironment::deselectSelection () const -{ - mainWindow ()->slotDeselect (); -} - -// public -QMenu *kpToolSelectionEnvironment::selectionToolRMBMenu () const -{ - return mainWindow ()->selectionToolRMBMenu (); -} - - -// public -void kpToolSelectionEnvironment::enableTextToolBarActions (bool enable) const -{ - mainWindow ()->enableTextToolBarActions (enable); -} - -// public -kpTextStyle kpToolSelectionEnvironment::textStyle () const -{ - return mainWindow ()->textStyle (); -} - -// public -int kpToolSelectionEnvironment::settingTextStyle () const -{ - return mainWindow ()->settingTextStyle (); -} - - -#include "moc_kpToolSelectionEnvironment.cpp" diff --git a/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.h b/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.h deleted file mode 100644 index 94941d6b..00000000 --- a/kolourpaint/environments/tools/selection/kpToolSelectionEnvironment.h +++ /dev/null @@ -1,72 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolSelectionEnvironment_H -#define kpToolSelectionEnvironment_H - - -#include - - -#include - -class kpImageSelectionTransparency; -class kpTextStyle; - - -// Facade for kpToolSelection clients. -class kpToolSelectionEnvironment : public kpToolEnvironment -{ -Q_OBJECT - -public: - // Note: Our interface must never publicly leak or any other - // classes we are trying to hide as that would defeat the point of - // the facade. - kpToolSelectionEnvironment (kpMainWindow *mainWindow); - virtual ~kpToolSelectionEnvironment (); - - kpImageSelectionTransparency imageSelectionTransparency () const; - int settingImageSelectionTransparency () const; - - void deselectSelection () const; - - QMenu *selectionToolRMBMenu () const; - - void enableTextToolBarActions (bool enable = true) const; - - kpTextStyle textStyle () const; - int settingTextStyle () const; - -private: - struct kpToolSelectionEnvironmentPrivate * const d; -}; - - -#endif // kpToolSelectionEnvironment_H - diff --git a/kolourpaint/gen_cmake_include_dirs b/kolourpaint/gen_cmake_include_dirs deleted file mode 100755 index df6260a4..00000000 --- a/kolourpaint/gen_cmake_include_dirs +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Recalculates the KolourPaint-specific part of CMakeLists.txt's "include_directories()" - -for f in `find -type d | fgrep -v .git | egrep -v '^\.$' | egrep -v '^\./pics ^\./patches$ ^\./tests$' | cut -c3- | sort` -do - echo '${CMAKE_CURRENT_SOURCE_DIR}/'$f -done diff --git a/kolourpaint/gen_cmake_srcs b/kolourpaint/gen_cmake_srcs deleted file mode 100755 index db6884ea..00000000 --- a/kolourpaint/gen_cmake_srcs +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Recalculates the KolourPaint-specific part of CMakeLists.txt's "set(kolourpaint_SRCS" - -for f in `find -name \*.cpp | cut -c3- | sort` -do - echo '${CMAKE_CURRENT_SOURCE_DIR}/'$f -done diff --git a/kolourpaint/generic/kpSetOverrideCursorSaver.cpp b/kolourpaint/generic/kpSetOverrideCursorSaver.cpp deleted file mode 100644 index c695e89c..00000000 --- a/kolourpaint/generic/kpSetOverrideCursorSaver.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - - -kpSetOverrideCursorSaver::kpSetOverrideCursorSaver (const QCursor &cursor) -{ - QApplication::setOverrideCursor (cursor); -} - -kpSetOverrideCursorSaver::~kpSetOverrideCursorSaver () -{ - QApplication::restoreOverrideCursor (); -} - diff --git a/kolourpaint/generic/kpSetOverrideCursorSaver.h b/kolourpaint/generic/kpSetOverrideCursorSaver.h deleted file mode 100644 index 1d9f83ad..00000000 --- a/kolourpaint/generic/kpSetOverrideCursorSaver.h +++ /dev/null @@ -1,107 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpSetOverrideCursorSaver_H -#define kpSetOverrideCursorSaver_H - - -#include - - -// -// A less error-prone way of setting the override cursor, compared to -// the QApplication::{set,restore}OverrideCursor() pair. -// -// To use this class, allocate it on the stack with the desired cursor. -// -// This class sets the application's override cursor to on -// construction. It restores the cursor on destruction. -// -// Example Usage 1 - Cursor active during the entire method: -// -// void method () -// { -// kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); -// -// -// -// } // Stack unwinds, calling cursorSaver's destructor, -// // which restores the cursor -// -// Example Usage 2 - Cursor active during part of the method: -// -// void method () -// { -// -// -// { -// kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); -// -// -// -// } // Stack unwinds, calling cursorSaver's destructor, -// // which restores the cursor -// -// // (cursor is restored before this code executes) -// -// } -// -// Note that the kpSetOverrideCursorSaver must be defined as a local -// variable inside -- not outside --- the braces containing the code the -// cursor can be active over, else the destruction and cursor restoration -// might not occur at the right time. In other words, the following usage -// is wrong: -// -// INCORRECT Example Usage 2: -// -// void method () -// { -// -// -// kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); -// // BUG: These braces do nothing to limit the effect of cursorSaver. -// { -// -// } -// -// // BUG: cursorSaver has not yet restored the cursor before this -// // code executes. -// -// -// } // Stack unwinds, calling cursorSaver's destructor, -// // which restores the cursor -// -class kpSetOverrideCursorSaver -{ -public: - kpSetOverrideCursorSaver (const QCursor &cursor); - ~kpSetOverrideCursorSaver (); -}; - - -#endif // kpSetOverrideCursorSaver_H diff --git a/kolourpaint/generic/kpWidgetMapper.cpp b/kolourpaint/generic/kpWidgetMapper.cpp deleted file mode 100644 index 25d5fb42..00000000 --- a/kolourpaint/generic/kpWidgetMapper.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include - - -namespace kpWidgetMapper -{ - - -QPoint fromGlobal (const QWidget *widget, const QPoint &point) -{ - if (!widget) - return point; - - return widget->mapFromGlobal (point); -} - -QRect fromGlobal (const QWidget *widget, const QRect &rect) -{ - if (!widget || !rect.isValid ()) - return rect; - - QPoint topLeft = fromGlobal (widget, rect.topLeft ()); - return QRect (topLeft.x (), topLeft.y (), rect.width (), rect.height ()); -} - - -QPoint toGlobal (const QWidget *widget, const QPoint &point) -{ - if (!widget) - return point; - - return widget->mapToGlobal (point); -} - -QRect toGlobal (const QWidget *widget, const QRect &rect) -{ - if (!widget || !rect.isValid ()) - return rect; - - QPoint topLeft = toGlobal (widget, rect.topLeft ()); - return QRect (topLeft.x (), topLeft.y (), rect.width (), rect.height ()); -} - - -} // namespace kpWidgetMapper { diff --git a/kolourpaint/generic/kpWidgetMapper.h b/kolourpaint/generic/kpWidgetMapper.h deleted file mode 100644 index 71610095..00000000 --- a/kolourpaint/generic/kpWidgetMapper.h +++ /dev/null @@ -1,48 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_WIDGET_MAPPER_H -#define KP_WIDGET_MAPPER_H - - -#include -#include -#include - - -namespace kpWidgetMapper -{ - QPoint fromGlobal (const QWidget *widget, const QPoint &point); - QRect fromGlobal (const QWidget *widget, const QRect &rect); - - QPoint toGlobal (const QWidget *widget, const QPoint &point); - QRect toGlobal (const QWidget *widget, const QRect &rect); -} - - -#endif // KP_WIDGET_MAPPER_H diff --git a/kolourpaint/generic/widgets/kpResizeSignallingLabel.cpp b/kolourpaint/generic/widgets/kpResizeSignallingLabel.cpp deleted file mode 100644 index 42aef147..00000000 --- a/kolourpaint/generic/widgets/kpResizeSignallingLabel.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_RESIZE_SIGNALLING_LABEL 0 - - -#include - -#include - -#include - - -kpResizeSignallingLabel::kpResizeSignallingLabel (const QString &string, - QWidget *parent ) - : QLabel (string, parent) -{ -} - -kpResizeSignallingLabel::kpResizeSignallingLabel (QWidget *parent ) - : QLabel (parent) -{ -} - -kpResizeSignallingLabel::~kpResizeSignallingLabel () -{ -} - - -// protected virtual [base QLabel] -void kpResizeSignallingLabel::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_RESIZE_SIGNALLING_LABEL - kDebug () << "kpResizeSignallingLabel::resizeEvent() newSize=" << e->size () - << " oldSize=" << e->oldSize () << endl; -#endif - QLabel::resizeEvent (e); - - emit resized (); -} - - -#include "moc_kpResizeSignallingLabel.cpp" diff --git a/kolourpaint/generic/widgets/kpResizeSignallingLabel.h b/kolourpaint/generic/widgets/kpResizeSignallingLabel.h deleted file mode 100644 index ec53a342..00000000 --- a/kolourpaint/generic/widgets/kpResizeSignallingLabel.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_RESIZE_SIGNALLING_LABEL_H -#define KP_RESIZE_SIGNALLING_LABEL_H - - -#include - - -#include - - -class kpResizeSignallingLabel : public QLabel -{ -Q_OBJECT - -public: - kpResizeSignallingLabel (const QString &string, QWidget *parent); - kpResizeSignallingLabel (QWidget *parent); - virtual ~kpResizeSignallingLabel (); - -signals: - void resized (); - -protected: - virtual void resizeEvent (QResizeEvent *e); -}; - - -#endif // KP_RESIZE_SIGNALLING_LABEL_H diff --git a/kolourpaint/generic/widgets/kpSubWindow.cpp b/kolourpaint/generic/widgets/kpSubWindow.cpp deleted file mode 100644 index 667910dc..00000000 --- a/kolourpaint/generic/widgets/kpSubWindow.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - - -kpSubWindow::kpSubWindow (QWidget *parent) - : QDialog (parent) -{ -} diff --git a/kolourpaint/generic/widgets/kpSubWindow.h b/kolourpaint/generic/widgets/kpSubWindow.h deleted file mode 100644 index e81e927d..00000000 --- a/kolourpaint/generic/widgets/kpSubWindow.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpSubWindow_H -#define kpSubWindow_H - - -#include - -// -// A tool window with the following properties, in order of importance: -// -// 1. Stays on top of its parent window, but not on top of any other -// window (this rules out Qt::WindowStaysOnTop) -// 2. Does not auto-hide when its parent window loses focus -// (this rules out Qt::Tool). -// 3. Does not have a taskbar entry. -// 4. TODO: Does not take keyboard focus away from the parent window, -// when it is shown. -// 5. TODO: Is not in the Alt+Tab list -// -// We mean "tool window" in the window system sense. It has nothing to do -// with kpTool so to avoid confusion, we do not name it "kpToolWindow". -// -class kpSubWindow : public QDialog -{ - public: - kpSubWindow(QWidget *parent); -}; - - -#endif // kpSubWindow_H diff --git a/kolourpaint/imagelib/effects/kpEffectBalance.cpp b/kolourpaint/imagelib/effects/kpEffectBalance.cpp deleted file mode 100644 index 15e67185..00000000 --- a/kolourpaint/imagelib/effects/kpEffectBalance.cpp +++ /dev/null @@ -1,213 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BALANCE 0 - - -#include - -#include - -#include - -#include - -#include - - -#if DEBUG_KP_EFFECT_BALANCE - #include -#endif - - -static inline int between0And255 (int val) -{ - if (val < 0) - return 0; - else if (val > 255) - return 255; - else - return val; -} - - -static inline int brightness (int base, int strength) -{ - return between0And255 (base + strength * 255 / 50); -} - -static inline int contrast (int base, int strength) -{ - return between0And255 ((base - 127) * (strength + 50) / 50 + 127); -} - -static inline int gamma (int base, int strength) -{ - return between0And255 (qRound (255.0 * pow (base / 255.0, 1.0 / pow (10., strength / 50.0)))); -} - - -static inline int brightnessContrastGamma (int base, - int newBrightness, - int newContrast, - int newGamma) -{ - return gamma (contrast (brightness (base, newBrightness), - newContrast), - newGamma); -} - -static inline QRgb brightnessContrastGammaForRGB (QRgb rgb, - int channels, - int brightness, int contrast, int gamma) -{ - int red = qRed (rgb); - int green = qGreen (rgb); - int blue = qBlue (rgb); - - - if (channels & kpEffectBalance::Red) - red = brightnessContrastGamma (red, brightness, contrast, gamma); - if (channels & kpEffectBalance::Green) - green = brightnessContrastGamma (green, brightness, contrast, gamma); - if (channels & kpEffectBalance::Blue) - blue = brightnessContrastGamma (blue, brightness, contrast, gamma); - - - return qRgba (red, green, blue, qAlpha (rgb)); -} - - -// public static -kpImage kpEffectBalance::applyEffect (const kpImage &image, - int channels, - int brightness, int contrast, int gamma) -{ -#if DEBUG_KP_EFFECT_BALANCE - kDebug () << "kpEffectBalance::applyEffect(" - << "channels=" << channels - << ",brightness=" << brightness - << ",contrast=" << contrast - << ",gamma=" << gamma - << ")" << endl; - QTime timer; timer.start (); -#endif - - QImage qimage = image; -#if DEBUG_KP_EFFECT_BALANCE - kDebug () << "\tconvertToImage=" << timer.restart (); -#endif - - - quint8 transformRed [256], - transformGreen [256], - transformBlue [256]; - - for (int i = 0; i < 256; i++) - { - quint8 applied = (quint8) brightnessContrastGamma (i, brightness, contrast, gamma); - - if (channels & kpEffectBalance::Red) - transformRed [i] = applied; - else - transformRed [i] = i; - - if (channels & kpEffectBalance::Green) - transformGreen [i] = applied; - else - transformGreen [i] = i; - - if (channels & kpEffectBalance::Blue) - transformBlue [i] = applied; - else - transformBlue [i] = i; - } - -#if DEBUG_KP_EFFECT_BALANCE - kDebug () << "\tbuild lookup=" << timer.restart (); -#endif - - - if (qimage.depth () > 8) - { - for (int y = 0; y < qimage.height (); y++) - { - for (int x = 0; x < qimage.width (); x++) - { - const QRgb rgb = qimage.pixel (x, y); - - const quint8 red = (quint8) qRed (rgb); - const quint8 green = (quint8) qGreen (rgb); - const quint8 blue = (quint8) qBlue (rgb); - const quint8 alpha = (quint8) qAlpha (rgb); - - qimage.setPixel (x, y, - qRgba (transformRed [red], - transformGreen [green], - transformBlue [blue], - alpha)); - - #if 0 - qimage.setPixel (x, y, - brightnessContrastGammaForRGB (qimage.pixel (x, y), - channels, - brightness, contrast, gamma)); - #endif - } - } - } - else - { - for (int i = 0; i < qimage.colorCount(); i++) - { - const QRgb rgb = qimage.color (i); - - const quint8 red = (quint8) qRed (rgb); - const quint8 green = (quint8) qGreen (rgb); - const quint8 blue = (quint8) qBlue (rgb); - const quint8 alpha = (quint8) qAlpha (rgb); - - qimage.setColor (i, - qRgba (transformRed [red], - transformGreen [green], - transformBlue [blue], - alpha)); - - #if 0 - qimage.setColor (i, - brightnessContrastGammaForRGB (qimage.color (i), - channels, - brightness, contrast, gamma)); - #endif - } - - } - - return qimage; -} - diff --git a/kolourpaint/imagelib/effects/kpEffectBalance.h b/kolourpaint/imagelib/effects/kpEffectBalance.h deleted file mode 100644 index 6635864f..00000000 --- a/kolourpaint/imagelib/effects/kpEffectBalance.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBalance_H -#define kpEffectBalance_H - - -#include - - -class kpEffectBalance -{ -public: - enum Channel - { - None = 0, - Red = 1, Green = 2, Blue = 4, - RGB = Red | Green | Blue - }; - - // (, & are from -50 to 50) - static kpImage applyEffect (const kpImage &image, - int channels, - int brightness, int contrast, int gamma); -}; - - -#endif // kpEffectBalance_H diff --git a/kolourpaint/imagelib/effects/kpEffectBlurSharpen.cpp b/kolourpaint/imagelib/effects/kpEffectBlurSharpen.cpp deleted file mode 100644 index 35a2fe7e..00000000 --- a/kolourpaint/imagelib/effects/kpEffectBlurSharpen.cpp +++ /dev/null @@ -1,204 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BLUR_SHARPEN 0 - - -#include - -#include - -#include -#include - -#include - -#include - - -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - #include -#endif - - -//--------------------------------------------------------------------- - -// -// For info on "radius" and "sigma", see http://redskiesatnight.com/Articles/IMsharpen/ -// -// Daniel Duley says: -// -// -// I don't think I can describe it any better than the article: The radius -// controls many how pixels are taken into account when determining the value -// of the center pixel. This controls the quality [and speed] of the result but not -// necessarily the strength. The sigma controls how those neighboring pixels -// are weighted depending on how far the are from the center one. This is -// closer to strength, but not exactly >:) -// -// - - -static QImage BlurQImage (const QImage qimage_, int strength) -{ - QImage qimage = qimage_; - if (strength == 0) - return qimage; - - - // The numbers that follow were picked by experimentation to try to get - // an effect linearly proportional to and at the same time, - // be fast enough. - // - // I still have no idea what "radius" means. - - const double RadiusMin = 1; - const double RadiusMax = 10; - const double radius = RadiusMin + - (strength - 1) * - (RadiusMax - RadiusMin) / - (kpEffectBlurSharpen::MaxStrength - 1); - -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "kpEffectBlurSharpen.cpp:BlurQImage(strength=" << strength << ")" - << " radius=" << radius - << endl; -#endif - - - qimage = Blitz::blur (qimage, qRound (radius)); - - - return qimage; -} - -//--------------------------------------------------------------------- - -static QImage SharpenQImage (const QImage &qimage_, int strength) -{ - QImage qimage = qimage_; - if (strength == 0) - return qimage; - - - // The numbers that follow were picked by experimentation to try to get - // an effect linearly proportional to and at the same time, - // be fast enough. - // - // I still have no idea what "radius" and "sigma" mean. - - const double RadiusMin = .1; - const double RadiusMax = 2.5; - const double radius = RadiusMin + - (strength - 1) * - (RadiusMax - RadiusMin) / - (kpEffectBlurSharpen::MaxStrength - 1); - - const double SigmaMin = .5; - const double SigmaMax = 3.0; - const double sigma = SigmaMin + - (strength - 1) * - (SigmaMax - SigmaMin) / - (kpEffectBlurSharpen::MaxStrength - 1); - - const double RepeatMin = 1; - const double RepeatMax = 2; - const double repeat = qRound (RepeatMin + - (strength - 1) * - (RepeatMax - RepeatMin) / - (kpEffectBlurSharpen::MaxStrength - 1)); - -// I guess these values are more proper as they use an auto-calculated -// radius but they cause sharpen() to be too slow. -#if 0 - const double radius = 0/*auto-calculate*/; - - const double SigmaMin = .6; - const double SigmaMax = 1.0; - const double sigma = SigmaMin + - (strength - 1) * - (SigmaMax - SigmaMin) / - (kpEffectBlurSharpen::MaxStrength - 1); - - const double RepeatMin = 1; - const double RepeatMax = 3; - const double repeat = qRound (RepeatMin + - (strength - 1) * - (RepeatMax - RepeatMin) / - (kpEffectBlurSharpen::MaxStrength - 1)); -#endif - -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "kpEffectBlurSharpen.cpp:SharpenQImage(strength=" << strength << ")" - << " radius=" << radius - << " sigma=" << sigma - << " repeat=" << repeat - << endl; -#endif - - - for (int i = 0; i < repeat; i++) - { - #if DEBUG_KP_EFFECT_BLUR_SHARPEN - QTime timer; timer.start (); - #endif - qimage = Blitz::gaussianSharpen (qimage, radius, sigma); - #if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "\titeration #" + QString::number (i) - << ": " + QString::number (timer.elapsed ()) << "ms" << endl; - #endif - } - - - return qimage; -} - -//--------------------------------------------------------------------- - -// public static -kpImage kpEffectBlurSharpen::applyEffect (const kpImage &image, - Type type, int strength) -{ -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "kpEffectBlurSharpen::applyEffect(image.rect=" << image.rect () - << ",type=" << int (type) - << ",strength=" << strength - << ")" << endl; -#endif - - Q_ASSERT (strength >= MinStrength && strength <= MaxStrength); - - if (type == Blur) - return ::BlurQImage (image, strength); - else if (type == Sharpen) - return ::SharpenQImage (image, strength); - else - return kpImage(); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/effects/kpEffectBlurSharpen.h b/kolourpaint/imagelib/effects/kpEffectBlurSharpen.h deleted file mode 100644 index 60f1b899..00000000 --- a/kolourpaint/imagelib/effects/kpEffectBlurSharpen.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBlurSharpen_H -#define kpEffectBlurSharpen_H - - -#include - - -class kpEffectBlurSharpen -{ -public: - enum Type - { - None = 0, Blur, Sharpen - }; - - // Blur or Sharpen with this strength is the same as None. - // This will always be 0 - this constant will not change. - static const int MinStrength = 0; - - static const int MaxStrength = 10; - - // = strength of the effect - // (must be between MinStrength and MaxStrength inclusive) - static kpImage applyEffect (const kpImage &image, - Type type, int strength); -}; - - -#endif // kpEffectBlurSharpen_H diff --git a/kolourpaint/imagelib/effects/kpEffectEmboss.cpp b/kolourpaint/imagelib/effects/kpEffectEmboss.cpp deleted file mode 100644 index 0e5503af..00000000 --- a/kolourpaint/imagelib/effects/kpEffectEmboss.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_EMBOSS 0 - - -#include - -#include - -#include - -#include - -#include - - -static QImage EmbossQImage (const QImage &qimage_, int strength) -{ - QImage qimage = qimage_; - if (strength == 0) - return qimage; - - - // The numbers that follow were picked by experimentation to try to get - // an effect linearly proportional to and at the same time, - // be fast enough. - // - // I still have no idea what "radius" and "sigma" mean. - - const double radius = 0; - -#if 0 - const double SigmaMin = 1; - const double SigmaMax = 1.2; - - return SigmaMin + - (kpEffectEmboss::MaxStrength - strength) * - (SigmaMax - SigmaMin) / - (kpEffectEmboss::MaxStrength - 1); -#endif - const double sigma = 1; - - const int repeat = 1; - - - for (int i = 0; i < repeat; i++) - { - qimage = Blitz::emboss (qimage, radius, sigma); - } - - - return qimage; -} - - -// public static -kpImage kpEffectEmboss::applyEffect (const kpImage &image, int strength) -{ -#if DEBUG_KP_EFFECT_EMBOSS - kDebug () << "kpEffectEmboss::applyEffect(strength=" << strength << ")" - << endl; -#endif - - Q_ASSERT (strength >= MinStrength && strength <= MaxStrength); - - return ::EmbossQImage (image, strength); -} diff --git a/kolourpaint/imagelib/effects/kpEffectEmboss.h b/kolourpaint/imagelib/effects/kpEffectEmboss.h deleted file mode 100644 index 7b72ad62..00000000 --- a/kolourpaint/imagelib/effects/kpEffectEmboss.h +++ /dev/null @@ -1,52 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectEmboss_H -#define kpEffectEmboss_H - - -#include - - -class kpEffectEmboss -{ -public: - // This will always be 0 - this constant will not change. - static const int MinStrength = 0; - - static const int MaxStrength = 10; - - // = strength of the effect - // (must be between MinStrength and MaxStrength inclusive) - // - // Currently, all non-zero strengths are the same. - static kpImage applyEffect (const kpImage &image, int strength); -}; - - -#endif // kpEffectEmboss_H diff --git a/kolourpaint/imagelib/effects/kpEffectFlatten.cpp b/kolourpaint/imagelib/effects/kpEffectFlatten.cpp deleted file mode 100644 index 0427fabf..00000000 --- a/kolourpaint/imagelib/effects/kpEffectFlatten.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_FLATTEN 0 - - -#include - -#include - -#include -#include - -#include -#include - -#include - - -// public static -void kpEffectFlatten::applyEffect (QImage *destImagePtr, - const QColor &color1, const QColor &color2) -{ - if (!destImagePtr) - return; - - Blitz::flatten (*destImagePtr/*ref*/, color1, color2); -} - -// public static -QImage kpEffectFlatten::applyEffect (const QImage &img, - const QColor &color1, const QColor &color2) -{ - QImage retImage = img; - applyEffect (&retImage, color1, color2); - return retImage; -} - - diff --git a/kolourpaint/imagelib/effects/kpEffectFlatten.h b/kolourpaint/imagelib/effects/kpEffectFlatten.h deleted file mode 100644 index 1f49d503..00000000 --- a/kolourpaint/imagelib/effects/kpEffectFlatten.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectFlatten_H -#define kpEffectFlatten_H - - -#include -#include - - -class kpEffectFlatten -{ -public: - static void applyEffect (QImage *destImagePtr, - const QColor &color1, const QColor &color2); - static QImage applyEffect (const QImage &img, - const QColor &color1, const QColor &color2); -}; - - -#endif // kpEffectFlatten_H diff --git a/kolourpaint/imagelib/effects/kpEffectGrayscale.cpp b/kolourpaint/imagelib/effects/kpEffectGrayscale.cpp deleted file mode 100644 index 80ba8a85..00000000 --- a/kolourpaint/imagelib/effects/kpEffectGrayscale.cpp +++ /dev/null @@ -1,74 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PIXMAP_FX 0 - - -#include - -#include - - -static QRgb toGray (QRgb rgb) -{ - // naive way that doesn't preserve brightness - // int gray = (qRed (rgb) + qGreen (rgb) + qBlue (rgb)) / 3; - - // over-exaggerates red & blue - // int gray = qGray (rgb); - - int gray = (212671 * qRed (rgb) + 715160 * qGreen (rgb) + 72169 * qBlue (rgb)) / 1000000; - return qRgba (gray, gray, gray, qAlpha (rgb)); -} - - -// public static -kpImage kpEffectGrayscale::applyEffect (const kpImage &image) -{ - kpImage qimage(image); - - // TODO: Why not just write to the kpImage directly? - if (qimage.depth () > 8) - { - for (int y = 0; y < qimage.height (); y++) - { - for (int x = 0; x < qimage.width (); x++) - { - qimage.setPixel (x, y, toGray (qimage.pixel (x, y))); - } - } - } - else - { - // 1- & 8- bit images use a color table - for (int i = 0; i < qimage.colorCount(); i++) - qimage.setColor (i, toGray (qimage.color (i))); - } - - return qimage; -} diff --git a/kolourpaint/imagelib/effects/kpEffectGrayscale.h b/kolourpaint/imagelib/effects/kpEffectGrayscale.h deleted file mode 100644 index 696c6ab7..00000000 --- a/kolourpaint/imagelib/effects/kpEffectGrayscale.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectGrayscale_H -#define kpEffectGrayscale_H - - -#include - - -// -// Converts the image to grayscale. -// - -class kpEffectGrayscale -{ -public: - static kpImage applyEffect (const kpImage &image); -}; - - -#endif // kpEffectGrayscale_H diff --git a/kolourpaint/imagelib/effects/kpEffectHSV.cpp b/kolourpaint/imagelib/effects/kpEffectHSV.cpp deleted file mode 100644 index a4bc142a..00000000 --- a/kolourpaint/imagelib/effects/kpEffectHSV.cpp +++ /dev/null @@ -1,173 +0,0 @@ - -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// TODO: Clarence's code review - -#include - -#include - -#include -#include - -#include - -#include - - -static void ColorToHSV(unsigned int c, float* pHue, float* pSaturation, float* pValue) -{ - int r = qRed(c); - int g = qGreen(c); - int b = qBlue(c); - int min; - if(b >= g && b >= r) - { - // Blue - min = qMin(r, g); - if(b != min) - { - *pHue = (float)(r - g) / ((b - min) * 6) + (float)2 / 3; - *pSaturation = (float)1 - (float)min / (float)b; - } - else - { - *pHue = 0; - *pSaturation = 0; - } - *pValue = (float)b / 255; - } - else if(g >= r) - { - // Green - min = qMin(b, r); - if(g != min) - { - *pHue = (float)(b - r) / ((g - min) * 6) + (float)1 / 3; - *pSaturation = (float)1 - (float)min / (float)g; - } - else - { - *pHue = 0; - *pSaturation = 0; - } - *pValue = (float)g / 255; - } - else - { - // Red - min = qMin(g, b); - if(r != min) - { - *pHue = (float)(g - b) / ((r - min) * 6); - if(*pHue < 0) - (*pHue) += (float)1; - *pSaturation = (float)1 - (float)min / (float)r; - } - else - { - *pHue = 0; - *pSaturation = 0; - } - *pValue = (float)r / 255; - } -} - -static unsigned int HSVToColor(int alpha, float hue, float saturation, float value) -{ - //Q_ASSERT (hue >= 0 && hue <= 1 && saturation >= 0 && saturation <= 1 && value >= 0 && value <= 1); - - hue *= (float)5.999999; - int h = (int)hue; - float f = hue - h; - float p = value * ((float)1 - saturation); - float q = value * ((float)1 - ((h & 1) == 0 ? (float)1 - f : f) * saturation); - switch(h) - { - case 0: return qRgba((int)(value * 255.999999), (int)(q * 255.999999), (int)(p * 255.999999), alpha); - case 1: return qRgba((int)(q * 255.999999), (int)(value * 255.999999), (int)(p * 255.999999), alpha); - case 2: return qRgba((int)(p * 255.999999), (int)(value * 255.999999), (int)(q * 255.999999), alpha); - case 3: return qRgba((int)(p * 255.999999), (int)(q * 255.999999), (int)(value * 255.999999), alpha); - case 4: return qRgba((int)(q * 255.999999), (int)(p * 255.999999), (int)(value * 255.999999), alpha); - case 5: return qRgba((int)(value * 255.999999), (int)(p * 255.999999), (int)(q * 255.999999), alpha); - } - return qRgba(0, 0, 0, alpha); -} - -static QRgb AdjustHSVInternal (QRgb pix, double hueDiv360, double saturation, double value) -{ - float h, s, v; - ::ColorToHSV(pix, &h, &s, &v); - - const int alpha = qAlpha(pix); - - h += (float)hueDiv360; - h -= floor(h); - - s = qMax((float)0, qMin((float)1, s + (float)saturation)); - - v = qMax((float)0, qMin((float)1, v + (float)value)); - - return ::HSVToColor(alpha, h, s, v); -} - -static void AdjustHSV (QImage* pImage, double hue, double saturation, double value) -{ - hue /= 360; - - if (pImage->depth () > 8) - { - for (int y = 0; y < pImage->height (); y++) - { - for (int x = 0; x < pImage->width (); x++) - { - QRgb pix = pImage->pixel (x, y); - pix = ::AdjustHSVInternal (pix, hue, saturation, value); - pImage->setPixel (x, y, pix); - } - } - } - else - { - for (int i = 0; i < pImage->colorCount(); i++) - { - QRgb pix = pImage->color (i); - pix = ::AdjustHSVInternal (pix, hue, saturation, value); - pImage->setColor (i, pix); - } - } -} - -// public static -kpImage kpEffectHSV::applyEffect (const kpImage &image, - double hue, double saturation, double value) -{ - QImage qimage(image); - ::AdjustHSV (&qimage, hue, saturation, value); - return qimage; -} - diff --git a/kolourpaint/imagelib/effects/kpEffectHSV.h b/kolourpaint/imagelib/effects/kpEffectHSV.h deleted file mode 100644 index d637190a..00000000 --- a/kolourpaint/imagelib/effects/kpEffectHSV.h +++ /dev/null @@ -1,44 +0,0 @@ - -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectHSV_H -#define kpEffectHSV_H - - -#include - - -class kpEffectHSV -{ -public: - static kpImage applyEffect (const kpImage &image, - double hue, double saturation, double value); -}; - - -#endif // kpEffectHSV_H diff --git a/kolourpaint/imagelib/effects/kpEffectInvert.cpp b/kolourpaint/imagelib/effects/kpEffectInvert.cpp deleted file mode 100644 index 4dd71024..00000000 --- a/kolourpaint/imagelib/effects/kpEffectInvert.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_INVERT 0 - - -#include - -#include -#include - -#include - -#include - - -// public static -void kpEffectInvert::applyEffect (QImage *destImagePtr, int channels) -{ - QRgb mask = qRgba ((channels & Red) ? 0xFF : 0, - (channels & Green) ? 0xFF : 0, - (channels & Blue) ? 0xFF : 0, - 0/*don't invert alpha*/); -#if DEBUG_KP_EFFECT_INVERT - kDebug () << "kpEffectInvert::applyEffect(channels=" << channels - << ") mask=" << (int *) mask - << endl; -#endif - - if (destImagePtr->depth () > 8) - { - #if 0 - // SYNC: TODO: Qt BUG - invertAlpha argument is inverted!!! - destImagePtr->invertPixels (true/*no invert alpha (Qt 3.2)*/); - #else - // Above version works for Qt 3.2 at least. - // But this version will always work (slower, though) and supports - // inverting particular channels. - for (int y = 0; y < destImagePtr->height (); y++) - { - for (int x = 0; x < destImagePtr->width (); x++) - { - destImagePtr->setPixel (x, y, destImagePtr->pixel (x, y) ^ mask); - } - } - #endif - } - else - { - for (int i = 0; i < destImagePtr->colorCount(); i++) - { - destImagePtr->setColor (i, destImagePtr->color (i) ^ mask); - } - } -} - -// public static -QImage kpEffectInvert::applyEffect (const QImage &img, int channels) -{ - QImage retImage = img; - applyEffect (&retImage, channels); - return retImage; -} - - diff --git a/kolourpaint/imagelib/effects/kpEffectInvert.h b/kolourpaint/imagelib/effects/kpEffectInvert.h deleted file mode 100644 index b7f9f96f..00000000 --- a/kolourpaint/imagelib/effects/kpEffectInvert.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectInvert_H -#define kpEffectInvert_H - - -#include - - -class kpEffectInvert -{ -public: - enum Channel - { - None = 0, - Red = 1, Green = 2, Blue = 4, - RGB = Red | Green | Blue - }; - - // - // Inverts the colours of each pixel in the given image. - // These functions differ from QImage::invertPixels() in the following ways: - // - // 1. for 8-bit images, it inverts the colours of the Colour Table - // (this means that you would get visually similar results to inversion - // at higher bit depths - rather than a "random-looking" inversion - // depending on the contents of the Colour Table) - // 2. never inverts the Alpha Buffer - // - - static void applyEffect (QImage *destImagePtr, int channels = RGB); - static QImage applyEffect (const QImage &img, int channels = RGB); -}; - - -#endif // kpEffectInvert_H diff --git a/kolourpaint/imagelib/effects/kpEffectReduceColors.cpp b/kolourpaint/imagelib/effects/kpEffectReduceColors.cpp deleted file mode 100644 index 5d848f96..00000000 --- a/kolourpaint/imagelib/effects/kpEffectReduceColors.cpp +++ /dev/null @@ -1,236 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_REDUCE_COLORS 0 - - -#include - -#include - -//--------------------------------------------------------------------- - -static QImage::Format DepthToFormat (int depth) -{ - // These values are QImage's supported depths. - switch (depth) - { - case 1: - // (can be MSB instead, I suppose) - return QImage::Format_MonoLSB; - - case 8: - return QImage::Format_Indexed8; - - case 16: - return QImage::Format_ARGB4444_Premultiplied; - - case 24: - return QImage::Format_ARGB6666_Premultiplied; - - case 32: - return QImage::Format_ARGB32_Premultiplied; - - default: - Q_ASSERT (!"unknown depth"); - return QImage::Format_Invalid; - } -} - -//--------------------------------------------------------------------- - -// public static -QImage kpEffectReduceColors::convertImageDepth (const QImage &image, int depth, bool dither) -{ -#if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "kpeffectreducecolors.cpp:ConvertImageDepth() changing image (w=" << image.width () - << ",h=" << image.height () - << ") depth from " << image.depth () - << " to " << depth - << " (dither=" << dither << ")" - << endl; -#endif - - if (image.isNull ()) - return image; - - if (depth == image.depth ()) - return image; - - -#if DEBUG_KP_EFFECT_REDUCE_COLORS && 0 - for (int y = 0; y < image.height (); y++) - { - for (int x = 0; x < image.width (); x++) - { - fprintf (stderr, " %08X", image.pixel (x, y)); - } - fprintf (stderr, "\n"); - } -#endif - - - // Hack around Qt's braindead QImage::convertToFormat(QImage::Format_MonoLSB, ...) - // (with dithering off) which produces pathetic results with an image that - // only has 2 colors - sometimes it just gives a completely black - // result (try yellow and white as input). Instead, we simply preserve - // the 2 colours. - // - // One use case is resaving a "color monochrome" image (<= 2 colors but - // not necessarily black & white). - if (depth == 1 && !dither) - { - #if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\tinvoking convert-to-depth 1 hack"; - #endif - QRgb color0 = 0, color1 = 0; - bool color0Valid = false, color1Valid = false; - - bool moreThan2Colors = false; - - QImage monoImage (image.width (), image.height (), QImage::Format_MonoLSB); - monoImage.setColorCount (2); - #if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\t\tinitialising output image w=" << monoImage.width () - << ",h=" << monoImage.height () - << ",d=" << monoImage.depth () - << endl; - #endif - for (int y = 0; y < image.height (); y++) - { - for (int x = 0; x < image.width (); x++) - { - // (this can be transparent) - QRgb imagePixel = image.pixel (x, y); - - if (color0Valid && imagePixel == color0) - monoImage.setPixel (x, y, 0); - else if (color1Valid && imagePixel == color1) - monoImage.setPixel (x, y, 1); - else if (!color0Valid) - { - color0 = imagePixel; - color0Valid = true; - monoImage.setPixel (x, y, 0); - #if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\t\t\tcolor0=" << (int *) color0 - << " at x=" << x << ",y=" << y << endl; - #endif - } - else if (!color1Valid) - { - color1 = imagePixel; - color1Valid = true; - monoImage.setPixel (x, y, 1); - #if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\t\t\tcolor1=" << (int *) color1 - << " at x=" << x << ",y=" << y << endl; - #endif - } - else - { - #if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\t\t\timagePixel=" << (int *) imagePixel - << " at x=" << x << ",y=" << y - << " moreThan2Colors - abort hack" << endl; - #endif - moreThan2Colors = true; - - // Dijkstra, this is clearer than double break'ing or - // a check in both loops - goto exit_loop; - } - } - } - exit_loop: - - if (!moreThan2Colors) - { - monoImage.setColor (0, color0Valid ? color0 : 0xFFFFFF); - monoImage.setColor (1, color1Valid ? color1 : 0x000000); - return monoImage; - } - } - - QImage retImage = image.convertToFormat (::DepthToFormat (depth), - Qt::AutoColor | - (dither ? Qt::DiffuseDither : Qt::ThresholdDither) | - Qt::ThresholdAlphaDither | - (dither ? Qt::PreferDither : Qt::AvoidDither)); -#if DEBUG_KP_EFFECT_REDUCE_COLORS - kDebug () << "\tformat: before=" << image.format () - << "after=" << retImage.format (); -#endif - -#if DEBUG_KP_EFFECT_REDUCE_COLORS && 0 - kDebug () << "After colour reduction:"; - for (int y = 0; y < image.height (); y++) - { - for (int x = 0; x < image.width (); x++) - { - fprintf (stderr, " %08X", image.pixel (x, y)); - } - fprintf (stderr, "\n"); - } -#endif - - return retImage; -} - -//--------------------------------------------------------------------- - -// public static -void kpEffectReduceColors::applyEffect (QImage *destPtr, int depth, bool dither) -{ - if (!destPtr) - return; - - // You can't "reduce" to 32-bit since it's the highest depth. - if (depth != 1 && depth != 8) - return; - - *destPtr = convertImageDepth(*destPtr, depth, dither); - - // internally we always use QImage::Format_ARGB32_Premultiplied and - // this effect is just an "effect" in that it changes the image (the look) somehow - // When one wants a different depth on the file, then he needs to save the image - // in that depth - *destPtr = destPtr->convertToFormat(QImage::Format_ARGB32_Premultiplied); -} - -//--------------------------------------------------------------------- - -QImage kpEffectReduceColors::applyEffect (const QImage &pm, int depth, bool dither) -{ - QImage ret = pm; - applyEffect (&ret, depth, dither); - return ret; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/effects/kpEffectReduceColors.h b/kolourpaint/imagelib/effects/kpEffectReduceColors.h deleted file mode 100644 index b137a112..00000000 --- a/kolourpaint/imagelib/effects/kpEffectReduceColors.h +++ /dev/null @@ -1,51 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectReduceColors_H -#define kpEffectReduceColors_H - -#include - -// The specified must be supported by QImage. -class kpEffectReduceColors -{ -public: - // TODO: Why isn't applyEffect() for the public API sufficient? - // Ans: See TODO in kpDocument_Save.cpp. Maybe we should rename - // this method? - // - // Also, this can increase the image depth while applyEffect() - // will not. - static QImage convertImageDepth (const QImage &image, int depth, bool dither); - - static void applyEffect (QImage *destPixmapPtr, int depth, bool dither); - static QImage applyEffect (const QImage &pm, int depth, bool dither); -}; - - -#endif // kpEffectReduceColors_H diff --git a/kolourpaint/imagelib/effects/kpEffectToneEnhance.cpp b/kolourpaint/imagelib/effects/kpEffectToneEnhance.cpp deleted file mode 100644 index 2a005cd7..00000000 --- a/kolourpaint/imagelib/effects/kpEffectToneEnhance.cpp +++ /dev/null @@ -1,283 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -// TODO: Clarence's code review - -#include - -#include - -#include - -#include - - -#define RED_WEIGHT 77 -#define GREEN_WEIGHT 150 -#define BLUE_WEIGHT 29 - -#define MAX_TONE_VALUE ((RED_WEIGHT + GREEN_WEIGHT + BLUE_WEIGHT) * 255) -#define TONE_DROP_BITS 5 -#define TONE_MAP_SIZE ((MAX_TONE_VALUE >> TONE_DROP_BITS) + 1) -#define MAX_GRANULARITY 25 -#define MIN_IMAGE_DIM 3 - -//--------------------------------------------------------------------- - -inline unsigned int ComputeTone(unsigned int color) -{ - return RED_WEIGHT * qRed(color) + GREEN_WEIGHT * qGreen(color) + BLUE_WEIGHT * qBlue(color); -} - -//--------------------------------------------------------------------- - -inline unsigned int AdjustTone(unsigned int color, unsigned int oldTone, unsigned int newTone, double amount) -{ - return qRgba( - qMax(0, qMin(255, (int) (amount * qRed(color) * newTone / oldTone + (1.0 - amount) * qRed(color)))), - qMax(0, qMin(255, (int) (amount * qGreen(color) * newTone / oldTone + (1.0 - amount) * qGreen(color)))), - qMax(0, qMin(255, (int) (amount * qBlue(color) * newTone / oldTone + (1.0 - amount) * qBlue(color)))), - qAlpha(color) - ); -} - -//--------------------------------------------------------------------- - -class kpEffectToneEnhanceApplier -{ - public: - kpEffectToneEnhanceApplier (); - ~kpEffectToneEnhanceApplier (); - - void BalanceImageTone(QImage* pImage, double granularity, double amount); - - protected: - int m_nToneMapGranularity, m_areaWid, m_areaHgt; - unsigned int m_nComputedWid, m_nComputedHgt; - // LOTODO: Use less error-prone QTL containers instead. - unsigned int* m_pHistogram; - unsigned int** m_pToneMaps; - - void DeleteToneMaps(); - unsigned int* MakeToneMap(QImage* pImage, int x, int y, int nGranularity); - void ComputeToneMaps(QImage* pImage, int nGranularity); - unsigned int InterpolateNewTone(QImage* pImage, unsigned int oldTone, int x, int y, int nGranularity); -}; - -//--------------------------------------------------------------------- - -kpEffectToneEnhanceApplier::kpEffectToneEnhanceApplier () -{ - m_nToneMapGranularity = 0; - m_areaWid = 0; - m_areaHgt = 0; - m_nComputedWid = 0; - m_nComputedHgt = 0; - m_pHistogram = new unsigned int[TONE_MAP_SIZE]; - m_pToneMaps = 0; -} - -//--------------------------------------------------------------------- - -kpEffectToneEnhanceApplier::~kpEffectToneEnhanceApplier () -{ - DeleteToneMaps(); - delete[] m_pHistogram; -} - -//--------------------------------------------------------------------- - -// protected -void kpEffectToneEnhanceApplier::DeleteToneMaps() -{ - int nToneMaps = m_nToneMapGranularity * m_nToneMapGranularity; - for(int i = 0; i < nToneMaps; i++) - delete[] m_pToneMaps[i]; - delete[] m_pToneMaps; - m_pToneMaps = 0; - m_nToneMapGranularity = 0; -} - -//--------------------------------------------------------------------- - -// protected -unsigned int* kpEffectToneEnhanceApplier::MakeToneMap(QImage* pImage, int u, int v, int nGranularity) -{ - // Compute the region to make the tone map for - int xx, yy; - if(nGranularity > 1) - { - xx = u * (pImage->width() - 1) / (nGranularity - 1) - m_areaWid / 2; - if(xx < 0) - xx = 0; - else if(xx + m_areaWid > pImage->width()) - xx = pImage->width() - m_areaWid; - yy = v * (pImage->width() - 1) / (nGranularity - 1) - m_areaHgt / 2; - if(yy < 0) - yy = 0; - else if(yy + m_areaHgt > pImage->height()) - yy = pImage->height() - m_areaHgt; - } - else - { - xx = 0; - yy = 0; - } - - // Make a tone histogram for the region - memset(m_pHistogram, '\0', sizeof(unsigned int) * TONE_MAP_SIZE); - int x, y; - unsigned int tone; - for(y = 0; y < m_areaHgt; y++) - { - for(x = 0; x < m_areaWid; x++) - { - tone = ComputeTone(pImage->pixel(xx + x, yy + y)); - m_pHistogram[tone >> TONE_DROP_BITS]++; - } - } - - // Forward sum the tone histogram - int i; - for(i = 1; i < TONE_MAP_SIZE; i++) - m_pHistogram[i] += m_pHistogram[i - 1]; - - // Compute the forward contribution to the tone map - unsigned int total = m_pHistogram[i - 1]; - unsigned int* pToneMap = new unsigned int[TONE_MAP_SIZE]; - for(i = 0; i < TONE_MAP_SIZE; i++) - pToneMap[i] = (uint)((unsigned long long int)m_pHistogram[i] * MAX_TONE_VALUE / total); -/* - // Undo the forward sum and reverse sum the tone histogram - m_pHistogram[TONE_MAP_SIZE - 1] -= m_pHistogram[TONE_MAP_SIZE - 2]; - for(i = TONE_MAP_SIZE - 2; i > 0; i--) - { - m_pHistogram[i] -= m_pHistogram[i - 1]; - m_pHistogram[i] += m_pHistogram[i + 1]; - } - m_pHistogram[0] += m_pHistogram[1]; -*/ - return pToneMap; -} - -//--------------------------------------------------------------------- - -// protected -void kpEffectToneEnhanceApplier::ComputeToneMaps(QImage* pImage, int nGranularity) -{ - if(nGranularity == m_nToneMapGranularity && pImage->width() == (int) m_nComputedWid && pImage->height() == (int) m_nComputedHgt) - { - return; // We've already computed tone maps for this granularity - } - DeleteToneMaps(); - m_pToneMaps = new unsigned int*[nGranularity * nGranularity]; - m_nToneMapGranularity = nGranularity; - m_nComputedWid = pImage->width(); - m_nComputedHgt = pImage->height(); - int u, v; - for(v = 0; v < nGranularity; v++) - { - for(u = 0; u < nGranularity; u++) - m_pToneMaps[nGranularity * v + u] = MakeToneMap(pImage, u, v, nGranularity); - } -} - -//--------------------------------------------------------------------- - -// protected -unsigned int kpEffectToneEnhanceApplier::InterpolateNewTone(QImage* pImage, unsigned int oldTone, int x, int y, int nGranularity) -{ - oldTone = (oldTone >> TONE_DROP_BITS); - if(m_nToneMapGranularity <= 1) - return m_pToneMaps[0][oldTone]; - int u = x * (nGranularity - 1) / pImage->width(); - int v = y * (nGranularity - 1) / pImage->height(); - unsigned int x1y1 = m_pToneMaps[m_nToneMapGranularity * v + u][oldTone]; - unsigned int x2y1 = m_pToneMaps[m_nToneMapGranularity * v + u + 1][oldTone]; - unsigned int x1y2 = m_pToneMaps[m_nToneMapGranularity * (v + 1) + u][oldTone]; - unsigned int x2y2 = m_pToneMaps[m_nToneMapGranularity * (v + 1) + u + 1][oldTone]; - int hFac = x - (u * (pImage->width() - 1) / (nGranularity - 1)); - if(hFac > m_areaWid) - hFac = m_areaWid; - unsigned int y1 = (x1y1 * (m_areaWid - hFac) + x2y1 * hFac) / m_areaWid; - unsigned int y2 = (x1y2 * (m_areaWid - hFac) + x2y2 * hFac) / m_areaWid; - int vFac = y - (v * (pImage->height() - 1) / (nGranularity - 1)); - if(vFac > m_areaHgt) - vFac = m_areaHgt; - return (y1 * (m_areaHgt - vFac) + y2 * vFac) / m_areaHgt; -} - -//--------------------------------------------------------------------- - -// public -void kpEffectToneEnhanceApplier::BalanceImageTone(QImage* pImage, double granularity, double amount) -{ - if(pImage->width() < MIN_IMAGE_DIM || pImage->height() < MIN_IMAGE_DIM) - return; // the image is not big enough to perform this operation - int nGranularity = (int)(granularity * (MAX_GRANULARITY - 2)) + 1; - m_areaWid = pImage->width() / nGranularity; - if(m_areaWid < MIN_IMAGE_DIM) - m_areaWid = MIN_IMAGE_DIM; - m_areaHgt = pImage->height() / nGranularity; - if(m_areaHgt < MIN_IMAGE_DIM) - m_areaHgt = MIN_IMAGE_DIM; - ComputeToneMaps(pImage, nGranularity); - int x, y; - unsigned int oldTone, newTone, col; - for(y = 0; y < pImage->height(); y++) - { - for(x = 0; x < pImage->width(); x++) - { - col = pImage->pixel(x, y); - oldTone = ComputeTone(col); - newTone = InterpolateNewTone(pImage, oldTone, x, y, nGranularity); - pImage->setPixel(x, y, AdjustTone(col, oldTone, newTone, amount)); - } - } -} - -//--------------------------------------------------------------------- - -// public static -kpImage kpEffectToneEnhance::applyEffect (const kpImage &image, - double granularity, double amount) -{ - if (amount == 0) - return image; - - QImage qimage(image); - - // OPT: Cache the calculated values? - kpEffectToneEnhanceApplier applier; - applier.BalanceImageTone (&qimage, granularity, amount); - - return qimage; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/effects/kpEffectToneEnhance.h b/kolourpaint/imagelib/effects/kpEffectToneEnhance.h deleted file mode 100644 index 6bda7d28..00000000 --- a/kolourpaint/imagelib/effects/kpEffectToneEnhance.h +++ /dev/null @@ -1,61 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectToneEnhance_H -#define kpEffectToneEnhance_H - - -#include - - -// -// Histogram Equalizer effect. -// -// It just divides out the color histogram from the pixel values. (So if -// you plot the color histogram after equalizing, you should get a nearly -// flat/uniform distribution.) -// -// The two sliders adjust: -// -// 1. The extent to which it equalizes -// 2. The local-ness of the equalization. (In other words, it computes just -// the histogram of the regions near the pixel it is adjusting.) -// -// ASSUMPTION: The given is not paletted (currently, this is the -// same as the screen mode not being paletted). -// -class kpEffectToneEnhance -{ -public: - static kpImage applyEffect (const kpImage &image, - double granularity, double amount); -}; - - -#endif // kpEffectToneEnhance_H diff --git a/kolourpaint/imagelib/kpColor.cpp b/kolourpaint/imagelib/kpColor.cpp deleted file mode 100644 index a4a18d0b..00000000 --- a/kolourpaint/imagelib/kpColor.cpp +++ /dev/null @@ -1,310 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR 0 - - -#include - -#include - -#include - -//--------------------------------------------------------------------- - -kpColor::kpColor() - : m_rgbaIsValid(false), - m_rgba(0), - m_colorCacheIsValid(false) -{ -} - -//--------------------------------------------------------------------- - -kpColor::kpColor (int red, int green, int blue, bool isTransparent) - : m_rgba(0), m_colorCacheIsValid(false) -{ -#if DEBUG_KP_COLOR - kDebug () << "kpColor::(r=" << red << ",g=" << green << ",b=" << blue - << ",isTrans=" << isTransparent << ")" << endl; -#endif - if (red < 0 || red > 255 || - green < 0 || green > 255 || - blue < 0 || blue > 255) - { - kError () << "kpColor::(r=" << red - << ",g=" << green - << ",b=" << blue - << ",t=" << isTransparent - << ") passed out of range values" << endl; - m_rgbaIsValid = false; - return; - } - - m_rgba = qRgba (red, green, blue, isTransparent ? 0 : 255/*opaque*/); - m_rgbaIsValid = true; -} - -//--------------------------------------------------------------------- - -kpColor::kpColor (const QRgb &rgba) - : m_colorCacheIsValid (false) -{ -#if DEBUG_KP_COLOR - kDebug () << "kpColor::(rgba=" << (int *) rgba << ")"; -#endif - m_rgba = rgba; - m_rgbaIsValid = true; -} - -//--------------------------------------------------------------------- - -kpColor::kpColor (const kpColor &rhs) - : m_rgbaIsValid (rhs.m_rgbaIsValid), - m_rgba (rhs.m_rgba), - m_colorCacheIsValid (rhs.m_colorCacheIsValid), - m_colorCache (rhs.m_colorCache) -{ -#if DEBUG_KP_COLOR - kDebug () << "kpColor::()"; -#endif -} - -//--------------------------------------------------------------------- - -// friend -QDataStream &operator<< (QDataStream &stream, const kpColor &color) -{ - stream << int (color.m_rgbaIsValid) << int (color.m_rgba); - - return stream; -} - -//--------------------------------------------------------------------- - -// friend -QDataStream &operator>> (QDataStream &stream, kpColor &color) -{ - int a, b; - stream >> a >> b; - color.m_rgbaIsValid = a; - color.m_rgba = b; - - color.m_colorCacheIsValid = false; - - return stream; -} - -//--------------------------------------------------------------------- - -kpColor &kpColor::operator= (const kpColor &rhs) -{ - // (as soon as you add a ptr, you won't be complaining to me that this - // method was unnecessary :)) - - if (this == &rhs) - return *this; - - m_rgbaIsValid = rhs.m_rgbaIsValid; - m_rgba = rhs.m_rgba; - m_colorCacheIsValid = rhs.m_colorCacheIsValid; - m_colorCache = rhs.m_colorCache; - - return *this; -} - -bool kpColor::operator== (const kpColor &rhs) const -{ - return isSimilarTo (rhs, kpColor::Exact); -} - -bool kpColor::operator!= (const kpColor &rhs) const -{ - return !(*this == rhs); -} - -//--------------------------------------------------------------------- - - -template -inline dtype square (dtype val) -{ - return val * val; -} - -//--------------------------------------------------------------------- - -// public static -int kpColor::processSimilarity (double colorSimilarity) -{ - // sqrt (dr ^ 2 + dg ^ 2 + db ^ 2) <= colorSimilarity * sqrt (255 ^ 2 * 3) - // dr ^ 2 + dg ^ 2 + db ^ 2 <= (colorSimilarity ^ 2) * (255 ^ 2 * 3) - - return int (square (colorSimilarity) * (square (255) * 3)); -} - -//--------------------------------------------------------------------- - -bool kpColor::isSimilarTo (const kpColor &rhs, int processedSimilarity) const -{ - // Are we the same? - if (this == &rhs) - return true; - - - // Do we dither in terms of validity? - if (isValid () != rhs.isValid ()) - return false; - - // Are both of us invalid? - if (!isValid ()) - return true; - - // --- both are now valid --- - - if (m_rgba == rhs.m_rgba) - return true; - - if (processedSimilarity == kpColor::Exact) - return false; - else - { - return (square (qRed (m_rgba) - qRed (rhs.m_rgba)) + - square (qGreen (m_rgba) - qGreen (rhs.m_rgba)) + - square (qBlue (m_rgba) - qBlue (rhs.m_rgba)) - <= processedSimilarity); - } -} - -//--------------------------------------------------------------------- - -// public -bool kpColor::isValid () const -{ - return m_rgbaIsValid; -} - -//--------------------------------------------------------------------- - -// public -int kpColor::red () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::red() called with invalid kpColor" << endl; - return 0; - } - - return qRed (m_rgba); -} - -//--------------------------------------------------------------------- - -// public -int kpColor::green () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::green() called with invalid kpColor" << endl; - return 0; - } - - return qGreen (m_rgba); -} - -//--------------------------------------------------------------------- - -// public -int kpColor::blue () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::blue() called with invalid kpColor" << endl; - return 0; - } - - return qBlue (m_rgba); -} - -//--------------------------------------------------------------------- - -// public -int kpColor::alpha () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::alpha() called with invalid kpColor" << endl; - return 0; - } - - return qAlpha (m_rgba); -} - -//--------------------------------------------------------------------- - -// public -bool kpColor::isTransparent () const -{ - return (alpha () == 0); -} - -//--------------------------------------------------------------------- - -// public -QRgb kpColor::toQRgb () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::toQRgb() called with invalid kpColor" << endl; - return 0; - } - - return m_rgba; -} - -//--------------------------------------------------------------------- - -// public -QColor kpColor::toQColor () const -{ - if (!m_rgbaIsValid) - { - kError () << "kpColor::toQColor() called with invalid kpColor" << endl; - return Qt::black; - } - - if (m_colorCacheIsValid) - return m_colorCache; - - m_colorCache = QColor(qRed(m_rgba), qGreen(m_rgba), qBlue(m_rgba), qAlpha(m_rgba)); - m_colorCacheIsValid = true; - - return m_colorCache; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/kpColor.h b/kolourpaint/imagelib/kpColor.h deleted file mode 100644 index c9942786..00000000 --- a/kolourpaint/imagelib/kpColor.h +++ /dev/null @@ -1,156 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_COLOR_H -#define KP_COLOR_H - - -#include - - -#include - - -// -// kpColor is an object-oriented abstraction of QRgb, for document image data. -// In the future, other color models such as -// 8-bit indexed will be supported. It also provides better error handling, -// reporting (noisy kError()'s) and recovery compared to Qt. This abstraction -// will allow us to eventually dump the Qt paint routines. -// -// In general, you should pass around kpColor objects instead of QRgb -// and QColor. Only convert an opaque kpColor to a QColor (using toQColor()) -// if you need to draw something on-screen. -// -// Constructing a kpColor object from QColor is usually wrong since QColor's -// come from on-screen pixels, which may lack the full color resolution of -// kpColor, due to the limited color range on e.g. a 16-bit screen. -// -class kpColor -{ -public: - kpColor (); - kpColor (int red, int green, int blue, bool isTransparent = false); - kpColor (const QRgb &rgba); - kpColor (const kpColor &rhs); - friend QDataStream &operator<< (QDataStream &stream, const kpColor &color); - friend QDataStream &operator>> (QDataStream &stream, kpColor &color); - kpColor &operator= (const kpColor &rhs); - bool operator== (const kpColor &rhs) const; - bool operator!= (const kpColor &rhs) const; - - -// -// Constants -// -public: - // "lhs.isSimilarTo (rhs, kpColor::Exact)" is exactly the same as calling - // "lhs == rhs". - static const int Exact; - - static const kpColor Invalid; - static const kpColor Transparent; - - - // - // Primary Colors + B&W - // - - static const kpColor Red, Green, Blue; - static const kpColor Black, White; - - - // - // Full-brightness Colors - // - - static const kpColor Yellow, Purple, Aqua; - - - // - // Mixed Colors - // - - static const kpColor Gray, LightGray, Orange; - - - // - // Pastel Colors - // - - static const kpColor Pink, LightGreen, LightBlue, Tan; - - - // - // Dark Colors - // - - static const kpColor DarkRed; - - // (identical) - static const kpColor DarkOrange, Brown; - - static const kpColor DarkYellow, DarkGreen, DarkAqua, DarkBlue, - DarkPurple, DarkGray; - - -public: - static int processSimilarity (double colorSimilarity); - // Usage: isSimilarTo (rhs, kpColor::processSimilarity (.1)) checks for - // Color Similarity within 10% - bool isSimilarTo (const kpColor &rhs, int processedSimilarity) const; - - bool isValid () const; - - int red () const; - int green () const; - int blue () const; - int alpha () const; - bool isTransparent () const; - - // Cast operators will most likely result in careless conversions so - // use explicit functions instead: - QRgb toQRgb () const; - - QColor toQColor () const; - -private: - // Catch accidental call to "const QRgb &rgba" (unsigned int) ctor - // by e.g. "kpColor(Qt::black)" (Qt::black is an enum element that can cast - // to "unsigned int"). - kpColor (Qt::GlobalColor color); - - bool m_rgbaIsValid; - QRgb m_rgba; - - mutable bool m_colorCacheIsValid; - mutable QColor m_colorCache; -}; - - -#endif // KP_COLOR_H diff --git a/kolourpaint/imagelib/kpColor_Constants.cpp b/kolourpaint/imagelib/kpColor_Constants.cpp deleted file mode 100644 index 4b519269..00000000 --- a/kolourpaint/imagelib/kpColor_Constants.cpp +++ /dev/null @@ -1,117 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR 0 - - -#include - - -static inline int RoundUp2 (int val) -{ - return val % 2 ? val + 1 : val; -} - -static inline int Bound0_255 (int val) -{ - return qBound (0, val, 255); -} - - -enum -{ - BlendDark = 25, - BlendNormal = 50, - BlendLight = 75, - BlendAdd = 100 -}; - -// Adds the 2 given colors together and then multiplies by the given . -static inline kpColor Blend (const kpColor &a, const kpColor &b, - int percent = ::BlendNormal) -{ - return kpColor (::Bound0_255 (::RoundUp2 (a.red () + b.red ()) * percent / 100), - ::Bound0_255 (::RoundUp2 (a.green () + b.green ()) * percent / 100), - ::Bound0_255 (::RoundUp2 (a.blue () + b.blue ()) * percent / 100)); -} - -static inline kpColor Add (const kpColor &a, const kpColor &b) -{ - return ::Blend (a, b, ::BlendAdd); -} - - -// (intentionally _not_ an HSV darkener) -static inline kpColor Dark (const kpColor &color) -{ - return ::Blend (color, kpColor::Black); -} - - -// public static -const int kpColor::Exact = 0; - -// public static -const kpColor kpColor::Invalid; // LOTODO: what's wrong with explicitly specifying () constructor? -const kpColor kpColor::Transparent (0, 0, 0, true/*isTransparent*/); - - -// -// Make our own colors in case weird ones like "Qt::cyan" -// (turquoise) get changed by Qt. -// - - -const kpColor kpColor::Red (255, 0, 0); -const kpColor kpColor::Green (0, 255, 0); -const kpColor kpColor::Blue (0, 0, 255); -const kpColor kpColor::Black (0, 0, 0); -const kpColor kpColor::White (255, 255, 255); - -const kpColor kpColor::Yellow = ::Add (kpColor::Red, kpColor::Green); -const kpColor kpColor::Purple = ::Add (kpColor::Red, kpColor::Blue); -const kpColor kpColor::Aqua = ::Add (kpColor::Green, kpColor::Blue); - -const kpColor kpColor::Gray = ::Blend (kpColor::Black, kpColor::White); -const kpColor kpColor::LightGray = ::Blend (kpColor::Gray, kpColor::White); -const kpColor kpColor::Orange = ::Blend (kpColor::Red, kpColor::Yellow); - -const kpColor kpColor::Pink = ::Blend (kpColor::Red, kpColor::White); -const kpColor kpColor::LightGreen = ::Blend (kpColor::Green, kpColor::White); -const kpColor kpColor::LightBlue = ::Blend (kpColor::Blue, kpColor::White); -const kpColor kpColor::Tan = ::Blend (kpColor::Yellow, kpColor::White); - -const kpColor kpColor::DarkRed = ::Dark (kpColor::Red); -const kpColor kpColor::DarkOrange = ::Dark (kpColor::Orange); -const kpColor kpColor::Brown = kpColor::DarkOrange; -const kpColor kpColor::DarkYellow = ::Dark (kpColor::Yellow); -const kpColor kpColor::DarkGreen = ::Dark (kpColor::Green); -const kpColor kpColor::DarkAqua = ::Dark (kpColor::Aqua); -const kpColor kpColor::DarkBlue = ::Dark (kpColor::Blue); -const kpColor kpColor::DarkPurple = ::Dark (kpColor::Purple); -const kpColor kpColor::DarkGray = ::Dark (kpColor::Gray); diff --git a/kolourpaint/imagelib/kpDocumentMetaInfo.cpp b/kolourpaint/imagelib/kpDocumentMetaInfo.cpp deleted file mode 100644 index 55fb55b6..00000000 --- a/kolourpaint/imagelib/kpDocumentMetaInfo.cpp +++ /dev/null @@ -1,283 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include - -#include - -#include - - -// -// Constants which "ought to be enough for anybody" -// LOTODO: Maybe there are some QImage constants somewhere? -// - -// public static - -// (round up to guarantee at least 1 dot per inch) -const int kpDocumentMetaInfo::MinDotsPerMeter = - int (ceil (1/*single dot per inch - a very low DPI*/ * KP_INCHES_PER_METER) + .1); - -const int kpDocumentMetaInfo::MaxDotsPerMeter = - int ((600 * 100)/*a lot of DPI*/ * KP_INCHES_PER_METER); - -// public static -const int kpDocumentMetaInfo::MaxOffset = (4000/*big image*/ * 100)/*a very big image*/; -const int kpDocumentMetaInfo::MinOffset = -kpDocumentMetaInfo::MaxOffset; - -//--------------------------------------------------------------------- - -struct kpDocumentMetaInfoPrivate -{ - int m_dotsPerMeterX, m_dotsPerMeterY; - QPoint m_offset; - - QMap m_textMap; -}; - -//--------------------------------------------------------------------- - -// public -kpDocumentMetaInfo::kpDocumentMetaInfo () - : d (new kpDocumentMetaInfoPrivate ()) -{ - d->m_dotsPerMeterX = 0; - d->m_dotsPerMeterY = 0; - d->m_offset = QPoint (0, 0); -} - -//--------------------------------------------------------------------- - -kpDocumentMetaInfo::kpDocumentMetaInfo (const kpDocumentMetaInfo &rhs) - : d (new kpDocumentMetaInfoPrivate ()) -{ - d->m_dotsPerMeterX = rhs.dotsPerMeterX (); - d->m_dotsPerMeterY = rhs.dotsPerMeterY (); - d->m_offset = rhs.offset (); - d->m_textMap = rhs.textMap (); -} - -//--------------------------------------------------------------------- - -// public -kpDocumentMetaInfo::~kpDocumentMetaInfo () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentMetaInfo::operator== (const kpDocumentMetaInfo &rhs) const -{ - return (d->m_dotsPerMeterX == rhs.d->m_dotsPerMeterX && - d->m_dotsPerMeterY == rhs.d->m_dotsPerMeterY && - d->m_offset == rhs.d->m_offset && - d->m_textMap == rhs.d->m_textMap); -} - -//--------------------------------------------------------------------- - -// public -bool kpDocumentMetaInfo::operator!= (const kpDocumentMetaInfo &rhs) const -{ - return !(*this == rhs); -} - -//--------------------------------------------------------------------- - -// public -kpDocumentMetaInfo &kpDocumentMetaInfo::operator= (const kpDocumentMetaInfo &rhs) -{ - if (this == &rhs) - return *this; - - d->m_dotsPerMeterX = rhs.dotsPerMeterX (); - d->m_dotsPerMeterY = rhs.dotsPerMeterY (); - d->m_offset = rhs.offset (); - d->m_textMap = rhs.textMap (); - - return *this; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentMetaInfo::printDebug (const QString &prefix) const -{ - const QString usedPrefix = !prefix.isEmpty() ? QString(prefix + QLatin1String(":")) : QString(); - - kDebug () << usedPrefix; - - kDebug () << "dotsPerMeter X=" << dotsPerMeterX () - << " Y=" << dotsPerMeterY () - << " offset=" << offset () << endl; - - QList keyList = textKeys (); - for (QList ::const_iterator it = keyList.constBegin (); - it != keyList.constEnd (); - ++it) - { - kDebug () << "key=" << (*it) - << " text=" << text (*it) - << endl; - } - - kDebug () << usedPrefix << "ENDS"; -} - -//--------------------------------------------------------------------- - -// public -kpCommandSize::SizeType kpDocumentMetaInfo::size () const -{ - kpCommandSize::SizeType ret = 0; - - foreach (const QString &key, d->m_textMap.keys ()) - { - ret += kpCommandSize::StringSize (key) + - kpCommandSize::StringSize (d->m_textMap [key]); - } - - // We don't know what the QMap size overhead is so overestimate the size - // rather than underestimating it. - // LOTODO: Find the proper size in bytes. - return ret * 3; -} - -//--------------------------------------------------------------------- - -// public -int kpDocumentMetaInfo::dotsPerMeterX () const -{ - return d->m_dotsPerMeterX; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentMetaInfo::setDotsPerMeterX (int val) -{ - // Unspecified resolution? - if (val == 0) - { - d->m_dotsPerMeterX = 0; - return; - } - - d->m_dotsPerMeterX = qBound (MinDotsPerMeter, val, MaxDotsPerMeter); -} - -//--------------------------------------------------------------------- - -// public -int kpDocumentMetaInfo::dotsPerMeterY () const -{ - return d->m_dotsPerMeterY; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentMetaInfo::setDotsPerMeterY (int val) -{ - // Unspecified resolution? - if (val == 0) - { - d->m_dotsPerMeterY = 0; - return; - } - - d->m_dotsPerMeterY = qBound (MinDotsPerMeter, val, MaxDotsPerMeter); -} - -//--------------------------------------------------------------------- - -// public -QPoint kpDocumentMetaInfo::offset () const -{ - return d->m_offset; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentMetaInfo::setOffset (const QPoint &point) -{ - const int x = qBound (MinOffset, point.x (), MaxOffset); - const int y = qBound (MinOffset, point.y (), MaxOffset); - - d->m_offset = QPoint (x, y); -} - -//--------------------------------------------------------------------- - -// public -QMap kpDocumentMetaInfo::textMap () const -{ - return d->m_textMap; -} - -//--------------------------------------------------------------------- - -// public -QList kpDocumentMetaInfo::textKeys () const -{ - return d->m_textMap.keys (); -} - -//--------------------------------------------------------------------- - -// public -QString kpDocumentMetaInfo::text (const QString &key) const -{ - if (key.isEmpty ()) - return QString (); - - return d->m_textMap [key]; -} - -//--------------------------------------------------------------------- - -// public -void kpDocumentMetaInfo::setText (const QString &key, const QString &value) -{ - if (key.isEmpty ()) - return; - - d->m_textMap [key] = value; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/kpDocumentMetaInfo.h b/kolourpaint/imagelib/kpDocumentMetaInfo.h deleted file mode 100644 index 23538305..00000000 --- a/kolourpaint/imagelib/kpDocumentMetaInfo.h +++ /dev/null @@ -1,108 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_DOCUMENT_META_INFO_H -#define KP_DOCUMENT_META_INFO_H - - -#include -#include -#include -#include - -#include - - -#include -#include - - -class kpDocumentMetaInfo -{ -public: - kpDocumentMetaInfo (); - kpDocumentMetaInfo (const kpDocumentMetaInfo &rhs); - virtual ~kpDocumentMetaInfo (); - - bool operator== (const kpDocumentMetaInfo &rhs) const; - bool operator!= (const kpDocumentMetaInfo &rhs) const; - - kpDocumentMetaInfo &operator= (const kpDocumentMetaInfo &rhs); - - - void printDebug (const QString &prefix) const; - - - kpCommandSize::SizeType size () const; - - - // - // Constants (enforced by methods) - // - - static const int MinDotsPerMeter, MaxDotsPerMeter; - static const int MinOffset, MaxOffset; - - - // See QImage documentation - - // is 0 if the resolution is unspecified. - // Else, these methods automatically bound to be between - // MinDotsPerMeter ... MaxDotsPerMeter inclusive. - int dotsPerMeterX () const; - void setDotsPerMeterX (int val); - - // is 0 if the resolution is unspecified. - // Else, these methods automatically bound to be between - // MinDotsPerMeter ... MaxDotsPerMeter inclusive. - int dotsPerMeterY () const; - void setDotsPerMeterY (int val); - - - // These methods automatically bound each of X and Y to be between - // MinOffset and MaxOffset inclusive. - QPoint offset () const; - void setOffset (const QPoint &point); - - - QMap textMap () const; - QList textKeys () const; - - // (if is empty, it returns an empty string) - QString text (const QString &key) const; - - // (if is empty, the operation is ignored) - void setText (const QString &key, const QString &value); - - -private: - struct kpDocumentMetaInfoPrivate *d; -}; - - -#endif // KP_DOCUMENT_META_INFO_H diff --git a/kolourpaint/imagelib/kpFloodFill.cpp b/kolourpaint/imagelib/kpFloodFill.cpp deleted file mode 100644 index 115d03be..00000000 --- a/kolourpaint/imagelib/kpFloodFill.cpp +++ /dev/null @@ -1,413 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_FLOOD_FILL 0 - - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -class kpFillLine -{ -public: - kpFillLine (int y = -1, int x1 = -1, int x2 = -1) - : m_y (y), m_x1 (x1), m_x2 (x2) - { - } - - static kpCommandSize::SizeType size () - { - return sizeof (kpFillLine); - } - - int m_y, m_x1, m_x2; -}; - -//--------------------------------------------------------------------- - -static kpCommandSize::SizeType FillLinesListSize (const QLinkedList &fillLines) -{ - return (fillLines.size () * kpFillLine::size ()); -} - -//--------------------------------------------------------------------- - -struct kpFloodFillPrivate -{ - // - // Copy of whatever was passed to the constructor. - // - - kpImage *imagePtr; - int x, y; - kpColor color; - int processedColorSimilarity; - - - // - // Set by Step 1. - // - - kpColor colorToChange; - - - // - // Set by Step 2. - // - - QLinkedList fillLines; - QList < QLinkedList > fillLinesCache; - - QRect boundingRect; - - bool prepared; -}; - -//--------------------------------------------------------------------- - -kpFloodFill::kpFloodFill (kpImage *image, int x, int y, - const kpColor &color, int processedColorSimilarity) - : d (new kpFloodFillPrivate ()) -{ - d->imagePtr = image; - d->x = x, d->y = y; - d->color = color, d->processedColorSimilarity = processedColorSimilarity; - - d->prepared = false; -} - -//--------------------------------------------------------------------- - -kpFloodFill::~kpFloodFill () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public -kpColor kpFloodFill::color () const -{ - return d->color; -} - -//--------------------------------------------------------------------- - -// public -int kpFloodFill::processedColorSimilarity () const -{ - return d->processedColorSimilarity; -} - -//--------------------------------------------------------------------- - -// public -kpCommandSize::SizeType kpFloodFill::size () const -{ - kpCommandSize::SizeType fillLinesCacheSize = 0; - foreach (const QLinkedList &linesList, d->fillLinesCache) - { - fillLinesCacheSize += ::FillLinesListSize (linesList); - } - - return ::FillLinesListSize(d->fillLines) + - kpCommandSize::QImageSize(d->imagePtr) + - fillLinesCacheSize; -} - -//--------------------------------------------------------------------- - -// public -void kpFloodFill::prepareColorToChange () -{ - if (d->colorToChange.isValid ()) - return; - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "kpFloodFill::prepareColorToChange()"; -#endif - - d->colorToChange = kpPixmapFX::getColorAtPixel (*d->imagePtr, QPoint (d->x, d->y)); -} - -//--------------------------------------------------------------------- - -// public -kpColor kpFloodFill::colorToChange () -{ - prepareColorToChange (); - - return d->colorToChange; -} - -//--------------------------------------------------------------------- - -// Derived from the zSprite2 Graphics Engine - -// private -kpColor kpFloodFill::pixelColor (int x, int y, bool *beenHere) const -{ - if (beenHere) - *beenHere = false; - - Q_ASSERT (y >= 0 && y < (int) d->fillLinesCache.count ()); - - foreach (const kpFillLine &line, d->fillLinesCache [y]) - { - if (x >= line.m_x1 && x <= line.m_x2) - { - if (beenHere) - *beenHere = true; - return d->color; - } - } - - return kpPixmapFX::getColorAtPixel (*(d->imagePtr), QPoint (x, y)); -} - -//--------------------------------------------------------------------- - -// private -bool kpFloodFill::shouldGoTo (int x, int y) const -{ - bool beenThere; - const kpColor col = pixelColor (x, y, &beenThere); - - return (!beenThere && col.isSimilarTo (d->colorToChange, d->processedColorSimilarity)); -} - -//--------------------------------------------------------------------- - -// private -int kpFloodFill::findMinX (int y, int x) const -{ - for (;;) - { - if (x < 0) - return 0; - - if (shouldGoTo (x, y)) - x--; - else - return x + 1; - } -} - -//--------------------------------------------------------------------- - -// private -int kpFloodFill::findMaxX (int y, int x) const -{ - for (;;) - { - if (x > d->imagePtr->width () - 1) - return d->imagePtr->width () - 1; - - if (shouldGoTo (x, y)) - x++; - else - return x - 1; - } -} - -//--------------------------------------------------------------------- - -// private -void kpFloodFill::addLine (int y, int x1, int x2) -{ -#if DEBUG_KP_FLOOD_FILL && 0 - kDebug () << "kpFillCommand::fillAddLine (" - << y << "," << x1 << "," << x2 << ")" << endl; -#endif - - d->fillLines.append (kpFillLine (y, x1, x2)); - d->fillLinesCache [y].append ( - kpFillLine (y/*OPT: can determine from array index*/, x1, x2)); - d->boundingRect = d->boundingRect.united (QRect (QPoint (x1, y), QPoint (x2, y))); -} - -//--------------------------------------------------------------------- - -// private -void kpFloodFill::findAndAddLines (const kpFillLine &fillLine, int dy) -{ - // out of bounds? - if (fillLine.m_y + dy < 0 || fillLine.m_y + dy >= d->imagePtr->height ()) - return; - - for (int xnow = fillLine.m_x1; xnow <= fillLine.m_x2; xnow++) - { - // At current position, right colour? - if (shouldGoTo (xnow, fillLine.m_y + dy)) - { - // Find minimum and maximum x values - int minxnow = findMinX (fillLine.m_y + dy, xnow); - int maxxnow = findMaxX (fillLine.m_y + dy, xnow); - - // Draw line - addLine (fillLine.m_y + dy, minxnow, maxxnow); - - // Move x pointer - xnow = maxxnow; - } - } -} - -//--------------------------------------------------------------------- - -// public -void kpFloodFill::prepare () -{ - if (d->prepared) - return; - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "kpFloodFill::prepare()"; -#endif - - prepareColorToChange (); - - d->boundingRect = QRect (); - - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "\tperforming NOP check"; -#endif - - // get the color we need to replace - if (d->processedColorSimilarity == 0 && d->color == d->colorToChange) - { - // need to do absolutely nothing (this is a significant optimization - // for people who randomly click a lot over already-filled areas) - d->prepared = true; // sync with all "return true"'s - return; - } - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "\tcreating fillLinesCache"; -#endif - - // ready cache - for (int i = 0; i < d->imagePtr->height (); i++) - d->fillLinesCache.append (QLinkedList ()); - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "\tcreating fill lines"; -#endif - - // draw initial line - addLine (d->y, findMinX (d->y, d->x), findMaxX (d->y, d->x)); - - for (QLinkedList ::ConstIterator it = d->fillLines.begin (); - it != d->fillLines.end (); - ++it) - { - #if DEBUG_KP_FLOOD_FILL && 0 - kDebug () << "Expanding from y=" << (*it).m_y - << " x1=" << (*it).m_x1 - << " x2=" << (*it).m_x2 - << endl; - #endif - - // - // Make more lines above and below current line. - // - // WARNING: Adds to end of "fillLines" (the linked list we are iterating - // through). Therefore, "fillLines" must remain a linked list - // - you cannot change it into a vector. Also, do not use - // "foreach" for this loop as that makes a copy of the linked - // list at the start and won't see new lines. - // - findAndAddLines (*it, -1); - findAndAddLines (*it, +1); - } - -#if DEBUG_KP_FLOOD_FILL && 1 - kDebug () << "\tfinalising memory usage"; -#endif - - // finalize memory usage - d->fillLinesCache.clear (); - - d->prepared = true; // sync with all "return true"'s -} - -//--------------------------------------------------------------------- - -// public -QRect kpFloodFill::boundingRect () -{ - prepare (); - - return d->boundingRect; -} - -//--------------------------------------------------------------------- -// public -void kpFloodFill::fill() -{ - prepare(); - - QApplication::setOverrideCursor(Qt::WaitCursor); - - QPainter painter(d->imagePtr); - - // by definition, flood fill with a fully transparent color erases the pixels - // and sets them to be fully transparent - if ( d->color.isTransparent() ) - painter.setCompositionMode(QPainter::CompositionMode_Clear); - - painter.setPen(d->color.toQColor()); - - foreach (const kpFillLine &l, d->fillLines) - { - if ( l.m_x1 == l.m_x2 ) - painter.drawPoint(l.m_x1, l.m_y); - else - painter.drawLine(l.m_x1, l.m_y, l.m_x2, l.m_y); - } - - QApplication::restoreOverrideCursor(); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/kpFloodFill.h b/kolourpaint/imagelib/kpFloodFill.h deleted file mode 100644 index 195bcbf6..00000000 --- a/kolourpaint/imagelib/kpFloodFill.h +++ /dev/null @@ -1,128 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_FLOOD_FILL_H -#define KP_FLOOD_FILL_H - - -#include -#include - - -class kpColor; -class kpFillLine; - - -struct kpFloodFillPrivate; - -class kpFloodFill -{ -public: - kpFloodFill (kpImage *image, int x, int y, - const kpColor &color, - int processedColorSimilarity); - ~kpFloodFill (); - - - // - // Spits back constructor arguments. - // - -public: - kpColor color () const; - int processedColorSimilarity () const; - - -public: - // Used for calculating the size of a command in the command history. - kpCommandSize::SizeType size () const; - - - // - // Step 1: Determines the colour that will be changed to color(). - // - // Very fast. - // - -public: - void prepareColorToChange (); - - // (may invoke prepareColorToChange()). - kpColor colorToChange (); - - - // - // Step 2: Determines the scanlines / pixels that will be changed to color(). - // - // The slowest part of the whole fill operation. - // - // Before calling a Step 2 function, you don't have to (but you can) - // call any of the functions in Step 1. - // - -private: - kpColor pixelColor (int x, int y, bool *beenHere = 0) const; - bool shouldGoTo (int x, int y) const; - - // Finds the minimum x value at a certain line to be filled. - int findMinX (int y, int x) const; - - // Finds the maximum x value at a certain line to be filled. - int findMaxX (int y, int x) const; - - void addLine (int y, int x1, int x2); - void findAndAddLines (const kpFillLine &fillLine, int dy); - -public: - // (may invoke Step 1's prepareColorToChange()) - void prepare (); - - // (may invoke prepare()) - QRect boundingRect (); - - - // - // Step 3: Draws the lines identified in Step 2 in color(). - // - // Between the speeds of Step 2 and Step 1. - // - // Before calling a Step 3 function, you don't have to (but you can) - // call any of the functions in Step 1 or 2. - // - -public: - // (may invoke Step 2's prepare()) - void fill (); - - -private: - kpFloodFillPrivate * const d; -}; - - -#endif // KP_FLOOD_FILL_H diff --git a/kolourpaint/imagelib/kpImage.h b/kolourpaint/imagelib/kpImage.h deleted file mode 100644 index 428f94b1..00000000 --- a/kolourpaint/imagelib/kpImage.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_IMAGE_H -#define KP_IMAGE_H - - -#include - -typedef QImage kpImage; - - -#endif // KP_IMAGE_H diff --git a/kolourpaint/imagelib/kpPainter.cpp b/kolourpaint/imagelib/kpPainter.cpp deleted file mode 100644 index f2658d08..00000000 --- a/kolourpaint/imagelib/kpPainter.cpp +++ /dev/null @@ -1,600 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PAINTER 0 - - -#include - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// public static -bool kpPainter::pointsAreCardinallyAdjacent (const QPoint &p, const QPoint &q) -{ - int dx = qAbs (p.x () - q.x ()); - int dy = qAbs (p.y () - q.y ()); - - return (dx + dy == 1); -} - -//--------------------------------------------------------------------- - -// Returns a random integer from 0 to 999 inclusive. -static int RandomNumberFrom0to999 () -{ - return (KRandom::random () % 1000); -} - -//--------------------------------------------------------------------- - -// public static -QList kpPainter::interpolatePoints (const QPoint &startPoint, - const QPoint &endPoint, - bool cardinalAdjacency, - double probability) -{ -#if DEBUG_KP_PAINTER - kDebug () << "CALL(startPoint=" << startPoint - << ",endPoint=" << endPoint << ")"; -#endif - - QList ret; - - Q_ASSERT (probability >= 0.0 && probability <= 1.0); - const int probabilityTimes1000 = qRound (probability * 1000); -#define SHOULD_DRAW() (probabilityTimes1000 == 1000/*avoid ::RandomNumberFrom0to999() call*/ || \ - ::RandomNumberFrom0to999 () < probabilityTimes1000) - -#if 0 - kDebug () << "prob=" << probability - << " *1000=" << probabilityTimes1000; -#endif - - - // Derived from the zSprite2 Graphics Engine. - // "MODIFIED" comment shows deviation from zSprite2 and Bresenham's line - // algorithm. - - const int x1 = startPoint.x (), - y1 = startPoint.y (), - x2 = endPoint.x (), - y2 = endPoint.y (); - - // Difference of x and y values - const int dx = x2 - x1; - const int dy = y2 - y1; - - // Absolute values of differences - const int ix = qAbs (dx); - const int iy = qAbs (dy); - - // Larger of the x and y differences - const int inc = ix > iy ? ix : iy; - - // Plot location - int plotx = x1; - int ploty = y1; - - int x = 0; - int y = 0; - - if (SHOULD_DRAW ()) - ret.append (QPoint (plotx, ploty)); - - - for (int i = 0; i <= inc; i++) - { - // oldplotx is equally as valid but would look different - // (but nobody will notice which one it is) - const int oldploty = ploty; - int plot = 0; - - x += ix; - y += iy; - - if (x > inc) - { - plot++; - x -= inc; - - if (dx < 0) - plotx--; - else - plotx++; - } - - if (y > inc) - { - plot++; - y -= inc; - - if (dy < 0) - ploty--; - else - ploty++; - } - - if (plot) - { - if (cardinalAdjacency && plot == 2) - { - // MODIFIED: Every point is - // horizontally or vertically adjacent to another point (if there - // is more than 1 point, of course). This is in contrast to the - // ordinary line algorithm which can create diagonal adjacencies. - - if (SHOULD_DRAW ()) - ret.append (QPoint (plotx, oldploty)); - } - - if (SHOULD_DRAW ()) - ret.append (QPoint (plotx, ploty)); - } - } - -#undef SHOULD_DRAW - - return ret; -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::drawLine (kpImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth) -{ - kpPixmapFX::drawLine (image, x1, y1, x2, y2, color, penWidth); -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::drawPolyline (kpImage *image, - const QPolygon &points, - const kpColor &color, int penWidth) -{ - kpPixmapFX::drawPolyline (image, points, color, penWidth); -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::drawPolygon (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal) -{ - kpPixmapFX::drawPolygon (image, points, fcolor, penWidth, bcolor, isFinal); -} - -//--------------------------------------------------------------------- - - -// public static -void kpPainter::drawCurve (kpImage *image, - const QPoint &startPoint, - const QPoint &controlPointP, const QPoint &controlPointQ, - const QPoint &endPoint, - const kpColor &color, int penWidth) -{ - kpPixmapFX::drawCurve (image, - startPoint, controlPointP, controlPointQ, endPoint, color, penWidth); -} - -//--------------------------------------------------------------------- - - -// public static -void kpPainter::fillRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &color) -{ - kpPixmapFX::fillRect (image, x, y, width, height, color); -} - -//--------------------------------------------------------------------- - - -// public static -void kpPainter::drawRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor) -{ - kpPixmapFX::drawRect (image, x, y, width, height, fcolor, penWidth, bcolor); -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::drawRoundedRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor) -{ - kpPixmapFX::drawRoundedRect (image, x, y, width, height, fcolor, penWidth, bcolor); -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::drawEllipse (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor) -{ - kpPixmapFX::drawEllipse (image, x, y, width, height, fcolor, penWidth, bcolor); -} - -//--------------------------------------------------------------------- - - -// are operating on the original image -// (the original image is not passed to this function). -// -// = subset of the original image containing all the pixels in -// -// = the rectangle, relative to the painters, whose pixels we -// want to change -static bool ReadableImageWashRect (QPainter *rgbPainter, - const QImage &image, - const kpColor &colorToReplace, - const QRect &imageRect, const QRect &drawRect, - int processedColorSimilarity) -{ - bool didSomething = false; - -#if DEBUG_KP_PAINTER && 0 - kDebug () << "kppixmapfx.cpp:WashRect(imageRect=" << imageRect - << ",drawRect=" << drawRect - << ")" << endl; -#endif - - // If you're going to pass painter pointers, those painters had better be - // active (i.e. QPainter::begin() has been called). - Q_ASSERT (!rgbPainter || rgbPainter->isActive ()); - -// make use of scanline coherence -#define FLUSH_LINE() \ -{ \ - if (rgbPainter) { \ - if (startDrawX == x - 1) \ - rgbPainter->drawPoint (startDrawX + imageRect.x (), \ - y + imageRect.y ()); \ - else \ - rgbPainter->drawLine (startDrawX + imageRect.x (), \ - y + imageRect.y (), \ - x - 1 + imageRect.x (), \ - y + imageRect.y ()); \ - } \ - didSomething = true; \ - startDrawX = -1; \ -} - - const int maxY = drawRect.bottom () - imageRect.top (); - - const int minX = drawRect.left () - imageRect.left (); - const int maxX = drawRect.right () - imageRect.left (); - - for (int y = drawRect.top () - imageRect.top (); - y <= maxY; - y++) - { - int startDrawX = -1; - - int x; // for FLUSH_LINE() - for (x = minX; x <= maxX; x++) - { - #if DEBUG_KP_PAINTER && 0 - fprintf (stderr, "y=%i x=%i colorAtPixel=%08X colorToReplace=%08X ... ", - y, x, - kpPixmapFX::getColorAtPixel (image, QPoint (x, y)).toQRgb (), - colorToReplace.toQRgb ()); - #endif - if (kpPixmapFX::getColorAtPixel (image, QPoint (x, y)).isSimilarTo (colorToReplace, processedColorSimilarity)) - { - #if DEBUG_KP_PAINTER && 0 - fprintf (stderr, "similar\n"); - #endif - if (startDrawX < 0) - startDrawX = x; - } - else - { - #if DEBUG_KP_PAINTER && 0 - fprintf (stderr, "different\n"); - #endif - if (startDrawX >= 0) - FLUSH_LINE (); - } - } - - if (startDrawX >= 0) - FLUSH_LINE (); - } - -#undef FLUSH_LINE - - return didSomething; -} - -//--------------------------------------------------------------------- - -struct WashPack -{ - QPoint startPoint, endPoint; - kpColor color; - int penWidth, penHeight; - kpColor colorToReplace; - int processedColorSimilarity; - - QRect readableImageRect; - QImage readableImage; -}; - -//--------------------------------------------------------------------- - -static QRect Wash (kpImage *image, - const QPoint &startPoint, const QPoint &endPoint, - const kpColor &color, int penWidth, int penHeight, - const kpColor &colorToReplace, - int processedColorSimilarity, - QRect (*drawFunc) (QPainter * /*rgbPainter*/, void * /*data*/)) -{ - WashPack pack; - pack.startPoint = startPoint; pack.endPoint = endPoint; - pack.color = color; - pack.penWidth = penWidth; pack.penHeight = penHeight; - pack.colorToReplace = colorToReplace; - pack.processedColorSimilarity = processedColorSimilarity; - - - // Get the rectangle that bounds the changes and the pixmap for that - // rectangle. - const QRect normalizedRect = kpPainter::normalizedRect(pack.startPoint, pack.endPoint); - pack.readableImageRect = kpTool::neededRect (normalizedRect, - qMax (pack.penWidth, pack.penHeight)); -#if DEBUG_KP_PAINTER - kDebug () << "kppainter.cpp:Wash() startPoint=" << startPoint - << " endPoint=" << endPoint - << " --> normalizedRect=" << normalizedRect - << " readableImageRect=" << pack.readableImageRect - << endl; -#endif - pack.readableImage = kpPixmapFX::getPixmapAt (*image, pack.readableImageRect); - - QPainter painter(image); - return (*drawFunc)(&painter, &pack); -} - -//--------------------------------------------------------------------- - -void WashHelperSetup (QPainter *rgbPainter, const WashPack *pack) -{ - // Set the drawing colors for the painters. - - if (rgbPainter) - rgbPainter->setPen (pack->color.toQColor()); -} - -//--------------------------------------------------------------------- - -static QRect WashLineHelper (QPainter *rgbPainter, void *data) -{ -#if DEBUG_KP_PAINTER && 0 - kDebug () << "Washing pixmap (w=" << rect.width () - << ",h=" << rect.height () << ")" << endl; - QTime timer; - int convAndWashTime; -#endif - - WashPack *pack = static_cast (data); - - - // Setup painters. - ::WashHelperSetup (rgbPainter, pack); - - - bool didSomething = false; - - QList points = kpPainter::interpolatePoints (pack->startPoint, pack->endPoint); - for (QList ::const_iterator pit = points.constBegin (); - pit != points.constEnd (); - ++pit) - { - // OPT: This may be reading and possibly writing pixels that were - // visited on a previous iteration, since the pen is usually - // bigger than 1 pixel. Maybe we could use QRegion to determine - // all the non-intersecting regions and only wash each region once. - // - // Profiling needs to be done as QRegion is known to be a CPU hog. - if (::ReadableImageWashRect (rgbPainter, - pack->readableImage, - pack->colorToReplace, - pack->readableImageRect, - kpToolFlowBase::hotRectForMousePointAndBrushWidthHeight ( - *pit, pack->penWidth, pack->penHeight), - pack->processedColorSimilarity)) - { - didSomething = true; - } - } - - -#if DEBUG_KP_PAINTER && 0 - int ms = timer.restart (); - kDebug () << "\ttried to wash: " << ms << "ms" - << " (" << (ms ? (rect.width () * rect.height () / ms) : -1234) - << " pixels/ms)" - << endl; - convAndWashTime += ms; -#endif - - - // TODO: Rectangle may be too big. Use QRect::unite() incrementally? - // Efficiency? - return didSomething ? pack->readableImageRect : QRect (); -} - -//--------------------------------------------------------------------- - -// public static -QRect kpPainter::washLine (kpImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth, int penHeight, - const kpColor &colorToReplace, - int processedColorSimilarity) -{ - return ::Wash (image, - QPoint (x1, y1), QPoint (x2, y2), - color, penWidth, penHeight, - colorToReplace, - processedColorSimilarity, - &::WashLineHelper); -} - -//--------------------------------------------------------------------- - -static QRect WashRectHelper (QPainter *rgbPainter, void *data) -{ -#if DEBUG_KP_PAINTER && 0 - kDebug () << "Washing pixmap (w=" << rect.width () - << ",h=" << rect.height () << ")" << endl; - QTime timer; - int convAndWashTime; -#endif - - WashPack *pack = static_cast (data); - - - // Setup painters. - ::WashHelperSetup (rgbPainter, pack); - - - const QRect drawRect (pack->startPoint, pack->endPoint); - - bool didSomething = false; - - if (::ReadableImageWashRect (rgbPainter, - pack->readableImage, - pack->colorToReplace, - pack->readableImageRect, - drawRect, - pack->processedColorSimilarity)) - { - didSomething = true; - } - - -#if DEBUG_KP_PAINTER && 0 - int ms = timer.restart (); - kDebug () << "\ttried to wash: " << ms << "ms" - << " (" << (ms ? (rect.width () * rect.height () / ms) : -1234) - << " pixels/ms)" - << endl; - convAndWashTime += ms; -#endif - - - return didSomething ? drawRect : QRect (); -} - -//--------------------------------------------------------------------- - -// public static -QRect kpPainter::washRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &color, - const kpColor &colorToReplace, - int processedColorSimilarity) -{ - return ::Wash (image, - QPoint (x, y), QPoint (x + width - 1, y + height - 1), - color, 1/*pen width*/, 1/*pen height*/, - colorToReplace, - processedColorSimilarity, - &::WashRectHelper); -} - -//--------------------------------------------------------------------- - -// public static -void kpPainter::sprayPoints (kpImage *image, - const QList &points, - const kpColor &color, - int spraycanSize) -{ -#if DEBUG_KP_PAINTER - kDebug () << "kpPainter::sprayPoints()"; -#endif - - Q_ASSERT (spraycanSize > 0); - - QPainter painter(image); - const int radius = spraycanSize / 2; - - // Set the drawing colors for the painters. - - painter.setPen(color.toQColor()); - - foreach (const QPoint &p, points) - { - for (int i = 0; i < 10; i++) - { - const int dx = (KRandom::random () % spraycanSize) - radius; - const int dy = (KRandom::random () % spraycanSize) - radius; - - // Make it look circular. - // TODO: Can be done better by doing a random vector angle & length - // but would sin and cos be too slow? - if ((dx * dx) + (dy * dy) > (radius * radius)) - continue; - - const QPoint p2 (p.x () + dx, p.y () + dy); - - painter.drawPoint(p2); - } - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/imagelib/kpPainter.h b/kolourpaint/imagelib/kpPainter.h deleted file mode 100644 index dd8c217a..00000000 --- a/kolourpaint/imagelib/kpPainter.h +++ /dev/null @@ -1,188 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_PAINTER_H -#define KP_PAINTER_H - - -#include -#include - - -#include - - -// -// Stateless painter with sane semantics that works on kpImage's i.e. it -// works on document - not view - data. If you find that you need state, -// you should probably move it into kpPainter to avoid the overhead of -// passing around this state (e.g. color, line width) and for reuse. -// -// kpPainter is to kpImage as QPainter is to QPixmap. -// -// This encapsulates the set of functionality used by all of KolourPaint's -// document drawing functions and nothing more, permitting rewriting of -// the image library. Currently uses QPainter/kpPixmapFX as the image library. -// - -struct kpPainterPrivate; - -class kpPainter -{ -public: - // helper to make a correct QRect out of 2 QPoints regardless of their relative position - // to each other - static QRect normalizedRect(const QPoint& p1, const QPoint& p2) - { - return QRect(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y()), - qAbs(p2.x() - p1.x()) + 1, qAbs(p2.y() - p1.y()) + 1); - } - - // Returns whether the given points are cardinally adjacent (i.e. one point - // is exactly 1 pixel north, east, south or west of the other). Equal - // points are not cardinally adjacent. - static bool pointsAreCardinallyAdjacent (const QPoint &p, const QPoint &q); - - // Returns a list of points representing a straight line from - // to inclusive, using Bresenham's line algorithm. Each point - // is created only with the specified . - // - // If is set, a modified Bresenham's algorithm will add - // an extra point between every pair of originally strictly-diagonally-adjacent - // points, such that these points become cardinally adjacent. However, these - // extra points are also created only with the specified . - // - // For instance, must be set if a diagonal line is to - // drawn at each of the returned points, otherwise things won't look right: - // - // .\..... - // \.\.... - // .\.B... - // ..Ac\.. - // ...\.\. - // ....\.. - // - // 'A' is the previous Bresenham point. 'B' is the new point. See how if - // diagonal lines are drawn at A and B, there is a gap between the lines. - // Setting will solve this problem, since it will add - // a point at 'c'. - // - // ASSUMPTION: is between 0.0 and 1.0 inclusive. - static QList interpolatePoints (const QPoint &startPoint, - const QPoint &endPoint, - bool cardinalAdjacency = false, - double probability = 1.0); - - // Draws a line from (x1,y1) to (x2,y2) onto , with - // and . The corners are rounded and centred at those - // coordinates so if > 1, the line is likely to extend past - // a rectangle with those corners. - static void drawLine (kpImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth); - static void drawPolyline (kpImage *image, - const QPolygon &points, - const kpColor &color, int penWidth); - // = shape completed else drawing but haven't finalised. - // If not , the edge that would form the closure, if the - // shape were finalised now, is highlighted specially. Unfortunately, - // the argument is currently ignored. - // - // Odd-even fill. - static void drawPolygon (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor = kpColor::Invalid, - bool isFinal = true); - // Cubic Beizer. - static void drawCurve (kpImage *image, - const QPoint &startPoint, - const QPoint &controlPointP, const QPoint &controlPointQ, - const QPoint &endPoint, - const kpColor &color, int penWidth); - - static void fillRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &color); - - // Draws a rectangle / rounded rectangle / ellipse with top-left at - // (x, y) with width and height . Unlike QPainter, - // this rectangle will really fit inside x and won't - // be one pixel higher or wider etc. - // - // and must be >= 0. - // - // must not be invalid. However, may be invalid - // to signify an unfilled rectangle / rounded rectangle /ellipse. - static void drawRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid); - static void drawRoundedRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid); - static void drawEllipse (kpImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid); - - // Replaces all pixels of on the line - // from (x1,y1) to (x2,y2) of , with a pen of with - // dimensions x. - // - // The corners are centred at those coordinates so if > 1 or - // > 1, the line is likely to extend past a rectangle with - // those corners. - // - // Returns the dirty rectangle. - static QRect washLine (kpImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth, int penHeight, - const kpColor &colorToReplace, - int processedColorSimilarity); - - static QRect washRect (kpImage *image, - int x, int y, int width, int height, - const kpColor &color, - const kpColor &colorToReplace, - int processedColorSimilarity); - - // For each point in , sprays a random pattern of 10 dots of , - // each within a circle of diameter , onto . - // - // ASSUMPTION: spraycanSize > 0. - // TODO: I think this diameter is 1 or 2 off. - static void sprayPoints (kpImage *image, - const QList &points, - const kpColor &color, - int spraycanSize); -}; - - -#endif // KP_PAINTER_H diff --git a/kolourpaint/imagelib/transforms/kpTransformAutoCrop.cpp b/kolourpaint/imagelib/transforms/kpTransformAutoCrop.cpp deleted file mode 100644 index bee701a8..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformAutoCrop.cpp +++ /dev/null @@ -1,769 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// TODO: Color Similarity is obviously useful in Autocrop but it isn't -// obvious as to how to implement it. The current heuristic, -// for each side, chooses an arbitrary reference color for which -// all other candidate pixels in that side are tested against -// for similarity. But if the reference color happens to be at -// one extreme of the range of colors in that side, then pixels -// at the other extreme would not be deemed similar enough. The -// key is to find the median color as the reference but how do -// you do this if you don't know which pixels to sample in the first -// place (that's what you're trying to find)? Chicken and egg situation. -// -// The other heuristic that is in doubt is the use of the average -// color in determining the similarity of sides (it is possible -// to get vastly differently colors in both sides yet they will be -// considered similar). - -#define DEBUG_KP_TOOL_AUTO_CROP 0 - - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -class kpTransformAutoCropBorder -{ -public: - // WARNING: Only call the with imagePtr = 0 if you are going to use - // operator= to fill it in with a valid imagePtr immediately - // afterwards. - kpTransformAutoCropBorder (const kpImage *imagePtr = 0, int processedColorSimilarity = 0); - - kpCommandSize::SizeType size () const; - - const kpImage *image () const; - int processedColorSimilarity () const; - QRect rect () const; - int left () const; - int right () const; - int top () const; - int bottom () const; - kpColor referenceColor () const; - kpColor averageColor () const; - bool isSingleColor () const; - - // (returns true on success (even if no rect) or false on error) - bool calculate (int isX, int dir); - - bool fillsEntireImage () const; - bool exists () const; - void invalidate (); - -private: - const kpImage *m_imagePtr; - int m_processedColorSimilarity; - - QRect m_rect; - kpColor m_referenceColor; - int m_redSum, m_greenSum, m_blueSum; - bool m_isSingleColor; -}; - -kpTransformAutoCropBorder::kpTransformAutoCropBorder (const kpImage *imagePtr, - int processedColorSimilarity) - : m_imagePtr (imagePtr), - m_processedColorSimilarity (processedColorSimilarity) -{ - invalidate (); -} - - -// public -kpCommandSize::SizeType kpTransformAutoCropBorder::size () const -{ - return sizeof (kpTransformAutoCropBorder); -} - - -// public -const kpImage *kpTransformAutoCropBorder::image () const -{ - return m_imagePtr; -} - -// public -int kpTransformAutoCropBorder::processedColorSimilarity () const -{ - return m_processedColorSimilarity; -} - -// public -QRect kpTransformAutoCropBorder::rect () const -{ - return m_rect; -} - -// public -int kpTransformAutoCropBorder::left () const -{ - return m_rect.left (); -} - -// public -int kpTransformAutoCropBorder::right () const -{ - return m_rect.right (); -} - -// public -int kpTransformAutoCropBorder::top () const -{ - return m_rect.top (); -} - -// public -int kpTransformAutoCropBorder::bottom () const -{ - return m_rect.bottom (); -} - -// public -kpColor kpTransformAutoCropBorder::referenceColor () const -{ - return m_referenceColor; -} - -// public -kpColor kpTransformAutoCropBorder::averageColor () const -{ - if (!m_rect.isValid ()) - return kpColor::Invalid; - - if (m_referenceColor.isTransparent ()) - return kpColor::Transparent; - else if (m_processedColorSimilarity == 0) - return m_referenceColor; - else - { - int numPixels = (m_rect.width () * m_rect.height ()); - Q_ASSERT (numPixels > 0); - - return kpColor (m_redSum / numPixels, - m_greenSum / numPixels, - m_blueSum / numPixels); - } -} - -//--------------------------------------------------------------------- - -bool kpTransformAutoCropBorder::isSingleColor () const -{ - return m_isSingleColor; -} - -//--------------------------------------------------------------------- - -// public -bool kpTransformAutoCropBorder::calculate (int isX, int dir) -{ -#if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "kpTransformAutoCropBorder::calculate() CALLED!"; -#endif - int maxX = m_imagePtr->width () - 1; - int maxY = m_imagePtr->height () - 1; - - QImage qimage = *m_imagePtr; - Q_ASSERT (!qimage.isNull ()); - - // (sync both branches) - if (isX) - { - int numCols = 0; - int startX = (dir > 0) ? 0 : maxX; - - kpColor col = kpPixmapFX::getColorAtPixel (qimage, startX, 0); - for (int x = startX; - x >= 0 && x <= maxX; - x += dir) - { - int y; - for (y = 0; y <= maxY; y++) - { - if (!kpPixmapFX::getColorAtPixel (qimage, x, y).isSimilarTo (col, m_processedColorSimilarity)) - break; - } - - if (y <= maxY) - break; - else - numCols++; - } - - if (numCols) - { - m_rect = - kpPainter::normalizedRect(QPoint(startX, 0), - QPoint(startX + (numCols - 1) * dir, maxY)); - m_referenceColor = col; - } - } - else - { - int numRows = 0; - int startY = (dir > 0) ? 0 : maxY; - - kpColor col = kpPixmapFX::getColorAtPixel (qimage, 0, startY); - for (int y = startY; - y >= 0 && y <= maxY; - y += dir) - { - int x; - for (x = 0; x <= maxX; x++) - { - if (!kpPixmapFX::getColorAtPixel (qimage, x, y).isSimilarTo (col, m_processedColorSimilarity)) - break; - } - - if (x <= maxX) - break; - else - numRows++; - } - - if (numRows) - { - m_rect = kpPainter::normalizedRect(QPoint(0, startY), - QPoint(maxX, startY + (numRows - 1) * dir)); - m_referenceColor = col; - } - } - - - if (m_rect.isValid ()) - { - m_isSingleColor = true; - - if (m_processedColorSimilarity != 0) - { - for (int y = m_rect.top (); y <= m_rect.bottom (); y++) - { - for (int x = m_rect.left (); x <= m_rect.right (); x++) - { - kpColor colAtPixel = kpPixmapFX::getColorAtPixel (qimage, x, y); - - if (m_isSingleColor && colAtPixel != m_referenceColor) - m_isSingleColor = false; - - m_redSum += colAtPixel.red (); - m_greenSum += colAtPixel.green (); - m_blueSum += colAtPixel.blue (); - } - } - } - } - - - return true; -} - -// public -bool kpTransformAutoCropBorder::fillsEntireImage () const -{ - return (m_rect == m_imagePtr->rect ()); -} - -// public -bool kpTransformAutoCropBorder::exists () const -{ - // (will use in an addition so make sure returns 1 or 0) - return (m_rect.isValid () ? 1 : 0); -} - -// public -void kpTransformAutoCropBorder::invalidate () -{ - m_rect = QRect (); - m_referenceColor = kpColor::Invalid; - m_redSum = m_greenSum = m_blueSum = 0; - m_isSingleColor = false; -} - - -struct kpTransformAutoCropCommandPrivate -{ - bool actOnSelection; - kpTransformAutoCropBorder leftBorder, rightBorder, topBorder, botBorder; - kpImage *leftImage, *rightImage, *topImage, *botImage; - - QRect contentsRect; - int oldWidth, oldHeight; - kpAbstractImageSelection *oldSelectionPtr; -}; - -// REFACTOR: Move to /commands/ -kpTransformAutoCropCommand::kpTransformAutoCropCommand (bool actOnSelection, - const kpTransformAutoCropBorder &leftBorder, - const kpTransformAutoCropBorder &rightBorder, - const kpTransformAutoCropBorder &topBorder, - const kpTransformAutoCropBorder &botBorder, - kpCommandEnvironment *environ) - : kpNamedCommand(text(actOnSelection, DontShowAccel), environ), - d (new kpTransformAutoCropCommandPrivate ()) -{ - d->actOnSelection = actOnSelection; - d->leftBorder = leftBorder; - d->rightBorder = rightBorder; - d->topBorder = topBorder; - d->botBorder = botBorder; - d->leftImage = 0; - d->rightImage = 0; - d->topImage = 0; - d->botImage = 0; - - kpDocument *doc = document (); - Q_ASSERT (doc); - - d->oldWidth = doc->width (d->actOnSelection); - d->oldHeight = doc->height (d->actOnSelection); - - d->oldSelectionPtr = 0; -} - -//--------------------------------------------------------------------- - -kpTransformAutoCropCommand::~kpTransformAutoCropCommand () -{ - deleteUndoImages (); - - delete d->oldSelectionPtr; - delete d; -} - -//--------------------------------------------------------------------- -// public static - -QString kpTransformAutoCropCommand::text(bool actOnSelection, int options) -{ - if (actOnSelection) - { - if (options & kpTransformAutoCropCommand::ShowAccel) - return i18n ("Remove Internal B&order"); - else - return i18n ("Remove Internal Border"); - } - else - { - if (options & kpTransformAutoCropCommand::ShowAccel) - return i18n ("Autocr&op"); - else - return i18n ("Autocrop"); - } -} - -//--------------------------------------------------------------------- -// public virtual [base kpCommand] - -kpCommandSize::SizeType kpTransformAutoCropCommand::size () const -{ - return d->leftBorder.size () + - d->rightBorder.size () + - d->topBorder.size () + - d->botBorder.size () + - ImageSize (d->leftImage) + - ImageSize (d->rightImage) + - ImageSize (d->topImage) + - ImageSize (d->botImage) + - SelectionSize (d->oldSelectionPtr); -} - -//--------------------------------------------------------------------- -// private - -void kpTransformAutoCropCommand::getUndoImage (const kpTransformAutoCropBorder &border, kpImage **image) -{ - kpDocument *doc = document (); - Q_ASSERT (doc); - -#if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "kpTransformAutoCropCommand::getUndoImage()"; - kDebug () << "\timage=" << image - << " border: rect=" << border.rect () - << " isSingleColor=" << border.isSingleColor () - << endl; -#endif - - if (image && border.exists () && !border.isSingleColor ()) - { - if (*image) - { - #if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "\talready have *image - delete it"; - #endif - delete *image; - } - - *image = new kpImage ( - kpPixmapFX::getPixmapAt (doc->image (d->actOnSelection), - border.rect ())); - } -} - - -// private -void kpTransformAutoCropCommand::getUndoImages () -{ - getUndoImage (d->leftBorder, &d->leftImage); - getUndoImage (d->rightBorder, &d->rightImage); - getUndoImage (d->topBorder, &d->topImage); - getUndoImage (d->botBorder, &d->botImage); -} - -// private -void kpTransformAutoCropCommand::deleteUndoImages () -{ -#if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "kpTransformAutoCropCommand::deleteUndoImages()"; -#endif - - delete d->leftImage; d->leftImage = 0; - delete d->rightImage; d->rightImage = 0; - delete d->topImage; d->topImage = 0; - delete d->botImage; d->botImage = 0; -} - - -// public virtual [base kpCommand] -void kpTransformAutoCropCommand::execute () -{ - if (!d->contentsRect.isValid ()) - d->contentsRect = contentsRect (); - - - getUndoImages (); - - - kpDocument *doc = document (); - Q_ASSERT (doc); - - - kpImage imageWithoutBorder = - kpTool::neededPixmap (doc->image (d->actOnSelection), - d->contentsRect); - - - if (!d->actOnSelection) - doc->setImage (imageWithoutBorder); - else - { - d->oldSelectionPtr = doc->imageSelection ()->clone (); - d->oldSelectionPtr->setBaseImage (kpImage ()); - - // d->contentsRect is relative to the top of the sel - // while sel is relative to the top of the doc - QRect rect = d->contentsRect; - rect.translate (d->oldSelectionPtr->x (), d->oldSelectionPtr->y ()); - - kpRectangularImageSelection sel ( - rect, - imageWithoutBorder, - d->oldSelectionPtr->transparency ()); - - doc->setSelection (sel); - - environ ()->somethingBelowTheCursorChanged (); - } -} - -// public virtual [base kpCommand] -void kpTransformAutoCropCommand::unexecute () -{ -#if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "kpTransformAutoCropCommand::unexecute()"; -#endif - - kpDocument *doc = document (); - Q_ASSERT (doc); - - kpImage image (d->oldWidth, d->oldHeight, QImage::Format_ARGB32_Premultiplied); - - // restore the position of the center image - kpPixmapFX::setPixmapAt (&image, d->contentsRect, - doc->image (d->actOnSelection)); - - // draw the borders - - const kpTransformAutoCropBorder *borders [] = - { - &d->leftBorder, &d->rightBorder, - &d->topBorder, &d->botBorder, - 0 - }; - - const kpImage *images [] = - { - d->leftImage, d->rightImage, - d->topImage, d->botImage, - 0 - }; - - const kpImage **p = images; - for (const kpTransformAutoCropBorder **b = borders; *b; b++, p++) - { - if (!(*b)->exists ()) - continue; - - if ((*b)->isSingleColor ()) - { - kpColor col = (*b)->referenceColor (); - #if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "\tdrawing border " << (*b)->rect () - << " rgb=" << (int *) col.toQRgb () /* %X hack */ << endl; - #endif - - const QRect r = (*b)->rect (); - kpPainter::fillRect (&image, - r.x (), r.y (), r.width (), r.height (), - col); - } - else - { - #if DEBUG_KP_TOOL_AUTO_CROP && 1 - kDebug () << "\trestoring border image " << (*b)->rect (); - #endif - if (*p) - { - // REFACTOR: Add equivalent method to kpPainter and use. - kpPixmapFX::setPixmapAt (&image, (*b)->rect (), **p); - } - } - } - - - if (!d->actOnSelection) - doc->setImage (image); - else - { - d->oldSelectionPtr->setBaseImage (image); - - doc->setSelection (*d->oldSelectionPtr); - delete d->oldSelectionPtr; d->oldSelectionPtr = 0; - - environ ()->somethingBelowTheCursorChanged (); - } - - - deleteUndoImages (); -} - - -// private -QRect kpTransformAutoCropCommand::contentsRect () const -{ - const kpImage image = document ()->image (d->actOnSelection); - - QPoint topLeft (d->leftBorder.exists () ? - d->leftBorder.rect ().right () + 1 : - 0, - d->topBorder.exists () ? - d->topBorder.rect ().bottom () + 1 : - 0); - QPoint botRight (d->rightBorder.exists () ? - d->rightBorder.rect ().left () - 1 : - image.width () - 1, - d->botBorder.exists () ? - d->botBorder.rect ().top () - 1 : - image.height () - 1); - - return QRect (topLeft, botRight); -} - - -static void ShowNothingToAutocropMessage (kpMainWindow *mainWindow, bool actOnSelection) -{ - kpSetOverrideCursorSaver cursorSaver (Qt::ArrowCursor); - - if (actOnSelection) - { - KMessageBox::information (mainWindow, - i18n ("KolourPaint cannot remove the selection's internal border as it" - " could not be located."), - i18nc ("@title:window", "Cannot Remove Internal Border"), - "NothingToAutoCrop"); - } - else - { - KMessageBox::information (mainWindow, - i18n ("KolourPaint cannot automatically crop the image as its" - " border could not be located."), - i18nc ("@title:window", "Cannot Autocrop"), - "NothingToAutoCrop"); - } -} - -bool kpTransformAutoCrop (kpMainWindow *mainWindow) -{ -#if DEBUG_KP_TOOL_AUTO_CROP - kDebug () << "kpTransformAutoCrop() CALLED!"; -#endif - - Q_ASSERT (mainWindow); - kpDocument *doc = mainWindow->document (); - Q_ASSERT (doc); - - // OPT: if already pulled selection image, no need to do it again here - kpImage image = doc->selection () ? doc->getSelectedBaseImage () : doc->image (); - Q_ASSERT (!image.isNull ()); - - kpViewManager *vm = mainWindow->viewManager (); - Q_ASSERT (vm); - - int processedColorSimilarity = mainWindow->colorToolBar ()->processedColorSimilarity (); - kpTransformAutoCropBorder leftBorder (&image, processedColorSimilarity), - rightBorder (&image, processedColorSimilarity), - topBorder (&image, processedColorSimilarity), - botBorder (&image, processedColorSimilarity); - - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - mainWindow->colorToolBar ()->flashColorSimilarityToolBarItem (); - - // TODO: With Colour Similarity, a lot of weird (and wonderful) things can - // happen resulting in a huge number of code paths. Needs refactoring - // and regression testing. - // - // TODO: e.g. When the top fills entire rect but bot doesn't we could - // invalidate top and continue autocrop. - int numRegions = 0; - if (!leftBorder.calculate (true/*x*/, +1/*going right*/) || - leftBorder.fillsEntireImage () || - !rightBorder.calculate (true/*x*/, -1/*going left*/) || - rightBorder.fillsEntireImage () || - !topBorder.calculate (false/*y*/, +1/*going down*/) || - topBorder.fillsEntireImage () || - !botBorder.calculate (false/*y*/, -1/*going up*/) || - botBorder.fillsEntireImage () || - ((numRegions = leftBorder.exists () + - rightBorder.exists () + - topBorder.exists () + - botBorder.exists ()) == 0)) - { - #if DEBUG_KP_TOOL_AUTO_CROP - kDebug () << "\tcan't find border; leftBorder.rect=" << leftBorder.rect () - << " rightBorder.rect=" << rightBorder.rect () - << " topBorder.rect=" << topBorder.rect () - << " botBorder.rect=" << botBorder.rect () - << endl; - #endif - ::ShowNothingToAutocropMessage (mainWindow, (bool) doc->selection ()); - return false; - } - -#if DEBUG_KP_TOOL_AUTO_CROP - kDebug () << "\tnumRegions=" << numRegions; - kDebug () << "\t\tleft=" << leftBorder.rect () - << " refCol=" << (leftBorder.exists () ? (int *) leftBorder.referenceColor ().toQRgb () : 0) - << " avgCol=" << (leftBorder.exists () ? (int *) leftBorder.averageColor ().toQRgb () : 0) - << endl; - kDebug () << "\t\tright=" << rightBorder.rect () - << " refCol=" << (rightBorder.exists () ? (int *) rightBorder.referenceColor ().toQRgb () : 0) - << " avgCol=" << (rightBorder.exists () ? (int *) rightBorder.averageColor ().toQRgb () : 0) - << endl; - kDebug () << "\t\ttop=" << topBorder.rect () - << " refCol=" << (topBorder.exists () ? (int *) topBorder.referenceColor ().toQRgb () : 0) - << " avgCol=" << (topBorder.exists () ? (int *) topBorder.averageColor ().toQRgb () : 0) - << endl; - kDebug () << "\t\tbot=" << botBorder.rect () - << " refCol=" << (botBorder.exists () ? (int *) botBorder.referenceColor ().toQRgb () : 0) - << " avgCol=" << (botBorder.exists () ? (int *) botBorder.averageColor ().toQRgb () : 0) - << endl; -#endif - - - // In case e.g. the user pastes a solid, coloured-in rectangle, - // we favor killing the bottom and right regions - // (these regions probably contain the unwanted whitespace due - // to the doc being bigger than the pasted selection to start with). - // - // We also kill if they kiss or even overlap. - - if (leftBorder.exists () && rightBorder.exists ()) - { - const kpColor leftCol = leftBorder.averageColor (); - const kpColor rightCol = rightBorder.averageColor (); - - if ((numRegions == 2 && !leftCol.isSimilarTo (rightCol, processedColorSimilarity)) || - leftBorder.right () >= rightBorder.left () - 1) // kissing or overlapping - { - #if DEBUG_KP_TOOL_AUTO_CROP - kDebug () << "\tignoring left border"; - #endif - leftBorder.invalidate (); - } - } - - if (topBorder.exists () && botBorder.exists ()) - { - const kpColor topCol = topBorder.averageColor (); - const kpColor botCol = botBorder.averageColor (); - - if ((numRegions == 2 && !topCol.isSimilarTo (botCol, processedColorSimilarity)) || - topBorder.bottom () >= botBorder.top () - 1) // kissing or overlapping - { - #if DEBUG_KP_TOOL_AUTO_CROP - kDebug () << "\tignoring top border"; - #endif - topBorder.invalidate (); - } - } - - - mainWindow->addImageOrSelectionCommand ( - new kpTransformAutoCropCommand ( - (bool) doc->selection (), - leftBorder, rightBorder, - topBorder, botBorder, - mainWindow->commandEnvironment ())); - - - return true; -} diff --git a/kolourpaint/imagelib/transforms/kpTransformAutoCrop.h b/kolourpaint/imagelib/transforms/kpTransformAutoCrop.h deleted file mode 100644 index f60ccf11..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformAutoCrop.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_AUTO_CROP_H -#define KP_TOOL_AUTO_CROP_H - - -#include - - -#include - -//class kpImage; -class kpMainWindow; -class kpTransformAutoCropBorder; - - -// REFACTOR: This should be moved into /commands/ -class kpTransformAutoCropCommand : public kpNamedCommand -{ -public: - kpTransformAutoCropCommand (bool actOnSelection, - const kpTransformAutoCropBorder &leftBorder, - const kpTransformAutoCropBorder &rightBorder, - const kpTransformAutoCropBorder &topBorder, - const kpTransformAutoCropBorder &botBorder, - kpCommandEnvironment *environ); - virtual ~kpTransformAutoCropCommand (); - - enum NameOptions - { - DontShowAccel = 0, - ShowAccel = 1 - }; - - static QString text(bool actOnSelection, int options); - - virtual SizeType size () const; - -private: - void getUndoImage (const kpTransformAutoCropBorder &border, kpImage **image); - void getUndoImages (); - void deleteUndoImages (); - -public: - virtual void execute (); - virtual void unexecute (); - -private: - QRect contentsRect () const; - - struct kpTransformAutoCropCommandPrivate *d; -}; - - -// (returns true on success (even if it did nothing) or false on error) -bool kpTransformAutoCrop (kpMainWindow *mainWindow); - - -#endif // KP_TOOL_AUTO_CROP_H diff --git a/kolourpaint/imagelib/transforms/kpTransformCrop.cpp b/kolourpaint/imagelib/transforms/kpTransformCrop.cpp deleted file mode 100644 index dc295956..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformCrop.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_CROP 0 - - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - - -void kpTransformCrop (kpMainWindow *mainWindow) -{ - kpDocument *doc = mainWindow->document (); - Q_ASSERT (doc); - - kpAbstractSelection *sel = doc->selection (); - Q_ASSERT (sel); - - - kpCommand *resizeDocCommand = - new kpTransformResizeScaleCommand ( - false/*act on doc, not sel*/, - sel->width (), sel->height (), - kpTransformResizeScaleCommand::Resize, - mainWindow->commandEnvironment ()); - - - kpTextSelection *textSel = - dynamic_cast (sel); - kpAbstractImageSelection *imageSel = - dynamic_cast (sel); - // It's either a text selection or an image selection, but cannot be - // neither or both. - Q_ASSERT (!!textSel != !!imageSel); - - if (textSel) - ::kpTransformCrop_TextSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); - else if (imageSel) - ::kpTransformCrop_ImageSelection (mainWindow, i18n ("Set as Image"), resizeDocCommand); - else - Q_ASSERT (!"unreachable"); -} diff --git a/kolourpaint/imagelib/transforms/kpTransformCrop.h b/kolourpaint/imagelib/transforms/kpTransformCrop.h deleted file mode 100644 index 2a5ba48c..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformCrop.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_CROP_H -#define KP_TOOL_CROP_H - - -class kpMainWindow; - - -// -// ASSUMPTION: There is a current selection. -// -// -// In all cases, the document is resized to be the same size as the bounding -// rectangle of the selection. Additional behavior depends on the type of -// selection: -// -// -// If it's a text box: -// -// 1. It's moved to (0, 0) and kept editable. -// -// 2. The document background always becomes completely transparent. -// -// Text boxes with transparent backgrounds, before calling this method, -// antialias their text with the pixels of the document below. Such -// pixels are unlikely to be all of the same color, so there is no single -// "correct" color for the new document background. We choose transparent -// because it's the most neutral and forces the text to not antialias. -// TODO: Perhaps a better approach would have been to simply copy the -// pixels of the document below the text box to (0, 0)? -// -// For text boxes with opaque backgrounds, the new transparent document -// background means that the extents of text boxes are clear, when the -// boxes are moved around -- this is handy. -// -// -// If it's an image selection: -// -// 1. The pixels of the document starting from position (0, 0) are set the -// same as those inside the selection region. Unlike other image selection -// commands, if the selection is not floating, there is still no pulling -// of the selection from the document. -// -// The pixels outside the selection region are set to the background color. -// -// 2. The selection border is discarded -- even if the selection was floating -// before -- and replaced by a new one, of the same shape, but located at (0, 0). -// This allows the user to pull off a selection, if they would like. -// -// For user convenience, this border is created by a undoable -// create-selection-border command added to the undo history. -// -void kpTransformCrop (kpMainWindow *mainWindow); - - -#endif // KP_TOOL_CROP_H diff --git a/kolourpaint/imagelib/transforms/kpTransformCropPrivate.h b/kolourpaint/imagelib/transforms/kpTransformCropPrivate.h deleted file mode 100644 index 2a75c250..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformCropPrivate.h +++ /dev/null @@ -1,49 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransformCropPrivate_H -#define kpTransformCropPrivate_H - - -#include - -class kpCommand; -class kpMainWindow; - - -// Adds a kpMacroCommand, with name , to the command history. -// -// The first subcommand of this kpMacroCommand should be -// which resizes the document to the size of the selection. -void kpTransformCrop_TextSelection (kpMainWindow *mainWindow, - const QString &commandName, kpCommand *resizeDocCommand); -void kpTransformCrop_ImageSelection (kpMainWindow *mainWindow, - const QString &commandName, kpCommand *resizeDocCommand); - - -#endif // kpTransformCropPrivate_H diff --git a/kolourpaint/imagelib/transforms/kpTransformCrop_ImageSelection.cpp b/kolourpaint/imagelib/transforms/kpTransformCrop_ImageSelection.cpp deleted file mode 100644 index abb2f687..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformCrop_ImageSelection.cpp +++ /dev/null @@ -1,269 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_CROP 0 - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// See the "image selection" part of the kpTransformCrop() API Doc. -// -// REFACTOR: Move into commands/ -class SetDocumentToSelectionImageCommand : public kpCommand -{ -public: - SetDocumentToSelectionImageCommand (kpCommandEnvironment *environ); - virtual ~SetDocumentToSelectionImageCommand (); - - /* (uninteresting child of macro cmd) */ - virtual QString name () const { return QString(); } - - virtual kpCommandSize::SizeType size () const - { - return ImageSize (m_oldImage) + - SelectionSize (m_fromSelectionPtr) + - ImageSize (m_imageIfFromSelectionDoesntHaveOne); - } - - // ASSUMPTION: Document has been resized to be the same size as the - // selection. - virtual void execute (); - virtual void unexecute (); - -protected: - kpColor m_backgroundColor; - kpImage m_oldImage; - kpAbstractImageSelection *m_fromSelectionPtr; - kpImage m_imageIfFromSelectionDoesntHaveOne; -}; - - -SetDocumentToSelectionImageCommand::SetDocumentToSelectionImageCommand (kpCommandEnvironment *environ) - : kpCommand (environ), - m_backgroundColor (environ->backgroundColor ()), - m_fromSelectionPtr ( - dynamic_cast ( - environ->document ()->selection ()->clone ())) -{ - Q_ASSERT (m_fromSelectionPtr); - - if ( m_fromSelectionPtr ) // make coverity happy - { - m_imageIfFromSelectionDoesntHaveOne = - m_fromSelectionPtr->hasContent () ? - kpImage () : - document ()->getSelectedBaseImage (); - } -} - -//--------------------------------------------------------------------- - -SetDocumentToSelectionImageCommand::~SetDocumentToSelectionImageCommand () -{ - delete m_fromSelectionPtr; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void SetDocumentToSelectionImageCommand::execute () -{ -#if DEBUG_KP_TOOL_CROP - kDebug () << "SetDocumentToSelectionImageCommand::execute()"; -#endif - - viewManager ()->setQueueUpdates (); - { - // kpTransformCrop_ImageSelection's has - // executed, resizing the document to be the size of the selection - // bounding rectangle. - Q_ASSERT (document ()->width () == m_fromSelectionPtr->width ()); - Q_ASSERT (document ()->height () == m_fromSelectionPtr->height ()); - m_oldImage = document ()->image (); - - - // - // e.g. original elliptical selection: - // - // t/---\ T = original transparent selection pixel - // | TT | t = outside the selection region - // t\__/t [every other character] = original opaque selection pixel - // - // Afterwards, the _document_ image becomes: - // - // b/---\ T = [unchanged] - // | TT | b = background color - // b\__/b [every other character] = [unchanged] - // - // The selection is deleted. - // - // TODO: Do not introduce a mask if the result will not contain - // any transparent pixels. - // - - QImage newDocImage(document()->width(), document()->height(), QImage::Format_ARGB32_Premultiplied); - newDocImage.fill(m_backgroundColor.toQRgb()); - - #if DEBUG_KP_TOOL_CROP - kDebug () << "\tsel: rect=" << m_fromSelectionPtr->boundingRect () - << " pm=" << m_fromSelectionPtr->hasContent () - << endl; - #endif - QImage setTransparentImage; - - if (m_fromSelectionPtr->hasContent ()) - { - setTransparentImage = m_fromSelectionPtr->transparentImage (); - - #if DEBUG_KP_TOOL_CROP - kDebug () << "\thave pixmap; rect=" - << setTransparentImage.rect () - << endl; - #endif - } - else - { - setTransparentImage = m_imageIfFromSelectionDoesntHaveOne; - #if DEBUG_KP_TOOL_CROP - kDebug () << "\tno pixmap in sel - get it; rect=" - << setTransparentImage.rect () - << endl; - #endif - } - -#if 0 - kpPixmapFX::paintMaskTransparentWithBrush (&newDocImage, - QPoint (0, 0), - m_fromSelectionPtr->shapeBitmap ()); -#endif - - kpPixmapFX::paintPixmapAt (&newDocImage, - QPoint (0, 0), - setTransparentImage); - - - document ()->setImageAt (newDocImage, QPoint (0, 0)); - document ()->selectionDelete (); - - - environ ()->somethingBelowTheCursorChanged (); - } - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpCommand] -void SetDocumentToSelectionImageCommand::unexecute () -{ -#if DEBUG_KP_TOOL_CROP - kDebug () << "SetDocumentToSelectionImageCommand::unexecute()"; -#endif - - viewManager ()->setQueueUpdates (); - { - document ()->setImageAt (m_oldImage, QPoint (0, 0)); - m_oldImage = kpImage (); - - #if DEBUG_KP_TOOL_CROP - kDebug () << "\tsel: rect=" << m_fromSelectionPtr->boundingRect () - << " pm=" << m_fromSelectionPtr->hasContent () - << endl; - #endif - document ()->setSelection (*m_fromSelectionPtr); - - environ ()->somethingBelowTheCursorChanged (); - } - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - - -void kpTransformCrop_ImageSelection (kpMainWindow *mainWindow, - const QString &commandName, kpCommand *resizeDocCommand) -{ - // Save starting selection, minus the border. - kpAbstractImageSelection *borderImageSel = - dynamic_cast ( - mainWindow->document ()->selection ()->clone ()); - Q_ASSERT (borderImageSel); - - if ( !borderImageSel ) // make coverity happy - return; - - // (only interested in border) - borderImageSel->deleteContent (); - borderImageSel->moveTo (QPoint (0, 0)); - - - kpCommandEnvironment *environ = mainWindow->commandEnvironment (); - - - kpMacroCommand *macroCmd = new kpMacroCommand (commandName, environ); - - // (must resize doc _before_ SetDocumentToSelectionImageCommand in case - // doc needs to gets bigger - else selection image may not fit) - macroCmd->addCommand (resizeDocCommand); - -#if DEBUG_KP_TOOL_CROP - kDebug () << "\tis pixmap sel"; - kDebug () << "\tcreating SetImage cmd"; -#endif - macroCmd->addCommand (new SetDocumentToSelectionImageCommand (environ)); - - - mainWindow->addImageOrSelectionCommand ( - macroCmd, - true/*add create cmd*/, - false/*don't add pull cmd*/); - - - // Add selection border back for convenience. - mainWindow->commandHistory ()->addCommand ( - new kpToolSelectionCreateCommand ( - i18n ("Selection: Create"), - *borderImageSel, - mainWindow->commandEnvironment ())); - - - delete borderImageSel; -} diff --git a/kolourpaint/imagelib/transforms/kpTransformCrop_TextSelection.cpp b/kolourpaint/imagelib/transforms/kpTransformCrop_TextSelection.cpp deleted file mode 100644 index b4853bc9..00000000 --- a/kolourpaint/imagelib/transforms/kpTransformCrop_TextSelection.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_CROP 0 - - -#include -#include - -#include -#include -#include -#include - - -void kpTransformCrop_TextSelection (kpMainWindow *mainWindow, - const QString &commandName, kpCommand *resizeDocCommand) -{ - kpCommandEnvironment *environ = mainWindow->commandEnvironment (); - - - kpMacroCommand *macroCmd = new kpMacroCommand (commandName, environ); - - macroCmd->addCommand (resizeDocCommand); - -#if DEBUG_KP_TOOL_CROP - kDebug () << "\tisText"; - kDebug () << "\tclearing doc with trans cmd"; -#endif - macroCmd->addCommand ( - new kpEffectClearCommand ( - false/*act on doc*/, - kpColor::Transparent, - environ)); - -#if DEBUG_KP_TOOL_CROP - kDebug () << "\tmoving sel to (0,0) cmd"; -#endif - kpToolSelectionMoveCommand *moveCmd = - new kpToolSelectionMoveCommand ( - QString()/*uninteresting child of macro cmd*/, - environ); - moveCmd->moveTo (QPoint (0, 0), true/*move on exec, not now*/); - moveCmd->finalize (); - macroCmd->addCommand (moveCmd); - - - mainWindow->addImageOrSelectionCommand ( - macroCmd, - true/*add create cmd*/, - true/*add create content cmd*/); -} diff --git a/kolourpaint/kolourpaint.appdata.xml b/kolourpaint/kolourpaint.appdata.xml deleted file mode 100644 index cba6ea96..00000000 --- a/kolourpaint/kolourpaint.appdata.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - kolourpaint.desktop - MIT - BSD-2-Clause and LGPL-2.0+ and GFDL-1.2-without-invariant - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPain - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - KolourPaint - xxKolourPaintxx - 小畫家_KolourPaint - Paint Program - Programa de pintura - Program pro malování - Mal- und Zeichenprogramm - Paint Program - Programa de dibujo - Joonistamisrakendus - Piirto-ohjelma - Logiciel de dessin - Rajzolóprogram - Programma per pinger - Programma di disegno - 그리기 프로그램 - Piešimo programa - Maalprogramm - Tekenprogramma - Program Paint - Programa de Pintura - Programa de desenho - Kresliaci program - Program za risanje - Ritprogram - Програма для малювання - xxPaint Programxx - 繪圖程式 - -

- KolourPaint is a simple painting program to quickly create raster images. - It is useful as a touch-up tool and simple image editing tasks. -

-

El KolourPaint és un programa senzill de pintura per crear ràpidament imatges ràster. És útil com a eina de retoc i tasques senzilles d'edició d'imatges.

-

KolourPaint is a simple painting program to quickly create raster images. It is useful as a touch-up tool and simple image editing tasks.

-

KolourPaint es un sencillo programa de dibujo que permite crear imágenes de mapas de bits de una forma rápida. Resulta útil como herramienta de retoque y para tareas de edición sencillas.

-

KolourPaint on lihtne joonistamisrakendus rasterpiltide kiireks loomiseks. Sellega on hõlpus luua visandeid ja täita lihtsamaid piltide töötlemise ülesandeid.

-

KolourPaint on yksinkertainen piirto-ohjelma, jolla voi luoda nopeasti bittikartakuvia. Sitä voi käyttää myös kuvien parantamiseen ja yksinkertaiseen kuvankäsittelyyn.

-

KolourPaint est logiciel de dessin simple qui permet de créer rapidement des images. Il est pratique pour retoucher ou modifier simplement des images.

-

A KolourPaint egy egyszerű rajzolóprogram raszteres képek gyors létrehozásához. Hasznos retusálóeszközként és egyszerű képszerkesztő feladatokhoz.

-

KolourPaint es un simple programma per pinger e designar pro crear rapidemente imagines raster. Illo es utile como instrumento de retocco e per cargas de simple modification de images.

-

KolourPaint è un semplice programma di disegno per la creazione rapida di immagini. È utile come strumento da usare «al volo» e per effettuare semplici modifiche alle immagini.

-

KolourPaint는 래스터 그림을 빠르게 만드는 프로그램입니다. 간단한 보정 도구 및 편집 도구로 사용할 수 있습니다.

-

KolourPaint is en eenfach Maalprogramm, mit dat sik gau Pixelbiller opstellen laat. Dat is goot för lütte Utbetern un eenfache Bildbewerken.

-

KolourPaint is een eenvoudig tekenprogramma om snel rasterafbeeldingen te maken. Het is nuttig als een hulpmiddel voor bijwerken en eenvoudige taken voor bewerking van afbeeldingen.

-

KolourPaint jest prostym programem do malowania i szybkiego tworzenia obrazów rastrowych. Jest przydatny przy retuszowaniu i prostych pracach edytowania.

-

O KolourPaint é um programa simples de pintura que cria rapidamente imagens rasterizadas. É útil como uma ferramenta de retoques e para tarefas simples de edição de imagens.

-

KolourPaint é um programa de desenho simples, que cria rapidamente imagens rasterizadas. É útil como uma ferramenta de retoques e para tarefas simples de edição de imagens.

-

KolourPaint je jednoduchý kresliaci program na rýchlu tvorbu rastrových obrázkov. Je užitočný ako touch-up nástroj a na jednoduché úpravy obrázkov.

-

KolourPaint je preprost program za risanje in hitro ustvarjanje rastrskih slik. Uporaben je za izboljšave slik in preprosto urejanje slik.

-

KolourPaint är ett enkelt ritprogram för att snabbt skapa punktavbildningar. Det är användbart som förbättringsverktyg och för enkla bildredigeringsuppgifter.

-

KolourPaint — проста програма для малювання, за допомогою якої можна швидко створювати растрові зображення. Ця програма може бути корисною для виконання простих завдань з редагування зображень.

-

xxKolourPaint is a simple painting program to quickly create raster images. It is useful as a touch-up tool and simple image editing tasks.xx

-

KolourPaint 是一套類似小畫家的簡易繪圖程式。

-

Features:

-

Funcionalitats:

-

Vlastnosti:

-

Leistungsmerkmale:

-

Features:

-

Funcionalidades:

-

Omadused:

-

Ominaisuudet:

-

Fonctionnalités :

-

Szolgáltatások:

-

Characteristicas:

-

Caratteristiche:

-

기능:

-

Galimybės:

-

Markmalen:

-

Mogelijkheden:

-

Cechy:

-

Características:

-

Funcionalidades:

-

Funkcie:

-

Zmožnosti:

-

Funktioner:

-

Можливості:

-

xxFeatures:xx

-

功能:

-
    -
  • Support for drawing various shapes - lines, rectangles, rounded rectangles, ovals and polygons
  • -
  • Permet dibuixar diverses formes: línies, rectangles, rectangles arrodonits, ovals i polígons
  • -
  • Das Zeichnen verschiedener Objekte wie Linien, Rechtecke, abgerundete Rechtecke, Ellipsen und Polygone wird unterstützt.
  • -
  • Support for drawing various shapes - lines, rectangles, rounded rectangles, ovals and polygons
  • -
  • Permite dibujar distintas formas (líneas, rectángulos, rectángulos de esquinas redondeadas, óvalos y polígonos)
  • -
  • Mitmesuguste kujundite joonistamise toetus: jooned, ristkülikud, ümarnurksed ristkülikud, ovaalid, hulknurgad
  • -
  • Piirtämistuki useille muodoille – viivoille, suorakaiteille, pyöristetyille suorakaiteille, ellipseille ja monikulmioille
  • -
  • Dessin de formes variées : lignes, rectangles, rectangles à bords arrondis, ovales, polygones
  • -
  • Különféle alakzatok rajzolásának támogatása - vonalak, téglalapok, lekerekített téglalapok, oválisok és sokszögek
  • -
  • Supporto pro varie formas de designo - lineas, rectangulos, rectangulos tundite, ovales e polygonos.
  • -
  • Supporto per il disegno di varie forme - linee, rettangoli, rettangoli arrotondati, ovali e poligoni
  • -
  • 다양한 도형 그리기 - 직선, 사각형, 둥근 사각형, 타원형, 다각형
  • -
  • Ünnerstütt dat Teken vun en Reeg vun Formen - Lienen, Rechtecks, afrundt Rechtecks, Ovalen un Veelecks
  • -
  • Ondersteuning voor het tekenen van verschillende vormen - lijnen, rechthoeken, afgeronde rechthoeken, ovalen en polygonen
  • -
  • Obsługa rysowania rozmaitych kształtów - proste, prostokąty, zaokrąglone prostokąty, owale i wielokąty
  • -
  • Suporte para desenhar várias formas - linhas, rectângulos, rectângulos arredondados, ovais e polígonos
  • -
  • Suporte para desenhar várias formas - linhas, retângulos, retângulos arredondados, ovais e polígonos
  • -
  • Podpora pre kreslenie rôznych tvarov - čiary, obdĺžniky, zaoblené obdĺžniky, ovály a polygóny
  • -
  • Podpora risanju različnih oblik - črt, pravokotnikov, zaobljenih pravokotnikov, ovalov in mnogokotnikov
  • -
  • Stöd för att rita diverse former: linjer, rektanglar, rundade rektanglar, ovaler och polygoner
  • -
  • Підтримка малювання різноманітних форм: прямих, прямокутників, прямокутників із заокругленими кутами, овалів та багатокутників.
  • -
  • xxSupport for drawing various shapes - lines, rectangles, rounded rectangles, ovals and polygonsxx
  • -
  • 支援繪出不同的形狀 -- 線條、矩形、圓角矩形、橢圓與多邊形等
  • -
  • Curves, lines and text
  • -
  • Corbes, línies i text
  • -
  • Kurven, Linien und Text
  • -
  • Curves, lines and text
  • -
  • Curvas, líneas y texto
  • -
  • Kõverad, sirged ja tekst
  • -
  • Käyrät, viivat ja teksti
  • -
  • Courbes, lignes et textes
  • -
  • Görbék, vonalak és szöveg
  • -
  • Curvas, lineas e texto
  • -
  • Curve, linee e testo
  • -
  • 곡선, 직선 및 텍스트
  • -
  • Kreivės, tiesės ir tekstas
  • -
  • Bagens, Lienen un Text
  • -
  • Krommen, lijnen en tekst
  • -
  • Krzywe, proste i teks
  • -
  • Curvas, linhas e texto
  • -
  • Curvas, linhas e texto
  • -
  • Krivky, čiary a text
  • -
  • Krivulje, črte in besedilo
  • -
  • Kurvor, linjer och text
  • -
  • Можливість малювання кривих, прямих та тексту.
  • -
  • xxCurves, lines and textxx
  • -
  • 曲線、線條與文字
  • -
  • Colour picker
  • -
  • Selector de color
  • -
  • Farbwähler
  • -
  • Colour picker
  • -
  • Selección de color
  • -
  • Värvivalija
  • -
  • Värivalitsin
  • -
  • Sélecteur de couleur
  • -
  • Színválasztó
  • -
  • Seligitor de color
  • -
  • Selettore del colore
  • -
  • 색 선택기
  • -
  • Spalvų parinkiklis
  • -
  • Klöörköör
  • -
  • Kleurkiezer
  • -
  • Wybierak barwy
  • -
  • Selecção de cores
  • -
  • Seleção de cor
  • -
  • Výber farieb
  • -
  • Izbirnik barv
  • -
  • Färgväljare
  • -
  • Піпетка для отримання кольору із зображення.
  • -
  • xxColour pickerxx
  • -
  • 顏色挑選器
  • -
  • Selections
  • -
  • Seleccions
  • -
  • Mehre Auswahlarten
  • -
  • Selections
  • -
  • Selecciones
  • -
  • Valikud
  • -
  • Valintatyökalu
  • -
  • Sélections
  • -
  • Kijelölések
  • -
  • Selectiones
  • -
  • Selezioni
  • -
  • 선택
  • -
  • Žymėjimai
  • -
  • Köören
  • -
  • Selecties
  • -
  • Zaznaczenia
  • -
  • Selecções
  • -
  • Seleções
  • -
  • Výbery
  • -
  • Izbire
  • -
  • Markeringar
  • -
  • Можливість позначення ділянок зображення.
  • -
  • xxSelectionsxx
  • -
  • 選取區
  • -
  • Rotation, monochrome and other advanced effects
  • -
  • Gir, monocrom i altres efectes avançats.
  • -
  • Drehung, Umwandlung in Schwarzweiß und weitere Effekte können angewendet werden
  • -
  • Rotation, monochrome and other advanced effects
  • -
  • Rotación, conversión a monocromo y otros efectos avanzados
  • -
  • Pööramine, ühevärvilisus ja veel mõned efektid
  • -
  • Kierto, pelkistäminen yksiväriseksi sekä muita tehosteita
  • -
  • Rotation, monochrome e altere effectos avantiate
  • -
  • Rotazione, monocromia e altri effetti avanzati
  • -
  • 회전, 흑백, 기타 고급 효과
  • -
  • Dreihen, Swatt-Witt un en Reeg verwiedert Effekten
  • -
  • Roteren, monochroom en andere geavanceerde effecten
  • -
  • Obrót, monochromatyczność i inne zaawansowane efekty
  • -
  • Rotação, monocromáticos e outros efeitos avançados
  • -
  • Rotação, monocromático e outros efeitos avançados
  • -
  • Otáčanie, monochromatické a iné pokročilé efekty
  • -
  • Vrtenje, monokromatsko in drugi napredni učinki
  • -
  • Rotation, svartvitt och andra avancerade effekter
  • -
  • Можливість обертання частин зображення, перетворення зображення на чорно-біле, різноманітні ефекти перетворення зображення.
  • -
  • xxRotation, monochrome and other advanced effectsxx
  • -
  • 旋轉、單色與其他進階效果
  • -
-
- http://www.kolourpaint.org/ - https://bugs.kde.org/enter_bug.cgi?format=guided&product=kolourpaint - http://docs.kde.org/stable/en/kdegraphics/kolourpaint/index.html - - - http://kde.org/images/screenshots/kolourpaint.png - - - KDE - - kolourpaint - -
diff --git a/kolourpaint/kolourpaint.cpp b/kolourpaint/kolourpaint.cpp deleted file mode 100644 index cdbe36df..00000000 --- a/kolourpaint/kolourpaint.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - - -int main (int argc, char *argv []) -{ - KAboutData aboutData - ( - "kolourpaint", 0, - ki18n ("KolourPaint"), - kpVersionText, - ki18n ("Paint Program for KDE"), - KAboutData::License_Custom, - ki18n (0/*copyright statement - see license instead*/), - ki18n ("To obtain support, please visit the website."), - "http://www.kolourpaint.org/" - ); - - // (this is _not_ the same as KAboutData::License_BSD) - aboutData.setLicenseText (ki18n (kpLicenseText)); - - - // Please add yourself here if you feel you're missing. - // SYNC: with AUTHORS - - aboutData.addAuthor (ki18n ("Clarence Dang"), ki18n ("Project Founder"), "dang@kde.org"); - aboutData.addAuthor (ki18n ("Thurston Dang"), ki18n ("Chief Investigator"), - "thurston_dang@users.sourceforge.net"); - aboutData.addAuthor (ki18n ("Martin Koller"), ki18n ("Scanning Support, Alpha Support, Current Maintainer"), "kollix@aon.at"); - aboutData.addAuthor (ki18n ("Kristof Borrey"), ki18n ("Icons"), "borrey@kde.org"); - aboutData.addAuthor (ki18n ("Tasuku Suzuki"), ki18n ("InputMethod Support"), "stasuku@gmail.com"); - aboutData.addAuthor (ki18n ("Kazuki Ohta"), ki18n ("InputMethod Support"), "mover@hct.zaq.ne.jp"); - aboutData.addAuthor (ki18n ("Nuno Pinheiro"), ki18n ("Icons"), "nf.pinheiro@gmail.com"); - aboutData.addAuthor (ki18n ("Danny Allen"), ki18n ("Icons"), "dannya40uk@yahoo.co.uk"); - aboutData.addAuthor (ki18n ("Mike Gashler"), ki18n ("Image Effects"), "gashlerm@yahoo.com"); - - aboutData.addAuthor (ki18n ("Laurent Montel"), ki18n ("KDE 4 Porting"), "montel@kde.org"); - - // TODO: missing a lot of people who helped with the KDE 4 port. - - aboutData.addCredit (ki18n ("Thanks to the many others who have helped to make this program possible.")); - - KCmdLineArgs::init (argc, argv, &aboutData); - - KCmdLineOptions cmdLineOptions; - cmdLineOptions.add ("+[file]", ki18n ("Image file to open")); - KCmdLineArgs::addCmdLineOptions (cmdLineOptions); - - KApplication app; - - if (app.isSessionRestored ()) - { - // Creates a kpMainWindow using the default constructor and then - // calls kpMainWindow::readProperties(). - RESTORE (kpMainWindow) - } - else - { - kpMainWindow *mainWindow; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs (); - - if (args->count () >= 1) - { - for (int i = 0; i < args->count (); i++) - { - mainWindow = new kpMainWindow (args->url (i)); - mainWindow->show (); - } - } - else - { - mainWindow = new kpMainWindow (); - mainWindow->show (); - } - - args->clear (); - } - - return app.exec (); -} diff --git a/kolourpaint/kolourpaint.desktop b/kolourpaint/kolourpaint.desktop deleted file mode 100644 index a7436453..00000000 --- a/kolourpaint/kolourpaint.desktop +++ /dev/null @@ -1,165 +0,0 @@ -[Desktop Entry] - -Name=KolourPaint -Name[ar]=كُولُرْبينْت -Name[ast]=KolourPaint -Name[be]=KolourPaint -Name[bg]=KolourPaint -Name[br]=KolourPaint -Name[bs]=KolurPaint -Name[ca]=KolourPaint -Name[ca@valencia]=KolourPaint -Name[cs]=KolourPaint -Name[cy]=KolourPaint -Name[da]=KolourPaint -Name[de]=KolourPaint -Name[el]=KolourPaint -Name[en_GB]=KolourPaint -Name[eo]=KolourPaint -Name[es]=KolourPaint -Name[et]=KolourPaint -Name[eu]=KolourPaint -Name[fa]=KolourPaint -Name[fi]=KolourPaint -Name[fr]=KolourPaint -Name[ga]=KolourPaint -Name[gl]=KolourPaint -Name[he]=KolourPaint -Name[hi]=के-कलर-पेंट -Name[hne]=के-कलर-पेंट -Name[hr]=KolourPaint -Name[hu]=KolourPaint -Name[ia]=KolourPaint -Name[is]=KolourPaint -Name[it]=KolourPaint -Name[ja]=KolourPaint -Name[kk]=KolourPaint -Name[km]=KolourPaint -Name[ko]=KolourPaint -Name[ku]=KolourPaint -Name[lt]=KolourPaint -Name[lv]=KolourPaint -Name[mr]=कलरपेंट -Name[ms]=KolourPaint -Name[nb]=KolourPaint -Name[nds]=KolourPaint -Name[ne]=रङ पेन्ट -Name[nl]=KolourPaint -Name[nn]=KolourPaint -Name[pa]=ਕੇ-ਰੰਗ-ਪੇਂਟ -Name[pl]=KolourPaint -Name[pt]=KolourPaint -Name[pt_BR]=KolourPaint -Name[ro]=KolourPaint -Name[ru]=KolourPaint -Name[se]=KolourPaint -Name[si]=KolourPaint -Name[sk]=KolourPaint -Name[sl]=KolourPaint -Name[sr]=Колор-сликање -Name[sr@ijekavian]=Колор-сликање -Name[sr@ijekavianlatin]=Kolor-slikanje -Name[sr@latin]=Kolor-slikanje -Name[sv]=Kolourpaint -Name[ta]=நிற பெயின்ட் -Name[tg]=KolourPaint -Name[th]=วาดภาพระบายสี-K -Name[tr]=KolourPaint -Name[ug]=KolourPaint -Name[uk]=KolourPaint -Name[uz]=KolourPaint -Name[uz@cyrillic]=KolourPaint -Name[vi]=KolourPaint -Name[x-test]=xxKolourPaintxx -Name[zh_CN]=KolourPaint -Name[zh_HK]=KolourPaint -Name[zh_TW]=KolourPaint 小畫家 -GenericName=Paint Program -GenericName[af]=Verf Program -GenericName[ar]=برنامج التلوين -GenericName[ast]=Programa de pintura -GenericName[bg]=Графичен редактор -GenericName[br]=Goulev tresañ -GenericName[bs]=Program za slikanje -GenericName[ca]=Programa de pintura -GenericName[ca@valencia]=Programa de pintura -GenericName[cs]=Program pro malování -GenericName[cy]=Rhaglen Peintio -GenericName[da]=Maleprogram -GenericName[de]=Mal- und Zeichenprogramm -GenericName[el]=Πρόγραμμα ζωγραφικής -GenericName[en_GB]=Paint Program -GenericName[eo]=Pentrilo -GenericName[es]=Programa de pintura -GenericName[et]=Joonistusprogramm -GenericName[eu]=Marrazteko programa -GenericName[fa]=برنامه رنگ -GenericName[fi]=Piirto-ohjelma -GenericName[fr]=Programme de dessin -GenericName[ga]=Clár Péinteála -GenericName[gl]=Programa de debuxo -GenericName[he]=תוכנית ציור -GenericName[hi]=पेंट प्रोग्राम -GenericName[hne]=पेंट प्रोग्राम -GenericName[hr]=Program za slikanje -GenericName[hu]=Rajzolóprogram -GenericName[ia]=Programma per pinger -GenericName[is]=Teikniforrit -GenericName[it]=Programma di disegno -GenericName[ja]=ペイントプログラム -GenericName[kk]=Сурет салу бағдарламасы -GenericName[km]=កម្មវិធី​គូរ -GenericName[ko]=그리기 프로그램 -GenericName[ku]=Bernameya Nexşe Kirinê -GenericName[lt]=Piešimo programa -GenericName[lv]=Krāsošanas programma -GenericName[mr]=रंग कार्यक्रम -GenericName[ms]=Program Mewarna -GenericName[nb]=Tegneprogram -GenericName[nds]=Maalprogramm -GenericName[ne]=रङ्गयाउने कार्यक्रम -GenericName[nl]=Tekenprogramma -GenericName[nn]=Måleprogram -GenericName[pa]=ਰੰਗ ਪਰੋਗਰਾਮ -GenericName[pl]=Program Paint -GenericName[pt]=Programa de Pintura -GenericName[pt_BR]=Programa de desenho -GenericName[ro]=Program de desenare -GenericName[ru]=Простой редактор изображений -GenericName[se]=Málenprográmma -GenericName[si]=පින්තාරු වැඩසටහන -GenericName[sk]=Kresliaci program -GenericName[sl]=Program za risanje -GenericName[sr]=Програм за сликање -GenericName[sr@ijekavian]=Програм за сликање -GenericName[sr@ijekavianlatin]=Program za slikanje -GenericName[sr@latin]=Program za slikanje -GenericName[sv]=Ritprogram -GenericName[ta]=பெயிண்ட் நிரலி -GenericName[tg]=Муҳаррири графикӣ -GenericName[th]=โปรแกรมวาดภาพ -GenericName[tr]=Boyama Uygulaması -GenericName[ug]=سىزىش پروگراممىسى -GenericName[uk]=Програма для малювання -GenericName[uz]=Chizish dasturi -GenericName[uz@cyrillic]=Чизиш дастури -GenericName[vi]=Chương trình vẽ -GenericName[wa]=Program di dessinaedje -GenericName[xh]=Udweliso lwenkqubo lwepeyinti -GenericName[x-test]=xxPaint Programxx -GenericName[zh_CN]=绘图程序 -GenericName[zh_HK]=繪圖程式 -GenericName[zh_TW]=繪圖程式 -Icon=kolourpaint - -Type=Application -Exec=kolourpaint --icon '%i' --caption '%c' %u -X-DocPath=kolourpaint/index.html - -# SYNC: Run branches/kolourpaint/control/scripts/kde4port/gen_mimetype_line.sh in -# the version of kdelibs/kimgio/ (e.g. KDE 4.0) KolourPaint is -# shipped with. -MimeType=image/bmp;image/gif;image/jpeg;image/jp2;image/jpeg2000;image/png;image/tiff;image/x-dds;image/x-eps;image/x-exr;image/x-hdr;image/x-ico;image/vnd.microsoft.icon;image/x-pcx;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-rgb;image/x-tga;image/x-xbitmap;image/x-xcf;image/x-xpixmap;video/x-mng;image/x-sun-raster;image/svg+xml;image/svg+xml-compressed;image/x-webp;image/webp; - -Categories=Qt;KDE;Graphics;2DGraphics;RasterGraphics; -Terminal=false diff --git a/kolourpaint/kolourpaintui.rc b/kolourpaint/kolourpaintui.rc deleted file mode 100644 index 465a647e..00000000 --- a/kolourpaint/kolourpaintui.rc +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - &View - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &Image - - - - - - - - - - - - - - - - - - - - - - - - - - &Colors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Main Toolbar - - - - - - - - - - - - - - - - -Selection Tool RMB Menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kolourpaint/kpDefs.h b/kolourpaint/kpDefs.h deleted file mode 100644 index 6d4881b5..00000000 --- a/kolourpaint/kpDefs.h +++ /dev/null @@ -1,152 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_DEFS_H -#define KP_DEFS_H - - -#include - -#include -#include -#include -#include - -#include - - -// approx. 2896x2896x32bpp or 3344x3344x24bpp (TODO: 24==32?) or 4096*4096x16bpp -#define KP_BIG_IMAGE_SIZE (32 * 1048576) - - -#define KP_PI 3.141592653589793238462 - - -#define KP_DEGREES_TO_RADIANS(deg) ((deg) * KP_PI / 180.0) -#define KP_RADIANS_TO_DEGREES(rad) ((rad) * 180.0 / KP_PI) - - -#define KP_INVALID_POINT QPoint (INT_MIN / 8, INT_MIN / 8) -#define KP_INVALID_WIDTH (INT_MIN / 8) -#define KP_INVALID_HEIGHT (INT_MIN / 8) -#define KP_INVALID_SIZE QSize (INT_MIN / 8, INT_MIN / 8) - - -#define KP_INCHES_PER_METER (100 / 2.54) -#define KP_MILLIMETERS_PER_INCH 25.4 - - -// -// Settings -// - -#define kpSettingsGroupRecentFiles "Recent Files" - -#define kpSettingsGroupGeneral "General Settings" -#define kpSettingFirstTime "First Time" -#define kpSettingShowGrid "Show Grid" -#define kpSettingShowPath "Show Path" -#define kpSettingColorSimilarity "Color Similarity" -#define kpSettingDitherOnOpen "Dither on Open if Screen is 15/16bpp and Image Num Colors More Than" -#define kpSettingPrintImageCenteredOnPage "Print Image Centered On Page" -#define kpSettingOpenImagesInSameWindow "Open Images in the Same Window" - -#define kpSettingsGroupFileSaveAs "File/Save As" -#define kpSettingsGroupFileExport "File/Export" -#define kpSettingsGroupEditCopyTo "Edit/Copy To" - -#define kpSettingForcedMimeType "Forced MimeType" -#define kpSettingForcedColorDepth "Forced Color Depth" -#define kpSettingForcedDither "Forced Dither" -#define kpSettingForcedQuality "Forced Quality" - -#define kpSettingLastDocSize "Last Document Size" - -#define kpSettingMoreEffectsLastEffect "More Effects - Last Effect" - -#define kpSettingsGroupMimeTypeProperties "MimeType Properties Version 1.2-3" -#define kpSettingMimeTypeMaximumColorDepth "Maximum Color Depth" -#define kpSettingMimeTypeHasConfigurableColorDepth "Configurable Color Depth" -#define kpSettingMimeTypeHasConfigurableQuality "Configurable Quality Setting" - - -#define kpSettingsGroupUndoRedo "Undo/Redo Settings" -#define kpSettingUndoMinLimit "Min Limit" -#define kpSettingUndoMaxLimit "Max Limit" -#define kpSettingUndoMaxLimitSizeLimit "Max Limit Size Limit" - - -#define kpSettingsGroupThumbnail "Thumbnail Settings" -#define kpSettingThumbnailShown "Shown" -#define kpSettingThumbnailGeometry "Geometry" -#define kpSettingThumbnailZoomed "Zoomed" -#define kpSettingThumbnailShowRectangle "ShowRectangle" - - -#define kpSettingsGroupPreviewSave "Save Preview Settings" -#define kpSettingPreviewSaveGeometry "Geometry" -#define kpSettingPreviewSaveUpdateDelay "Update Delay" - - -#define kpSettingsGroupTools "Tool Settings" -#define kpSettingLastTool "Last Used Tool" -#define kpSettingToolBoxIconSize "Tool Box Icon Size" - - -#define kpSettingsGroupText "Text Settings" -#define kpSettingFontFamily "Font Family" -#define kpSettingFontSize "Font Size" -#define kpSettingBold "Bold" -#define kpSettingItalic "Italic" -#define kpSettingUnderline "Underline" -#define kpSettingStrikeThru "Strike Thru" - - -#define kpSettingsGroupFlattenEffect "Flatten Effect Settings" -#define kpSettingFlattenEffectColor1 "Color1" -#define kpSettingFlattenEffectColor2 "Color2" - - -// -// Session Restore Setting -// - -// URL of the document in the main window. -// -// This key only exists if the document does. If it exists, it can be empty. -// The URL need not point to a file that exists e.g. "kolourpaint doesnotexist.png". -#define kpSessionSettingDocumentUrl QString::fromLatin1 ("Session Document Url") - -// The size of a document which is not from a URL e.g. "kolourpaint doesnotexist.png". -// This key does not exist for documents from URLs. -#define kpSessionSettingNotFromUrlDocumentSize QString::fromLatin1 ("Session Not-From-Url Document Size") - - -#endif // KP_DEFS_H - - diff --git a/kolourpaint/kpThumbnail.cpp b/kolourpaint/kpThumbnail.cpp deleted file mode 100644 index 526d5582..00000000 --- a/kolourpaint/kpThumbnail.cpp +++ /dev/null @@ -1,179 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_THUMBNAIL 0 - - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - - -struct kpThumbnailPrivate -{ - kpMainWindow *mainWindow; - kpThumbnailView *view; - QHBoxLayout *lay; -}; - -kpThumbnail::kpThumbnail (kpMainWindow *parent) - : kpSubWindow (parent), - d (new kpThumbnailPrivate ()) -{ - Q_ASSERT (parent); - - d->mainWindow = parent; - d->view = 0; - d->lay = new QHBoxLayout (this); - - - setMinimumSize (64, 64); - - - updateCaption (); -} - -kpThumbnail::~kpThumbnail () -{ - delete d; -} - - -// public -kpThumbnailView *kpThumbnail::view () const -{ - return d->view; -} - -// public -void kpThumbnail::setView (kpThumbnailView *view) -{ -#if DEBUG_KP_THUMBNAIL - kDebug () << "kpThumbnail::setView(" << view << ")"; -#endif - - if (d->view == view) - return; - - - if (d->view) - { - disconnect (d->view, SIGNAL (destroyed ()), - this, SLOT (slotViewDestroyed ())); - disconnect (d->view, SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateCaption ())); - - d->lay->removeWidget (d->view); - } - - d->view = view; - - if (d->view) - { - connect (d->view, SIGNAL (destroyed ()), - this, SLOT (slotViewDestroyed ())); - connect (d->view, SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateCaption ())); - - Q_ASSERT (d->view->parent () == this); - d->lay->addWidget (d->view, Qt::AlignCenter); - - d->view->show (); - } - - updateCaption (); -} - - -// public slot -void kpThumbnail::updateCaption () -{ - setWindowTitle (view () ? view ()->caption () : i18nc ("@title:window", "Thumbnail")); -} - - -// protected slot -void kpThumbnail::slotViewDestroyed () -{ -#if DEBUG_KP_THUMBNAIL - kDebug () << "kpThumbnail::slotViewDestroyed()"; -#endif - - d->view = 0; - updateCaption (); -} - - -// protected virtual [base QWidget] -void kpThumbnail::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_THUMBNAIL - kDebug () << "kpThumbnail::resizeEvent(" << width () - << "," << height () << ")" << endl; -#endif - - QWidget::resizeEvent (e); - - // updateVariableZoom (); TODO: is below a good idea since this commented out? - - if (d->mainWindow) - { - d->mainWindow->notifyThumbnailGeometryChanged (); - - if (d->mainWindow->tool ()) - d->mainWindow->tool ()->somethingBelowTheCursorChanged (); - } -} - -// protected virtual [base QWidget] -void kpThumbnail::moveEvent (QMoveEvent * /*e*/) -{ - if (d->mainWindow) - d->mainWindow->notifyThumbnailGeometryChanged (); -} - -// protected virtual [base QWidget] -void kpThumbnail::closeEvent (QCloseEvent *e) -{ - QWidget::closeEvent (e); - - emit windowClosed (); -} - - -#include "moc_kpThumbnail.cpp" diff --git a/kolourpaint/kpThumbnail.h b/kolourpaint/kpThumbnail.h deleted file mode 100644 index f8cad02e..00000000 --- a/kolourpaint/kpThumbnail.h +++ /dev/null @@ -1,76 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_THUMBNAIL_H -#define KP_THUMBNAIL_H - - -#include - - -#include -#include - -class kpMainWindow; -class kpThumbnailView; - - -struct kpThumbnailPrivate; - -class kpThumbnail : public kpSubWindow -{ -Q_OBJECT - -public: - kpThumbnail (kpMainWindow *parent); - virtual ~kpThumbnail (); - -public: - kpThumbnailView *view () const; - void setView (kpThumbnailView *view); - -public slots: - void updateCaption (); - -protected slots: - void slotViewDestroyed (); - -protected: - virtual void resizeEvent (QResizeEvent *e); - virtual void moveEvent (QMoveEvent *e); - virtual void closeEvent (QCloseEvent *e); - -signals: - void windowClosed (); - -private: - kpThumbnailPrivate * const d; -}; - - -#endif // KP_THUMBNAIL_H diff --git a/kolourpaint/kpViewScrollableContainer.cpp b/kolourpaint/kpViewScrollableContainer.cpp deleted file mode 100644 index 4aa77bc6..00000000 --- a/kolourpaint/kpViewScrollableContainer.cpp +++ /dev/null @@ -1,1181 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_VIEW_SCROLLABLE_CONTAINER 0 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// (Pulled from out of Thurston's hat) -static const int DragScrollLeftTopMargin = 0; -static const int DragScrollRightBottomMargin = 16; // scrollbarish -static const int DragScrollInterval = 150; -static const int DragScrollInitialInterval = DragScrollInterval * 2; -static const int DragScrollNumPixels = 10; -static const int DragDistanceFromRectMaxFor1stMultiplier = 50; -static const int DragDistanceFromRectMaxFor2ndMultiplier = 100; - -//--------------------------------------------------------------------- -//--------------------------------------------------------------------- -// a transparent widget above all others in the viewport used only while resizing the document -// to be able to show the resize lines above everything else - -class kpOverlay : public QWidget -{ - public: - kpOverlay(QWidget *parent, kpViewScrollableContainer *container) - : QWidget(parent), m_container(container) - { - } - - virtual void paintEvent(QPaintEvent *) - { - m_container->drawResizeLines(); - } - - private: - kpViewScrollableContainer *m_container; - -}; - -//--------------------------------------------------------------------- - -const int kpGrip::Size = 5; - -//--------------------------------------------------------------------- - -kpGrip::kpGrip (GripType type, QWidget *parent) - : QWidget(parent), - m_type (type), - m_startPoint (KP_INVALID_POINT), - m_currentPoint (KP_INVALID_POINT), - m_shouldReleaseMouseButtons (false) -{ - setCursor(cursorForType(m_type)); - - setMouseTracking(true); // mouseMoveEvent's even when no mousebtn down - - setAutoFillBackground(true); - setBackgroundRole(QPalette::Highlight); - - setFixedSize(kpGrip::Size, kpGrip::Size); -} - -//--------------------------------------------------------------------- - -// public -kpGrip::GripType kpGrip::type () const -{ - return m_type; -} - -//--------------------------------------------------------------------- - -// public static -QCursor kpGrip::cursorForType (GripType type) -{ - switch (type) - { - case kpGrip::Bottom: - return Qt::SizeVerCursor; - break; // one day you'll forget - - case kpGrip::Right: - return Qt::SizeHorCursor; - break; // one day you'll forget - - case kpGrip::BottomRight: - return Qt::SizeFDiagCursor; - break; // one day you'll forget - } - - return Qt::ArrowCursor; -} - -//--------------------------------------------------------------------- - -// public -bool kpGrip::containsCursor() -{ - return isVisible() && - QRect(mapToGlobal(rect().topLeft()), - mapToGlobal(rect().bottomRight())).contains(QCursor::pos()); -} - -//--------------------------------------------------------------------- - -// public -bool kpGrip::isDrawing () const -{ - return (m_startPoint != KP_INVALID_POINT); -} - -//--------------------------------------------------------------------- - -// public -QString kpGrip::haventBegunDrawUserMessage () const -{ - return i18n ("Left drag the handle to resize the image."); -} - -//--------------------------------------------------------------------- - -// public -QString kpGrip::userMessage () const -{ - return m_userMessage; -} - -//--------------------------------------------------------------------- - -// public -void kpGrip::setUserMessage (const QString &message) -{ - // Don't do NOP checking here since another grip might have changed - // the message so an apparent NOP for this grip is not a NOP in the - // global sense (kpViewScrollableContainer::slotGripStatusMessageChanged()). - - m_userMessage = message; - emit statusMessageChanged (message); -} - -//--------------------------------------------------------------------- - -// protected -void kpGrip::cancel () -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpGrip::cancel()"; -#endif - if (m_currentPoint == KP_INVALID_POINT) - return; - - m_startPoint = KP_INVALID_POINT; - m_currentPoint = KP_INVALID_POINT; - - setUserMessage (i18n ("Resize Image: Let go of all the mouse buttons.")); - setCursor (Qt::ArrowCursor); - m_shouldReleaseMouseButtons = true; - - releaseKeyboard (); - emit cancelledDraw (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::keyReleaseEvent (QKeyEvent *e) -{ - if (m_startPoint != KP_INVALID_POINT && - e->key () == Qt::Key_Escape) - { - cancel (); - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::mousePressEvent (QMouseEvent *e) -{ - if (m_startPoint == KP_INVALID_POINT && - (e->buttons () & Qt::MouseButtonMask) == Qt::LeftButton) - { - m_startPoint = e->pos (); - m_currentPoint = e->pos (); - emit beganDraw (); - grabKeyboard (); - - setUserMessage (i18n ("Resize Image: Right click to cancel.")); - setCursor (cursorForType (m_type)); - } - else - { - if (m_startPoint != KP_INVALID_POINT) - cancel (); - } -} - -//--------------------------------------------------------------------- - -// public -QPoint kpGrip::viewDeltaPoint () const -{ - if (m_startPoint == KP_INVALID_POINT) - return KP_INVALID_POINT; - - const QPoint point = mapFromGlobal (QCursor::pos ()); - - // TODO: this is getting out of sync with m_currentPoint - - return QPoint (((m_type & kpGrip::Right) ? point.x () - m_startPoint.x () : 0), - ((m_type & kpGrip::Bottom) ? point.y () - m_startPoint.y () : 0)); - -} - -//--------------------------------------------------------------------- - -// public -void kpGrip::mouseMovedTo (const QPoint &point, bool dueToDragScroll) -{ - if (m_startPoint == KP_INVALID_POINT) - return; - - m_currentPoint = point; - - emit continuedDraw (((m_type & kpGrip::Right) ? point.x () - m_startPoint.x () : 0), - ((m_type & kpGrip::Bottom) ? point.y () - m_startPoint.y () : 0), - dueToDragScroll); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::mouseMoveEvent (QMouseEvent *e) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpGrip::mouseMoveEvent() m_startPoint=" << m_startPoint - << " stateAfter: buttons=" << (int *) (int) e->buttons () - << endl; -#endif - - if (m_startPoint == KP_INVALID_POINT) - { - if ((e->buttons () & Qt::MouseButtonMask) == 0) - setUserMessage (haventBegunDrawUserMessage ()); - return; - } - - mouseMovedTo (e->pos (), false/*not due to drag scroll*/); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::mouseReleaseEvent (QMouseEvent *e) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpGrip::mouseReleaseEvent() m_startPoint=" << m_startPoint - << " stateAfter: buttons=" << (int *) (int) e->buttons () - << endl; -#endif - - if (m_startPoint != KP_INVALID_POINT) - { - const int dx = m_currentPoint.x () - m_startPoint.x (), - dy = m_currentPoint.y () - m_startPoint.y (); - - m_currentPoint = KP_INVALID_POINT; - m_startPoint = KP_INVALID_POINT; - - releaseKeyboard (); - emit endedDraw ((m_type & kpGrip::Right) ? dx : 0, - (m_type & kpGrip::Bottom) ? dy : 0); - } - - if ((e->buttons () & Qt::MouseButtonMask) == 0) - { - m_shouldReleaseMouseButtons = false; - setUserMessage(QString()); - setCursor (cursorForType (m_type)); - - releaseKeyboard (); - emit releasedAllButtons (); - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::enterEvent (QEvent * /*e*/) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpGrip::enterEvent()" - << " m_startPoint=" << m_startPoint - << " shouldReleaseMouseButtons=" - << m_shouldReleaseMouseButtons << endl; -#endif - - if (m_startPoint == KP_INVALID_POINT && - !m_shouldReleaseMouseButtons) - { - #if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "\tsending message"; - #endif - setUserMessage (haventBegunDrawUserMessage ()); - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpGrip::leaveEvent (QEvent * /*e*/) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpGrip::leaveEvent()" - << " m_startPoint=" << m_startPoint - << " shouldReleaseMouseButtons=" - << m_shouldReleaseMouseButtons << endl; -#endif - if (m_startPoint == KP_INVALID_POINT && - !m_shouldReleaseMouseButtons) - { - setUserMessage(QString()); - } -} - -//--------------------------------------------------------------------- -//--------------------------------------------------------------------- -//--------------------------------------------------------------------- - -// TODO: Are we checking for m_view == 0 often enough? Also an issue in KDE 3. -kpViewScrollableContainer::kpViewScrollableContainer(QWidget *parent) - : QScrollArea(parent), - m_view(0), m_overlay(new kpOverlay(viewport(), this)), - m_docResizingGrip (0), - m_dragScrollTimer (new QTimer (this)), - m_zoomLevel (100), - m_scrollTimerRunOnce (false), - m_resizeRoundedLastViewX (-1), m_resizeRoundedLastViewY (-1), - m_resizeRoundedLastViewDX (0), m_resizeRoundedLastViewDY (0), - m_haveMovedFromOriginalDocSize (false) - -{ - // the base widget holding the documents view plus the resize grips - setWidget(new QWidget(viewport())); - - m_bottomGrip = new kpGrip(kpGrip::Bottom, widget()); - m_rightGrip = new kpGrip(kpGrip::Right, widget()); - m_bottomRightGrip = new kpGrip(kpGrip::BottomRight, widget()); - - m_bottomGrip->setObjectName(QLatin1String("Bottom Grip")); - m_rightGrip->setObjectName(QLatin1String("Right Grip")); - m_bottomRightGrip->setObjectName(QLatin1String("BottomRight Grip")); - - m_bottomGrip->hide (); - connectGripSignals (m_bottomGrip); - - m_rightGrip->hide (); - connectGripSignals (m_rightGrip); - - m_bottomRightGrip->hide (); - connectGripSignals (m_bottomRightGrip); - - - connect (horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(slotContentsMoved())); - - connect (verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(slotContentsMoved())); - - connect (m_dragScrollTimer, SIGNAL (timeout ()), - this, SLOT (slotDragScroll ())); - - m_overlay->hide(); -} - -//--------------------------------------------------------------------- - -// protected -void kpViewScrollableContainer::connectGripSignals (kpGrip *grip) -{ - connect (grip, SIGNAL (beganDraw ()), - this, SLOT (slotGripBeganDraw ())); - connect (grip, SIGNAL (continuedDraw (int, int, bool)), - this, SLOT (slotGripContinuedDraw (int, int, bool))); - connect (grip, SIGNAL (cancelledDraw ()), - this, SLOT (slotGripCancelledDraw ())); - connect (grip, SIGNAL (endedDraw (int, int)), - this, SLOT (slotGripEndedDraw (int, int))); - - connect (grip, SIGNAL (statusMessageChanged (const QString &)), - this, SLOT (slotGripStatusMessageChanged (const QString &))); - - connect (grip, SIGNAL (releasedAllButtons ()), - this, SLOT (recalculateStatusMessage ())); -} - -//--------------------------------------------------------------------- - -// public -QSize kpViewScrollableContainer::newDocSize () const -{ - return newDocSize (m_resizeRoundedLastViewDX, - m_resizeRoundedLastViewDY); -} - -//--------------------------------------------------------------------- - -// public -bool kpViewScrollableContainer::haveMovedFromOriginalDocSize () const -{ - return m_haveMovedFromOriginalDocSize; -} - -//--------------------------------------------------------------------- - -// public -QString kpViewScrollableContainer::statusMessage () const -{ - return m_gripStatusMessage; -} - -//--------------------------------------------------------------------- - -// public -void kpViewScrollableContainer::clearStatusMessage () -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER && 1 - kDebug () << "kpViewScrollableContainer::clearStatusMessage()"; -#endif - m_bottomRightGrip->setUserMessage(QString()); - m_bottomGrip->setUserMessage(QString()); - m_rightGrip->setUserMessage(QString()); -} - -//--------------------------------------------------------------------- - -// protected -QSize kpViewScrollableContainer::newDocSize (int viewDX, int viewDY) const -{ - if (!m_view) - return QSize (); - - if (!docResizingGrip ()) - return QSize (); - - const int docX = (int) m_view->transformViewToDocX (m_view->width () + viewDX); - const int docY = (int) m_view->transformViewToDocY (m_view->height () + viewDY); - - return QSize (qMax (1, docX), qMax (1, docY)); -} - -//--------------------------------------------------------------------- - -// protected -void kpViewScrollableContainer::calculateDocResizingGrip () -{ - if (m_bottomRightGrip->isDrawing ()) - m_docResizingGrip = m_bottomRightGrip; - else if (m_bottomGrip->isDrawing ()) - m_docResizingGrip = m_bottomGrip; - else if (m_rightGrip->isDrawing ()) - m_docResizingGrip = m_rightGrip; - else - m_docResizingGrip = 0; -} - -//--------------------------------------------------------------------- - -// protected -kpGrip *kpViewScrollableContainer::docResizingGrip () const -{ - return m_docResizingGrip; -} - -//--------------------------------------------------------------------- - -// protected -int kpViewScrollableContainer::bottomResizeLineWidth () const -{ - if (!docResizingGrip ()) - return -1; - - if (!m_view) - return -1; - - if (docResizingGrip ()->type () & kpGrip::Bottom) - return qMax (m_view->zoomLevelY () / 100, 1); - else - return 1; -} - -//--------------------------------------------------------------------- - -// protected -int kpViewScrollableContainer::rightResizeLineWidth () const -{ - if (!docResizingGrip ()) - return -1; - - if (!m_view) - return -1; - - if (docResizingGrip ()->type () & kpGrip::Right) - return qMax (m_view->zoomLevelX () / 100, 1); - else - return 1; -} - -//--------------------------------------------------------------------- - -// protected -QRect kpViewScrollableContainer::bottomResizeLineRect () const -{ - if (m_resizeRoundedLastViewX < 0 || m_resizeRoundedLastViewY < 0) - return QRect (); - - QRect visibleArea = QRect(QPoint(horizontalScrollBar()->value(),verticalScrollBar()->value()), viewport()->size()); - - return QRect (QPoint (0, - m_resizeRoundedLastViewY), - QPoint (m_resizeRoundedLastViewX - 1, - m_resizeRoundedLastViewY + bottomResizeLineWidth () - 1)).intersected(visibleArea); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpViewScrollableContainer::rightResizeLineRect () const -{ - if (m_resizeRoundedLastViewX < 0 || m_resizeRoundedLastViewY < 0) - return QRect (); - - QRect visibleArea = QRect(QPoint(horizontalScrollBar()->value(),verticalScrollBar()->value()), viewport()->size()); - - return QRect (QPoint (m_resizeRoundedLastViewX, - 0), - QPoint (m_resizeRoundedLastViewX + rightResizeLineWidth () - 1, - m_resizeRoundedLastViewY - 1)).intersected(visibleArea); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpViewScrollableContainer::bottomRightResizeLineRect () const -{ - if (m_resizeRoundedLastViewX < 0 || m_resizeRoundedLastViewY < 0) - return QRect (); - - QRect visibleArea = QRect(QPoint(horizontalScrollBar()->value(),verticalScrollBar()->value()), viewport()->size()); - - return QRect (QPoint (m_resizeRoundedLastViewX, - m_resizeRoundedLastViewY), - QPoint (m_resizeRoundedLastViewX + rightResizeLineWidth () - 1, - m_resizeRoundedLastViewY + bottomResizeLineWidth () - 1)).intersected(visibleArea); -} - -//--------------------------------------------------------------------- - -// private -QRect kpViewScrollableContainer::mapViewToViewport (const QRect &viewRect) -{ - if (!viewRect.isValid ()) - return QRect (); - - QRect ret = viewRect; - ret.translate (-horizontalScrollBar()->value() - viewport()->x(), -verticalScrollBar()->value() - viewport()->y()); - return ret; -} - -//--------------------------------------------------------------------- - -void kpViewScrollableContainer::drawResizeLines () -{ - static const char *stipple[] = - { - "8 8 2 1", - ". c #000000", - "# c #ffffff", - "....####", - "....####", - "....####", - "....####", - "####....", - "####....", - "####....", - "####...." - }; - - QPainter p(m_overlay); - p.setBackground(QPixmap(stipple)); - - const QRect rightRect = rightResizeLineRect(); - if ( rightRect.isValid() ) - { - QRect rect = mapViewToViewport(rightRect); - p.setBrushOrigin(rect.x(), rect.y()); - p.eraseRect(rect); - } - - const QRect bottomRect = bottomResizeLineRect(); - if ( bottomRect.isValid() ) - { - QRect rect = mapViewToViewport(bottomRect); - p.setBrushOrigin(rect.x(), rect.y()); - p.eraseRect(rect); - } - - const QRect bottomRightRect = bottomRightResizeLineRect (); - if ( bottomRightRect.isValid() ) - { - QRect rect = mapViewToViewport(bottomRightRect); - p.setBrushOrigin(rect.x(), rect.y()); - p.eraseRect(rect); - } -} - -//--------------------------------------------------------------------- - -// protected -void kpViewScrollableContainer::updateResizeLines (int viewX, int viewY, - int viewDX, int viewDY) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER && 0 - kDebug () << "kpViewScrollableContainer::updateResizeLines(" - << viewX << "," << viewY << ")" - << " oldViewX=" << m_resizeRoundedLastViewX - << " oldViewY=" << m_resizeRoundedLastViewY - << " viewDX=" << viewDX - << " viewDY=" << viewDY - << endl; -#endif - - - if (viewX >= 0 && viewY >= 0) - { - m_resizeRoundedLastViewX = (int) m_view->transformDocToViewX ((int) m_view->transformViewToDocX (viewX)); - m_resizeRoundedLastViewY = (int) m_view->transformDocToViewY ((int) m_view->transformViewToDocY (viewY)); - - m_resizeRoundedLastViewDX = viewDX; - m_resizeRoundedLastViewDY = viewDY; - } - else - { - m_resizeRoundedLastViewX = -1; - m_resizeRoundedLastViewY = -1; - - m_resizeRoundedLastViewDX = 0; - m_resizeRoundedLastViewDY = 0; - } - - m_overlay->update(); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotGripBeganDraw () -{ - if (!m_view) - return; - - m_overlay->resize(viewport()->size()); // make it cover whole viewport - m_overlay->move(viewport()->pos()); - m_overlay->show(); - m_overlay->raise(); // make it top-most - - calculateDocResizingGrip (); - - m_haveMovedFromOriginalDocSize = false; - - updateResizeLines (m_view->width (), m_view->height (), - 0/*viewDX*/, 0/*viewDY*/); - - emit beganDocResize (); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotGripContinuedDraw (int inViewDX, int inViewDY, - bool dueToDragScroll) -{ - int viewDX = inViewDX, - viewDY = inViewDY; - -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpViewScrollableContainer::slotGripContinuedDraw(" - << viewDX << "," << viewDY << ") size=" - << newDocSize (viewDX, viewDY) - << " dueToDragScroll=" << dueToDragScroll - << endl; -#endif - - if (!m_view) - return; - - if (!dueToDragScroll && - beginDragScroll(m_view->zoomLevelX ())) - { - const QPoint newViewDeltaPoint = docResizingGrip ()->viewDeltaPoint (); - viewDX = newViewDeltaPoint.x (); - viewDY = newViewDeltaPoint.y (); - #if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "\tdrag scrolled - new view delta point=" - << newViewDeltaPoint - << endl; - #endif - } - - m_haveMovedFromOriginalDocSize = true; - - updateResizeLines (qMax (1, qMax (m_view->width () + viewDX, (int) m_view->transformDocToViewX (1))), - qMax (1, qMax (m_view->height () + viewDY, (int) m_view->transformDocToViewY (1))), - viewDX, viewDY); - - emit continuedDocResize (newDocSize ()); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotGripCancelledDraw () -{ - m_haveMovedFromOriginalDocSize = false; - - updateResizeLines (-1, -1, 0, 0); - - calculateDocResizingGrip (); - - emit cancelledDocResize (); - - endDragScroll (); - - m_overlay->hide(); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotGripEndedDraw (int viewDX, int viewDY) -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpViewScrollableContainer::slotGripEndedDraw(" - << viewDX << "," << viewDY << ") size=" - << newDocSize (viewDX, viewDY) - << endl; -#endif - - if (!m_view) - return; - - const QSize newSize = newDocSize (viewDX, viewDY); - - m_haveMovedFromOriginalDocSize = false; - - // must erase lines before view size changes - updateResizeLines (-1, -1, 0, 0); - - calculateDocResizingGrip (); - - emit endedDocResize (newSize); - - endDragScroll (); - - m_overlay->hide(); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotGripStatusMessageChanged (const QString &string) -{ - if (string == m_gripStatusMessage) - return; - - m_gripStatusMessage = string; - emit statusMessageChanged (string); -} - -//--------------------------------------------------------------------- - -// public slot -void kpViewScrollableContainer::recalculateStatusMessage () -{ -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER - kDebug () << "kpViewScrollabelContainer::recalculateStatusMessage()"; - kDebug () << "\tQCursor::pos=" << QCursor::pos () - << " global visibleRect=" - << kpWidgetMapper::toGlobal (this, - QRect(0, 0, viewport->width(), viewport->height())) - << endl; -#endif - - // HACK: After dragging to a new size, handles move so that they are now - // under the mouse pointer but no mouseMoveEvent() is generated for - // any grip. This also handles the case of canceling over any - // grip. - // - if (kpWidgetMapper::toGlobal (this, - QRect(0, 0, viewport()->width(), viewport()->height())) - .contains (QCursor::pos ())) - { - if ( m_bottomRightGrip->containsCursor() ) - { - m_bottomRightGrip->setUserMessage (i18n ("Left drag the handle to resize the image.")); - } - else if ( m_bottomGrip->containsCursor() ) - { - m_bottomGrip->setUserMessage (i18n ("Left drag the handle to resize the image.")); - } - else if ( m_rightGrip->containsCursor() ) - { - m_rightGrip->setUserMessage (i18n ("Left drag the handle to resize the image.")); - } - else - { - clearStatusMessage (); - } - } - else - { - clearStatusMessage (); - } -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotContentsMoved () -{ - kpGrip *grip = docResizingGrip (); - if (grip) - { - grip->mouseMovedTo (grip->mapFromGlobal (QCursor::pos ()), - true/*moved due to drag scroll*/); - } - - m_overlay->move(viewport()->pos()); - m_overlay->update(); - - emit contentsMoved(); -} - -//--------------------------------------------------------------------- - -// protected -void kpViewScrollableContainer::disconnectViewSignals () -{ - disconnect (m_view, SIGNAL (sizeChanged (const QSize &)), - this, SLOT (updateGrips ())); - disconnect (m_view, SIGNAL (destroyed ()), - this, SLOT (slotViewDestroyed ())); -} - -//--------------------------------------------------------------------- - -// protected -void kpViewScrollableContainer::connectViewSignals () -{ - connect (m_view, SIGNAL (sizeChanged (const QSize &)), - this, SLOT (updateGrips ())); - connect (m_view, SIGNAL (destroyed ()), - this, SLOT (slotViewDestroyed ())); -} - -//--------------------------------------------------------------------- - -// public -kpView *kpViewScrollableContainer::view () const -{ - return m_view; -} - -//--------------------------------------------------------------------- - -// public -void kpViewScrollableContainer::setView (kpView *view) -{ - if (m_view == view) - return; - - if (m_view) - { - disconnectViewSignals (); - } - - m_view = view; - - if ( m_view ) - { - m_view->setParent(widget()); - m_view->show(); - } - - updateGrips (); - - if (m_view) - { - connectViewSignals (); - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpViewScrollableContainer::updateGrips () -{ - if (m_view) - { - widget()->resize(m_view->size() + m_bottomRightGrip->size()); - - // to make the grip more easily "touchable" make it as high as the view - m_rightGrip->setFixedHeight(m_view->height()); - m_rightGrip->move(m_view->width(), 0); - - // to make the grip more easily "touchable" make it as wide as the view - m_bottomGrip->setFixedWidth(m_view->width()); - m_bottomGrip->move(0, m_view->height ()); - - m_bottomRightGrip->move(m_view->width(), m_view->height()); - } - - m_bottomGrip->setHidden (m_view == 0); - m_rightGrip->setHidden (m_view == 0); - m_bottomRightGrip->setHidden (m_view == 0); - - recalculateStatusMessage (); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpViewScrollableContainer::slotViewDestroyed () -{ - m_view = 0; - updateGrips (); -} - -//--------------------------------------------------------------------- - -// public slot -bool kpViewScrollableContainer::beginDragScroll(int zoomLevel, bool *didSomething) -{ - if (didSomething) - *didSomething = false; - - m_zoomLevel = zoomLevel; - - const QPoint p = mapFromGlobal (QCursor::pos ()); - - bool stopDragScroll = true; - bool scrolled = false; - - if (!noDragScrollRect ().contains (p)) - { - if (m_dragScrollTimer->isActive ()) - { - if (m_scrollTimerRunOnce) - { - scrolled = slotDragScroll (); - } - } - else - { - m_scrollTimerRunOnce = false; - m_dragScrollTimer->start (DragScrollInitialInterval); - } - - stopDragScroll = false; - } - - if (stopDragScroll) - m_dragScrollTimer->stop (); - - if (didSomething) - *didSomething = scrolled; - - return scrolled; -} - -//--------------------------------------------------------------------- - -// public slot -bool kpViewScrollableContainer::beginDragScroll(int zoomLevel) -{ - return beginDragScroll(zoomLevel, - 0/*don't want scrolled notification*/); -} - -//--------------------------------------------------------------------- - -// public slot -bool kpViewScrollableContainer::endDragScroll () -{ - if (m_dragScrollTimer->isActive ()) - { - m_dragScrollTimer->stop (); - return true; - } - else - { - return false; - } -} - -//--------------------------------------------------------------------- - -static int distanceFromRectToMultiplier (int dist) -{ - if (dist < 0) - return 0; - else if (dist < DragDistanceFromRectMaxFor1stMultiplier) - return 1; - else if (dist < DragDistanceFromRectMaxFor2ndMultiplier) - return 2; - else - return 4; -} - -//--------------------------------------------------------------------- - -// protected slot -bool kpViewScrollableContainer::slotDragScroll (bool *didSomething) -{ - bool scrolled = false; - - if (didSomething) - *didSomething = false; - - - const QRect rect = noDragScrollRect (); - const QPoint pos = mapFromGlobal (QCursor::pos ()); - - int dx = 0, dy = 0; - int dxMultiplier = 0, dyMultiplier = 0; - - if (pos.x () < rect.left ()) - { - dx = -DragScrollNumPixels; - dxMultiplier = distanceFromRectToMultiplier (rect.left () - pos.x ()); - } - else if (pos.x () > rect.right ()) - { - dx = +DragScrollNumPixels; - dxMultiplier = distanceFromRectToMultiplier (pos.x () - rect.right ()); - } - - if (pos.y () < rect.top ()) - { - dy = -DragScrollNumPixels; - dyMultiplier = distanceFromRectToMultiplier (rect.top () - pos.y ()); - } - else if (pos.y () > rect.bottom ()) - { - dy = +DragScrollNumPixels; - dyMultiplier = distanceFromRectToMultiplier (pos.y () - rect.bottom ()); - } - - dx *= dxMultiplier;// * qMax (1, m_zoomLevel / 100); - dy *= dyMultiplier;// * qMax (1, m_zoomLevel / 100); - - if (dx || dy) - { - const int oldContentsX = horizontalScrollBar()->value (), - oldContentsY = verticalScrollBar()->value (); - - horizontalScrollBar()->setValue(oldContentsX + dx); - verticalScrollBar()->setValue(oldContentsY + dy); - - scrolled = (oldContentsX != horizontalScrollBar()->value () || - oldContentsY != verticalScrollBar()->value ()); - - if (scrolled) - { - QRegion region = QRect (horizontalScrollBar()->value (), verticalScrollBar()->value (), - viewport()->width(), viewport()->height()); - region -= QRect (oldContentsX, oldContentsY, - viewport()->width(), viewport()->height()); - - // Repaint newly exposed region immediately to reduce tearing - // of scrollView. - m_view->repaint (region); - } - } - - m_dragScrollTimer->start (DragScrollInterval); - m_scrollTimerRunOnce = true; - - if (didSomething) - *didSomething = scrolled; - - return scrolled; -} - -//--------------------------------------------------------------------- - -// protected slot -bool kpViewScrollableContainer::slotDragScroll () -{ - return slotDragScroll (0/*don't want scrolled notification*/); -} - -//--------------------------------------------------------------------- - -// protected virtual -void kpViewScrollableContainer::wheelEvent (QWheelEvent *e) -{ - e->ignore (); - - if (m_view) - m_view->wheelEvent (e); - - if ( !e->isAccepted() ) - QScrollArea::wheelEvent(e); -} - -//--------------------------------------------------------------------- - -QRect kpViewScrollableContainer::noDragScrollRect () const -{ - return QRect (DragScrollLeftTopMargin, DragScrollLeftTopMargin, - width () - DragScrollLeftTopMargin - DragScrollRightBottomMargin, - height () - DragScrollLeftTopMargin - DragScrollRightBottomMargin); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QScrollView] -void kpViewScrollableContainer::resizeEvent (QResizeEvent *e) -{ - QScrollArea::resizeEvent (e); - - emit resized (); -} - -//--------------------------------------------------------------------- - -#include "moc_kpViewScrollableContainer.cpp" diff --git a/kolourpaint/kpViewScrollableContainer.h b/kolourpaint/kpViewScrollableContainer.h deleted file mode 100644 index d3595483..00000000 --- a/kolourpaint/kpViewScrollableContainer.h +++ /dev/null @@ -1,216 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_VIEW_SCROLLABLE_CONTAINER_H -#define KP_VIEW_SCROLLABLE_CONTAINER_H - - -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class kpView; -class kpOverlay; - - -//--------------------------------------------------------------------- - -// REFACTOR: refactor by sharing iface's with kpTool -class kpGrip : public QWidget -{ -Q_OBJECT - -public: - enum GripType - { - Right = 1, Bottom = 2, - BottomRight = Right | Bottom - }; - - kpGrip (GripType type, QWidget *parent); - - GripType type () const; - - static QCursor cursorForType (GripType type); - - bool containsCursor(); - - bool isDrawing () const; - - static const int Size; - -signals: - void beganDraw (); - void continuedDraw (int viewDX, int viewDY, bool dueToDragScroll); - void cancelledDraw (); - void endedDraw (int viewDX, int viewDY); - - void statusMessageChanged (const QString &string); - - void releasedAllButtons (); - -public: - QString haventBegunDrawUserMessage () const; - - QString userMessage () const; - void setUserMessage (const QString &message); - -protected: - void cancel (); - -protected: - virtual void keyReleaseEvent (QKeyEvent *e); - virtual void mousePressEvent (QMouseEvent *e); -public: - QPoint viewDeltaPoint () const; - void mouseMovedTo (const QPoint &point, bool dueToDragScroll); -protected: - virtual void mouseMoveEvent (QMouseEvent *e); - virtual void mouseReleaseEvent (QMouseEvent *e); - - virtual void enterEvent (QEvent *e); - virtual void leaveEvent (QEvent *e); - -protected: - GripType m_type; - QPoint m_startPoint, m_currentPoint; - QString m_userMessage; - bool m_shouldReleaseMouseButtons; -}; - -//--------------------------------------------------------------------- - -class kpViewScrollableContainer : public QScrollArea -{ -Q_OBJECT - -public: - kpViewScrollableContainer(QWidget *parent); - - QSize newDocSize () const; - bool haveMovedFromOriginalDocSize () const; - QString statusMessage () const; - void clearStatusMessage (); - - kpView *view () const; - void setView (kpView *view); - - void drawResizeLines(); // public only for kpOverlay - -signals: - void contentsMoved(); - - void beganDocResize (); - void continuedDocResize (const QSize &size); - void cancelledDocResize (); - void endedDocResize (const QSize &size); - - // (string.isEmpty() if kpViewScrollableContainer has nothing to say) - void statusMessageChanged (const QString &string); - - void resized (); - -public slots: - void recalculateStatusMessage (); - - void updateGrips (); - - // TODO: Why the need for view's zoomLevel? We have the view() anyway. - bool beginDragScroll (int zoomLevel, - bool *didSomething); - bool beginDragScroll (int zoomLevel); - bool endDragScroll (); - -private: - void connectGripSignals (kpGrip *grip); - - QSize newDocSize (int viewDX, int viewDY) const; - - void calculateDocResizingGrip (); - kpGrip *docResizingGrip () const; - - int bottomResizeLineWidth () const; - int rightResizeLineWidth () const; - - QRect bottomResizeLineRect () const; - QRect rightResizeLineRect () const; - QRect bottomRightResizeLineRect () const; - - QRect mapViewToViewport (const QRect &viewRect); - - void updateResizeLines (int viewX, int viewY, - int viewDX, int viewDY); - - void disconnectViewSignals (); - void connectViewSignals (); - - QRect noDragScrollRect () const; - - virtual void wheelEvent(QWheelEvent *e); - virtual void resizeEvent(QResizeEvent *e); - -private slots: - void slotGripBeganDraw (); - void slotGripContinuedDraw (int viewDX, int viewDY, bool dueToScrollView); - void slotGripCancelledDraw (); - void slotGripEndedDraw (int viewDX, int viewDY); - - void slotGripStatusMessageChanged (const QString &string); - - void slotContentsMoved (); - void slotViewDestroyed (); - bool slotDragScroll (bool *didSomething); - bool slotDragScroll (); - -private: - kpView *m_view; - kpOverlay *m_overlay; - kpGrip *m_bottomGrip, *m_rightGrip, *m_bottomRightGrip; - kpGrip *m_docResizingGrip; - QTimer *m_dragScrollTimer; - int m_zoomLevel; - bool m_scrollTimerRunOnce; - int m_resizeRoundedLastViewX, m_resizeRoundedLastViewY; - int m_resizeRoundedLastViewDX, m_resizeRoundedLastViewDY; - bool m_haveMovedFromOriginalDocSize; - QString m_gripStatusMessage; -}; - -#endif // KP_VIEW_SCROLLABLE_CONTAINER_H diff --git a/kolourpaint/layers/selections/image/kpAbstractImageSelection.cpp b/kolourpaint/layers/selections/image/kpAbstractImageSelection.cpp deleted file mode 100644 index 0ad56884..00000000 --- a/kolourpaint/layers/selections/image/kpAbstractImageSelection.cpp +++ /dev/null @@ -1,583 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -// Returns whether can be set to have . -// In other words, this is the precondition for .setBaseImage(width () && - baseImage.height () == sel->height ()); -} - -//--------------------------------------------------------------------- - -struct kpAbstractImageSelectionPrivate -{ - kpImage baseImage; - - kpImageSelectionTransparency transparency; - - // The mask for the image, after selection transparency (a.k.a. background - // subtraction) is applied. - QBitmap transparencyMaskCache; // OPT: calculate lazily i.e. on-demand only -}; - -//--------------------------------------------------------------------- - -// protected -kpAbstractImageSelection::kpAbstractImageSelection ( - const kpImageSelectionTransparency &transparency) - : kpAbstractSelection (), - d (new kpAbstractImageSelectionPrivate ()) -{ - setTransparency (transparency); -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractImageSelection::kpAbstractImageSelection (const QRect &rect, - const kpImage &baseImage, - const kpImageSelectionTransparency &transparency) - : kpAbstractSelection (rect), - d (new kpAbstractImageSelectionPrivate ()) -{ - // This also checks that and have compatible - // relative dimensions. - setBaseImage (baseImage); - - setTransparency (transparency); -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractImageSelection::kpAbstractImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency) - : kpAbstractSelection (rect), - d (new kpAbstractImageSelectionPrivate ()) -{ - setTransparency (transparency); -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractImageSelection &kpAbstractImageSelection::operator= ( - const kpAbstractImageSelection &rhs) -{ - kpAbstractSelection::operator= (rhs); - - d->baseImage = rhs.d->baseImage; - - d->transparency = rhs.d->transparency; - d->transparencyMaskCache = rhs.d->transparencyMaskCache; - - return *this; -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractImageSelection::~kpAbstractImageSelection () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpAbstractSelection] -bool kpAbstractImageSelection::readFromStream (QDataStream &stream) -{ - if (!kpAbstractSelection::readFromStream (stream )) - return false; - - QImage qimage; - stream >> qimage; -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\timage: w=" << qimage.width () << " h=" << qimage.height () - << " depth=" << qimage.depth () << endl; -#endif - - if (!qimage.isNull ()) - { - // Image size does not match the selection's dimensions? - // This call only accesses our superclass' fields, which have already - // been read in. - if (!::CanSetBaseImageTo (this, qimage)) - { - return false; - } - - d->baseImage = qimage; - } - // (was just a selection border in the clipboard, even though KolourPaint's - // GUI doesn't allow you to copy such a thing into the clipboard) - else - d->baseImage = kpImage (); - - // TODO: Reset transparency mask? - // TODO: Concrete subclass need to emit changed()? - // [we can't since changed() must be called after all reading - // is complete and subclasses always call this method - // _before_ their reading logic] - return true; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpAbstractSelection] -void kpAbstractImageSelection::writeToStream (QDataStream &stream) const -{ - kpAbstractSelection::writeToStream (stream); - - if (!d->baseImage.isNull ()) - { - const QImage image = d->baseImage; - #if DEBUG_KP_SELECTION && 1 - kDebug () << "\twrote image rect=" << image.rect (); - #endif - stream << image; - } - else - { - #if DEBUG_KP_SELECTION && 1 - kDebug () << "\twrote no image because no pixmap"; - #endif - stream << QImage (); - } -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -QString kpAbstractImageSelection::name () const -{ - return i18n ("Selection"); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpAbstractSelection] -kpCommandSize::SizeType kpAbstractImageSelection::size () const -{ - return kpAbstractSelection::size () + - kpCommandSize::ImageSize (d->baseImage) + - (d->transparencyMaskCache.width() * d->transparencyMaskCache.height()) / 8; -} - -//--------------------------------------------------------------------- - -// public -kpCommandSize::SizeType kpAbstractImageSelection::sizeWithoutImage () const -{ - return (size () - kpCommandSize::ImageSize (d->baseImage)); -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -int kpAbstractImageSelection::minimumWidth () const -{ - return 1; -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -int kpAbstractImageSelection::minimumHeight () const -{ - return 1; -} - -//--------------------------------------------------------------------- -// public virtual -QBitmap kpAbstractImageSelection::shapeBitmap (bool nullForRectangular) const -{ - (void) nullForRectangular; - - Q_ASSERT (boundingRect ().isValid ()); - - QBitmap maskBitmap (width (), height ()); - maskBitmap.fill (Qt::color0/*transparent*/); - - { - QPainter painter(&maskBitmap); - - painter.setPen (Qt::color1/*opaque*/); - painter.setBrush (Qt::color1/*opaque*/); - - QPolygon points = calculatePoints (); - points.translate (-x (), -y ()); - - // Unlike QPainter::drawRect(), this draws the points literally - // without being 1 pixel wider and higher. This requires a QPen - // or it will draw 1 pixel narrower and shorter. - painter.drawPolygon (points, Qt::OddEvenFill); - } - - return maskBitmap; -} - -//--------------------------------------------------------------------- - -// public -kpImage kpAbstractImageSelection::givenImageMaskedByShape (const kpImage &image) const -{ -#if DEBUG_KP_SELECTION - kDebug () << "kpAbstractImageSelection::givenImageMaskedByShape() boundingRect=" - << boundingRect () << endl; -#endif - Q_ASSERT (image.width () == width () && image.height () == height ()); - - if (isRectangular ()) - return image; - - const QRegion mRegion = shapeRegion ().translated (-topLeft ()); - -#if DEBUG_KP_SELECTION - kDebug () << "\tshapeRegion=" << shapeRegion () - << " [rect=" << shapeRegion ().boundingRect () << "]" - << " calculatePoints=" << calculatePoints () - << " [rect=" << calculatePoints ().boundingRect () << "]" - << endl; -#endif - - kpImage retImage(width (), height (), QImage::Format_ARGB32_Premultiplied); - retImage.fill(0); // transparent - - QPainter painter(&retImage); - painter.setClipRegion(mRegion); - painter.drawImage(0, 0, image); - painter.end(); - - return retImage; -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -bool kpAbstractImageSelection::hasContent () const -{ - return !d->baseImage.isNull (); -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -void kpAbstractImageSelection::deleteContent () -{ - if (!hasContent ()) - return; - - setBaseImage (kpImage ()); -} - -//--------------------------------------------------------------------- - - -// public -kpImage kpAbstractImageSelection::baseImage () const -{ - return d->baseImage; -} - -//--------------------------------------------------------------------- - -// public -void kpAbstractImageSelection::setBaseImage (const kpImage &baseImage) -{ - Q_ASSERT (::CanSetBaseImageTo (this, baseImage)); - - // qt doc: the image format must be set to Format_ARGB32Premultiplied or Format_ARGB32 - // for the composition modes to have any effect - d->baseImage = baseImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - recalculateTransparencyMaskCache (); - - emit changed (boundingRect ()); -} - -//--------------------------------------------------------------------- - -// public -kpImageSelectionTransparency kpAbstractImageSelection::transparency () const -{ - return d->transparency; -} - -//--------------------------------------------------------------------- - -// public -bool kpAbstractImageSelection::setTransparency ( - const kpImageSelectionTransparency &transparency, - bool checkTransparentPixmapChanged) -{ - if (d->transparency == transparency) - return false; - - d->transparency = transparency; - - bool haveChanged = true; - - QBitmap oldTransparencyMaskCache = d->transparencyMaskCache; - recalculateTransparencyMaskCache (); - - if ( oldTransparencyMaskCache.size() == d->transparencyMaskCache.size() ) - { - if (d->transparencyMaskCache.isNull ()) - { - #if DEBUG_KP_SELECTION - kDebug () << "\tboth old and new pixmaps are null - nothing changed"; - #endif - haveChanged = false; - } - else if (checkTransparentPixmapChanged) - { - QImage oldTransparencyMaskImage = oldTransparencyMaskCache.toImage(); - QImage newTransparencyMaskImage = d->transparencyMaskCache.toImage(); - - bool changed = false; - for (int y = 0; y < oldTransparencyMaskImage.height () && !changed; y++) - { - for (int x = 0; x < oldTransparencyMaskImage.width () && !changed; x++) - { - if (kpPixmapFX::getColorAtPixel (oldTransparencyMaskImage, x, y) != - kpPixmapFX::getColorAtPixel (newTransparencyMaskImage, x, y)) - { - #if DEBUG_KP_SELECTION - kDebug () << "\tdiffer at " << QPoint (x, y) - << " old=" << kpPixmapFX::getColorAtPixel (oldTransparencyMaskImage, x, y).toQRgb () - << " new=" << kpPixmapFX::getColorAtPixel (newTransparencyMaskImage, x, y).toQRgb () - << endl; - #endif - changed = true; - break; - } - } - } - - if (!changed) - haveChanged = false; - } - } - - - if (haveChanged) - emit changed (boundingRect ()); - - return haveChanged; -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractImageSelection::recalculateTransparencyMaskCache () -{ -#if DEBUG_KP_SELECTION - kDebug () << "kpAbstractImageSelection::recalculateTransparencyMaskCache()"; -#endif - - if (d->baseImage.isNull ()) - { - #if DEBUG_KP_SELECTION - kDebug () << "\tno image - no need for transparency mask"; - #endif - d->transparencyMaskCache = QBitmap (); - return; - } - - if (d->transparency.isOpaque ()) - { - #if DEBUG_KP_SELECTION - kDebug () << "\topaque - no need for transparency mask"; - #endif - d->transparencyMaskCache = QBitmap (); - return; - } - - d->transparencyMaskCache = QBitmap(d->baseImage.size()); - - QPainter transparencyMaskPainter (&d->transparencyMaskCache); - - bool hasTransparent = false; - for (int y = 0; y < d->baseImage.height (); y++) - { - for (int x = 0; x < d->baseImage.width (); x++) - { - const kpColor pixelCol = kpPixmapFX::getColorAtPixel (d->baseImage, x, y); - if (pixelCol == kpColor::Transparent || - pixelCol.isSimilarTo (d->transparency.transparentColor (), - d->transparency.processedColorSimilarity ())) - { - transparencyMaskPainter.setPen (Qt::color1/*transparent*/); - hasTransparent = true; - } - else - { - transparencyMaskPainter.setPen (Qt::color0/*opaque*/); - } - - transparencyMaskPainter.drawPoint (x, y); - } - } - - transparencyMaskPainter.end (); - - if (!hasTransparent) - { - #if DEBUG_KP_SELECTION - kDebug () << "\tcolour useless - completely opaque"; - #endif - d->transparencyMaskCache = QBitmap (); - return; - } -} - -//--------------------------------------------------------------------- - -// public -kpImage kpAbstractImageSelection::transparentImage () const -{ - kpImage image = baseImage (); - - if (!d->transparencyMaskCache.isNull ()) - { - QPainter painter(&image); - painter.setCompositionMode(QPainter::CompositionMode_Clear); - painter.drawPixmap(0, 0, d->transparencyMaskCache); - } - - return image; -} - -//--------------------------------------------------------------------- - -// public -void kpAbstractImageSelection::fill (const kpColor &color) -{ - QImage newImage(width(), height(), QImage::Format_ARGB32_Premultiplied); - newImage.fill(color.toQRgb()); - - // LOTODO: Maybe disable Image/Clear menu item if transparent color - if ( !color.isTransparent() ) - { - QPainter painter(&newImage); - painter.setCompositionMode(QPainter::CompositionMode_Clear); - painter.drawPixmap(0, 0, shapeBitmap()); - } - - setBaseImage (newImage); -} - -//--------------------------------------------------------------------- - -// public virtual -void kpAbstractImageSelection::flip (bool horiz, bool vert) -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractImageSelection::flip(horiz=" << horiz - << ",vert=" << vert << ")" << endl; -#endif - - if (!d->baseImage.isNull ()) - { - #if DEBUG_KP_SELECTION && 1 - kDebug () << "\thave pixmap - flipping that"; - #endif - d->baseImage = d->baseImage.mirrored(horiz, vert); - } - - if (!d->transparencyMaskCache.isNull ()) - { - #if DEBUG_KP_SELECTION && 1 - kDebug () << "\thave transparency mask - flipping that"; - #endif - QImage image = d->transparencyMaskCache.toImage().mirrored(horiz, vert); - d->transparencyMaskCache = QBitmap::fromImage(image); - } - - emit changed (boundingRect ()); -} - -//--------------------------------------------------------------------- - -static void Paint (const kpAbstractImageSelection *sel, const kpImage &srcImage, - QImage *destImage, const QRect &docRect) -{ - if (!srcImage.isNull ()) - { - kpPixmapFX::paintPixmapAt (destImage, - sel->topLeft () - docRect.topLeft (), - srcImage); - } -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -void kpAbstractImageSelection::paint (QImage *destImage, - const QRect &docRect) const -{ - ::Paint (this, transparentImage (), destImage, docRect); -} - -//--------------------------------------------------------------------- - -// public -void kpAbstractImageSelection::paintWithBaseImage (QImage *destImage, - const QRect &docRect) const -{ - ::Paint (this, baseImage (), destImage, docRect); -} - -//--------------------------------------------------------------------- - - -#include "moc_kpAbstractImageSelection.cpp" diff --git a/kolourpaint/layers/selections/image/kpAbstractImageSelection.h b/kolourpaint/layers/selections/image/kpAbstractImageSelection.h deleted file mode 100644 index 6753629a..00000000 --- a/kolourpaint/layers/selections/image/kpAbstractImageSelection.h +++ /dev/null @@ -1,267 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAbstractImageSelection_H -#define kpAbstractImageSelection_H - - -#include - -#include -#include - - -// -// An abstract selection with optional image content and background -// subtraction. If there is image content, it is known as a "floating -// selection" that hovers above the document. Otherwise, it is an -// image selection "border", that highlights pixels of the document, and -// may later be upgraded to a floating selection by giving it an image -// consisting of those pixels. -// -// The images passed to this class (known as "base images") should have all -// pixels, outside of the border, set to transparent. However, nothing -// enforces this. Pixels on, or inside, the border might be opaque or -// transparent, depending on the content. -// -// The "transparent image" is the base image with background subtraction -// (kpImageSelectionTransparency) applied. This is automatically computed. -// -// The boundingRect() is the size of the border. The base image must be of -// exactly the same size, except that the base image is allowed to be null -// (for a selection that only consists of a border). -// -// Instead of copying selections' images to the clipboard, we copy -// selections, to preserve the border across KolourPaint instances. -// Background subtraction is not copied to the clipboard so that the base -// image is affected by the background subtraction of the destination -// KolourPaint window. -// -class kpAbstractImageSelection : public kpAbstractSelection -{ -Q_OBJECT - -// -// Initialization -// - -protected: - // (Call these in subclass constructors) - kpAbstractImageSelection (const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpAbstractImageSelection (const QRect &rect, - const kpImage &baseImage = kpImage (), - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpAbstractImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - // (Call this in subclass implementations of operator=) - kpAbstractImageSelection &operator= (const kpAbstractImageSelection &rhs); - -public: - // (Covariant return-type specialization of superclass pure virtual method) - virtual kpAbstractImageSelection *clone () const = 0; - - virtual ~kpAbstractImageSelection (); - - -// -// Marshalling -// - -public: - // You must override this if you have extra serializable fields. - // Remember to call this base implementation before your code. - virtual bool readFromStream (QDataStream &stream); - - // You must override this if you have extra serializable fields. - // Remember to call this base implementation before your code. - virtual void writeToStream (QDataStream &stream) const; - - -// -// General Queries -// - -public: - virtual QString name () const; - - // You must override this, if you have extra fields that take a - // non-constant amount of space, and add the size returned by this - // implementation. - virtual kpCommandSize::SizeType size () const; - - // Same as virtual size() (it even calls it) but subtracts the size of the - // baseImage(). - // - // kpCommand's store the kpImage's they are working on. These images may - // be from documents or selections. In the case of a selection, the - // selection's baseImage() is identical to that image, but takes no extra - // space due to kpImage's copy-on-write. This method fixes that - // double-counting of baseImage()'s size. - // - // The size of the internal transparency() mask is still included - // (see recalculateTransparencyMask()). - // - // sync: kpImage copy-on-write behavior - // - // TODO: Check all size() implementations are correct since we've - // started removing the old kpSelection::setPixmap(QPixmap()) - // (now kpAbstractImageSelection::setBaseImage(kpImage()) or - // kpAbstractImageSelection::deleteContent()) space saving hack. - kpCommandSize::SizeType sizeWithoutImage () const; - - -// -// Dimensions -// - -public: - virtual int minimumWidth () const; - virtual int minimumHeight () const; - - -// -// Shape Mask -// -// These methods do not access any class instance fields. -// - -public: - // Returns the mask corresponding to the shape of the selection. - // - // If is set, the method _may_ return a null - // bitmap if the selection is rectangular. - // - // This base implementation calls calculatePoints() and ignores - // . - // - // You should override this if you can implement it more efficiently or - // if you can honor . - // - // Note: This must be consistent with the outputs of calculatePoints() and - // shapeRegion(). - // - // TODO: Try to get rid of this method since it's slow. - virtual QBitmap shapeBitmap (bool nullForRectangular = false) const; - - // Returns the region corresponding to the shape of the selection - // e.g. elliptical region for an elliptical selection. - // - // Very slow. - // - // Note: This must be consistent with the outputs of calculatePoints() and - // shapeRegion(). - // - // OPT: QRegion is probably incredibly slow - cache - virtual QRegion shapeRegion () const = 0; - - // Returns the given with the pixels outside of the selection's - // shape set to transparent. - // - // Very slow. - // - // ASSUMPTION: The image has the same dimensions as the selection. - kpImage givenImageMaskedByShape (const kpImage &image) const; - - -// -// Content - Base Image -// - -public: - // Returns whether there's a non-null base image. - virtual bool hasContent () const; - - virtual void deleteContent (); - -public: - kpImage baseImage () const; - void setBaseImage (const kpImage &baseImage); - - -// -// Background Subtraction -// - -public: - kpImageSelectionTransparency transparency () const; - - // Returns whether or not the selection changed due to setting the - // transparency info. If is set, - // it will try harder to return false (although the check is - // expensive). - bool setTransparency (const kpImageSelectionTransparency &transparency, - bool checkTransparentPixmapChanged = false); - -private: - // Updates the selection transparency (a.k.a. background subtraction) mask - // so that transparentImage() will work. - // - // Called when the base image or selection transparency changes. - void recalculateTransparencyMaskCache (); - -public: - // Returns baseImage() after applying kpImageSelectionTransparency - kpImage transparentImage () const; - - -// -// Mutation - Effects -// - -public: - // Overwrites the base image with the selection's shape (e.g. ellipse) - // filled in with . See shapeBitmap(). - void fill (const kpColor &color); - - virtual void flip (bool horiz, bool vert); - - -// -// Rendering -// - -public: - // (using transparent image) - virtual void paint (QImage *destPixmap, const QRect &docRect) const; - - // (using base image) - void paintWithBaseImage (QImage *destPixmap, const QRect &docRect) const; - - -private: - struct kpAbstractImageSelectionPrivate * const d; -}; - - -#endif // kpAbstractImageSelection_H diff --git a/kolourpaint/layers/selections/image/kpEllipticalImageSelection.cpp b/kolourpaint/layers/selections/image/kpEllipticalImageSelection.cpp deleted file mode 100644 index a30e61bf..00000000 --- a/kolourpaint/layers/selections/image/kpEllipticalImageSelection.cpp +++ /dev/null @@ -1,183 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include -#include - - -struct kpEllipticalImageSelectionPrivate -{ -}; - - -kpEllipticalImageSelection::kpEllipticalImageSelection ( - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (transparency), - d (new kpEllipticalImageSelectionPrivate ()) -{ -} - -kpEllipticalImageSelection::kpEllipticalImageSelection (const QRect &rect, - const kpImage &baseImage, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (rect, baseImage, transparency), - d (new kpEllipticalImageSelectionPrivate ()) -{ -} - -kpEllipticalImageSelection::kpEllipticalImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (rect, transparency), - d (new kpEllipticalImageSelectionPrivate ()) -{ -} - -kpEllipticalImageSelection::kpEllipticalImageSelection (const kpEllipticalImageSelection &rhs) - : kpAbstractImageSelection (), - d (new kpEllipticalImageSelectionPrivate ()) -{ - *this = rhs; -} - -kpEllipticalImageSelection &kpEllipticalImageSelection::operator= ( - const kpEllipticalImageSelection &rhs) -{ - kpAbstractImageSelection::operator= (rhs); - - return *this; -} - -kpEllipticalImageSelection *kpEllipticalImageSelection::clone () const -{ - kpEllipticalImageSelection *sel = new kpEllipticalImageSelection (); - *sel = *this; - return sel; -} - -kpEllipticalImageSelection::~kpEllipticalImageSelection () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -int kpEllipticalImageSelection::serialID () const -{ - return SerialID; -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -bool kpEllipticalImageSelection::isRectangular () const -{ - return false; -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -QPolygon kpEllipticalImageSelection::calculatePoints () const -{ - Q_ASSERT (boundingRect ().isValid ()); - - if (width () == 1 && height () == 1) - { - QPolygon ret; - ret.append (topLeft ()); - return ret; - } - - QPainterPath path; - if (width () == 1 || height () == 1) - { - path.moveTo (x (), y ()); - // This does not work when the width _and_ height are 1 since lineTo() - // would not move at all. This is why we have a separate case for that - // at the top of the method. - path.lineTo (x () + width () - 1, y () + height () - 1); - } - else - { - // The adjusting is to fight QPainterPath::addEllipse() making - // the ellipse 1 pixel higher and wider than specified. - path.addEllipse (boundingRect ().adjusted (0, 0, -1, -1)); - } - - const QList polygons = path.toSubpathPolygons (); - Q_ASSERT (polygons.size () == 1); - - const QPolygonF firstPolygonF = polygons.first (); - return firstPolygonF.toPolygon (); -} - -//--------------------------------------------------------------------- - - -// protected virtual [kpAbstractImageSelection] -QRegion kpEllipticalImageSelection::shapeRegion () const -{ - QRegion reg(calculatePoints()); - return reg; -} - -//--------------------------------------------------------------------- - - -// public virtual [kpAbstractSelection] -bool kpEllipticalImageSelection::contains (const QPoint &point) const -{ - if (!boundingRect ().contains (point)) - return false; - - return shapeRegion ().contains (point); -} - -//--------------------------------------------------------------------- - - -// public virtual [kpAbstractSelection] -void kpEllipticalImageSelection::paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const -{ - if ( !boundingRect().isValid() ) - return; - - paintPolygonalBorder (calculatePoints (), - destPixmap, docRect, - selectionFinished); -} - - -#include "moc_kpEllipticalImageSelection.cpp" diff --git a/kolourpaint/layers/selections/image/kpEllipticalImageSelection.h b/kolourpaint/layers/selections/image/kpEllipticalImageSelection.h deleted file mode 100644 index e52a6cb9..00000000 --- a/kolourpaint/layers/selections/image/kpEllipticalImageSelection.h +++ /dev/null @@ -1,118 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEllipticalImageSelection_H -#define kpEllipticalImageSelection_H - - -#include - - -class kpEllipticalImageSelection : public kpAbstractImageSelection -{ -Q_OBJECT - -public: - kpEllipticalImageSelection (const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpEllipticalImageSelection (const QRect &rect, - const kpImage &baseImage = kpImage (), - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpEllipticalImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpEllipticalImageSelection (const kpEllipticalImageSelection &rhs); - - kpEllipticalImageSelection &operator= (const kpEllipticalImageSelection &rhs); - - virtual kpEllipticalImageSelection *clone () const; - - virtual ~kpEllipticalImageSelection (); - - -// -// Marshalling -// - -public: - static const int SerialID = 1; - virtual int serialID () const; - - -// -// General Queries -// - -public: - virtual bool isRectangular () const; - - -// -// Position & Dimensions -// - -public: - virtual QPolygon calculatePoints () const; - - -// -// Shape Mask -// - -public: - virtual QRegion shapeRegion () const; - - -// -// Point Testing -// - -public: - virtual bool contains (const QPoint &point) const; - - -// -// Rendering -// - -public: - virtual void paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - - -private: - struct kpEllipticalImageSelectionPrivate * const d; -}; - - - -#endif // kpEllipticalImageSelection_H diff --git a/kolourpaint/layers/selections/image/kpFreeFormImageSelection.cpp b/kolourpaint/layers/selections/image/kpFreeFormImageSelection.cpp deleted file mode 100644 index 4d8241c0..00000000 --- a/kolourpaint/layers/selections/image/kpFreeFormImageSelection.cpp +++ /dev/null @@ -1,389 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include - -#include - - -struct kpFreeFormImageSelectionPrivate -{ - QPolygon orgPoints; - - // Various Qt methods that take a QPolygon interpolate points differently - // (e.g. QPainter::drawPolygon() vs QRegion(QPolygon)) when given consecutive - // points that are not cardinally adjacent e.g. these 2 points: - // - // # - // # - // - // are diagonally, but not cardinally, adjacent. They are rendered - // inconsistently. Also, points which are not adjacent at all definitely - // require interpolation and are inconsistently rendered: - // - // # - // # - // - // So, we only pass cardinally interpolated points to those methods to - // avoid this issue: - // - // ## - // # - // - // These interpolated points are stored in . Regarding - // , see the APIDoc for cardinallyAdjacentPointsLoop(). - QPolygon cardPointsCache, cardPointsLoopCache; -}; - - -kpFreeFormImageSelection::kpFreeFormImageSelection ( - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (transparency), - d (new kpFreeFormImageSelectionPrivate ()) -{ -} - -kpFreeFormImageSelection::kpFreeFormImageSelection (const QPolygon &points, - const kpImage &baseImage, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (points.boundingRect (), baseImage, transparency), - d (new kpFreeFormImageSelectionPrivate ()) -{ - d->orgPoints = points; - recalculateCardinallyAdjacentPoints (); -} - -kpFreeFormImageSelection::kpFreeFormImageSelection (const QPolygon &points, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (points.boundingRect (), transparency), - d (new kpFreeFormImageSelectionPrivate ()) -{ - d->orgPoints = points; - recalculateCardinallyAdjacentPoints (); -} - -kpFreeFormImageSelection::kpFreeFormImageSelection (const kpFreeFormImageSelection &rhs) - : kpAbstractImageSelection (), - d (new kpFreeFormImageSelectionPrivate ()) -{ - *this = rhs; -} - -kpFreeFormImageSelection &kpFreeFormImageSelection::operator= (const kpFreeFormImageSelection &rhs) -{ - kpAbstractImageSelection::operator= (rhs); - - d->orgPoints = rhs.d->orgPoints; - d->cardPointsCache = rhs.d->cardPointsCache; - d->cardPointsLoopCache = rhs.d->cardPointsLoopCache; - - return *this; -} - -// public virtual [kpAbstractSelection] -kpFreeFormImageSelection *kpFreeFormImageSelection::clone () const -{ - kpFreeFormImageSelection *sel = new kpFreeFormImageSelection (); - *sel = *this; - return sel; -} - -kpFreeFormImageSelection::~kpFreeFormImageSelection () -{ - delete d; -} - - -// public virtual [kpAbstractSelection] -int kpFreeFormImageSelection::serialID () const -{ - return SerialID; -} - -// public virtual [base kpAbstractImageSelection] -bool kpFreeFormImageSelection::readFromStream (QDataStream &stream) -{ - if (!kpAbstractImageSelection::readFromStream (stream)) - return false; - - stream >> d->orgPoints; - recalculateCardinallyAdjacentPoints (); - - return true; -} - -// public virtual [base kpAbstractImageSelection] -void kpFreeFormImageSelection::writeToStream (QDataStream &stream) const -{ - kpAbstractImageSelection::writeToStream (stream); - - stream << d->orgPoints; -} - - -// public virtual [base kpAbstractImageSelection] -kpCommandSize::SizeType kpFreeFormImageSelection::size () const -{ - return kpAbstractImageSelection::size () + - (kpCommandSize::PolygonSize (d->orgPoints) + - kpCommandSize::PolygonSize (d->cardPointsCache) + - kpCommandSize::PolygonSize (d->cardPointsLoopCache)); -} - -// public virtual [kpAbstractSelection] -bool kpFreeFormImageSelection::isRectangular () const -{ - return false; -} - -// public -QPolygon kpFreeFormImageSelection::originalPoints () const -{ - return d->orgPoints; -} - - -static QPolygon RecalculateCardinallyAdjacentPoints (const QPolygon &points) -{ -#if DEBUG_KP_SELECTION - kDebug () << "kpFreeFormImageSelection.cpp:RecalculateCardinallyAdjacentPoints()" - << endl; - kDebug () << "\tpoints=" << points; -#endif - - // Filter out duplicates. - QPolygon noDups; - foreach (const QPoint &p, points) - { - if (!noDups.isEmpty () && p == noDups.last ()) - continue; - - noDups.append (p); - } -#if DEBUG_KP_SELECTION - kDebug () << "\twithout dups=" << noDups; -#endif - - // Interpolate to ensure cardinal adjacency. - QPolygon cardPoints; - foreach (const QPoint &p, noDups) - { - if (!cardPoints.isEmpty () && - !kpPainter::pointsAreCardinallyAdjacent (p, cardPoints.last ())) - { - const QPoint lastPoint = cardPoints.last (); - - QList interpPoints = kpPainter::interpolatePoints ( - lastPoint, - p, - true/*cardinal adjacency*/); - - Q_ASSERT (interpPoints.size () >= 2); - Q_ASSERT (interpPoints [0] == lastPoint); - Q_ASSERT (interpPoints.last () == p); - - for (int i = 1/*skip already existing point*/; - i < interpPoints.size (); - i++) - { - cardPoints.append (interpPoints [i]); - } - } - else - cardPoints.append (p); - } -#if DEBUG_KP_SELECTION - kDebug () << "\tcardinally adjacent=" << cardPoints; -#endif - - return cardPoints; -} - -// protected -void kpFreeFormImageSelection::recalculateCardinallyAdjacentPoints () -{ - d->cardPointsCache = ::RecalculateCardinallyAdjacentPoints (d->orgPoints); - - - QPolygon pointsLoop = d->cardPointsCache; - if (!pointsLoop.isEmpty ()) - pointsLoop.append (pointsLoop.first ()); - - // OPT: We know this method only needs to act on the last 2 points of - // "pointLoop", since the previous points are definitely cardinally - // adjacent. - d->cardPointsLoopCache = ::RecalculateCardinallyAdjacentPoints (pointsLoop); -} - -// public -QPolygon kpFreeFormImageSelection::cardinallyAdjacentPoints () const -{ - return d->cardPointsCache; -} - -// public -QPolygon kpFreeFormImageSelection::cardinallyAdjacentPointsLoop () const -{ - return d->cardPointsLoopCache; -} - - -// public virtual [kpAbstractSelection] -QPolygon kpFreeFormImageSelection::calculatePoints () const -{ - return d->cardPointsLoopCache; -} - - -// protected virtual [kpAbstractSelection] -QRegion kpFreeFormImageSelection::shapeRegion () const -{ - const QRegion region = QRegion (d->cardPointsLoopCache, Qt::OddEvenFill); - - // In Qt4, while QPainter::drawRect() gives you rectangles 1 pixel - // wider and higher, QRegion(QPolygon) gives you regions 1 pixel - // narrower and shorter! Compensate for this by merging shifted - // versions of the region. This seems to be consistent with shapeBitmap() - // but I am a bit worried. - // - // Regarding alternative solutions: - // 1. Instead of doing this region shifting and merging, if we were to - // construct a QRegion simply from a point array with 4 points for - // every point in "d->cardPointsLoopCache" (4 points = original point + 3 - // translations below), it probably wouldn't work because the order of - // the points in any point array matter for the odd-even fill - // algorithm. This would probably manifest as problems with - // self-intersecting borders. - // 2. Constructing a QRegion from QBitmap (from shapeBitmap()) is probably - // very slow since it would have to read each pixel of the QBitmap. - // Having said that, this is probably the safest option as region shifting - // is dodgy. Also, this would guarantee that shapeBitmap() and shapeRegion() - // are consistent and we wouldn't need cardinally adjacent points either - // (d->cardPointsCache and d->cardPointsLoopCache). - const QRegion regionX = region.translated (1, 0); - const QRegion regionY = region.translated (0, 1); - const QRegion regionXY = region.translated (1, 1); - - return region.united (regionX).united (regionY).united (regionXY); -} - - -// public virtual [kpAbstractSelection] -bool kpFreeFormImageSelection::contains (const QPoint &point) const -{ - if (!boundingRect ().contains (point)) - return false; - - // We can't use the baseImage() (when non-null) and get the transparency of - // the pixel at , instead of this region test, as the pixel may be - // transparent but still within the border. - return shapeRegion ().contains (point); -} - - -// public virtual [base kpAbstractSelection] -void kpFreeFormImageSelection::moveBy (int dx, int dy) -{ - d->orgPoints.translate (dx, dy); - - d->cardPointsCache.translate (dx, dy); - d->cardPointsLoopCache.translate (dx, dy); - - // Call base last since it fires the changed() signal and we only - // want that to fire at the very end of this method, after all - // the selection state has been changed. - kpAbstractImageSelection::moveBy (dx, dy); -} - -//--------------------------------------------------------------------- - -static void FlipPoints (QPolygon *points, - bool horiz, bool vert, - const QRect &oldRect) -{ - points->translate (-oldRect.x (), -oldRect.y ()); - - const QMatrix matrix (horiz ? -1 : +1, // m11 - 0, // m12 - 0, // m21 - vert ? -1 : +1, // m22 - horiz ? (oldRect.width() - 1) : 0, // dx - vert ? (oldRect.height() - 1) : 0); // dy - -#if !defined (QT_NO_DEBUG) && !defined (NDEBUG) - QPolygon oldPoints = *points; -#endif - - *points = matrix.map (*points); - -#if !defined (QT_NO_DEBUG) && !defined (NDEBUG) - // Sanity check: flipping the points twice gives us the original points. - Q_ASSERT (oldPoints == matrix.map (*points)); -#endif - - points->translate (oldRect.x (), oldRect.y ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpAbstractImageSelection] -void kpFreeFormImageSelection::flip (bool horiz, bool vert) -{ - ::FlipPoints (&d->orgPoints, horiz, vert, boundingRect ()); - - ::FlipPoints (&d->cardPointsCache, horiz, vert, boundingRect ()); - ::FlipPoints (&d->cardPointsLoopCache, horiz, vert, boundingRect ()); - - - // Call base last since it fires the changed() signal and we only - // want that to fire at the very end of this method, after all - // the selection state has been changed. - kpAbstractImageSelection::flip (horiz, vert); -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -void kpFreeFormImageSelection::paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const -{ - if (selectionFinished) - paintPolygonalBorder (cardinallyAdjacentPointsLoop (), - destPixmap, docRect, selectionFinished); - else - paintPolygonalBorder (cardinallyAdjacentPoints (), - destPixmap, docRect, selectionFinished); -} - - -#include "moc_kpFreeFormImageSelection.cpp" diff --git a/kolourpaint/layers/selections/image/kpFreeFormImageSelection.h b/kolourpaint/layers/selections/image/kpFreeFormImageSelection.h deleted file mode 100644 index c2751d1d..00000000 --- a/kolourpaint/layers/selections/image/kpFreeFormImageSelection.h +++ /dev/null @@ -1,159 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpFreeFormImageSelection_H -#define kpFreeFormImageSelection_H - - -#include - - -class kpFreeFormImageSelection : public kpAbstractImageSelection -{ -Q_OBJECT - -public: - kpFreeFormImageSelection (const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpFreeFormImageSelection (const QPolygon &points, - const kpImage &baseImage = kpImage (), - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpFreeFormImageSelection (const QPolygon &points, - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpFreeFormImageSelection (const kpFreeFormImageSelection &rhs); - - kpFreeFormImageSelection &operator= (const kpFreeFormImageSelection &rhs); - - virtual kpFreeFormImageSelection *clone () const; - - virtual ~kpFreeFormImageSelection (); - - -// -// Marshalling -// - -public: - static const int SerialID = 2; - virtual int serialID () const; - - virtual bool readFromStream (QDataStream &stream); - - virtual void writeToStream (QDataStream &stream) const; - - -// -// General Queries -// - -public: - virtual kpCommandSize::SizeType size () const; - - virtual bool isRectangular () const; - - // (as passed to the constructor) - QPolygon originalPoints () const; - - -// -// Cardinally Adjacent Points -// - -protected: - void recalculateCardinallyAdjacentPoints (); - -public: - // Returns the originalPoints() interpolated to be cardinally adjacent. - QPolygon cardinallyAdjacentPoints () const; - - // Returns cardinallyAdjacentPoints() but with extra points interpolated - // from the last point to the first point (the original points are - // thought of as a polygon where the first and last points are connected, - // rather than as a string of points). - // - // As used by the shape mask methods. - QPolygon cardinallyAdjacentPointsLoop () const; - - -// -// Position & Dimensions -// - -public: - // Implements kpAbstractSelection interface - same as - // cardinallyAdjacentPointsLoop (). - // This implementation is fast. - virtual QPolygon calculatePoints () const; - - -// -// Shape Mask -// - -public: - virtual QRegion shapeRegion () const; - - -// -// Point Testing -// - -public: - virtual bool contains (const QPoint &point) const; - - -// -// Mutation -// - -public: - virtual void moveBy (int dx, int dy); - - virtual void flip (bool horiz, bool vert); - - -// -// Rendering -// - -public: - virtual void paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - - -private: - struct kpFreeFormImageSelectionPrivate * const d; -}; - - -#endif // kpFreeFormImageSelection_H diff --git a/kolourpaint/layers/selections/image/kpImageSelectionTransparency.cpp b/kolourpaint/layers/selections/image/kpImageSelectionTransparency.cpp deleted file mode 100644 index 736de9b2..00000000 --- a/kolourpaint/layers/selections/image/kpImageSelectionTransparency.cpp +++ /dev/null @@ -1,208 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION_TRANSPARENCY 0 - - -#include - -#include - -#include -#include - - -//--------------------------------------------------------------------- - -kpImageSelectionTransparency::kpImageSelectionTransparency () - : m_isOpaque (true) -{ - setColorSimilarity (0); -} - -//--------------------------------------------------------------------- - -kpImageSelectionTransparency::kpImageSelectionTransparency (const kpColor &transparentColor, double colorSimilarity) - : m_isOpaque (false), - m_transparentColor (transparentColor) -{ - setColorSimilarity (colorSimilarity); -} - -//--------------------------------------------------------------------- - -kpImageSelectionTransparency::kpImageSelectionTransparency (bool isOpaque, const kpColor &transparentColor, - double colorSimilarity) - : m_isOpaque (isOpaque), - m_transparentColor (transparentColor) -{ - setColorSimilarity (colorSimilarity); -} - -//--------------------------------------------------------------------- - -bool kpImageSelectionTransparency::operator== (const kpImageSelectionTransparency &rhs) const -{ -#if DEBUG_KP_SELECTION_TRANSPARENCY && 0 - kDebug () << "kpImageSelectionTransparency::operator==()"; -#endif - - if (m_isOpaque != rhs.m_isOpaque) - { - #if DEBUG_KP_SELECTION_TRANSPARENCY && 0 - kDebug () << "\tdifferent opacity: lhs=" << m_isOpaque - << " rhs=" << rhs.m_isOpaque - << endl; - #endif - return false; - } - - if (m_isOpaque) - { - #if DEBUG_KP_SELECTION_TRANSPARENCY && 0 - kDebug () << "\tboth opaque - eq"; - #endif - return true; - } - -#if DEBUG_KP_SELECTION_TRANSPARENCY && 0 - kDebug () << "\tcolours: lhs=" << (int *) m_transparentColor.toQRgb () - << " rhs=" << (int *) rhs.m_transparentColor.toQRgb () - << endl; - kDebug () << "\tcolour similarity: lhs=" << m_colorSimilarity - << " rhs=" << rhs.m_colorSimilarity - << endl; -#endif - - return (m_transparentColor == rhs.m_transparentColor && - m_colorSimilarity == rhs.m_colorSimilarity); -} - -//--------------------------------------------------------------------- - -bool kpImageSelectionTransparency::operator!= (const kpImageSelectionTransparency &rhs) const -{ - return !(*this == rhs); -} - -//--------------------------------------------------------------------- - -kpImageSelectionTransparency::~kpImageSelectionTransparency () -{ -} - -//--------------------------------------------------------------------- - -// public -bool kpImageSelectionTransparency::isOpaque () const -{ - return m_isOpaque; -} - -//--------------------------------------------------------------------- - -// public -bool kpImageSelectionTransparency::isTransparent () const -{ - return !isOpaque (); -} - -//--------------------------------------------------------------------- - -// public -void kpImageSelectionTransparency::setOpaque (bool yes) -{ - m_isOpaque = yes; -} - -//--------------------------------------------------------------------- - -// public -void kpImageSelectionTransparency::setTransparent (bool yes) -{ - setOpaque (!yes); -} - -//--------------------------------------------------------------------- - - -// public -kpColor kpImageSelectionTransparency::transparentColor () const -{ - if (m_isOpaque) - { - // There are legitimate uses for this so no kError() - kDebug () << "kpImageSelectionTransparency::transparentColor() " - "getting transparent color even though opaque" << endl; - } - - return m_transparentColor; -} - -//--------------------------------------------------------------------- - -// public -void kpImageSelectionTransparency::setTransparentColor (const kpColor &transparentColor) -{ - m_transparentColor = transparentColor; -} - -//--------------------------------------------------------------------- - - -// public -double kpImageSelectionTransparency::colorSimilarity () const -{ - if (m_colorSimilarity < 0 || - m_colorSimilarity > kpColorSimilarityHolder::MaxColorSimilarity) - { - kError () << "kpImageSelectionTransparency::colorSimilarity() invalid colorSimilarity" << endl; - return 0; - } - - return m_colorSimilarity; -} - -//--------------------------------------------------------------------- - -// pubulic -void kpImageSelectionTransparency::setColorSimilarity (double colorSimilarity) -{ - m_colorSimilarity = colorSimilarity; - m_processedColorSimilarity = kpColor::processSimilarity (colorSimilarity); -} - -//--------------------------------------------------------------------- - -// public -int kpImageSelectionTransparency::processedColorSimilarity () const -{ - return m_processedColorSimilarity; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/selections/image/kpImageSelectionTransparency.h b/kolourpaint/layers/selections/image/kpImageSelectionTransparency.h deleted file mode 100644 index b110b39c..00000000 --- a/kolourpaint/layers/selections/image/kpImageSelectionTransparency.h +++ /dev/null @@ -1,82 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_SELECTION_TRANSPARENCY_H -#define KP_SELECTION_TRANSPARENCY_H - - -#include - - -// This does not apply to the Text Tool. Use kpTextStyle for that. -class kpImageSelectionTransparency -{ -public: - // Opaque selection - kpImageSelectionTransparency (); - // Selection that's transparent at pixels with - kpImageSelectionTransparency (const kpColor &transparentColor, double colorSimilarity); - // If , is allowed to be anything - // (including invalid) as the color would have no effect. - // However, you are encouraged to set it as you would if !, - // because setTransparent(true) might be called later, after which - // the would suddenly become important. - // - // It is a similar case with , although - // must be in-range (see kpColorSimilarityHolder). - kpImageSelectionTransparency (bool isOpaque, const kpColor &transparentColor, double colorSimilarity); - // Returns whether they are visually equivalent. - // This is the same as a memcmp() except that if they are both opaque, - // this function will return true regardless of the transparentColor's. - bool operator== (const kpImageSelectionTransparency &rhs) const; - bool operator!= (const kpImageSelectionTransparency &rhs) const; - ~kpImageSelectionTransparency (); - - bool isOpaque () const; - bool isTransparent () const; - void setOpaque (bool yes = true); - void setTransparent (bool yes = true); - - // If isOpaque(), transparentColor() is generally not called because - // the transparent color would have no effect. - kpColor transparentColor () const; - void setTransparentColor (const kpColor &transparentColor); - - double colorSimilarity () const; - void setColorSimilarity (double colorSimilarity); - int processedColorSimilarity () const; - -private: - bool m_isOpaque; - kpColor m_transparentColor; - double m_colorSimilarity; - int m_processedColorSimilarity; -}; - - -#endif // KP_SELECTION_TRANSPARENCY_H diff --git a/kolourpaint/layers/selections/image/kpRectangularImageSelection.cpp b/kolourpaint/layers/selections/image/kpRectangularImageSelection.cpp deleted file mode 100644 index 8c235dc5..00000000 --- a/kolourpaint/layers/selections/image/kpRectangularImageSelection.cpp +++ /dev/null @@ -1,149 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include -#include - - -struct kpRectangularImageSelectionPrivate -{ -}; - - -kpRectangularImageSelection::kpRectangularImageSelection ( - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (transparency), - d (new kpRectangularImageSelectionPrivate ()) -{ -} - -kpRectangularImageSelection::kpRectangularImageSelection (const QRect &rect, - const kpImage &baseImage, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (rect, baseImage, transparency), - d (new kpRectangularImageSelectionPrivate ()) -{ -} - -kpRectangularImageSelection::kpRectangularImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency) - : kpAbstractImageSelection (rect, transparency), - d (new kpRectangularImageSelectionPrivate ()) -{ -} - -kpRectangularImageSelection::kpRectangularImageSelection (const kpRectangularImageSelection &rhs) - : kpAbstractImageSelection (), - d (new kpRectangularImageSelectionPrivate ()) -{ - *this = rhs; -} - -kpRectangularImageSelection &kpRectangularImageSelection::operator= ( - const kpRectangularImageSelection &rhs) -{ - kpAbstractImageSelection::operator= (rhs); - - return *this; -} - -kpRectangularImageSelection *kpRectangularImageSelection::clone () const -{ - kpRectangularImageSelection *sel = new kpRectangularImageSelection (); - *sel = *this; - return sel; -} - -kpRectangularImageSelection::~kpRectangularImageSelection () -{ - delete d; -} - - -// public virtual [kpAbstractSelection] -int kpRectangularImageSelection::serialID () const -{ - return SerialID; -} - - -// public virtual [kpAbstractSelection] -bool kpRectangularImageSelection::isRectangular () const -{ - return true; -} - - -// public virtual [kpAbstractSelection] -QPolygon kpRectangularImageSelection::calculatePoints () const -{ - return kpAbstractImageSelection::CalculatePointsForRectangle (boundingRect ()); -} - - -// public virtual [base kpAbstractImageSelection] -QBitmap kpRectangularImageSelection::shapeBitmap (bool nullForRectangular) const -{ - Q_ASSERT (boundingRect ().isValid ()); - - if (nullForRectangular) - return QBitmap (); - - QBitmap maskBitmap (width (), height ()); - maskBitmap.fill (Qt::color1/*opaque*/); - return maskBitmap; -} - -// public virtual [kpAbstractImageSelection] -QRegion kpRectangularImageSelection::shapeRegion () const -{ - return QRegion (boundingRect (), QRegion::Rectangle); -} - - -// public virtual [kpAbstractSelection] -bool kpRectangularImageSelection::contains (const QPoint &point) const -{ - return boundingRect ().contains (point); -} - - -// public virtual [kpAbstractSelection] -void kpRectangularImageSelection::paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const -{ - paintRectangularBorder (destPixmap, docRect, selectionFinished); -} - - -#include "moc_kpRectangularImageSelection.cpp" diff --git a/kolourpaint/layers/selections/image/kpRectangularImageSelection.h b/kolourpaint/layers/selections/image/kpRectangularImageSelection.h deleted file mode 100644 index b486bd84..00000000 --- a/kolourpaint/layers/selections/image/kpRectangularImageSelection.h +++ /dev/null @@ -1,119 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpRectangularImageSelection_H -#define kpRectangularImageSelection_H - - -#include - - -class kpRectangularImageSelection : public kpAbstractImageSelection -{ -Q_OBJECT - -public: - kpRectangularImageSelection (const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpRectangularImageSelection (const QRect &rect, - const kpImage &baseImage = kpImage (), - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpRectangularImageSelection (const QRect &rect, - const kpImageSelectionTransparency &transparency = - kpImageSelectionTransparency ()); - - kpRectangularImageSelection (const kpRectangularImageSelection &rhs); - - kpRectangularImageSelection &operator= (const kpRectangularImageSelection &rhs); - - virtual kpRectangularImageSelection *clone () const; - - virtual ~kpRectangularImageSelection (); - - -// -// Marshalling -// - -public: - static const int SerialID = 0; - virtual int serialID () const; - - -// -// General Queries -// - -public: - virtual bool isRectangular () const; - - -// -// Position & Dimensions -// - -public: - virtual QPolygon calculatePoints () const; - - -// -// Shape Mask -// - -public: - virtual QBitmap shapeBitmap (bool nullForRectangular = false) const; - - virtual QRegion shapeRegion () const; - - -// -// Point Testing -// - -public: - virtual bool contains (const QPoint &point) const; - - -// -// Rendering -// - -public: - virtual void paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - - -private: - struct kpRectangularImageSelectionPrivate * const d; -}; - - -#endif // kpRectangularImageSelection_H diff --git a/kolourpaint/layers/selections/kpAbstractSelection.cpp b/kolourpaint/layers/selections/kpAbstractSelection.cpp deleted file mode 100644 index 75137876..00000000 --- a/kolourpaint/layers/selections/kpAbstractSelection.cpp +++ /dev/null @@ -1,312 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include -#include - -#include - -struct kpAbstractSelectionPrivate -{ - QRect rect; -}; - - -// protected -kpAbstractSelection::kpAbstractSelection () - : QObject (), - d (new kpAbstractSelectionPrivate ()) -{ - d->rect = QRect (); -} - -// protected -kpAbstractSelection::kpAbstractSelection (const QRect &rect) - : QObject (), - d (new kpAbstractSelectionPrivate ()) -{ - d->rect = rect; -} - -// protected -kpAbstractSelection &kpAbstractSelection::operator= (const kpAbstractSelection &rhs) -{ - if (this == &rhs) - return *this; - - d->rect = rhs.d->rect; - - return *this; -} - -// protected -kpAbstractSelection::~kpAbstractSelection () -{ - delete d; -} - - -// public virtual -bool kpAbstractSelection::readFromStream (QDataStream &stream) -{ - stream >> d->rect; - - return true; -} - -// public virtual -void kpAbstractSelection::writeToStream (QDataStream &stream) const -{ - stream << d->rect; -} - -// friend -QDataStream &operator<< (QDataStream &stream, const kpAbstractSelection &selection) -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractSelection::operator<<(sel: rect=" << - selection.boundingRect () << endl; -#endif - stream << selection.serialID (); - selection.writeToStream (stream); - return stream; -} - - -// public virtual -kpCommandSize::SizeType kpAbstractSelection::size () const -{ - return 0/*constant size*/; -} - - -// public -QSize kpAbstractSelection::minimumSize () const -{ - return QSize (minimumWidth (), minimumHeight ()); -} - - -// public -int kpAbstractSelection::x () const -{ - return d->rect.x (); -} - -// public -int kpAbstractSelection::y () const -{ - return d->rect.y (); -} - -// public -QPoint kpAbstractSelection::topLeft () const -{ - return d->rect.topLeft (); -} - - -// public -int kpAbstractSelection::width () const -{ - return boundingRect ().width (); -} - -// public -int kpAbstractSelection::height () const -{ - return boundingRect ().height (); -} - -// public -QRect kpAbstractSelection::boundingRect () const -{ - return d->rect; -} - -// public static -QPolygon kpAbstractSelection::CalculatePointsForRectangle (const QRect &rect) -{ - QPolygon points; - - // OPT: not space optimal - current code adds duplicate corner points. - - // top - for (int x = 0; x < rect.width (); x++) - points.append (QPoint (rect.x () + x, rect.top ())); - - // right - for (int y = 0; y < rect.height (); y++) - points.append (QPoint (rect.right (), rect.y () + y)); - - // bottom - for (int x = rect.width () - 1; x >= 0; x--) - points.append (QPoint (rect.x () + x, rect.bottom ())); - - // left - for (int y = rect.height () - 1; y >= 0; y--) - points.append (QPoint (rect.left (), rect.y () + y)); - - return points; -} - - -// public -bool kpAbstractSelection::contains (int x, int y) const -{ - return contains (QPoint (x, y)); -} - - -// public virtual -void kpAbstractSelection::moveBy (int dx, int dy) -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractSelection::moveBy(" << dx << "," << dy << ")"; -#endif - - if (dx == 0 && dy == 0) - return; - - QRect oldRect = boundingRect (); - -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\toldRect=" << oldRect; -#endif - - d->rect.translate (dx, dy); -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\tnewRect=" << d->rect; -#endif - - emit changed (oldRect); - emit changed (boundingRect ()); -} - -// public -void kpAbstractSelection::moveTo (int dx, int dy) -{ - moveTo (QPoint (dx, dy)); -} - -// public -void kpAbstractSelection::moveTo (const QPoint &topLeftPoint) -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractSelection::moveTo(" << topLeftPoint << ")"; -#endif - QRect oldBoundingRect = boundingRect (); -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\toldBoundingRect=" << oldBoundingRect; -#endif - if (topLeftPoint == oldBoundingRect.topLeft ()) - return; - - QPoint delta (topLeftPoint - oldBoundingRect.topLeft ()); - moveBy (delta.x (), delta.y ()); -} - -//--------------------------------------------------------------------- - -// protected -void kpAbstractSelection::paintRectangularBorder (QImage *destPixmap, - const QRect &docRect, - bool selectionFinished) const -{ - (void) selectionFinished; - -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractSelection::paintRectangularBorder() boundingRect=" - << boundingRect () << endl; -#endif - -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\tselection border = rectangle"; - kDebug () << "\t\tx=" << boundingRect ().x () - docRect.x () - << " y=" << boundingRect ().y () - docRect.y () - << " w=" << boundingRect ().width () - << " h=" << boundingRect ().height () - << endl; -#endif - kpPixmapFX::drawRect(destPixmap, - boundingRect ().x () - docRect.x (), - boundingRect ().y () - docRect.y (), - boundingRect ().width (), - boundingRect ().height (), - kpColor::Blue, 1/*pen width*/, - kpColor::Invalid/*no background*/, - kpColor::Yellow); -} - -//--------------------------------------------------------------------- - -// protected -void kpAbstractSelection::paintPolygonalBorder (const QPolygon &points, - QImage *destPixmap, - const QRect &docRect, - bool selectionFinished) const -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpAbstractSelection::paintPolygonalBorder() boundingRect=" - << boundingRect () << endl; -#endif - - QPolygon pointsTranslated = points; - pointsTranslated.translate (-docRect.x (), -docRect.y ()); - - if ( !selectionFinished ) - { - kpPixmapFX::drawPolyline(destPixmap, - pointsTranslated, kpColor::Blue, 1/*pen width*/, kpColor::Yellow); - } - else - { - kpPixmapFX::drawPolygon(destPixmap, - pointsTranslated, - kpColor::Blue, 1/*pen width*/, - kpColor::Invalid/*no background*/, - true/*is final*/, - kpColor::Yellow); - - kpPixmapFX::drawRect(destPixmap, - boundingRect ().x () - docRect.x (), - boundingRect ().y () - docRect.y (), - boundingRect ().width (), - boundingRect ().height (), - kpColor::LightGray, 1/*pen width*/, - kpColor::Invalid/*no background*/, - kpColor::DarkGray); - } -} - -#include "moc_kpAbstractSelection.cpp" diff --git a/kolourpaint/layers/selections/kpAbstractSelection.h b/kolourpaint/layers/selections/kpAbstractSelection.h deleted file mode 100644 index ba2948e1..00000000 --- a/kolourpaint/layers/selections/kpAbstractSelection.h +++ /dev/null @@ -1,278 +0,0 @@ - -// OPT: The selection classes should use copy-on-write. - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAstractSelection_H -#define kpAstractSelection_H - - -#include - -#include -#include - - -#include -#include -#include -#include -#include - - -// -// Abstract base class for selections. -// -// Selections consist of: -// -// 1. Bounding rectangle (provided by this base class) relative to the -// source document -// 2. Border (must be on, or inside, the bounding rectangle and does not -// have to be rectangular) -// 3. Optional content (e.g. image or text). -// -// A selection without content is a selection border. -// -// Any content outside the border should not be rendered i.e. the selection -// is transparent in all areas outside of the border. Pixels on, or inside, -// the border are considered to be renderable content. Parts, or all, of -// this content can be transparent. -// -class kpAbstractSelection : public QObject -{ -Q_OBJECT - -// -// Initialization -// - -protected: - // (Call these in subclass constructors) - kpAbstractSelection (); - kpAbstractSelection (const QRect &rect); - - // (Call this in subclass implementations of operator=) - kpAbstractSelection &operator= (const kpAbstractSelection &rhs); - -public: - // To implement, create an instance of your type and then call your - // implementation of operator=(). - virtual kpAbstractSelection *clone () const = 0; - - virtual ~kpAbstractSelection (); - - -// -// Marshalling -// - -public: - // Returns a unique ID for this type of selection, use for marshalling. - virtual int serialID () const = 0; - - // This is called after your object has been created with the default - // constructor. - // - // Reads the object marshalled in the and returns whether it - // succeeded. This is called by kpSelectionFactory so the serialID() - // has already been read and removed from the . - // - // You must override this. Remember to call this base implementation - // before your code. - virtual bool readFromStream (QDataStream &stream); - - // Marshalls the object into the . This is called by - // operator<<() so the serialID() has already been written into the - // . - // - // You must override this. Remember to call this base implementation - // before your code. - virtual void writeToStream (QDataStream &stream) const; - - // Writes the serialID() of the to the and then - // calls writeToStream() to do the remaining marshalling. - // - // (kpSelectionFactory::FromStream() is the ">>" replacement) - friend QDataStream &operator<< (QDataStream &stream, - const kpAbstractSelection &selection); - - -// -// General Queries -// - -public: - // Returns e.g. i18n ("Selection") or i18n ("Text"). - virtual QString name () const = 0; - - // Returns the memory usage of the selection (like kpCommand's), - // _not_ its dimensions. - // - // You must override this and add the size returned by this implementation. - virtual kpCommandSize::SizeType size () const; - -public: - // e.g. return false for an elliptical selection. - virtual bool isRectangular () const = 0; - - -// -// Position & Dimensions -// - -public: - // Returns the minimum allowed dimensions of your selection type. - // Usually this is 1x1 pixels by pixels. - virtual int minimumWidth () const = 0; - virtual int minimumHeight () const = 0; - QSize minimumSize () const; - -public: - // (in document coordinates) - int x () const; - int y () const; - QPoint topLeft () const; - -public: - // (in document coordinates) - - // Returns the width of the bounding rectangle. - int width () const; - - // Returns the height of the bounding rectangle. - int height () const; - - // Returns the bounding rectangle. - QRect boundingRect () const; - -public: - // Use this to implement calculatePoints() for rectangular selections. - static QPolygon CalculatePointsForRectangle (const QRect &rect); - - // Returns the border. This may be recalculated for every call so - // may be slow. - virtual QPolygon calculatePoints () const = 0; - - -// -// Point Testing -// - -public: - // Returns whether the given is on or inside the -- possibly, - // non-rectangular -- border of the selection. - // - // (for non-rectangular selections, may return false even if - // kpView::onSelectionResizeHandle()) - virtual bool contains (const QPoint &point) const = 0; - bool contains (int x, int y) const; - - -// -// Content -// - -public: - // i.e. Has an image or text - not just a border. - virtual bool hasContent () const = 0; - - // Deletes the content, changing the selection back into a border. - // If the selection has no content, it does nothing. - virtual void deleteContent () = 0; - - -// -// Mutation - Movement -// - -public: - // (You only need to override this if you store your own border - // coordinates) - virtual void moveBy (int dx, int dy); - - // (These call moveBy() so if you only reimplement moveBy(), that should - // be sufficient) - void moveTo (int dx, int dy); - void moveTo (const QPoint &topLeftPoint); - - -// -// Rendering -// - -public: - // Renders the selection on top of <*destPixmap>. This does not render - // the border. - // - // is the document rectangle that <*destPixmap> represents. - // - // You need to clip to boundingRect() or if you are a non-rectangular - // selection, an even smaller region, - // - // However, there is no need to do any explicit clipping to , - // since any drawing outside the bounds of is discarded. - // However, you may choose to clip for whatever reason e.g. performance. - virtual void paint (QImage *destPixmap, const QRect &docRect) const = 0; - - -protected: - // Use this to implement paintBorder() for rectangular selections. - void paintRectangularBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - - // Use this to implement paintBorder() for non-rectangular selections - // (this calls calculatePoints()). - // - // If , this also draws a bounding rectangular box. - void paintPolygonalBorder (const QPolygon &points, - QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - -public: - // Renders the selection border on top of <*destPixmap>. - // - // is the same as for paint(). - // - // If is false, the user is still dragging out the - // selection border so it may be drawn differently. - virtual void paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const = 0; - - -signals: - // Signals that a view update is required in the document region , - // due to the selection changing. - void changed (const QRect &docRect); - - -private: - struct kpAbstractSelectionPrivate * const d; -}; - - -#endif // kpAstractSelection_H diff --git a/kolourpaint/layers/selections/kpSelectionDrag.cpp b/kolourpaint/layers/selections/kpSelectionDrag.cpp deleted file mode 100644 index cdc0c825..00000000 --- a/kolourpaint/layers/selections/kpSelectionDrag.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION_DRAG 0 - - -#include - -#include -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -// public static -const char * const kpSelectionDrag::SelectionMimeType = - "application/x-kolourpaint-selection-400"; - -//--------------------------------------------------------------------- - -kpSelectionDrag::kpSelectionDrag (const kpAbstractImageSelection &sel) -{ -#if DEBUG_KP_SELECTION_DRAG && 1 - kDebug () << "kpSelectionDrag() w=" << sel.width () - << " h=" << sel.height () - << endl; -#endif - - Q_ASSERT (sel.hasContent ()); - - // Store as selection. - QByteArray ba; - { - QDataStream stream (&ba, QIODevice::WriteOnly); - stream << sel; - } - setData (kpSelectionDrag::SelectionMimeType, ba); - - // Store as image (so that QMimeData::hasImage()) works). - // OPT: an awful waste of memory storing image in both selection and QImage - const QImage image = sel.baseImage (); -#if DEBUG_KP_SELECTION_DRAG && 1 - kDebug () << "\timage: w=" << image.width () - << " h=" << image.height () - << endl; -#endif - if (image.isNull ()) - { - // TODO: proper error handling. - kError () << "kpSelectionDrag::setSelection() could not convert to image" - << endl; - } - else - setImageData (image); -} - -//--------------------------------------------------------------------- -// public static - -bool kpSelectionDrag::canDecode(const QMimeData *mimeData) -{ - Q_ASSERT(mimeData); - -#if DEBUG_KP_SELECTION_DRAG - kDebug() << "kpSelectionDrag::canDecode()" - << "hasSel=" << mimeData->hasFormat(kpSelectionDrag::SelectionMimeType) - << "hasImage=" << mimeData->hasImage(); -#endif - - // mimeData->hasImage() would not check if the data is a valid image - return mimeData->hasFormat(kpSelectionDrag::SelectionMimeType) || - !qvariant_cast(mimeData->imageData()).isNull(); -} - -//--------------------------------------------------------------------- -// public static - -kpAbstractImageSelection *kpSelectionDrag::decode(const QMimeData *mimeData) -{ -#if DEBUG_KP_SELECTION_DRAG - kDebug () << "kpSelectionDrag::decode(kpAbstractSelection)"; -#endif - Q_ASSERT (mimeData); - - if (mimeData->hasFormat (kpSelectionDrag::SelectionMimeType)) - { - #if DEBUG_KP_SELECTION_DRAG - kDebug () << "\tmimeSource hasFormat selection - just return it in QByteArray"; - #endif - QByteArray data = mimeData->data (kpSelectionDrag::SelectionMimeType); - QDataStream stream (&data, QIODevice::ReadOnly); - - return kpSelectionFactory::FromStream (stream); - } - else - { - #if DEBUG_KP_SELECTION_DRAG - kDebug () << "\tmimeSource doesn't provide selection - try image"; - #endif - - QImage image = qvariant_cast (mimeData->imageData ()); - if (!image.isNull ()) - { - #if DEBUG_KP_SELECTION_DRAG - kDebug () << "\tok w=" << image.width () << " h=" << image.height (); - #endif - - return new kpRectangularImageSelection ( - QRect (0, 0, image.width (), image.height ()), image); - } - else - { - #if DEBUG_KP_SELECTION_DRAG - kDebug () << "kpSelectionDrag::decode(kpAbstractSelection) mimeSource had no sel " - "and could not decode to image" << endl; - #endif - return 0; - } - } -} - -//--------------------------------------------------------------------- - -#include "moc_kpSelectionDrag.cpp" diff --git a/kolourpaint/layers/selections/kpSelectionDrag.h b/kolourpaint/layers/selections/kpSelectionDrag.h deleted file mode 100644 index 1da2d3f2..00000000 --- a/kolourpaint/layers/selections/kpSelectionDrag.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_SELECTION_DRAG_H -#define KP_SELECTION_DRAG_H - -#include - -class kpAbstractImageSelection; - - -class kpSelectionDrag : public QMimeData -{ - Q_OBJECT - - public: - static const char * const SelectionMimeType; - - // ASSUMPTION: has content (is not just a border). - kpSelectionDrag(const kpAbstractImageSelection &sel); - - public: - static bool canDecode(const QMimeData *mimeData); - static kpAbstractImageSelection *decode(const QMimeData *mimeData); -}; - - -#endif // KP_SELECTION_DRAG_H diff --git a/kolourpaint/layers/selections/kpSelectionFactory.cpp b/kolourpaint/layers/selections/kpSelectionFactory.cpp deleted file mode 100644 index aa4a9de0..00000000 --- a/kolourpaint/layers/selections/kpSelectionFactory.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -// public static -// TODO: KolourPaint has not been tested against invalid or malicious -// clipboard data [Bug #28]. -kpAbstractImageSelection *kpSelectionFactory::FromStream (QDataStream &stream) -{ -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpSelectionFactory::FromStream()"; -#endif - int serialID; - stream >> serialID; - -#if DEBUG_KP_SELECTION && 1 - kDebug () << "\tserialID=" << serialID; -#endif - - // Only image selections are marshalled. - // - // Text selections are only ever seen in the clipboard as ordinary text, - // not selections, since copying text formatting over the clipboard doesn't - // seem compelling. - kpAbstractImageSelection *imageSel = 0; - switch (serialID) - { - case kpRectangularImageSelection::SerialID: - imageSel = new kpRectangularImageSelection (); - break; - - case kpEllipticalImageSelection::SerialID: - imageSel = new kpEllipticalImageSelection (); - break; - - case kpFreeFormImageSelection::SerialID: - imageSel = new kpFreeFormImageSelection (); - break; - } - - // Unknown selection type? - if (imageSel == 0) - { - return 0; - } - - if (!imageSel->readFromStream (stream)) - { - delete imageSel; - return 0; - } - - return imageSel; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/selections/kpSelectionFactory.h b/kolourpaint/layers/selections/kpSelectionFactory.h deleted file mode 100644 index 5bbd271c..00000000 --- a/kolourpaint/layers/selections/kpSelectionFactory.h +++ /dev/null @@ -1,48 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpSelectionFactory_H -#define kpSelectionFactory_H - - -#include - - -#include - -class kpAbstractImageSelection; - - -class kpSelectionFactory -{ -public: - static kpAbstractImageSelection *FromStream (QDataStream &stream); -}; - - -#endif // kpSelectionFactory_H diff --git a/kolourpaint/layers/selections/text/kpPreeditText.cpp b/kolourpaint/layers/selections/text/kpPreeditText.cpp deleted file mode 100644 index 4f6ae5bd..00000000 --- a/kolourpaint/layers/selections/text/kpPreeditText.cpp +++ /dev/null @@ -1,142 +0,0 @@ - -/* - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -//--------------------------------------------------------------------- - -bool attributeLessThan (const QInputMethodEvent::Attribute &a1, const QInputMethodEvent::Attribute &a2) -{ - return a1.start < a2.start; -} - -//--------------------------------------------------------------------- - -kpPreeditText::kpPreeditText () - : m_cursorPosition (0), m_cursorColor (Qt::transparent), - m_selectionStart (0), m_selectionLength (0), - m_position (-1, -1) -{ -} - -//--------------------------------------------------------------------- - -kpPreeditText::kpPreeditText (const QInputMethodEvent *event) - : m_cursorPosition (0), m_cursorColor (Qt::transparent), - m_selectionStart (0), m_selectionLength (0), - m_position (-1, -1) -{ - m_preeditString = event->preeditString (); - foreach (const QInputMethodEvent::Attribute &attr, event->attributes ()) - { - switch (attr.type) - { - case QInputMethodEvent::TextFormat: - m_textFormatList.append (attr); - break; - case QInputMethodEvent::Cursor: - m_cursorPosition = attr.start; - if (attr.length > 0) - { - m_cursorColor = attr.value.value (); - } - break; - case QInputMethodEvent::Selection: - m_selectionStart = attr.start; - m_selectionLength = attr.length; - break; - default: - break; - } - } - qSort (m_textFormatList.begin (), m_textFormatList.end (), attributeLessThan); -} - -//--------------------------------------------------------------------- - -bool kpPreeditText::isEmpty () const -{ - return m_preeditString.isEmpty (); -} - -//--------------------------------------------------------------------- - -const QString &kpPreeditText::preeditString () const -{ - return m_preeditString; -} - -//--------------------------------------------------------------------- - -int kpPreeditText::cursorPosition () const -{ - return m_cursorPosition; -} - -//--------------------------------------------------------------------- - -const QColor &kpPreeditText::cursorColor () const -{ - return m_cursorColor; -} - -//--------------------------------------------------------------------- - -int kpPreeditText::selectionStart () const -{ - return m_selectionStart; -} - -//--------------------------------------------------------------------- - -int kpPreeditText::selectionLength () const -{ - return m_selectionLength; -} - -//--------------------------------------------------------------------- - -const QList &kpPreeditText::textFormatList () const -{ - return m_textFormatList; -} - -//--------------------------------------------------------------------- - -const QPoint &kpPreeditText::position () const -{ - return m_position; -} - -//--------------------------------------------------------------------- - -void kpPreeditText::setPosition (const QPoint &position) -{ - m_position = position; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/selections/text/kpPreeditText.h b/kolourpaint/layers/selections/text/kpPreeditText.h deleted file mode 100644 index 92200f63..00000000 --- a/kolourpaint/layers/selections/text/kpPreeditText.h +++ /dev/null @@ -1,65 +0,0 @@ - -/* - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpPreeditText_H -#define kpPreeditText_H - -#include -#include -#include - -class kpPreeditText -{ -public: - kpPreeditText (); - kpPreeditText (const QInputMethodEvent *event); - - bool isEmpty () const; - - const QString &preeditString () const; - int cursorPosition () const; - bool cursorVisible () const; - const QColor &cursorColor () const; - int selectionStart () const; - int selectionLength () const; - const QList &textFormatList () const; - - const QPoint &position () const; - void setPosition (const QPoint &position); - -private: - QString m_preeditString; - int m_cursorPosition; - QColor m_cursorColor; - int m_selectionStart; - int m_selectionLength; - QList m_textFormatList; - QPoint m_position; -}; - -#endif // kpPreeditText_H diff --git a/kolourpaint/layers/selections/text/kpTextSelection.cpp b/kolourpaint/layers/selections/text/kpTextSelection.cpp deleted file mode 100644 index f4dff208..00000000 --- a/kolourpaint/layers/selections/text/kpTextSelection.cpp +++ /dev/null @@ -1,346 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include -#include - -#include -#include - -#include - -#include -#include - - -// public -kpTextSelection::kpTextSelection (const QRect &rect, - const kpTextStyle &textStyle) - : kpAbstractSelection (rect), - d (new kpTextSelectionPrivate ()) -{ - d->textStyle = textStyle; -} - -// public -kpTextSelection::kpTextSelection (const QRect &rect, - const QList &textLines, - const kpTextStyle &textStyle) - : kpAbstractSelection (rect), - d (new kpTextSelectionPrivate ()) -{ - d->textLines = textLines; - d->textStyle = textStyle; -} - -// public -kpTextSelection::kpTextSelection (const kpTextSelection &rhs) - : kpAbstractSelection (), - d (new kpTextSelectionPrivate ()) -{ - *this = rhs; -} - -// public -kpTextSelection &kpTextSelection::operator= (const kpTextSelection &rhs) -{ - kpAbstractSelection::operator= (rhs); - - d->textLines = rhs.d->textLines; - d->textStyle = rhs.d->textStyle; - d->preeditText = rhs.d->preeditText; - - return *this; -} - -// public virtual [base kpAbstractSelection] -kpTextSelection *kpTextSelection::clone () const -{ - kpTextSelection *sel = new kpTextSelection (); - *sel = *this; - return sel; -} - -// public -kpTextSelection *kpTextSelection::resized (int newWidth, int newHeight) const -{ - return new kpTextSelection (QRect (x (), y (), newWidth, newHeight), - d->textLines, - d->textStyle); -} - -// public -kpTextSelection::~kpTextSelection () -{ - delete d; -} - - -// public virtual [kpAbstractSelection] -int kpTextSelection::serialID () const -{ - Q_ASSERT (!"Marshalling not supported"); - return -1; -} - -// public virtual [base kpAbstractSelection] -bool kpTextSelection::readFromStream (QDataStream &stream) -{ - (void) stream; - - Q_ASSERT (!"Marshalling not supported"); - return false; -} - -// public virtual [base kpAbstractSelection] -void kpTextSelection::writeToStream (QDataStream &stream) const -{ - (void) stream; - - Q_ASSERT (!"Marshalling not supported"); -} - - -// public virtual [kpAbstractSelection] -QString kpTextSelection::name () const -{ - return i18n ("Text"); -} - - -// public virtual [base kpAbstractSelection] -kpCommandSize::SizeType kpTextSelection::size () const -{ - return kpAbstractSelection::size () + - kpCommandSize::StringSize (text ()); -} - - -// public virtual [kpAbstractSelection] -bool kpTextSelection::isRectangular () const -{ - return true; -} - - -// public static -int kpTextSelection::MinimumWidthForTextStyle (const kpTextStyle &) -{ - return (kpTextSelection::TextBorderSize () * 2 + 5); -} - -// public static -int kpTextSelection::MinimumHeightForTextStyle (const kpTextStyle &) -{ - return (kpTextSelection::TextBorderSize () * 2 + 5); -} - -// public static -QSize kpTextSelection::MinimumSizeForTextStyle (const kpTextStyle &textStyle) -{ - return QSize (kpTextSelection::MinimumWidthForTextStyle (textStyle), - kpTextSelection::MinimumHeightForTextStyle (textStyle)); -} - - -// public virtual [kpAbstractSelection] -int kpTextSelection::minimumWidth () const -{ - return kpTextSelection::MinimumWidthForTextStyle (textStyle ()); -} - -// public virtual [kpAbstractSelection] -int kpTextSelection::minimumHeight () const -{ - return kpTextSelection::MinimumHeightForTextStyle (textStyle ()); -} - - -// public static -int kpTextSelection::PreferredMinimumWidthForTextStyle (const kpTextStyle &textStyle) -{ - const int about15CharsWidth = - textStyle.fontMetrics ().width ( - QLatin1String ("1234567890abcde")); - - const int preferredMinWidth = - qMax (150, - kpTextSelection::TextBorderSize () * 2 + about15CharsWidth); - - return qMax (kpTextSelection::MinimumWidthForTextStyle (textStyle), - qMin (250, preferredMinWidth)); -} - -// public static -int kpTextSelection::PreferredMinimumHeightForTextStyle (const kpTextStyle &textStyle) -{ - const int preferredMinHeight = - kpTextSelection::TextBorderSize () * 2 + textStyle.fontMetrics ().height (); - - return qMax (kpTextSelection::MinimumHeightForTextStyle (textStyle), - qMin (150, preferredMinHeight)); -} - -// public static -QSize kpTextSelection::PreferredMinimumSizeForTextStyle (const kpTextStyle &textStyle) -{ - return QSize (kpTextSelection::PreferredMinimumWidthForTextStyle (textStyle), - kpTextSelection::PreferredMinimumHeightForTextStyle (textStyle)); -} - - -// public static -int kpTextSelection::TextBorderSize () -{ - return 1; -} - -// public -QRect kpTextSelection::textAreaRect () const -{ - return QRect (x () + kpTextSelection::TextBorderSize (), - y () + kpTextSelection::TextBorderSize (), - width () - kpTextSelection::TextBorderSize () * 2, - height () - kpTextSelection::TextBorderSize () * 2); -} - - -// public virtual [kpAbstractSelection] -QPolygon kpTextSelection::calculatePoints () const -{ - return kpAbstractSelection::CalculatePointsForRectangle (boundingRect ()); -} - - -// public virtual [kpAbstractSelection] -bool kpTextSelection::contains (const QPoint &point) const -{ - return boundingRect ().contains (point); -} - - -// public -bool kpTextSelection::pointIsInTextBorderArea (const QPoint &point) const -{ - return (boundingRect ().contains (point) && !pointIsInTextArea (point)); -} - -// public -bool kpTextSelection::pointIsInTextArea (const QPoint &point) const -{ - return textAreaRect ().contains (point); -} - - -// public virtual [kpAbstractSelection] -bool kpTextSelection::hasContent () const -{ - return !d->textLines.isEmpty (); -} - -// public virtual [kpAbstractSelection] -void kpTextSelection::deleteContent () -{ - if (!hasContent ()) - return; - - setTextLines (QList ()); -} - - -// public -QList kpTextSelection::textLines () const -{ - return d->textLines; -} - -// public -void kpTextSelection::setTextLines (const QList &textLines_) -{ - d->textLines = textLines_; - - emit changed (boundingRect ()); -} - - -// public static -QString kpTextSelection::TextForTextLines (const QList &textLines) -{ - if (textLines.isEmpty ()) - return QString (); - - QString bigString = textLines [0]; - - for (QList ::const_iterator it = textLines.begin () + 1; - it != textLines.end (); - ++it) - { - bigString += QLatin1String ("\n"); - bigString += (*it); - } - - return bigString; -} - -// public -QString kpTextSelection::text () const -{ - return kpTextSelection::TextForTextLines (d->textLines); -} - - -// public -kpTextStyle kpTextSelection::textStyle () const -{ - return d->textStyle; -} - -// public -void kpTextSelection::setTextStyle (const kpTextStyle &textStyle) -{ - d->textStyle = textStyle; - - emit changed (boundingRect ()); -} - -kpPreeditText kpTextSelection::preeditText () const -{ - return d->preeditText; -} - -void kpTextSelection::setPreeditText (const kpPreeditText &preeditText) -{ - d->preeditText = preeditText; - emit changed (boundingRect ()); -} - -#include "moc_kpTextSelection.cpp" diff --git a/kolourpaint/layers/selections/text/kpTextSelection.h b/kolourpaint/layers/selections/text/kpTextSelection.h deleted file mode 100644 index 49b61494..00000000 --- a/kolourpaint/layers/selections/text/kpTextSelection.h +++ /dev/null @@ -1,294 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTextSelection_H -#define kpTextSelection_H - - -#include -#include -#include -#include - -// -// A rectangular text box containing lines of text, rendered in a given text -// style. -// -// A text selection with an empty list of text lines is just a text box -// border and contains no content. -// -// The minimal text selection that is considered to contain content consists -// of a single empty text line. -// -// The rendered elements are as follows: -// -// ############### -// # # -// # * *---------- Text Border -// # | # -// #####|######### -// | -// | -// Text Area -// (text lines are rendered on top of here; the parts of the lines -// that don't fit here are not rendered) -// -// The text style determines how the text box is drawn. -// -// The foreground color determines the color of the text. Transparent -// foreground text means that the text box is see-through for the pixels -// of the text, exposing the document pixels below. It does not mean -// that the transparent color is drawn onto the document. In other -// words, we are "painting" transparent pixels -- not "setting" them. -// -// If the background color is opaque, the text is drawn on top of a -// filled-in rectangle and the rectangle completely overwrites any -// document pixels below. -// -// Consistent with the behavior of a transparent foreground color, a -// transparent background color does not mean that a transparent-colored -// rectangle is drawn onto the document. Instead, it means that the -// text box background is see-through so that text is drawn directly on -// top of the document pixels. No rectangle is drawn in this case. -// -// A text box with transparent foreground and background colors is -// completely invisible since both the text and background are see-through. -// -// A rendered text cursor is controlled separately by kpViewManager, as -// cursors are only a view concept so do not belong in this document-based -// class. -// -// Marshalling, for copying text selections to the clipboard, is not -// currently supported. This is because generally, users are only interested -// in the text itself, not the border nor formatting. -// -class kpTextSelection : public kpAbstractSelection -{ -Q_OBJECT - -// -// Initialization -// - -public: - kpTextSelection (const QRect &rect = QRect (), - const kpTextStyle &textStyle = kpTextStyle ()); - kpTextSelection (const QRect &rect, const QList &textLines, - const kpTextStyle &textStyle); - kpTextSelection (const kpTextSelection &rhs); - - kpTextSelection &operator= (const kpTextSelection &rhs); - - virtual kpTextSelection *clone () const; - - // Returns a copy of the text selection but with new dimensions - // x . - kpTextSelection *resized (int newWidth, int newHeight) const; - - virtual ~kpTextSelection (); - - -// -// Marshalling -// - -public: - virtual int serialID () const; - - virtual bool readFromStream (QDataStream &stream); - - virtual void writeToStream (QDataStream &stream) const; - - -// -// General Queries -// - -public: - virtual QString name () const; - - virtual kpCommandSize::SizeType size () const; - -public: - virtual bool isRectangular () const; - - -// -// Position & Dimensions -// - -public: - // Returns the absolute minimum size that a textbox must be if it is of - // the given . - // - // This leaves enough room for the border on all 4 sides and also a - // text area big enough to fit a character in an extremely small font. - static int MinimumWidthForTextStyle (const kpTextStyle &textStyle); - static int MinimumHeightForTextStyle (const kpTextStyle &textStyle); - static QSize MinimumSizeForTextStyle (const kpTextStyle &textStyle); - - // REFACTOR: Enforce in kpTextSelection, not just in kpToolSelection & - // when pasting (in kpMainWindow). - // - // Otherwise, if enforcement fails, e.g. textAreaRect() will - // not work. - virtual int minimumWidth () const; - virtual int minimumHeight () const; - -public: - // Returns the suggested minimum size that a textbox should be if it is of - // the given . - // - // This leaves enough room for the border on all 4 sides and also for - // a small line of the text in the given text style. - static int PreferredMinimumWidthForTextStyle (const kpTextStyle &textStyle); - static int PreferredMinimumHeightForTextStyle (const kpTextStyle &textStyle); - static QSize PreferredMinimumSizeForTextStyle (const kpTextStyle &textStyle); - -public: - // Returns the size of the text border. Constant. - static int TextBorderSize (); - - // Returns the rectangle that text lines are drawn on top of. - // This will be a sub-rectangle of boundingRect() and is therefore, - // in document coordinates like everything else in this class. - QRect textAreaRect () const; - -public: - virtual QPolygon calculatePoints () const; - - -// -// Point Testing -// - -public: - virtual bool contains (const QPoint &point) const; - -public: - bool pointIsInTextBorderArea (const QPoint &point) const; - bool pointIsInTextArea (const QPoint &point) const; - - -// -// Content -// - -public: - // (see class header comment) - virtual bool hasContent () const; - - virtual void deleteContent (); - -public: - QList textLines () const; - void setTextLines (const QList &textLines); - - static QString TextForTextLines (const QList &textLines); - // Returns textLines() as one long newline-separated string. - // If the last text line is not empty, there is no trailing newline. - QString text () const; - - -// -// Text Style -// - -public: - kpTextStyle textStyle () const; - void setTextStyle (const kpTextStyle &textStyle); - - -// -// Preedit Text -// - -public: - kpPreeditText preeditText () const; - void setPreeditText (const kpPreeditText &preeditText); - -// -// Cursor -// -// A text cursor position is the row and column of a character in -// textLines(), that it is to the left of. As a result, a column value -// of 1 character past the last character of a text line is allowed. -// - -public: - // If the given point is in the text area, it returns the closest - // row/column (in textLines()) for the point. - // - // If the given point is not in the text area, it returns -1. - int closestTextRowForPoint (const QPoint &point) const; - int closestTextColForPoint (const QPoint &point) const; - - // Given a valid row and column in textLines(), returns the top-left - // point of where the text cursor should be rendered. - // TODO: Code is not symmetric to closestTest{Row,Col}ForPoint() - // [look at the Y/row value calculations] - // - // If the row and column is not inside textLines(), it returns - // KP_INVALID_POINT. - QPoint pointForTextRowCol (int row, int col) const; - - -// -// Rendering -// - -private: - void drawPreeditString(QPainter &painter, int &x, int y, const kpPreeditText &preeditText) const; - -public: - virtual void paint(QImage *destPixmap, const QRect &docRect) const; - - virtual void paintBorder(QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const; - -public: - // Returns an image that contains the painted text (without a border). - // - // If the text box has a see-through background, the image will be given - // an arbitrarily neutral background (currently, the transparent color). - // As a result, the returned image will be an approximation since text - // boxes are normally rendered -- and antialiased with -- a different - // background, namely the document image. Therefore, it is invalid to - // stamp the returned image onto the document image and expect it to look - // like stamping this text selection onto the document image (the latter - // is achieved via kpDocument::selectionPushOntoDocument(), antialiases - // and is more correct). - kpImage approximateImage () const; - - -private: - struct kpTextSelectionPrivate * const d; -}; - - -#endif // kpTextSelection_H diff --git a/kolourpaint/layers/selections/text/kpTextSelectionPrivate.h b/kolourpaint/layers/selections/text/kpTextSelectionPrivate.h deleted file mode 100644 index 47392252..00000000 --- a/kolourpaint/layers/selections/text/kpTextSelectionPrivate.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTextSelectionPrivate_H -#define kpTextSelectionPrivate_H - - -#include - -#include -#include -#include - -struct kpTextSelectionPrivate -{ - QList textLines; - kpTextStyle textStyle; - kpPreeditText preeditText; -}; - - -#endif // kpTextSelectionPrivate_H diff --git a/kolourpaint/layers/selections/text/kpTextSelection_Cursor.cpp b/kolourpaint/layers/selections/text/kpTextSelection_Cursor.cpp deleted file mode 100644 index 0f327261..00000000 --- a/kolourpaint/layers/selections/text/kpTextSelection_Cursor.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include -#include - -#include -#include - -#include - -#include -#include -#include - - -// public -int kpTextSelection::closestTextRowForPoint (const QPoint &point) const -{ - if (!pointIsInTextArea (point)) - return -1; - - const QFontMetrics fontMetrics (d->textStyle.fontMetrics ()); - - int row = (point.y () - textAreaRect ().y ()) / - fontMetrics.lineSpacing (); - if (row >= (int) d->textLines.size ()) - row = d->textLines.size () - 1; - - return row; -} - -// public -int kpTextSelection::closestTextColForPoint (const QPoint &point) const -{ - int row = closestTextRowForPoint (point); - if (row < 0 || row >= (int) d->textLines.size ()) - return -1; - - const int localX = point.x () - textAreaRect ().x (); - - const QFontMetrics fontMetrics (d->textStyle.fontMetrics ()); - - // (should be 0 but call just in case) - int charLocalLeft = fontMetrics.width (d->textLines [row], 0); - - // OPT: binary search or guess location then move - for (int col = 0; col < (int) d->textLines [row].length (); col++) - { - // OPT: fontMetrics::charWidth() might be faster - const int nextCharLocalLeft = fontMetrics.width (d->textLines [row], col + 1); - if (localX <= (charLocalLeft + nextCharLocalLeft) / 2) - return col; - - charLocalLeft = nextCharLocalLeft; - } - - return d->textLines [row].length ()/*past end of line*/; -} - -//--------------------------------------------------------------------- - -// public -QPoint kpTextSelection::pointForTextRowCol (int row, int col) const -{ - kpPreeditText preeditText = d->preeditText; - if ((row < 0 || col < 0) || - (preeditText.isEmpty () && - (row >= (int) d->textLines.size () || col > (int) d->textLines [row].length ()))) - { -#if DEBUG_KP_SELECTION && 1 - kDebug () << "kpTextSelection::pointForTextRowCol(" - << row << "," - << col << ") out of range" - << " textLines='" - << text () - << "'" - << endl; -#endif - return KP_INVALID_POINT; - } - - const QFontMetrics fontMetrics (d->textStyle.fontMetrics ()); - - QString line = (d->textLines.count () > row) ? d->textLines[row] : QString (); - if (row == preeditText.position ().y ()) - { - line.insert (preeditText.position ().x (), preeditText.preeditString ()); - } - const int x = fontMetrics.width (line.left (col)); - const int y = row * fontMetrics.height () + - (row >= 1 ? row * fontMetrics.leading () : 0); - - return textAreaRect ().topLeft () + QPoint (x, y); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/selections/text/kpTextSelection_Paint.cpp b/kolourpaint/layers/selections/text/kpTextSelection_Paint.cpp deleted file mode 100644 index 49aeac59..00000000 --- a/kolourpaint/layers/selections/text/kpTextSelection_Paint.cpp +++ /dev/null @@ -1,269 +0,0 @@ - -// REFACTOR: Move into kpPainter - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_SELECTION 0 - - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -void kpTextSelection::drawPreeditString(QPainter &painter, int &x, int y, const kpPreeditText &preeditText) const -{ - int i = 0; - QString preeditString = preeditText.preeditString (); - QString str; - foreach (const QInputMethodEvent::Attribute &attr, preeditText.textFormatList ()) - { - int start = attr.start; - int length = attr.length; - QTextCharFormat format = qvariant_cast (attr.value).toCharFormat (); - - if (i > start) - { - length = length - i + start; - start = i; - } - if (length <= 0) continue; - - if (i < start) - { - str = preeditString.mid (i, start - i); - painter.drawText (x, y, str); - x += painter.fontMetrics ().width (str); - } - - painter.save(); - str = preeditString.mid (start, length); - int width = painter.fontMetrics().width (str); - if (format.background ().color () != Qt::black) - { - painter.save (); - painter.setPen (format.background ().color ()); - painter.setBrush (format.background()); - painter.drawRect (x, y - painter.fontMetrics ().ascent (), width, painter.fontMetrics ().height ()); - painter.restore (); - } - if (format.foreground ().color () != Qt::black) - { - painter.setBrush (format.foreground ()); - painter.setPen (format.foreground ().color ()); - } - if (format.underlineStyle ()) - { - painter.drawLine (x, y + painter.fontMetrics ().descent (), x + width, y + painter.fontMetrics ().descent ()); - } - painter.drawText (x, y, str); - - x += width; - painter.restore (); - - i = start + length; - } - if (i < preeditString.length ()) - { - str = preeditString.mid (i); - painter.drawText (x, y, str); - x += painter.fontMetrics ().width (str); - } -} - -//--------------------------------------------------------------------- - -// public virtual [kpAbstractSelection] -void kpTextSelection::paint(QImage *destPixmap, const QRect &docRect) const -{ -#if DEBUG_KP_SELECTION - kDebug () << "kpTextSelection::paint() textStyle: fcol=" - << (int *) d->textStyle.foregroundColor ().toQRgb () - << " bcol=" - << (int *) d->textStyle.backgroundColor ().toQRgb () - << endl; -#endif - - // Drawing text is slow so if the text box will be rendered completely - // outside of , don't bother rendering it at all. - const QRect modifyingRect = docRect.intersected (boundingRect ()); - if (modifyingRect.isEmpty ()) - return; - - - // Is the text box completely invisible? - if (textStyle ().foregroundColor ().isTransparent () && - textStyle ().backgroundColor ().isTransparent ()) - { - return; - } - - kpImage floatImage(modifyingRect.size(), QImage::Format_ARGB32_Premultiplied); - floatImage.fill(0); - - QRect theWholeAreaRect, theTextAreaRect; - theWholeAreaRect = boundingRect ().translated (-modifyingRect.topLeft ()); - theTextAreaRect = textAreaRect ().translated (-modifyingRect.topLeft ()); - - QList theTextLines = textLines(); - kpTextStyle theTextStyle = textStyle(); - - const QFontMetrics fontMetrics (theTextStyle.font ()); - -#if DEBUG_KP_SELECTION - kDebug () << "kpTextSelection_Paint.cpp:DrawTextHelper"; - kDebug () << "\theight=" << fontMetrics.height () - << " leading=" << fontMetrics.leading () - << " ascent=" << fontMetrics.ascent () - << " descent=" << fontMetrics.descent () - << " lineSpacing=" << fontMetrics.lineSpacing () - << endl; -#endif - - QPainter painter(&floatImage); - - // Fill in the background using the transparent/opaque tool setting - if ( theTextStyle.isBackgroundTransparent() ) - painter.fillRect(theWholeAreaRect, Qt::transparent); - else - painter.fillRect(theWholeAreaRect, theTextStyle.backgroundColor().toQColor()); - - painter.setClipRect(theWholeAreaRect); - painter.setPen(theTextStyle.foregroundColor().toQColor()); - painter.setFont(theTextStyle.font()); - - if ( theTextStyle.foregroundColor().toQColor().alpha() < 255 ) - { - // if the foreground color has an alpha channel, we want to - // see through the background, so we first need to punch holes - // into the background where the text is - painter.setCompositionMode(QPainter::CompositionMode_Clear); - - int baseLine = theTextAreaRect.y () + fontMetrics.ascent (); - foreach (const QString &str, theTextLines) - { - painter.drawText (theTextAreaRect.x (), baseLine, str); - baseLine += fontMetrics.lineSpacing (); - - // if the next textline would already be below the visible text area, stop drawing - if ( (baseLine - fontMetrics.ascent()) > (theTextAreaRect.y() + theTextAreaRect.height()) ) - break; - } - // the next text drawing will now blend the text foreground color with - // what is really below the text background - painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - } - - // Draw a line at a time instead of using QPainter::drawText(QRect,...). - // Else, the line heights become >QFontMetrics::height() if you type Chinese - // characters (!) and then the cursor gets out of sync. - int baseLine = theTextAreaRect.y () + fontMetrics.ascent (); - - kpPreeditText thePreeditText = preeditText(); - - if ( theTextLines.isEmpty() ) - { - if ( ! thePreeditText.isEmpty() ) - { - int x = theTextAreaRect.x(); - drawPreeditString(painter, x, baseLine, thePreeditText); - } - } - else - { - int i = 0; - int row = thePreeditText.position().y(); - int col = thePreeditText.position().x(); - foreach (const QString &str, theTextLines) - { - if (row == i && !thePreeditText.isEmpty()) - { - QString left = str.left(col); - QString right = str.mid(col); - int x = theTextAreaRect.x(); - painter.drawText(x, baseLine, left); - x += fontMetrics.width(left); - drawPreeditString(painter, x, baseLine, thePreeditText); - - painter.drawText(x, baseLine, right); - } - else - { - painter.drawText(theTextAreaRect.x (), baseLine, str); - } - baseLine += fontMetrics.lineSpacing(); - i++; - - // if the next textline would already be below the visible text area, stop drawing - if ( (baseLine - fontMetrics.ascent()) > (theTextAreaRect.y() + theTextAreaRect.height()) ) - break; - } - } - - // ... convert that into "painting" transparent pixels on top of - // the document. - kpPixmapFX::paintPixmapAt (destPixmap, - modifyingRect.topLeft () - docRect.topLeft (), - floatImage); -} - -//--------------------------------------------------------------------- - - -// public virtual [kpAbstractSelection] -void kpTextSelection::paintBorder (QImage *destPixmap, const QRect &docRect, - bool selectionFinished) const -{ - paintRectangularBorder (destPixmap, docRect, selectionFinished); -} - -//--------------------------------------------------------------------- - -// public -kpImage kpTextSelection::approximateImage () const -{ - kpImage retImage (width (), height (), QImage::Format_ARGB32_Premultiplied); - retImage.fill(0); - paint (&retImage, boundingRect ()); - return retImage; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/selections/text/kpTextStyle.cpp b/kolourpaint/layers/selections/text/kpTextStyle.cpp deleted file mode 100644 index 9b4390ec..00000000 --- a/kolourpaint/layers/selections/text/kpTextStyle.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include -#include - - -kpTextStyle::kpTextStyle () - : m_fontSize (0), - m_isBold (false), m_isItalic (false), - m_isUnderline (false), m_isStrikeThru (false), - m_isBackgroundOpaque (true) -{ -} - -kpTextStyle::kpTextStyle (const QString &fontFamily, - int fontSize, - bool isBold, bool isItalic, - bool isUnderline, bool isStrikeThru, - const kpColor &fcolor, const kpColor &bcolor, - bool isBackgroundOpaque) - : m_fontFamily (fontFamily), - m_fontSize (fontSize), - m_isBold (isBold), m_isItalic (isItalic), - m_isUnderline (isUnderline), m_isStrikeThru (isStrikeThru), - m_foregroundColor (fcolor), m_backgroundColor (bcolor), - m_isBackgroundOpaque (isBackgroundOpaque) -{ -} - -kpTextStyle::~kpTextStyle () -{ -} - - -// friend -QDataStream &operator<< (QDataStream &stream, const kpTextStyle &textStyle) -{ - stream << textStyle.m_fontFamily; - stream << textStyle.m_fontSize; - - stream << int (textStyle.m_isBold) << int (textStyle.m_isItalic) - << int (textStyle.m_isUnderline) << int (textStyle.m_isStrikeThru); - - stream << textStyle.m_foregroundColor << textStyle.m_backgroundColor; - - stream << int (textStyle.m_isBackgroundOpaque); - - return stream; -} - -// friend -QDataStream &operator>> (QDataStream &stream, kpTextStyle &textStyle) -{ - stream >> textStyle.m_fontFamily; - stream >> textStyle.m_fontSize; - - int a, b, c, d; - stream >> a >> b >> c >> d; - textStyle.m_isBold = a; - textStyle.m_isItalic = b; - textStyle.m_isUnderline = c; - textStyle.m_isStrikeThru = d; - - stream >> textStyle.m_foregroundColor >> textStyle.m_backgroundColor; - - int e; - stream >> e; - textStyle.m_isBackgroundOpaque = e; - - return stream; -} - -// public -bool kpTextStyle::operator== (const kpTextStyle &rhs) const -{ - return (m_fontFamily == rhs.m_fontFamily && - m_fontSize == rhs.m_fontSize && - m_isBold == rhs.m_isBold && - m_isItalic == rhs.m_isItalic && - m_isUnderline == rhs.m_isUnderline && - m_isStrikeThru == rhs.m_isStrikeThru && - m_foregroundColor == rhs.m_foregroundColor && - m_backgroundColor == rhs.m_backgroundColor && - m_isBackgroundOpaque == rhs.m_isBackgroundOpaque); -} - -// public -bool kpTextStyle::operator!= (const kpTextStyle &rhs) const -{ - return !(*this == rhs); -} - - -// public -QString kpTextStyle::fontFamily () const -{ - return m_fontFamily; -} - -// public -void kpTextStyle::setFontFamily (const QString &f) -{ - m_fontFamily = f; -} - - -// public -int kpTextStyle::fontSize () const -{ - return m_fontSize; -} - -// public -void kpTextStyle::setFontSize (int s) -{ - m_fontSize = s; -} - - -// public -bool kpTextStyle::isBold () const -{ - return m_isBold; -} - -// public -void kpTextStyle::setBold (bool yes) -{ - m_isBold = yes; -} - - -// public -bool kpTextStyle::isItalic () const -{ - return m_isItalic; -} - -// public -void kpTextStyle::setItalic (bool yes) -{ - m_isItalic = yes; -} - - -// public -bool kpTextStyle::isUnderline () const -{ - return m_isUnderline; -} - -// public -void kpTextStyle::setUnderline (bool yes) -{ - m_isUnderline = yes; -} - - -// public -bool kpTextStyle::isStrikeThru () const -{ - return m_isStrikeThru; -} - -// public -void kpTextStyle::setStrikeThru (bool yes) -{ - m_isStrikeThru = yes; -} - - -// public -kpColor kpTextStyle::foregroundColor () const -{ - return m_foregroundColor; -} - -// public -void kpTextStyle::setForegroundColor (const kpColor &fcolor) -{ - m_foregroundColor = fcolor; -} - - -// public -kpColor kpTextStyle::backgroundColor () const -{ - return m_backgroundColor; -} - -// public -void kpTextStyle::setBackgroundColor (const kpColor &bcolor) -{ - m_backgroundColor = bcolor; -} - - -// public -bool kpTextStyle::isBackgroundOpaque () const -{ - return m_isBackgroundOpaque; -} - -// public -void kpTextStyle::setBackgroundOpaque (bool yes) -{ - m_isBackgroundOpaque = yes; -} - - -// public -bool kpTextStyle::isBackgroundTransparent () const -{ - return !m_isBackgroundOpaque; -} - -// public -void kpTextStyle::setBackgroundTransparent (bool yes) -{ - m_isBackgroundOpaque = !yes; -} - - -// public -QFont kpTextStyle::font () const -{ - QFont fnt (m_fontFamily, m_fontSize); - fnt.setBold (m_isBold); - fnt.setItalic (m_isItalic); - fnt.setUnderline (m_isUnderline); - fnt.setStrikeOut (m_isStrikeThru); - - return fnt; -} - -// public -QFontMetrics kpTextStyle::fontMetrics () const -{ - return QFontMetrics (font ()); -} diff --git a/kolourpaint/layers/selections/text/kpTextStyle.h b/kolourpaint/layers/selections/text/kpTextStyle.h deleted file mode 100644 index 4b5d98c8..00000000 --- a/kolourpaint/layers/selections/text/kpTextStyle.h +++ /dev/null @@ -1,107 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TEXT_STYLE_H -#define KP_TEXT_STYLE_H - - -#include - -#include - - -#include -#include -#include - - -class kpTextStyle -{ -public: - kpTextStyle (); - kpTextStyle (const QString &fontFamily, - int fontSize, - bool isBold, bool isItalic, - bool isUnderline, bool isStrikeThru, - const kpColor &fcolor, - const kpColor &bcolor, - bool isBackgroundOpaque); - ~kpTextStyle (); - - - friend QDataStream &operator<< (QDataStream &stream, const kpTextStyle &textStyle); - friend QDataStream &operator>> (QDataStream &stream, kpTextStyle &textStyle); - bool operator== (const kpTextStyle &rhs) const; - bool operator!= (const kpTextStyle &rhs) const; - - - QString fontFamily () const; - void setFontFamily (const QString &f); - - int fontSize () const; - void setFontSize (int s); - - bool isBold () const; - void setBold (bool yes = true); - - bool isItalic () const; - void setItalic (bool yes = true); - - bool isUnderline () const; - void setUnderline (bool yes = true); - - bool isStrikeThru () const; - void setStrikeThru (bool yes = true); - - kpColor foregroundColor () const; - void setForegroundColor (const kpColor &fcolor); - - // Note: This is the _input_ backgroundColor - kpColor backgroundColor () const; - void setBackgroundColor (const kpColor &bcolor); - - bool isBackgroundOpaque () const; - void setBackgroundOpaque (bool yes = true); - - bool isBackgroundTransparent () const; - void setBackgroundTransparent (bool yes = true); - - - QFont font () const; - QFontMetrics fontMetrics () const; - -private: - QString m_fontFamily; - int m_fontSize; - bool m_isBold, m_isItalic, m_isUnderline, m_isStrikeThru; - kpColor m_foregroundColor, m_backgroundColor; - bool m_isBackgroundOpaque; -}; - - -#endif // KP_TEXT_STYLE_H diff --git a/kolourpaint/layers/tempImage/kpTempImage.cpp b/kolourpaint/layers/tempImage/kpTempImage.cpp deleted file mode 100644 index f9ea76ca..00000000 --- a/kolourpaint/layers/tempImage/kpTempImage.cpp +++ /dev/null @@ -1,217 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpTempImage::kpTempImage (bool isBrush, RenderMode renderMode, - const QPoint &topLeft, const kpImage &image) - : m_isBrush (isBrush), - m_renderMode (renderMode), - m_topLeft (topLeft), - m_image (image), - m_width (image.width ()), m_height (image.height ()), - m_userFunction (0), - m_userData (0) -{ - // Use below constructor for that. - Q_ASSERT (renderMode != UserFunction); -} - -//--------------------------------------------------------------------- - -kpTempImage::kpTempImage (bool isBrush, const QPoint &topLeft, - UserFunctionType userFunction, void *userData, - int width, int height) - : m_isBrush (isBrush), - m_renderMode (UserFunction), - m_topLeft (topLeft), - m_width (width), m_height (height), - m_userFunction (userFunction), - m_userData (userData) -{ - Q_ASSERT (m_userFunction); -} - -//--------------------------------------------------------------------- - -kpTempImage::kpTempImage (const kpTempImage &rhs) - : m_isBrush (rhs.m_isBrush), - m_renderMode (rhs.m_renderMode), - m_topLeft (rhs.m_topLeft), - m_image (rhs.m_image), - m_width (rhs.m_width), m_height (rhs.m_height), - m_userFunction (rhs.m_userFunction), - m_userData (rhs.m_userData) -{ -} - -//--------------------------------------------------------------------- - -kpTempImage &kpTempImage::operator= (const kpTempImage &rhs) -{ - if (this == &rhs) - return *this; - - m_isBrush = rhs.m_isBrush; - m_renderMode = rhs.m_renderMode; - m_topLeft = rhs.m_topLeft; - m_image = rhs.m_image; - m_width = rhs.m_width, m_height = rhs.m_height; - m_userFunction = rhs.m_userFunction; - m_userData = rhs.m_userData; - - return *this; -} - -//--------------------------------------------------------------------- - -// public -bool kpTempImage::isBrush () const -{ - return m_isBrush; -} - -//--------------------------------------------------------------------- - -// public -kpTempImage::RenderMode kpTempImage::renderMode () const -{ - return m_renderMode; -} - -//--------------------------------------------------------------------- - -// public -QPoint kpTempImage::topLeft () const -{ - return m_topLeft; -} - -//--------------------------------------------------------------------- - -// public -kpImage kpTempImage::image () const -{ - return m_image; -} - -//--------------------------------------------------------------------- - -// public -kpTempImage::UserFunctionType kpTempImage::userFunction () const -{ - return m_userFunction; -} - -//--------------------------------------------------------------------- - -// public -void *kpTempImage::userData () const -{ - return m_userData; -} - -//--------------------------------------------------------------------- - -// public -bool kpTempImage::isVisible (const kpViewManager *vm) const -{ - return m_isBrush ? (bool) vm->viewUnderCursor () : true; -} - -//--------------------------------------------------------------------- - -// public -QRect kpTempImage::rect () const -{ - return QRect (m_topLeft.x (), m_topLeft.y (), - m_width, m_height); -} - -//--------------------------------------------------------------------- - -// public -int kpTempImage::width () const -{ - return m_width; -} - -//--------------------------------------------------------------------- - -// public -int kpTempImage::height () const -{ - return m_height; -} - -//--------------------------------------------------------------------- - -// public -bool kpTempImage::paintMayAddMask () const -{ - return (m_renderMode == SetImage || - m_renderMode == UserFunction); -} - -//--------------------------------------------------------------------- - -// public -void kpTempImage::paint (kpImage *destImage, const QRect &docRect) const -{ - const QPoint REL_TOP_LEFT = m_topLeft - docRect.topLeft (); - - switch (m_renderMode) - { - case SetImage: - { - kpPixmapFX::setPixmapAt(destImage, REL_TOP_LEFT, m_image); - break; - } - - case PaintImage: - { - kpPixmapFX::paintPixmapAt(destImage, REL_TOP_LEFT, m_image); - break; - } - - case UserFunction: - { - m_userFunction(destImage, REL_TOP_LEFT, m_userData); - break; - } - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/layers/tempImage/kpTempImage.h b/kolourpaint/layers/tempImage/kpTempImage.h deleted file mode 100644 index bc70c069..00000000 --- a/kolourpaint/layers/tempImage/kpTempImage.h +++ /dev/null @@ -1,110 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// REFACTOR: maybe make us and kpAbstractSelection share a new kpLayer base? - - -#ifndef kpTempImage_H -#define kpTempImage_H - - -#include - -#include - - -class kpViewManager; - - -class kpTempImage -{ -public: - // REFACTOR: Extract into class hierarchy. - enum RenderMode - { - SetImage, - PaintImage, - UserFunction - }; - - // REFACTOR: Function pointers imply a need for a proper class hierarchy. - typedef void (*UserFunctionType) (kpImage * /*destImage*/, - const QPoint & /*topLeft*/, - void * /*userData*/); - - /* - * Specifies that its visibility is dependent on whether or - * not the mouse cursor is inside a view. If false, the - * image is always displayed. - * - * This is the only way of specifying the "UserFunction" - * . must not draw outside - * the claimed rectangle. - */ - kpTempImage (bool isBrush, RenderMode renderMode, const QPoint &topLeft, const kpImage &image); - kpTempImage (bool isBrush, const QPoint &topLeft, - UserFunctionType userFunction, void *userData, - int width, int height); - kpTempImage (const kpTempImage &rhs); - kpTempImage &operator= (const kpTempImage &rhs); - - bool isBrush () const; - RenderMode renderMode () const; - QPoint topLeft () const; - kpImage image () const; - UserFunctionType userFunction () const; - void *userData () const; - - bool isVisible (const kpViewManager *vm) const; - QRect rect () const; - int width () const; - int height () const; - - - // Returns whether a call to paint() may add a mask to <*destImage>. - bool paintMayAddMask () const; - - /* - * Draws itself onto <*destImage>, given that <*destImage> represents - * the unzoomed of the kpDocument. You should check for - * visibility before calling this function. - */ - void paint (kpImage *destImage, const QRect &docRect) const; - -private: - bool m_isBrush; - RenderMode m_renderMode; - QPoint m_topLeft; - kpImage m_image; - // == m_image.{width,height}() unless m_renderMode == UserFunction. - int m_width, m_height; - UserFunctionType m_userFunction; - void *m_userData; -}; - - -#endif // kpTempImage_H diff --git a/kolourpaint/lgpl/generic/kpColorCollection.cpp b/kolourpaint/lgpl/generic/kpColorCollection.cpp deleted file mode 100644 index 7aa1df47..00000000 --- a/kolourpaint/lgpl/generic/kpColorCollection.cpp +++ /dev/null @@ -1,537 +0,0 @@ - -// REFACT0R: Remote open/save file logic is duplicated in kpDocument. -// HITODO: Test when remote file support in KDE 4 stabilizes - -/* This file is part of the KDE libraries - Copyright (C) 1999 Waldo Bastian (bastian@kde.org) - Copyright (C) 2007 Clarence Dang (dang@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -//----------------------------------------------------------------------------- -// KDE color collection - -#define DEBUG_KP_COLOR_COLLECTION 0 - -#include "kpColorCollection.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct ColorNode -{ - ColorNode(const QColor &c, const QString &n) - : color(c), name(n) {} - - QColor color; - QString name; -}; - -//--------------------------------------------------------------------- - -//BEGIN kpColorCollectionPrivate -class kpColorCollectionPrivate -{ -public: - kpColorCollectionPrivate(); - kpColorCollectionPrivate(const kpColorCollectionPrivate&); - - QList colorList; - QString name; - QString desc; - kpColorCollection::Editable editable; -}; - -kpColorCollectionPrivate::kpColorCollectionPrivate() - : editable(kpColorCollection::Yes) -{ -} - -kpColorCollectionPrivate::kpColorCollectionPrivate(const kpColorCollectionPrivate& p) - : colorList(p.colorList), name(p.name), desc(p.desc), editable(p.editable) -{ -} -//END kpColorCollectionPrivate - -//--------------------------------------------------------------------- - -QStringList -kpColorCollection::installedCollections() -{ - QStringList paletteList; - KGlobal::dirs()->findAllResources("config", "colors/*", KStandardDirs::NoDuplicates, paletteList); - - int strip = strlen("colors/"); - for(QStringList::Iterator it = paletteList.begin(); - it != paletteList.end(); - ++it) - { - (*it) = (*it).mid(strip); - } - - return paletteList; -} - -kpColorCollection::kpColorCollection() -{ - d = new kpColorCollectionPrivate(); -} - -kpColorCollection::kpColorCollection(const kpColorCollection &p) -{ - d = new kpColorCollectionPrivate(*p.d); -} - -kpColorCollection::~kpColorCollection() -{ - // Need auto-save? - delete d; -} - -static void CouldNotOpenDialog (const KUrl &url, QWidget *parent) -{ - KMessageBox::sorry (parent, - i18n ("Could not open color palette \"%1\".", - kpUrlFormatter::PrettyFilename (url))); -} - -// TODO: Set d->editable? -bool -kpColorCollection::open(const KUrl &url, QWidget *parent) -{ - QString tempPaletteFilePath; - if (url.isEmpty () || !KIO::NetAccess::download (url, tempPaletteFilePath, parent)) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\tcould not download"; - #endif - ::CouldNotOpenDialog (url, parent); - return false; - } - - // sync: remember to "KIO::NetAccess::removeTempFile (tempPaletteFilePath)" in all exit paths - - QFile paletteFile(tempPaletteFilePath); - if (!paletteFile.exists() || - !paletteFile.open(QIODevice::ReadOnly)) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\tcould not open qfile"; - #endif - KIO::NetAccess::removeTempFile (tempPaletteFilePath); - ::CouldNotOpenDialog (url, parent); - return false; - } - - // Read first line - // Expected "GIMP Palette" - QString line = QString::fromLocal8Bit(paletteFile.readLine()); - if (line.indexOf(" Palette") == -1) - { - KIO::NetAccess::removeTempFile (tempPaletteFilePath); - KMessageBox::sorry (parent, - i18n ("Could not open color palette \"%1\" - unsupported format.\n" - "The file may be corrupt.", - kpUrlFormatter::PrettyFilename (url))); - return false; - } - - QList newColorList; - QString newDesc; - - while( !paletteFile.atEnd() ) - { - line = QString::fromLocal8Bit(paletteFile.readLine()); - if (line[0] == '#') - { - // This is a comment line - line = line.mid(1); // Strip '#' - line = line.trimmed(); // Strip remaining white space.. - if (!line.isEmpty()) - { - newDesc += line+'\n'; // Add comment to description - } - } - else - { - // This is a color line, hopefully - line = line.trimmed(); - if (line.isEmpty()) continue; - int r, g, b; - int pos = 0; - if (sscanf(line.toAscii(), "%d %d %d%n", &r, &g, &b, &pos) >= 3) - { - r = qBound(0, r, 255); - g = qBound(0, g, 255); - b = qBound(0, b, 255); - QString name = line.mid(pos).trimmed(); - newColorList.append(ColorNode(QColor(r, g, b), name)); - } - } - } - - d->colorList = newColorList; - d->name.clear (); - d->desc = newDesc; - - KIO::NetAccess::removeTempFile (tempPaletteFilePath); - return true; -} - -static void CouldNotOpenKDEDialog (const QString &name, QWidget *parent) -{ - KMessageBox::sorry (parent, - i18n ("Could not open KDE color palette \"%1\".", name)); -} - -bool -kpColorCollection::openKDE(const QString &name, QWidget *parent) -{ -#if DEBUG_KP_COLOR_COLLECTION - kDebug () << "name=" << name; -#endif - - if (name.isEmpty()) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "name.isEmpty"; - #endif - ::CouldNotOpenKDEDialog (name, parent); - return false; - } - - QString filename = KStandardDirs::locate("config", "colors/"+name); - if (filename.isEmpty()) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "could not find file"; - #endif - ::CouldNotOpenKDEDialog (name, parent); - return false; - } - - // (this will pop up an error dialog on failure) - if (!open (KUrl (filename), parent)) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "could not open"; - #endif - return false; - } - - d->name = name; -#if DEBUG_KP_COLOR_COLLECTION - kDebug () << "opened"; -#endif - return true; -} - -static void CouldNotSaveDialog (const KUrl &url, QWidget *parent) -{ - // TODO: use file.errorString() - KMessageBox::error (parent, - i18n ("Could not save color palette as \"%1\".", - kpUrlFormatter::PrettyFilename (url))); -} - -static void SaveToFile (kpColorCollectionPrivate *d, QIODevice *device) -{ - // HITODO: QTextStream can fail but does not report errors. - // Bug in KColorCollection too. - QTextStream str (device); - - QString description = d->desc.trimmed(); - description = '#'+description.split( "\n", QString::KeepEmptyParts).join("\n#"); - - str << "KDE RGB Palette\n"; - str << description << "\n"; - foreach (const ColorNode &node, d->colorList) - { - // Added for KolourPaint. - if(!node.color.isValid ()) - continue; - - int r,g,b; - node.color.getRgb(&r, &g, &b); - str << r << " " << g << " " << b << " " << node.name << "\n"; - } - - str.flush(); -} - -bool -kpColorCollection::saveAs(const KUrl &url, bool showOverwritePrompt, - QWidget *parent) const -{ - if (showOverwritePrompt && - KIO::NetAccess::exists (url, KIO::NetAccess::DestinationSide/*write*/, parent)) - { - int result = KMessageBox::warningContinueCancel (parent, - i18n ("A color palette called \"%1\" already exists.\n" - "Do you want to overwrite it?", - kpUrlFormatter::PrettyFilename (url)), - QString (), - KGuiItem (i18n ("Overwrite"))); - if (result != KMessageBox::Continue) - return false; - } - - if (url.isLocalFile ()) - { - const QString filename = url.toLocalFile (); - - // sync: All failure exit paths _must_ call KSaveFile::abort() or - // else, the KSaveFile destructor will overwrite the file, - // , despite the failure. - KSaveFile atomicFileWriter (filename); - { - if (!atomicFileWriter.open ()) - { - // We probably don't need this as has not been - // opened. - atomicFileWriter.abort (); - - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\treturning false because could not open KSaveFile" - << " error=" << atomicFileWriter.error () << endl; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Write to local temporary file. - ::SaveToFile (d, &atomicFileWriter); - - // Atomically overwrite local file with the temporary file - // we saved to. - if (!atomicFileWriter.finalize ()) - { - atomicFileWriter.abort (); - - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\tcould not close KSaveFile"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - } // sync KSaveFile.abort() - } - // Remote file? - else - { - // Create temporary file that is deleted when the variable goes - // out of scope. - KTemporaryFile tempFile; - if (!tempFile.open ()) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\treturning false because could not open tempFile"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Write to local temporary file. - ::SaveToFile (d, &tempFile); - - // Collect name of temporary file now, as QTemporaryFile::fileName() - // stops working after close() is called. - const QString tempFileName = tempFile.fileName (); - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\ttempFileName='" << tempFileName << "'"; - #endif - Q_ASSERT (!tempFileName.isEmpty ()); - - tempFile.close (); - if (tempFile.error () != QFile::NoError) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\treturning false because could not close"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - - // Copy local temporary file to overwrite remote. - // TODO: No one seems to know how to do this atomically - // [http://lists.kde.org/?l=kde-core-devel&m=117845162728484&w=2]. - // At least, fish:// (ssh) is definitely not atomic. - if (!KIO::NetAccess::upload (tempFileName, url, parent)) - { - #if DEBUG_KP_COLOR_COLLECTION - kDebug () << "\treturning false because could not upload"; - #endif - ::CouldNotSaveDialog (url, parent); - return false; - } - } - - d->name.clear (); - return true; -} - -bool -kpColorCollection::saveKDE(QWidget *parent) const -{ - const QString name = d->name; - QString filename = KStandardDirs::locateLocal("config", "colors/" + name); - const bool ret = saveAs (KUrl (filename), false/*no overwite prompt*/, parent); - // (d->name is wiped by saveAs()). - d->name = name; - return ret; -} - -QString kpColorCollection::description() const -{ - return d->desc; -} - -void kpColorCollection::setDescription(const QString &desc) -{ - d->desc = desc; -} - -QString kpColorCollection::name() const -{ - return d->name; -} - -void kpColorCollection::setName(const QString &name) -{ - d->name = name; -} - -kpColorCollection::Editable kpColorCollection::editable() const -{ - return d->editable; -} - -void kpColorCollection::setEditable(Editable editable) -{ - d->editable = editable; -} - -int kpColorCollection::count() const -{ - return (int) d->colorList.count(); -} - -void kpColorCollection::resize(int newCount) -{ - if (newCount == count()) - return; - else if (newCount < count()) - { - d->colorList.erase(d->colorList.begin() + newCount, d->colorList.end()); - } - else if (newCount > count()) - { - while(newCount > count()) - { - const int ret = addColor(QColor(), QString()/*color name*/); - Q_ASSERT(ret == count() - 1); - } - } -} - -kpColorCollection& -kpColorCollection::operator=( const kpColorCollection &p) -{ - if (&p == this) return *this; - d->colorList = p.d->colorList; - d->name = p.d->name; - d->desc = p.d->desc; - d->editable = p.d->editable; - return *this; -} - -QColor -kpColorCollection::color(int index) const -{ - if ((index < 0) || (index >= count())) - return QColor(); - - return d->colorList[index].color; -} - -int -kpColorCollection::findColor(const QColor &color) const -{ - for (int i = 0; i < d->colorList.size(); ++i) - { - if (d->colorList[i].color == color) - return i; - } - return -1; -} - -QString -kpColorCollection::name(int index) const -{ - if ((index < 0) || (index >= count())) - return QString(); - - return d->colorList[index].name; -} - -QString kpColorCollection::name(const QColor &color) const -{ - return name(findColor(color)); -} - -int -kpColorCollection::addColor(const QColor &newColor, const QString &newColorName) -{ - d->colorList.append(ColorNode(newColor, newColorName)); - return count() - 1; -} - -int -kpColorCollection::changeColor(int index, - const QColor &newColor, - const QString &newColorName) -{ - if ((index < 0) || (index >= count())) - return -1; - - ColorNode& node = d->colorList[index]; - node.color = newColor; - node.name = newColorName; - - return index; -} - -int kpColorCollection::changeColor(const QColor &oldColor, - const QColor &newColor, - const QString &newColorName) -{ - return changeColor( findColor(oldColor), newColor, newColorName); -} - diff --git a/kolourpaint/lgpl/generic/kpColorCollection.h b/kolourpaint/lgpl/generic/kpColorCollection.h deleted file mode 100644 index b904caf7..00000000 --- a/kolourpaint/lgpl/generic/kpColorCollection.h +++ /dev/null @@ -1,264 +0,0 @@ - -// SYNC: Periodically merge in changes from: -// -// trunk/KDE/kdelibs/kdeui/colors/kcolorcollection.{h,cpp} -// -// which this is a fork of. -// -// Our changes can be merged back into KDE (grep for "Added for KolourPaint" and similar). - -/* This file is part of the KDE libraries - Copyright (C) 1999 Waldo Bastian (bastian@kde.org) - Copyright (C) 2007 Clarence Dang (dang@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version - 2 of the License. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -//----------------------------------------------------------------------------- -// KDE color collection. - -#ifndef kpColorCollection_H -#define kpColorCollection_H - -#include - -#include -#include -#include -#include - - -class KUrl; - -/** - * Class for handling color collections ("palettes"). - * - * This class makes it easy to handle color collections, sometimes referred to - * as "palettes". This class can read and write collections from and to a file. - * - * Collections that are managed by KDE have a non-empty name(). Collections - * stored in regular files have an empty name(). - * - * This class uses the "GIMP" palette file format. - * - * @author Waldo Bastian (bastian@kde.org), Clarence Dang (dang@kde.org) - **/ -class KOLOURPAINT_LGPL_EXPORT kpColorCollection -{ -public: - /** - * Query which KDE color collections are installed. - * - * @return A list with installed color collection names. - */ - static QStringList installedCollections(); - - /** - * kpColorCollection constructor - * - * argument removed for KolourPaint. - * Use openKDE() instead, which also has error handling. - **/ - explicit kpColorCollection(); - - /** - * kpColorCollection copy constructor. - **/ - kpColorCollection(const kpColorCollection &); - - /** - * kpColorCollection destructor. - **/ - ~kpColorCollection(); - - /** - * kpColorCollection assignment operator - **/ - kpColorCollection& operator=( const kpColorCollection &); - - // On failure, this prints an error dialog and returns false. - // On success, it sets the name() to an empty string and returns true. - // - // Added for KolourPaint. - bool open(const KUrl &url, QWidget *parent); - - // Same as open() but is given the name of a KDE palette, not a filename. - // - // @param name The name of collection as returned by installedCollections(). - // name() is set to this. - // - // Added for KolourPaint. - bool openKDE(const QString &name, QWidget *parent); - - // On failure, this prints an error dialog and returns false. - // If the user cancels any presented overwrite dialog, it also returns false. - // On success, it returns true. - // - // The file can be overwritten without displaying any warning dialog, if - // is set to false. - // - // name() is set to an empty string. - // - // Added for KolourPaint. - bool saveAs(const KUrl &url, bool showOverwritePrompt, QWidget *parent) const; - - /** - * Save the collection to the KDE-local store - * (usually $HOME/.kde/share/config/colors) using name(). - * - * @return 'true' if successful - * - * Renamed from save() for KolourPaint. - **/ - bool saveKDE(QWidget *parent) const; - - /** - * Get the description of the collection. - * @return the description of the collection. - **/ - QString description() const; - - /** - * Set the description of the collection. - * @param desc the new description - **/ - void setDescription(const QString &desc); - - /** - * Get the name of the collection. - * @return the name of the collection - **/ - QString name() const; - - /** - * Set the name of the collection. - * @param name the name of the collection - **/ - void setName(const QString &name); - - /** - * Used to specify whether a collection may be edited. - * @see editable() - * @see setEditable() - */ - enum Editable { Yes, ///< Collection may be edited - No, ///< Collection may not be edited - Ask ///< Ask user before editing - }; - - /** - * Returns whether the collection may be edited. - * @return the state of the collection - **/ - Editable editable() const; - - /** - * Change whether the collection may be edited. - * @param editable the state of the collection - **/ - void setEditable(Editable editable); - - /** - * Return the number of colors in the collection. - * @return the number of colors - **/ - int count() const; - - /** - * Adds invalid colors or removes colors so that there will be @p newCount - * colors in the color collection. - * - * @param target number of colors - * - * Added for KolourPaint. - */ - void resize(int newCount); - - /** - * Find color by index. - * @param index the index of the desired color - * @return The @p index -th color of the collection, null if not found. - **/ - QColor color(int index) const; - - /** - * Find index by @p color. - * @param color the color to find - * @return The index of the color in the collection or -1 if the - * color is not found. - **/ - int findColor(const QColor &color) const; - - /** - * Find color name by @p index. - * @param index the index of the color - * @return The name of the @p index -th color. - * Note that not all collections have named the colors. Null is - * returned if the color does not exist or has no name. - **/ - QString name(int index) const; - - /** - * Find color name by @p color. - * @return The name of color according to this collection. - * Note that not all collections have named the colors. - * Note also that each collection can give the same color - * a different name. - **/ - QString name(const QColor &color) const; - - /** - * Add a color. - * @param newColor The color to add. - * @param newColorName The name of the color, null to remove - * the name. - * @return The index of the added color. - **/ - int addColor(const QColor &newColor, - const QString &newColorName = QString()); - - /** - * Change a color. - * @param index Index of the color to change - * @param newColor The new color. - * @param newColorName The new color name, null to remove - * the name. - * @return The index of the new color or -1 if the color couldn't - * be changed. - **/ - int changeColor(int index, - const QColor &newColor, - const QString &newColorName = QString()); - - /** - * Change a color. - * @param oldColor The original color - * @param newColor The new color. - * @param newColorName The new color name, null to remove - * the name. - * @return The index of the new color or -1 if the color couldn't - * be changed. - **/ - int changeColor(const QColor &oldColor, - const QColor &newColor, - const QString &newColorName = QString()); - -private: - class kpColorCollectionPrivate *d; -}; - - -#endif // kpColorCollection_H - diff --git a/kolourpaint/lgpl/generic/kpUrlFormatter.cpp b/kolourpaint/lgpl/generic/kpUrlFormatter.cpp deleted file mode 100644 index b898df39..00000000 --- a/kolourpaint/lgpl/generic/kpUrlFormatter.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -//--------------------------------------------------------------------- - -// public static -QString kpUrlFormatter::PrettyUrl (const KUrl &url) -{ - if (url.isEmpty ()) - return i18n ("Untitled"); - else - return url.pathOrUrl (); -} - -//--------------------------------------------------------------------- - -// public static -QString kpUrlFormatter::PrettyFilename (const KUrl &url) -{ - if (url.isEmpty ()) - return i18n ("Untitled"); - else if (url.fileName ().isEmpty ()) - return kpUrlFormatter::PrettyUrl (url); // better than the name "" - else - return url.fileName (); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/lgpl/generic/kpUrlFormatter.h b/kolourpaint/lgpl/generic/kpUrlFormatter.h deleted file mode 100644 index 93a5f9a5..00000000 --- a/kolourpaint/lgpl/generic/kpUrlFormatter.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -// -// This class is in the lpgl/ folder because other code in the folder needs -// to access it. But it is not under the LPGL. -// - - -#ifndef kpUrlFormatter_H -#define kpUrlFormatter_H - -#include - - -#include - -class KUrl; - - -class KOLOURPAINT_LGPL_EXPORT kpUrlFormatter -{ -public: - // (will convert: empty Url --> "Untitled") - static QString PrettyUrl (const KUrl &url); - - // (will convert: empty Url --> "Untitled") - static QString PrettyFilename (const KUrl &url); -}; - - -#endif // kpUrlFormatter_H diff --git a/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.cpp b/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.cpp deleted file mode 100644 index fb280784..00000000 --- a/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.cpp +++ /dev/null @@ -1,563 +0,0 @@ - -/* This file is part of the KDE libraries - Copyright (C) 1997 Martin Jones (mjones@kde.org) - Copyright (C) 2007 Roberto Raggi (roberto@kdevelop.org) - Copyright (C) 2007 Clarence Dang (dang@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -//----------------------------------------------------------------------------- - -#define DEBUG_KP_COLOR_CELLS_BASE 0 - -#include - -#include - - -#include -#include - -#include -#include - -#include -#include -#include - - -class kpColorCellsBase::kpColorCellsBasePrivate -{ -public: - kpColorCellsBasePrivate(kpColorCellsBase *q): q(q) - { - colors = 0; - inMouse = false; - selected = -1; - shade = false; - acceptDrags = false; - cellsResizable = true; - } - - kpColorCellsBase *q; - - // Note: This is a good thing and is _not_ data duplication with the - // colors of QTableWidget cells, for the following reasons: - // - // 1. QColor in Qt4 is full-quality RGB. However, QTableWidget - // cells are lossy as their colors may be dithered on the screen. - // - // Eventually, this field will be changed to a kpColor. - // - // 2. We change the QTableWidget cells' colors when the widget is - // disabled (see changeEvent()). - // - // Therefore, do not remove this field without better reasons. - QColor *colors; - - QPoint mousePos; - int selected; - bool shade; - bool acceptDrags; - bool cellsResizable; - bool inMouse; -}; - -kpColorCellsBase::kpColorCellsBase( QWidget *parent, int rows, int cols ) - : QTableWidget( parent ), d(new kpColorCellsBasePrivate(this)) -{ - setItemDelegate(new QItemDelegate(this)); - - setFrameShape(QFrame::NoFrame); - d->shade = true; - setRowCount( rows ); - setColumnCount( cols ); - - verticalHeader()->hide(); - horizontalHeader()->hide(); - - d->colors = new QColor [ rows * cols ]; - - d->selected = 0; - d->inMouse = false; - - // Drag'n'Drop - setAcceptDrops( true); - - setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - viewport()->setBackgroundRole( QPalette::Background ); - setBackgroundRole( QPalette::Background ); -} - -kpColorCellsBase::~kpColorCellsBase() -{ - delete [] d->colors; - - delete d; -} - -void kpColorCellsBase::invalidateAllColors () -{ - for (int r = 0; r < rowCount (); r++) - for (int c = 0; c < columnCount (); c++) - d->colors [r * columnCount () + c] = QColor (); -} - -void kpColorCellsBase::clear() -{ - invalidateAllColors (); - QTableWidget::clear (); -} - -void kpColorCellsBase::clearContents() -{ - invalidateAllColors (); - QTableWidget::clearContents (); -} - -void kpColorCellsBase::setRowColumnCounts (int rows, int columns) -{ - const int oldRows = rowCount (), oldCols = columnCount (); - const int newRows = rows, newCols = columns; -#if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "oldRows=" << oldRows << "oldCols=" << oldCols - << "newRows=" << newRows << "newCols=" << newCols; -#endif - - if (oldRows == newRows && oldCols == newCols) - return; - - QTableWidget::setColumnCount (newCols); - QTableWidget::setRowCount (newRows); - - QColor *oldColors = d->colors; - d->colors = new QColor [newRows * newCols]; - - for (int r = 0; r < qMin (oldRows, newRows); r++) - for (int c = 0; c < qMin (oldCols, newCols); c++) - d->colors [r * newCols + c] = oldColors [r * oldCols + c]; - - delete [] oldColors; -} - -void kpColorCellsBase::setColumnCount (int newColumns) -{ - setRowColumnCounts (rowCount (), newColumns); -} - -void kpColorCellsBase::setRowCount (int newRows) -{ - setRowColumnCounts (newRows, columnCount ()); -} - -QColor kpColorCellsBase::color(int index) const -{ - return d->colors[index]; -} - -int kpColorCellsBase::count() const -{ - return rowCount() * columnCount(); -} - -void kpColorCellsBase::setShading(bool _shade) -{ - d->shade = _shade; -} - -void kpColorCellsBase::setAcceptDrags(bool _acceptDrags) -{ - d->acceptDrags = _acceptDrags; -} - -void kpColorCellsBase::setCellsResizable(bool yes) -{ - d->cellsResizable = yes; -} - -void kpColorCellsBase::setSelected(int index) -{ - Q_ASSERT( index >= 0 && index < count() ); - - d->selected = index; -} - -int kpColorCellsBase::selectedIndex() const -{ - return d->selected; -} - -//--------------------------------------------------------------------- - -static void TableWidgetItemSetColor (QTableWidgetItem *tableItem, const QColor &color) -{ - Q_ASSERT (tableItem); - QImage image(16, 16, QImage::Format_ARGB32_Premultiplied); - QPainter painter(&image); - const int StippleSize = 4; - QColor useColor; - - for (int dy = 0; dy < 16; dy += StippleSize) - { - for (int dx = 0; dx < 16; dx += StippleSize) - { - const bool parity = ((dy + dx) / StippleSize) % 2; - - if (!parity) - useColor = Qt::white; - else - useColor = Qt::lightGray; - - painter.fillRect(dx, dy, StippleSize, StippleSize, useColor); - } - } - - painter.fillRect(image.rect(), color); - painter.end(); - - tableItem->setData(Qt::BackgroundRole , QBrush(image)); -} - -//--------------------------------------------------------------------- - -void kpColorCellsBase::setColor( int column, const QColor &colorIn ) -{ - const int tableRow = column / columnCount(); - const int tableColumn = column % columnCount(); - - Q_ASSERT( tableRow >= 0 && tableRow < rowCount() ); - Q_ASSERT( tableColumn >= 0 && tableColumn < columnCount() ); - - QColor color = colorIn; - - d->colors[column] = color; - - QTableWidgetItem* tableItem = item(tableRow,tableColumn); - - if (color.isValid ()) - { - if ( tableItem == 0 ) { - tableItem = new QTableWidgetItem(); - setItem(tableRow,tableColumn,tableItem); - } - - if (isEnabled ()) - ::TableWidgetItemSetColor (tableItem, color); - } - else - { - delete tableItem; - } - - emit colorChanged (column, color); -} - -void kpColorCellsBase::changeEvent( QEvent* event ) -{ - QTableWidget::changeEvent (event); - - if (event->type () != QEvent::EnabledChange) - return; - - for (int r = 0; r < rowCount (); r++) - { - for (int c = 0; c < columnCount (); c++) - { - const int index = r * columnCount () + c; - - QTableWidgetItem* tableItem = item(r, c); - - // See API Doc for this invariant. - Q_ASSERT (!!tableItem == d->colors [index].isValid ()); - - if (!tableItem) - continue; - - - QColor color; - if (isEnabled ()) - color = d->colors [index]; - else - color = palette ().color (backgroundRole ()); - - ::TableWidgetItemSetColor (tableItem, color); - } - } -} - -/*void kpColorCellsBase::paintCell( QPainter *painter, int row, int col ) -{ - painter->setRenderHint( QPainter::Antialiasing , true ); - - QBrush brush; - int w = 1; - - if (shade) - { - qDrawShadePanel( painter, 1, 1, cellWidth()-2, - cellHeight()-2, palette(), true, 1, &brush ); - w = 2; - } - QColor color = colors[ row * numCols() + col ]; - if (!color.isValid()) - { - if (!shade) return; - color = palette().color(backgroundRole()); - } - - const QRect colorRect( w, w, cellWidth()-w*2, cellHeight()-w*2 ); - painter->fillRect( colorRect, color ); - - if ( row * numCols() + col == selected ) { - painter->setPen( qGray(color.rgb())>=127 ? Qt::black : Qt::white ); - painter->drawLine( colorRect.topLeft(), colorRect.bottomRight() ); - painter->drawLine( colorRect.topRight(), colorRect.bottomLeft() ); - } -}*/ - -void kpColorCellsBase::resizeEvent( QResizeEvent* e ) -{ - if (d->cellsResizable) - { - // According to the Qt doc: - // If you need to set the width of a given column to a fixed value, call - // QHeaderView::resizeSection() on the table's {horizontal,vertical} - // header. - // Therefore we iterate over each row and column and set the header section - // size, as the sizeHint does indeed appear to be ignored in favor of a - // minimum size that is larger than what we want. - for ( int index = 0 ; index < columnCount() ; index++ ) - horizontalHeader()->resizeSection( index, sizeHintForColumn(index) ); - for ( int index = 0 ; index < rowCount() ; index++ ) - verticalHeader()->resizeSection( index, sizeHintForRow(index) ); - } - else - { - // Update scrollbars if they're forced on by a subclass. - // TODO: Should the d->cellsResizable path (from kdelibs) do this as well? - QTableWidget::resizeEvent (e); - } -} - -int kpColorCellsBase::sizeHintForColumn(int /*column*/) const -{ - // TODO: Should it be "(width() - frameWidth() * 2) / columnCount()"? - return width() / columnCount() ; -} - -int kpColorCellsBase::sizeHintForRow(int /*row*/) const -{ - // TODO: Should be "(height() - frameWidth() * 2) / rowCount()"? - return height() / rowCount() ; -} - -void kpColorCellsBase::mousePressEvent( QMouseEvent *e ) -{ - d->inMouse = true; - d->mousePos = e->pos(); -} - - -int kpColorCellsBase::positionToCell(const QPoint &pos, bool ignoreBorders, - bool allowEmptyCell) const -{ - //TODO ignoreBorders not yet handled - Q_UNUSED( ignoreBorders ) - - const int r = indexAt (pos).row (), c = indexAt (pos).column (); -#if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "r=" << r << "c=" << c; -#endif - - if (r == -1 || c == -1) - return -1; - - if (!allowEmptyCell && !itemAt(pos)) - return -1; - - const int cell = r * columnCount() + c; - - /*if (!ignoreBorders) - { - int border = 2; - int x = pos.x() - col * cellWidth(); - int y = pos.y() - row * cellHeight(); - if ( (x < border) || (x > cellWidth()-border) || - (y < border) || (y > cellHeight()-border)) - return -1; - }*/ - - return cell; -} - - -void kpColorCellsBase::mouseMoveEvent( QMouseEvent *e ) -{ - if( !(e->buttons() & Qt::LeftButton)) return; - - if(d->inMouse) { - int delay = KGlobalSettings::dndEventDelay(); - if(e->x() > d->mousePos.x()+delay || e->x() < d->mousePos.x()-delay || - e->y() > d->mousePos.y()+delay || e->y() < d->mousePos.y()-delay){ - // Drag color object - int cell = positionToCell(d->mousePos); - if (cell != -1) - { - #if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "beginning drag from cell=" << cell - << "color: isValid=" << d->colors [cell].isValid () - << " rgba=" << (int *) d->colors [cell].rgba(); - #endif - Q_ASSERT (d->colors[cell].isValid()); - KColorMimeData::createDrag(d->colors[cell], this)->start(Qt::CopyAction | Qt::MoveAction); - #if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "finished drag"; - #endif - } - } - } -} - - -// LOTODO: I'm not quite clear on how the drop actions logic is supposed -// to be done e.g.: -// -// 1. Who is supposed to call setDropAction(). -// 2. Which variant of accept(), setAccepted(), acceptProposedAction() etc. -// is supposed to be called to accept a move -- rather than copy -- -// action. -// -// Nevertheless, it appears to work -- probably because we restrict -// the non-Qt-default move/swap action to be intrawidget. -static void SetDropAction (QWidget *self, QDropEvent *event) -{ - // TODO: Would be nice to default to CopyAction if the destination cell - // is null. - if (event->source () == self && (event->keyboardModifiers () & Qt::ControlModifier) == 0) - event->setDropAction(Qt::MoveAction); - else - event->setDropAction(Qt::CopyAction); -} - -void kpColorCellsBase::dragEnterEvent( QDragEnterEvent *event) -{ -#if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "kpColorCellsBase::dragEnterEvent() acceptDrags=" - << d->acceptDrags - << " canDecode=" << KColorMimeData::canDecode(event->mimeData()) - << endl; -#endif - event->setAccepted( d->acceptDrags && KColorMimeData::canDecode( event->mimeData())); - if (event->isAccepted ()) - ::SetDropAction (this, event); -} - -// Reimplemented to override QTableWidget's override. Else dropping doesn't work. -void kpColorCellsBase::dragMoveEvent (QDragMoveEvent *event) -{ -#if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "kpColorCellsBase::dragMoveEvent() acceptDrags=" - << d->acceptDrags - << " canDecode=" << KColorMimeData::canDecode(event->mimeData()) - << endl; -#endif - // TODO: Disallow drag that isn't onto a cell. - event->setAccepted( d->acceptDrags && KColorMimeData::canDecode( event->mimeData())); - if (event->isAccepted ()) - ::SetDropAction (this, event); -} - -void kpColorCellsBase::dropEvent( QDropEvent *event) -{ - QColor c=KColorMimeData::fromMimeData(event->mimeData()); - - const int dragSourceCell = event->source () == this ? - positionToCell (d->mousePos, true) : - -1; -#if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "kpColorCellsBase::dropEvent()" - << "color: rgba=" << (const int *) c.rgba () << "isValid=" << c.isValid() - << "source=" << event->source () << "dragSourceCell=" << dragSourceCell; -#endif - if( c.isValid()) { - ::SetDropAction (this, event); - - int cell = positionToCell(event->pos(), true, true/*allow empty cell*/); - #if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "\tcell=" << cell; - #endif - // TODO: I believe kdelibs forgets to do this. - if (cell == -1) - return; - - // Avoid NOP. - if (cell == dragSourceCell) - return; - - QColor destOldColor = d->colors [cell]; - setColor(cell,c); - - #if DEBUG_KP_COLOR_CELLS_BASE - kDebug () << "\tdropAction=" << event->dropAction () - << "destOldColor.rgba=" << (const int *) destOldColor.rgba (); - #endif - if (event->dropAction () == Qt::MoveAction && dragSourceCell != -1) { - setColor(dragSourceCell, destOldColor); - } - } -} - -void kpColorCellsBase::mouseReleaseEvent( QMouseEvent *e ) -{ - int cell = positionToCell(d->mousePos); - int currentCell = positionToCell(e->pos()); - - // If we release the mouse in another cell and we don't have - // a drag we should ignore this event. - if (currentCell != cell) - cell = -1; - - if ( (cell != -1) && (d->selected != cell) ) - { - d->selected = cell; - - const int newRow = cell/columnCount(); - const int newColumn = cell%columnCount(); - - clearSelection(); // we do not want old violet selected cells - - item(newRow,newColumn)->setSelected(true); - } - - d->inMouse = false; - if (cell != -1) - { - emit colorSelected( cell , color(cell) ); - emit colorSelected( cell , color(cell), e->button() ); - } -} - -void kpColorCellsBase::mouseDoubleClickEvent( QMouseEvent * /*e*/ ) -{ - int cell = positionToCell(d->mousePos, false, true/*allow empty cell*/); - - if (cell != -1) - emit colorDoubleClicked( cell , color(cell) ); -} - - -#include "moc_kpColorCellsBase.cpp" diff --git a/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.h b/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.h deleted file mode 100644 index 3fa257dd..00000000 --- a/kolourpaint/lgpl/generic/widgets/kpColorCellsBase.h +++ /dev/null @@ -1,185 +0,0 @@ - -// SYNC: Periodically merge in changes from: -// -// trunk/KDE/kdelibs/kdeui/colors/kcolordialog.{h,cpp} -// -// which this is a fork of. -// -// Our changes can be merged back into KDE (grep for "Added for KolourPaint" and similar). - -/* This file is part of the KDE libraries - Copyright (C) 1997 Martin Jones (mjones@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -//---------------------------------------------------------------------- -// KDE color selection dialog. - -// layout management added Oct 1997 by Mario Weilguni -// - -#ifndef kpColorCellsBase_H -#define kpColorCellsBase_H - -#include - -#include - -/** -* A table of editable color cells. -* -* @author Martin Jones -* -* Added for KolourPaint: -* -* If you have not called setColor() for a cell, its widget will not exist. -* So it is possible to have "holes" in this rectangular table of cells. -* You can delete a cell widget by calling setColor() with an invalid QColor. -* -* An invariant is that color() returns an invalid color iff the cells' widget -* does not exist. Note that: -* -* 1. You can double click on cells that don't contain a widget -* 2. You can drop onto -- but not drag from -- a cell that doesn't contain a -* widget -* -* If a color is dragged and dropped to-and-from the same instance of this -* widget, then the colors in the source and destination cells are swapped -* (this is a "move action"). -* -* If CTRL is held or they are not from the same instance, then the source -* cell's color is copied into the destination cell, without any change to -* the source cell (this is a "copy action"). -*/ -class KOLOURPAINT_LGPL_EXPORT kpColorCellsBase : public QTableWidget -{ - Q_OBJECT -public: - /** - * Constructs a new table of color cells, consisting of - * @p rows * @p columns colors. - * - * @param parent The parent of the new widget - * @param rows The number of rows in the table - * @param columns The number of columns in the table - * - * Specifying and was made optional for KolourPaint. - */ - kpColorCellsBase( QWidget *parent, int rows = 0, int columns = 0 ); - ~kpColorCellsBase(); - -private: - /** Added for KolourPaint. */ - void invalidateAllColors (); - -public: - /** Added for KolourPaint. - WARNING: These are not virtual in QTableWidget. - */ - void clear (); - void clearContents (); - - /** Added for KolourPaint. */ - void setRowColumnCounts (int rows, int columns); - - /** Added for KolourPaint. - WARNING: These are not virtual in QTableWidget. - */ - void setColumnCount (int columns); - void setRowCount (int rows); - - /** Sets the color in the given index in the table. - - The following behavior change was added for KolourPaint: - - If is not valid, the cell widget at is deleted. - */ - void setColor( int index, const QColor &col ); - /** Returns the color at a given index in the table. - If a cell widget does not exist at , the invalid color is - returned. - */ - QColor color( int index ) const; - /** Returns the total number of color cells in the table */ - int count() const; - - void setShading(bool shade); - void setAcceptDrags(bool acceptDrags); - - /** Whether component cells should resize with the entire widget. - Default is true. - - Added for KolourPaint. - */ - void setCellsResizable(bool yes); - - /** Sets the currently selected cell to @p index */ - void setSelected(int index); - /** Returns the index of the cell which is currently selected */ - int selectedIndex() const; - -Q_SIGNALS: - /** Emitted when a color is selected in the table */ - void colorSelected( int index , const QColor& color ); - /** Emitted with the above. - - Added for KolourPaint. - */ - void colorSelected( int index , const QColor& color, Qt::MouseButton button ); - - /** Emitted when a color in the table is double-clicked */ - void colorDoubleClicked( int index , const QColor& color ); - - /** Emitted when setColor() is called. - This includes when a color is dropped onto the table, via drag-and-drop. - - Added for KolourPaint. - */ - void colorChanged( int index , const QColor& color ); - -protected: - /** Grays out the cells, when the object is disabled. - Added for KolourPaint. - */ - virtual void changeEvent( QEvent* event ); - - // the three methods below are used to ensure equal column widths and row heights - // for all cells and to update the widths/heights when the widget is resized - virtual int sizeHintForColumn(int column) const; - virtual int sizeHintForRow(int column) const; - virtual void resizeEvent( QResizeEvent* event ); - - virtual void mouseReleaseEvent( QMouseEvent * ); - virtual void mousePressEvent( QMouseEvent * ); - virtual void mouseMoveEvent( QMouseEvent * ); - virtual void dragEnterEvent( QDragEnterEvent * ); - virtual void dragMoveEvent( QDragMoveEvent * ); - virtual void dropEvent( QDropEvent *); - virtual void mouseDoubleClickEvent( QMouseEvent * ); - - /** was added for KolourPaint. */ - int positionToCell(const QPoint &pos, bool ignoreBorders=false, - bool allowEmptyCell=false) const; - -private: - class kpColorCellsBasePrivate; - friend class kpColorCellsBasePrivate; - kpColorCellsBasePrivate *const d; - - Q_DISABLE_COPY(kpColorCellsBase) -}; - -#endif // kpColorCellsBase_H diff --git a/kolourpaint/lgpl/kolourpaint_lgpl_export.h b/kolourpaint/lgpl/kolourpaint_lgpl_export.h deleted file mode 100644 index fdfb8bca..00000000 --- a/kolourpaint/lgpl/kolourpaint_lgpl_export.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KOLOURPAINT_LGPL_EXPORT_H -#define KOLOURPAINT_LGPL_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include - -#ifndef KOLOURPAINT_LGPL_EXPORT -# if defined(MAKE_KOLOURPAINT4_LGPL_LIB) - /* We are building this library */ -# define KOLOURPAINT_LGPL_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define KOLOURPAINT_LGPL_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef KOLOURPAINT_LGPL_EXPORT_DEPRECATED -# define KOLOURPAINT_LGPL_EXPORT_DEPRECATED KDE_DEPRECATED KOLOURPAINT_LGPL_EXPORT -# endif - -#endif diff --git a/kolourpaint/mainWindow/kpMainWindow.cpp b/kolourpaint/mainWindow/kpMainWindow.cpp deleted file mode 100644 index 37986a80..00000000 --- a/kolourpaint/mainWindow/kpMainWindow.cpp +++ /dev/null @@ -1,974 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if DEBUG_KP_MAIN_WINDOW - #include -#endif - - -//--------------------------------------------------------------------- - -kpMainWindow::kpMainWindow () - : KXmlGuiWindow (0/*parent*/) -{ - init (); - open (KUrl (), true/*create an empty doc*/); - - d->isFullyConstructed = true; -} - -//--------------------------------------------------------------------- - -kpMainWindow::kpMainWindow (const KUrl &url) - : KXmlGuiWindow (0/*parent*/) -{ - init (); - open (url, true/*create an empty doc with the same url if url !exist*/); - - d->isFullyConstructed = true; -} - -//--------------------------------------------------------------------- - -kpMainWindow::kpMainWindow (kpDocument *newDoc) - : KXmlGuiWindow (0/*parent*/) -{ - init (); - setDocument (newDoc); - - d->isFullyConstructed = true; -} - -//--------------------------------------------------------------------- - - -// TODO: Move into appropriate kpMainWindow_*.cpp or another class - -// private -void kpMainWindow::readGeneralSettings () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tkpMainWindow(" << objectName () << ")::readGeneralSettings()"; -#endif - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - d->configFirstTime = cfg.readEntry (kpSettingFirstTime, true); - d->configShowGrid = cfg.readEntry (kpSettingShowGrid, false); - d->configShowPath = cfg.readEntry (kpSettingShowPath, false); - d->moreEffectsDialogLastEffect = cfg.readEntry (kpSettingMoreEffectsLastEffect, 0); - - if (cfg.hasKey (kpSettingOpenImagesInSameWindow)) - { - d->configOpenImagesInSameWindow = cfg.readEntry (kpSettingOpenImagesInSameWindow, false); - } - else - { - d->configOpenImagesInSameWindow = false; -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tconfigOpenImagesInSameWindow: first time" - << " - writing default: " << d->configOpenImagesInSameWindow - << endl; -#endif - // TODO: More hidden options have to write themselves out on startup, - // not on use, to be discoverable (e.g. printing centered on page). - cfg.writeEntry (kpSettingOpenImagesInSameWindow, - d->configOpenImagesInSameWindow); - cfg.sync (); - } - - d->configPrintImageCenteredOnPage = cfg.readEntry (kpSettingPrintImageCenteredOnPage, true); - - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tGeneral Settings: firstTime=" << d->configFirstTime - << " showGrid=" << d->configShowGrid - << " showPath=" << d->configShowPath - << " moreEffectsDialogLastEffect=" << d->moreEffectsDialogLastEffect - << " openImagesInSameWindow=" << d->configOpenImagesInSameWindow - << " printImageCenteredOnPage=" << d->configPrintImageCenteredOnPage; -#endif -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::readThumbnailSettings () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tkpMainWindow(" << objectName () << ")::readThumbnailSettings()"; -#endif - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupThumbnail); - - d->configThumbnailShown = cfg.readEntry (kpSettingThumbnailShown, false); - d->configThumbnailGeometry = cfg.readEntry (kpSettingThumbnailGeometry, QRect ()); - d->configZoomedThumbnail = cfg.readEntry (kpSettingThumbnailZoomed, true); - d->configThumbnailShowRectangle = cfg.readEntry (kpSettingThumbnailShowRectangle, true); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tThumbnail Settings: shown=" << d->configThumbnailShown - << " geometry=" << d->configThumbnailGeometry - << " zoomed=" << d->configZoomedThumbnail - << " showRectangle=" << d->configThumbnailShowRectangle - << endl; -#endif -} - -//--------------------------------------------------------------------- - -void kpMainWindow::finalizeGUI(KXMLGUIClient *client) -{ - if ( client == this ) - { - const QList menuToHide = findChildren("toolToolBarHiddenMenu"); - // should only contain one but... - foreach (KMenu *menu, menuToHide) - { - menu->menuAction()->setVisible(false); - } - } -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::init () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow(" << objectName () << ")::init()"; - QTime totalTime; totalTime.start (); -#endif - - d = new kpMainWindowPrivate; - - // - // set mainwindow properties - // - - setMinimumSize (320, 260); - setAcceptDrops (true); - - // - // read config - // - - // KConfig::readEntry() does not actually reread from disk, hence doesn't - // realize what other processes have done e.g. Settings / Show Path - KGlobal::config ()->reparseConfiguration (); - - readGeneralSettings (); - readThumbnailSettings (); - - // - // create GUI - // - setupActions (); - createStatusBar (); - createGUI (); - - createColorBox (); - createToolBox (); - - - // Let the Tool Box take all the vertical space, since it can be quite - // tall with all its tool option widgets. This also avoids occasional - // bugs like the Tool Box overlapping the Color Tool Bar. - setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); - setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - - // no tabbed docks; does not make sense with only 2 dock widgets - setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks); - - addDockWidget(Qt::BottomDockWidgetArea, d->colorToolBar, Qt::Horizontal); - - d->scrollView = new kpViewScrollableContainer (this); - d->scrollView->setObjectName ( QLatin1String("scrollView" )); - connect (d->scrollView, SIGNAL (beganDocResize ()), - this, SLOT (slotBeganDocResize ())); - connect (d->scrollView, SIGNAL (continuedDocResize (const QSize &)), - this, SLOT (slotContinuedDocResize (const QSize &))); - connect (d->scrollView, SIGNAL (cancelledDocResize ()), - this, SLOT (slotCancelledDocResize ())); - connect (d->scrollView, SIGNAL (endedDocResize (const QSize &)), - this, SLOT (slotEndedDocResize (const QSize &))); - - connect (d->scrollView, SIGNAL (statusMessageChanged (const QString &)), - this, SLOT (slotDocResizeMessageChanged (const QString &))); - - connect (d->scrollView, SIGNAL(contentsMoved()), - this, SLOT(slotScrollViewAfterScroll())); - - setCentralWidget (d->scrollView); - - // - // set initial pos/size of GUI - // - - setAutoSaveSettings (); - - // our non-XMLGUI tools-toolbar will get initially the toolButtonStyle as - // all other toolbars, but we want to show only icons for the tools by default - // (have to do this _after_ setAutoSaveSettings as that applies the default settings) - if (d->configFirstTime) - { - d->toolToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); - - KConfigGroup cfg(KGlobal::config(), kpSettingsGroupGeneral); - - cfg.writeEntry(kpSettingFirstTime, d->configFirstTime = false); - cfg.sync(); - } - - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tall done in " << totalTime.elapsed () << "msec"; -#endif -} - -//--------------------------------------------------------------------- - -// private virtual [base KMainWindow] -void kpMainWindow::readProperties (const KConfigGroup &configGroup) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow<" << this << ">::readProperties()"; -#endif - - // No document at all? - if (!configGroup.hasKey (kpSessionSettingDocumentUrl)) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tno url - no document"; - #endif - setDocument (0); - } - // Have a document. - else - { - const KUrl url = configGroup.readEntry (kpSessionSettingDocumentUrl, - QString ()); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\turl=" << url; - #endif - - const QSize notFromURLDocSize = - configGroup.readEntry (kpSessionSettingNotFromUrlDocumentSize, - QSize ()); - - // Is from URL? - if (notFromURLDocSize.isEmpty ()) - { - // If this fails, the empty document that kpMainWindow::kpMainWindow() - // created is left untouched. - openInternal (url, defaultDocSize (), - false/*show error message if url !exist*/); - } - // Not from URL? - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tnot from url; doc size=" << notFromURLDocSize; - #endif - // Either we have an empty URL or we have a "kolourpaint doesnotexist.png" - // URL. Regarding the latter case, if a file now actually exists at that - // URL, we do open it - ignoring notFromURLDocSize - to avoid putting - // the user in a situation where he might accidentally overwrite an - // existing file. - openInternal (url, notFromURLDocSize, - true/*create an empty doc with the same url if url !exist*/); - } - } - -} - -//--------------------------------------------------------------------- - -// private virtual [base KMainWindow] -// WARNING: KMainWindow API Doc says "No user interaction is allowed -// in this function!" -void kpMainWindow::saveProperties (KConfigGroup &configGroup) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow<" << this << ">::saveProperties()"; -#endif - - // No document at all? - if (!d->document) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tno url - no document"; - #endif - } - // Have a document. - else - { - // Save URL in all cases: - // - // a) d->document->isFromURL() - // b) !d->document->isFromURL() [save size in this case] - // i) No URL - // ii) URL (from "kolourpaint doesnotexist.png") - - const KUrl url = d->document->url (); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\turl=" << url; - #endif - configGroup.writeEntry (kpSessionSettingDocumentUrl, url.url ()); - - // Not from URL e.g. "kolourpaint doesnotexist.png"? - // - // Note that "kolourpaint doesexist.png" is considered to be from - // a URL even if it was deleted in the background (hence the - // "false" arg to isFromURL()). This is because the user expects - // it to be from a URL, so when we session restore, we pop up a - // "cannot find file" dialog, instead of silently creating a new, - // blank document. - if (!d->document->isFromURL (false/*don't bother checking exists*/)) - { - // If we don't have a URL either: - // - // a) it was not modified - so we can use either width() or - // constructorWidth() (they'll be equal). - // b) the changes were discarded so we use the initial width, - // constructorWidth(). - // - // Similarly for height() and constructorHeight(). - const QSize docSize (d->document->constructorWidth (), - d->document->constructorHeight ()); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tnot from url; doc size=" << docSize; - #endif - configGroup.writeEntry (kpSessionSettingNotFromUrlDocumentSize, docSize); - } - - - // Local session save i.e. queryClose() was not called beforehand - // (see QApplication::saveState())? - #if 0 - if (d->document->isModified ()) - { - // TODO: Implement by saving the current image to a persistent file. - // We do this instead of saving/mutating the backing image file - // as no one expects a file save on a session save without a - // "do you want to save" dialog first. - // - // I don't think any KDE application implements local session saving. - // - // --- The below code does not compile but shows you want to do --- - - // Create unique name for the document in this main window. - const KUrl tempURL = homeDir + - "kolourpaint session " + sessionID + - mainWindowPtrToString + ".png"; - // TODO: Use lossless PNG saving options. - kpDocumentSaveOptions pngSaveOptions; - - if (kpDocument::savePixmapToFile (d->document->pixmapWithSelection (), - tempURL, - pngSaveOptions, *d->document->metaInfo (), - false/*no overwrite prompt*/, - false/*no lossy prompt*/, - this)) - { - // readProperties() will still open kpSessionSettingDocumentUrl - // (as that's the expected URL) and will then add commands to: - // - // 1. Resize the document to the size of image at - // kpSessionSettingDocumentUnsavedContentsUrl, if the sizes - // differ. - // 2. Paste the kpSessionSettingDocumentUnsavedContentsUrl image - // (setting the main window's selection mode to opaque beforehand). - // - // It will then delete the file at - // kpSessionSettingDocumentUnsavedContentsUrl. - configGroup.writeEntry (kpSessionSettingDocumentUnsavedContentsUrl, - tempURL.url ()); - } - else - { - // Not much we can do - we aren't allowed to throw up a dialog. - } - } - #endif - } -} - -//--------------------------------------------------------------------- - - -kpMainWindow::~kpMainWindow () -{ - d->isFullyConstructed = false; - - // Get the kpTool to finish up. This makes sure that the kpTool destructor - // will not need to access any other class (that might be deleted before - // the destructor is called by the QObject child-deletion mechanism). - if (tool ()) - tool ()->endInternal (); - - // Delete document & views. - // Note: This will disconnects signals from the current kpTool, so kpTool - // must not be destructed yet. - setDocument (0); - - delete d->commandHistory; d->commandHistory = 0; - delete d->scrollView; d->scrollView = 0; - - delete d; d = 0; -} - -//--------------------------------------------------------------------- - - -// public -kpDocument *kpMainWindow::document () const -{ - return d->document; -} - -//--------------------------------------------------------------------- - -// public -kpDocumentEnvironment *kpMainWindow::documentEnvironment () -{ - if (!d->documentEnvironment) - d->documentEnvironment = new kpDocumentEnvironment (this); - - return d->documentEnvironment; -} - -//--------------------------------------------------------------------- - -// public -kpViewManager *kpMainWindow::viewManager () const -{ - return d->viewManager; -} - -//--------------------------------------------------------------------- - -// public -kpColorToolBar *kpMainWindow::colorToolBar () const -{ - return d->colorToolBar; -} - -//--------------------------------------------------------------------- - -// public -kpColorCells *kpMainWindow::colorCells () const -{ - return d->colorToolBar ? d->colorToolBar->colorCells () : 0; -} - -//--------------------------------------------------------------------- - -// public -kpToolToolBar *kpMainWindow::toolToolBar () const -{ - return d->toolToolBar; -} - -//--------------------------------------------------------------------- - -// public -kpCommandHistory *kpMainWindow::commandHistory () const -{ - return d->commandHistory; -} - -//--------------------------------------------------------------------- - -kpCommandEnvironment *kpMainWindow::commandEnvironment () -{ - if (!d->commandEnvironment) - d->commandEnvironment = new kpCommandEnvironment (this); - - return d->commandEnvironment; -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupActions () -{ - setupFileMenuActions (); - setupEditMenuActions (); - setupViewMenuActions (); - setupImageMenuActions (); - setupColorsMenuActions (); - setupSettingsMenuActions (); - - setupTextToolBarActions (); - setupToolActions (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableDocumentActions (bool enable) -{ - enableFileMenuDocumentActions (enable); - enableEditMenuDocumentActions (enable); - enableViewMenuDocumentActions (enable); - enableImageMenuDocumentActions (enable); - enableColorsMenuDocumentActions (enable); - enableSettingsMenuDocumentActions (enable); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setDocument (kpDocument *newDoc) -{ - //kDebug () << newDoc; - - // is it a close operation? - if (!newDoc) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdisabling actions"; - #endif - - // sync with the bit marked "sync" below - - // TODO: Never disable the Color Box because the user should be - // able to manipulate the colors, even without a currently - // open document. - // - // We just have to make sure that signals from the Color - // Box aren't fired and received unexpectedly when there's - // no document. - Q_ASSERT (d->colorToolBar); - d->colorToolBar->setEnabled (false); - - enableTextToolBarActions (false); - } - - // Always disable the tools. - // If we decide to open a new document/mainView we want - // kpTool::begin() to be called again e.g. in case it sets the cursor. - // kpViewManager won't do this because we nuke it to avoid stale state. - enableToolsDocumentActions (false); - - if (!newDoc) - { - enableDocumentActions (false); - } - - delete d->mainView; d->mainView = 0; - slotDestroyThumbnail (); - - // viewManager will die and so will the selection - d->actionCopy->setEnabled (false); - d->actionCut->setEnabled (false); - d->actionDelete->setEnabled (false); - d->actionDeselect->setEnabled (false); - d->actionCopyToFile->setEnabled (false); - - delete d->viewManager; d->viewManager = 0; - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdestroying document"; - kDebug () << "\t\td->document=" << d->document; -#endif - // destroy current document - delete d->document; - d->document = newDoc; - - - if (!d->lastCopyToURL.isEmpty ()) - d->lastCopyToURL.setFileName (QString()); - d->copyToFirstTime = true; - - if (!d->lastExportURL.isEmpty ()) - d->lastExportURL.setFileName (QString()); - d->exportFirstTime = true; - - - // not a close operation? - if (d->document) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\treparenting doc that may have been created into a" - << " different mainWindiow" << endl; - #endif - d->document->setEnviron (documentEnvironment ()); - - d->viewManager = new kpViewManager (this); - - d->mainView = new kpZoomedView (d->document, d->toolToolBar, d->viewManager, - 0/*buddyView*/, - d->scrollView, - d->scrollView->viewport ()); - d->mainView->setObjectName ( QLatin1String("mainView" )); - - d->viewManager->registerView (d->mainView); - d->scrollView->setView (d->mainView); - d->mainView->show (); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\thooking up document signals"; - #endif - - // Copy/Cut/Deselect/Delete - connect (d->document, SIGNAL (selectionEnabled (bool)), - d->actionCut, SLOT (setEnabled (bool))); - connect (d->document, SIGNAL (selectionEnabled (bool)), - d->actionCopy, SLOT (setEnabled (bool))); - connect (d->document, SIGNAL (selectionEnabled (bool)), - d->actionDelete, SLOT (setEnabled (bool))); - connect (d->document, SIGNAL (selectionEnabled (bool)), - d->actionDeselect, SLOT (setEnabled (bool))); - connect (d->document, SIGNAL (selectionEnabled (bool)), - d->actionCopyToFile, SLOT (setEnabled (bool))); - - // this code won't actually enable any actions at this stage - // (fresh document) but better safe than sorry - d->actionCopy->setEnabled (d->document->selection ()); - d->actionCut->setEnabled (d->document->selection ()); - d->actionDeselect->setEnabled (d->document->selection ()); - d->actionDelete->setEnabled (d->document->selection ()); - d->actionCopyToFile->setEnabled (d->document->selection ()); - - connect (d->document, SIGNAL (selectionEnabled (bool)), - this, SLOT (slotImageMenuUpdateDueToSelection ())); - connect (d->document, SIGNAL (selectionIsTextChanged (bool)), - this, SLOT (slotImageMenuUpdateDueToSelection ())); - - // Status bar - connect (d->document, SIGNAL (documentOpened ()), - this, SLOT (recalculateStatusBar ())); - - connect (d->document, SIGNAL (sizeChanged (const QSize &)), - this, SLOT (setStatusBarDocSize (const QSize &))); - - // Caption (url, modified) - connect (d->document, SIGNAL (documentModified ()), - this, SLOT (slotUpdateCaption ())); - connect (d->document, SIGNAL (documentOpened ()), - this, SLOT (slotUpdateCaption ())); - connect (d->document, SIGNAL (documentSaved ()), - this, SLOT (slotUpdateCaption ())); - - // File/Reload action only available with non-empty URL - connect (d->document, SIGNAL (documentSaved ()), - this, SLOT (slotEnableReload ())); - - connect (d->document, SIGNAL (documentSaved ()), - this, SLOT (slotEnableSettingsShowPath ())); - - // Command history - Q_ASSERT (d->commandHistory); - connect (d->commandHistory, SIGNAL (documentRestored ()), - this, SLOT (slotDocumentRestored ())); // caption "!modified" - connect (d->document, SIGNAL (documentSaved ()), - d->commandHistory, SLOT (documentSaved ())); - - // Sync document -> views - connect (d->document, SIGNAL (contentsChanged (const QRect &)), - d->viewManager, SLOT (updateViews (const QRect &))); - connect (d->document, SIGNAL (sizeChanged (int, int)), - d->viewManager, SLOT (adjustViewsToEnvironment ())); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tenabling actions"; - #endif - - // sync with the bit marked "sync" above - - Q_ASSERT (d->colorToolBar); - d->colorToolBar->setEnabled (true); - - - // Hide the text toolbar - it will be shown by kpToolText::begin() - enableTextToolBarActions (false); - - enableToolsDocumentActions (true); - - enableDocumentActions (true); - - // TODO: The thumbnail auto zoom doesn't work because it thinks its - // width == 1 when !this->isShown(). So for consistency, - // never create the thumbnail. - #if 0 - if (d->configThumbnailShown) - { - if (isShown ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcreating thumbnail immediately"; - #endif - slotCreateThumbnail (); - } - // this' geometry is weird ATM - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcreating thumbnail LATER"; - #endif - QTimer::singleShot (0, this, SLOT (slotCreateThumbnail ())); - } - } - #endif - } - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tupdating mainWindow elements"; -#endif - - slotImageMenuUpdateDueToSelection (); - recalculateStatusBar (); - slotUpdateCaption (); // Untitled to start with - slotEnableReload (); - slotEnableSettingsShowPath (); - - if (d->commandHistory) - d->commandHistory->clear (); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdocument and views ready to go!"; -#endif -} - -//--------------------------------------------------------------------- - -// private virtual [base QWidget] -void kpMainWindow::dragEnterEvent (QDragEnterEvent *e) -{ - // It's faster to test for QMimeData::hasText() first due to the - // lazy evaluation of the '||' operator. - e->setAccepted (e->mimeData ()->hasText () || - KUrl::List::canDecode (e->mimeData ()) || - kpSelectionDrag::canDecode (e->mimeData ())); -} - -//--------------------------------------------------------------------- - -// private virtual [base QWidget] -void kpMainWindow::dropEvent (QDropEvent *e) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::dropEvent" << e->pos (); -#endif - - KUrl::List urls; - - kpAbstractImageSelection *sel = kpSelectionDrag::decode (e->mimeData ()); - if (sel) - { - // TODO: How do you actually drop a selection or ordinary images on - // the clipboard)? Will this code path _ever_ execute? - sel->setTransparency (imageSelectionTransparency ()); - // TODO: drop at point like with QTextDrag below? - paste (*sel); - delete sel; - } - else if (!(urls = KUrl::List::fromMimeData (e->mimeData ())).isEmpty ()) - { - // LOTODO: kpSetOverrideCursorSaver cursorSaver (Qt::waitCursor); - // - // However, you would need to prefix all possible error/warning - // dialogs that might be called, with Qt::arrowCursor e.g. in - // kpDocument and probably a lot more places. - foreach (const KUrl &u, urls) - open (u); - } - else if (e->mimeData ()->hasText ()) - { - const QString text = e->mimeData ()->text (); - - QPoint selTopLeft = KP_INVALID_POINT; - const QPoint globalPos = QWidget::mapToGlobal (e->pos ()); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tpos toGlobal=" << globalPos; - #endif - - kpView *view = 0; - - if (d->viewManager) - { - view = d->viewManager->viewUnderCursor (); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tviewUnderCursor=" << view; - #endif - if (!view) - { - // HACK: see kpViewManager::setViewUnderCursor() to see why - // it's not reliable - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tattempting to discover view"; - - if (d->mainView && d->scrollView) - { - kDebug () << "\t\t\tmainView->globalRect=" - << kpWidgetMapper::toGlobal (d->mainView, d->mainView->rect ()) - << " scrollView->globalRect=" - << kpWidgetMapper::toGlobal (d->scrollView, - QRect (0, 0, - d->scrollView->viewport()->width (), - d->scrollView->viewport()->height ())) - << endl; - } - #endif - if (d->thumbnailView && - kpWidgetMapper::toGlobal (d->thumbnailView, d->thumbnailView->rect ()) - .contains (globalPos)) - { - // TODO: Code will never get executed. - // Thumbnail doesn't accept drops. - view = d->thumbnailView; - } - else if (d->mainView && - kpWidgetMapper::toGlobal (d->mainView, d->mainView->rect ()) - .contains (globalPos) && - d->scrollView && - kpWidgetMapper::toGlobal (d->scrollView, - QRect (0, 0, - d->scrollView->viewport()->width (), - d->scrollView->viewport()->height ())) - .contains (globalPos)) - { - view = d->mainView; - } - } - } - - if (view) - { - const QPoint viewPos = view->mapFromGlobal (globalPos); - const QPoint docPoint = view->transformViewToDoc (viewPos); - - // viewUnderCursor() is hacky and can return a view when we aren't - // over one thanks to drags. - if (d->document && d->document->rect ().contains (docPoint)) - { - selTopLeft = docPoint; - - // TODO: In terms of doc pixels, would be inconsistent behaviour - // based on zoomLevel of view. - // selTopLeft -= QPoint (-view->selectionResizeHandleAtomicSize (), - // -view->selectionResizeHandleAtomicSize ()); - } - } - - pasteText (text, true/*force new text selection*/, selTopLeft); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotScrollViewAfterScroll () -{ - // OPT: Why can't this be moved into kpViewScrollableContainer::slotDragScroll(), - // grouping all drag-scroll-related repaints, which would potentially avoid - // double repainting? - if (tool ()) - { - tool ()->somethingBelowTheCursorChanged (); - } -} - -//--------------------------------------------------------------------- - -// private virtual [base QWidget] -void kpMainWindow::moveEvent (QMoveEvent * /*e*/) -{ - if (d->thumbnail) - { - // Disabled because it lags too far behind the mainWindow - // d->thumbnail->move (d->thumbnail->pos () + (e->pos () - e->oldPos ())); - - notifyThumbnailGeometryChanged (); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotUpdateCaption () -{ - if (d->document) - { - setCaption (d->configShowPath ? d->document->prettyUrl () - : d->document->prettyFilename (), - d->document->isModified ()); - } - else - { - setCaption (QString(), false); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotDocumentRestored () -{ - if (d->document) - d->document->setModified (false); - slotUpdateCaption (); -} - -//--------------------------------------------------------------------- - -#include "moc_kpMainWindow.cpp" diff --git a/kolourpaint/mainWindow/kpMainWindow.h b/kolourpaint/mainWindow/kpMainWindow.h deleted file mode 100644 index 40e622aa..00000000 --- a/kolourpaint/mainWindow/kpMainWindow.h +++ /dev/null @@ -1,698 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_MAIN_WINDOW_H -#define KP_MAIN_WINDOW_H - - -#include -#include - -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class KConfigGroup; -class KFontAction; -class KFontSizeAction; -class KSelectAction; -class KToggleAction; -class KToolBar; -#include -class KRecentFilesAction; -class KScanDialog; -class KToggleFullScreenAction; - -class kpColor; -class kpColorCells; -class kpColorToolBar; -class kpCommand; -class kpCommandEnvironment; -class kpCommandHistory; -class kpDocument; -class kpDocumentEnvironment; -class kpDocumentMetaInfo; -class kpDocumentSaveOptions; -class kpViewManager; -class kpViewScrollableContainer; -class kpImageSelectionTransparency; -class kpSqueezedTextLabel; -class kpTextStyle; -class kpThumbnail; -class kpThumbnailView; -class kpTool; -class kpToolEnvironment; -class kpToolSelectionEnvironment; -class kpToolText; -class kpToolToolBar; -class kpTransformDialogEnvironment; -class kpZoomedView; - - -class kpMainWindow : public KXmlGuiWindow -{ -Q_OBJECT - -public: - // Opens a new window with a blank document. - kpMainWindow (); - - // Opens a new window with the document specified by - // or creates a blank document if could not be opened. - kpMainWindow (const KUrl &url); - - // Opens a new window with the document - // ( can be 0 although this would result in a new - // window without a document at all). - kpMainWindow (kpDocument *newDoc); - - virtual void finalizeGUI(KXMLGUIClient *client); - -private: - void readGeneralSettings (); - void readThumbnailSettings (); - - void init (); - - // (only called for restoring a previous session e.g. starting KDE with - // a previously saved session; it's not called on normal KolourPaint - // startup) - virtual void readProperties (const KConfigGroup &configGroup); - // (only called for saving the current session e.g. logging out of KDE - // with the KolourPaint window open; it's not called on normal KolourPaint - // exit) - virtual void saveProperties (KConfigGroup &configGroup); - -public: - ~kpMainWindow (); - -public: - kpDocument *document () const; - kpDocumentEnvironment *documentEnvironment (); - kpViewManager *viewManager () const; - kpColorToolBar *colorToolBar () const; - kpColorCells *colorCells () const; - kpToolToolBar *toolToolBar () const; - kpCommandHistory *commandHistory () const; - kpCommandEnvironment *commandEnvironment (); - -private: - void setupActions (); - void enableDocumentActions (bool enable = true); - - void setDocument (kpDocument *newDoc); - - virtual void dragEnterEvent (QDragEnterEvent *e); - virtual void dropEvent (QDropEvent *e); - virtual void moveEvent (QMoveEvent *e); - -private slots: - void slotScrollViewAfterScroll (); - void slotUpdateCaption (); - void slotDocumentRestored (); - - -// -// Tools -// - -private: - kpToolSelectionEnvironment *toolSelectionEnvironment (); - kpToolEnvironment *toolEnvironment (); - - void setupToolActions (); - void createToolBox (); - void enableToolsDocumentActions (bool enable = true); - -private slots: - void updateToolOptionPrevNextActionsEnabled (); - void updateActionDrawOpaqueChecked (); -private: - void updateActionDrawOpaqueEnabled (); - -public: - QActionGroup *toolsActionGroup (); - - kpTool *tool () const; - - bool toolHasBegunShape () const; - bool toolIsASelectionTool (bool includingTextTool = true) const; - bool toolIsTextTool () const; - -private: - // Ends the current shape. If there is no shape currently being drawn, - // it does nothing. - // - // In general, call this at the start of every kpMainWindow slot, - // directly invoked by the _user_ (by activating an action or via another - // way), so that: - // - // 1. The document contains the pixels of that shape: - // - // Most tools have the shape, currently being drawn, layered above the - // document as a kpTempImage. In other words, the document does not - // yet contain the pixels of that shape. By ending the shape, the layer - // is pushed down onto the document so that it now contains those - // pixels. Your slot can now safely read the document as it's now - // consistent with what's on the screen. - // - // For example, consider the case where a line is being dragged out and - // CTRL+I is pressed to invert the image, while the mouse is still held - // down. The CTRL+I invert code (kpMainWindow::slotInvertColors()) must - // push the line kpTempImage onto the document before the invert can - // meaningfully proceed (else the invert will see the state of the document - // before the line was dragged out). - // - // Note that selection layers are not pushed down by this method. - // This is a feature, not a bug. The user would be annoyed if e.g. - // slotSave() happened to push down the selection. Use - // kpDocument::imageWithSelection() to get around this problem. You - // should still call toolEndShape() even if a selection is active - // -- this ends selection "shapes", which are actually things like - // selection moves or smearing operations, rather than the selections - // themselves. - // - // AND/OR: - // - // 2. The current tool is no longer in a drawing state: - // - // If your slot is going to bring up a new main window or modal dialog - // or at least some widget that acquires mouse or keyboard focus, this - // could confuse the tool if the tool is in the middle of a drawing - // operation. - // - // Do not call this in slots not invoked by the user. For instance, - // calling this method in response to an internal timer tick would be - // wrong. The user's drawing operation would unexpectedly finish and - // this would bewilder and irritate the user. - // - // TODO: Help / KolourPaint Handbook does not call this. I'm sure there - // are a few other actions that don't call this but should. - void toolEndShape (); - -public: - kpImageSelectionTransparency imageSelectionTransparency () const; - // The drawing background color is set to .transparentColor() - // if the is in Transparent mode or if - // is true (not the default). [x] - // - // If is in Opaque mode and is false, - // the background color is not changed because: - // - // 1. It is ignored by the selection in Opaque mode anyway. - // 2. This avoids irritating the user with an unnecessary background - // color change. - // - // The only case where you should set to true is in - // kpToolImageSelectionTransparencyCommand to ensure that the state - // is identical to when the command was constructed. - // Later: I don't think setting it to true is ever necessary since: - // - // 1. The background color only counts in Transparent mode. - // - // 2. Any kpToolImageSelectionTransparencyCommand that switches to - // Transparent mode will automatically set the background - // color due to the first part of [x] anyway. - // - // The other fields of are copied into the main window - // as expected. - void setImageSelectionTransparency (const kpImageSelectionTransparency &transparency, - bool forceColorChange = false); - int settingImageSelectionTransparency () const; - -private slots: - void slotToolSelected (kpTool *tool); - -private: - void readLastTool (); - int toolNumber () const; - void saveLastTool (); - -private: - bool maybeDragScrollingMainView () const; -private slots: - bool slotDragScroll (const QPoint &docPoint, - const QPoint &docLastPoint, - int zoomLevel, - bool *didSomething); - bool slotEndDragScroll (); - -private slots: - void slotBeganDocResize (); - void slotContinuedDocResize (const QSize &size); - void slotCancelledDocResize (); - void slotEndedDocResize (const QSize &size); - - void slotDocResizeMessageChanged (const QString &string); - -private slots: - void slotActionPrevToolOptionGroup1 (); - void slotActionNextToolOptionGroup1 (); - void slotActionPrevToolOptionGroup2 (); - void slotActionNextToolOptionGroup2 (); - - void slotActionDrawOpaqueToggled (); - void slotActionDrawColorSimilarity (); - -public slots: - void slotToolRectSelection(); - void slotToolEllipticalSelection(); - void slotToolFreeFormSelection(); - void slotToolText(); - -// -// File Menu -// - -private: - void setupFileMenuActions (); - void enableFileMenuDocumentActions (bool enable = true); - - void addRecentURL (const KUrl &url); - -private slots: - void slotNew (); - -private: - QSize defaultDocSize () const; - void saveDefaultDocSize (const QSize &size); - -private: - bool shouldOpen (); - void setDocumentChoosingWindow (kpDocument *doc); - -private: - kpDocument *openInternal (const KUrl &url, - const QSize &fallbackDocSize, - bool newDocSameNameIfNotExist); - // Same as above except that it: - // - // 1. Assumes a default fallback document size. - // 2. If the URL is successfully opened (with the special exception of - // the "kolourpaint doesnotexist.png" case), it is bubbled up to the - // top in the Recent Files Action. - // - // As a result of this behavior, this should only be called in response - // to a user open request e.g. File / Open or "kolourpaint doesexist.png". - // It should not be used for session restore - in that case, it does not - // make sense to bubble the Recent Files list. - bool open (const KUrl &url, bool newDocSameNameIfNotExist = false); - - KUrl::List askForOpenURLs(const QString &caption, - bool allowMultipleURLs = true); - -private slots: - void slotOpen (); - void slotOpenRecent (const KUrl &url); - - void slotScan (); - void slotScanned (const QImage &image, int); - - void slotScreenshot(); - void slotMakeScreenshot(); - - void slotProperties (); - - bool save (bool localOnly = false); - bool slotSave (); - -private: - KUrl askForSaveURL (const QString &caption, - const QString &startURL, - const kpImage &imageToBeSaved, - const kpDocumentSaveOptions &startSaveOptions, - const kpDocumentMetaInfo &docMetaInfo, - const QString &forcedSaveOptionsGroup, - bool localOnly, - kpDocumentSaveOptions *chosenSaveOptions, - bool isSavingForFirstTime, - bool *allowOverwritePrompt, - bool *allowLossyPrompt); - -private slots: - bool saveAs (bool localOnly = false); - bool slotSaveAs (); - - bool slotExport (); - - void slotEnableReload (); - bool slotReload (); - -private: - void sendDocumentNameToPrinter (QPrinter *printer); - void sendImageToPrinter (QPrinter *printer, bool showPrinterSetupDialog); - -private slots: - void slotPrint (); - void slotPrintPreview (); - - void slotMail (); - - bool queryCloseDocument (); - virtual bool queryClose (); - - void slotClose (); - void slotQuit (); - - -// -// Edit Menu -// - -private: - void setupEditMenuActions (); - void enableEditMenuDocumentActions (bool enable = true); - -public: - QMenu *selectionToolRMBMenu (); - -private slots: - void slotCut (); - void slotCopy (); - void slotEnablePaste (); -private: - QRect calcUsefulPasteRect (int imageWidth, int imageHeight); - // (it is possible to paste a selection border i.e. a selection with no content) - void paste (const kpAbstractSelection &sel, - bool forceTopLeft = false); -public: - // ( is ignored if is empty) - void pasteText (const QString &text, - bool forceNewTextSelection = false, - const QPoint &newTextSelectionTopLeft = KP_INVALID_POINT); - void pasteTextAt (const QString &text, const QPoint &point, - // Allow tiny adjustment of so that mouse - // pointer is not exactly on top of the topLeft of - // any new text selection (so that it doesn't look - // weird by being on top of a resize handle just after - // a paste). - bool allowNewTextSelectionPointShift = false); -public slots: - void slotPaste (); -private slots: - void slotPasteInNewWindow (); -public slots: - void slotDelete (); - - void slotSelectAll (); -private: - void addDeselectFirstCommand (kpCommand *cmd); -public slots: - void slotDeselect (); -private slots: - void slotCopyToFile (); - void slotPasteFromFile (); - - -// -// View Menu -// - -private: - void setupViewMenuActions (); - - bool viewMenuDocumentActionsEnabled () const; - void enableViewMenuDocumentActions (bool enable = true); - void actionShowGridUpdate (); - void updateMainViewGrid (); - QRect mapToGlobal (const QRect &rect) const; - QRect mapFromGlobal (const QRect &rect) const; - -private slots: - void slotShowGridToggled (); - - -// -// View Menu - Zoom -// - -private: - void setupViewMenuZoomActions (); - void enableViewMenuZoomDocumentActions (bool enable); - - void sendZoomListToActionZoom (); - - void zoomToPre (int zoomLevel); - void zoomToPost (); - -public: - void zoomTo (int zoomLevel, bool centerUnderCursor = false); - void zoomToRect (const QRect &normalizedDocRect, - bool accountForGrips, - bool careAboutWidth, bool careAboutHeight); - -public slots: - void slotActualSize (); - void slotFitToPage (); - void slotFitToWidth (); - void slotFitToHeight (); - -public: - void zoomIn (bool centerUnderCursor = false); - void zoomOut (bool centerUnderCursor = false); - -public slots: - void slotZoomIn (); - void slotZoomOut (); - -private: - void zoomAccordingToZoomAction (bool centerUnderCursor = false); - -private slots: - void slotZoom (); - - -// -// View Menu - Thumbnail -// - -private: - void setupViewMenuThumbnailActions (); - void enableViewMenuThumbnailDocumentActions (bool enable); - -private slots: - void slotDestroyThumbnail (); - void slotDestroyThumbnailInitatedByUser (); - void slotCreateThumbnail (); - -public: - void notifyThumbnailGeometryChanged (); - -private slots: - void slotSaveThumbnailGeometry (); - void slotShowThumbnailToggled (); - void updateThumbnailZoomed (); - void slotZoomedThumbnailToggled (); - void slotThumbnailShowRectangleToggled (); - -private: - void enableViewZoomedThumbnail (bool enable = true); - void enableViewShowThumbnailRectangle (bool enable = true); - void enableThumbnailOptionActions (bool enable = true); - void createThumbnailView (); - void destroyThumbnailView (); - void updateThumbnail (); - - -// -// Image Menu -// - -private: - kpTransformDialogEnvironment *transformDialogEnvironment (); - - bool isSelectionActive () const; - bool isTextSelection () const; - - QString autoCropText () const; - - void setupImageMenuActions (); - void enableImageMenuDocumentActions (bool enable = true); - -private slots: - void slotImageMenuUpdateDueToSelection (); - -public: - kpColor backgroundColor (bool ofSelection = false) const; - void addImageOrSelectionCommand (kpCommand *cmd, - bool addSelCreateCmdIfSelAvail = true, - bool addSelContentCmdIfSelAvail = true); - -private slots: - void slotResizeScale (); -public slots: - void slotCrop (); -private slots: - void slotAutoCrop (); - void slotFlip (); - void slotMirror (); - - void slotRotate (); - void slotRotate270 (); - void slotRotate90 (); - - void slotSkew (); - void slotConvertToBlackAndWhite (); - void slotConvertToGrayscale (); - void slotInvertColors (); - void slotClear (); - void slotMoreEffects (); - - -// -// Colors Menu -// - -private: - void setupColorsMenuActions (); - void createColorBox (); - void enableColorsMenuDocumentActions (bool enable); -private slots: - void slotUpdateColorsDeleteRowActionEnabled (); - -private: - void deselectActionColorsKDE (); - - bool queryCloseColors (); - -private: - void openDefaultColors (); -private slots: - void slotColorsDefault (); - -private: - bool openKDEColors (const QString &name); -private slots: - void slotColorsKDE (); - -private: - bool openColors (const KUrl &url); -private slots: - void slotColorsOpen (); - - void slotColorsReload (); - - bool slotColorsSave (); - bool slotColorsSaveAs (); - - void slotColorsAppendRow (); - void slotColorsDeleteRow (); - - -// -// Settings Menu -// - -private: - void setupSettingsMenuActions (); - void enableSettingsMenuDocumentActions (bool enable = true); - -private slots: - void slotFullScreen (); - - void slotEnableSettingsShowPath (); - void slotShowPathToggled (); - - void slotKeyBindings (); - -// -// Status Bar -// - -private: - enum - { - StatusBarItemShapePoints, - StatusBarItemShapeSize, - StatusBarItemDocSize, - StatusBarItemDocDepth, - StatusBarItemZoom - }; - - void addPermanentStatusBarItem (int id, int maxTextLen); - void createStatusBar (); - - void setStatusBarDocDepth (int depth = 0); - -private slots: - void setStatusBarMessage (const QString &message = QString()); - void setStatusBarShapePoints (const QPoint &startPoint = KP_INVALID_POINT, - const QPoint &endPoint = KP_INVALID_POINT); - void setStatusBarShapeSize (const QSize &size = KP_INVALID_SIZE); - void setStatusBarDocSize (const QSize &size = KP_INVALID_SIZE); - void setStatusBarZoom (int zoom = 0); - - void recalculateStatusBarMessage (); - void recalculateStatusBarShape (); - - void recalculateStatusBar (); - - -// -// Text ToolBar -// - -private: - void setupTextToolBarActions (); - void readAndApplyTextSettings (); - -public: - void enableTextToolBarActions (bool enable = true); - -private slots: - void slotTextFontFamilyChanged (); - void slotTextFontSizeChanged (); - void slotTextBoldChanged (); - void slotTextItalicChanged (); - void slotTextUnderlineChanged (); - void slotTextStrikeThruChanged (); - -public: - KToolBar *textToolBar (); - bool isTextStyleBackgroundOpaque () const; - kpTextStyle textStyle () const; - void setTextStyle (const kpTextStyle &textStyle_); - int settingTextStyle () const; - -private: - struct kpMainWindowPrivate *d; -}; - -#endif // KP_MAIN_WINDOW_H diff --git a/kolourpaint/mainWindow/kpMainWindowPrivate.h b/kolourpaint/mainWindow/kpMainWindowPrivate.h deleted file mode 100644 index 84a15255..00000000 --- a/kolourpaint/mainWindow/kpMainWindowPrivate.h +++ /dev/null @@ -1,428 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2014 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpMainWindowPrivate_H -#define kpMainWindowPrivate_H - - -#define DEBUG_KP_MAIN_WINDOW 0 - - -#include - - -#include -#include - -class KSelectAction; -class KToggleAction; -class KAction; -class KSqueezedTextLabel; - -class kpCommandEnvironment; -class kpDocumentEnvironment; -class kpToolSelectionEnvironment; -class kpTransformDialogEnvironment; - - -struct kpMainWindowPrivate -{ - kpMainWindowPrivate () - : isFullyConstructed(false), - scrollView(0), - mainView(0), - thumbnail(0), - thumbnailView(0), - document(0), - viewManager(0), - colorToolBar(0), - toolToolBar(0), - commandHistory(0), - - configFirstTime(false), - configShowGrid(false), - configShowPath(false), - configThumbnailShown(false), - configZoomedThumbnail(false), - - documentEnvironment(0), - commandEnvironment(0), - - // Tools - - toolSelectionEnvironment(0), - toolsActionGroup(0), - - toolSpraycan(0), - toolBrush(0), - toolColorEraser(0), - toolColorPicker(0), - toolCurve(0), - toolEllipse(0), - toolEllipticalSelection(0), - toolEraser(0), - toolFloodFill(0), - toolFreeFormSelection(0), - toolLine(0), - toolPen(0), - toolPolygon(0), - toolPolyline(0), - toolRectangle(0), - toolRectSelection(0), - toolRoundedRectangle(0), - toolZoom(0), - toolText(0), - - lastToolNumber(0), - toolActionsEnabled(false), - actionPrevToolOptionGroup1(0), - actionNextToolOptionGroup1(0), - actionPrevToolOptionGroup2(0), - actionNextToolOptionGroup2(0), - - settingImageSelectionTransparency(0), - - docResizeWidth(0), - docResizeHeight(0), - docResizeToBeCompleted(false), - - configOpenImagesInSameWindow(false), - configPrintImageCenteredOnPage(false), - - actionNew(0), - actionOpen(0), - actionOpenRecent(0), - actionScan(0), - actionScreenshot(0), - actionProperties(0), - actionSave(0), - actionSaveAs(0), - actionExport(0), - actionReload(0), - actionPrint(0), - actionPrintPreview(0), - actionMail(0), - actionClose(0), - actionQuit(0), - - scanDialog(0), - - exportFirstTime(false), - - // Edit Menu - - editMenuDocumentActionsEnabled(false), - - actionUndo(0), - actionRedo(0), - actionCut(0), - actionCopy(0), - actionPaste(0), - actionPasteInNewWindow(0), - actionDelete(0), - actionSelectAll(0), - actionDeselect(0), - actionCopyToFile(0), - actionPasteFromFile(0), - - copyToFirstTime(false), - - // View Menu - - configThumbnailShowRectangle(false), - actionShowThumbnailRectangle(0), - - viewMenuDocumentActionsEnabled(false), - - actionActualSize(0), - actionFitToPage(0), - actionFitToWidth(0), - actionFitToHeight(0), - actionZoomIn(0), - actionZoomOut(0), - actionZoom(0), - actionShowGrid(0), - actionShowThumbnail(0), - actionZoomedThumbnail(0), - - thumbnailSaveConfigTimer(0), - - // Image Menu - - transformDialogEnvironment(0), - - imageMenuDocumentActionsEnabled(false), - - actionResizeScale(0), - actionCrop(0), - actionAutoCrop(0), - actionFlip(0), - actionMirror(0), - actionRotate(0), - actionRotateLeft(0), - actionRotateRight(0), - actionSkew(0), - actionConvertToBlackAndWhite(0), - actionConvertToGrayscale(0), - actionMoreEffects(0), - actionInvertColors(0), - actionClear(0), - - actionDrawOpaque(0), - actionDrawColorSimilarity(0), - - moreEffectsDialogLastEffect(0), - - // Colors Menu - - colorMenuDocumentActionsEnabled(false), - - actionColorsDefault(0), - actionColorsKDE(0), - actionColorsOpen(0), - actionColorsReload(0), - actionColorsSave(0), - actionColorsSaveAs(0), - actionColorsAppendRow(0), - actionColorsDeleteRow(0), - - // Settings Menu - - actionShowPath(0), - actionKeyBindings(0), - actionConfigureToolbars(0), - actionConfigure(0), - actionFullScreen(0), - - // Status Bar - - statusBarCreated(false), - statusBarMessageLabel(0), - statusBarShapeLastPointsInitialised(false), - statusBarShapeLastSizeInitialised(false), - - // Text ToolBar - - actionTextFontFamily(0), - actionTextFontSize(0), - actionTextBold(0), - actionTextItalic(0), - actionTextUnderline(0), - actionTextStrikeThru(0), - settingTextStyle(0), - textOldFontSize(0) - { - } - - bool isFullyConstructed; - - kpViewScrollableContainer *scrollView; - kpZoomedView *mainView; - kpThumbnail *thumbnail; - kpThumbnailView *thumbnailView; - kpDocument *document; - kpViewManager *viewManager; - kpColorToolBar *colorToolBar; - kpToolToolBar *toolToolBar; - kpCommandHistory *commandHistory; - - bool configFirstTime; - bool configShowGrid; - bool configShowPath; - - bool configThumbnailShown; - QRect configThumbnailGeometry; - bool configZoomedThumbnail; - - kpDocumentEnvironment *documentEnvironment; - kpCommandEnvironment *commandEnvironment; - - // - // Tools - // - - kpToolSelectionEnvironment *toolSelectionEnvironment; - QActionGroup *toolsActionGroup; - - kpTool *toolSpraycan, *toolBrush, - *toolColorEraser, *toolColorPicker, - *toolCurve, *toolEllipse, - *toolEllipticalSelection, *toolEraser, - *toolFloodFill, *toolFreeFormSelection, - *toolLine, *toolPen, *toolPolygon, - *toolPolyline, *toolRectangle, *toolRectSelection, - *toolRoundedRectangle, *toolZoom; - kpToolText *toolText; - - QList tools; - int lastToolNumber; - - bool toolActionsEnabled; - KAction *actionPrevToolOptionGroup1, - *actionNextToolOptionGroup1, - *actionPrevToolOptionGroup2, - *actionNextToolOptionGroup2; - - int settingImageSelectionTransparency; - - int docResizeWidth, docResizeHeight; - bool docResizeToBeCompleted; - - // - // File Menu - // - - bool configOpenImagesInSameWindow, configPrintImageCenteredOnPage; - - QAction *actionNew, *actionOpen; - KRecentFilesAction *actionOpenRecent; - KAction *actionScan, *actionScreenshot, *actionProperties, - *actionSave, *actionSaveAs, *actionExport, - *actionReload, - *actionPrint, *actionPrintPreview, - *actionMail, - *actionClose, *actionQuit; - - KScanDialog *scanDialog; - - KUrl lastExportURL; - kpDocumentSaveOptions lastExportSaveOptions; - bool exportFirstTime; - - // - // Edit Menu - // - - bool editMenuDocumentActionsEnabled; - - KAction *actionUndo, *actionRedo, - *actionCut, *actionCopy, - *actionPaste, *actionPasteInNewWindow, - *actionDelete, - *actionSelectAll, *actionDeselect, - *actionCopyToFile, *actionPasteFromFile; - - KUrl lastCopyToURL; - kpDocumentSaveOptions lastCopyToSaveOptions; - bool copyToFirstTime; - - // - // View Menu - // - - bool configThumbnailShowRectangle; - KToggleAction *actionShowThumbnailRectangle; - - bool viewMenuDocumentActionsEnabled; - - QAction *actionActualSize, - *actionFitToPage, *actionFitToWidth, *actionFitToHeight, - *actionZoomIn, *actionZoomOut; - KSelectAction *actionZoom; - KToggleAction *actionShowGrid, - *actionShowThumbnail, *actionZoomedThumbnail; - - QList zoomList; - - QTimer *thumbnailSaveConfigTimer; - - // - // Image Menu - // - - kpTransformDialogEnvironment *transformDialogEnvironment; - - bool imageMenuDocumentActionsEnabled; - - KAction *actionResizeScale, - *actionCrop, *actionAutoCrop, - *actionFlip, *actionMirror, - *actionRotate, *actionRotateLeft, *actionRotateRight, - *actionSkew, - *actionConvertToBlackAndWhite, *actionConvertToGrayscale, - *actionMoreEffects, - *actionInvertColors, *actionClear; - - // Implemented in kpMainWindow_Tools.cpp, not kpImageWindow_Image.cpp - // since they're really setting tool options. - KToggleAction *actionDrawOpaque; - QAction *actionDrawColorSimilarity; - - int moreEffectsDialogLastEffect; - - // - // Colors Menu - // - - bool colorMenuDocumentActionsEnabled; - - QAction *actionColorsDefault; - KSelectAction *actionColorsKDE; - QAction *actionColorsOpen, *actionColorsReload; - - QAction *actionColorsSave, *actionColorsSaveAs; - - QAction *actionColorsAppendRow; - QAction *actionColorsDeleteRow; - - // - // Settings Menu - // - - KToggleAction *actionShowPath; - QAction *actionKeyBindings, *actionConfigureToolbars, *actionConfigure; - KToggleFullScreenAction *actionFullScreen; - - // - // Status Bar - // - - bool statusBarCreated; - KSqueezedTextLabel *statusBarMessageLabel; - - bool statusBarShapeLastPointsInitialised; - QPoint statusBarShapeLastStartPoint, statusBarShapeLastEndPoint; - bool statusBarShapeLastSizeInitialised; - QSize statusBarShapeLastSize; - - // - // Text ToolBar - // - - KFontAction *actionTextFontFamily; - KFontSizeAction *actionTextFontSize; - KToggleAction *actionTextBold, *actionTextItalic, - *actionTextUnderline, *actionTextStrikeThru; - - int settingTextStyle; - QString textOldFontFamily; - int textOldFontSize; -}; - - -#endif // kpMainWindowPrivate_H diff --git a/kolourpaint/mainWindow/kpMainWindow_Colors.cpp b/kolourpaint/mainWindow/kpMainWindow_Colors.cpp deleted file mode 100644 index 8a4890ef..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Colors.cpp +++ /dev/null @@ -1,454 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -static QStringList KDEColorCollectionNames () -{ - return kpColorCollection::installedCollections (); -} - - -// private -void kpMainWindow::setupColorsMenuActions () -{ - KActionCollection *ac = actionCollection (); - - - d->actionColorsDefault = ac->addAction ("colors_default"); - d->actionColorsDefault->setText (i18n ("Use KolourPaint Defaults")); - connect (d->actionColorsDefault, SIGNAL (triggered (bool)), - SLOT (slotColorsDefault ())); - - d->actionColorsKDE = ac->add ("colors_kde"); - d->actionColorsKDE->setText (i18nc ("@item:inmenu colors", "Use KDE's")); - // TODO: Will this slot be called spuriously if there are no colors - // installed? - connect (d->actionColorsKDE, SIGNAL (triggered (QAction *)), - SLOT (slotColorsKDE ())); - foreach (const QString &colName, ::KDEColorCollectionNames ()) - d->actionColorsKDE->addAction (colName); - - d->actionColorsOpen = ac->addAction ("colors_open"); - d->actionColorsOpen->setText (i18nc ("@item:inmenu colors", "&Open...")); - connect (d->actionColorsOpen, SIGNAL (triggered (bool)), - SLOT (slotColorsOpen ())); - - d->actionColorsReload = ac->addAction ("colors_reload"); - d->actionColorsReload->setText (i18nc ("@item:inmenu colors", "Reloa&d")); - connect (d->actionColorsReload, SIGNAL (triggered (bool)), - SLOT (slotColorsReload ())); - - - d->actionColorsSave = ac->addAction ("colors_save"); - d->actionColorsSave->setText (i18nc ("@item:inmenu colors", "&Save")); - connect (d->actionColorsSave, SIGNAL (triggered (bool)), - SLOT (slotColorsSave ())); - - d->actionColorsSaveAs = ac->addAction ("colors_save_as"); - d->actionColorsSaveAs->setText (i18nc ("@item:inmenu colors", "Save &As...")); - connect (d->actionColorsSaveAs, SIGNAL (triggered (bool)), - SLOT (slotColorsSaveAs ())); - - - d->actionColorsAppendRow = ac->addAction ("colors_append_row"); - d->actionColorsAppendRow->setText (i18nc ("@item:inmenu colors", "Add Row")); - connect (d->actionColorsAppendRow, SIGNAL (triggered (bool)), - SLOT (slotColorsAppendRow ())); - - d->actionColorsDeleteRow = ac->addAction ("colors_delete_row"); - d->actionColorsDeleteRow->setText (i18nc ("@item:inmenu colors", "Delete Last Row")); - connect (d->actionColorsDeleteRow, SIGNAL (triggered (bool)), - SLOT (slotColorsDeleteRow ())); - - - enableColorsMenuDocumentActions (false); -} - -// private -void kpMainWindow::createColorBox () -{ - d->colorToolBar = new kpColorToolBar (i18n ("Color Box"), this); - - // (needed for QMainWindow::saveState()) - d->colorToolBar->setObjectName ( QLatin1String("Color Box" )); - - connect (colorCells (), SIGNAL (rowCountChanged (int)), - SLOT (slotUpdateColorsDeleteRowActionEnabled ())); -} - -// private -void kpMainWindow::enableColorsMenuDocumentActions (bool enable) -{ - d->actionColorsDefault->setEnabled (enable); - d->actionColorsKDE->setEnabled (enable); - d->actionColorsOpen->setEnabled (enable); - d->actionColorsReload->setEnabled (enable); - - d->actionColorsSave->setEnabled (enable); - d->actionColorsSaveAs->setEnabled (enable); - - d->actionColorsAppendRow->setEnabled (enable); - - d->colorMenuDocumentActionsEnabled = enable; - - slotUpdateColorsDeleteRowActionEnabled (); -} - -// private slot -void kpMainWindow::slotUpdateColorsDeleteRowActionEnabled () -{ - // Currently, this is always enabled since kpColorCells guarantees that - // there will be at least one row of cells (which might all be of the - // invalid color). - // - // But this method is left here for future extensibility. - d->actionColorsDeleteRow->setEnabled ( - d->colorMenuDocumentActionsEnabled && (colorCells ()->rowCount () > 0)); -} - - -// Used in 2 situations: -// -// 1. User opens a color without using the "Use KDE's" submenu. -// 2. User attempts to open a color using the "Use KDE's" submenu but the -// opening fails. -// -// TODO: Maybe we could put the 3 actions (for different ways of opening -// colors) in an exclusive group -- this might elminate the need for -// this hack. -// -// private -void kpMainWindow::deselectActionColorsKDE () -{ - d->actionColorsKDE->setCurrentItem (-1); -} - - -// private -bool kpMainWindow::queryCloseColors () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::queryCloseColors() colorCells.modified=" - << colorCells ()->isModified (); -#endif - - toolEndShape (); - - if (!colorCells ()->isModified ()) - return true; // ok to close - - int result = KMessageBox::Cancel; - - - if (!colorCells ()->url ().isEmpty ()) - { - result = KMessageBox::warningYesNoCancel (this, - i18n ("The color palette \"%1\" has been modified.\n" - "Do you want to save it?", - kpUrlFormatter::PrettyFilename (colorCells ()->url ())), - QString ()/*caption*/, - KStandardGuiItem::save (), KStandardGuiItem::discard ()); - } - else - { - const QString name = colorCells ()->colorCollection ()->name (); - if (!name.isEmpty ()) - { - result = KMessageBox::warningYesNoCancel (this, - i18n ("The KDE color palette \"%1\" has been modified.\n" - "Do you want to save it to a file?", - name), - QString ()/*caption*/, - KStandardGuiItem::save (), KStandardGuiItem::discard ()); - } - else - { - result = KMessageBox::warningYesNoCancel (this, - i18n ("The default color palette has been modified.\n" - "Do you want to save it to a file?"), - QString ()/*caption*/, - KStandardGuiItem::save (), KStandardGuiItem::discard ()); - } - } - - switch (result) - { - case KMessageBox::Yes: - return slotColorsSave (); // close only if save succeeds - case KMessageBox::No: - return true; // close without saving - default: - return false; // don't close current doc - } -} - - -// private -void kpMainWindow::openDefaultColors () -{ - colorCells ()->setColorCollection ( - kpColorCells::DefaultColorCollection ()); -} - -// private slot -void kpMainWindow::slotColorsDefault () -{ - // Call just in case. - toolEndShape (); - - if (!queryCloseColors ()) - return; - - openDefaultColors (); - - deselectActionColorsKDE (); -} - -// private -bool kpMainWindow::openKDEColors (const QString &name) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::openKDEColors(" << name << ")"; -#endif - - kpColorCollection colorCol; - if (colorCol.openKDE (name, this)) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "opened"; - #endif - colorCells ()->setColorCollection (colorCol); - return true; - } - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "failed to open"; - #endif - return false; - } -} - -// private slot -void kpMainWindow::slotColorsKDE () -{ - // Call in case an error dialog appears. - toolEndShape (); - - const int curItem = d->actionColorsKDE->currentItem (); - - if (!queryCloseColors ()) - { - deselectActionColorsKDE (); - return; - } - else - { - // queryCloseColors() calls slotColorSave(), which can call - // slotColorSaveAs(), which can call deselectActionColorsKDE(). - d->actionColorsKDE->setCurrentItem (curItem); - } - - const QStringList colNames = ::KDEColorCollectionNames (); - const int selected = d->actionColorsKDE->currentItem (); - Q_ASSERT (selected >= 0 && selected < colNames.size ()); - - if (!openKDEColors (colNames [selected])) - deselectActionColorsKDE (); -} - -// private -bool kpMainWindow::openColors (const KUrl &url) -{ - if (!colorCells ()->openColorCollection (url)) - return false; - - return true; -} - -// private slot -void kpMainWindow::slotColorsOpen () -{ - // Call due to dialog. - toolEndShape (); - - KFileDialog fd (colorCells ()->url (), QString()/*filter*/, this); - fd.setCaption (i18nc ("@title:window", "Open Color Palette")); - fd.setOperationMode (KFileDialog::Opening); - - if (fd.exec ()) - { - if (!queryCloseColors ()) - return; - - if (openColors (fd.selectedUrl ())) - deselectActionColorsKDE (); - } -} - -// private slot -void kpMainWindow::slotColorsReload () -{ - toolEndShape (); - - if (colorCells ()->isModified ()) - { - int result = KMessageBox::Cancel; - - if (!colorCells ()->url ().isEmpty ()) - { - result = KMessageBox::warningContinueCancel (this, - i18n ("The color palette \"%1\" has been modified.\n" - "Reloading will lose all changes since you last saved it.\n" - "Are you sure?", - kpUrlFormatter::PrettyFilename (colorCells ()->url ())), - QString ()/*caption*/, - KGuiItem(i18n ("&Reload"))); - } - else - { - const QString name = colorCells ()->colorCollection ()->name (); - if (!name.isEmpty ()) - { - result = KMessageBox::warningContinueCancel (this, - i18n ("The KDE color palette \"%1\" has been modified.\n" - "Reloading will lose all changes.\n" - "Are you sure?", - colorCells ()->colorCollection ()->name ()), - QString ()/*caption*/, - KGuiItem (i18n ("&Reload"))); - } - else - { - result = KMessageBox::warningContinueCancel (this, - i18n ("The default color palette has been modified.\n" - "Reloading will lose all changes.\n" - "Are you sure?"), - QString ()/*caption*/, - KGuiItem (i18n ("&Reload"))); - } - } - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "result=" << result - << "vs KMessageBox::Continue" << KMessageBox::Continue; - #endif - if (result != KMessageBox::Continue) - return; - } - - - if (!colorCells ()->url ().isEmpty ()) - { - openColors (colorCells ()->url ()); - } - else - { - const QString name = colorCells ()->colorCollection ()->name (); - if (!name.isEmpty ()) - openKDEColors (name); - else - openDefaultColors (); - } -} - - -// private slot -bool kpMainWindow::slotColorsSave () -{ - // Call due to dialog. - toolEndShape (); - - if (colorCells ()->url ().isEmpty ()) - { - return slotColorsSaveAs (); - } - - return colorCells ()->saveColorCollection (); -} - -// private slot -bool kpMainWindow::slotColorsSaveAs () -{ - // Call due to dialog. - toolEndShape (); - - KFileDialog fd (colorCells ()->url (), QString()/*filter*/, this); - fd.setCaption (i18n ("Save Color Palette As")); - fd.setOperationMode (KFileDialog::Saving); - - if (fd.exec ()) - { - if (!colorCells ()->saveColorCollectionAs (fd.selectedUrl ())) - return false; - - // We're definitely using our own color collection now. - deselectActionColorsKDE (); - - return true; - } - else - return false; -} - - -// private slot -void kpMainWindow::slotColorsAppendRow () -{ - // Call just in case. - toolEndShape (); - - kpColorCells *colorCells = d->colorToolBar->colorCells (); - colorCells->appendRow (); -} - -// private slot -void kpMainWindow::slotColorsDeleteRow () -{ - // Call just in case. - toolEndShape (); - - kpColorCells *colorCells = d->colorToolBar->colorCells (); - colorCells->deleteLastRow (); -} diff --git a/kolourpaint/mainWindow/kpMainWindow_Edit.cpp b/kolourpaint/mainWindow/kpMainWindow_Edit.cpp deleted file mode 100644 index 1c5e955b..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Edit.cpp +++ /dev/null @@ -1,921 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupEditMenuActions () -{ - KActionCollection *ac = actionCollection (); - - - // Undo/Redo - // CONFIG: Need GUI for config history size. - d->commandHistory = new kpCommandHistory (true/*read config*/, this); - - if (d->configFirstTime) - { - // (so that cfg-file-editing user can modify in the meantime) - d->commandHistory->writeConfig (); - } - - - d->actionCut = KStandardAction::cut (this, SLOT (slotCut ()), ac); - d->actionCopy = KStandardAction::copy (this, SLOT (slotCopy ()), ac); - d->actionPaste = KStandardAction::paste (this, SLOT (slotPaste ()), ac); - d->actionPasteInNewWindow = ac->addAction ("edit_paste_in_new_window"); - d->actionPasteInNewWindow->setText (i18n ("Paste in &New Window")); - connect (d->actionPasteInNewWindow, SIGNAL (triggered (bool)), - SLOT (slotPasteInNewWindow ())); - d->actionPasteInNewWindow->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_V); - - //d->actionDelete = KStandardAction::clear (this, SLOT (slotDelete ()), ac); - d->actionDelete = ac->addAction ("edit_clear"); - d->actionDelete->setText (i18n ("&Delete Selection")); - connect (d->actionDelete, SIGNAL (triggered (bool)), SLOT (slotDelete ())); - - d->actionSelectAll = KStandardAction::selectAll (this, SLOT (slotSelectAll ()), ac); - d->actionDeselect = KStandardAction::deselect (this, SLOT (slotDeselect ()), ac); - - - d->actionCopyToFile = ac->addAction ("edit_copy_to_file"); - d->actionCopyToFile->setText (i18n ("C&opy to File...")); - connect (d->actionCopyToFile, SIGNAL (triggered (bool)), - SLOT (slotCopyToFile ())); - d->actionPasteFromFile = ac->addAction ("edit_paste_from_file"); - d->actionPasteFromFile->setText (i18n ("Paste &From File...")); - connect (d->actionPasteFromFile, SIGNAL (triggered (bool)), - SLOT (slotPasteFromFile ())); - - - d->editMenuDocumentActionsEnabled = false; - enableEditMenuDocumentActions (false); - - // Paste should always be enabled, as long as there is something to paste - // (independent of whether we have a document or not) - connect (QApplication::clipboard (), SIGNAL (dataChanged ()), - this, SLOT (slotEnablePaste ())); - slotEnablePaste (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableEditMenuDocumentActions (bool enable) -{ - // d->actionCut - // d->actionCopy - // d->actionPaste - // d->actionPasteInNewWindow - - // d->actionDelete - - d->actionSelectAll->setEnabled (enable); - // d->actionDeselect - - d->editMenuDocumentActionsEnabled = enable; - - // d->actionCopyToFile - - // Unlike d->actionPaste, we disable this if there is no document. - // This is because "File / Open" would do the same thing, if there is - // no document. - d->actionPasteFromFile->setEnabled (enable); -} - -//--------------------------------------------------------------------- - -// public -QMenu *kpMainWindow::selectionToolRMBMenu () -{ - return qobject_cast (guiFactory ()->container ("selectionToolRMBMenu", this)); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotCut () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotCut() CALLED"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - Q_ASSERT (d->document && d->document->selection ()); - - toolEndShape (); - - slotCopy (); - slotDelete (); -} - -//--------------------------------------------------------------------- - -static QMimeData *NewTextMimeData (const QString &text) -{ - QMimeData *md = new QMimeData (); - md->setText (text); - return md; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotCopy () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotCopy() CALLED"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - Q_ASSERT (d->document && d->document->selection ()); - - toolEndShape (); - - kpAbstractSelection *sel = d->document->selection ()->clone (); - - if (dynamic_cast (sel)) - { - kpTextSelection *textSel = static_cast (sel); - if (!textSel->text ().isEmpty ()) - { - QApplication::clipboard ()->setMimeData ( - ::NewTextMimeData (textSel->text ()), - QClipboard::Clipboard); - - // SYNC: Normally, users highlight text and press CTRL+C. - // Highlighting text copies it to the X11 "middle - // mouse button" clipboard. CTRL+C copies it to the - // separate, Windows-like "CTRL+V" clipboard. - // - // However, KolourPaint doesn't support highlighting. - // So when they press CTRL+C to copy all text, simulate - // the highlighting by copying the text to the "middle - // mouse button" clipboard. We don't do this for images - // as no one ever middle-mouse-pastes images. - // - // Note that we don't share the QMimeData pointer with - // the above in case Qt doesn't expect it. - // - // Once we change KolourPaint to support highlighted text - // and CTRL+C to copy only the highlighted text, delete - // this code. - QApplication::clipboard ()->setMimeData ( - ::NewTextMimeData (textSel->text ()), - QClipboard::Selection); - } - } - else if (dynamic_cast (sel)) - { - kpAbstractImageSelection *imageSel = - static_cast (sel); - - // Transparency doesn't get sent across the aether so nuke it now - // so that transparency mask doesn't get needlessly recalculated - // if we ever call sel.setBaseImage(). - imageSel->setTransparency (kpImageSelectionTransparency ()); - - kpImage rawImage; - - if (imageSel->hasContent ()) - rawImage = imageSel->baseImage (); - else - rawImage = d->document->getSelectedBaseImage (); - - imageSel->setBaseImage ( rawImage ); - - QApplication::clipboard ()->setMimeData ( - new kpSelectionDrag (*imageSel), - QClipboard::Clipboard); - } - else - Q_ASSERT (!"Unknown selection type"); - - delete sel; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotEnablePaste () -{ - const QMimeData *md = - QApplication::clipboard()->mimeData(QClipboard::Clipboard); - - // It's faster to test for QMimeData::hasText() first due to the - // lazy evaluation of the '||' operator. - const bool shouldEnable = (md->hasText() || kpSelectionDrag::canDecode(md)); - - d->actionPasteInNewWindow->setEnabled(shouldEnable); - d->actionPaste->setEnabled(shouldEnable); -} - -//--------------------------------------------------------------------- - -// private -QRect kpMainWindow::calcUsefulPasteRect (int imageWidth, int imageHeight) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::calcUsefulPasteRect(" - << imageWidth << "," << imageHeight - << ")" - << endl; -#endif - Q_ASSERT (d->document); - - // TODO: 1st choice is to paste sel near but not overlapping last deselect point - - if (d->mainView && d->scrollView) - { - const QPoint viewTopLeft (d->scrollView->horizontalScrollBar()->value (), - d->scrollView->verticalScrollBar()->value ()); - - const QPoint docTopLeft = d->mainView->transformViewToDoc (viewTopLeft); - - if ((docTopLeft.x () + imageWidth <= d->document->width () && - docTopLeft.y () + imageHeight <= d->document->height ()) || - imageWidth <= docTopLeft.x () || - imageHeight <= docTopLeft.y ()) - { - return QRect (docTopLeft.x (), docTopLeft.y (), - imageWidth, imageHeight); - } - } - - return QRect (0, 0, imageWidth, imageHeight); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::paste(const kpAbstractSelection &sel, bool forceTopLeft) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::paste(forceTopLeft=" << forceTopLeft << ")" - << endl; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - toolEndShape (); - - // - // Make sure we've got a document (esp. with File/Close) - // - - if (!d->document) - { - kpDocument *newDoc = new kpDocument ( - sel.width (), sel.height (), documentEnvironment ()); - - // will also create viewManager - setDocument (newDoc); - } - - // - // Paste as new selection - // - - const kpAbstractImageSelection *imageSel = - dynamic_cast (&sel); - if (imageSel && imageSel->hasContent () && imageSel->transparency ().isTransparent ()) - { - d->colorToolBar->flashColorSimilarityToolBarItem (); - } - - kpAbstractSelection *selInUsefulPos = sel.clone (); - if (!forceTopLeft) - selInUsefulPos->moveTo (calcUsefulPasteRect (sel.width (), sel.height ()).topLeft ()); - // TODO: Should use kpCommandHistory::addCreateSelectionCommand(), - // as well, to really support pasting selection borders. - addDeselectFirstCommand (new kpToolSelectionCreateCommand ( - dynamic_cast (selInUsefulPos) ? - i18n ("Text: Create Box") : - i18n ("Selection: Create"), - *selInUsefulPos, - commandEnvironment ())); - delete selInUsefulPos; - - -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "sel.size=" << QSize (sel.width (), sel.height ()) - << " document.size=" - << QSize (d->document->width (), d->document->height ()) - << endl; -#endif - - // If the selection is bigger than the document, automatically - // resize the document (with the option of Undo'ing) to fit - // the selection. - // - // No annoying dialog necessary. - // - if (sel.width () > d->document->width () || - sel.height () > d->document->height ()) - { - d->commandHistory->addCommand ( - new kpTransformResizeScaleCommand ( - false/*act on doc, not sel*/, - qMax (sel.width (), d->document->width ()), - qMax (sel.height (), d->document->height ()), - kpTransformResizeScaleCommand::Resize, - commandEnvironment ())); - } -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::pasteText (const QString &text, - bool forceNewTextSelection, - const QPoint &newTextSelectionTopLeft) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::pasteText(" << text - << ",forceNewTextSelection=" << forceNewTextSelection - << ",newTextSelectionTopLeft=" << newTextSelectionTopLeft - << ")" << endl; -#endif - - if ( text.isEmpty() ) - return; - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - toolEndShape (); - - QStringList textLines = text.split('\n'); - - if (!forceNewTextSelection && - d->document && d->document->textSelection () && - d->commandHistory && d->viewManager) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\treusing existing Text Selection"; - #endif - - d->viewManager->setQueueUpdates(); - - kpTextSelection *textSel = d->document->textSelection (); - if (!textSel->hasContent ()) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\t\tneeds content"; - #endif - commandHistory ()->addCreateSelectionCommand ( - new kpToolSelectionCreateCommand ( - i18n ("Text: Create Box"), - *textSel, - commandEnvironment ()), - false/*no exec*/); - } - - kpMacroCommand *macroCmd = new kpMacroCommand (i18n ("Text: Paste"), - commandEnvironment ()); - // (yes, this is the same check as the previous "if") - if (!textSel->hasContent ()) - { - kpCommand *giveContentCmd = new kpToolTextGiveContentCommand ( - *textSel, - QString ()/*uninteresting child of macro cmd*/, - commandEnvironment ()); - giveContentCmd->execute (); - - macroCmd->addCommand (giveContentCmd); - } - - for (int i = 0; i < (int) textLines.size (); i++) - { - if (i > 0) - { - macroCmd->addCommand ( - new kpToolTextEnterCommand ( - QString()/*uninteresting child of macroCmd*/, - d->viewManager->textCursorRow (), - d->viewManager->textCursorCol (), - kpToolTextEnterCommand::AddEnterNow, - commandEnvironment ())); - } - - macroCmd->addCommand ( - new kpToolTextInsertCommand ( - QString()/*uninteresting child of macroCmd*/, - d->viewManager->textCursorRow (), - d->viewManager->textCursorCol (), - textLines [i], - commandEnvironment ())); - } - - d->commandHistory->addCommand (macroCmd, false/*no exec*/); - - d->viewManager->restoreQueueUpdates(); - } - else - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tcreating Text Selection"; - #endif - - const kpTextStyle ts = textStyle (); - const QFontMetrics fontMetrics = ts.fontMetrics (); - - int height = textLines.size () * fontMetrics.height (); - if (textLines.size () >= 1) - height += (textLines.size () - 1) * fontMetrics.leading (); - - int width = 0; - for (QList ::const_iterator it = textLines.constBegin (); - it != textLines.constEnd (); - ++it) - { - const int w = fontMetrics.width (*it); - if (w > width) - width = w; - } - - // limit the size to avoid memory overflow - width = qMin(qMax(QApplication::desktop()->width(), d->document ? d->document->width() : 0), width); - height = qMin(qMax(QApplication::desktop()->height(), d->document ? d->document->height() : 0), height); - - const int selWidth = qMax (kpTextSelection::MinimumWidthForTextStyle (ts), - width + kpTextSelection::TextBorderSize () * 2); - const int selHeight = qMax (kpTextSelection::MinimumHeightForTextStyle (ts), - height + kpTextSelection::TextBorderSize () * 2); - kpTextSelection newTextSel (QRect (0, 0, selWidth, selHeight), - textLines, - ts); - - if (newTextSelectionTopLeft != KP_INVALID_POINT) - { - newTextSel.moveTo (newTextSelectionTopLeft); - paste (newTextSel, true/*force topLeft*/); - } - else - { - paste (newTextSel); - } - } -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::pasteTextAt (const QString &text, const QPoint &point, - bool allowNewTextSelectionPointShift) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::pasteTextAt(" << text - << ",point=" << point - << ",allowNewTextSelectionPointShift=" - << allowNewTextSelectionPointShift - << ")" << endl; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - toolEndShape (); - - - if (d->document && - d->document->textSelection () && - d->document->textSelection ()->pointIsInTextArea (point)) - { - kpTextSelection *textSel = d->document->textSelection (); - - int row, col; - - if (textSel->hasContent ()) - { - row = textSel->closestTextRowForPoint (point); - col = textSel->closestTextColForPoint (point); - } - else - { - row = col = 0; - } - - d->viewManager->setTextCursorPosition (row, col); - - pasteText (text); - } - else - { - QPoint pointToUse = point; - - if (allowNewTextSelectionPointShift) - { - // TODO: In terms of doc pixels, would be inconsistent behaviour - // based on zoomLevel of view. - // pointToUse -= QPoint (-view->selectionResizeHandleAtomicSize (), - // -view->selectionResizeHandleAtomicSize ()); - } - - pasteText (text, true/*force new text selection*/, pointToUse); - } -} - -//--------------------------------------------------------------------- -// public slot - -void kpMainWindow::slotPaste() -{ - kpSetOverrideCursorSaver cursorSaver(Qt::WaitCursor); - - toolEndShape(); - - const QMimeData *mimeData = QApplication::clipboard()->mimeData(QClipboard::Clipboard); - - kpAbstractImageSelection *sel = kpSelectionDrag::decode(mimeData); - if ( sel ) - { - sel->setTransparency(imageSelectionTransparency()); - paste(*sel); - delete sel; - } - else if ( mimeData->hasText() ) - { - pasteText(mimeData->text()); - } - else - { - kpSetOverrideCursorSaver cursorSaver(Qt::ArrowCursor); - - KMessageBox::sorry(this, - i18n("KolourPaint cannot paste the contents of" - " the clipboard as it has an unknown format."), - i18n("Cannot Paste")); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotPasteInNewWindow () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotPasteInNewWindow() CALLED"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - toolEndShape (); - - // - // Pasting must ensure that: - // - // Requirement 1. the document is the same size as the image to be pasted. - // Requirement 2. transparent pixels in the image must remain as transparent. - // - - kpMainWindow *win = new kpMainWindow (0/*no document*/); - win->show (); - - // Make "Edit / Paste in New Window" always paste white pixels as white. - // Don't let selection transparency get in the way and paste them as - // transparent. - kpImageSelectionTransparency transparency = win->imageSelectionTransparency (); - if (transparency.isTransparent ()) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tchanging image selection transparency to opaque"; - #endif - transparency.setOpaque (); - // Since we are setting selection transparency programmatically - // -- as opposed to in response to user input -- this will not - // affect the selection transparency tool option widget's "last used" - // config setting. - win->setImageSelectionTransparency (transparency); - } - - // (this handles Requirement 1. above) - win->slotPaste (); - - // if slotPaste could not decode clipboard data, no document was created - if ( win->document() ) - { - // (this handles Requirement 2. above; - // slotDeselect() is not enough unless the document is filled with the - // transparent color in advance) - win->slotCrop(); - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotDelete () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotDelete() CALLED"; -#endif - if (!d->actionDelete->isEnabled ()) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\taction not enabled - was probably called from kpTool::keyPressEvent()"; - #endif - return; - } - - Q_ASSERT (d->document && d->document->selection ()); - - toolEndShape (); - - addImageOrSelectionCommand (new kpToolSelectionDestroyCommand ( - d->document->textSelection () ? - i18n ("Text: Delete Box") : // not to be confused with i18n ("Text: Delete") - i18n ("Selection: Delete"), - false/*no push onto doc*/, - commandEnvironment ())); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotSelectAll () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotSelectAll() CALLED"; -#endif - Q_ASSERT (d->document); - - toolEndShape (); - - if (d->document->selection ()) - slotDeselect (); - - // just the border - don't actually pull image from doc yet - d->document->setSelection ( - kpRectangularImageSelection (d->document->rect (), - imageSelectionTransparency ())); - - if (tool ()) - tool ()->somethingBelowTheCursorChanged (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::addDeselectFirstCommand (kpCommand *cmd) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::addDeselectFirstCommand(" - << cmd - << ")" - << endl; -#endif - - - kpAbstractSelection *sel = d->document->selection (); - -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tsel=" << sel; -#endif - - if (sel) - { - // if you just dragged out something with no action then - // forget the drag - if (!sel->hasContent ()) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tjust a fresh border - was nop - delete"; - #endif - d->document->selectionDelete (); - if (tool ()) - tool ()->somethingBelowTheCursorChanged (); - - if (cmd) - d->commandHistory->addCommand (cmd); - } - else - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\treal selection with image - push onto doc cmd"; - #endif - kpCommand *deselectCommand = new kpToolSelectionDestroyCommand ( - dynamic_cast (sel) ? - i18n ("Text: Finish") : - i18n ("Selection: Deselect"), - true/*push onto document*/, - commandEnvironment ()); - - if (cmd) - { - kpMacroCommand *macroCmd = new kpMacroCommand (cmd->name (), - commandEnvironment ()); - macroCmd->addCommand (deselectCommand); - macroCmd->addCommand (cmd); - d->commandHistory->addCommand (macroCmd); - } - else - d->commandHistory->addCommand (deselectCommand); - } - } - else - { - if (cmd) - d->commandHistory->addCommand (cmd); - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotDeselect () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::slotDeselect() CALLED"; -#endif - Q_ASSERT (d->document && d->document->selection ()); - - toolEndShape (); - - addDeselectFirstCommand (0); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotCopyToFile () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotCopyToFile()"; -#endif - - toolEndShape (); - - - if (!d->document->selection ()) - return; - - kpImage imageToSave; - - if (d->document->imageSelection ()) - { - kpAbstractImageSelection *imageSel = d->document->imageSelection (); - if (!imageSel->hasContent ()) - { - // Not a floating selection - user has just selected a region; - // haven't pulled it off yet so probably don't expect and can't - // visualize selection transparency so give opaque, not transparent - // image. - imageToSave = d->document->getSelectedBaseImage (); - } - else - imageToSave = imageSel->transparentImage (); - } - else if (d->document->textSelection ()) - { - imageToSave = d->document->textSelection ()->approximateImage (); - } - else - Q_ASSERT (!"Unknown selection type"); - - - kpDocumentSaveOptions chosenSaveOptions; - bool allowOverwritePrompt, allowLossyPrompt; - KUrl chosenURL = askForSaveURL (i18nc ("@title:window", "Copy to File"), - d->lastCopyToURL.url (), - imageToSave, - d->lastCopyToSaveOptions, - kpDocumentMetaInfo (), - kpSettingsGroupEditCopyTo, - false/*allow remote files*/, - &chosenSaveOptions, - d->copyToFirstTime, - &allowOverwritePrompt, - &allowLossyPrompt); - - if (chosenURL.isEmpty ()) - return; - - - if (!kpDocument::savePixmapToFile (imageToSave, - chosenURL, - chosenSaveOptions, kpDocumentMetaInfo (), - allowOverwritePrompt, - allowLossyPrompt, - this)) - { - return; - } - - - addRecentURL (chosenURL); - - - d->lastCopyToURL = chosenURL; - d->lastCopyToSaveOptions = chosenSaveOptions; - - d->copyToFirstTime = false; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotPasteFromFile () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotPasteFromFile()"; -#endif - - toolEndShape (); - - - KUrl::List urls = askForOpenURLs(i18nc ("@title:window", "Paste From File"), - false/*only 1 URL*/); - - if (urls.count () != 1) - return; - - KUrl url = urls.first (); - - kpImage image = kpDocument::getPixmapFromFile (url, - false/*show error message if doesn't exist*/, - this); - - if (image.isNull ()) - return; - - addRecentURL (url); - - paste (kpRectangularImageSelection ( - QRect (0, 0, image.width (), image.height ()), - image, - imageSelectionTransparency ())); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/mainWindow/kpMainWindow_File.cpp b/kolourpaint/mainWindow/kpMainWindow_File.cpp deleted file mode 100644 index 6c55bd4c..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_File.cpp +++ /dev/null @@ -1,1495 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2007 Martin Koller - Copyright (c) 2007 John Layt - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// private -void kpMainWindow::setupFileMenuActions () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::setupFileMenuActions()"; -#endif - KActionCollection *ac = actionCollection (); - - d->actionNew = KStandardAction::openNew (this, SLOT (slotNew ()), ac); - d->actionOpen = KStandardAction::open (this, SLOT (slotOpen ()), ac); - - d->actionOpenRecent = KStandardAction::openRecent (this, SLOT (slotOpenRecent (const KUrl &)), ac); - d->actionOpenRecent->loadEntries (KGlobal::config ()->group (kpSettingsGroupRecentFiles)); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\trecent URLs=" << d->actionOpenRecent->items (); -#endif - - d->actionSave = KStandardAction::save (this, SLOT (slotSave ()), ac); - d->actionSaveAs = KStandardAction::saveAs (this, SLOT (slotSaveAs ()), ac); - - d->actionExport = ac->addAction("file_export"); - d->actionExport->setText (i18n ("E&xport...")); - d->actionExport->setIcon (KIcon ("document-export")); - connect(d->actionExport, SIGNAL(triggered(bool) ), SLOT (slotExport ())); - - d->actionScan = ac->addAction("file_scan"); - d->actionScan->setText(i18n ("Scan...")); - d->actionScan->setIcon(SmallIcon("scanner")); - connect(d->actionScan, SIGNAL(triggered(bool)), SLOT(slotScan())); - - d->actionScreenshot = ac->addAction("file_screenshot"); - d->actionScreenshot->setText(i18n("Acquire Screenshot")); - connect(d->actionScreenshot, SIGNAL(triggered(bool)), SLOT(slotScreenshot())); - - d->actionProperties = ac->addAction ("file_properties"); - d->actionProperties->setText (i18n ("Properties")); - d->actionProperties->setIcon (KIcon ("document-properties")); - connect (d->actionProperties, SIGNAL (triggered (bool)), SLOT (slotProperties ())); - - //d->actionRevert = KStandardAction::revert (this, SLOT (slotRevert ()), ac); - d->actionReload = ac->addAction ("file_revert"); - d->actionReload->setText (i18n ("Reloa&d")); - d->actionReload->setIcon (KIcon ("view-refresh")); - connect(d->actionReload, SIGNAL(triggered(bool) ), SLOT (slotReload ())); - d->actionReload->setShortcuts(KStandardShortcut::reload ()); - slotEnableReload (); - - d->actionPrint = KStandardAction::print (this, SLOT (slotPrint ()), ac); - d->actionPrintPreview = KStandardAction::printPreview (this, SLOT (slotPrintPreview ()), ac); - - d->actionMail = KStandardAction::mail (this, SLOT (slotMail ()), ac); - - d->actionClose = KStandardAction::close (this, SLOT (slotClose ()), ac); - d->actionQuit = KStandardAction::quit (this, SLOT (slotQuit ()), ac); - - d->scanDialog = 0; - - enableFileMenuDocumentActions (false); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableFileMenuDocumentActions (bool enable) -{ - // d->actionNew - // d->actionOpen - - // d->actionOpenRecent - - d->actionSave->setEnabled (enable); - d->actionSaveAs->setEnabled (enable); - - d->actionExport->setEnabled (enable); - - // d->actionScan - - d->actionProperties->setEnabled (enable); - - // d->actionReload - - d->actionPrint->setEnabled (enable); - d->actionPrintPreview->setEnabled (enable); - - d->actionMail->setEnabled (enable); - - d->actionClose->setEnabled (enable); - // d->actionQuit->setEnabled (enable); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::addRecentURL (const KUrl &url_) -{ - // HACK: KRecentFilesAction::loadEntries() clears the KRecentFilesAction::d->urls - // map. - // - // So afterwards, the URL ref, our method is given, points to an - // element in this now-cleared map (see KRecentFilesAction::urlSelected(QAction*)). - // Accessing it would result in a crash. - // - // To avoid the crash, make a copy of it before calling - // loadEntries() and use this copy, instead of the to-be-dangling - // ref. - const KUrl url = url_; - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::addRecentURL(" << url << ")"; -#endif - if (url.isEmpty ()) - return; - - - KSharedConfig::Ptr cfg = KGlobal::config(); - - // KConfig::readEntry() does not actually reread from disk, hence doesn't - // realize what other processes have done e.g. Settings / Show Path - cfg->reparseConfiguration (); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\trecent URLs=" << d->actionOpenRecent->items (); -#endif - // HACK: Something might have changed interprocess. - // If we could PROPAGATE: interprocess, then this wouldn't be required. - d->actionOpenRecent->loadEntries (cfg->group (kpSettingsGroupRecentFiles)); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tafter loading config=" << d->actionOpenRecent->items (); -#endif - - d->actionOpenRecent->addUrl (url); - - d->actionOpenRecent->saveEntries (cfg->group (kpSettingsGroupRecentFiles)); - cfg->sync (); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tnew recent URLs=" << d->actionOpenRecent->items (); -#endif - - - // TODO: PROPAGATE: interprocess - // TODO: Is this loop safe since a KMainWindow later along in the list, - // could be closed as the code in the body almost certainly re-enters - // the event loop? Problem for KDE 3 as well, I think. - foreach (KMainWindow *kmw, KMainWindow::memberList ()) - { - Q_ASSERT (dynamic_cast (kmw)); - kpMainWindow *mw = static_cast (kmw); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tmw=" << mw; - #endif - - if (mw != this) - { - // WARNING: Do not use KRecentFilesAction::setItems() - // - it does not work since only its superclass, - // KSelectAction, implements setItems() and can't - // update KRecentFilesAction's URL list. - - // Avoid URL memory leak in KRecentFilesAction::loadEntries(). - mw->d->actionOpenRecent->clear (); - - mw->d->actionOpenRecent->loadEntries (cfg->group (kpSettingsGroupRecentFiles)); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\t\tcheck recent URLs=" - << mw->d->actionOpenRecent->items () << endl; - #endif - } - } -} - -//--------------------------------------------------------------------- - - -// private slot -// TODO: Disable action if -// (d->configOpenImagesInSameWindow && d->document && d->document->isEmpty()) -// as it does nothing if this is true. -void kpMainWindow::slotNew () -{ - toolEndShape (); - - if (d->document && !d->configOpenImagesInSameWindow) - { - // A document -- empty or otherwise -- is open. - // Force open a new window. In contrast, open() might not open - // a new window in this case. - kpMainWindow *win = new kpMainWindow (); - win->show (); - } - else - { - open (KUrl (), true/*create an empty doc*/); - } -} - -//--------------------------------------------------------------------- - - -// private -QSize kpMainWindow::defaultDocSize () const -{ - // KConfig::readEntry() does not actually reread from disk, hence doesn't - // realize what other processes have done e.g. Settings / Show Path - KGlobal::config ()->reparseConfiguration (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - QSize docSize = cfg.readEntry (kpSettingLastDocSize, QSize ()); - - if (docSize.isEmpty ()) - { - docSize = QSize (400, 300); - } - else - { - // Don't get too big or you'll thrash (or even lock up) the computer - // just by opening a window - docSize = QSize (qMin (2048, docSize.width ()), - qMin (2048, docSize.height ())); - } - - return docSize; -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::saveDefaultDocSize (const QSize &size) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tCONFIG: saving Last Doc Size = " << size; -#endif - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - cfg.writeEntry (kpSettingLastDocSize, size); - cfg.sync (); -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::shouldOpen () -{ - if (d->configOpenImagesInSameWindow) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\topenImagesInSameWindow"; - #endif - // (this brings up a dialog and might save the current doc) - if (!queryCloseDocument ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tqueryCloseDocument() aborts open"; - #endif - return false; - } - } - - return true; -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setDocumentChoosingWindow (kpDocument *doc) -{ - // Want new window? - if (d->document && !d->document->isEmpty () && - !d->configOpenImagesInSameWindow) - { - // Send doc to new window. - kpMainWindow *win = new kpMainWindow (doc); - win->show (); - } - else - { - // (sets up views, doc signals) - setDocument (doc); - } -} - -//--------------------------------------------------------------------- - -// private -kpDocument *kpMainWindow::openInternal (const KUrl &url, - const QSize &fallbackDocSize, - bool newDocSameNameIfNotExist) -{ - // If using OpenImagesInSameWindow mode, ask whether to close the - // current document. - if (!shouldOpen ()) - return 0; - - // Create/open doc. - kpDocument *newDoc = new kpDocument (fallbackDocSize.width (), - fallbackDocSize.height (), - documentEnvironment ()); - if (!newDoc->open (url, newDocSameNameIfNotExist)) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\topen failed"; - #endif - delete newDoc; - return 0; - } - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\topen OK"; -#endif - // Send document to current or new window. - setDocumentChoosingWindow (newDoc); - - return newDoc; -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::open (const KUrl &url, bool newDocSameNameIfNotExist) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::open(" << url - << ",newDocSameNameIfNotExist=" << newDocSameNameIfNotExist - << ")" << endl; -#endif - - kpDocument *newDoc = openInternal (url, - defaultDocSize (), - newDocSameNameIfNotExist); - if (newDoc) - { - if (newDoc->isFromURL (false/*don't bother checking exists*/)) - addRecentURL (url); - return true; - } - else - { - return false; - } -} - -//--------------------------------------------------------------------- - -// private -KUrl::List kpMainWindow::askForOpenURLs(const QString &caption, bool allowMultipleURLs) -{ - QStringList mimeTypes = KImageIO::mimeTypes (KImageIO::Reading); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::askForURLs(allowMultiple=" - << allowMultipleURLs - << ")" << endl - << "\tmimeTypes=" << mimeTypes << endl; -#endif - QString filter = mimeTypes.join (" "); - - KFileDialog fd(KUrl("kfiledialog:///dir/"), filter, this); - fd.setCaption(caption); - fd.setOperationMode(KFileDialog::Opening); - - if (allowMultipleURLs) - fd.setMode (KFile::Files); - - if (fd.exec ()) - return fd.selectedUrls (); - else - return KUrl::List (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotOpen () -{ - toolEndShape (); - - const KUrl::List urls = askForOpenURLs(i18nc("@title:window", "Open Image")); - - for (KUrl::List::const_iterator it = urls.begin (); - it != urls.end (); - ++it) - { - open (*it); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotOpenRecent (const KUrl &url) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotOpenRecent(" << url << ")"; - kDebug () << "\titems=" << d->actionOpenRecent->items (); -#endif - - toolEndShape (); - - open (url); - - // If the open is successful, addRecentURL() would have bubbled up the - // URL in the File / Open Recent action. As a side effect, the URL is - // deselected. - // - // If the open fails, we should deselect the URL: - // - // 1. for consistency - // - // 2. because it has not been opened. - // - d->actionOpenRecent->setCurrentItem (-1); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotScan () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotScan() scanDialog=" << d->scanDialog; -#endif - - toolEndShape (); - - if (!d->scanDialog) - { - // Create scan dialog by looking for plugin. - // [takes about 500ms on 350Mhz] - d->scanDialog = KScanDialog::getScanDialog (this); - - // No scanning support (kdegraphics/libkscan) installed? - // [Remove $KDEDIR/share/servicetypes/kscan.desktop and - // $KDEDIR/share/services/scanservice.desktop to simulate this] - if (!d->scanDialog) - { - // Instead, we could try to create the scan dialog in the ctor - // and just disable the action in the first place, removing - // the need for this dialog. - // - // But this increases startup time and is a bit risky e.g. if - // the scan support hangs, KolourPaint would not be able to be - // started at all. - // - // Also, disabling the action is bad because the scan support - // can be installed while KolourPaint is still running. - KMessageBox::sorry (this, - i18n ("No plugin was found which provides the scanner dialog.\n" - "This usually means that the package providing the ksaneplugin is not installed."), - i18n ("No Scanning Support")); - return; - } - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcreated scanDialog=" << d->scanDialog; - #endif - connect (d->scanDialog, SIGNAL (finalImage (const QImage &, int)), - SLOT (slotScanned (const QImage &, int))); - } - - - // If using OpenImagesInSameWindow mode, ask whether to close the - // current document. - // - // Do this after scan support is detected. Because if it's not, what - // would be the point of closing the document? - // - // Ideally, we would do this after the user presses "Final Scan" in - // the scan dialog and before the scan begins (if the user wants to - // cancel the scan operation, it would be annoying to offer this choice - // only after the slow scan is completed) but the KScanDialog API does - // not allow this. So we settle for doing this before any - // scan dialogs are shown. We don't do this between KScanDialog::setup() - // and KScanDialog::exec() as it could be confusing alternating between - // scanning and KolourPaint dialogs. - if (!shouldOpen ()) - return; - - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcalling setup"; -#endif - // Bring up dialog to select scan device. - // If there is no scanner, we find that this does not bring up a dialog - // but still returns true. - if (d->scanDialog->setup ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tOK - showing dialog"; - #endif - // Called only if scanner configured/available. - // - // In reality, this seems to be called even if you press "Cancel" in - // the KScanDialog::setup() dialog! - // - // We use exec() to make sure it's modal. show() seems to work too - // but better safe than sorry. - d->scanDialog->exec (); - } - else - { - // Have never seen this code path execute even if "Cancel" is pressed. - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tFAIL"; - #endif - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotScanned (const QImage &image, int) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotScanned() image.rect=" << image.rect (); -#endif - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\thiding dialog"; -#endif - // (KScanDialog does not close itself after a scan is made) - // - // Close the dialog, first thing: - // - // 1. This means that any dialogs we bring up won't be nested on top. - // - // 2. We don't want to return from this method but forget to close - // the dialog. So do it before anything else. - d->scanDialog->hide (); - - // (just in case there's some drawing between slotScan() exiting and - // us being called) - toolEndShape (); - - - // TODO: Maybe this code should be moved into kpdocument.cpp - - // since it resembles the responsibilities of kpDocument::open(). - - kpDocumentSaveOptions saveOptions; - kpDocumentMetaInfo metaInfo; - - kpDocument::getDataFromImage(image, saveOptions, metaInfo); - - // Create document from image and meta info. - kpDocument *doc = new kpDocument (image.width (), image.height (), - documentEnvironment ()); - doc->setImage (image); - doc->setSaveOptions (saveOptions); - doc->setMetaInfo (metaInfo); - - // Send document to current or new window. - setDocumentChoosingWindow (doc); -} - -//--------------------------------------------------------------------- - -void kpMainWindow::slotScreenshot() -{ - toolEndShape(); - - KDialog *dialog = new KDialog(this); - dialog->setButtons(KDialog::Ok | KDialog::Cancel); - - QLabel *label = new QLabel(i18n("Snapshot Delay")); - KIntSpinBox *seconds = new KIntSpinBox; - seconds->setRange(0, 99); - seconds->setSuffix(ki18np(" second", " seconds")); - seconds->setSpecialValueText(i18n("No delay")); - - QCheckBox *hideWindow = new QCheckBox(i18n("Hide Main Window")); - hideWindow->setChecked(true); - - QVBoxLayout *vbox = new QVBoxLayout(dialog->mainWidget()); - vbox->addWidget(label); - vbox->addWidget(seconds); - vbox->addWidget(hideWindow); - - if ( dialog->exec() == KDialog::Rejected ) - { - delete dialog; - return; - } - - if ( hideWindow->isChecked() ) - hide(); - - // at least 1 seconds to make sure the window is hidden and the hide effect already stopped - QTimer::singleShot((seconds->value() + 1) * 1000, this, SLOT(slotMakeScreenshot())); - - delete dialog; -} - -//--------------------------------------------------------------------- - -void kpMainWindow::slotMakeScreenshot() -{ - QCoreApplication::processEvents(); - QPixmap pixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); - - kpDocument *doc = new kpDocument(pixmap.width(), pixmap.height(), - documentEnvironment()); - doc->setImage(pixmap.toImage()); - - // Send document to current or new window. - setDocumentChoosingWindow(doc); - - show(); // in case we hid the mainwindow, show it again -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotProperties () -{ - toolEndShape (); - - kpDocumentMetaInfoDialog dialog (document ()->metaInfo (), this); - - if (dialog.exec () && !dialog.isNoOp ()) - { - commandHistory ()->addCommand ( - new kpDocumentMetaInfoCommand ( - i18n ("Document Properties"), - dialog.metaInfo ()/*new*/, *document ()->metaInfo ()/*old*/, - commandEnvironment ())); - } -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::save (bool localOnly) -{ - if (d->document->url ().isEmpty () || - !KImageIO::mimeTypes (KImageIO::Writing) - .contains (d->document->saveOptions ()->mimeType ()) || - // SYNC: kpDocument::getPixmapFromFile() can't determine quality - // from file so it has been set initially to an invalid value. - (d->document->saveOptions ()->mimeTypeHasConfigurableQuality () && - d->document->saveOptions ()->qualityIsInvalid ()) || - (localOnly && !d->document->url ().isLocalFile ())) - { - return saveAs (localOnly); - } - else - { - if (d->document->save (false/*no overwrite prompt*/, - !d->document->savedAtLeastOnceBefore ()/*lossy prompt*/)) - { - addRecentURL (d->document->url ()); - return true; - } - else - return false; - } -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotSave () -{ - toolEndShape (); - - return save (); -} - -//--------------------------------------------------------------------- - -// private -KUrl kpMainWindow::askForSaveURL (const QString &caption, - const QString &startURL, - const kpImage &imageToBeSaved, - const kpDocumentSaveOptions &startSaveOptions, - const kpDocumentMetaInfo &docMetaInfo, - const QString &forcedSaveOptionsGroup, - bool localOnly, - kpDocumentSaveOptions *chosenSaveOptions, - bool isSavingForFirstTime, - bool *allowOverwritePrompt, - bool *allowLossyPrompt) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::askForURL() startURL=" << startURL; - startSaveOptions.printDebug ("\tstartSaveOptions"); -#endif - - bool reparsedConfiguration = false; - - // KConfig::readEntry() does not actually reread from disk, hence doesn't - // realize what other processes have done e.g. Settings / Show Path - // so reparseConfiguration() must be called -#define SETUP_READ_CFG() \ - if (!reparsedConfiguration) \ - { \ - KGlobal::config ()->reparseConfiguration (); \ - reparsedConfiguration = true; \ - } \ - \ - KConfigGroup cfg (KGlobal::config (), forcedSaveOptionsGroup); \ - - - if (chosenSaveOptions) - *chosenSaveOptions = kpDocumentSaveOptions (); - - if (allowOverwritePrompt) - *allowOverwritePrompt = true; // play it safe for now - - if (allowLossyPrompt) - *allowLossyPrompt = true; // play it safe for now - - - kpDocumentSaveOptions fdSaveOptions = startSaveOptions; - - QStringList mimeTypes = KImageIO::mimeTypes (KImageIO::Writing); -#if DEBUG_KP_MAIN_WINDOW - QStringList sortedMimeTypes = mimeTypes; - sortedMimeTypes.sort (); - kDebug () << "\tmimeTypes=" << mimeTypes - << "\tsortedMimeTypes=" << sortedMimeTypes << endl; -#endif - if (mimeTypes.isEmpty ()) - { - kError () << "No KImageIO output mimetypes!" << endl; - return KUrl (); - } - -#define MIME_TYPE_IS_VALID() (!fdSaveOptions.mimeTypeIsInvalid () && \ - mimeTypes.contains (fdSaveOptions.mimeType ())) - if (!MIME_TYPE_IS_VALID ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tmimeType=" << fdSaveOptions.mimeType () - << " not valid, get default" << endl; - #endif - - SETUP_READ_CFG (); - - fdSaveOptions.setMimeType (kpDocumentSaveOptions::defaultMimeType (cfg)); - - - if (!MIME_TYPE_IS_VALID ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tmimeType=" << fdSaveOptions.mimeType () - << " not valid, get hardcoded" << endl; - #endif - if (mimeTypes.contains ("image/png")) - fdSaveOptions.setMimeType ("image/png"); - else if (mimeTypes.contains ("image/bmp")) - fdSaveOptions.setMimeType ("image/bmp"); - else - fdSaveOptions.setMimeType (mimeTypes.first ()); - } - } -#undef MIME_TYPE_IS_VALID - - if (fdSaveOptions.colorDepthIsInvalid ()) - { - SETUP_READ_CFG (); - - fdSaveOptions.setColorDepth (kpDocumentSaveOptions::defaultColorDepth (cfg)); - fdSaveOptions.setDither (kpDocumentSaveOptions::defaultDither (cfg)); - } - - if (fdSaveOptions.qualityIsInvalid ()) - { - SETUP_READ_CFG (); - - fdSaveOptions.setQuality (kpDocumentSaveOptions::defaultQuality (cfg)); - } -#if DEBUG_KP_MAIN_WINDOW - fdSaveOptions.printDebug ("\tcorrected saveOptions passed to fileDialog"); -#endif - - kpDocumentSaveOptionsWidget *saveOptionsWidget = - new kpDocumentSaveOptionsWidget (imageToBeSaved, - fdSaveOptions, - docMetaInfo, - this); - - KFileDialog fd (startURL, QString(), this, - saveOptionsWidget); - saveOptionsWidget->setVisualParent (&fd); - fd.setCaption (caption); - fd.setOperationMode (KFileDialog::Saving); - fd.setMimeFilter (mimeTypes, fdSaveOptions.mimeType ()); - if (localOnly) - fd.setMode (KFile::File | KFile::LocalOnly); - - connect (&fd, SIGNAL (filterChanged (const QString &)), - saveOptionsWidget, SLOT (setMimeType (const QString &))); - - if ( fd.exec() == QDialog::Accepted ) - { - kpDocumentSaveOptions newSaveOptions = saveOptionsWidget->documentSaveOptions (); - #if DEBUG_KP_MAIN_WINDOW - newSaveOptions.printDebug ("\tnewSaveOptions"); - #endif - - KConfigGroup cfg (KGlobal::config (), forcedSaveOptionsGroup); - - // Save options user forced - probably want to use them in future - kpDocumentSaveOptions::saveDefaultDifferences (cfg, - fdSaveOptions, newSaveOptions); - cfg.sync (); - - - if (chosenSaveOptions) - *chosenSaveOptions = newSaveOptions; - - - bool shouldAllowOverwritePrompt = - (fd.selectedUrl () != startURL || - newSaveOptions.mimeType () != startSaveOptions.mimeType ()); - if (allowOverwritePrompt) - { - *allowOverwritePrompt = shouldAllowOverwritePrompt; - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tallowOverwritePrompt=" << *allowOverwritePrompt; - #endif - } - - if (allowLossyPrompt) - { - // SYNC: kpDocumentSaveOptions elements - everything except quality - // (one quality setting is "just as lossy" as another so no - // need to continually warn due to quality change) - *allowLossyPrompt = - (isSavingForFirstTime || - shouldAllowOverwritePrompt || - newSaveOptions.mimeType () != startSaveOptions.mimeType () || - newSaveOptions.colorDepth () != startSaveOptions.colorDepth () || - newSaveOptions.dither () != startSaveOptions.dither ()); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tallowLossyPrompt=" << *allowLossyPrompt; - #endif - } - - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tselectedUrl=" << fd.selectedUrl (); - #endif - return fd.selectedUrl (); - } - else - return KUrl (); -#undef SETUP_READ_CFG -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::saveAs (bool localOnly) -{ - kpDocumentSaveOptions chosenSaveOptions; - bool allowOverwritePrompt, allowLossyPrompt; - KUrl chosenURL = askForSaveURL (i18nc ("@title:window", "Save Image As"), - d->document->url ().url (), - d->document->imageWithSelection (), - *d->document->saveOptions (), - *d->document->metaInfo (), - kpSettingsGroupFileSaveAs, - localOnly, - &chosenSaveOptions, - !d->document->savedAtLeastOnceBefore (), - &allowOverwritePrompt, - &allowLossyPrompt); - - - if (chosenURL.isEmpty ()) - return false; - - - if (!d->document->saveAs (chosenURL, chosenSaveOptions, - allowOverwritePrompt, - allowLossyPrompt)) - { - return false; - } - - - addRecentURL (chosenURL); - - return true; -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotSaveAs () -{ - toolEndShape (); - - return saveAs (); -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotExport () -{ - toolEndShape (); - - kpDocumentSaveOptions chosenSaveOptions; - bool allowOverwritePrompt, allowLossyPrompt; - KUrl chosenURL = askForSaveURL (i18nc ("@title:window", "Export"), - d->lastExportURL.url (), - d->document->imageWithSelection (), - d->lastExportSaveOptions, - *d->document->metaInfo (), - kpSettingsGroupFileExport, - false/*allow remote files*/, - &chosenSaveOptions, - d->exportFirstTime, - &allowOverwritePrompt, - &allowLossyPrompt); - - - if (chosenURL.isEmpty ()) - return false; - - if (!kpDocument::savePixmapToFile (d->document->imageWithSelection (), - chosenURL, - chosenSaveOptions, *d->document->metaInfo (), - allowOverwritePrompt, - allowLossyPrompt, - this)) - { - return false; - } - - - addRecentURL (chosenURL); - - d->lastExportURL = chosenURL; - d->lastExportSaveOptions = chosenSaveOptions; - - d->exportFirstTime = false; - - return true; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotEnableReload () -{ - d->actionReload->setEnabled (d->document); -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotReload () -{ - toolEndShape (); - - Q_ASSERT (d->document); - - - KUrl oldURL = d->document->url (); - - - if (d->document->isModified ()) - { - int result = KMessageBox::Cancel; - - if (d->document->isFromURL (false/*don't bother checking exists*/) && !oldURL.isEmpty ()) - { - result = KMessageBox::warningContinueCancel (this, - i18n ("The document \"%1\" has been modified.\n" - "Reloading will lose all changes since you last saved it.\n" - "Are you sure?", - d->document->prettyFilename ()), - QString()/*caption*/, - KGuiItem(i18n ("&Reload"))); - } - else - { - result = KMessageBox::warningContinueCancel (this, - i18n ("The document \"%1\" has been modified.\n" - "Reloading will lose all changes.\n" - "Are you sure?", - d->document->prettyFilename ()), - QString()/*caption*/, - KGuiItem(i18n ("&Reload"))); - } - - if (result != KMessageBox::Continue) - return false; - } - - - kpDocument *doc = 0; - - // If it's _supposed to_ come from a URL or it exists - if (d->document->isFromURL (false/*don't bother checking exists*/) || - (!oldURL.isEmpty () && KIO::NetAccess::exists (oldURL, KIO::NetAccess::SourceSide/*open*/, this))) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotReload() reloading from disk!"; - #endif - - doc = new kpDocument (1, 1, documentEnvironment ()); - if (!doc->open (oldURL)) - { - delete doc; doc = 0; - return false; - } - - addRecentURL (oldURL); - } - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotReload() create doc"; - #endif - - doc = new kpDocument (d->document->constructorWidth (), - d->document->constructorHeight (), - documentEnvironment ()); - doc->setURL (oldURL, false/*not from URL*/); - } - - - setDocument (doc); - - return true; -} - - -// private -void kpMainWindow::sendDocumentNameToPrinter (QPrinter *printer) -{ - KUrl url = d->document->url (); - if (!url.isEmpty ()) - { - int dot; - - QString fileName = url.fileName (); - dot = fileName.lastIndexOf ('.'); - - // file.ext but not .hidden-file? - if (dot > 0) - fileName.truncate (dot); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::sendDocumentNameToPrinter() fileName=" - << fileName - << " dir=" - << url.directory () - << endl; - #endif - printer->setDocName (fileName); - } -} - - -// private -void kpMainWindow::sendImageToPrinter (QPrinter *printer, - bool showPrinterSetupDialog) -{ - // Get image to be printed. - kpImage image = d->document->imageWithSelection (); - - - // Get image DPI. - double imageDotsPerMeterX = - double (d->document->metaInfo ()->dotsPerMeterX ()); - double imageDotsPerMeterY = - double (d->document->metaInfo ()->dotsPerMeterY ()); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::sendImageToPrinter() image:" - << " width=" << image.width () - << " height=" << image.height () - << " dotsPerMeterX=" << imageDotsPerMeterX - << " dotsPerMeterY=" << imageDotsPerMeterY - << endl; -#endif - - // Image DPI invalid (e.g. new image, could not read from file - // or Qt3 doesn't implement DPI for JPEG)? - if (imageDotsPerMeterX <= 0 || imageDotsPerMeterY <= 0) - { - // Even if just one DPI dimension is invalid, mutate both DPI - // dimensions as we have no information about the intended - // aspect ratio anyway (and other dimension likely to be invalid). - - // When rendering text onto a document, the fonts are rasterised - // according to the screen's DPI. - // TODO: I think we should use the image's DPI. Technically - // possible? - // - // So no matter what computer you draw text on, you get - // the same pixels. - // - // So we must print at the screen's DPI to get the right text size. - // - // Unfortunately, this means that moving to a different screen DPI - // affects printing. If you edited the image at a different screen - // DPI than when you print, you get incorrect results. Furthermore, - // this is bogus if you don't have text in your image. Worse still, - // what if you have multiple screens connected to the same computer - // with different DPIs? - // TODO: mysteriously, someone else is setting this to 96dpi always. - QPixmap arbitraryScreenElement(1, 1); - const QPaintDevice *screenDevice = &arbitraryScreenElement; - const int dpiX = screenDevice->logicalDpiX (), - dpiY = screenDevice->logicalDpiY (); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tusing screen dpi: x=" << dpiX << " y=" << dpiY; - #endif - - imageDotsPerMeterX = dpiX * KP_INCHES_PER_METER; - imageDotsPerMeterY = dpiY * KP_INCHES_PER_METER; - } - - - // Get page size (excluding margins). - // Coordinate (0,0) is the X here: - // mmmmm - // mX m - // m m m = margin - // m m - // mmmmm - const int printerWidthMM = printer->widthMM (); - const int printerHeightMM = printer->heightMM (); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tprinter: widthMM=" << printerWidthMM - << " heightMM=" << printerHeightMM - << endl; -#endif - - - double dpiX = imageDotsPerMeterX / KP_INCHES_PER_METER; - double dpiY = imageDotsPerMeterY / KP_INCHES_PER_METER; -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\timage: dpiX=" << dpiX << " dpiY=" << dpiY; -#endif - - - // - // If image doesn't fit on page at intended DPI, change the DPI. - // - - const double scaleDpiX = - (image.width () / (printerWidthMM / KP_MILLIMETERS_PER_INCH)) - / dpiX; - const double scaleDpiY = - (image.height () / (printerHeightMM / KP_MILLIMETERS_PER_INCH)) - / dpiY; - const double scaleDpi = qMax (scaleDpiX, scaleDpiY); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tscaleDpi: x=" << scaleDpiX << " y=" << scaleDpiY - << " --> scale at " << scaleDpi << " to fit?" - << endl; -#endif - - // Need to increase resolution to fit page? - if (scaleDpi > 1.0) - { - dpiX *= scaleDpi; - dpiY *= scaleDpi; - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\t\tto fit page, scaled to:" - << " dpiX=" << dpiX << " dpiY=" << dpiY << endl; - #endif - } - - - // Make sure DPIs are equal as that's all QPrinter::setResolution() - // supports. We do this in such a way that we only ever stretch an - // image, to avoid losing information. Don't antialias as the printer - // will do that to translate our DPI to its physical resolution and - // double-antialiasing looks bad. - if (dpiX > dpiY) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdpiX > dpiY; stretching image height to equalise DPIs to dpiX=" - << dpiX << endl; - #endif - kpPixmapFX::scale (&image, - image.width (), - qMax (1, qRound (image.height () * dpiX / dpiY)), - false/*don't antialias*/); - - dpiY = dpiX; - } - else if (dpiY > dpiX) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdpiY > dpiX; stretching image width to equalise DPIs to dpiY=" - << dpiY << endl; - #endif - kpPixmapFX::scale (&image, - qMax (1, qRound (image.width () * dpiY / dpiX)), - image.height (), - false/*don't antialias*/); - - dpiX = dpiY; - } - - Q_ASSERT (dpiX == dpiY); - - - // QPrinter::setResolution() has to be called before QPrinter::setup(). - printer->setResolution (qMax (1, qRound (dpiX))); - - - sendDocumentNameToPrinter (printer); - - - if (showPrinterSetupDialog) - { - kpPrintDialogPage *optionsPage = new kpPrintDialogPage (this); - optionsPage->setPrintImageCenteredOnPage (d->configPrintImageCenteredOnPage); - - QPrintDialog *printDialog = - KdePrint::createPrintDialog ( - printer, - QList () << optionsPage, - this); - printDialog->setWindowTitle (i18nc ("@title:window", "Print Image")); - - // Display dialog. - const bool wantToPrint = printDialog->exec (); - - if (optionsPage->printImageCenteredOnPage () != - d->configPrintImageCenteredOnPage) - { - // Save config option even if the dialog was cancelled. - d->configPrintImageCenteredOnPage = optionsPage->printImageCenteredOnPage (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - cfg.writeEntry (kpSettingPrintImageCenteredOnPage, - d->configPrintImageCenteredOnPage); - cfg.sync (); - } - - delete printDialog; - - if (!wantToPrint) - return; - } - - - double originX = 0, originY = 0; - - // Center image on page? - if (d->configPrintImageCenteredOnPage) - { - originX = - (printerWidthMM * dpiX / KP_MILLIMETERS_PER_INCH - image.width ()) - / 2; - originY = - (printerHeightMM * dpiY / KP_MILLIMETERS_PER_INCH - image.height ()) - / 2; - } - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\torigin: x=" << originX << " y=" << originY; -#endif - - - // Send image to printer. - QPainter painter; - painter.begin (printer); - painter.drawImage (qRound (originX), qRound (originY), image); - painter.end (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotPrint () -{ - toolEndShape (); - - QPrinter printer; - - sendImageToPrinter (&printer, true/*showPrinterSetupDialog*/); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotPrintPreview () -{ - toolEndShape (); - - QPrinter printer; - - KPrintPreview printPreview (&printer); - - sendImageToPrinter (&printer, false/*don't showPrinterSetupDialog*/); - - printPreview.exec (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotMail () -{ - toolEndShape (); - - if (d->document->url ().isEmpty ()/*no name*/ || - !d->document->isFromURL () || - d->document->isModified ()/*needs to be saved*/) - { - int result = KMessageBox::questionYesNo (this, - i18n ("You must save this image before sending it.\n" - "Do you want to save it?"), - QString(), - KStandardGuiItem::save (), KStandardGuiItem::cancel ()); - - if (result == KMessageBox::Yes) - { - if (!save ()) - { - // save failed or aborted - don't email - return; - } - } - else - { - // don't want to save - don't email - return; - } - } - - KToolInvocation::invokeMailer ( - QString()/*to*/, - QString()/*cc*/, - QString()/*bcc*/, - d->document->prettyFilename()/*subject*/, - QString()/*body*/, - QString()/*messageFile*/, - QStringList(d->document->url().url())/*attachments*/); -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::queryCloseDocument () -{ - toolEndShape (); - - if (!d->document || !d->document->isModified ()) - return true; // ok to close current doc - - int result = KMessageBox::warningYesNoCancel (this, - i18n ("The document \"%1\" has been modified.\n" - "Do you want to save it?", - d->document->prettyFilename ()), - QString()/*caption*/, - KStandardGuiItem::save (), KStandardGuiItem::discard ()); - - switch (result) - { - case KMessageBox::Yes: - return slotSave (); // close only if save succeeds - case KMessageBox::No: - return true; // close without saving - default: - return false; // don't close current doc - } -} - -//--------------------------------------------------------------------- - -// private virtual [base KMainWindow] -bool kpMainWindow::queryClose () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::queryClose()"; -#endif - toolEndShape (); - - if (!queryCloseDocument ()) - return false; - - if (!queryCloseColors ()) - return false; - - return true; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotClose () -{ - toolEndShape (); - - if (!queryCloseDocument ()) - return; - - setDocument (0); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotQuit () -{ - toolEndShape (); - - close (); // will call queryClose() -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/mainWindow/kpMainWindow_Image.cpp b/kolourpaint/mainWindow/kpMainWindow_Image.cpp deleted file mode 100644 index 2dd1b94d..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Image.cpp +++ /dev/null @@ -1,595 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//--------------------------------------------------------------------- - -// private -kpTransformDialogEnvironment *kpMainWindow::transformDialogEnvironment () -{ - if (!d->transformDialogEnvironment) - d->transformDialogEnvironment = new kpTransformDialogEnvironment (this); - - return d->transformDialogEnvironment; -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::isSelectionActive () const -{ - return (d->document ? bool (d->document->selection ()) : false); -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::isTextSelection () const -{ - return (d->document && d->document->textSelection ()); -} - -//--------------------------------------------------------------------- - -// private -QString kpMainWindow::autoCropText () const -{ - return kpTransformAutoCropCommand::text(isSelectionActive(), - kpTransformAutoCropCommand::ShowAccel); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupImageMenuActions () -{ - KActionCollection *ac = actionCollection (); - - d->actionResizeScale = ac->addAction ("image_resize_scale"); - d->actionResizeScale->setText (i18n ("R&esize / Scale...")); - connect (d->actionResizeScale, SIGNAL (triggered (bool)), SLOT (slotResizeScale ())); - d->actionResizeScale->setShortcut(Qt::CTRL + Qt::Key_E); - - d->actionCrop = ac->addAction ("image_crop"); - d->actionCrop->setText (i18n ("Se&t as Image (Crop)")); - connect (d->actionCrop, SIGNAL (triggered (bool)), SLOT (slotCrop ())); - d->actionCrop->setShortcut(Qt::CTRL + Qt::Key_T); - - d->actionAutoCrop = ac->addAction ("image_auto_crop"); - d->actionAutoCrop->setText (autoCropText ()); - connect (d->actionAutoCrop, SIGNAL (triggered (bool)), SLOT (slotAutoCrop ())); - d->actionAutoCrop->setShortcut(Qt::CTRL + Qt::Key_U); - - d->actionFlip = ac->addAction ("image_flip"); - d->actionFlip->setText (i18n ("&Flip (upside down)")); - connect (d->actionFlip, SIGNAL (triggered (bool)), SLOT (slotFlip ())); - d->actionFlip->setShortcut(Qt::CTRL + Qt::Key_F); - - d->actionMirror = ac->addAction ("image_mirror"); - d->actionMirror->setText (i18n ("Mirror (horizontally)")); - connect (d->actionMirror, SIGNAL (triggered (bool)), SLOT (slotMirror ())); - //d->actionMirror->setShortcut(Qt::CTRL + Qt::Key_M); - - d->actionRotate = ac->addAction ("image_rotate"); - d->actionRotate->setText (i18n ("&Rotate...")); - d->actionRotate->setIcon (KIcon ("transform-rotate")); - connect (d->actionRotate, SIGNAL (triggered (bool)), SLOT (slotRotate ())); - d->actionRotate->setShortcut(Qt::CTRL + Qt::Key_R); - - d->actionRotateLeft = ac->addAction ("image_rotate_270deg"); - d->actionRotateLeft->setText (i18n ("Rotate &Left")); - d->actionRotateLeft->setIcon (KIcon ("object-rotate-left")); - connect (d->actionRotateLeft, SIGNAL (triggered (bool)), SLOT (slotRotate270 ())); - d->actionRotateLeft->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Left); - - d->actionRotateRight = ac->addAction ("image_rotate_90deg"); - d->actionRotateRight->setText (i18n ("Rotate Righ&t")); - d->actionRotateRight->setIcon (KIcon ("object-rotate-right")); - connect (d->actionRotateRight, SIGNAL (triggered (bool)), SLOT (slotRotate90 ())); - d->actionRotateRight->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Right); - - d->actionSkew = ac->addAction ("image_skew"); - d->actionSkew->setText (i18n ("S&kew...")); - connect (d->actionSkew, SIGNAL (triggered (bool)), SLOT (slotSkew ())); - d->actionSkew->setShortcut(Qt::CTRL + Qt::Key_K); - - d->actionConvertToBlackAndWhite = ac->addAction ("image_convert_to_black_and_white"); - d->actionConvertToBlackAndWhite->setText (i18n ("Reduce to Mo&nochrome (Dithered)")); - connect (d->actionConvertToBlackAndWhite, SIGNAL (triggered (bool)), SLOT (slotConvertToBlackAndWhite ())); - - d->actionConvertToGrayscale = ac->addAction ("image_convert_to_grayscale"); - d->actionConvertToGrayscale->setText (i18n ("Reduce to &Grayscale")); - connect (d->actionConvertToGrayscale, SIGNAL (triggered (bool)), SLOT (slotConvertToGrayscale ())); - - d->actionInvertColors = ac->addAction ("image_invert_colors"); - d->actionInvertColors->setText (i18n ("&Invert Colors")); - connect (d->actionInvertColors, SIGNAL (triggered (bool)), SLOT (slotInvertColors ())); - d->actionInvertColors->setShortcut(Qt::CTRL + Qt::Key_I); - - d->actionClear = ac->addAction ("image_clear"); - d->actionClear->setText (i18n ("C&lear")); - connect (d->actionClear, SIGNAL (triggered (bool)), SLOT (slotClear ())); - d->actionClear->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N); - - d->actionMoreEffects = ac->addAction ("image_more_effects"); - d->actionMoreEffects->setText (i18n ("&More Effects...")); - connect (d->actionMoreEffects, SIGNAL (triggered (bool)), SLOT (slotMoreEffects ())); - d->actionMoreEffects->setShortcut(Qt::CTRL + Qt::Key_M); - - - enableImageMenuDocumentActions (false); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableImageMenuDocumentActions (bool enable) -{ - d->actionResizeScale->setEnabled (enable); - d->actionCrop->setEnabled (enable); - d->actionAutoCrop->setEnabled (enable); - d->actionFlip->setEnabled (enable); - d->actionMirror->setEnabled (enable); - d->actionRotate->setEnabled (enable); - d->actionRotateLeft->setEnabled (enable); - d->actionRotateRight->setEnabled (enable); - d->actionSkew->setEnabled (enable); - d->actionConvertToBlackAndWhite->setEnabled (enable); - d->actionConvertToGrayscale->setEnabled (enable); - d->actionInvertColors->setEnabled (enable); - d->actionClear->setEnabled (enable); - d->actionMoreEffects->setEnabled (enable); - - d->imageMenuDocumentActionsEnabled = enable; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotImageMenuUpdateDueToSelection () -{ - // SYNC: kolourpaintui.rc - const QString MenuBarItemTextImage = i18nc ( - "Image/Selection Menu caption - make sure the translation has" - " the same accel as the Select&ion translation", - "&Image"); - const QString MenuBarItemTextSelection = i18nc ( - "Image/Selection Menu caption - make sure that translation has" - " the same accel as the &Image translation", - "Select&ion"); - - Q_ASSERT (menuBar ()); - foreach (QAction *action, menuBar ()->actions ()) - { - if (action->text () == MenuBarItemTextImage || - action->text () == MenuBarItemTextSelection) - { - if (isSelectionActive ()) - action->setText (MenuBarItemTextSelection); - else - action->setText (MenuBarItemTextImage); - - break; - } - } - - - d->actionResizeScale->setEnabled (d->imageMenuDocumentActionsEnabled); - d->actionCrop->setEnabled (d->imageMenuDocumentActionsEnabled && - isSelectionActive ()); - - const bool enable = (d->imageMenuDocumentActionsEnabled && !isTextSelection ()); - d->actionAutoCrop->setText (autoCropText ()); - d->actionAutoCrop->setEnabled (enable); - d->actionFlip->setEnabled (enable); - d->actionMirror->setEnabled (enable); - d->actionRotate->setEnabled (enable); - d->actionRotateLeft->setEnabled (enable); - d->actionRotateRight->setEnabled (enable); - d->actionSkew->setEnabled (enable); - d->actionConvertToBlackAndWhite->setEnabled (enable); - d->actionConvertToGrayscale->setEnabled (enable); - d->actionInvertColors->setEnabled (enable); - d->actionClear->setEnabled (enable); - d->actionMoreEffects->setEnabled (enable); -} - -//--------------------------------------------------------------------- - -// public -kpColor kpMainWindow::backgroundColor (bool ofSelection) const -{ - if (ofSelection) - return kpColor::Transparent; - else - { - Q_ASSERT (d->colorToolBar); - return d->colorToolBar->backgroundColor (); - } -} - -//--------------------------------------------------------------------- - -// public -// REFACTOR: sync: Code dup with kpAbstractSelectionTool::addNeedingContentCommand(). -void kpMainWindow::addImageOrSelectionCommand (kpCommand *cmd, - bool addSelCreateCmdIfSelAvail, - bool addSelContentCmdIfSelAvail) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::addImageOrSelectionCommand()" - << " addSelCreateCmdIfSelAvail=" << addSelCreateCmdIfSelAvail - << " addSelContentCmdIfSelAvail=" << addSelContentCmdIfSelAvail - << endl; -#endif - - Q_ASSERT (d->document); - - - if (d->viewManager) - d->viewManager->setQueueUpdates (); - - - kpAbstractSelection *sel = d->document->selection (); -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\timage sel=" << sel - << " sel->hasContent=" << (sel ? sel->hasContent () : 0) - << endl; -#endif - if (addSelCreateCmdIfSelAvail && sel && !sel->hasContent ()) - { - QString createCmdName; - - if (dynamic_cast (sel)) - createCmdName = i18n ("Selection: Create"); - else if (dynamic_cast (sel)) - createCmdName = i18n ("Text: Create Box"); - else - Q_ASSERT (!"Unknown selection type"); - - // create selection region - commandHistory ()->addCreateSelectionCommand ( - new kpToolSelectionCreateCommand ( - createCmdName, - *sel, - commandEnvironment ()), - false/*no exec - user already dragged out sel*/); - } - - - if (addSelContentCmdIfSelAvail && sel && !sel->hasContent ()) - { - kpAbstractImageSelection *imageSel = - dynamic_cast (sel); - kpTextSelection *textSel = - dynamic_cast (sel); - - if (imageSel && imageSel->transparency ().isTransparent ()) - d->colorToolBar->flashColorSimilarityToolBarItem (); - - kpMacroCommand *macroCmd = new kpMacroCommand (cmd->name (), - commandEnvironment ()); - - if (imageSel) - { - macroCmd->addCommand ( - new kpToolSelectionPullFromDocumentCommand ( - *imageSel, - backgroundColor (), - QString()/*uninteresting child of macro cmd*/, - commandEnvironment ())); - } - else if (textSel) - { - macroCmd->addCommand ( - new kpToolTextGiveContentCommand ( - *textSel, - QString()/*uninteresting child of macro cmd*/, - commandEnvironment ())); - } - else - Q_ASSERT (!"Unknown selection type"); - - macroCmd->addCommand (cmd); - - d->commandHistory->addCommand (macroCmd); - } - else - { - d->commandHistory->addCommand (cmd); - } - - - if (d->viewManager) - d->viewManager->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotResizeScale () -{ - toolEndShape (); - - kpTransformResizeScaleDialog dialog(transformDialogEnvironment(), this); - - if (dialog.exec () && !dialog.isNoOp ()) - { - kpTransformResizeScaleCommand *cmd = new kpTransformResizeScaleCommand ( - dialog.actOnSelection (), - dialog.imageWidth (), dialog.imageHeight (), - dialog.type (), - commandEnvironment ()); - - bool addSelCreateCommand = (dialog.actOnSelection () || - cmd->scaleSelectionWithImage ()); - bool addSelContentCommand = dialog.actOnSelection (); - - addImageOrSelectionCommand ( - cmd, - addSelCreateCommand, - addSelContentCommand); - - // Resized document? - if (!dialog.actOnSelection () && - dialog.type () == kpTransformResizeScaleCommand::Resize) - { - // TODO: this should be the responsibility of kpDocument - saveDefaultDocSize (QSize (dialog.imageWidth (), dialog.imageHeight ())); - } - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotCrop () -{ - toolEndShape (); - - Q_ASSERT (d->document && d->document->selection ()); - - - ::kpTransformCrop (this); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotAutoCrop () -{ - toolEndShape (); - - ::kpTransformAutoCrop (this); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotFlip() -{ - toolEndShape(); - - addImageOrSelectionCommand( - new kpTransformFlipCommand(d->document->selection(), - false, true, commandEnvironment())); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotMirror() -{ - toolEndShape(); - - addImageOrSelectionCommand( - new kpTransformFlipCommand(d->document->selection(), - true, false, commandEnvironment())); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotRotate () -{ - toolEndShape (); - - kpTransformRotateDialog dialog ((bool) d->document->selection (), - transformDialogEnvironment (), this); - - if (dialog.exec () && !dialog.isNoOp ()) - { - addImageOrSelectionCommand ( - new kpTransformRotateCommand (d->document->selection (), - dialog.angle (), - commandEnvironment ())); - } -} - -// private slot -void kpMainWindow::slotRotate270 () -{ - toolEndShape (); - - // TODO: Special command name instead of just "Rotate"? - addImageOrSelectionCommand ( - new kpTransformRotateCommand ( - d->document->selection (), - 270, - commandEnvironment ())); -} - -// private slot -void kpMainWindow::slotRotate90 () -{ - toolEndShape (); - - // TODO: Special command name instead of just "Rotate"? - addImageOrSelectionCommand ( - new kpTransformRotateCommand ( - d->document->selection (), - 90, - commandEnvironment ())); -} - - -// private slot -void kpMainWindow::slotSkew () -{ - toolEndShape (); - - kpTransformSkewDialog dialog ((bool) d->document->selection (), - transformDialogEnvironment (), this); - - if (dialog.exec () && !dialog.isNoOp ()) - { - addImageOrSelectionCommand ( - new kpTransformSkewCommand (d->document->selection (), - dialog.horizontalAngle (), dialog.verticalAngle (), - commandEnvironment ())); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotConvertToBlackAndWhite () -{ - toolEndShape (); - - addImageOrSelectionCommand ( - new kpEffectReduceColorsCommand (1/*depth*/, true/*dither*/, - d->document->selection (), - commandEnvironment ())); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotConvertToGrayscale () -{ - toolEndShape (); - - addImageOrSelectionCommand ( - new kpEffectGrayscaleCommand (d->document->selection (), - commandEnvironment ())); -} - -// private slot -void kpMainWindow::slotInvertColors () -{ - toolEndShape (); - - addImageOrSelectionCommand ( - new kpEffectInvertCommand (d->document->selection (), - commandEnvironment ())); -} - -// private slot -void kpMainWindow::slotClear () -{ - toolEndShape (); - - addImageOrSelectionCommand ( - new kpEffectClearCommand ( - d->document->selection (), - backgroundColor (), - commandEnvironment ())); -} - -// private slot -void kpMainWindow::slotMoreEffects () -{ - toolEndShape (); - - kpEffectsDialog dialog ((bool) d->document->selection (), - transformDialogEnvironment (), this, - d->moreEffectsDialogLastEffect); - - if (dialog.exec () && !dialog.isNoOp ()) - { - addImageOrSelectionCommand (dialog.createCommand ()); - } - - - if (d->moreEffectsDialogLastEffect != dialog.selectedEffect ()) - { - d->moreEffectsDialogLastEffect = dialog.selectedEffect (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - cfg.writeEntry (kpSettingMoreEffectsLastEffect, - d->moreEffectsDialogLastEffect); - cfg.sync (); - } -} diff --git a/kolourpaint/mainWindow/kpMainWindow_Settings.cpp b/kolourpaint/mainWindow/kpMainWindow_Settings.cpp deleted file mode 100644 index 889306ff..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Settings.cpp +++ /dev/null @@ -1,145 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupSettingsMenuActions () -{ - KActionCollection *ac = actionCollection (); - - - // Settings/Toolbars |> %s - setStandardToolBarMenuEnabled (true); - - // Settings/Show Statusbar - createStandardStatusBarAction (); - - - d->actionFullScreen = KStandardAction::fullScreen (this, SLOT (slotFullScreen ()), - this/*window*/, ac); - - - d->actionShowPath = ac->add ("settings_show_path"); - d->actionShowPath->setText (i18n ("Show &Path")); - connect(d->actionShowPath, SIGNAL(triggered(bool) ), SLOT (slotShowPathToggled ())); - //d->actionShowPath->setCheckedState (KGuiItem(i18n ("Hide &Path"))); - slotEnableSettingsShowPath (); - - - d->actionKeyBindings = KStandardAction::keyBindings (this, SLOT (slotKeyBindings ()), ac); - - KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection()); - - enableSettingsMenuDocumentActions (false); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableSettingsMenuDocumentActions (bool /*enable*/) -{ -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotFullScreen () -{ - KToggleFullScreenAction::setFullScreen( this, d->actionFullScreen->isChecked ()); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotEnableSettingsShowPath () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotEnableSettingsShowPath()"; -#endif - - const bool enable = (d->document && !d->document->url ().isEmpty ()); - - d->actionShowPath->setEnabled (enable); - d->actionShowPath->setChecked (enable && d->configShowPath); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotShowPathToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotShowPathToggled()"; -#endif - - d->configShowPath = d->actionShowPath->isChecked (); - - slotUpdateCaption (); - - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - cfg.writeEntry (kpSettingShowPath, d->configShowPath); - cfg.sync (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotKeyBindings () -{ - toolEndShape (); - - if (KShortcutsDialog::configure (actionCollection (), - KShortcutsEditor::LetterShortcutsAllowed, - this)) - { - // TODO: PROPAGATE: thru mainWindow's and interprocess - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/mainWindow/kpMainWindow_StatusBar.cpp b/kolourpaint/mainWindow/kpMainWindow_StatusBar.cpp deleted file mode 100644 index d91e4db2..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_StatusBar.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_STATUS_BAR (DEBUG_KP_MAIN_WINDOW && 0) - - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::addPermanentStatusBarItem (int id, int maxTextLen) -{ - KStatusBar *sb = statusBar (); - - QString textWithMaxLen; - textWithMaxLen.fill (QString::number (8/*big fat*/).at (0), - maxTextLen); //+ 2/*spaces on either side*/); - - // Permanent --> place on the right - sb->insertPermanentFixedItem (textWithMaxLen, id); - sb->changeItem (QString(), id); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::createStatusBar () -{ - KStatusBar *sb = statusBar (); - - // 9999 pixels "ought to be enough for anybody" - const int maxDimenLength = 4; - - d->statusBarMessageLabel = new KSqueezedTextLabel(sb); - // this is done to have the same height as the other labels in status bar; done like in kstatusbar.cpp - d->statusBarMessageLabel->setFixedHeight(d->statusBarMessageLabel->fontMetrics().height() + 2); - d->statusBarMessageLabel->setTextElideMode(Qt::ElideRight); // this is the reason why we explicitly set a widget - sb->addWidget(d->statusBarMessageLabel, 1/*stretch*/); - - addPermanentStatusBarItem (StatusBarItemShapePoints, - (maxDimenLength + 1/*,*/ + maxDimenLength) * 2 + 3/* - */); - addPermanentStatusBarItem (StatusBarItemShapeSize, - (1/*+/-*/ + maxDimenLength) * 2 + 1/*x*/); - - QString numSample = i18n("%1 x %2", 5000, 5000); // localized string; can e.g. be "5 000" - addPermanentStatusBarItem(StatusBarItemDocSize, numSample.length()); - - addPermanentStatusBarItem(StatusBarItemDocDepth, 5/*XXbpp*/); - - addPermanentStatusBarItem (StatusBarItemZoom, - 5/*1600%*/); - - d->statusBarShapeLastPointsInitialised = false; - d->statusBarShapeLastSizeInitialised = false; - d->statusBarCreated = true; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarMessage (const QString &message) -{ -#if DEBUG_STATUS_BAR && 1 - kDebug () << "kpMainWindow::setStatusBarMessage(" - << message - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - d->statusBarMessageLabel->setText (message); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarShapePoints (const QPoint &startPoint, - const QPoint &endPoint) -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::setStatusBarShapePoints(" - << startPoint << "," << endPoint - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - if (d->statusBarShapeLastPointsInitialised && - startPoint == d->statusBarShapeLastStartPoint && - endPoint == d->statusBarShapeLastEndPoint) - { - #if DEBUG_STATUS_BAR && 0 - kDebug () << "\tNOP"; - #endif - return; - } - - if (startPoint == KP_INVALID_POINT) - { - statusBar ()->changeItem (QString(), StatusBarItemShapePoints); - } - else if (endPoint == KP_INVALID_POINT) - { - statusBar ()->changeItem (i18n ("%1,%2", - startPoint.x (), - startPoint.y ()), - StatusBarItemShapePoints); - } - else - { - statusBar ()->changeItem (i18n ("%1,%2 - %3,%4", - startPoint.x (), - startPoint.y (), - endPoint.x (), - endPoint.y ()), - StatusBarItemShapePoints); - } - - d->statusBarShapeLastStartPoint = startPoint; - d->statusBarShapeLastEndPoint = endPoint; - d->statusBarShapeLastPointsInitialised = true; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarShapeSize (const QSize &size) -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::setStatusBarShapeSize(" - << size - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - if (d->statusBarShapeLastSizeInitialised && - size == d->statusBarShapeLastSize) - { - #if DEBUG_STATUS_BAR && 0 - kDebug () << "\tNOP"; - #endif - return; - } - - if (size == KP_INVALID_SIZE) - { - statusBar ()->changeItem (QString(), StatusBarItemShapeSize); - } - else - { - statusBar ()->changeItem (i18n ("%1x%2", - size.width (), - size.height ()), - StatusBarItemShapeSize); - } - - d->statusBarShapeLastSize = size; - d->statusBarShapeLastSizeInitialised = true; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarDocSize (const QSize &size) -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::setStatusBarDocSize(" - << size - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - if (size == KP_INVALID_SIZE) - { - statusBar ()->changeItem (QString(), StatusBarItemDocSize); - } - else - { - statusBar ()->changeItem (i18n ("%1 x %2", - size.width (), - size.height ()), - StatusBarItemDocSize); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarDocDepth (int depth) -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::setStatusBarDocDepth(" - << depth - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - if (depth <= 0) - { - statusBar ()->changeItem (QString(), StatusBarItemDocDepth); - } - else - { - statusBar ()->changeItem (i18n ("%1bpp", depth), - StatusBarItemDocDepth); - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::setStatusBarZoom (int zoom) -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::setStatusBarZoom(" - << zoom - << ") ok=" << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - if (zoom <= 0) - { - statusBar ()->changeItem (QString(), StatusBarItemZoom); - } - else - { - statusBar ()->changeItem (i18n ("%1%", zoom), - StatusBarItemZoom); - } -} - -//--------------------------------------------------------------------- - -void kpMainWindow::recalculateStatusBarMessage () -{ -#if DEBUG_STATUS_BAR && 1 - kDebug () << "kpMainWindow::recalculateStatusBarMessage()"; -#endif - QString scrollViewMessage = d->scrollView->statusMessage (); -#if DEBUG_STATUS_BAR && 1 - kDebug () << "\tscrollViewMessage=" << scrollViewMessage; - kDebug () << "\tresizing doc? " << !d->scrollView->newDocSize ().isEmpty () - << endl; - kDebug () << "\tviewUnderCursor? " - << (d->viewManager && d->viewManager->viewUnderCursor ()) - << endl; -#endif - - // HACK: To work around kpViewScrollableContainer's unreliable - // status messages (which in turn is due to Qt not updating - // QWidget::underMouse() on drags and we needing to hack around it) - if (!scrollViewMessage.isEmpty () && - d->scrollView->newDocSize ().isEmpty () && - d->viewManager && d->viewManager->viewUnderCursor ()) - { - #if DEBUG_STATUS_BAR && 1 - kDebug () << "\t\tnot resizing & viewUnderCursor - message is wrong - clearing" - << endl; - #endif - d->scrollView->blockSignals (true); - d->scrollView->clearStatusMessage (); - d->scrollView->blockSignals (false); - - scrollViewMessage.clear (); - #if DEBUG_STATUS_BAR && 1 - kDebug () << "\t\t\tdone"; - #endif - } - - if (!scrollViewMessage.isEmpty ()) - { - setStatusBarMessage (scrollViewMessage); - } - else - { - const kpTool *t = tool (); - if (t) - { - setStatusBarMessage (t->userMessage ()); - } - else - { - setStatusBarMessage (); - } - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::recalculateStatusBarShape () -{ -#if DEBUG_STATUS_BAR && 0 - kDebug () << "kpMainWindow::recalculateStatusBarShape()"; -#endif - - QSize docResizeTo = d->scrollView->newDocSize (); -#if DEBUG_STATUS_BAR && 0 - kDebug () << "\tdocResizeTo=" << docResizeTo; -#endif - if (docResizeTo.isValid ()) - { - const QPoint startPoint (d->document->width (), d->document->height ()); - #if DEBUG_STATUS_BAR && 0 - kDebug () << "\thavedMovedFromOrgSize=" - << d->scrollView->haveMovedFromOriginalDocSize () << endl; - #endif - if (!d->scrollView->haveMovedFromOriginalDocSize ()) - { - setStatusBarShapePoints (startPoint); - setStatusBarShapeSize (); - } - else - { - const int newWidth = docResizeTo.width (); - const int newHeight = docResizeTo.height (); - - setStatusBarShapePoints (startPoint, QPoint (newWidth, newHeight)); - const QPoint sizeAsPoint (QPoint (newWidth, newHeight) - startPoint); - setStatusBarShapeSize (QSize (sizeAsPoint.x (), sizeAsPoint.y ())); - } - } - else - { - const kpTool *t = tool (); - #if DEBUG_STATUS_BAR && 0 - kDebug () << "\ttool=" << t; - #endif - if (t) - { - setStatusBarShapePoints (t->userShapeStartPoint (), - t->userShapeEndPoint ()); - setStatusBarShapeSize (t->userShapeSize ()); - } - else - { - setStatusBarShapePoints (); - setStatusBarShapeSize (); - } - } -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::recalculateStatusBar () -{ -#if DEBUG_STATUS_BAR && 1 - kDebug () << "kpMainWindow::recalculateStatusBar() ok=" - << d->statusBarCreated - << endl; -#endif - - if (!d->statusBarCreated) - return; - - recalculateStatusBarMessage (); - recalculateStatusBarShape (); - - if (d->document) - { - setStatusBarDocSize (QSize (d->document->width (), d->document->height ())); - setStatusBarDocDepth (d->document->image ().depth ()); - } - else - { - setStatusBarDocSize (); - setStatusBarDocDepth (); - } - - if (d->mainView) - { - setStatusBarZoom (d->mainView->zoomLevelX ()); - } - else - { - setStatusBarZoom (); - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/mainWindow/kpMainWindow_Text.cpp b/kolourpaint/mainWindow/kpMainWindow_Text.cpp deleted file mode 100644 index 588dd04e..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Text.cpp +++ /dev/null @@ -1,435 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -// private -void kpMainWindow::setupTextToolBarActions () -{ - KActionCollection *ac = actionCollection (); - - d->actionTextFontFamily = ac->add ("text_font_family"); - d->actionTextFontFamily->setText (i18n ("Font Family")); - connect (d->actionTextFontFamily, SIGNAL (triggered (const QString &)), - this, SLOT (slotTextFontFamilyChanged ())); - - d->actionTextFontSize = ac->add ("text_font_size"); - d->actionTextFontSize->setText (i18n ("Font Size")); - connect (d->actionTextFontSize, SIGNAL (fontSizeChanged (int)), - this, SLOT (slotTextFontSizeChanged ())); - - d->actionTextBold = ac->add ("text_bold"); - d->actionTextBold->setIcon (KIcon ("format-text-bold")); - d->actionTextBold->setText (i18n ("Bold")); - connect (d->actionTextBold, SIGNAL (triggered (bool)), - SLOT (slotTextBoldChanged ())); - - d->actionTextItalic = ac->add ("text_italic"); - d->actionTextItalic->setIcon (KIcon ("format-text-italic")); - d->actionTextItalic->setText (i18n ("Italic")); - connect (d->actionTextItalic, SIGNAL (triggered (bool)), - SLOT (slotTextItalicChanged ())); - - d->actionTextUnderline = ac->add ("text_underline"); - d->actionTextUnderline->setIcon (KIcon ("format-text-underline")); - d->actionTextUnderline->setText (i18n ("Underline")); - connect (d->actionTextUnderline, SIGNAL (triggered (bool)), - SLOT (slotTextUnderlineChanged ())); - - d->actionTextStrikeThru = ac->add ("text_strike_thru"); - d->actionTextStrikeThru->setIcon (KIcon ("format-text-strikethrough")); - d->actionTextStrikeThru->setText (i18n ("Strike Through")); - connect (d->actionTextStrikeThru, SIGNAL (triggered (bool)), - SLOT (slotTextStrikeThruChanged ())); - - - readAndApplyTextSettings (); - - - enableTextToolBarActions (false); -} - -// private -void kpMainWindow::readAndApplyTextSettings () -{ - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - - const QString font (cfg.readEntry (kpSettingFontFamily, QString::fromLatin1 ("Times"))); - d->actionTextFontFamily->setFont (font); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "asked setFont to set to=" << font - << "- got back=" << d->actionTextFontFamily->font (); -#endif - d->actionTextFontSize->setFontSize (cfg.readEntry (kpSettingFontSize, 14)); - d->actionTextBold->setChecked (cfg.readEntry (kpSettingBold, false)); - d->actionTextItalic->setChecked (cfg.readEntry (kpSettingItalic, false)); - d->actionTextUnderline->setChecked (cfg.readEntry (kpSettingUnderline, false)); - d->actionTextStrikeThru->setChecked (cfg.readEntry (kpSettingStrikeThru, false)); - - d->textOldFontFamily = d->actionTextFontFamily->font (); - d->textOldFontSize = d->actionTextFontSize->fontSize (); -} - - -// public -void kpMainWindow::enableTextToolBarActions (bool enable) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::enableTextToolBarActions(" << enable << ")"; -#endif - - d->actionTextFontFamily->setEnabled (enable); - d->actionTextFontSize->setEnabled (enable); - d->actionTextBold->setEnabled (enable); - d->actionTextItalic->setEnabled (enable); - d->actionTextUnderline->setEnabled (enable); - d->actionTextStrikeThru->setEnabled (enable); - - if (textToolBar ()) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\thave toolbar - setShown"; - #endif - // COMPAT: KDE4 does not place the Text Tool Bar in a new row, underneath - // the Main Tool Bar, if there isn't enough room. This makes - // accessing the Text Tool Bar's buttons difficult. - textToolBar ()->setVisible (enable); - } -} - - -// private slot -void kpMainWindow::slotTextFontFamilyChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextFontFamilyChanged() alive=" - << d->isFullyConstructed - << "fontFamily=" - << d->actionTextFontFamily->font () - << "action.currentItem=" - << d->actionTextFontFamily->currentItem () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotFontFamilyChanged (d->actionTextFontFamily->font (), - d->textOldFontFamily); - } - - // Since editable KSelectAction's steal focus from view, switch back to mainView - // TODO: back to the last view - if (d->mainView) - d->mainView->setFocus (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingFontFamily, d->actionTextFontFamily->font ()); - cfg.sync (); - - d->textOldFontFamily = d->actionTextFontFamily->font (); -} - -// private slot -void kpMainWindow::slotTextFontSizeChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextFontSizeChanged() alive=" - << d->isFullyConstructed - << " fontSize=" - << d->actionTextFontSize->fontSize () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotFontSizeChanged (d->actionTextFontSize->fontSize (), - d->textOldFontSize); - } - - // Since editable KSelectAction's steal focus from view, switch back to mainView - // TODO: back to the last view - if (d->mainView) - d->mainView->setFocus (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingFontSize, d->actionTextFontSize->fontSize ()); - cfg.sync (); - - d->textOldFontSize = d->actionTextFontSize->fontSize (); -} - -// private slot -void kpMainWindow::slotTextBoldChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextFontBoldChanged() alive=" - << d->isFullyConstructed - << " bold=" - << d->actionTextBold->isChecked () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotBoldChanged (d->actionTextBold->isChecked ()); - } - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingBold, d->actionTextBold->isChecked ()); - cfg.sync (); -} - -// private slot -void kpMainWindow::slotTextItalicChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextFontItalicChanged() alive=" - << d->isFullyConstructed - << " bold=" - << d->actionTextItalic->isChecked () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotItalicChanged (d->actionTextItalic->isChecked ()); - } - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingItalic, d->actionTextItalic->isChecked ()); - cfg.sync (); -} - -// private slot -void kpMainWindow::slotTextUnderlineChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextFontUnderlineChanged() alive=" - << d->isFullyConstructed - << " underline=" - << d->actionTextUnderline->isChecked () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotUnderlineChanged (d->actionTextUnderline->isChecked ()); - } - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingUnderline, d->actionTextUnderline->isChecked ()); - cfg.sync (); -} - -// private slot -void kpMainWindow::slotTextStrikeThruChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotTextStrikeThruChanged() alive=" - << d->isFullyConstructed - << " strikeThru=" - << d->actionTextStrikeThru->isChecked () - << endl; -#endif - - if (!d->isFullyConstructed) - return; - - if (d->toolText && d->toolText->hasBegun ()) - { - toolEndShape (); - d->toolText->slotStrikeThruChanged (d->actionTextStrikeThru->isChecked ()); - } - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupText); - cfg.writeEntry (kpSettingStrikeThru, d->actionTextStrikeThru->isChecked ()); - cfg.sync (); -} - - -// public -KToolBar *kpMainWindow::textToolBar () -{ - return toolBar ("textToolBar"); -} - -bool kpMainWindow::isTextStyleBackgroundOpaque () const -{ - if (d->toolToolBar) - { - kpToolWidgetOpaqueOrTransparent *oot = - d->toolToolBar->toolWidgetOpaqueOrTransparent (); - - if (oot) - { - return oot->isOpaque (); - } - } - - return true; -} - -// public -kpTextStyle kpMainWindow::textStyle () const -{ - return kpTextStyle (d->actionTextFontFamily->font (), - d->actionTextFontSize->fontSize (), - d->actionTextBold->isChecked (), - d->actionTextItalic->isChecked (), - d->actionTextUnderline->isChecked (), - d->actionTextStrikeThru->isChecked (), - d->colorToolBar ? d->colorToolBar->foregroundColor () : kpColor::Invalid, - d->colorToolBar ? d->colorToolBar->backgroundColor () : kpColor::Invalid, - isTextStyleBackgroundOpaque ()); -} - -// public -void kpMainWindow::setTextStyle (const kpTextStyle &textStyle_) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::setTextStyle()"; -#endif - - d->settingTextStyle++; - - - if (textStyle_.fontFamily () != d->actionTextFontFamily->font ()) - { - d->actionTextFontFamily->setFont (textStyle_.fontFamily ()); - slotTextFontFamilyChanged (); - } - - if (textStyle_.fontSize () != d->actionTextFontSize->fontSize ()) - { - d->actionTextFontSize->setFontSize (textStyle_.fontSize ()); - slotTextFontSizeChanged (); - } - - if (textStyle_.isBold () != d->actionTextBold->isChecked ()) - { - d->actionTextBold->setChecked (textStyle_.isBold ()); - slotTextBoldChanged (); - } - - if (textStyle_.isItalic () != d->actionTextItalic->isChecked ()) - { - d->actionTextItalic->setChecked (textStyle_.isItalic ()); - slotTextItalicChanged (); - } - - if (textStyle_.isUnderline () != d->actionTextUnderline->isChecked ()) - { - d->actionTextUnderline->setChecked (textStyle_.isUnderline ()); - slotTextUnderlineChanged (); - } - - if (textStyle_.isStrikeThru () != d->actionTextStrikeThru->isChecked ()) - { - d->actionTextStrikeThru->setChecked (textStyle_.isStrikeThru ()); - slotTextStrikeThruChanged (); - } - - - if (textStyle_.foregroundColor () != d->colorToolBar->foregroundColor ()) - { - d->colorToolBar->setForegroundColor (textStyle_.foregroundColor ()); - } - - if (textStyle_.backgroundColor () != d->colorToolBar->backgroundColor ()) - { - d->colorToolBar->setBackgroundColor (textStyle_.backgroundColor ()); - } - - - if (textStyle_.isBackgroundOpaque () != isTextStyleBackgroundOpaque ()) - { - if (d->toolToolBar) - { - kpToolWidgetOpaqueOrTransparent *oot = - d->toolToolBar->toolWidgetOpaqueOrTransparent (); - - if (oot) - { - oot->setOpaque (textStyle_.isBackgroundOpaque ()); - } - } - } - - - d->settingTextStyle--; -} - -// public -int kpMainWindow::settingTextStyle () const -{ - return d->settingTextStyle; -} - diff --git a/kolourpaint/mainWindow/kpMainWindow_Tools.cpp b/kolourpaint/mainWindow/kpMainWindow_Tools.cpp deleted file mode 100644 index 109da786..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_Tools.cpp +++ /dev/null @@ -1,807 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// private -kpToolSelectionEnvironment *kpMainWindow::toolSelectionEnvironment () -{ - if (!d->toolSelectionEnvironment) - d->toolSelectionEnvironment = new kpToolSelectionEnvironment (this); - - return d->toolSelectionEnvironment; -} - -//--------------------------------------------------------------------- - -// private -kpToolEnvironment *kpMainWindow::toolEnvironment () -{ - // It's fine to return a more complex environment than required. - return toolSelectionEnvironment (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupToolActions () -{ - kpToolSelectionEnvironment *toolSelEnv = toolSelectionEnvironment (); - kpToolEnvironment *toolEnv = toolEnvironment (); - - d->tools.append (d->toolFreeFormSelection = new kpToolFreeFormSelection (toolSelEnv, this)); - d->tools.append (d->toolRectSelection = new kpToolRectSelection (toolSelEnv, this)); - - d->tools.append (d->toolEllipticalSelection = new kpToolEllipticalSelection (toolSelEnv, this)); - d->tools.append (d->toolText = new kpToolText (toolSelEnv, this)); - - d->tools.append (d->toolLine = new kpToolLine (toolEnv, this)); - d->tools.append (d->toolPen = new kpToolPen (toolEnv, this)); - - d->tools.append (d->toolEraser = new kpToolEraser (toolEnv, this)); - d->tools.append (d->toolBrush = new kpToolBrush (toolEnv, this)); - - d->tools.append (d->toolFloodFill = new kpToolFloodFill (toolEnv, this)); - d->tools.append (d->toolColorPicker = new kpToolColorPicker (toolEnv, this)); - - d->tools.append (d->toolColorEraser = new kpToolColorEraser (toolEnv, this)); - d->tools.append (d->toolSpraycan = new kpToolSpraycan (toolEnv, this)); - - d->tools.append (d->toolRoundedRectangle = new kpToolRoundedRectangle (toolEnv, this)); - d->tools.append (d->toolRectangle = new kpToolRectangle (toolEnv, this)); - - d->tools.append (d->toolPolygon = new kpToolPolygon (toolEnv, this)); - d->tools.append (d->toolEllipse = new kpToolEllipse (toolEnv, this)); - - d->tools.append (d->toolPolyline = new kpToolPolyline (toolEnv, this)); - d->tools.append (d->toolCurve = new kpToolCurve (toolEnv, this)); - - d->tools.append (d->toolZoom = new kpToolZoom (toolEnv, this)); - - - KActionCollection *ac = actionCollection (); - - d->actionPrevToolOptionGroup1 = ac->addAction ("prev_tool_option_group_1"); - d->actionPrevToolOptionGroup1->setText (i18n ("Previous Tool Option (Group #1)")); - d->actionPrevToolOptionGroup1->setShortcuts (kpTool::shortcutForKey (Qt::Key_1)); - connect (d->actionPrevToolOptionGroup1, SIGNAL (triggered (bool)), - SLOT (slotActionPrevToolOptionGroup1 ())); - - d->actionNextToolOptionGroup1 = ac->addAction ("next_tool_option_group_1"); - d->actionNextToolOptionGroup1->setText (i18n ("Next Tool Option (Group #1)")); - d->actionNextToolOptionGroup1->setShortcuts (kpTool::shortcutForKey (Qt::Key_2)); - connect (d->actionNextToolOptionGroup1, SIGNAL (triggered (bool)), - SLOT (slotActionNextToolOptionGroup1 ())); - - d->actionPrevToolOptionGroup2 = ac->addAction ("prev_tool_option_group_2"); - d->actionPrevToolOptionGroup2->setText (i18n ("Previous Tool Option (Group #2)")); - d->actionPrevToolOptionGroup2->setShortcuts (kpTool::shortcutForKey (Qt::Key_3)); - connect (d->actionPrevToolOptionGroup2, SIGNAL (triggered (bool)), - SLOT (slotActionPrevToolOptionGroup2 ())); - - d->actionNextToolOptionGroup2 = ac->addAction ("next_tool_option_group_2"); - d->actionNextToolOptionGroup2->setText (i18n ("Next Tool Option (Group #2)")); - d->actionNextToolOptionGroup2->setShortcuts (kpTool::shortcutForKey (Qt::Key_4)); - connect (d->actionNextToolOptionGroup2, SIGNAL (triggered (bool)), - SLOT (slotActionNextToolOptionGroup2 ())); - - - // - // Implemented in this file (kpMainWindow_Tools.cpp), not - // kpImageWindow_Image.cpp since they're really setting tool options. - // - - d->actionDrawOpaque = ac->add ("image_draw_opaque"); - d->actionDrawOpaque->setText (i18n ("&Draw Opaque")); - connect (d->actionDrawOpaque, SIGNAL (triggered (bool)), - SLOT (slotActionDrawOpaqueToggled ())); - - d->actionDrawColorSimilarity = ac->addAction ("image_draw_color_similarity"); - d->actionDrawColorSimilarity->setText (i18n ("Draw With Color Similarity...")); - connect (d->actionDrawColorSimilarity, SIGNAL (triggered (bool)), - SLOT (slotActionDrawColorSimilarity ())); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::createToolBox () -{ - d->toolToolBar = new kpToolToolBar(QLatin1String("Tool Box"), 2/*columns/rows*/, this); - d->toolToolBar->setWindowTitle(i18n("Tool Box")); - - connect (d->toolToolBar, SIGNAL (sigToolSelected (kpTool *)), - this, SLOT (slotToolSelected (kpTool *))); - connect (d->toolToolBar, SIGNAL (toolWidgetOptionSelected ()), - this, SLOT (updateToolOptionPrevNextActionsEnabled ())); - - connect (d->toolToolBar->toolWidgetOpaqueOrTransparent (), - SIGNAL (isOpaqueChanged (bool)), - SLOT (updateActionDrawOpaqueChecked ())); - updateActionDrawOpaqueChecked (); - - foreach (kpTool *tool, d->tools) - d->toolToolBar->registerTool(tool); - - // (from config file) - readLastTool (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableToolsDocumentActions (bool enable) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::enableToolsDocumentsAction(" << enable << ")"; -#endif - - d->toolActionsEnabled = enable; - - if (enable && !d->toolToolBar->isEnabled ()) - { - kpTool *previousTool = d->toolToolBar->previousTool (); - - // select tool for enabled Tool Box - - if (previousTool) - d->toolToolBar->selectPreviousTool (); - else - { - if (d->lastToolNumber >= 0 && d->lastToolNumber < (int) d->tools.count ()) - d->toolToolBar->selectTool (d->tools.at (d->lastToolNumber)); - else - d->toolToolBar->selectTool (d->toolPen); - } - } - else if (!enable && d->toolToolBar->isEnabled ()) - { - // don't have a disabled Tool Box with a checked Tool - d->toolToolBar->selectTool (0); - } - - - d->toolToolBar->setEnabled (enable); - - - foreach (kpTool *tool, d->tools) - { - kpToolAction *action = tool->action(); - if (!enable && action->isChecked()) - action->setChecked(false); - - action->setEnabled(enable); - } - - - updateToolOptionPrevNextActionsEnabled (); - updateActionDrawOpaqueEnabled (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::updateToolOptionPrevNextActionsEnabled () -{ - const bool enable = d->toolActionsEnabled; - - - d->actionPrevToolOptionGroup1->setEnabled (enable && - d->toolToolBar->shownToolWidget (0) && - d->toolToolBar->shownToolWidget (0)->hasPreviousOption ()); - d->actionNextToolOptionGroup1->setEnabled (enable && - d->toolToolBar->shownToolWidget (0) && - d->toolToolBar->shownToolWidget (0)->hasNextOption ()); - - d->actionPrevToolOptionGroup2->setEnabled (enable && - d->toolToolBar->shownToolWidget (1) && - d->toolToolBar->shownToolWidget (1)->hasPreviousOption ()); - d->actionNextToolOptionGroup2->setEnabled (enable && - d->toolToolBar->shownToolWidget (1) && - d->toolToolBar->shownToolWidget (1)->hasNextOption ()); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::updateActionDrawOpaqueChecked () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::updateActionDrawOpaqueChecked()"; -#endif - - const bool drawOpaque = - (d->toolToolBar->toolWidgetOpaqueOrTransparent ()->selectedRow () == 0); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdrawOpaque=" << drawOpaque; -#endif - - d->actionDrawOpaque->setChecked (drawOpaque); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::updateActionDrawOpaqueEnabled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::updateActionDrawOpaqueEnabled()"; -#endif - - const bool enable = d->toolActionsEnabled; - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tenable=" << enable - << " tool=" << (tool () ? tool ()->objectName () : 0) - << " (is selection=" << toolIsASelectionTool () << ")" - << endl; -#endif - - d->actionDrawOpaque->setEnabled (enable && toolIsASelectionTool ()); -} - -//--------------------------------------------------------------------- - -// public -QActionGroup *kpMainWindow::toolsActionGroup () -{ - if (!d->toolsActionGroup) - d->toolsActionGroup = new QActionGroup (this); - - return d->toolsActionGroup; -} - -//--------------------------------------------------------------------- - -// public -kpTool *kpMainWindow::tool () const -{ - return d->toolToolBar ? d->toolToolBar->tool () : 0; -} - -//--------------------------------------------------------------------- - -// public -bool kpMainWindow::toolHasBegunShape () const -{ - kpTool *currentTool = tool (); - return (currentTool && currentTool->hasBegunShape ()); -} - -//--------------------------------------------------------------------- - -// public -bool kpMainWindow::toolIsASelectionTool (bool includingTextTool) const -{ - kpTool *currentTool = tool (); - - return ((currentTool == d->toolFreeFormSelection) || - (currentTool == d->toolRectSelection) || - (currentTool == d->toolEllipticalSelection) || - (currentTool == d->toolText && includingTextTool)); -} - -//--------------------------------------------------------------------- - -// public -bool kpMainWindow::toolIsTextTool () const -{ - return (tool () == d->toolText); -} - -//--------------------------------------------------------------------- - - -// private -void kpMainWindow::toolEndShape () -{ - if (toolHasBegunShape ()) - tool ()->endShapeInternal (); -} - -//--------------------------------------------------------------------- - -// public -kpImageSelectionTransparency kpMainWindow::imageSelectionTransparency () const -{ - kpToolWidgetOpaqueOrTransparent *oot = d->toolToolBar->toolWidgetOpaqueOrTransparent (); - Q_ASSERT (oot); - - return kpImageSelectionTransparency (oot->isOpaque (), backgroundColor (), d->colorToolBar->colorSimilarity ()); -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::setImageSelectionTransparency (const kpImageSelectionTransparency &transparency, bool forceColorChange) -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::setImageSelectionTransparency() isOpaque=" << transparency.isOpaque () - << " color=" << (transparency.transparentColor ().isValid () ? (int *) transparency.transparentColor ().toQRgb () : 0) - << " forceColorChange=" << forceColorChange - << endl; -#endif - - kpToolWidgetOpaqueOrTransparent *oot = d->toolToolBar->toolWidgetOpaqueOrTransparent (); - Q_ASSERT (oot); - - d->settingImageSelectionTransparency++; - - oot->setOpaque (transparency.isOpaque ()); - if (transparency.isTransparent () || forceColorChange) - { - d->colorToolBar->setColor (1, transparency.transparentColor ()); - d->colorToolBar->setColorSimilarity (transparency.colorSimilarity ()); - } - - d->settingImageSelectionTransparency--; -} - -//--------------------------------------------------------------------- - -// public -int kpMainWindow::settingImageSelectionTransparency () const -{ - return d->settingImageSelectionTransparency; -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotToolSelected (kpTool *tool) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotToolSelected (" << tool << ")"; -#endif - - kpTool *previousTool = d->toolToolBar ? d->toolToolBar->previousTool () : 0; - - if (previousTool) - { - disconnect (previousTool, SIGNAL (movedAndAboutToDraw (const QPoint &, const QPoint &, int, bool *)), - this, SLOT (slotDragScroll (const QPoint &, const QPoint &, int, bool *))); - disconnect (previousTool, SIGNAL (endedDraw (const QPoint &)), - this, SLOT (slotEndDragScroll ())); - disconnect (previousTool, SIGNAL (cancelledShape (const QPoint &)), - this, SLOT (slotEndDragScroll ())); - - disconnect (previousTool, SIGNAL (userMessageChanged (const QString &)), - this, SLOT (recalculateStatusBarMessage ())); - disconnect (previousTool, SIGNAL (userShapePointsChanged (const QPoint &, const QPoint &)), - this, SLOT (recalculateStatusBarShape ())); - disconnect (previousTool, SIGNAL (userShapeSizeChanged (const QSize &)), - this, SLOT (recalculateStatusBarShape ())); - - disconnect (d->colorToolBar, SIGNAL (colorsSwapped (const kpColor &, const kpColor &)), - previousTool, SLOT (slotColorsSwappedInternal (const kpColor &, const kpColor &))); - disconnect (d->colorToolBar, SIGNAL (foregroundColorChanged (const kpColor &)), - previousTool, SLOT (slotForegroundColorChangedInternal (const kpColor &))); - disconnect (d->colorToolBar, SIGNAL (backgroundColorChanged (const kpColor &)), - previousTool, SLOT (slotBackgroundColorChangedInternal (const kpColor &))); - disconnect (d->colorToolBar, SIGNAL (colorSimilarityChanged (double, int)), - previousTool, SLOT (slotColorSimilarityChangedInternal (double, int))); - } - - if (tool) - { - connect (tool, SIGNAL (movedAndAboutToDraw (const QPoint &, const QPoint &, int, bool *)), - this, SLOT (slotDragScroll (const QPoint &, const QPoint &, int, bool *))); - connect (tool, SIGNAL (endedDraw (const QPoint &)), - this, SLOT (slotEndDragScroll ())); - connect (tool, SIGNAL (cancelledShape (const QPoint &)), - this, SLOT (slotEndDragScroll ())); - - connect (tool, SIGNAL (userMessageChanged (const QString &)), - this, SLOT (recalculateStatusBarMessage ())); - connect (tool, SIGNAL (userShapePointsChanged (const QPoint &, const QPoint &)), - this, SLOT (recalculateStatusBarShape ())); - connect (tool, SIGNAL (userShapeSizeChanged (const QSize &)), - this, SLOT (recalculateStatusBarShape ())); - recalculateStatusBar (); - - connect (d->colorToolBar, SIGNAL (colorsSwapped (const kpColor &, const kpColor &)), - tool, SLOT (slotColorsSwappedInternal (const kpColor &, const kpColor &))); - connect (d->colorToolBar, SIGNAL (foregroundColorChanged (const kpColor &)), - tool, SLOT (slotForegroundColorChangedInternal (const kpColor &))); - connect (d->colorToolBar, SIGNAL (backgroundColorChanged (const kpColor &)), - tool, SLOT (slotBackgroundColorChangedInternal (const kpColor &))); - connect (d->colorToolBar, SIGNAL (colorSimilarityChanged (double, int)), - tool, SLOT (slotColorSimilarityChangedInternal (double, int))); - - - saveLastTool (); - } - - updateToolOptionPrevNextActionsEnabled (); - updateActionDrawOpaqueEnabled (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::readLastTool () -{ - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupTools); - - d->lastToolNumber = cfg.readEntry (kpSettingLastTool, -1); -} - -//--------------------------------------------------------------------- - -// private -int kpMainWindow::toolNumber () const -{ - int number = 0; - for (QList ::const_iterator it = d->tools.constBegin (); - it != d->tools.constEnd (); - ++it) - { - if (*it == tool ()) - return number; - - number++; - } - - return -1; -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::saveLastTool () -{ - int number = toolNumber (); - if (number < 0 || number >= (int) d->tools.count ()) - return; - - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupTools); - - cfg.writeEntry (kpSettingLastTool, number); - cfg.sync (); -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::maybeDragScrollingMainView () const -{ - return (tool () && d->mainView && - tool ()->viewUnderStartPoint () == d->mainView); -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotDragScroll (const QPoint &docPoint, - const QPoint &docLastPoint, - int zoomLevel, - bool *scrolled) -{ - Q_UNUSED(docPoint) - Q_UNUSED(docLastPoint) - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotDragScroll() maybeDragScrolling=" - << maybeDragScrollingMainView () - << endl; -#endif - - if (maybeDragScrollingMainView ()) - { - return d->scrollView->beginDragScroll(zoomLevel, scrolled); - } - else - { - return false; - } -} - -//--------------------------------------------------------------------- - -// private slot -bool kpMainWindow::slotEndDragScroll () -{ - // (harmless if haven't started drag scroll) - return d->scrollView->endDragScroll (); -} - -//--------------------------------------------------------------------- - - -// private slot -void kpMainWindow::slotBeganDocResize () -{ - toolEndShape (); - - recalculateStatusBarShape (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotContinuedDocResize (const QSize &) -{ - recalculateStatusBarShape (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotCancelledDocResize () -{ - recalculateStatusBar (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotEndedDocResize (const QSize &size) -{ -#define DOC_RESIZE_COMPLETED() \ -{ \ - d->docResizeToBeCompleted = false; \ - recalculateStatusBar (); \ -} - - // Prevent statusbar updates - d->docResizeToBeCompleted = true; - - d->docResizeWidth = (size.width () > 0 ? size.width () : 1), - d->docResizeHeight = (size.height () > 0 ? size.height () : 1); - - if (d->docResizeWidth == d->document->width () && - d->docResizeHeight == d->document->height ()) - { - DOC_RESIZE_COMPLETED (); - return; - } - - - // Blank status to avoid confusion if dialog comes up - setStatusBarMessage (); - setStatusBarShapePoints (); - setStatusBarShapeSize (); - - - if (kpTool::warnIfBigImageSize (d->document->width (), - d->document->height (), - d->docResizeWidth, d->docResizeHeight, - i18n ("

Resizing the image to" - " %1x%2 may take a substantial amount of memory." - " This can reduce system" - " responsiveness and cause other application resource" - " problems.

" - - "

Are you sure want to resize the" - " image?

", - d->docResizeWidth, - d->docResizeHeight), - i18nc ("@title:window", "Resize Image?"), - i18n ("R&esize Image"), - this)) - { - d->commandHistory->addCommand ( - new kpTransformResizeScaleCommand ( - false/*doc, not sel*/, - d->docResizeWidth, d->docResizeHeight, - kpTransformResizeScaleCommand::Resize, - commandEnvironment ())); - - saveDefaultDocSize (QSize (d->docResizeWidth, d->docResizeHeight)); - } - - - DOC_RESIZE_COMPLETED (); - -#undef DOC_RESIZE_COMPLETED -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotDocResizeMessageChanged (const QString &string) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotDocResizeMessageChanged(" << string - << ") docResizeToBeCompleted=" << d->docResizeToBeCompleted - << endl; -#else - (void) string; -#endif - - if (d->docResizeToBeCompleted) - return; - - recalculateStatusBarMessage (); -} - -//--------------------------------------------------------------------- - - -// private slot -void kpMainWindow::slotActionPrevToolOptionGroup1 () -{ - if (!d->toolToolBar->shownToolWidget (0)) - return; - - // We don't call toolEndShape() here because we want #23 in the file BUGS - // to later work. - - d->toolToolBar->shownToolWidget (0)->selectPreviousOption (); - updateToolOptionPrevNextActionsEnabled (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotActionNextToolOptionGroup1 () -{ - if (!d->toolToolBar->shownToolWidget (0)) - return; - - // We don't call toolEndShape() here because we want #23 in the file BUGS - // to later work. - - d->toolToolBar->shownToolWidget (0)->selectNextOption (); - updateToolOptionPrevNextActionsEnabled (); -} - -//--------------------------------------------------------------------- - - -// private slot -void kpMainWindow::slotActionPrevToolOptionGroup2 () -{ - if (!d->toolToolBar->shownToolWidget (1)) - return; - - // We don't call toolEndShape() here because we want #23 in the file BUGS - // to later work. - - d->toolToolBar->shownToolWidget (1)->selectPreviousOption (); - updateToolOptionPrevNextActionsEnabled (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotActionNextToolOptionGroup2 () -{ - if (!d->toolToolBar->shownToolWidget (1)) - return; - - // We don't call toolEndShape() here because we want #23 in the file BUGS - // to later work. - - d->toolToolBar->shownToolWidget (1)->selectNextOption (); - updateToolOptionPrevNextActionsEnabled (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotActionDrawOpaqueToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotActionDrawOpaqueToggled()"; -#endif - toolEndShape (); - - // TODO: How does this differ to setImageSelectionTransparency()? - - // ("kpToolWidgetBase::" is to access one overload shadowed by the override - // of the other overload) - d->toolToolBar->toolWidgetOpaqueOrTransparent ()->kpToolWidgetBase::setSelected ( - (d->actionDrawOpaque->isChecked () ? - 0/*row 0 = opaque*/ : - 1/*row 1 = transparent*/), - 0/*column*/); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotActionDrawColorSimilarity () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotActionDrawColorSimilarity()"; -#endif - toolEndShape (); - - d->colorToolBar->openColorSimilarityDialog (); -} - -//--------------------------------------------------------------------- - - -// public slots - -#define SLOT_TOOL(toolName) \ -void kpMainWindow::slotTool##toolName () \ -{ \ - if (!d->toolToolBar) \ - return; \ - \ - if (tool () == d->tool##toolName) \ - return; \ - \ - d->toolToolBar->selectTool (d->tool##toolName); \ -} - - -SLOT_TOOL (RectSelection) -SLOT_TOOL (EllipticalSelection) -SLOT_TOOL (FreeFormSelection) -SLOT_TOOL (Text) diff --git a/kolourpaint/mainWindow/kpMainWindow_View.cpp b/kolourpaint/mainWindow/kpMainWindow_View.cpp deleted file mode 100644 index 6b5f4c9a..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_View.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// private -void kpMainWindow::setupViewMenuActions () -{ - KActionCollection *ac = actionCollection (); - - /*d->actionFullScreen = KStandardAction::fullScreen (0, 0, ac); - d->actionFullScreen->setEnabled (false);*/ - - - setupViewMenuZoomActions (); - - - d->actionShowGrid = ac->add ("view_show_grid"); - d->actionShowGrid->setText (i18n ("Show &Grid")); - d->actionShowGrid->setShortcut (Qt::CTRL + Qt::Key_G); - //d->actionShowGrid->setCheckedState (KGuiItem(i18n ("Hide &Grid"))); - connect (d->actionShowGrid, SIGNAL (triggered (bool)), - SLOT (slotShowGridToggled ())); - - - setupViewMenuThumbnailActions (); - - - enableViewMenuDocumentActions (false); -} - -//--------------------------------------------------------------------- - -// private -bool kpMainWindow::viewMenuDocumentActionsEnabled () const -{ - return d->viewMenuDocumentActionsEnabled; -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableViewMenuDocumentActions (bool enable) -{ - d->viewMenuDocumentActionsEnabled = enable; - - - enableViewMenuZoomDocumentActions (enable); - - actionShowGridUpdate (); - - enableViewMenuThumbnailDocumentActions (enable); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::actionShowGridUpdate () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::actionShowGridUpdate()"; -#endif - const bool enable = (viewMenuDocumentActionsEnabled () && - d->mainView && d->mainView->canShowGrid ()); - - d->actionShowGrid->setEnabled (enable); - d->actionShowGrid->setChecked (enable && d->configShowGrid); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotShowGridToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotActionShowGridToggled()"; -#endif - - updateMainViewGrid (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - - cfg.writeEntry (kpSettingShowGrid, d->configShowGrid = d->actionShowGrid->isChecked ()); - cfg.sync (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::updateMainViewGrid () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::updateMainViewGrid ()"; -#endif - - if (d->mainView) - d->mainView->showGrid (d->actionShowGrid->isChecked ()); -} - -//--------------------------------------------------------------------- - -// private -QRect kpMainWindow::mapToGlobal (const QRect &rect) const -{ - return kpWidgetMapper::toGlobal (this, rect); -} - -//--------------------------------------------------------------------- - -// private -QRect kpMainWindow::mapFromGlobal (const QRect &rect) const -{ - return kpWidgetMapper::fromGlobal (this, rect); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/mainWindow/kpMainWindow_View_Thumbnail.cpp b/kolourpaint/mainWindow/kpMainWindow_View_Thumbnail.cpp deleted file mode 100644 index 3f34154d..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_View_Thumbnail.cpp +++ /dev/null @@ -1,477 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// private -void kpMainWindow::setupViewMenuThumbnailActions () -{ - d->thumbnailSaveConfigTimer = 0; - - KActionCollection *ac = actionCollection (); - - - d->actionShowThumbnail = ac->add ("view_show_thumbnail"); - d->actionShowThumbnail->setText (i18n ("Show T&humbnail")); - // TODO: This doesn't work when the thumbnail has focus. - // Testcase: Press CTRL+H twice on a fresh KolourPaint. - // The second CTRL+H doesn't close the thumbnail. - d->actionShowThumbnail->setShortcut (Qt::CTRL + Qt::Key_H); - //d->actionShowThumbnail->setCheckedState (KGuiItem(i18n ("Hide T&humbnail"))); - connect (d->actionShowThumbnail, SIGNAL (triggered (bool)), - SLOT (slotShowThumbnailToggled ())); - - // Please do not use setCheckedState() here - it wouldn't make sense - d->actionZoomedThumbnail = ac->add ("view_zoomed_thumbnail"); - d->actionZoomedThumbnail->setText (i18n ("Zoo&med Thumbnail Mode")); - connect (d->actionZoomedThumbnail, SIGNAL (triggered (bool)), - SLOT (slotZoomedThumbnailToggled ())); - - // For consistency with the above action, don't use setCheckedState() - // - // Also, don't use "Show Thumbnail Rectangle" because if entire doc - // can be seen in scrollView, checking option won't "Show" anything - // since rect _surrounds_ entire doc (hence, won't be rendered). - d->actionShowThumbnailRectangle = ac->add ("view_show_thumbnail_rectangle"); - d->actionShowThumbnailRectangle->setText (i18n ("Enable Thumbnail &Rectangle")); - connect (d->actionShowThumbnailRectangle, SIGNAL (triggered (bool)), - SLOT (slotThumbnailShowRectangleToggled ())); -} - -// private -void kpMainWindow::enableViewMenuThumbnailDocumentActions (bool enable) -{ - d->actionShowThumbnail->setEnabled (enable); - enableThumbnailOptionActions (enable); -} - -// private slot -void kpMainWindow::slotDestroyThumbnail () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotDestroyThumbnail()"; -#endif - - d->actionShowThumbnail->setChecked (false); - enableThumbnailOptionActions (false); - updateThumbnail (); -} - -// private slot -void kpMainWindow::slotDestroyThumbnailInitatedByUser () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotDestroyThumbnailInitiatedByUser()"; -#endif - - d->actionShowThumbnail->setChecked (false); - slotShowThumbnailToggled (); -} - -// private slot -void kpMainWindow::slotCreateThumbnail () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotCreateThumbnail()"; -#endif - - d->actionShowThumbnail->setChecked (true); - enableThumbnailOptionActions (true); - updateThumbnail (); -} - -// public -void kpMainWindow::notifyThumbnailGeometryChanged () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::notifyThumbnailGeometryChanged()"; -#endif - - if (!d->thumbnailSaveConfigTimer) - { - d->thumbnailSaveConfigTimer = new QTimer (this); - d->thumbnailSaveConfigTimer->setSingleShot (true); - connect (d->thumbnailSaveConfigTimer, SIGNAL (timeout ()), - this, SLOT (slotSaveThumbnailGeometry ())); - } - - // (single shot) - d->thumbnailSaveConfigTimer->start (500/*msec*/); -} - -// private slot -void kpMainWindow::slotSaveThumbnailGeometry () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::saveThumbnailGeometry()"; -#endif - - if (!d->thumbnail) - return; - - QRect rect (d->thumbnail->x (), d->thumbnail->y (), - d->thumbnail->width (), d->thumbnail->height ()); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tthumbnail relative geometry=" << rect; -#endif - - d->configThumbnailGeometry = mapFromGlobal (rect); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tCONFIG: saving thumbnail geometry " - << d->configThumbnailGeometry - << endl; -#endif - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupThumbnail); - - cfg.writeEntry (kpSettingThumbnailGeometry, d->configThumbnailGeometry); - cfg.sync (); -} - -// private slot -void kpMainWindow::slotShowThumbnailToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotShowThumbnailToggled()"; -#endif - - d->configThumbnailShown = d->actionShowThumbnail->isChecked (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupThumbnail); - - cfg.writeEntry (kpSettingThumbnailShown, d->configThumbnailShown); - cfg.sync (); - - - enableThumbnailOptionActions (d->actionShowThumbnail->isChecked ()); - updateThumbnail (); -} - -// private slot -void kpMainWindow::updateThumbnailZoomed () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::updateThumbnailZoomed() zoomed=" - << d->actionZoomedThumbnail->isChecked () << endl; -#endif - - if (!d->thumbnailView) - return; - - destroyThumbnailView (); - createThumbnailView (); -} - -// private slot -void kpMainWindow::slotZoomedThumbnailToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotZoomedThumbnailToggled()"; -#endif - - d->configZoomedThumbnail = d->actionZoomedThumbnail->isChecked (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupThumbnail); - - cfg.writeEntry (kpSettingThumbnailZoomed, d->configZoomedThumbnail); - cfg.sync (); - - - updateThumbnailZoomed (); -} - -// private slot -void kpMainWindow::slotThumbnailShowRectangleToggled () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotThumbnailShowRectangleToggled()"; -#endif - - d->configThumbnailShowRectangle = d->actionShowThumbnailRectangle->isChecked (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupThumbnail); - - cfg.writeEntry (kpSettingThumbnailShowRectangle, d->configThumbnailShowRectangle); - cfg.sync (); - - - if (d->thumbnailView) - { - d->thumbnailView->showBuddyViewScrollableContainerRectangle ( - d->actionShowThumbnailRectangle->isChecked ()); - } -} - -// private -void kpMainWindow::enableViewZoomedThumbnail (bool enable) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::enableSettingsViewZoomedThumbnail()"; -#endif - - d->actionZoomedThumbnail->setEnabled (enable && - d->actionShowThumbnail->isChecked ()); - - // Note: Don't uncheck if disabled - being able to see the zoomed state - // before turning on the thumbnail can be useful. - d->actionZoomedThumbnail->setChecked (d->configZoomedThumbnail); -} - -// private -void kpMainWindow::enableViewShowThumbnailRectangle (bool enable) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::enableViewShowThumbnailRectangle()"; -#endif - - d->actionShowThumbnailRectangle->setEnabled (enable && - d->actionShowThumbnail->isChecked ()); - - // Note: Don't uncheck if disabled for consistency with - // enableViewZoomedThumbnail() - d->actionShowThumbnailRectangle->setChecked ( - d->configThumbnailShowRectangle); -} - -// private -void kpMainWindow::enableThumbnailOptionActions (bool enable) -{ - enableViewZoomedThumbnail (enable); - enableViewShowThumbnailRectangle (enable); -} - - -// private -void kpMainWindow::createThumbnailView () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tcreating new kpView:"; -#endif - - if (d->thumbnailView) - { - kDebug () << "kpMainWindow::createThumbnailView() had to destroy view"; - destroyThumbnailView (); - } - - if (d->actionZoomedThumbnail->isChecked ()) - { - d->thumbnailView = new kpZoomedThumbnailView ( - d->document, d->toolToolBar, d->viewManager, - d->mainView, - 0/*scrollableContainer*/, - d->thumbnail); - d->thumbnailView->setObjectName ( QLatin1String("thumbnailView" )); - } - else - { - d->thumbnailView = new kpUnzoomedThumbnailView ( - d->document, d->toolToolBar, d->viewManager, - d->mainView, - 0/*scrollableContainer*/, - d->thumbnail); - d->thumbnailView->setObjectName ( QLatin1String("thumbnailView" )); - } - - d->thumbnailView->showBuddyViewScrollableContainerRectangle ( - d->actionShowThumbnailRectangle->isChecked ()); - - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tgive kpThumbnail the kpView:"; -#endif - if (d->thumbnail) - d->thumbnail->setView (d->thumbnailView); - else - kError () << "kpMainWindow::createThumbnailView() no thumbnail" << endl; - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tregistering the kpView:"; -#endif - if (d->viewManager) - d->viewManager->registerView (d->thumbnailView); -} - -// private -void kpMainWindow::destroyThumbnailView () -{ - if (!d->thumbnailView) - return; - - if (d->viewManager) - d->viewManager->unregisterView (d->thumbnailView); - - if (d->thumbnail) - d->thumbnail->setView (0); - - d->thumbnailView->deleteLater (); d->thumbnailView = 0; -} - - -// private -void kpMainWindow::updateThumbnail () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::updateThumbnail()"; -#endif - bool enable = d->actionShowThumbnail->isChecked (); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tthumbnail=" - << bool (d->thumbnail) - << " action_isChecked=" - << enable - << endl; -#endif - - if (bool (d->thumbnail) == enable) - return; - - if (!d->thumbnail) - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcreating thumbnail"; - #endif - - // Read last saved geometry before creating thumbnail & friends - // in case they call notifyThumbnailGeometryChanged() - QRect thumbnailGeometry = d->configThumbnailGeometry; - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tlast used geometry=" << thumbnailGeometry; - #endif - - d->thumbnail = new kpThumbnail (this); - - createThumbnailView (); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tmoving thumbnail to right place"; - #endif - if (!thumbnailGeometry.isEmpty () && - QRect (0, 0, width (), height ()).intersects (thumbnailGeometry)) - { - const QRect geometry = mapToGlobal (thumbnailGeometry); - d->thumbnail->resize (geometry.size ()); - d->thumbnail->move (geometry.topLeft ()); - } - else - { - if (d->scrollView) - { - const int margin = 20; - const int initialWidth = 160, initialHeight = 120; - - QRect geometryRect (width () - initialWidth - margin * 2, - d->scrollView->y () + margin, - initialWidth, - initialHeight); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tcreating geometry=" << geometryRect; - #endif - - geometryRect = mapToGlobal (geometryRect); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tmap to global=" << geometryRect; - #endif - d->thumbnail->resize (geometryRect.size ()); - d->thumbnail->move (geometryRect.topLeft ()); - } - } - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tshowing thumbnail"; - #endif - d->thumbnail->show (); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tconnecting signal thumbnail::windowClosed to destroy slot"; - #endif - connect (d->thumbnail, SIGNAL (windowClosed ()), - this, SLOT (slotDestroyThumbnailInitatedByUser ())); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tDONE"; - #endif - } - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tdestroying thumbnail d->thumbnail=" - << d->thumbnail << endl; - #endif - - if (d->thumbnailSaveConfigTimer && d->thumbnailSaveConfigTimer->isActive ()) - { - d->thumbnailSaveConfigTimer->stop (); - slotSaveThumbnailGeometry (); - } - - // Must be done before hiding the thumbnail to avoid triggering - // this signal - re-entering this code. - disconnect (d->thumbnail, SIGNAL (windowClosed ()), - this, SLOT (slotDestroyThumbnailInitatedByUser ())); - - // Avoid change/flicker of caption due to view delete - // (destroyThumbnailView()) - d->thumbnail->hide (); - - destroyThumbnailView (); - - d->thumbnail->deleteLater (); d->thumbnail = 0; - } -} diff --git a/kolourpaint/mainWindow/kpMainWindow_View_Zoom.cpp b/kolourpaint/mainWindow/kpMainWindow_View_Zoom.cpp deleted file mode 100644 index 67392499..00000000 --- a/kolourpaint/mainWindow/kpMainWindow_View_Zoom.cpp +++ /dev/null @@ -1,708 +0,0 @@ -// REFACTOR: Clean up bits of this file - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int ZoomLevelFromString (const QString &stringIn) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow_View.cpp:ZoomLevelFromString(" << stringIn << ")"; -#endif - - // Remove any non-digits kdelibs sometimes adds behind our back :( e.g.: - // - // 1. kdelibs adds accelerators to actions' text directly - // 2. ',' is automatically added to change "1000%" to "1,000%" - QString string = stringIn; - string.remove (QRegExp ("[^0-9]")); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\twithout non-digits='" << string << "'"; -#endif - - // Convert zoom level to number. - bool ok = false; - int zoomLevel = string.toInt (&ok); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tzoomLevel=" << zoomLevel; -#endif - - if (!ok || zoomLevel < kpView::MinZoomLevel || zoomLevel > kpView::MaxZoomLevel) - return 0; // error - else - return zoomLevel; -} - -//--------------------------------------------------------------------- - -static QString ZoomLevelToString (int zoomLevel) -{ - return i18n ("%1%", zoomLevel); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::setupViewMenuZoomActions () -{ - KActionCollection *ac = actionCollection (); - - - d->actionActualSize = KStandardAction::actualSize (this, SLOT (slotActualSize ()), ac); - d->actionFitToPage = KStandardAction::fitToPage (this, SLOT (slotFitToPage ()), ac); - d->actionFitToWidth = KStandardAction::fitToWidth (this, SLOT (slotFitToWidth ()), ac); - d->actionFitToHeight = KStandardAction::fitToHeight (this, SLOT (slotFitToHeight ()), ac); - - - d->actionZoomIn = KStandardAction::zoomIn (this, SLOT (slotZoomIn ()), ac); - d->actionZoomOut = KStandardAction::zoomOut (this, SLOT (slotZoomOut ()), ac); - - - d->actionZoom = ac->add ("view_zoom_to"); - d->actionZoom->setText (i18n ("&Zoom")); - connect (d->actionZoom, SIGNAL (triggered (QAction *)), SLOT (slotZoom ())); - d->actionZoom->setEditable (true); - - // create the zoom list for the 1st call to zoomTo() below - d->zoomList.append (10); d->zoomList.append (25); d->zoomList.append (33); - d->zoomList.append (50); d->zoomList.append (67); d->zoomList.append (75); - d->zoomList.append (100); - d->zoomList.append (200); d->zoomList.append (300); - d->zoomList.append (400); d->zoomList.append (600); d->zoomList.append (800); - d->zoomList.append (1000); d->zoomList.append (1200); d->zoomList.append (1600); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::enableViewMenuZoomDocumentActions (bool enable) -{ - d->actionActualSize->setEnabled (enable); - d->actionFitToPage->setEnabled (enable); - d->actionFitToWidth->setEnabled (enable); - d->actionFitToHeight->setEnabled (enable); - - d->actionZoomIn->setEnabled (enable); - d->actionZoomOut->setEnabled (enable); - d->actionZoom->setEnabled (enable); - - - // TODO: for the time being, assume that we start at zoom 100% - // with no grid - - // This function is only called when a new document is created - // or an existing document is closed. So the following will - // always be correct: - - zoomTo (100); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::sendZoomListToActionZoom () -{ - QStringList items; - - const QList ::ConstIterator zoomListEnd (d->zoomList.end ()); - for (QList ::ConstIterator it = d->zoomList.constBegin (); - it != zoomListEnd; - ++it) - { - items << ::ZoomLevelToString (*it); - } - - // Work around a KDE bug - KSelectAction::setItems() enables the action. - // David Faure said it won't be fixed because it's a feature used by - // KRecentFilesAction. - bool e = d->actionZoom->isEnabled (); - d->actionZoom->setItems (items); - if (e != d->actionZoom->isEnabled ()) - d->actionZoom->setEnabled (e); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::zoomToPre (int zoomLevel) -{ - // We're called quite early in the init process and/or when there might - // not be a document or a view so we have a lot of "if (ptr)" guards. - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::zoomToPre(" << zoomLevel << ")"; -#endif - - zoomLevel = qBound (kpView::MinZoomLevel, zoomLevel, kpView::MaxZoomLevel); - -// mute point since the thumbnail suffers from this too -#if 0 - else if (d->mainView && d->mainView->zoomLevelX () % 100 == 0 && zoomLevel % 100) - { - if (KMessageBox::warningContinueCancel (this, - i18n ("Setting the zoom level to a value that is not a multiple of 100% " - "results in imprecise editing and redraw glitches.\n" - "Do you really want to set to zoom level to %1%?", - zoomLevel), - QString()/*caption*/, - i18n ("Set Zoom Level to %1%", zoomLevel), - "DoNotAskAgain_ZoomLevelNotMultipleOf100") != KMessageBox::Continue) - { - zoomLevel = d->mainView->zoomLevelX (); - } - } -#endif - - int index = 0; - QList ::Iterator it = d->zoomList.begin (); - - while (index < (int) d->zoomList.count () && zoomLevel > *it) - it++, index++; - - if (zoomLevel != *it) - d->zoomList.insert (it, zoomLevel); - - // OPT: We get called twice on startup. sendZoomListToActionZoom() is very slow. - sendZoomListToActionZoom (); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tsetCurrentItem(" << index << ")"; -#endif - d->actionZoom->setCurrentItem (index); -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcurrentItem=" - << d->actionZoom->currentItem () - << " action=" - << d->actionZoom->action (d->actionZoom->currentItem ()) - << " checkedAction" - << d->actionZoom->selectableActionGroup ()->checkedAction () - << endl;; -#endif - - - if (viewMenuDocumentActionsEnabled ()) - { - d->actionActualSize->setEnabled (zoomLevel != 100); - - d->actionZoomIn->setEnabled (d->actionZoom->currentItem () < (int) d->zoomList.count () - 1); - d->actionZoomOut->setEnabled (d->actionZoom->currentItem () > 0); - } - - - // TODO: Is this actually needed? - if (d->viewManager) - d->viewManager->setQueueUpdates (); - - if (d->scrollView) - { - d->scrollView->setUpdatesEnabled (false); - } -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::zoomToPost () -{ -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::zoomToPost()"; -#endif - - if (d->mainView) - { - actionShowGridUpdate (); - updateMainViewGrid (); - - // Since Zoom Level KSelectAction on ToolBar grabs focus after changing - // Zoom, switch back to the Main View. - // TODO: back to the last view - d->mainView->setFocus (); - - } - - - // The view magnified and moved beneath the cursor - if (tool ()) - tool ()->somethingBelowTheCursorChanged (); - - - if (d->scrollView) - { - // TODO: setUpdatesEnabled() should really return to old value - // - not necessarily "true" - d->scrollView->setUpdatesEnabled (true); - } - - if (d->viewManager && d->viewManager->queueUpdates ()/*just in case*/) - d->viewManager->restoreQueueUpdates (); - - setStatusBarZoom (d->mainView ? d->mainView->zoomLevelX () : 0); - -#if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "kpMainWindow::zoomToPost() done"; -#endif -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::zoomTo (int zoomLevel, bool centerUnderCursor) -{ - zoomToPre (zoomLevel); - - - if (d->scrollView && d->mainView) - { - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tscrollView contentsX=" << d->scrollView->horizontalScrollBar()->value () - << " contentsY=" << d->scrollView->verticalScrollBar()->value () - << " contentsWidth=" << d->scrollView->widget()->width () - << " contentsHeight=" << d->scrollView->widget()->height () - << " visibleWidth=" << d->scrollView->viewport()->width () - << " visibleHeight=" << d->scrollView->viewport()->height () - << " oldZoomX=" << d->mainView->zoomLevelX () - << " oldZoomY=" << d->mainView->zoomLevelY () - << " newZoom=" << zoomLevel - << endl; - #endif - - // TODO: when changing from no scrollbars to scrollbars, Qt lies about - // visibleWidth() & visibleHeight() (doesn't take into account the - // space taken by the would-be scrollbars) until it updates the - // scrollview; hence the centering is off by about 5-10 pixels. - - // TODO: Use visibleRect() for greater accuracy? - // Or use kpAbstractScrollAreaUtils::EstimateUsableArea() - // instead of ScrollView::visible{Width,Height}(), as - // per zoomToRect()? - - int viewX, viewY; - - bool targetDocAvail = false; - double targetDocX = -1, targetDocY = -1; - - if (centerUnderCursor && - d->viewManager && d->viewManager->viewUnderCursor ()) - { - kpView *const vuc = d->viewManager->viewUnderCursor (); - QPoint viewPoint = vuc->mouseViewPoint (); - - // vuc->transformViewToDoc() returns QPoint which only has int - // accuracy so we do X and Y manually. - targetDocX = vuc->transformViewToDocX (viewPoint.x ()); - targetDocY = vuc->transformViewToDocY (viewPoint.y ()); - targetDocAvail = true; - - if (vuc != d->mainView) - viewPoint = vuc->transformViewToOtherView (viewPoint, d->mainView); - - viewX = viewPoint.x (); - viewY = viewPoint.y (); - } - else - { - viewX = d->scrollView->horizontalScrollBar()->value () + - qMin (d->mainView->width (), - d->scrollView->viewport()->width ()) / 2; - viewY = d->scrollView->verticalScrollBar()->value () + - qMin (d->mainView->height (), - d->scrollView->viewport()->height ()) / 2; - } - - - int newCenterX = viewX * zoomLevel / d->mainView->zoomLevelX (); - int newCenterY = viewY * zoomLevel / d->mainView->zoomLevelY (); - - // Do the zoom. - d->mainView->setZoomLevel (zoomLevel, zoomLevel); - - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\tvisibleWidth=" << d->scrollView->viewport()->width () - << " visibleHeight=" << d->scrollView->viewport()->height () - << endl; - kDebug () << "\tnewCenterX=" << newCenterX - << " newCenterY=" << newCenterY << endl; - #endif - - d->scrollView->horizontalScrollBar()->setValue(newCenterX - (d->scrollView->viewport()->width() / 2)); - d->scrollView->verticalScrollBar()->setValue(newCenterY - (d->scrollView->viewport()->height() / 2)); - - if (centerUnderCursor && - targetDocAvail && - d->viewManager && d->viewManager->viewUnderCursor ()) - { - // Move the mouse cursor so that it is still above the same - // document pixel as before the zoom. - - kpView *const vuc = d->viewManager->viewUnderCursor (); - - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tcenterUnderCursor: reposition cursor; viewUnderCursor=" - << vuc->objectName () << endl; - #endif - - const double viewX = vuc->transformDocToViewX (targetDocX); - const double viewY = vuc->transformDocToViewY (targetDocY); - // Rounding error from zooming in and out :( - // TODO: do everything in terms of tool doc points in type "double". - const QPoint viewPoint ((int) viewX, (int) viewY); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tdoc: (" << targetDocX << "," << targetDocY << ")" - << " viewUnderCursor: (" << viewX << "," << viewY << ")" - << endl; - #endif - - if (vuc->visibleRegion ().contains (viewPoint)) - { - const QPoint globalPoint = - kpWidgetMapper::toGlobal (vuc, viewPoint); - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\tglobalPoint=" << globalPoint; - #endif - - // TODO: Determine some sane cursor flashing indication - - // cursor movement is convenient but not conventional. - // - // Major problem: if using QApplication::setOverrideCursor() - // and in some stage of flash and window quits. - // - // Or if using kpView::setCursor() and change tool. - QCursor::setPos (globalPoint); - } - // e.g. Zoom to 200%, scroll mainView to bottom-right. - // Unzoomed Thumbnail shows top-left portion of bottom-right of - // mainView. - // - // Aim cursor at bottom-right of thumbnail and zoom out with - // CTRL+Wheel. - // - // If mainView is now small enough to largely not need scrollbars, - // Unzoomed Thumbnail scrolls to show _top-left_ portion - // _of top-left_ of mainView. - // - // Unzoomed Thumbnail no longer contains the point we zoomed out - // on top of. - else - { - #if DEBUG_KP_MAIN_WINDOW - kDebug () << "\t\twon't move cursor - would get outside view" - << endl; - #endif - - // TODO: Sane cursor flashing indication that indicates - // that the normal cursor movement didn't happen. - } - } - - #if DEBUG_KP_MAIN_WINDOW && 1 - kDebug () << "\t\tcheck (contentsX=" << d->scrollView->horizontalScrollBar()->value () - << ",contentsY=" << d->scrollView->verticalScrollBar()->value () - << ")" << endl; - #endif - } - - - zoomToPost (); -} - -//--------------------------------------------------------------------- - -// private -void kpMainWindow::zoomToRect (const QRect &normalizedDocRect, - bool accountForGrips, - bool careAboutWidth, bool careAboutHeight) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::zoomToRect(normalizedDocRect=" - << normalizedDocRect - << ",accountForGrips=" << accountForGrips - << ",careAboutWidth=" << careAboutWidth - << ",careAboutHeight=" << careAboutHeight - << ")"; -#endif - // You can't care about nothing. - Q_ASSERT (careAboutWidth || careAboutHeight); - - // The size of the scroll view minus the current or future scrollbars. - const QSize usableScrollArea - (d->scrollView->maximumViewportSize().width() - d->scrollView->verticalScrollBar()->sizeHint().width(), - d->scrollView->maximumViewportSize().height() - d->scrollView->horizontalScrollBar()->sizeHint().height()); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "size=" << d->scrollView->maximumViewportSize() - << "scrollbar w=" << d->scrollView->verticalScrollBar()->sizeHint().width() - << "usableSize=" << usableScrollArea; -#endif - // Handle rounding error, mis-estimating the scroll view size and - // cosmic rays. We do this because we really don't want unnecessary - // scrollbars. This seems to need to be at least 2 for slotFitToWidth() - // and friends. - // least 2. - // TODO: I might have fixed this but check later. - const int slack = 0; - - // The grip and slack are in view coordinates but are never zoomed. - const int viewWidth = - usableScrollArea.width () - - (accountForGrips ? kpGrip::Size : 0) - - slack; - const int viewHeight = - usableScrollArea.height () - - (accountForGrips ? kpGrip::Size : 0) - - slack; - - // We want the selected document rectangle to fill the scroll view. - // - // The integer arithmetic rounds down, rather than to the nearest zoom - // level, as rounding down guarantees that the view, at the zoom level, - // will fit inside x . - const int zoomX = - careAboutWidth ? - qMax (1, viewWidth * 100 / normalizedDocRect.width ()) : - INT_MAX; - const int zoomY = - careAboutHeight ? - qMax (1, viewHeight * 100 / normalizedDocRect.height ()) : - INT_MAX; - - // Since kpView only supports identical horizontal and vertical zooms, - // choose the one that will show the greatest amount of document - // content. - const int zoomLevel = qMin (zoomX, zoomY); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tzoomX=" << zoomX - << " zoomY=" << zoomY - << " -> zoomLevel=" << zoomLevel << endl; -#endif - - zoomToPre (zoomLevel); - { - d->mainView->setZoomLevel (zoomLevel, zoomLevel); - - const QPoint viewPoint = - d->mainView->transformDocToView (normalizedDocRect.topLeft ()); - - d->scrollView->horizontalScrollBar()->setValue(viewPoint.x()); - d->scrollView->verticalScrollBar()->setValue(viewPoint.y()); - } - zoomToPost (); -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotActualSize () -{ - zoomTo (100); -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotFitToPage () -{ - if ( d->document ) - { - zoomToRect ( - d->document->rect (), - true/*account for grips*/, - true/*care about width*/, true/*care about height*/); - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotFitToWidth () -{ - if ( d->document ) - { - const QRect docRect ( - 0/*x*/, - (int) d->mainView->transformViewToDocY (d->scrollView->verticalScrollBar()->value ())/*maintain y*/, - d->document->width (), - 1/*don't care about height*/); - zoomToRect ( - docRect, - true/*account for grips*/, - true/*care about width*/, false/*don't care about height*/); - } -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotFitToHeight () -{ - if ( d->document ) - { - const QRect docRect ( - (int) d->mainView->transformViewToDocX (d->scrollView->horizontalScrollBar()->value ())/*maintain x*/, - 0/*y*/, - 1/*don't care about width*/, - d->document->height ()); - zoomToRect ( - docRect, - true/*account for grips*/, - false/*don't care about width*/, true/*care about height*/); - } -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::zoomIn (bool centerUnderCursor) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::zoomIn(centerUnderCursor=" - << centerUnderCursor << ") currentItem=" - << d->actionZoom->currentItem () - << endl; -#endif - const int targetItem = d->actionZoom->currentItem () + 1; - - if (targetItem >= (int) d->zoomList.count ()) - return; - - d->actionZoom->setCurrentItem (targetItem); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tnew currentItem=" << d->actionZoom->currentItem (); -#endif - - zoomAccordingToZoomAction (centerUnderCursor); -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::zoomOut (bool centerUnderCursor) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::zoomOut(centerUnderCursor=" - << centerUnderCursor << ") currentItem=" - << d->actionZoom->currentItem () - << endl; -#endif - const int targetItem = d->actionZoom->currentItem () - 1; - - if (targetItem < 0) - return; - - d->actionZoom->setCurrentItem (targetItem); - -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "\tnew currentItem=" << d->actionZoom->currentItem (); -#endif - - zoomAccordingToZoomAction (centerUnderCursor); -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotZoomIn () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotZoomIn ()"; -#endif - - zoomIn (false/*don't center under cursor*/); -} - -//--------------------------------------------------------------------- - -// public slot -void kpMainWindow::slotZoomOut () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotZoomOut ()"; -#endif - - zoomOut (false/*don't center under cursor*/); -} - -//--------------------------------------------------------------------- - -// public -void kpMainWindow::zoomAccordingToZoomAction (bool centerUnderCursor) -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::zoomAccordingToZoomAction(centerUnderCursor=" - << centerUnderCursor - << ") currentItem=" << d->actionZoom->currentItem () - << " currentText=" << d->actionZoom->currentText () - << endl; -#endif - - // This might be a new zoom level the user has typed in. - zoomTo (::ZoomLevelFromString (d->actionZoom->currentText ()), - centerUnderCursor); -} - -//--------------------------------------------------------------------- - -// private slot -void kpMainWindow::slotZoom () -{ -#if DEBUG_KP_MAIN_WINDOW - kDebug () << "kpMainWindow::slotZoom () index=" << d->actionZoom->currentItem () - << " text='" << d->actionZoom->currentText () << "'" << endl; -#endif - - zoomAccordingToZoomAction (false/*don't center under cursor*/); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/patches/checkerboard-faster-render.diff b/kolourpaint/patches/checkerboard-faster-render.diff deleted file mode 100644 index 7cc5c8b5..00000000 --- a/kolourpaint/patches/checkerboard-faster-render.diff +++ /dev/null @@ -1,147 +0,0 @@ -At 100% zoom: kpMainWindow::drawTransparentBackground() accounts for -about 75% of kpView::paintEvent()'s time. Bottleneck is -QPainter::fillRect(). QPainter::drawPixmap() seems much faster. For -800x600, renderer goes from 10ms to 1ms. - -2007-10-12: -Have not reprofiled KolourPaint under Qt4 to determine whether this patch -is still worthwhile (I suspect it still is since QPainter/X11 could not -magically have gotten faster). In any case, the patch needs to be updated -before being applied. - ---- kpmainwindow.cpp 2004-08-05 02:10:38.000000000 +1000 -+++ kpmainwindow.cpp 2004-09-29 11:24:45.000000000 +1000 -@@ -838,12 +838,116 @@ - } - - -+#if 1 -+// (indexed by [isPreview][parity]) -+static QPixmap *checkerBoardCache [2][2] = {{0, 0}, {0, 0}}; -+ -+ -+static int checkerBoardCellSize (bool isPreview) -+{ -+ return !isPreview ? 16 : 10; -+} -+ -+ -+// public -+static QPixmap *createCheckerBoardCache (bool isPreview, bool parity) -+{ -+ int cellSize = checkerBoardCellSize (isPreview); -+ const int rep = 2; // must be multiple of 2 -+ -+ QPixmap *newPixmap = new QPixmap (cellSize * rep, cellSize * rep); -+ QPainter painter (newPixmap); -+ -+ int parityAsInt = parity ? 1 : 0; -+ for (int y = 0; y < rep; y++) -+ { -+ for (int x = 0; x < rep; x++) -+ { -+ QColor col; -+ -+ if ((parityAsInt + x + y) % 2) -+ { -+ if (!isPreview) -+ col = QColor (213, 213, 213); -+ else -+ col = QColor (224, 224, 224); -+ } -+ else -+ col = Qt::white; -+ -+ painter.fillRect (x * cellSize, y * cellSize, -+ cellSize, cellSize, -+ col); -+ } -+ } -+ -+ painter.end (); -+ return newPixmap; -+} -+ -+void kpMainWindow::drawTransparentBackground (QPainter *painter, -+ int /*viewWidth*/, int /*viewHeight*/, -+ const QRect &rect, -+ bool isPreview) -+{ -+#if DEBUG_KP_MAIN_WINDOW && 1 || 1 -+ kDebug () << "\tkpMainWindow::drawTransparentBackground(rect=" -+ << rect << ")" << endl; -+ QTime totalTimer; totalTimer.start (); -+#endif -+ -+ int cellSize = checkerBoardCellSize (isPreview); -+ -+ -+ int starty = rect.y (); -+ if (starty % cellSize) -+ starty -= (starty % cellSize); -+ -+ int startx = rect.x (); -+ if (startx % cellSize) -+ startx -= (startx % cellSize); -+ -+ -+ int parity = ((startx / cellSize + starty / cellSize) % 2) ? 1 : 0; -+ -+ if (!checkerBoardCache [isPreview][parity]) -+ { -+ checkerBoardCache [isPreview][parity] = createCheckerBoardCache (isPreview, parity); -+ } -+ -+ QPixmap *tilePixmap = checkerBoardCache [isPreview][parity]; -+ for (int y = starty; y <= rect.bottom (); y += tilePixmap->height ()) -+ { -+ for (int x = startx; x <= rect.right (); x += tilePixmap->width ()) -+ { -+ painter->drawPixmap (x - rect.x (), y - rect.y (), *tilePixmap); -+ } -+ } -+ -+#if DEBUG_KP_MAIN_WINDOW && 1 || 1 -+{ -+ const int totalTimerElapsed = totalTimer.elapsed (); -+ kDebug () << "\t\ttotal=" << totalTimerElapsed << endl; -+} -+#endif -+} -+ -+ -+#else -+ - // public - void kpMainWindow::drawTransparentBackground (QPainter *painter, - int /*viewWidth*/, int /*viewHeight*/, - const QRect &rect, - bool isPreview) - { -+#if DEBUG_KP_MAIN_WINDOW && 1 -+ kDebug () << "\tkpMainWindow::drawTransparentBackground(rect=" -+ << rect << ")" << endl; -+ QTime totalTimer; totalTimer.start (); -+#endif -+ -+ - const int cellSize = !isPreview ? 16 : 10; - - int starty = rect.y (); -@@ -877,8 +982,15 @@ - } - } - painter->restore (); --} - -+#if DEBUG_KP_MAIN_WINDOW && 1 || 1 -+{ -+ const int totalTimerElapsed = totalTimer.elapsed (); -+ kDebug () << "\t\ttotal=" << totalTimerElapsed << endl; -+} -+#endif -+} -+#endif - - // private slot - void kpMainWindow::slotUpdateCaption () diff --git a/kolourpaint/patches/linear-sharpen-effect.diff b/kolourpaint/patches/linear-sharpen-effect.diff deleted file mode 100644 index 605852f0..00000000 --- a/kolourpaint/patches/linear-sharpen-effect.diff +++ /dev/null @@ -1,150 +0,0 @@ -Changes the "Sharpen" effect to Blitz::sharpen() instead of -Blitz::gaussianSharpen(), in order to avoid parameters that are currently -set in a dangerously adhoc fashion (radius, sigma, repeat). - -Unfortunately, the results do not look good. - -2007-08-14 20:35 - - -Index: imagelib/effects/kpEffectBlurSharpen.cpp -=================================================================== ---- imagelib/effects/kpEffectBlurSharpen.cpp (revision 699849) -+++ imagelib/effects/kpEffectBlurSharpen.cpp (working copy) -@@ -26,7 +26,7 @@ - */ - - --#define DEBUG_KP_EFFECT_BLUR_SHARPEN 0 -+#define DEBUG_KP_EFFECT_BLUR_SHARPEN 1 - - - #include -@@ -46,18 +46,10 @@ - #endif - - --static QImage BlurQImage (const QImage qimage_, int strength) -+static int RadiusForStrength (int strength) - { -- QImage qimage = qimage_; -- if (strength == 0) -- return qimage; -- -- -- // The numbers that follow were picked by experimentation to try to get -- // an effect linearly proportional to and at the same time, -- // be fast enough. -- // -- // I still have no idea what "radius" means. -+ // (must be in range and not 0) -+ Q_ASSERT (strength > 0 && strength <= kpEffectBlurSharpen::MaxStrength); - - const double RadiusMin = 1; - const double RadiusMax = 10; -@@ -67,92 +59,36 @@ static QImage BlurQImage (const QImage q - (kpEffectBlurSharpen::MaxStrength - 1); - - #if DEBUG_KP_EFFECT_BLUR_SHARPEN -- kDebug () << "kpEffectBlurSharpen.cpp:BlurQImage(strength=" << strength << ")" -+ kDebug () << "kpEffectBlurSharpen.cpp:RadiusForStrength(strength=" << strength << ")" - << " radius=" << radius - << endl; - #endif - -- -- qimage = Blitz::blur (qimage, qRound (radius)); -- -- -- return qimage; -+ return qRound (radius); - } - --static QImage SharpenQImage (const QImage &qimage_, int strength) -+ -+static QImage BlurQImage (const QImage qimage_, int strength) - { - QImage qimage = qimage_; - if (strength == 0) - return qimage; - - -- // The numbers that follow were picked by experimentation to try to get -- // an effect linearly proportional to and at the same time, -- // be fast enough. -- // -- // I still have no idea what "radius" and "sigma" mean. -- -- const double RadiusMin = .1; -- const double RadiusMax = 2.5; -- const double radius = RadiusMin + -- (strength - 1) * -- (RadiusMax - RadiusMin) / -- (kpEffectBlurSharpen::MaxStrength - 1); -- -- const double SigmaMin = .5; -- const double SigmaMax = 3.0; -- const double sigma = SigmaMin + -- (strength - 1) * -- (SigmaMax - SigmaMin) / -- (kpEffectBlurSharpen::MaxStrength - 1); -- -- const double RepeatMin = 1; -- const double RepeatMax = 2; -- const double repeat = qRound (RepeatMin + -- (strength - 1) * -- (RepeatMax - RepeatMin) / -- (kpEffectBlurSharpen::MaxStrength - 1)); -+ qimage = Blitz::blur (qimage, ::RadiusForStrength (strength)); - --// I guess these values are more proper as they use an auto-calculated --// radius but they cause sharpen() to be too slow. --#if 0 -- const double radius = 0/*auto-calculate*/; -- -- const double SigmaMin = .6; -- const double SigmaMax = 1.0; -- const double sigma = SigmaMin + -- (strength - 1) * -- (SigmaMax - SigmaMin) / -- (kpEffectBlurSharpen::MaxStrength - 1); - -- const double RepeatMin = 1; -- const double RepeatMax = 3; -- const double repeat = qRound (RepeatMin + -- (strength - 1) * -- (RepeatMax - RepeatMin) / -- (kpEffectBlurSharpen::MaxStrength - 1)); --#endif -+ return qimage; -+} - --#if DEBUG_KP_EFFECT_BLUR_SHARPEN -- kDebug () << "kpEffectBlurSharpen.cpp:SharpenQImage(strength=" << strength << ")" -- << " radius=" << radius -- << " sigma=" << sigma -- << " repeat=" << repeat -- << endl; --#endif -+static QImage SharpenQImage (const QImage &qimage_, int strength) -+{ -+ QImage qimage = qimage_; -+ if (strength == 0) -+ return qimage; - - -- for (int i = 0; i < repeat; i++) -- { -- #if DEBUG_KP_EFFECT_BLUR_SHARPEN -- QTime timer; timer.start (); -- #endif -- qimage = Blitz::gaussianSharpen (qimage, radius, sigma); -- #if DEBUG_KP_EFFECT_BLUR_SHARPEN -- kDebug () << "\titeration #" + QString::number (i) -- << ": " + QString::number (timer.elapsed ()) << "ms" << endl; -- #endif -- } -+ qimage = Blitz::sharpen (qimage, ::RadiusForStrength (strength) * 10); - - - return qimage; diff --git a/kolourpaint/pics/CMakeLists.txt b/kolourpaint/pics/CMakeLists.txt deleted file mode 100644 index cfdfb885..00000000 --- a/kolourpaint/pics/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -# Change this number every time you add an icon to force the build system -# to rebuild and pick the icon up: -# -# 3 -# - -add_subdirectory( action ) -add_subdirectory( app ) -add_subdirectory( custom ) - diff --git a/kolourpaint/pics/action/CMakeLists.txt b/kolourpaint/pics/action/CMakeLists.txt deleted file mode 100644 index 9c426b31..00000000 --- a/kolourpaint/pics/action/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -# Change this number every time you add an icon to force the build system -# to rebuild and pick the icon up: -# -# 4 -# - -kde4_install_icons( ${DATA_INSTALL_DIR}/kolourpaint/icons ) - diff --git a/kolourpaint/pics/action/hi16-action-tool_brush.png b/kolourpaint/pics/action/hi16-action-tool_brush.png deleted file mode 100644 index 93be87f0c6a462eb90b1ccc1cd7da197958debf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 622 zcmV-!0+IcRP)7XG3c>1Txy>n7XH$1<)3rHcXSJQ3esp8kto;ax@m7gpnJ840$LX&%FzQ zK)Aqh9AVig2@Y8bWE6z;;g&+cvvQob6YWG9O)b!ynof{ zbZ+=BA%(+Y~9mtuB)%ni((0)m;)(fq0(#wfd=_}fr~^!_P#zhSC)a9qUfhR zFsw|sVp2GhG`86FG(#H*F+fWM==C~evl%1D+rPl6h| z3GeI}z7!>c^c?utL%5;TyY3l3yNm;$?!xbPj~00000 diff --git a/kolourpaint/pics/action/hi16-action-tool_color_eraser.png b/kolourpaint/pics/action/hi16-action-tool_color_eraser.png deleted file mode 100644 index 39940a72354e1aee55cc3b78e1d7b94a6a284072..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 954 zcmV;r14aCaP)FH_D>DjtjD2a5%SWuISC1zS|=s zBdv;}Y=$666$HT_3Vb|^xU+#T*r~8HHdML3Bl_pLBhA4o1_#uF@3;3?Zge_#z zpJ;5LjvxKm_tg3>QBmr=ECGIQ&d2DBv0-P_M-^tL01{pR2&IB_4uGCsOsxa!ES88m z#*p@lFk@;tVrgq@h^xh7r53m|JFv;NZWQV4rhXF*`C6@1YQj}uk^x}0^;MHJ;K z(K4o!r_9YkZ&EspFh>1V=a4JRn3@U?GAkQM5@&c`$g(CDrzjm_WVs6cv{N*mInu;s zR*1!pw#p1^{OR>`@wfiUltM7jAV^A0(ryP3RA*ThlEhj|xm=QTG?O9-0!LtAk@+ez z(b1RtFwHH#c{+ALi?G`RxW&U-m^zFQN^;9tP|4}JeFLFkK;1Xp^tjQT$~9C`KhSY-vwSJv}+GyQVZE42Nu?Eyk z5|9bUfFYa7(+h!XeE__8^}iFes!e&5w`Oh>YmGsBD~cNpFiGoS9i@Y40*4GF4mgs4 z&3@mN-Z}rw`(O=F5n?u6@XF10{l}jJP$%QpO=Z&k!{o*DKRV)(;INJ)bbI%`k?FPB z=;`T8?V|7~^gn}u@6xK%Ih0pb&>+ZKrM8OmO_Sc~UkkD<{u5O!8a>t3)td}0ExxBE c;9qO-H%SQB<%MQ5FaQ7m07*qoM6N<$f_F5?Z~y=R diff --git a/kolourpaint/pics/action/hi16-action-tool_color_picker.png b/kolourpaint/pics/action/hi16-action-tool_color_picker.png deleted file mode 100644 index 56e83546cd0efcac42419fa1cc33f81ca5cd7517..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 582 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47&QZYLR|m<|L^SV%oxYO7|)QG zm&Z`Zz)-}%kj=nQz`z*Gz!(E!xVX3!78Vv26_u2fl$Dj0mzP&oR=T;lxx2f2dU|?$ zd;9qK`1$!&R8#`V?Cc!YEar@i49+r6#&QOMIsxG-A-#4zjvQ7Xx3aQ|p@zY9iU~^# z^W@1>X3d)8x73%hlX1_UJuZ`-7cXAAWXZCnOP6QP&6>4&)}~FHfndv)E!(zj-@bhZ z!#oCtr3?(K7#UVGGOT4}oXfztl#zKU3-d~5mg&qa3z&K8IQiPRMLUG-w%Iu>w-4PE z5_UK&Vr5vw=CHO4ZJnFCr`(vbW5@23Cr_U|dFIrqv!_o3(YZ5cfav_Wa~IE_zjWck z<%<_DUA%bt(xoexFJHZU`P!8$*RNi^@$mD*PnRyt0EV4qNswPK11Fz=h=iP~mbR6> zvwuKfP;hVv1XOlUS+Mf%y$27TJ%9WD{f7@99WxsJ1pyV*{P84_Ad3GZk=gxe&bi6`a{^&?)5fy`%4dsuI08kYD{|U zw>Pr1sl)I0-l)^+4Bqpl`NV|n<#nQ;?U6cr*=R$_m8ZVXnTs}Tx$?DiRfJ>4ir0{RC(MjtuF)WwWI-uAmdb)+A!T8yl$DyYn?k<8%wRG#(=f4M zDJx|`$^xY{*RRRcts65n3s3jlbI$XgKleWMitDFOnvq{{~U|84vRF|23x Ti$I0B00000NkvXXu0mjfAosv_ diff --git a/kolourpaint/pics/action/hi16-action-tool_ellipse.png b/kolourpaint/pics/action/hi16-action-tool_ellipse.png deleted file mode 100644 index c0d05fe2b20d2a4448c4a0e7b287a6cd9afde600..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 754 zcmV41W zVK1%SAbRnVv0_Al$&zNSt)sinea>7?XC^jKsuvF&e&-y{=li>y-ysk}fsG9Cx5K8r zEi5*5d??cB?KM@J#AZ4(F>bEEyC#C>melTKW%ZNA++1BEvBj;asc{_#p=>rA5XC%* zmnA=~EH9k>Fg`l9MgV&xl9gN2x>juO?de6GoyT>8WG!g95L(DGp$jERx6jOjN{<-nf3x0Dyzg#-QPNplNynrVC9QSO<=rF4Q-4e7oOw z<&b5??_l%-vHxJ($yh8haJ%n;7UTs3LS&l|nHaWA9D!~i=&f}uqUo-sVY`$U(P01O z6g0IS5Q)Yvb$6dJC_1DlstYlMJtAn}i-rdpE-b;zMO&TAnR0#^=)&e!u9$m!4&Vy! z*-_sl$(p12AoK)W6GJ{MX|6f@!zg^uK}Av=t5iIpym`K`@Uk6vMN~9fqZLQfF^EO{ zFvS&1{W@o?c%b(ZB@h6Dph$vn8H&Vj5C9w>o){Y&*_LYUQhkq#qh~&=iwk+Em7pL? zQhbo47@D9MhNMU`KxFe%wG?1Sfg-Q=y?Hg*U$wn;R+RarsV}N%*~l${0#AVuPtte| zg3NCbs2AD!nb-BMZQS(x;BecqyNKjEk~^;sQ*_wRGa^tlo=ljhXr3c!E=bZW7I18p z8G3xJNtO#kBkzVU{%IruVHajizJ-CZk6E4CoGe29qth$4Q7_~DNzD&m(E@uMIJ`XN** zR8XN(T&lQ6qZMPVShcO8rb(-|rkTl`w>YUNBK`Bg%l15!-fhW{iIS*q0qlq}g{xq8^{di?RqkUYFo@yEp-%to!PfCdNOH-M=0T zhEstl;bDYnE;EKl+wP3KxcOwX&naZV$u1>Oz-xx)R&`a-bWKoXiC0>h8`pQnIvOCx z_T$#pOACQGV{V7B~<8DCKd3ip}RD{Pw+Vne3~Tqd6o@y#var# z22Mi8*tyUBJu|Ph4?oL0ZL7`YYcKqnwK7C)W zn!vHuKn!F*y?{%9LBf*+Q6>Nx=ORQAY~>z}%?P);YPH%r>-Ede4jpKzPA|-&>-IMQ zp=F??IY>nSDjETTewikk!4kCO4Qu7SmK=107)t!3*atQtbY;}*#yJG!y`JKu8T}01PsFnF$@E#R0@iw z*788pVI-zh`xUt~jlG?&7f=k!^3Lz~*Mz1ynQ8Q?`=*e8L z1`Z%A!|Qz%83e(j+qL3s4gzIF#==b^T(P(s)Ac#_ypO2wwb(Up4 zh(J)6U&j>;7ujSDU##A>A)CYdju+EV0HIQ;Y@V2ycxkiQk`9N1;~Tmn;V?HjIq4f5 z=)VR43ZBT{(z-RaxL&V6Gd@24d47IAWHOmvYc!hne4Mw7dtvqwo)rdz;Ua$$o37h& b$KUxkuS}LgH=)0p00000NkvXXu0mjfgzi}e diff --git a/kolourpaint/pics/action/hi16-action-tool_flood_fill.png b/kolourpaint/pics/action/hi16-action-tool_flood_fill.png deleted file mode 100644 index fb0e2de5ac6fa4976f4ab6d0b1904721e0807c31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 583 zcmV-N0=WH&P)}(bbYmEp=B}u7> zg%;w+X2E|z1wll?LMuTFvj+3t%=O&aWLXkf#evJt-kI}z=iK*LM5xo^(ul>+Uep_T zyRhN1=_KwsJkh-=bv0&wg})B~bN>w3(LdS4Otmy|{b^zekke?-17iLP*j1j|?u@BB zYYrsVP~t2p1nWF%4iH|uyTMXl`N~casaearWtG1cT(DWm@-b{1s44BmAs(qrC*K=+ z$p_lc##|49dOa?CH1Z&n=YcXGAoi5yULmTzfuUaGqh~IsUw>p@n9Wvwq7ajc0U-}D zbW!XTkSidxL$12+E-T-bvVxGb%o;$N?pb>g%Byi&T@eLM#0aIqi;ITo7_nJ~i!K!e zl)8Y47{hCMQ8y~o%CgL#i`Zfz9l-gX%E97hl5mp<7%eq|8x9+*Wtm*_t*j)@4gGq3 z_u(JE#M1G}S!OdHod^m&-|xwu>WxnYOG>wzvJDTCK{q zf*TGYECBG{dw=4?)0yY%<2u-S33?g(N9zw4@7>b)7pTKBcmt=9Z{NFTvvvB9^&5{! V{kC>bqXPf{002ovPDHLkV1m3m6_x-1 diff --git a/kolourpaint/pics/action/hi16-action-tool_free_form_selection.png b/kolourpaint/pics/action/hi16-action-tool_free_form_selection.png deleted file mode 100644 index 4602a57352ffe47bc691b6b736977031870cb4a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 783 zcmV+q1MvKbP)5r0008kNkly?{a47X!-=lD!xu zsYpQ}5e3l)`;g?zG&OOk+tj8@nR5%L+r9VPb2|!x`1ZiVJ)HCW{?EDR`Qw5hVB3X0 zCFAUIL#EbZ8O~UAyADIhCl2)W%x$g{Z3k<0dJ4mY7PUG$ucoGMPAUss?NYjahSIdF z07Xl0QxqjCDlQvQMa8=F^UwDZ1WD<1h75g5UL{($B_$g^A)zpQa8RJH-pFYM03`4{ zh}39~d{HXH!xIi2g}J8+CjgHz3%x0WUBBV9ct(^TyglC{q@r|5s%!Z?@ z`0w0((3P5&?cfoFlH~x;uEB6kg#9z)Ah-Z4s8stsGj7(^{G$5Ug7a4u`r8~)kXUT9 zjE+b-4hB3PFK{~NF~DJdju-qa`a&pha(RrKCt}9TmL=Qgj;2@y-$HOXn#vC%M!ioT z5+aG6oU)4^*WEXcT88E6S;irT6_`2Ht>3b2cR1Naf+TRIf~1$d4rsUbzd~>ahJs{S zrc$draiOiHLCtY&_w>}nHLKn0G>?Nx$YR3YXi^#x85}B;;F8}1-!xs{+mjG{dVOMB zj8syB5!TtlCn>oPKPG5YlxmMys-S~pBpC>;uDW=0#qaw%(A!h7qYqrJY#d|fOC6Ti z1rcFldKH$^xa>oFLpB;4A%c9>u1@Ui>;!20r+2}YC8KZ&P2)7=mz0!D-T^R}XEvMv zZLBA;Z9+mTFhka*cOLh2#M`E41>qlGHQO2VjMKHv6i2v|RVr9AI(Rly> N002ovPDHLkV1lXcZEOGl diff --git a/kolourpaint/pics/action/hi16-action-tool_line.png b/kolourpaint/pics/action/hi16-action-tool_line.png deleted file mode 100644 index d2cea035ad2249c6ede1df1b92178fce1f518b9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}V}MVH>;M1%4Nc5|$jHpX7>LX* zO)ag>EN#rKY^-eUt?V4_99`_4T^(H9Ts*uWDh*A{jZDpficP?Z&8=)LZS1V=9Bdt& zfhrwcJzPAz-M#%lWIs%osIk|bddir?y_+QFCx(etRxso8i zUg^JeO5zJpsLwAj>s#;|3WirU?nn*8o&m`RzoReo{AzmiLGR4S zSz3y%D;h{FoJmTeOD5h7N#N0?^sNqzvIDb&^H51gv8utu{OGeqpHWK>bDU6UVwhY8IBl%uVyM ze@d*f0`t9^%k-qq5j_C*aWa;hu@{p)l)%YfnBEh^PUo^l+=5?+2}f$aULThg6#qTJ za-XJ|M=P&r@gpD&*wHv2UIn^Qloin9 zlMT1EWIJSRBs9<6veKs_ zC#hi}>RRfywB>UCO{eKqH*{{h_uTWRb7ht<))x-v+~4_rKj(M29Eo!dHgurkP$fc^ zRuhr~nwoeZN^ODuF9iHU24Evxip;Y2;^iAkBC!g6-j3{*xMBg4^pXW9Xp*Y!p^7Pfz zu@hGo2n9sf8Pj!63FB19oN79wBg4I}Q1E^J!rXA7BtajexL)MnN)?BzhL2XAwVkfH zHcKg>SeSLA12GfA#rOIUH4(vpuB|1cNT{u7dhBCiI;n67A2pz$)@ivIX|)Q$ju;>kR5Uk+CxLWY!McQO<|Q~!klO-ql__NHUY>u zWOIt1{Qf;8F#yM*j*~5saKBBMGaUc}Lemb;IqW8s=R~qB zLztY7ZRcEl2gNU06?d5&kNC4yOo-9?_;?tFhdg_To;t@Fsn(V}$FtD1JI`sB-MMC~ z+hw*9yqL`y4MQMAsOFg%?RO@U41e-1|MGsQE$5Quj)0H)`+5QE-JA=-`f-vCdt1E$T8`Y;oZs>j1Gx za{vQ*{Pk6UoVUOFdwy;XXFPGM!+p8Cv!P^WY9QYt+oMJuZWy3M8vr0p!OxyLu!XwX zn>%uxMbEoBUll`$B7a}w|F!waOIF*qW;MO?RCLwx8z67~&n=>miU0rr07*qoM6N<$ Eg60^ALI3~& diff --git a/kolourpaint/pics/action/hi16-action-tool_polyline.png b/kolourpaint/pics/action/hi16-action-tool_polyline.png deleted file mode 100644 index 08665135bf3a6eeff5c6c83aa33255079266c92d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 489 zcmVra-Ia^xgANXbn(EUnydAO{!8#YJ&&At^1xn9UXn z$=Qj6%W`qp_V~f## z`lOVNaQx3Z=&(7YQmR}4Lhc2yIlJ4HlGg}^6k_P=@?x)K0OoP14zmE80Tp#+3p7Tt;mJ6l2NpXh3D(sm1AvbP3p|H4hiEwT!nQ}r+*MLdxjh4BQ2^5$ zFwd}DfnO;mD`N6MTcjEiiNr)v0KYEt{f22NdrgS~gwM|&(GR&#-mjaTpWfwQ-U#Ww zSS0k3J-<*?5wxBspsBLTGG^w7i&g3>7P;KcJPGWC{08JZ>d8>XteJVnU8A(yS-O6l zS7<)p=yiLXXp^Q{HcY;SkOLF*DPjlR{#ZB^%bV2@x}es2`ug|T@|ZG=X0D$(!$vZt z*MkB7vx(rQ(w2C^bR}ES(`6vJc6Ewu{00000NkvXXu0mjfUo+{| diff --git a/kolourpaint/pics/action/hi16-action-tool_rect_selection.png b/kolourpaint/pics/action/hi16-action-tool_rect_selection.png deleted file mode 100644 index e4043b8d2716ee8d84cad5cf4e22e916ddbea781..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 857 zcmV-f1E&0mP)dy z_gS$1!;QO4rY0^Z4W9zi^%#RBNL`i^Hz=aoFv79I=(>`UVStZ7V~Mc7Q@nAbZvphY z{DTu+KW{vB^5|!ilM{JUh_-Fpv*qE#zPiEEvql+9Sku~mEeI=C|FeHLD5YR=q3-Vu z?H!$o1AY4RFSnYTTewyzjHTkrWYdEygt!ojOR2*+PVNxrv5bV!;qBW+b@r#PkJ9Se z558L2*tB0t6&lbK8bBih{oh2yk}tqY^GKkOa~bhShYubNC;;TqnW^zjQ`57d>w5DE zq!50qnkX6=hi_FAFp7W=yo|%+~syyU+ZfHbIj+OZ=!GN3U z(|${X#ABn+Q;$$(7q#qEcfP7NQJpihax-ffgt{^?96c`$i*jrZYYHq=U*{}J+u+z1 zwJ=s>dTgSAKz&YAZobD!W!DOU7ar=xOa9`AUnlM_tF>5LVfL$ZNw4QB+FZ}Pr8P8H@Ufrwt-PPL^S(=J zybMiZNn7h`rZxRBc>}0aM9_U{s`vQ0k#L|jo8N13SES<7!#=uEAByBUu7&yx;@|-_M-+Zod@5wQUP^ zb{@Rj)%E?-a(R6H!f#yH(b0qzY}TL%miRtEd`AJ@Ywj4rI#|`v@LT`j;C8K{+LVKg j>XsE1Z^N=Xgw!|cvh9WiUG{p1(p*UrvQy7{g5P+pWuL7oed0QLXy&F8O|N2gu9h5wYbpeKSt=-?>pe%c)z z3s)z)nl|&ZCTY~Qbyk`Ee}bRw;pvy%tCK2F8?BZWOl_fQT(hBFeJs$XoS=j&Mt#1N z)SfMx`rNE`a}86g&zQtHHD;{`@SSfT-i8qU;MmTXp0hSdjESk%n(%0i#2i_x05iRsbNJMQqv?W$BrdQcJz!KLJYq?f5c5)>AcD*5j1 z)Asp~uVPd8rf(9L;zxabiNM&{cv(s$xY9xaf-xzD=8S{ZYcLR$3&}Z>-KYEa^0_p5 z{pS5SBbE9V9UL60P_Iy6E~w;80Ovw+muhnkoHh_|FyM?KUTY|t%DM$+UHdHP?gewt z*=>z>^^|m>6nb!P3MM>`q;{2DGr_Seltm@A(I_UfjWTCSA>SE{pwZ?1M647Dp@j$U zs@-J8RrO@HUQBM#QqkcQ9SCfg;3d;LaE{qQ*Y#X|XDwAP{M@EB00c+918`j~0TW)_ zlhwIJC$qWDYv_m|h9I8S47QwbGMN;q$?n|jLOG}8;f_|5L0SXEXZsDaTFQhC;@>hm zV?FCHUe1JZcszTU&>#j5he%T>NUWf3Sbp7Les#7l&>CAahKEKb*MBUv71Gc80o4C@ zG?CE}@ilk0`Rw+HX}5>XKyq~^kFMzsq#~>g0f*9HFI%|%N zjNGgJCm=H4eBNNJHW&;e7Rw-=)={n=Re~&=c6q(7+ZzLt(mth>X*1GU>S|Ch@=1ut zlE`EjR8^r}m=E5#cC-C&Ku~gmp~q$U5vp_8mR+u`m5vAn=a5XUAeBmka}HH5G z_x}VurZyZ$kcA3XD%aaW&s9}5WLbvAq9K>dBav9C9!E3h;i}g#Wg0w`&4j4MDVQ zNnv5B0bi!v&>0m7QBcTy7-j552@4R|4jCL~3t09L4E zR1l+Br12b1(ds5L;evPr3y#z1Eecp51Ovx6%CGPr`UQHyQp?Qpi;@5U002ovPDHLk FV1j^2ORfL_ diff --git a/kolourpaint/pics/action/hi16-action-tool_text.png b/kolourpaint/pics/action/hi16-action-tool_text.png deleted file mode 100644 index 694aec8c0e6525dea1f777cc9b404b9b696ef742..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 332 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 U;d&IFZvX%Q07*qoM6N<$f*+y-Z2$lO diff --git a/kolourpaint/pics/action/hi22-action-tool_elliptical_selection.png b/kolourpaint/pics/action/hi22-action-tool_elliptical_selection.png deleted file mode 100644 index 4c63641834638607a032cfd1e42f49df8714fa37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1264 zcmV_0!$;UV7bOecohx+JcL%X@A>wiQ&=N_H&Hhdyn6LljDJvfGP?uf6UwHaf7r?yM z)A7vJ^v%`u&errXG&auG^fNa*(b@LV+4R!d^wQe&(%SUkg-1X$=`Pkm~)!Osf-uKzx_u1d~b$yj|dXw7U_1fU|+~W7#;`iO+_ub<6 zJ3d1(G&bGi_}}FCKS4&{<@n&`_~7OE;^+CMs=eap_?n=yijbn?==kO8`r_yIi97-y;H_%Jg!GBr7xo~to5HZnCfnx3q#vc7L~ zf266hKtxPjVQNQ8QDkXzg@}=fjFWzXiZV4gGd4L(Pgi7UZ!t7BX>D>(Q&?GCVKO#5 zH#|U9SY16pL_tMJIXpi)JwQ4%82|tP z&U8{vQvd=62nY!Y78n>B8zLhmCnzW_E-^DSH8wXmI66H&K0rW0K|(}DMMg(SNlHsg zO-@fxP*71(Qd3h^R#sM5SXx_KTwPsWUS45hV`OAxWoBk)XJ=<IhKGlUiHeJhjE#*W2IU;p67(?e6gO_xJhw z`~3Ywi;a>100Cr4L_t&-m1AHa12CH|njkI~u{wwySv2YRxf9!FPFZvK+}RayK^FV1 zd)CjMHmR?pdFtkk%1jVZ*1Bbj=gpilv8%1Is<B3oHrL`4>Iq7kc zAsbF}GH{(bxB#NG2Bb7PJk+=4TrNZJxwQzT330J8fhO|%cQfqRH)UdXJ6LIYa%#MX zv6{MOMm~eyq`pp|(xRO7^i)qn4IKkB3oC0L204(@l7j4%SQ}L}T{CMZcQ0>0X@=@0 zV5RR)o00xX4bLR(}yM!bbHmuyW#g>f$29}>Wcc3*gYu&MP$I}>)0DI6XA71{RMW)OQ aWB>pvGl|l9IfjD(0000L))MWXPhC0hwVLuvh}p5r|05RunCEfF_S&XlhgCQPk!(J{Xflf zC{I`f~} z2Y_mtjy(1C{J9ohywRshL%nLO?}F<5?Z?Q^Z|%E~mtr(;tiP|v6vh+wyz^VwGBBE9iBKJh)^3;t$SKqa7zrQ%qgiJ93-qOqW_wD}pjq2AveLBCu zq~`=!^+!M-iU808gyjfG%K{i>0T?L+SH~y9-R|47zfP?jAX}-lTP?P)9Itj(J1QT~ z(gCZ4-EimXG(5880@lLAyjuY43Lc`5KtKpWcwz;LZMNI<97#_yXm^p#RDN`5@A2}o zgI^vfE;6yRm%xASJZML!Kxb5ew*vSs0pxIKdJe#?Ie=6}E7_jib6p)9EYcZM6qTld zY*cA57*blAo6o%TV%aO2>5-78>4XyVd+9U<_ssx{ELyq%kYxb~;{kIB%`bY!MM9x4 zj9z(;l5w8~UZH83PN=M^s;cPh>>Paa=+UaMC~0Plw&dQ*Ph9@|-A+|Yg90?zV-(m- z6skdRz#tbMuDMB^lc_K>UI;1x76HuwDrOW4UyaSp%|AFCj%uUP$o)Mw27({}P1ErM zu~?SnD_t{%*V^pN9gl%R0=xI+B^`e^!VGlhfrJDZ6Q4ZI!r5F~;Ir#|2}w;&wP$5! zmd7FUc(?e!M5ouUgJCTgwe0nR>7tULX}oVCJJ}+Uj-S#P*Hn63VM6JxoE?!7v%&dY zf8f~MQqW1F(I_BPJ2O2^6jdEVpYsVJT83c~U{DkVyPqQqW~&0<)Z}sQSx7)dhQP!N z_CUX%w7vJs%qhTDpg56;qNr%JTAJfH+UN5lk|bHZUaxgWdb-FMdY zDWZI{#S*_da0o-66|@A{_1|!@e}He3lKwjJ=hXi05mz_z0-HfG)`!r)bJbQ`TU&Ri zy!`FQ3JNmJW;2CWIB`8^!R3mbZEqiLZEZa{IXO9mYa4*un8z4KlgYHJzP|qV_V)IG z$KzS-=;&CktE)SWdpj{T+a0r;&0PjFxuT+?y0Niww6wIeGX9Q9-4C{%d7Q9EhbbgF f{vh$tKBoTw`qZ1IokX%?00000NkvXXu0mjfm)k#Z diff --git a/kolourpaint/pics/action/hi22-action-tool_flood_fill.png b/kolourpaint/pics/action/hi22-action-tool_flood_fill.png deleted file mode 100644 index 954ce97e7f39447215355f45ecc460e9037bc44b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 783 zcmV+q1MvKbP)TJ(R{6e}HP$r%KD}5y=L0QoI=YpV z8u2t2ds-`GrL|tEna8Q-K*e8y*Eb*ArJTE^H80mpDkD}gPvE?oi3GlON#M%X&Nif* z%v1;|k+>CwaL?1_fKLEkmKV5sTW1_;5Ud!aG$cTQ>j*Ac;OheCC5t{@B9Y*si8qzs zQg)wH)NP$&NIA&hU?Gzwc|-$APWeX8N$XrA9`s`xT-6-ki))?61=d(ah3KcGopoV` ztYm>p6TqZV02i46j;(o$vL@MMd5{j++Mvh+$!QqLiNtNz&@3Ul;1|G@e5aoi4Q{^) z@XG?0cn1X(z$qHN6Be3CWKst1kh405@UTHG2fP<52)VpS1z8Fx4Tl&aQD*J3Hzi!f zn5VzTV&18=C7&!n2APJPPk34=Kt#s*Sb<5Bn8q=i7VznFj{u93Kcr})Ipt6E-h5neP zZfLl=C0@1=oE#hIa?W1)8y$;R~7I;*; zzoD!mInsx}%N?FE?t=EH7GrqgG2K^xh)1{k->ZB=_PD2~ha~??{Q!1)qZJM>Z0G<0 N002ovPDHLkV1k2#YsCNn diff --git a/kolourpaint/pics/action/hi22-action-tool_free_form_selection.png b/kolourpaint/pics/action/hi22-action-tool_free_form_selection.png deleted file mode 100644 index 8d7232cab31689b9cb1def00a6a0ccf7424d0eda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1188 zcmV;V1Y7%wP)j=x^h88KweamSGm00%Y8j>zn&|rIaYu@+p}}_`~9BJ^L?J* zIS;0kqU9_qHjd>up(HUWv!%VQDQkXyCLflY&8FWomy084Wy|w;Tos!(238)-D+mh; zTIWWHW^?_LQ=!N7qb%?hS>~jO#nXu&OGdK zOw4of8b(JDM!^K*V0enDDKD1|4BmXx?RIXh{^a7EBxU5m506|3Z0yNDF0w5^VC|LwkswfJQT`tFtCxb(}4jumRl7GMkyDTHkqbSnZ zs*>%Jb1Z`)G!{eC9|Q+)Lg#B6e$pPQ!;3&rrm0BrmQDfeRSI%tS)npQ8iGU`luYeT zWE;9`oBrza<9n@^zV~3Q3w$RFWp+(XjVCIy<^i={ph7h&{Zl#xpsFg6K_-Zy-k!=b zkt|kuc63^qbJ;bi<%fzifW8aB9`F>isohN|)w(1}(hUv`@H4Zs=v>X2h=VzqxdXR* zdFX*hRuEK)B(J&|t7_@$w-2^=JNri`JaYz}rrWTN^_iaR+YS5e;K=~BATSpE3L#99 z$0N%{g>Ss%urI7fV0Cp>Ddi{Y8Wfc()AQPc&K}!10`vD{g|z{!DDbRaPq3aL3Rifn z{wy zACU+mk2#)WIZ3jLr^<7VIvopL*%|E_kAnYmRz#=O8i=i>bX(NhzlA;fGzs+A3w}OC zFml9TFfhDchxzJ{OZWHP>PSG87MZXAQN5~PTA8}AMRg6AkMy29w5XH{MxKbGfi>_P z5j#vjZw2TsX#KC99j3FZo)tGtrXEC5w|#yz-R+w2H3}?m5E!20u)uT3@Ll7j1b{jy z%j8n9#~MPI;2}y?aiqUB6jX9hJ_na2I2Pu7LbpZbBURbb+17UN-(uP2!E9{c+Krc! zQeVBJV;SR*-(QUU<;piH3pQ&Ii)oeFY@S{cvhw8>zTf|pfg4DOiivky#%^r>@{7vD z3%0osIBmrgRhX~0S1u=tT{3^eD8(OO!h|ELhCmPXH%-qRqez;y+2;H)MwK$loawoC zZFUJ~#a6@sY#*Y^U3hN<@0}dKT?5~`%R36uW7uC^<5tqu5%JOh0000IWv}|tpEiVxL#7A`A+m5)h058o&cS?7s zuD^BGRex*s`_^s8s@COhn3rjME%+_t>&|Z-Un8myRV}eiw!IR!K`vu`#P_Y{YpQQq zUyFUq{MzgHkzHOcb%}RxI@Bf0MrYVnykGF|*Q)Uj`FC!N6gbSK`-AW4-19r%{hz}T5yUV)&g%(FF4S3O zCVPyXugi;G&KV&F69>)5BIJ7bc7q(|binHd z7JYDWnfUs~Pzi>l#{FfGE$j2_h|080cMjQKct40>E*coMQwPhwk2WOBFK6!IA`c0nDw!sn)^R%ijnfRI-Et(6Ve1 z4hSfoyv8YF4#Z#N+$z9i02CR(Jdg1y+2ECKn)b^C)GUHbkSaIM5qbp_lR{gdiQrYR z=>WGASP6kgos91HL*;&{+TTvYBFAQgktjBaWs%8goVFBLV&&MI#pobrt?{NypP~0R z)cpNk90fK|X|;$f1~OBD#cx~V!??-;Hx zdFyNu5xQ8cOz0G(0UPrcUwo|14w=J*4-HjyXP*A3MPNMshHherj>4u)+*(>ugVT`{ z_2-&KYJ>gmf6X{KF8t^D^o52~bt5o7;)=8)*vaNUg%S@c;k-07*qoM6N<$ Ef|7}AB>(^b diff --git a/kolourpaint/pics/action/hi22-action-tool_polygon.png b/kolourpaint/pics/action/hi22-action-tool_polygon.png deleted file mode 100644 index 407c901238ab5616f8d4811413b1743d05f9f731..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1250 zcmV<81ReW{P)lXaiAMZm-1ASm9dQ`_5x?KHhOr!G3QS_Ln~ z%fwcT7eFd1UJy|Pyw7xVjXG;vRI~_)r>#-vR_C7A$cH&K?e^iH7dS7!_qqJv=QwO{ zZ~seF49{}HnI>3EKu+klH`RX76wr2Lbm9t&kzR+Xs5qO5MVwhLuuMY-7AQX*QEUrB4! z`31%qXt?tx${5rO@^yfej9;COBD?g~VO2jl(5WN!3XM(MthQ-n%HKaJBN2;`T*SA@_M9r4YyG`bHdz2-jXL5-0J`bSz!o|is;R2F0rveTr zpO;+b&fa0T2F+11LV>^@pzU(e*wA57rseBY>HLunezi%)s{uh7cvTCs^y0a?=+ws* zKIbR+US}tGG=>KWyjuu-6dbX6B}Fi0ZxD*IQo5ulYcRE-D6ex>YUsrlgYCJ_6^tu# zDvgr(OoK2W{!x)n%mn|`#ovkoqw4-5QaCkqiQG-*ZYp6-(&x^jl zZLAA9$9({o19TWMh{ak0^O!h_nCkn zLA}>boIGnpfuIJX68fABx6qlKj=e+ZGR2A5c-K*%@riSBH3eNy+%5T_>4mdAgHicn z5_#k3Mk3Fn`vC5_xflEe+IS4l6;bGJBo%ibL$x|=G&*zqYhj#j M07*qoM6N<$g5ia2nE(I) diff --git a/kolourpaint/pics/action/hi22-action-tool_polyline.png b/kolourpaint/pics/action/hi22-action-tool_polyline.png deleted file mode 100644 index 6a5bd710074a828e35c0b8f3c3b62f0c8ffe4e09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 719 zcmV;=0xdp^G;HzeeRBtv_`dFS1G?)l!i=N@i^ZQI&vh|y}n z{z2~s%s7gOAGvHM+74K@vF18DtqCzLgf=tiJJ7jO;7$#qP&=e_awSTE2unfXi{Db} zmWGh|W+uY;y0Hc9@wrrDu`TdE&yXRd997VwxiFtj{8jF)>|xGsu!$+@^i+v=!PKB0ya?sAT``CJZG3)DsrU|>)Qgum_mDaeZc5@eNNeQGEYs% zY|TE#I$H=i5f~mZnt}(0{C$wm^O`3pD4;qrRx+22=P+ShTTHWXrd7swAh@7SWizQ| zY^jn>SVp$769moEB1Sb9b#h;Q;eBozUB= zeXe|5n77IvMQ)NcwY~+s*h!NPu&(PD0rV06ej$^3T|LM$wplfjvFIE8pV-wN4sl#o z56st1WRO^s;pMs>sUBW)c`jL^leJOJO5R{@BX9SzndH~H)+;j`T(JiOhkM!nS*goY zy43qs0=)%0WKjR5zmMPY?20h(Xte-8ky$s)R7IKZ-eH7q1-7rS+cSr!pXD+Fy zWbjbX1;3bbs~haed^&l$7V0|`@Y6=AN}+j10PRLMp-hN8pqC_cKNbn)Dse^ys`~UF zT3_9DT1~s5!#piq5wd%Xeeod@DmbrAAxwc)$HD>!`cDa{lrle~wI&m@;iXph@dyz+ z)%ca8`4h2O4(KGX9)<;%tK(5L^w!i`$g2IB{s;B5syh9zB8LC~002ovPDHLkV1i$o BPapsQ diff --git a/kolourpaint/pics/action/hi22-action-tool_rect_selection.png b/kolourpaint/pics/action/hi22-action-tool_rect_selection.png deleted file mode 100644 index 0a86d1bad57a473e89b565dce65dcd22eef07162..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1210 zcmV;r1V#IaP)~2e;Es+)qQ3&B)AmSw&HHu(reGp7E5u*?yR#YxQ6JESvU!d`p zfb~HlLLYv_h zHJLLFJolv)t2gNgYDT1t(cvj+O(?`^ho>Yk#;;xr`}*?(1%sMef8e`)6;IXI7lz>N7F=|0!csYaJ;CNc*Vsvbu8k z==E%ADUHk=B&vMx1gmEu{)ZrVJE@oC9#dSnu^Pf4Lj4cJ&ncIcIG8 z0gb^!V?pC?3Z1I{9z#Yeu6UV!ybeOT3 zv3}UQdMQm08~C@%%Bn8Hio;XVItGh@E?milxsEQC>mN{ROquPBF0(z)WeGE|W0eZAd@!Xcg9fM14P*`<>+LQtbL{csTz}kHnNFvKKsZ*uT8FbclJ!K57qQZj&IP4F(R3Exu5j8 zN2qIC%#jijk`pdC!J1NYBv%f>OWHGMj|B?bP0~|s`E%|}ny^HY5_^=`lbkz3fK6#R(3o92|Id~kup`f zIUhYr$aIQZzQ=5HNeP=J2uoO;xl%IMwz)4DCJA?mbU5S2()6RWkmikMb1;a~M}|-{ z%wupJPGt$Y3{H?`Szr-j2?@4E2XO|DIe;o981o3H)GX@n@9!hRGw>5_f80?u(_6QT zgDyv4A?snm#nTI#OXZUt-+a;dmJW**Qc9$I(Tf%>J#^!g7WEx+8oShb5-l^k9^}KoWdNjxmV89rlg$TSi+uE`JK;|c}cr`=)BA7ma*xAy& zH<0$}L@-dp0McYwz*z9&@|7z&6zT{_QE$IA`iT=K255Q?ZZZC&|M)F>zf(2d*8jYJ Y0fjvPD`lfxj{pDw07*qoM6N<$g131%g8%>k diff --git a/kolourpaint/pics/action/hi22-action-tool_rectangle.png b/kolourpaint/pics/action/hi22-action-tool_rectangle.png deleted file mode 100644 index a77d2d6a3ea68d9259aafa1954fdb8d986243905..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 742 zcmVz{0QP5m&5iMmTQFHM2)ywN8m;-oq6adB2 z0xU9AL5>^(!Ac-1K@V?e(iIDya+&82lL;Ju-JJ9$lYF@ZGcczjunYzQ zi!)rh$|VX0LZ@%Xt#&%xiPJG(2j-PvhYTTp;ZmIIGPlBZ_OoQCH66x1JD#Q%#mT6^ zV4+z3Z;h$87)=% z%lLyiFlL#9FIz|Lcb`U`MPO128AVD*q4t76dZAI;^Mo4Jjep`EZ)}d^_n!~Di$KFr z=|-eYJ(Q+aQ(i6bv@t>(PwH+o2i}RtgX8XE(0W~Ym+IPYM4n-I5C~HX6uDN~D5;~G zXG(B;?=ZP~b1~@Uh7Oh*#w8&-QnK7FV#}%Oe7?dTqqF6 zg2O;aC4|C43cW651Rg;w;!@7mtMtQn2iLs)){(8Xx{D9Iu%(SBh@6xg|nx-MC4}J z)MRnh#*LeN$4NwbV~bKEP{o=DfQcrCRGJ4aqtxZn2Q{vX#jzZjF=N?I?)`cvtJkYt z*`6))kxsL#D?MmLSH#{Ex>zl`gP|$!|NuZQL$oXh4 zD2Ia2&!Mi&4Wsl!pzwQOkExmiU%D`P9?Lf*@3%pB%iS9npB4uym4I z=_Iod(EFD?P4_>%b7kO7 zZC7HkPbuDu6tY`E{I|onwS=)xnfZg|B*$*;-f;ZmcZOQu=>PZT{Q*SU)s$6Y?U(=n N002ovPDHLkV1mZa2zvkk diff --git a/kolourpaint/pics/action/hi22-action-tool_spraycan.png b/kolourpaint/pics/action/hi22-action-tool_spraycan.png deleted file mode 100644 index 83e453c11f8271bf49df515edd118ba86c87ceb6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1096 zcmV-O1h@N%P)#NCZNXfglx5O{g`uGtP`Nv(I&3*1oJBjx%M5I)C`XdibvoKUl1_G^G@G zs|yz{>eJJcKS?Pcb)1&N0|PG{=RV53*FdRM+GpF=2G^aVv#WdGnKNf^X0qa4+p@ZY zK%OraXSeOx@rGJ7Y+2Ue#EtR56n2y6)w`Non!bu;q{nfD-DJMm(NS0iZ2tc~{a$c? z|MTZMJEEfJ)u~j<#BrpjX^QU$_@0mBh-Xin__}Y=@W{xPcar2r@5+@cNYjLo;SpT7 z+JOClI9A!#*8Jy-gCniGRI-nk%bqbgIY$x$SPN(_p92(aZA;c2J^E$;{lQb3sJIWk z?Nvidh7nVfGfYpf+Pz_e7e!iik}y$W5G{bdACk$~ z%*?p>en1#Xgb=j0<{oZpGIre^9@AD6@_2@uZp#v@WSKUWCCKG+c%IMjaFI%-MzvZe z3?+u4qm;_7?WyhEyZ2c3&hQn@A>d^~AcW;DSH3H>;p68=8i=AuH zAL+{v?A-ZL$L;XX+LMH=LN?I()T@_$|Dh0KtbsRrKDFys@V!9_%|$|E6*P5r_w_w+ z@?ZD|t(B1e|AO7=CL5PtXLX@UMhCAdxH`O&k~w>{)DGxe8Tmp!1? zm&@@tLBQElr{2G9MpK`#iG+_)%%ahOP8Px6m`tJLVvxb&Gq$O#ETVMws0$=~0TfU; zD10Ps1muayBhe|LvB=UEKGP%G8Y~7#5okOG{DHwW41UGpGCNhe82BIHfC)IzLm`L& O0000^5UPQaYXb5J1t3j7ZWn1?dRV1zkFkcl*=efV442nI@yH z?`{h?<2d6ObPy69a0|6-F=E`7upR>g(|}OXnhW7X=W#c(3pmBVd9Sz!Hq?BOhO@Yi z`VRx&XZQ8hx=A+%wxl(Q>lq@Q`uCNk)_Y7aYi#i~nabVH3S?W?kO1_;bUzEM&^kTj zdb`t7PPD=sEe}eP$4CT_|I4S{{@p~+F9XlA5Er&dIsQsZDW}L>fwyfUS#gV_6({Sn z#7|<{%cSG$Xg^5ck`9f7tqEopWL6y}y2%1N8~MSk3Hc#+WB~qujXA-(*tDWlsh%XF z15j|q$k<{eOq6!HWlqF6l8sH$q!j zSm8&@^&Irs#zqTY#*B_BS8HbhZYZVZn{%^wMaotvjh(^pE6l33v@n0$ysa-$R7J-_ zHuagFeoez8rEj1e@{tkvr=I>GBXDz?VW`8jb(}002ov JPDHLkV1k}wM)d#y diff --git a/kolourpaint/pics/action/hi32-action-tool_brush.png b/kolourpaint/pics/action/hi32-action-tool_brush.png deleted file mode 100644 index fe1f61370ebca1819b5363fd3990d17bad6172bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1504 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 diff --git a/kolourpaint/pics/action/hi32-action-tool_color_picker.png b/kolourpaint/pics/action/hi32-action-tool_color_picker.png deleted file mode 100644 index 35e241ebff864b08d2514a008e8d332dd6f8cadc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1369 zcmV-f1*ZCmP)yOJ%Mu3;qbO3a zJVoQCjxaP*2FQdt7RRfAP$vQYBomI%v3Cc${PT4H=acGbhd6bQW{fWxM{%F%B^6j44jggxi}_u z8&0X?rzKCrG1D1lvHY{>PvmPIlRd#1gng<;r$(>G2dwI>xagUpF9u3e0og)_l@ z#U@;tdIsS~2!FzK3<{$H$=%7=)U*jwgLEo&Ifu}OP$*iWA<-O6^N!_M6vczZXnD|r{T=(^qxS*Z!=7@{EW{=60j6S;l59_SAM}Fn!5I)2c*5h1 z2Ruur!|(J$Xs&2*`|)k$S@SSU_cqur_Jr^-N53F^-@bjTK2Xj3C-77tB7O*i_W>{X zd?SVQh!^}z{jsYq25I%*qWo4l=IG{tMYBhof(7xtf(J-SN(xL!NO)LLQwg)B7jtvx zK$78!S?Rv`@bEk=D_H`4#|hNhE@OV~e6XGDG2x%^y@CfwOiWy<)oLHs)YQUeyMgX* zGx947G4r?&RFz5?It`GeNpR?o45a^-25Gzm+?Ont?-e`%rT$2x(fn0iec6tiOlGvT zT}Mlc5w*>~pna$fC!34mO=k!`wF>Vgz5}*{^>90wm*4>i4^XQ$la%~5+-&Z}-Mho+ zxAfyh-1N8&HU z6_k22;nVqkK?Bgrm#fw42}EJCfgn#bSkC zpO47M$Z-emk^u-`s#Ge+C^;n@d?Vi9Z?WSM5fS6-)~#FS=oLHwrCvh#0|$Qnx`|fa z=EU#ao5D|=(1Y$h9vT|zz=aP$@Zz|*I3B0eUtd3RbM>H=kIUt92QGX7f)~Zc z#@?r&8sP)z=;$Kc=zQ8oMn=%v+XtO4m&Yg8u3fv_(JOcWg8laH-Fv^Ps^(RklD81v z=ftzKb3pfY;zH}yyEm4VmD6plXm9VdubhfdJ8s`VR#rCX-V-4qAuC*gI|takd$%9` zyW!TYKb?3}(^T@&(NQN(_nug@W{n+p=>XBu(dVh>OL4xKLZOhy#Khq0)!*&wZfLlM`ueLdnR@JaX67-%<&&#duMTj_H^jDW+v-Y6 zPVp}pJ6>1!EBH5`!SFK<97yAnTM1w8wlAnHTejRUDmuxdcKqDAQm9mFY}l~j8QnW0 zC@4tm*6+utsHo!f^zTqnQHiv)bpEyagdVm+y7vM%!p>qFH*S2obodXj4>^ z)nGb~jwVuQ&<8||pdc00GM(4&Fn1xN&W!k=jfea9yt((B_dn;{Gk31avMk5{6b&{5 z_^*Q{57L(!vT=}7RZm9xsR0odPXOmH-P;t`PKUZ!7UBl8AB`%nj!2(_~uR!mpbxbHA|cbT1= zim(+~<+U;oXjfM9Kxn&GITh<<zy2*{0K8fQfV~^VxbY|gSK`xXU zjHi)*13y7l!EFd2O7n7GCfoVBxlc4*541~$e1Xq5B!B>LrJ$-=tmLqn&an_Nlaj!b zL&eS+bCGDYH*zVT17}7~S+H)g2!LdgZ3)1VLyQ-uzGAw4ExTYt<0;n5 zAs6;owDT*5iPQOr^6xeMpO~4Rx|en*+_;eW8OXbpIhl|d)K`Mq4+_jNKbuT0RlSNl z`(S$jB7ypFCqFP9=4YA#OxcmomX$mP`PhnEv7HjEKkQRlcR+pslrZ%cydi|HmyxG4 g>Gqrd8*T>h5Br?wCE#U|W&i*H07*qoM6N<$f{8nmH~;_u diff --git a/kolourpaint/pics/action/hi32-action-tool_ellipse.png b/kolourpaint/pics/action/hi32-action-tool_ellipse.png deleted file mode 100644 index 4c067138e8da5ac2d6241b17ad5b5afebcf4846c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1673 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 diff --git a/kolourpaint/pics/action/hi32-action-tool_eraser.png b/kolourpaint/pics/action/hi32-action-tool_eraser.png deleted file mode 100644 index 7da1f46383956f659b856ab50668bf68a4f163ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1886 zcmV-k2ch_hP)X=CXmhDhvZMK#M*jwbVDC*FZan$lwg!d(y<4l@2 zhX$soQ}?XP=)CscxK&n;@#<3Wb;TH!6vA5a8Bml9ZT=UV-^oEbMQ@U_5yrdJ-bhBl3rBwIj}MTs|5TxT2BXx$tXK z?|Ibw-HV4_Hjm_e0?W1Y7|%ZgP)XFIfRb?c(CH_W1GRH=3K9t-7H>dq?)ALCbb` zGXgo-NSKhGl(T|EM*vZ?XGGjb!7Co+P)DZt(8V^qzE_UW?~Q^PSw|vz(6hvi%e2hE zEb8#^@F%mfvikLUJ#;!9YGg7L78c^u(7G(JghU&Z0gO&(JQsNK70(W2EU$;p{YrP5+Dnb6bIgVK@`d|p&^ zM>*H8qxkKlc0;895Fg?I8xy6#J|P5?o_N5HQwbf|z0$~11V7Srda4N<892K6!Ct`t zwfWn&ZTm@fc6P7XY=+fp#o*u|%1TQGiOb4RE*7KW=1oC2Nx4@(8ErW6YUjwVrFKKu zd>BHVU?iE3KCiPKe^G;wdw}&E;LlCbd*7xX_Hn{lk>_aq<~8Riwj0M>Bqb$PG%FOt z7K;T&qY+Yx1d@sh;aXK$iK?n9R8NVG38qReUmR2?#|#cU;}3JrIj!Y|O-2Myq$F@Q zz3d5h%RhhRsT28muw!`*$w@G9`0!y#U2QFDWwKjxxxBlQ0?4YXQA=a>b#;)}*Q24K zfr<5nF`6&TsjifaXp64i8Wp*+l(4#(MQ;kY2W8KDj-~Bc^*O~0AT4KU2fzsi5)%_| zHZ?X1boqICb~4aGJ7A=#sR?vNOG^t{C&c;+g#rqC*52N(raBo`oqn^!@fU6^cK&TDAq$Hm#JUIDFYR)t*wkqD7I@^StuwdFw&StrBd0uluC4UbqP{Z zU!&2O)GC!$LMbXKE{5vQv8_C#-!MgQ4xERo-z^`z@rPBF_d0Sx6zBVs)J!uCNR*wO z0#&6{Dj2w)osInbe759+{e68ptyYWP-d^0IMn?3tH8rT5s0GcD7n`TkH;LT%f_)yw zgF9Eo&!nEI$r_M$cXy+$txZ^kBHH(Pxw&i=7$Gyo_xJbf3kOdKHVPIf@ z*QnJj_rkn-D#&Uo#P0Z~+H1mGZSRXb$A14~?;{h`OD3uBW?%swLXYj=zdx6je6*cb zfxTQRl}-j{)y`IjEx)~&4k%`{jcSI9RCso5SMbQ;tzJq`XQxfGsqb#Uf#gi`^7Zxo zbxKN#k`5ay5#I@3M``Ko?6i-JjDYF^EM2T-#A2~6?!W3}IHw;bY#B+5NnSg4?06v|Awg48 zQew%;$uY&n#Yvr=oqxnkPXG9rO9Nk&7GK(`S7Tyg-o6X<92%IN7G}hKlKTH2r*ox$ Y13$bnsl=vyWdHyG07*qoM6N<$g2%z4v;Y7A diff --git a/kolourpaint/pics/action/hi32-action-tool_flood_fill.png b/kolourpaint/pics/action/hi32-action-tool_flood_fill.png deleted file mode 100644 index f8a8a8b82d25d548bf22498aa731ef95788c1648..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1176 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 ubGt25Swc#JQCJyh{cA^ksR|3;YQa^m>%p9 zVXf51*u+$#B9~JX_5Gp*Fll-fsfVo=o`G0w7p`t;g%cO2?dI*wOhzvCJLGaY)_C7e&Is_IyqNbsvuPrD_qNO;P5=m4kao z5EdL(Id%rND3ap=6_JeZ;1Z=l-xULGlGmc{%QaCNkgp!D=`Y~%L z+%+(8zQKL!6F}<-=03-a+OFkD_Nd&u<8(|)%ZWAJVbPAyq4E>d{!t36mTtE`=*e5Z zwKOy;-zBeP!VYsEpIQ)Xy2GlTj9LWLN{m_sAh~x~$I5_6(YDaIa$77u{Kzo3aS$vZ z9%4`&cTG*rj}|QeUbr0K$YgV)**d%m7Ogi#$Sijs@Q*%UW;l;{9Egu-X=yDZ`_&t<7Z)jo$M@FXRKxAxY zVQgk;Vs2?_VP$GzZDwh0Ze?R`ZEIm|XK7<^W$R#N=U`*+WaHp$>*!+dRzUpgC4RbIef9v9@yrnq%weZ0F=+@9gI2;_l?;0W`$b z)5p!r*Tcu((=QNc6vRoynd1sF#}#Ofr;7)QIde3Z%>eq^tR%=Um?1hQHZDFPAu%y2 zIXNXIH8m|QJv}2cGb<}AJLeA)_=^nUR!w>cG-0c!i(^Q|t=cp0Ld^~W&Vh}F=PV6x zeBUq0bI!88h&M^Q>i2vrhm$jJRHP~x2?j8wtxK2k`MmC6i)~=SnR!kPg1cK8oWJof z@!Xg$u;Bc@CI;JYrYtWuu6V&$r>Z2nV-z6J;QpQwky2Ip@>w491w6cx3M%pFMxQ@Avcl{oeNxz-~&G zImeh17IfC7u4*s**qE9gC366I9PECe^nG!^nrGp5FdOmj(=H7CZf;~RrG zYc6o&Jy~V$nE~b};Z828iCf6n`8EBWwd`FSR;szc<;>tttOEUB(BT4IZ^8B5Y8FwG zwv^35;;Wg!$;I+|-}Ml%3EVV7yC@u?>?tS~j>pZqu_-_tG!v+c_d8{^=)mj@ZF+^k zl~5=Y28w60WtObd>=e%J-#qtYdr_*Z32_vpbqOH7qZ`(T&US1s$L-NG@DmEXz1;gP+;{&ywK;Hk6a3-?IRZb2K)leE6vozY2^d4L zr^5ZAC-7&iym9x!QMl6t9mP<&7Bc5y{@%!u4}6Np7_1xhFHq}uVP9jBO<yf-GQc!{iac#cu!mxt!oluMXj&;t%Z_Ca zhZn{MRlPbzeC#-8r!lSK(;qs?E|+=iMukJ8p|{sS$wquEd0vRwcG002ovPDHLk FV1inv8ixP? diff --git a/kolourpaint/pics/action/hi32-action-tool_polygon.png b/kolourpaint/pics/action/hi32-action-tool_polygon.png deleted file mode 100644 index ec33bfc56deb480e16747fa9770e3a294890fe23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1877 zcmV-b2demqP)E$oD_ zB_u#(Uj)J;vI>rhtOACRuy0m7b*JaQ+-uW27{)1m_-2xO?>XQ1ujfA>EG;d)6FcB>>1jMkoV9hRN<1?AW}aqmJ$~`gEgL zYC@hNND%fSe6&^qfP5W-5J(IdCNG83&hCbe$L)1(i*2PcRhxf^V9?Uqev#yr34}-l zt+fyk51Z;6FkYpLntJNn7u#g5i>)=yi!D`63%4p77jBj{%r~Y>?zf(C4IMT%v-p!F z<_>}@!p8R%0OY~2i5}J9bv(bi7szW`7F(*D7n%w3lDheZV%c1MVa;4!!HwD4yvo@c zR&-_iZ}#pAeLC}nnh^M1j9`uM>1qOi+yfTsP-t&Byutyn8pvU^S5El+ILT7f)9LIlo}4EG2KUBuPA3950$EV)5>l z+noxzZ)CEMoG-ly-Uyp90l15>?7k9|^ysbCh+N(3>$uA$6|*&9HIQc&O;-x8Pn83C zvShL(F?X_kr97TP(d*6-YNWDFOv2mX@u?%;jvpDnA^Nhovep>qAn;5R{T@NCY4NdE#oULTKw4-GU2{f&g>) zV{U2lSW}{b)#OAYtmZ(x5qSh(mB$98fe>Y07$Of%Rf0Dp;0*|cbKppt;hqZ}xPVX) z@FmnNl%KFz-bhX~uo@Cg-D*fQusS56zc`XVDvcD3=Ofo+A~+}n5C%3TNSPm=s><_@ zlxNy`4knr%>*4-wI|f zP$5@<1PE05+>G%84*DIyQ;1Ia4W(E(^+oS-?2WQG(-&>!+#j>wr9YNpxOWN{z#s$! zzyrIJK5|ldt(a)+G`W;%X0f{V?(P<)Nfge#0q8FSX?0YoDlh!cP#M!i(ti2i5ONG!BaM#lSMz4%BAx zM#9wArCh)^q!>QmZC{oF#I_!T@n9)IdNyDr6+Gk0dX#SGA})vT(Yh}3S%B5%Iq$Si zBGJ^#3lb|7#hT7ACt54#?OKWfHak!ZEv628JV*lK)BeLLEHO@x|SDHA&Wm#Tl+N_V{yv!ZVf-V? zCT?bS25n*1hiOwx7Vy|%%2$GpKHUeKCuq!Po~+g)Xvg3|@Fav2!iuVg2qA5yfkX-~ z4;^Q>ZnwM}vR=2tf3tB{pcc*k&hjFIZb(=SgY1X8RAvKwYrN~g44bcz0x={rR1{Q} z9_{U1xnU&%&hT=Z&cS$fcH&zNBEHe38e*QbId-KVh@qcA zdGoR!)Gt>IZSh?r*;e@ACtaf_8>k&uzh_oQXj7O^mKV`4lgKoQFoxj$aw$R0$t#p$ihUs5afp3jfD0e+eU9R1e}N8Nc* zBbjCqn<#V!7D6|#NV$#OnK^u4TTKGKCCIgP^=l!s|I5{jVrcveF>S*|2j5$FwX0bz zK1zSL7WY4fsYMcLGG4#x-H^ENtp#8&3Z2=BlTVWG1^*|=p}mI?q5k}DsA#fcmapF` P00000NkvXXu0mjf?h0wK diff --git a/kolourpaint/pics/action/hi32-action-tool_polyline.png b/kolourpaint/pics/action/hi32-action-tool_polyline.png deleted file mode 100644 index cf682a7be89d034eaa87c5370da1e738f93a277b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1008 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 P00000NkvXXu0mjf>aC(> diff --git a/kolourpaint/pics/action/hi32-action-tool_rounded_rectangle.png b/kolourpaint/pics/action/hi32-action-tool_rounded_rectangle.png deleted file mode 100644 index 04a3bd862f5dd5f59159ba89989456d2b235d8a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1461 zcmV;m1xosfP)=PY8rykdT!m1PEftMo34g^qk<$1htGrXY7Ly-Ip>~p&vjW_Tl=8- zSil<(?sW6m2I2*R1}O*Of(W)4?#pY@FYmQ&vjRQ=aR*6bv4_|}A)!`q!P@(bZ$OB# zs)lwKFk(QWK*Agg$b0tu`N;MBTRK+{lF;qiRa~h_Z#wn)|0rBS|UgMu$d#m6FR3dFvY5)amkB5enEf3 zdw%DRdVxNZ$zNW!CIRL_q<|eDy!4CN#`Tjt*Rn8JvrK86RnA&fiW#d?rnXK?lq>Qn z`HE~(z9N~BTBaU}Eh2$v`7wWTd17S3{Al=*Nx%`9#)igBqy3}CkzSs0xSOlzum%mB z)-EmQM0~bpr<u`lcX_W!E zbW&y!3ne!Aq+rT2!GCNPjtI@;+;Nj&NMPa*@J$fRV-Fj-ERKQGF<=;M@6!*^dzboX z?4_Q(yRBoc9$x=IR%*tbTw4J`p(r3AFk}@TyoxO_0&De_tj7R+gSCMRtvmYlgYEr> zetOSRAGKT8)6%KyZti&6bs`~GZj(jrHSYMz_cNDM=tK-Wu>Y4s&!kH88?6D{X=^e| z*G*zR?QUc&vg+xJ%xdx+(`!%g5@dekx+~gc-+{0?*tmi%)Fakn#YXFKk>#DNn;46o zHaPW3JEmx+#wR3g2r|EQ^(=7N?dvCijRsQJyxm&9EZK@Rb5K9zXiZ`1*obvQ+aj}; z_LPxdKHGRKLw+y(jJPoHFs^020FQnb@YGvigD+fAY+^m`Xx#(g8?5`5HdqsxI-7M_ z;{q+WWTy6bmK+DcNWxAJ<7@@Ed6-?0g<>n#T^#*J>uy~yw1!}O{X8|NP+b$3DMg@f z48pY+Fd=cUeryuHtu-_*t=CdAZ>y@K(j+C0kS!IkRqHD9lQsxFoFXoM4d6@xn_I6> zFF3{pgn81R7&(4ZfHMWWX3aGWBi691vH01Bh*YWF_PrM{2;h#^$f8n7T%aQl)Vt>Q zv*MzNR7r8vIY|k^wNFDvk7mr#8m?d&w^UW{3WdPvbZP1FEE(=(wj7VXq$oR;HAb*c zL$BRFBd}3`ql*x0T!WT+Q4JY1YSfBVB^gBd^MO}10}WE7I2dyXWuu zH1*-p*+TnL93By!3L61Iq00pXwbO7ozOfgirO-I}+H?g3=iF64gwVV)O~cKK*`_;$ zIpQ6_*yF$7Xnz^8y86EM_Wf}M9@rC{!gY3>VRy%0R+OjZD<42(xCBG+?FVzsMK$v+ zU|1>TO$)S`Q3}QBU;Dndh P00000NkvXXu0mjf{WQlB diff --git a/kolourpaint/pics/action/hi32-action-tool_spraycan.png b/kolourpaint/pics/action/hi32-action-tool_spraycan.png deleted file mode 100644 index 30275e2b07b8909c92d19f46f3f48258b9ca2905..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1859 zcmV-J2fX-+P) zeQaA-8OEP;KOFnoj$_A8nl#PF=$Ett%hqbrz9dv>>Ja;&2*!tm!eCXU!n&zw6B8X` zjZ{>oO>78ND*|an^pE`k+WN<~O52zOMTL~Ig%Vh^G-=#4jpI1Z_4WO}Ji4~xB(&>V z!h7}TyyslW&+okFzDKeMf&kYWCr-R`SE*F|t>^o#nwH%A!2LUZi5raT26+4J_dYXU zE}m}7<>cYvVf6Igq#G5td*{yk=8heEO?aNa)^)wh0|Q^O|1SW?kH7hns^Ys-Q&WHt zXm4NR*%tn+D55VKjkGC>Bncq})v7%^Ha5L&_wKJv;A29%k_K&K46-b z+|r`mDMZleIF4djwq)D3EX!zHzrJJS#TSoeRuupc$68yHg+w9=(=rKQ!spYHZierB zuq=nN;W#c>i&!M0{B%_TcI?=$=CZG!<`#o!QxppeWn9eXF+M&{7#rL@<%Duw2W@T5 z4<0)7tBtD$aOu+RyY-6tg&>ebPhStTcntZ;NeIZOR?S6of&g6AG&Pe*M31ZrK&jMw zOQF#9T-7i|)u_;|2XT)W*eY!Dzc zs+YQMOx4#qI&!Rt0oQdAi$%k+yE~gB%(rd~pdhxw#fHEQB-i%gI_^qyjS`T)^2rzC*9VXnt?+O!0g#9m&WZqVEFUzaal>5GG$fO8eDu); zc1ERs6b|L`T@?Hl*b(tmCSeYKa)5V*MDv|+pi)?q{QId)Dq$w#8k(A#5REo*$0=ko zX-rJyF*Y^{mOCsz0Tz$M_XDsBgz#cpy35~w?6E_gpA4WA_t3bL0w^V@T4`DuhSTo>d?eU+Uki+_P)fVEtb!E+l;>yInhAJH3tCcgYTdfrudfbJ#SWTfmKrau z#D?6vL#``6q%o*vm0+uJw>1dMvcgIf3YXE+JPAn{a3VKD_p|8l@9P~H_|ZfE4e*}W zM6+90ny#n>P5eiA9nUQ_uLCU}1BHq4vsl~t4`}f+0_bo>61M2%59?4GbK z**%FK1xv%j1H_DjSnw%ng=C=qE&#)Eg2$60|M^*6ZZ^Fpmb(hGQbbG?u&ukm8_|a% zv;FJ^2vx^yc~kfUnihn>yhEG@!0*Lve7Esxrput@8o<7N1Jgfy{-s~s-EneXwd|;t z>Y=IKhAX?22j2#K)rT!fICr5Jk!TW$gacJoc?1#U^Tp$}BY0J0VBnjukX>9qE; z6yA0Q9;W$5j+*~w4AFl+6p>y>(E*yfot=U;g0sqdUpFpB%Y&Vqs=_*e&vnT-xem|>Qu zS(;#XK*OJ);v$^-5j287?*C@2nEqiVvu2~|+2Kwt+k!9I@Hnz9A zV{q_$KLA659rpaqu)^K-aNbL8fyp%&9`hLO#^FG2bi#6gXP?~@luFe{_)*R;?S^{3 z*p}sTb#7>A>>$k_1`yN$Jd9B96QG+*m*B(YW68X+OT2OK-8JK$lG z^BK6f4L%%d0X9AxmLK>V=K<&0@CdFE4fAUOd_TAh8P6~up*9dA7TP%Bkwj>!F^hBF zM{z`&>nc_$Bno&uI78FjGaP_tMOtMl*pRUwea xy)?)HG#1##(c*lFd67^H0RDx&!6;TK{sW3N{_fB#y*>Z{002ovPDHLkV1j%sj!ysp diff --git a/kolourpaint/pics/action/hi32-action-tool_text.png b/kolourpaint/pics/action/hi32-action-tool_text.png deleted file mode 100644 index 8fe85d361e840ed4b999130ae3b763063d71a6ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 994 zcmV<810DQ{P)MxvgfXTpWTVOg zH%GAy*Lr+Q6~;O+bV*Aho054M% z0&vT=#xw$+K9mDZq2G zAOUY6+^i7gJ`AXQF7zNSjz1ecC+k}f8iHulr&r*>ADTsEQ8z zLL#x+;cztAhtK(7Nq|z?2KDj`bdGg5ja9yS-C4G?n#&kfo zxcxzwO;~&11);k7RUi;Gfb-TrmWWS7-j-@&33S_R=bzXqLZWoSC^bd^?I!Q0r>2JS zCS@dne((Hh(4q(dz6(~l{2hLb`}i6T4-I0-xI6F{@%V!^^E(X+)Id1e;0M@x9awC) zfw9MrrVSSE>ga-mihy<4@?VCR2@pyTa8N1#y^;s_ur_5N!HMp+#FsnyJ`j#IEK;f3 zDzq6sgz*s5v!Q7HDaM#!i2+OVHAXPZ=&%jmVAz`+O(d;iz%pH)3kjv_4wT+9-~c#B zf-0moI|ZOv)WQEGp>#qmX&wWX?WG)0{qSk$N@Bb4k1-umVdj(DgOON?ooz_uT@Y(( zt_Fc92lxvTRa#nWv95zWHGp?}AWOsv$r#sQKOj=Nc@b(R@&i$dX(chF1C86cRp|VM z;ann&1d#u&;=&kW;YR?o7+?ZZ5JAV@&CJYP`~U0s7p-7QrrpGG QTL1t607*qoM6N<$f}@?yI{*Lx diff --git a/kolourpaint/pics/action/hi48-action-tool_brush.png b/kolourpaint/pics/action/hi48-action-tool_brush.png deleted file mode 100644 index bf7d5fc6b4dd7ba8de0288589a53624f0a3b1303..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2609 zcmV-13eNS3P)=l3}Da-;#yMLFUp@6H;3{I#*RV~-EQU4)Pn z{BO~_092^u-VE}_oM-PF{osS+yiY$iH1}77@#jT;6w_;5p9UZ_ih10A*Ni*w&-WLZ z011N4hFgXqvnUfk2f+9B88DB^7FSH1I>Euj6T&irG&hj##_&E5P%L1?_&diBHrcEo zkN}#T8ibYNq}Y%Hpzm6U5F-4{i)F=AC#FG*>Ea0|Q-F4;9AGvh3_$I(04~5jFu&g@ zYeqi`BkKufA;bYh0iiy<3Kgee!kFS=sk(4Y(#7+!dJsMejR2wvK>$jh1R#X){w&NY zxVg{{Ep8pc0HWUmBA}?$R5H%@Web_pQ*f(2yRf@?V<3ovS84$Ph(*y}6T*o;3oyZj z^!@|09I81LfTa6hh@1oAC4C0C2qHVnaZ00c!vWZCN>f0O7@UfN0V9T)3F6Jm$t^H- z9%1736gfmUA4SUzZDK;h=NpqTb?Snbr%hYD*6+XFM^BmAdA9?F8To}az50m2()J0^ zUH$GyyG8)f8v;P$VVg2#-l7>Z9jGID1)D_0<;dM$Y6;uY}_0JROl<-4(i+F$Ke0H3cUW8Sv9o!H#hli-|DNSEmI~ThVd43hw}rdmX@JvKD7&XR;Ls z9LIw>z!1(rlq*o8pn(W5s&Arc1=<=smd)~VPi}5*8r$r84S?M&J>50Y>9ljK;y=tl zOG^+94K4IYJF_dIpH~zWg0~3Gbxx?H8z2>sYn^Btwo;rtxp>`z1uH6+E`4=rQPCJL zTY|4UKw;rHyW8y=!f^!c?P1i`Hle=0h523=+}YWsf4*>`4mCB62;|*^e_I~I*~4Z8 z&X^FbN1C*_A8TuPiB@6DjU<;P~jX}jGFOV@GtXA*m3a@e4Y9{LLoL&QLsXIJZ^FD;G7hn zukg8tAD&mSZr#Q=XU=@o$3T(}poZI1ni^aA0|$=D!C<(j_yiEv6X7uEtXM%fGu$~v z@D7~>bBYUAQy7B4(d6|snM7n{q>2LvW?2df`ady!`a>tztXV&s&`2skVBc1EcEulK zt!2Bl6J_VLGZocxDAf6rAeS#|Xl&sS2=P$B1Pe4lMax$JSn_-v#A2}sR5#~zy7~i1 z9sp~y{%%a4GN#S^g#ROP3YL*@`7Z7I^R-&dr6wsHj`Unk6UL#-GO8OT)Hcb8#t0QF zG11*XJXBTH`>L@q$iAnBLapDjO)i-;U@{Bv`-_0=EWnr3fk*v2#L4ROBzEQ_($dtb z1p^&YBx3Z%wX!W3!@2X9QCS(H_KJY@6NRVaD4nf{KDOI!{NBAgk0iAR{5%HaWWxp% zU`+wCJb*V77?jhAS;IdTO60{vIr{gdoENs$#ry{4rUg{4XxIYuEa>E{4Kn>xmT z^rSAjuz&yl_M`z28U=PtDxLrr%z!2WKY*lXP#Bu|H+A9uVS9uU^(n$tZX`sBs&=bI zX1@Nh5JesU(M5;D@no)1RrwGADVZ}Mz0zfPP%q-&|CI^t_rXZO>t~Z9M zzPrgIrIQukXDBBQwUUaVjF;1(g1QT zNOL(cI>*OE8{#zaYO%&OmWkIm3hr63IKZ^ znKB%!rYwd>6%D~U0BL$7fDM2}iN3JdD<)y$`TTGzPHs%fBMH z`%MHa&O}?pL5wPEx|IxpGS4c_#y<^ma2J{n*Wz`0PbH}@G;7MR=lE&dQFjviPV7NM zA;7t#(1dPLF~a)7sJaf4U?=0+wLlu{fQ}H3>~F@!q`#4|io9`3JGS;K%>Cx?*zw*R z)PDXtjyG3zTgM70dX*Es9t9xU4G`nn)gTAnL*ub(ET{L9uG=f+`H@x!nn%j$9{E%o@~{R=pK-Cye2Y|xCoRgUt~ z?HFitqU`iGM2@_JHjRnxQC(xnWkRpLU#L9r^=33}KZV}`kggviWa(8q*y--!n#jUFuYr~(xqqha+y{K@csuK^gA+J8w4(qmUe4cb}n z@S93Zp0){(Z9b)4+;&C_Xf*l|KqAQZLF_C$ikY{q$EdrvVD4|fz*l<1CNcg4uxCd} T=ff^K00000NkvXXu0mjfV6NYq diff --git a/kolourpaint/pics/action/hi48-action-tool_color_eraser.png b/kolourpaint/pics/action/hi48-action-tool_color_eraser.png deleted file mode 100644 index 1cbc7ee1745764a23c9f80ec0f3c277819a719ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4328 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 diff --git a/kolourpaint/pics/action/hi48-action-tool_ellipse.png b/kolourpaint/pics/action/hi48-action-tool_ellipse.png deleted file mode 100644 index 6f2e2c9787a0467d94d0eb2d0cbd4a645857a16c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2537 zcmV_Vu})p7bsI`$=O1zbz&n!aTIx$(T)&(b?b}A$}g>|wAKB4MEM^247IlInSSV$MX^L-Zp_^(O%vuE1Y!Eyfb6|b4P zhSrHu{q*R_==8|&$n>yUJ8goir;Ko^!XT5#3KK2IiS_0=a=^D5VBlTr<+Pab&ZB1-?Ys0pk2Zvd|h8!kq3!wP5%ye zoIW|KpP}#(4GS()Ob%Lr_jdH^yUDn8wGem{f!DtoZ3Vo#N!JK?`RftDYm0c=>VnGQ zs@!r-Wp=5i{NjzUPFsid)6@YIY-}$Z|2rn$+0||Cbwk^PZfpTQ4ET_GN-0;F;MkyI z%=rL;lR4*8c%Qxp@YXJU2jC3^Ue~H?scF_VRyFDx057d2@M>*!A$Jj;QLHXaEmRdJ z<*AD9`xjN)t#h7YE&@iTnSD?yHop-uIM>|Lsn;6k9Pnu)T)~D*DSSfE-9O&jN#N~( zcN2K$Si2G4wg|7NA9-Cy;Z?&`c@>(4vjgJ>GcVlCEMK+Oj+s)P)J^ffCAF~1N50PtjAT(T zlLc@~$pSbtSxj&;=XKiJk{ZCZy!^^xZce$TBCAAGp8iU0geT;xOz_O1ya)p4B+Ijd z;^mqCF|zb0QLSl$OZC{GMmUlMaBIl|_*==svz#nuc)k&yqAh>puv3XE{e z$pZLFlLc^gvS5SW36>;!-tT{Y;37p^uP=8!&Zl13v4A%E!pr@an|^MzS#A%TE@-*~x-2`PXC73pyU} zQ-A%wB9eMxe`^8dHA23HWC5I=EESfLg~Bl+CvOVE-949w!~6bzo*#(Xe}NxFex;y; zmwJPlc5D;mfUo_nzx9V)5Q@FZTu?zS0}=-PPWZ zqu2UEk9qZl{^NQd2Ss9Zq1=xrXRtLT5HJy zI1WNrpNM1rcJ|$HbQ|M=(Lkq9{3r-RhtXLIrqC--#4j*@*Pe=Fy!^$nH~b~BIH;j+ z21w#=JQc*-uG={N)`5(DDsk60xq~JP;7cV74)fn$=7+p%RA|R39Nng!rf75&U|@l~ z6)1_n9W)SsCwL&?Zpc8wz0iTg`y8pUaD+bQ8OddzO8m#k+~zGibtwgkGMX%a(`3O( z7JhOoGrlAo-NtAz(da6`6bs}da^~q1DNFGs_4v6g6=$O;p9oQ!v)eZs>V(GXFe zZVK4vEO&w=3D!0!9Ty}BMuiQ>XwXgrjm~<918lFv3P!YFI`jVMIdu{rT8(NV!{Q#iU!JIzGnmjxJ5 zoFkE=b`~dDksU@VoEW?wLn$;s3-Sf7UpcV?fQu=2NII3 z;W09pbtDV3>zHwDNH!c}flhPGXpE^5oTbdip2PSeI37MLuC;S?S=L28`?iXDaS@J_ zo3`IAUJ8$SXX7#J*r4b-#sxEuQNe6eIJ%8aGtoG8>7q1(CP(?w znDm~i6KC!UZS0+9Sa<;}AMoZb7Ggi+^3~y<{T`{=7@K$Du|a9qF)EmCCj2RWf$Ff)}G}TEloota?G=iG{GrIWHP_Z zJFw`r$9do0?R$XIRte+lqe_Fu*@dEx0LK4W;{%PXO00000NkvXXu0mjf{+skf diff --git a/kolourpaint/pics/action/hi48-action-tool_elliptical_selection.png b/kolourpaint/pics/action/hi48-action-tool_elliptical_selection.png deleted file mode 100644 index ae4795834cde3c453b53d80676a395a876d83155..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2911 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 KMNUMnLSTY1uTC!j diff --git a/kolourpaint/pics/action/hi48-action-tool_flood_fill.png b/kolourpaint/pics/action/hi48-action-tool_flood_fill.png deleted file mode 100644 index 6e70dbafbbfd32d5864935d5005832fa92991577..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1474 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 diff --git a/kolourpaint/pics/action/hi48-action-tool_line.png b/kolourpaint/pics/action/hi48-action-tool_line.png deleted file mode 100644 index a721dc84605ebe2024e010d49f06ce25a2192895..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 750 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBgK_U^ETz332`Z|G%M$nX#FLvALxQ z2w9m}Seb&5wW+1G83@^!S=pFd+1NNZ**G}cIs%c49S}JIk*mEk5V<)3kqZ#HJGugq zhm#u+c>;}vBO_CDAOhI}LJ*5ALAF4w0Gn@aZEIm|XJKP!X=`s~=U{E`Xl)O*5onh^ z$S$ZA5c8cqyj(oJT|Ir=ynNlg{XBg9f!2X70^0)f4$u~eFMwVETVV^b!p0tIi=Cql z$QCD{zkr@XvIXP?XLm0b4-_jreFMDw0-3%t-UEiCOG%JlFarlC65v7uJ9h5cy?f7| zy?giW+qZxJ{sTa8@Zh0Chk@Y8kt0Ws9z6yG$7`&ez5ydd#nZ(xq~g}pOUM0~9R*q* zW=TvsDamKH;o$rKcHg9$4J_R!PrTrF{oth)HqYPde@$e1vi-K+86W<#Q!)%s5`N!* zeK73p)db^TUfgDP%9kX}{pZ4Y?FG9)Q|R}*j4cVR|3sWN_|&s0Ml7;#7tpyB-_ZC- zUy+5o^|v<1L7VUE6Ll>zUzeSrkDSZ>#r`b9U-CUzzEpm3UeXl!pHFea z-<~**p5O8wEO*NPb1EAA(&uP=>smkK8^>1tSO4!U_h-3Q^q*I8Lzv|IpN#@L*8lp_ z>F}9n&C7q{UKesMdpo|}?LNzWfxP+)nbmTMKK=IU;f-s*U)ix682${Nu6{1-oD!M< Dm;wqy diff --git a/kolourpaint/pics/action/hi48-action-tool_pen.png b/kolourpaint/pics/action/hi48-action-tool_pen.png deleted file mode 100644 index 94151a3db56cf7fc5d5a911465a2836df311e4dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1952 zcmV;R2VeM!P)HD7-!68mP$FvWTMfmih@Kl$><~|DIc6tT%)2U zNFpxL2ojbtsJLJNWs}tgkw!p53?L{1f?%-kKZo00eXE9{WNEGY@YN45)cF8TotDk93e9tB3$V>G0q33A`0D2Hu^^c`4AlIVMF-Bv3HqclGp`jG@ z+0iHn`^Xsi`tXChXOM%e1(N5}rnYJypmn_{pwB#wi@8}yKNE-6@-&?Ibk_A9Q)!kg z1YT4e+!l;VfI;gPwEV6|(82}q^l-;#p9G3hc@bY=vzAuLPJqWJxbe~yKp+#X z6M(wE0u8BR@f#K5Sc$|2&l1*olDljK(%&ORdXRmYaL+*!xb6v5bN;U6pPvKDLx8FS zOaxNa%*0v`nk^fFw0G&{+7z8szRiV;Du8R90>n8UIK!Dl5Rx_6I^DMB-|l218v&mG zQ^vMYl0cn~1vq~*qxS?(lgPEGDG2eRFJU+!0W@>*Lje$Yy^1zcmL5aNfM~{11iYGRi;=6oFGx6DZv{XCR4a<-bOEcNJERa zjBdA-H!8UJqd*w}2xNXht6D34VG(HX0!lfrkV&FM z2mH*LK)9RehRr^7N;aRwIg3b@|CwX0&|wQ0%>otUxHPAs69teo0ys*dMBWB(Z1kp= zWh21jGq)kv59lBhx5og*oR`fQJb^gQc!KemGeV~+OL_hkvJuD*R9z5ShXQvA_=BnN z0g5;;kxAs-I3SipiOL8+Y|+wE*=(b^i)d<1f;Vu7fHtOi2%uL1g=CT_eggQ3Gln3< z+hX4<4vm|9NG%(IoP~7wUj36m3jwW6r5{khd6CgGnJjmNGn#Poh!$IQv{5$qK>lJH zdG-6TMl=&d8g00|2FNF~gcFxn0#PJNBrF&W0y&(y zOdgZ10}gXW653)XV7nhh0U%ij=mW{FWbKG1;l==kEi z)swJIN7G~@P_Tp+x8&=9dID}RzfA-(IkT7xOs)^`1Lr})z34w-*Hp>^K(Y}iTw!kz zYSqAX0_qsO2arLM#L>~f0TLz3c4!egh33gdKp#Xe+&rTNY6z%hsvZN*ai%fpO!jzS zFXujja8QkXFWOb}{HtUma50EZ7^_@N2TCz6sN3s{UDHf=uPg*E zEv0cak?w-!NU0hGq}l-~#K~kl3Vg@8haf~K5I=u-JAeByL^c9NLA0x*bi8z=6!`(a za3+&U;;a@3CsCs1pa;I4PGJB@76O+)BFD<@quVV9O1Xkd4+oMui!&)|V9z7KZW1NZ zRy-wq<4+T0BTyVnE8B9tr6Z+yGH{wKM>Jb)dXI|)L#2K%44G4T8=dQp4;W5+m%rMqI+F9E}+stlpn zQQGm-ye;>wC=$g&p(IkXQ;YB!6xhS!Dn`v{#G>7!VFva|p!8$%y&3Bz?f8Yxz|Tq` zflLxfj{{pdw-JO;72^Kx*tq*?vhTrsi(}FYG>o#>0*2-EgR#I>+VL~|fd7!?#zj2K zeNCc7bGR4w%%qU}%(pluedLi|36y_AF16pg-4oa2{7wdPX$LM%CW+%tTz&wsg+x-8 zx*ETGhDLUsZ>e}cabOfZ7AX4%z1osITiWw8e1RCU+_*^40vkCu5$=Y$Veen)aCZ-; z6|w2D0MGv$jmc|(ykVwY|JW$Yjf*%NVEbTT1BntvtKAXtXPP1vmmW+jW7}f^!!nxR zbbcpLcZLOKTFyg6GsnDv5E3zNbH@JX6q#K{#rh2H?m_NueOTC>wa4@iiTWHM{T&t< zXp#sU39RK@N4U1x2ivC8`wy`Ap!wKE_VD)wS;u6|; zIW_u!%EuvLo}(eao!t8OYIl7wtuBxoKs%oHpNiBIk!Y&QM-!J%T;Ny|=t*w}Xj)ZrI8kTs` zlf9emt`Fry70CL0Vq(mX5l9LcaXD!6eamairPY0%ZRJLZ{GX9@7?>}eeeC``Sa&e zVYNKtFrXe#4X^?%#piDe(vo)rJQu^afHZ&>VDXPt0FvK_gy+Bjzz?wE$0PvBZv#vb zqNZD{A3C{3_3P?yd_0SoD*#)-hi_8=k~ai=Ply?Aw0KlrGtyYy@UWrs%EK$1%(`1U z?OcXc)U^I9LCALiF2Dfr&JQU7$*%!S5Hf4mZ+cu()!$eJ#Lw41tUq7(u)h4#gUdWX zN%h@JeqnjdrsjLba9R5?w)qV7SRfPC$P zOJy|=YD+HMuQ^kF|6*~~y$cydUA6YdW7>4rn~~qogqr{dz_K?j0Lgz27$cpjY3M%9 zDQ><&Tt9bNNFIroUc6t6#1W?}?_DT5f3G_K+;|nBlFJ)EAHlg&XSLg{M`ex9gajcN zo+SV?z>?P$K$Bk%7$6-eGc~_Y<2K%W$@OXSXD<@hg~SU1NIb86yfU|J{Csxl-HKBs zch6;(+$~Qn94&Y8EBMM}^WH&uMb&2##M}qO0hFW_K*)a#Xd?|Wl+~Ukq}P0d3#NwCf1U^(x{zk|(Zb6p!)JipI)P3h$I6@ua*v zB?-BsXX0~4i(|7!PqVW|PJ2Z(l$-BxZ&6vZ?pp~$CIOWIOThc$0toq^0cyyPWEB*r z0weRzrxwaoMBANId4$NKsVANMU5!a6x#=aDM2?p}d1G zh1CY8`?}>7nUbdDM}Sm-CSZ|30M5;T68c3C|I|(-&y$d-#C1Akvd+HjI))5!J&`+l z2FVlGqccZ}Sn0!s5vfA*A<08|!AV2hfW*OEzxcr%4^{`)axc41bKTbA)$)o{62$ZY zj8H%b{e`1zR1a}o+C)Xy>5$=2Av2TfVE`l^$QjD@PZ-ScjT_ANX7jVWV)$8ZQ3IK- ztbxo!UJdz179LGXYWfdm5OEs?w37#R_P%^+5*1x1iHgMOM4icXB#*9>kfB{i@<`k> zntzIrcZuxJaE|EDI1%2T4#==RTvV!UVADkj;G=+A^1wGNxAjdYDsi2JOxSeD5Z95s zPb?pu&-RQN$nro$58w!(5EPN=95DbQKuB1B`qn*(Rg{2g6yQM~SnYBel9Z_Ey0nQ( zT&EM2gbWfFI?vDcjfK#OJm_A}XDU09AF}iP`EHbbUUFYG&zj8#_~C>O4LXc!>vs zfcy{_KLK3$TOdZ58-saB+##SZ#o}lOd#z1Ngx;>!2m{;J$PIhjSVnejER%h0QF@jI zrzrP(=~7}b;2!xhJh7pca$RDg&NMwD4mjssptqoE+Q#<-5_$?kKpYZBkq8`-<1jV; z%c(P7Z|4irNOKKe^bkxvnUpLjsQ(Ay42Na0@S71(PS@4p?iPKJ7!^j}%-R|9qdp&zNICbv#=}A85+ncPaWjai?Z7|b@ zW{|w#9#T<*Av0SYgR=($|Mp@v7b~i2J)t__PPh31ppQIPP~9+WV)qRjiPLT)ahfy| zw)gK%!Nfiq+?R^ese+0YeT=hWCIRW9vcfi?dA2$RXALsHW9aCc?CKXgefWrKSCKxN zS)+fj2^~k`#BDn-q0@)_dQTG4$3pwluzbLR&MBlVTWlZw?o0x#L`Nuw+eanUF=WvR z1R!~fJ#jT+p|fFzy|yF$j1P{b9*rb13OD)koQErxK!K$=PWk1l z0_Z~n#S!v8Q`>CVF}Nok9mh7YaKqXM`@#OOU+f=8f2+06*OUO(Yy#rQi)NOt&BS$d z!v`uvTy*}Z)#USuR+IM^Ot)gH(J6q=JdP?g0F$Dr)!g|eI*!DN+k`ZZK87%cvhn8q zeN719}gFdtO_| z+$x$lP8c|G;3R_U56*@iPsuX_Amy~*oS zooha;6pebQ2D%G4>xPG8;)qNTBn&+RiuluZI9^;9f+o-0AOr$q)X#`pep-vR}FVTB*@P5IP#UY#DiF`rIa1O7e6+dUVleW$WL} znI?|47#5UR(uc%eq-&tI`5f-9CqGyzr#pn9^INrR5IT*%s~GF~RQ$G(1KHOF%v`~w zJqXz;uTWkcA&zA|?oFJ1GU*wpWIh6xl9f|NjxqHcWnK`vzf#4%l4|G~K=w6>(|x@o z%TT%YVn4F>Niw&y8j0hU7Pq%{4ncH*7&hPg0nx(onUXhmg+_Y3jJy(ks_a4DeFGvs zkyTKBBr3iCx$_PlDB!6G9x`nE(qV+^*LJ=FyhUNe*mivtV;$9q@-1>*^ae$2qDzg# zC!#y>hzHN942&)4ixTbm3Q!lVumCFVF@gWK5EpiG43&7&4_;HnrCq*(cM_`V+VrIH zhxrP44pF diff --git a/kolourpaint/pics/action/hi48-action-tool_polyline.png b/kolourpaint/pics/action/hi48-action-tool_polyline.png deleted file mode 100644 index 54613695e10518d50759d7d26f9d36b5d41a2372..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1341 zcmV-D1;YA?P)GbqH!mALpLsL$ zes7a&eBZySvnuev5!luj?&=Lio*;WGi4OOMqr=<7QLp0#03IQJB~c%6nF6_|(*-6K zcr_1qynr4)Cerx=TKLG-A#hX&-&e}cjurs;s2*M~5Q@g13dOAXaLmewV|G3qxAT!w zE|aO16gU(BUm$gNA>h9S-Ur?X-jB#wjvpnFxYONs0ibUnzi8k;CkfqWfj_B(C*pX^ zN(j8HffspA{+v!g15aGiW&yzOAeZXH#~To^Pio=ql@WMP3m+{eSRjso20mtc;<$YR zz{i0vDDcw~K2*w~px*)fH#&Gy;Cy2n1!CVR@TW*t!Z#@J7y>_&Ibi21@WesDc0+9u zVDxv_S+F}8{jrdNfSQ=?eqV+s3DJJgasj~CGx}$hIsb{c#^_fBVwQ-J03$vm;o~B1 z;tJ>Yw^RW5tTOToI$^*I z%09nGscpt9wT-!e3{&VC32!G-zLQAj5xTu80l>emhG(=-Gg@m@0j0KCmH^OeEiaWT z!xzKxk!1@o`nwc(alErmZ8I+66#?UL2ZklQlT7<=GINPLa;vcbz}Evmt2|+k%j>E@ zRc+Ih0O0HGM0&0a@4Kmt5IJlt0Q`Ohet|roDb5a*;bmTL=4sD}k4tzj)i3e~eK$8O zz|`qM;G$9^n{1?}o>v9T z!?bx-!iyx*1HZGNZ(LFU_+H?zD7DRqysi_dt>@jQ1z5}*ymbFxMfl8MF`SPzAQ1ne z7T%iX9knZ1z{yJZ7@?gI{mq7H^QMGP_7^ip)&;>2)xgIrA@Jyu#h8Ua37&W@6L6B5 z&A|U%f`8CY4eUT>;5pqw>;ig5sVYAc*BTK3Ue@!XooE5P$CQ}@{&E>!<_F#Ak5}R1aR>2FA7Y*w8O^p6WWq6VlIl=MsWUKOo?FM|5`TdhCA5wbw zJjWl>_lPL9Yf1^AdixRQDH_3I4Yq`s<#ude6GEDxYHRG355Hy`tK&5QCN5I!^b zBcB^b z$LV{VzO_bQuj}E>1sMID2|Vp-`o`$HZP|Yx2!JP!kpS?yrQpd07Va_Dfzy&daA@Hz z$5;UPTo62cPcvQCnS%xkoT&pZ^QED{2^~D`Y*VoMHDKL^#4r-0NQ@%zLMhI(oc9>6 zflW-Ky@Q&W}6%+zF3*(Q@@;zlqm-9Up9#Y7V|nrKYi!37jiQ9w~a#T9o&5d{K* zEGiy|Ahe^Mn?r~2L7_q{&fdFT7?z1(rn zo;~|R<5d8!0{A@w&^Iu8o1jC`CQKY^pq{buM>+-uQ#c%BEnOp{iCixC6Mg-uAL{UU z|Cz$$y{$Q3M@Q#%4u_|sYiOuV_f6t(OvdXN8GUSMX!wD?{GOD> z;y38oll6GK2{iV9bp2ml6O;G#^z{BY6fclJM0iSg#=}HGVd= zr6Z0vG-}f~;F)8*wzk>dsIO*}=MNArAaKn9BtzXWS?{}5<37%M`zXb(0q zouP<`PKj-5?ep{U4N2r0nLHis9t+FOd1W=S!)dvV$EKQ^Nk$uQI%Ad~I;q@z*Z>wS zS)CrsPcH2g$}`1*%rSJk#h zwRZO35Onlk6SVgQ7natC23?Qg`v*rQ_+Gimr=a3JysyT&dHBbjKIa>MBQhnZx?X;| zvQBoQqE>dSuuOE+(Z zV{6~#27%%ykgso6T&!(UxD)yFH4XB!Y}Lyi%Z?E7gQZo24i>$oZoDo1S(@4CNR;ZzRf~M*qKNi)A{DqfQJ)@AwvsAy6A+`ef_|&e|)4y7E zUNZn~g4e2b_8vq&Wdzm3M^e3^Md3Z1>O}td%c`D~A+|)~#-(;ygeMA@X&ZcZR4o9e z9Pv|y-@c6MjRJ+wZ%}>bSX7U_Co+#p7OiwRQE#fnneX~S0Ce&9nB=wvV^lprQ+1FZ zi|WM{y?ZrP2l1ZQ}x!4{_7*C zerY7tAJxbX4X1imvDAJf)#L7oETZp-Rz)WYmwQ}onfIni-sEvwSrdi|ppI#rJaeJ= z_fQ?=$D(>#o_KR=j(GF^Y_UyhuGkvtC#QFyMF3)^V~@*`vX@bv$e$d$>JqB$l5OclV%zk5v29wubPJK+@=Fli8&fjG z)`{s|RzF>DpKs+{XKdm8*a%p;`?29N#~OpLmY!Rr$9=vwi&YE2Y472OV^sazuT>q$ zDwf!175Ca_6-wz-YL{6g+4`VBx;3LnIvB|9v@Xl5w>lRe^lqF9<(F?mkfX8&r3K>L8x?s0TzH^Gm5s*9ah!d>?yPWX_Og2!q&_ zsMbZnv7O&vjq6-|Exz-I5Weuo8+_rC(1iA-4A4fulj{vz%7FnD=L>29Y~SgU$6A1m zs5+6~Kb-1$gF(m~VU-wC`qFj5eAvS+p!w^I*96Z=gD^;iB?*^CBny{ErHEGEN*0+T zP`n{cpnvi5jqJ@*8v^KJIvgBba#X6j52rfFvsGt%9rnmA?cSM|FWz!3rtJq;N=A5= zO&m%yq$86>D?lnfRkWHWu61`Zx-AJ-D5ok|GeA2zvupj2D>g>40uUpBXr|+GU}S`* z>J_7@ULxI&gammI@Ca#{XXjc!ZU2QvGbE&YaLZhHHz=la5r~K15iY|7#UgD5g7@>f zZPN0jn^9V+%x*=g%`BEa2ioXgZm~I5Gk|vp`pDtf=xyP$ zU2e70*Y2z3IUIjtdhlZ7O!yqC`$x7egjJw8ECS*vmrxX>Q9eNq&w>zS!yS}EjwH~| zL6r6E!YBHWR~DAr_-X+#<;XX*W%>}RA7oT7(oh|?61k_OsxE{&gGdlU@jbE({N!O_@7Z)v<>0 z2@x!qwyIQj&c;Xjm?<^MGnRqRp*rk!H(R_Bii0?mhPogPVx{zZkE-Q|%4&L#l-Kkg zt*DhBt*n(FV}Le&=emB=j=P!`Iy=}frEIcpeiCTX|RpYZ|;MmFnAI6Ien;+=WOV1Tm1Ts*|6rAq$h0&tQ$k2JDS~8{1uJ zngIxyjxBb3l7>?qd(%tTTff1Q7Ar$6tQOmq8*JEDZG!0@35(he&$E?Rk>7+wgzB&g zY(m5j3=*%C9|vg_(etQ+DC2}n1WyKN*EK6V>>XX$0ko;j1M6*eqzt7x*5?biRC2ML z1+*3vYO}3#_)_B+m`zb8k+ASQ>NYBj26-oy>W2muukRfsPNdyIutCu0g^9GWRdKnw zz2A@E&w?NNV{c~#4?B@rT07iftBx%mHWgam6lpW$8TDZuoBh>O_qf$Pw+?)dYJ$d}Ob7vRjol#i2V>v;zV2=g z@%{3JrNr6|_KA$@uuRx(;ZkNJ!GQ5Tqdq1o)Osutund5867F}cMQuk-hY(0sB&r(u z#zECRiMTI_x3nvQL6r6*p@eWk1R=6hq>RL;sxOQJ3>p}W zN@n}|CO({%uLb*Hcf__2Q+cpNz+?sQ|B|>8HT6*nQDxwH zBqqF0xn-tX>FW=LhqOhOhusr`WZQ%{_Bf26r5?qC`}tgyNH?(}>$ z&ujW0)d#aKW?-x^v0Omi$C6jWKK7{h@IEFd)OeQqmyxWngUU9sL_QH}gQ&DenJw*A z=J(2!g(?(KI}gE}JmXQO8Ng*#<7Ztn=OL}bE}!!^mvO9|tBkS5L+ywEvBHG^Q94og zRkN)<+dfn>8Si_cB%-1)>ci)-2q~Nf@*pgeKP{EXmF0vALK*dyASjnZCo?qz_%mVg z1l<*eAo=>IK|160SJ+I@Uurv%vux7@{pHr5=$TuM*EL_KH{IIObnfoe2!NfyKB2Ws zHf=v~e3PB4hlA58&)xekcpo_G?Q{IJpWoSw!GYes;X#$P(le;{sP(WN&z%AHnrB7&Y0OZ#2Af(IWE@}onyfyBg@%uPR)OB;^+IhW4(uK zy2R#d>++AdCi7g!b`P&_&EA>`oT&@#h8ZJK3xNLqM4fS?pNa93==AX4%zYd#?Y}T7{_;JUwr6+3n!3}_zFmU$t_UH)jSE*k0v`Y&DlUACO7v2-34#DEw6W^M zNfS3sY{&2WHZwdg)3w(dZyb_AvdGHo=b0CefB*l^?0DtC7~^g75x{vX;8wtO1$^+~ z-S;89wPEa&U$-AO1AzY?3ZHMH`@sHP0P$0AbC1u0#dYw`yYD4o;QJT#H1ju8rFXbDirVCv*SCqDJ(7Gdq4a%SO(YdwOV_IhOs#kYXeP`d$t0b zFv4f>z32-k<@jP6g;F%s89OGFsIS36Dbm>3Utv#;72F^Dee?ClA6R-7FIdq+1uIoD2BfTIo zB>{D=bF8}VQFP}zTTS(x+Ob)+(JKY8yH(dcEwJe(TqiM0t`m{c^{!LB6;*QuR=I9g zxz6n?Tqll->liq$?>ciSXr0bXx>CS8t{cPpmR#ptyKz3asxsp}-78$jnB|^sA1D34UQBx>@Hzn%*Re_=SH*Sy(yHquOX;fX^WC`K z^}$%huTIm^?tXk8Ct6+Uc|fmn-7t_V*ZV^?Iewjv4?F2-Fv`<^{Xk;@EZ_>)sqT8N z=kS@=-E0idBZQvJRDL5*WC(K|*U8z7T!)w>I_sQf!jCmFpuOQ+cG^qE-ede<4Q;yM)+@5a=2(#?judvUk*G9J2suHDE=t`p&U zt|zI=T8ByZX>-;+AC)(o|4IOnsVlnP?Pud>t@w0ze>PC6c3!&|fbcc0^Cn|mACB|c zFHa^%FAm~?L%yruMlW-HmZ)Us?`h{rbK1o^*MI^J-}i*gJt-isy8?yl)m_%W*4}-v zH9SmGty}{mtS>#`OChAsQ2;!I%k}|&7Fcv0fU}1?5VOj_A z+0R>pL#%V*cnI(a4w0ZC`UvfV2!MtNxj+#Ge7yh#pl^P!|NeY>3{O8NE?f^oDWe5= z1m`Qj@PWkWNyrJ>msSK8FI~jS=!d_J+Rs|Ez6;l*kii?F^h;L&PstHrX(|=q>k2^l z2iwCv7x(snoR+c?F>nL|qDZg^pTT(%dy?Q61Yj=h^nqlxfX9D~58S|$;}U^weB-_! zfhe3VP$qD@sIg9Pq(uxF@r&BK(9`C$=Ni7z5J7}xUa%IN#gG6hdn7_yc*zTy7jfM_ z;AYxf49|0)uLQ#vVtn79J5Tdp@H9dJm7Un-jtVfM5zVi_B76kUEI`VTa)Rb)!2_S7 zT??4guzhPl5;-^8inB-dkP^EP~#(%#$NW*s>SxCiGK-ew*@2Jlzqm+)`jw@|pVVekWB-wQB< jqQKn4;BfeeH|2&ESE|3Tg4l1>Daw5R&8csC*3Jl}J_f4KksXl-rn zH=Vr#_6qo47x1a6`R`Evg0c_glU>R_xF%eCw+jH^-=nyrq@##Y){GqSufOFEzx^%+ z{0YSqB_bswpFy^^TY(FIh**+sR1YGPGJfSbhT?(ZhT@9ySKR_EQRpb0a`}AUmFppk z`YyWPjId^V#PN;mQLk4n?w+rx?w&tW-Hxxv8H?+BR-9aqtvI=C#L?xL+L5{uhxK@< z9h^PX_Rb#54k#2``=9rlS*+^&&C_QBc>DbbRP2!n z)z}bQ^>UD{8XXu@jr5H!4fTwm3@;9L4lNFJ4lMSw`jvg{eaha}US)T4x3Y`Ll65E2 zm?QqdcSQt})$2_RR(9%ylMGJ@^^dz2>{>H#$ub86E;D>L*40=%05N~Osen88A{5w{2t@K~d)L^k(17)cN#j_rZB?`Zd=-MPXp}dXH^`ex znX-n2tS*)rfv9O~Z=Xv&n`WWf`sRK#fHb!%HlC)yTjvQ^cFTH?Uh61$>*bB|rZT3y zv4kOOcu^;36xGTY!67kYxOQ6oho!HVrT}{<*JbRFr+m(@?8N%eTda2&u#Vujv|d~< zV;0rP7=<-5#`7v^U4Ess*2(RZ6yw}yN}dFESg1@i^DgP&YF9sB^fv3G9M!l!>%F79 zZ@r*KR-cdH^ALP)xuhm4wU4piocIdk1$HPP9Q(j8@TzJD)<+FlXKmj)!0WeOEv?T7 z@Cr#yPMM@St#G#d>pPr8OPf>pRtkp#YOoKI(+VV9BU`Tlcskzyi>zOa+D#Bxh z*`Hr$$9i5Gi$3HLS%oX01_~I(KB!^#Pw%#MfZwV0XUKY1iKOab{8SDGj>Y-Q=X6{F zqfmfm%g{3@=Haaaydmpd2CO%C8?fG@Xx)zWr2N^^`*FhT)8CB80kCe4UT9Cm6|ndb zex);L{UyK~&pLuGxrf^1+-*(*KyDR0^QHnc*2mvseenIQgYl<1;^NRKL6*~gNHCm z0b5x|@OrJo1`NNN!kiuQ{Ul8n+UN!Rm-T_|TZjJsDMM7?dz+KE1%UAi=y?b0*=Uu# z^F)~S*%fVHf3O0!u-<{U4*h)-waJbFj9I{TtiwEx7MdKazl|NQV0O$&G;2Y;uZ_o^ zx;`FfumFA5VFQL)hgA|TU~FIv7FJ_eC(hoQi1!WUB%DW^xeH<3L_G7Rtwd#muopI9 zy4GPXzx9(K)0p5VF0*3*`imP{V86TEq=0a4a?pKVGEBw65&YDEuwJ^(Rzka(qvdrB z=~~Y$o~!f;nTR(QIM{}}dgfa#GzNS%lAm_{yUBDk)-pnVn52P3zmSSjoz0wfJN@u+ z<^+C*f#n{0-B`vkaA*zxd)y=p`kTiaz_+6WnPF&#yB8y*-;bNhe(-cE=L`RsR-Ns% z_JQW)mw{4jzy2tBI?q_vp;e%_!8itf?Gb<7G*|{`cm{y&bVR~bZe-H*v+q)-^I%nX zbU!E1d7#lgQkq+m-((ezbigLdSk_@+LXShMTztSw0pkD;w(mv@>0lY4K_CGCm@axA zMVl#z&YCHVi0Q60C6HckdZdI0V~UNvTyySX=Or>$ufqVvtiynWRsrJ}_`edTbHOw~ zKS3M6Sh~0fwegF@yxEduGy@)?de32;pO}#anp25{)Pj^xO|{1=)~;d9-G+yjfnJ9J zidheRBFKW?2ICkwn2yU9zeso{E(Ykd!nraUdaU%n8a1pnZ?S4&8{~~Y*gEg#`E`rt z3uXsiQO}goi~$e5{_T$f8fG2(8(Ia7131`DEtoCKD4MItERj^gR^>@bM~f-$V9Vn( zzc$_Dbu(KpzmH7_wi3-bq&Z1_=xAj1`?rmLco?A2=U_dCK2sE*D=toXK3fXl@I0JT zF0F<~%o}%8hb)K`%~8rh8wX{;t;j#ceX z0o@Lt)AEi74aIJEs)X4F2JDr8^V48n*M*0cNkZ`Hg>&U#on9iYjf}49JbNK@5`Ulz zAyE#gz0ckZ+SV&3D{9amEhxvE@E5=jAQOVM(v0XJF*{(dKST$qImtn4L3Wf84m!## zDNgbOR!(xFmGeBwnyMh%P!$JlT^1;ZTo$bCT$I*_-IPSiVYQ(b97ny*jRai#;m9P)3rY6 zo@s?r3I|f2c;cBZDdiQ#QsHXLv__ROH=cX$>3_ySk^@TM$tRy(lFd$SYivw37K=rU zjEtbScZpxA$Ytx+ojHJmAQldgJoVJGjoDo0`HqgZMgSUoAhCEp(76ofiuoH#WRF?RZDY=Xl!WEKpn>+ zI2QtdVAK;0Hkw5tp?%P&VFQ5lIuLJ}k(fQgB5 z?A^N;l}dRAaBU{EijI!dX?NfKi_aVi0t8^5A=P9%ff*#B%coKr3BNAY;GD;lhYildtk>C zn3~Fk(XPvaZf5q9+0)aqgw6hyIV2$L@$sX-IW^V#(J~_(i$#%4Ceb#p4J|G65Rb=6 zXgR^EurIv#knlBl-}gwsM>^eLanx?U?Y18$=Y&AH-1enCdk(v_R4NgWL}ogJJ$puB zS{5ubN&-o68&jQ{2Ck}ydGlJpF-sDX>SNKO_C{voTL+(jD^_Qx7OX3mT#G+21fa0} zjXu2c@^%al@5S_Vt{VCJ(qWcT8nkJeFbqTg9kv~bwzsD?e)qc%EIfDw$|4OPXJw|l zjw+YRkc>Vvu&?P-?+Y^#jmETcVrk&q(2!DUUA(wMv9x}0kO&0p6X!`U(oihK7Y5*E z5PbrxE0cZtJc5m)xjBV=zR0sK9o-9&h%P0Tlo4I9VBQyRy6L_X4?KY>oCF`e@T5`_ z!grO;CJ$~cHdoDOI1p0+Z;OA2V z3wS^xmhFp0qRfDT=gRjj9X2b$w_sr49X57W`#G63_^_-rK>`m6D1B~jGDUZ5`M&F} zyDR$t6Nuq70&k}Rq0Vo9_1R=&!cW*X3HUWp4=!+RZO!QHY{#x$yV2i282D$(g?l6T zKAcj1m=PH^bX4zW)Ca*eMnh@W;Z)&k#shli9Sr_jx-O^}D<0b9(fk zXF(Ubx;nu6#n{*sqdpwgd7!e!R`-K0p>UzefV^(%OlBIXM8;gcuyV^a*WBLv;Rp-} zh6C$D;C0&5y7f5|!ZC!2Kx7CEFbE`2Gq5$_Nk{`_^ur!-Yo?S^N>8d{W(OJ)K2BaW z5vA*v4@aPYvk5d+2R_V(r7BKK@3=q+V%>Oy(@$%Yk<#yH>hR}@KANs z9VZ}B^NSA4Z#O!-dmtg8NaE;KO_F=!-u)-ARixnItbIqm_G~C6=Qq7^4+)6csMlnK z&-JB5O9C^^tTQn>I*Rtz30M(+AL-Ruh*-Y0diA0+FT3oPwfjdvVI9H6X8~TL$1VKh z3$81kB1o6f4uP9^Z$`p0s##zJu1QoXuKq^>+uns#vJ8Nv!~*ytfr8hLWy?BcGTCtd zC6|21n4Q4i#TtTIJS*_}cZ#yX^MWMQ_d!UinuVHj(vjza8-eF+<21`df&@eb3Lf(E z81OTSGS;kFzFbOm(fbp4S_HFxEfpV7)%x`pz2P|O=Ryc41RjE~$wal0sbNOAEBeu% zeg&(KoQCo%5C*}kfP@PN3&96Xl)rjH2yyzp3H)A|kkxHFd*tg0fWj<%yIfX2r_M~& z_mPpAQJTwTv7_%*oV0Q$4)4ur@X{+ofdqtuY@rzy*U}q0By4ncwyfDVfizA9Nm6G4 zK8ugCVZ$Y(%)<9dnRi?vP}c|HL_$8F$2$YBqb>3ZF8JgqI+`7VS5R&V2uT!*3FHb* z8hBWKnshR0&$sHp|4H=1!WswwGHi1}RY1M3)`rgtlrRhT#$yfFCcUlg|Jl<7DG~u_ z-JqrXBoZQrMd=)lINU+hCOKsgJd^J#2-Ab`ODJSJFfqN5k@rbF*bj!zLa|s@yqf&g zdQa)Z5W{)!AZ7*~#2z{)-ES0f5|cRtaoa`0av@C#Ur?b4 zTq`3Ufaf#q?mbm1)6A7R*?IE2|F!)EvKp87#FzOmSflIiKfw$jXiNTR&;YH7#xtdF<_^dC1ux;^J zmB8=BN|Z^UfEBczHFaG?7jpC$&|L#IPk&Z_-&Xy;mcWfSUZL`iebrl;Rfb>$jfh}` zsRmUMywDbqAV32H;|s8L*BXpYcj!6~uNO5WxF=+P|HuPdwrrlz1h7RUQNjiA&`S{W zP{C3-v;iO&5uO)oze8I>$4s+2Xwlyl=&vJCl}($z_S~-Vwnuk4$1%8#nt)+Z30z4F zIkyQz`9*kc=y>d$T!adV)ZUZ+mw@ZP_S(?)Qfc^FP^_74YiRoxwM|3wF&#E$K;caS zYuC>PCN*$HPaLn)#$l17H?!9j>Lmbj{oq9N*_kG;7FmXcDU>0Qt3=>>z6R(kviJRP z(o`)Qm*8ENjp4uj_Gm>2_xzi0zF9*5$e)T&5YQ*7T>wG5un4A=wq0i;j}uVFk$NCo z=%?SN@6#ya92Bq;;9DQ6wg>9v)?2UMk;zo<_kC3nW)x+k6^@yNVOj(^>vdb73x$gN z(n|xGp`p=JHf`F_hfpl|_%iLH5I_=&;02l?5rd(@bdyjcqA0<_PChr&yB7kIw#aks zbdvif5H|Gp#>R@5cXl?!d|!hOH*l>bc)rtCXTWu(+uuJqz}mY^TkU)Fce_!DJaZXn^ENFjEn{MBgq{kVc6lIT_*4PGIxq4O98Nv#D70 z-0DWIzivx8bGefwtloTc{BOmgdx8dEE4o}9LK=p|k^0v~16gXB{#6iYgV3;Eq-Plv zPULx#;Qs{)2Z2=R7qIz#7i?_hvnDW079JcP&U~)BJN5Bs)QB+ZVWc&Q5WGjH$L*n_aDRihyjU-uy%*|Tq2MZ&&|}PaN4*~^hrH^6s=9qaul$ZU-!VoYv9nK3HiM1bGVd)-Y6D1Ii@{-VnS}4n({AZ>8#S=XAz<9 z#OVZaQaEt}SxehXb?G0_;Cvjza}RZpzENF5z~Qt}SlEULhG+V~#BcEh^(OX1*00}u z7$d$yN)^}`NxVS&&tLuOmLm33EGUjbiO&*1r;eT=7*jW~1?Xrm=DYbJxDtSW^K6q; zJAfE%3P#QKV!!3V2XE}7p?-KVuu+Y`)PryybrmFz<*AQ0t3fKPrZsuqLv4V=jJXgx z8whG%mrf)sJwa8NLoq`80CfZcjr1fTHJN|V`T*j9CQ#sMNRx2!QIxR&Ubw9*IF`Da zdKBEbB~bl;;ycAs2;4*hDFhp&;mYAP5mC@!1H*s?M6BH}+m?OE|%Pgv(Xm zTxS3*r5&(vJtTetfqrTttm<7>30uW;U@)`y$q>Ck{1%s{BNBBCi{H34m1uxLDtbq|Q(d mz%+ds>JV)DzN%czvHTacr|w#8C%DZ30000r{*U_{XC}o(t+I?B1VPZMBCL&@D6k0x!;L|- zDGMVsipYhuC`N+OMhX(MXput@7CPVzr|W5#~m2v-rr}=>(04z zhm`VvomIdpAW5xm-A!s_XDT&Kw%;}Y%G^ngl0_m5WSVRqJ)mJv)ate>R3=j+2kdOv zFA-T1ajMXZH5_ka!xgVL9C3!Pe(5xOkSYxV zAP(RAk|$eJ0U^kzWQONCPcCZ8-Xt?gz9G-6pUu6{EYCkpq>2G?WPl5Miw5v#>1~wK z&)8ld?HFK2kg>r5?7;zS5lj=A195sl3;X_LO;iU^y6%WjIsmc}VgbYhg90RoY5>ZA z;P?P?BfP0W0un?yfEP43xqkGI0^~+G;wmq;c8~xS4!q(3%0K4@k>pXP5dbck5#GK* z14x+>h|Vg24ngrABe9@EFqKYL131+Il;7@!%|)h>)F3V;yVJLZ=`;`Gp3(qI0i0?8 z${!*!P8uP?!wKM3)0zPAVp+g007QZ)4-jGN7b0~CMxc=Z9yBg&*Z;mMAVCxdP}ujQ zwiHoIY7m!G+w80vA$C*&q!3qg14Pt*UjcLo08=Tz+r}-{_1~%jNFnk8D7)TocK-I8 z05k}f>9Z6N*rs!WQMjVs2$lo5GKI(op!kzPt0RMEM=nP+FYC{X@Q)P`-BJKs0Z35* z<-ZPFU8zGb0`D3C$F+wY0q|i_K;3q?5}6?K11Nc4*zVpWQilLw8321tCpL&{Y^fWH z0lXNHLSzFdeK2bGWJolKUrjGa`Ss+Q5#jkymjR>@*?_3in~geSQiot+Utt}5(hs9? zB2LgeLGh1yoHM@d5W$&307n5lxfGEBpzN+@cehl46hb?lOy`6Fu>fLQ5de`(5Lp09 zA5(x~AppFQ7tjDeWP->Bbaqd!YxTzGT0H>6L;O?}kV2RN6n(TkHX%XCp&~?J6$B)R z3;@MXDZtPXB0QECkh<*v;OPOBzKba|Pvr0s;heev%LC9{+2{e3JR_e0^wDSvb&1XHP<4G=LPg_zR>F@&Giq9eTjn>faapWJOUtO8o>yh&n#=6M)$HlZfFrfG@au%aGU0$z_13!Ctp*5G=lm6 zSXn?a3NPz+Cjk4G-~I&=TkPj#mR#i2{#o-k_5z66hKeK3u_oRj8~P`4KJ ze)|VBrOF_lBA=0Slz)@yQ(IQv4h<`^8p!7bq zJC#8&3KwpRk69^x9K>QFgzNtWz#Bnn<5lKn3R`hRKS3OuP~5U^t<807*qoM6N<$f@Z`PC;$Ke diff --git a/kolourpaint/pics/action/hisc-action-tool_brush.svgz b/kolourpaint/pics/action/hisc-action-tool_brush.svgz deleted file mode 100644 index 4848fadc23626b76d763cc419da066ed570760e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8136 zcmV;(A2;A1iwFP!000000Nk8ia~#KYhVT6=5ctNbEE?zg12&xtyOMI1om9nkQfd$2Ygf|MuHo{N`UyPL6(ezdT

fsa{o*q9Izj!SEe)+Q9FCT8--CvC6FD^bU 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 diff --git a/kolourpaint/pics/action/hisc-action-tool_color_picker.svgz b/kolourpaint/pics/action/hisc-action-tool_color_picker.svgz deleted file mode 100644 index e680a1a70a6f4ba19c5625f0935c32ebea3521c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10939 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 diff --git a/kolourpaint/pics/action/hisc-action-tool_curve.svgz b/kolourpaint/pics/action/hisc-action-tool_curve.svgz deleted file mode 100644 index 9aaa3e7f9377d58c6b3730785ead3511c645bb32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2380 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 diff --git a/kolourpaint/pics/action/hisc-action-tool_elliptical_selection.svgz b/kolourpaint/pics/action/hisc-action-tool_elliptical_selection.svgz deleted file mode 100644 index 63c328029d90d4b9dd3417074cbd9dab3facb118..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3597 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 TFXI37h>!mPR#^u3q&WZpSxGBB diff --git a/kolourpaint/pics/action/hisc-action-tool_eraser.svgz b/kolourpaint/pics/action/hisc-action-tool_eraser.svgz deleted file mode 100644 index d7415948df9a70b22dbbd097373a2657db97b168..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6959 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 diff --git a/kolourpaint/pics/action/hisc-action-tool_line.svgz b/kolourpaint/pics/action/hisc-action-tool_line.svgz deleted file mode 100644 index 622248262bf864d58d2f3e9beb3b6b63a158d6e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1333 zcmV-51ykJ~m7zUNn{+Dn42B$9eqQr5{KL5cur12ntnnHFhV zU6~XpdTr;|cO;8?df`RUzO;q3-@kix_lx6L9~7sWGwYD+t@T+vRv9h1^?IvynR?#gaB%Zh z=t{Nm-dK(Umetedm1SArR#Yj=mUfFT_o`@cEc1B5cUMeu`{A@ zr5(gBYOYc@;w{fNTRoTOY-vNjI6z7BZX!y%o z5v&lSII^eS?-dmlG~RA$@2FP!@im5;h9pF{sLii`!0_NN7Rjv>y0zzU0U`n`2g#de zWt09m<0QnSQ#YF;-6{^7_@<~EFF{%&qwmSiWKr-8+L9Irda7*8Yw4_4rNzIaQvq+- zjUb1x=VE;V-Xb@_K@j=9^w{i(AdZ7YkIgP(vkCS(#{|k5`IkAyksqO3XW=G`m_*Sn zOn?wC0uqi%9`k?^iP3+^^1Nw{-@$TcETAhbOL!ijY6*@LWcOmZURNAknOujuN}mdT zwsIgQsnQ!C`+*<5ZA21End?*9nZAWcuX`sKyyKU7k5`GGBvbDsiD7RMzjuG)p<3a zZSyf`c|W^n2^z$5#M6mjdd4^6QO`s(>4{9R*NfLCedpB&b@SAHY1E$#>?!Am{xo0F zuG}Tv@Mc0luIuJ%6)UM2S4I^z*GSb4k!ApaVnl7dYNtn+_0^U#d05(Hs{Ae`v|Q+h zhJZ=gj^_@D2u#zdvS}p*oe;yYohkQ90fA0IPaKkJZf4e0TY1>1nw&K)Dn2!3GTZNJ z+x?mS@;F7*#?ERbAv&%0vjq;hfNY)iixne+o~o{wG|s5!CvJmAG-*}QE`_NLrZ;tIOr z#nS##D=j=Ps@#`5$#`pSh%2eyz8askYY4PE$Io#5~_%=F5Vc#i5PeY%5sI$2R z#QkoCfeY;j0a?fZtS^?+zx04F0|-pE4jj5ZCgDWdKO6l}I(Bz4i0{^DD%WKpC=8)j rt`rJ-?e)!kh`*Uu?*E$ojGAGeB;5(Nfj_*!M1k8s=lLR@@eu$3j7FK6 diff --git a/kolourpaint/pics/action/hisc-action-tool_pen.svgz b/kolourpaint/pics/action/hisc-action-tool_pen.svgz deleted file mode 100644 index 0dfdd297e9f956d63130d127581318ce73281afe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4924 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 diff --git a/kolourpaint/pics/action/hisc-action-tool_rectangle.svgz b/kolourpaint/pics/action/hisc-action-tool_rectangle.svgz deleted file mode 100644 index a4f8b15c7c2b0ece006205eed92bd5202246f029..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1960 zcmV;Z2UqwXiwFP!000000PR}aZrex_ea}~L+=0Fwm!Op`5% zV~P|=%ChqHTTO{-Qli(BK!dpwHb~Z`tNPUGZo1%`@1ItA@Mx<#D~sC+L3k3_A}Q0X zSlmuNfBGTRlb~+mB8~I1u(y+RFoHP7e0#O_jHHX%gAou58iN5kVxHc=N=Y zZ|yy*Y+Y`uWIue8^ewA&4yHbnEo+U4F($$^qBI1Hu-+9-{1g`TRnHX?9CM`@;|O%# z^4D3-o^pWU*<@O6KRQ6ahTo&Z5ySml=iq5kVVmgPr*~0j9b%L=X>XX$%f~$}M-i`V zy^a%GA49bM+bnICw-c@rZm)IIikCK9ESqzAmflWazJz1bzIPeTj-0}X(N@)k>8m&$ zdZlG@AJ>p}v@BOPO5>u~MccA^h#pcKy}$eE$B)rNnFAE-I4hbnXP6Z@Csmzv{{ZE9P6bVd8A_*~mbXSJiZ6DE;XOcHaH zJ~^pDS}077wZdb)@Sy@=cSGi-J!A*%fy$3rf^V}xD z%Q)Z0yLu8t2RPlRasF*^R)8Bp66PR07V{n8CXpeWOXj6d?ULYHbLDN5QQPFi_GOGI zlvA>CjEQ6tPeX-_(p1W6h>;+QQ!xa2hy%e?ltDk7z=<9-$vbhBK`+&`%*Ql`&I+7?%WN&%T$}+Biok*5)^(=QjWP+ z<8U%ci~u+RMy4s5DugMOjC>26!x>X-=s$2?3{EEHMK;iXc7Tx`z++7RJ{WUFsTu!} zB1#JlM>`Q<1yS4~&zQoRTm)qCm)sWwmq6NaJS8(mO+!wRrkFU95|Z)D>c3}S>*C5G#ix*bj$MZE1^Dg={^{2q+u_$$!7 z#1SVECW;s{g$JdnqC>_C0gTp)^C4pmlAI8(JvT>f=Y88h3}YdiufX^MpK1azAvniV z=|9y*kAU&xV*F?sJ%$c&-bAkb(movU^pMRTJb^>|!gFXOb_!m>M6ekse9gMm@4xjIujb}|M$me{Z} zCB&l&NrIJ8XUa`gK{3NT-dUJbd+QicFU#$sa^TG4ytb#VX_;(R&Udrt%lhfm!a0Zc z_a$W4RGYH_wpjtQ4G)b-f+>E+qU%XYt)8)f2+uh?v^y%SY!jz(6Z^7v65h4vpj|xs z`P~o4ZbFjG{tInM-yLuU@qM|0d|ID_U7F0?Vu+i!*$OJ@dc*&M7VS;s6$9gDx3(Y{ z4BPd&$9m=Pv&x)P^s&kE{Jjg(?|MXsM7utOp9j2jvuxiMe)hiHecemYDV*UNoV=sbi^5i>yzC%tc6K=D6; z(1>tBB%Ugyji!|2;6qO;C?c3BB|%D%7F=^YE*&4CFZ~h>_Hze2k<9Pnev^Y5Il{ow zOx)G7<>gW-!?~19?@I*)e0_C(X1r;&=Z&~OU+EMwf^cJ6h?Ox$u|4pZYpi5XdKXBH z2%(bGDIeR6vf3V{UqJ1VvbKCaKS;C;Q;D z_fi;>J9-&T`%*{*+$k15j+gZ^`rxI#?C-qP&(p{8c#PsXPFeAP33=$jW4Jml7G+_d zJw94_waM+wK3brDdZZ#F3=kMnks&3(ji|4o;wr8lY}KZ5cn<3(u9|^lm8FAsTkPL2 zMP$F!9X$wZ4G=9e}SVxcv`KHYeM(AOHZagT0~v diff --git a/kolourpaint/pics/action/hisc-action-tool_rounded_rectangle.svgz b/kolourpaint/pics/action/hisc-action-tool_rounded_rectangle.svgz deleted file mode 100644 index 359eed2400eb85821e776c9b70f3988b61797829..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2220 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 R{MY?|{{x@Cp;+6S0RY)p*Rucs diff --git a/kolourpaint/pics/action/hisc-action-tool_text.svgz b/kolourpaint/pics/action/hisc-action-tool_text.svgz deleted file mode 100644 index 52d87f8124ad68c888e6f6c3f682289bbbf37a48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2666 zcmbV_cQ_l08phj0ksh_TqxRN{Y9mIeQ>sSwMzuzTqRLTw#R_e;(uz?lsM335R!}oU zjAO-#5vv+RsIldB69QMe>~bF(r=o11SWdxZw|S zSvg|fW(+tksX*b@Yq@LD&X+BRJ+E0eR0-#a+%&*$(+%;hTFNO2Ai<2R!w7~helgCw zV`g?OL)&XSfW8{rc?Wy5-xnH)otQY7n@5lbV$&O-5dS17GhmXc-zDED!$z<4j;yG^%`^zV=ZI7#QyCy%QY+^;QmFL1n-X_4n|o+ zz&1-UR)e}WWm57)8P{*b^5>nwrAQ#BliyzSfLyE>r8Fv)cv^zn0e%~ z>gVCQZggyYB25ko)mv01?fs_Hao1Po>KN8@oKCHF@vP}(R7d)Vo2|M({Ns?(r@2@^?|eNSc=v;(a4n`PLC` zjrsU_%$=Oxp$KLTi{6{RFwDYEXXP)Dp|!_vTjM)q>^fOTD7CyL7axL9wzCYclD4q2 zT|)Lep~z0h(+?f#tE8KxYLGpqqgmXS3z$~P_IWh&=zWNlZ|0=^!ZaZNwqxPK`%7mV zdu=EsR@1IAJBrXQ2twEXU2iu8@mSR>+2{d$VMEAkyi+JeLwwYyv&f7QwHng9gp08( z@cg#Da>e?JvCLw1RE4t2#v|P0bm!{S24z+~OAS_K=b0KpHV|C`GM{{vm-V*`R6}=` zl63S^Uk&bDS;CC^?qtRca)*heyQ{-8G_UlMRBe*=Z>)FwCdb)S<|l9Uun2!F9|3}S zq^^Fg0Tq#7qT`Wy;A{+7?{ml9$rP}gd^GX4ir}bGUo|H95v~9z=xyjb4C`F!8)RB1 zt1>VW`W|m`hX6-!4pE!2gM3Im^ZwDqAkwB}|7cZ6m-?XPrLxL8fW!4@W7v}CxoM%s z#$YapEJ{p)rZAKzAQlde;L{C1FD$Qi@{nK@OqEh;-i)XL;s&k~aKQcpHBNGpB7vY0 zoZm0NwM0au5D(XGFY_n57obSaZamdmIbx=H((=WG-|XIBz5(PvYn+;DTQ=tzL0H6H zdJ|)$CpB+{YDe{-b?;XuU}6__oR)hL6&lhozT2Xoes_8?M!WoaU#qPlY=8dVL1$K% z0kTAz!*Zvxp=;P=`CiP&kV;|eUw@rW3NiyKilD^U9?v3vFI`V~$_9+-iolYDrP^YU z1fNoHDmqoVS7)3}f~$}$8IaTigel29;4RP?GWc}SD0qCt!?g7Df*%i2_S*jJc~OIN zUj%*a=-i6VJUB|$)XdZuYf1T(-CR2xEBb)CmbjGyD1`-VGnFRii4a&T=Q2Mzra6)F zh;W8WvkTp<**#YP*)C|_XZ2iT5fxk_Osrv}^mQ=!1$78a{f9`&>Tw+`0kUkzZY4*k)RHoCf2$F5l_q8h#Z6bN{*6$YV?B+OYZYXbT-;+-wHr3u( z7%OtrC~59f8hByX?oHx(RGfDBkm4?@njeg8-%$&-1x(4R_d6BxnAGf-AC(Tju>S?G z*avQws4Bwl+@E+E1e7jdGXPIzCc4n(v%>WrqYLw+4p zkJ3gqi~!%Cqs0j{PE(L4MfIL3r@xFAA@jKCVIr&k zNnPhI@ARze8g@N=>K6JUivH;OMI9AnBh(kW^m{{W1q_S55BKIoc~XJulgT{Pb`}G<#0bp)3=&bZsxyO Y!XumEy+4%1q<5TV2$)LEDV#d>Z|0#cCjbBd diff --git a/kolourpaint/pics/app/CMakeLists.txt b/kolourpaint/pics/app/CMakeLists.txt deleted file mode 100644 index 8bf119c3..00000000 --- a/kolourpaint/pics/app/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -# Change this number every time you add an icon to force the build system -# to rebuild and pick the icon up: -# -# 3 -# - -kde4_install_icons( ${ICON_INSTALL_DIR} ) - diff --git a/kolourpaint/pics/app/hi16-app-kolourpaint.png b/kolourpaint/pics/app/hi16-app-kolourpaint.png deleted file mode 100644 index 9fe668e9e3d95c57befa5129970627d3e771752a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 759 zcmVSfpg&Z$2oit2aHXA&kfy4b4G2W zPOHeOZ^;E0gb+Bp2+F*eYc}kvUGSP%e{pv4meCLb0BPVP+_ebp{oHY{H(N;yv(yc= zCpz7b$Co&Lfqe@s_};p>j5X`cJnPJqQ6H9kOI2BvS`ALX?CU9a05i4k%eW=6N)lfz7quw)t8S~ zgo+|=2!wnN?I(diNi3uN(ARV9Vo};Y1r9$ZzskoxsX7Is7)0U-riYY-^kjOfy1ijE zKa$JYr@%ob^&oxxg`M#ylFsc}NsuHY0PP(D(;Cg^#?s=1XEO}?XMtVAh{?L3n?FCO zR1VNyB+?Q%B-9Fc0*eQ?bh?Y$em&&+)mmXJjz%Gkz zsb6$m0J4IRx9M7uOjWoJXF)_IDq`y1Fy@EvYz!~QmSr#ONJ$x6=B)H?R|9GG6g0#1D{CbT=EMEPUX4d++7=R4)OH);TR^SNHWBvRs)Sw z!S_n;B)(NV8EEb3(I1JHE)i>%b-Gdi7|d2P00jh(Yo%s3Y{1%ZpxqdP4jMvs z2KH7~T(@n2=an~Q0)YKHw+MEHy|&`IS`&9L-gR(ouvR;)+UB~jK~drUVi(4EzYn1S p8HQD{ESvr-ENtZC#Ka{0LX=eZc diff --git a/kolourpaint/pics/app/hi22-app-kolourpaint.png b/kolourpaint/pics/app/hi22-app-kolourpaint.png deleted file mode 100644 index 6452a93b309a8e5da54687e4264b7dd127a8582f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1206 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 Q#{d8T07*qoM6N<$g8w@J3;+NC diff --git a/kolourpaint/pics/app/hi48-app-kolourpaint.png b/kolourpaint/pics/app/hi48-app-kolourpaint.png deleted file mode 100644 index aca21f16fee22bf3c7ccfdf8786fcd041ea8272a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3922 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 diff --git a/kolourpaint/pics/custom/CMakeLists.txt b/kolourpaint/pics/custom/CMakeLists.txt deleted file mode 100644 index 7c83b3be..00000000 --- a/kolourpaint/pics/custom/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -install(FILES - tool_spraycan_9x9.png - tool_spraycan_17x17.png - tool_spraycan_29x29.png - color_transparent_26x26.png - colorbutton_swap_16x16.png - option_opaque.png option_transparent.png - resize.png scale.png - smooth_scale.png - image_skew_horizontal.png - image_skew_vertical.png - image_rotate_anticlockwise.png - image_rotate_clockwise.png - DESTINATION ${DATA_INSTALL_DIR}/kolourpaint/pics) diff --git a/kolourpaint/pics/custom/color_transparent_26x26.png b/kolourpaint/pics/custom/color_transparent_26x26.png deleted file mode 100644 index 50b67bfe3592dffc8bd0c0cfe84a7aefd3eb7162..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 919 zcmV;I18Dq-P)UBVV$#1}J}8#|yJ zRk$5mydXE5Axf(vJD(;>t0zdPC`6(uTevA)w=7q(EN8+jXu~a4vMqAWFK59pbqVsx;}EoKVYywY`;H#(Liy* zKzGVPYq&#&)0i5iqc$};9Z*FW0cuu zpyOzy8mRuIhKI=6I~)RMB*lcK_usK=G6 z$(FR&nYY-Sy4jw<>7b^+puF3mtHYwN$D**=qO!@N!|S8J+@!eRrM={(!sw;N?54uq zsL1WA#NVsS@2$t+ud>6h&G4|d$FR!bve5Cf%;UAb-?h{8w#MeS$?3PwGrz|E=UC8UO$RT}ebiR49>SSh8f*Ku->x0gF12~Ry{bSgjbYc!@b0;DRe(6C0^Kg z8Wezdws#|{UGlZlr`OiX0rB+d0w{JB+D@sdnKDHNh-+%Bnvw02oj9?&dg4T>YB0@% zWY>()^76jE@^Z;OFzq!BVV7i2Sy@j{nVEzsm@eah+qJ;Hq^qmMS1VsEPui^n$hN76 z*(F|F-0G>9Q(7ugTAD53)Y@9i3bkvJMV+frW&scgfrt!F>pJrZ5W7U3jnZ?$fFDAo zGFvi1>=KU3f&xAmBY**FSBgMM(h9v<34~Ph4_D7AcNEx5#Xzu7} t50)6rv=Jic$mPHuhdmvduo)w#Ljb%0VF~>h{}ccK002ovPDHLkV1jx~zmWg{ diff --git a/kolourpaint/pics/custom/colorbutton_swap_16x16.png b/kolourpaint/pics/custom/colorbutton_swap_16x16.png deleted file mode 100644 index b1352721596fcf87421e2f2b884df41b12c973d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6>^xl@Ln>}9Jr~HvV8Fw2aqs`7 z%TH-7m0kKw`H(QD?u6iM4GylRrUI`07tYq*IB>?n_`<)2N>vxn?b4MsMGRgR{~5Ic SEkl7OF?hQAxvXiJ}#2xCc* zUoeBivm0qZPO+zpV@SoVt5*&A4k!pPJHG#KKUc{0IBWD0hVlqz5rqKGPt2XF8&#$q z=##ki<;EFLq6?Z1P^~lD#NZ<+{7>T95m^mCuER6U+*?O5fP)ksYJ{ecCOF zvXGK#%Y3qSt;_oVbCKtdj$Jl?!*tdMe`eUF&ct?L*7=h_>lr*<{an^LB{Ts5oz6{| diff --git a/kolourpaint/pics/custom/image_rotate_clockwise.png b/kolourpaint/pics/custom/image_rotate_clockwise.png deleted file mode 100644 index cd1e00b7f75fb7f4dbda85265b8f3e7dbab3422c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^IzX()!3-o*CUIK;DYgKg5ZC`ez`*c2>iJ}#2xCc* zUoeBivm0qZPL8LGV@SoVr&kQQ7z}xs9pC@ApBq(>_V`eNz|>0_oWE4Svxp|$RBP95&MYu9$N$DqkIKQZt8nT>Zd@)q50bvv#Q sm9^${>o$+QAA5i8f4|2>@&63weK(lc7W%u@0_|n+boFyt=akR{05dsHxBvhE diff --git a/kolourpaint/pics/custom/image_skew_horizontal.png b/kolourpaint/pics/custom/image_skew_horizontal.png deleted file mode 100644 index b6c39068aadd83f53230e60fccda1577cb790b3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^Za{3p!3-oBr1sSSNuB_o5ZC|z{{xvo3}ncB>z@qd zFqQ=Q1v5B2yO9RugnGI-hE&{od(n{ZfCC4!a5k~V^=FseQ{!oiRtO#ocsA4Ll;O-N$#pZYm@iqfWtVu} XT&~GW&seSkTEO7x>gTe~DWM4fC!Ipp diff --git a/kolourpaint/pics/custom/image_skew_vertical.png b/kolourpaint/pics/custom/image_skew_vertical.png deleted file mode 100644 index 7c6fad9a6ac95e78513ee43d6fb943aaa34a2733..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^CP3`Q!3-p~__zxLDV_kI5ZC|z{{xvo3}ncB>z@qd zFqQ=Q1v5B2yO9Ru^n1EEhE&{od(M!H*-(JxVD#Pp|8v$XVeK|8d6r-;%k^yLvh3`& z^4^spPXjqwDpgmlKe(Zji^;gE5o z0;6ftMeB?U{}%>vC=046bEqkII8W#>Vw{=2z)z-$MTNt|mf2C}mWx7%gN<;8u(->@ d^jRKX7cO}1c`Dh4`@!PC{xWt~$(699L4PEG&- diff --git a/kolourpaint/pics/custom/option_opaque.png b/kolourpaint/pics/custom/option_opaque.png deleted file mode 100644 index add5daad2d8eb5f2631a62d176157494723f3cf6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 659 zcmV;E0&M+>P)NTG?@H5Z_<2*fgZYG#$LHEVWo za6AJ7_;jj?E{@$;CyiF`98HW;GNb@4sH{Qp9(;a*YH%EmU4!fhAgOPh_JJ&rJ_@*e zet_ZQhd6!n0Gp*M>xDNwJy&7s31p9GZaQZ2(d%u=WWscdI;eoT6MN|^ePEAQA~&32 z-#~`qJm6zh{ikj9l1X1%95^@xrH}Bv4qh#&HO?N~;{K~Blbz%>Nu~6e1UA1^0|#pn zq}RX~fbN{E)?H4wuR{`K@NLlIeiZUY16nPX-@)KXKFY z1uSpD)Rpd>{MK~rWOf9d;^Mq!5KspdFnc)6q-ASyn#lB|=6{MfG_J7!PXM?j*1?PUauL!t^BhrSLnaM>P@Al>iw73|)jaH)Cya za2+1c+s>1ERC{mQvp53_i<4~73|51=ODo9b@FA?V@N5*o=x?W$-O13!-+)@x%}RHG zi2F=x25(JIgn%2SLGHqS@{hZ9(g|cNi*0~0H?5!!-#F^xLtqHzZm;ksJ$~VN z5=4uZRxNF7X$xUy2n%%Fw}~$B9M}q;2QPpk*ba7pm%!ga3A_w;f?Z%Ycm=!) zUIVX#Jzy``2lj&l;2?Mdya^70!{7)w3jP893H}9+f#cvUZ~~kJr@(3OHh2fT3*G}g z;C*lo^n(9DA!%$JuTo(86z%3%gTzza}T{WaceH= zN%c(i!>$3BsVPv98dUO8jZ;-(oEXqMg9lv81>ME%b@iXL^~`3PmfEeq{4Jb{c|CG| zPSs+5qe?rp_T?YHD0uFqzNjzX68`m~;k@FLZ$Dm>bGoXgWVE7RdVIQk#XBDk3W9C@ z*54d?F=6XVe9SL4YIO-81n46}4RbGz)lA2QTi(w~i|*9sZi((aI60YK);(Jn(>I@% zaIH=w_$50>j^tTlziIz$)KXhk^x)&87|hxAU(V)4`{kc!nofALmj~b2@4Yg6-BHoK zO7&zYcEi2B6&V@vL%xBImAhZ78r#1=%$$3$ zFK5J-Jyp0PLhW~_!MwS@;gvAmVZV&sA;YCRvx2X7eLHVupHGKj`eD5N$brJ~!!2~o cvo$tf_HhK5s;71?-T3q`hE#LPsU%z3|3dGHrvLx| diff --git a/kolourpaint/pics/custom/resize.png b/kolourpaint/pics/custom/resize.png deleted file mode 100644 index 398e5fc6deeaa7d0f9d6ce814c2ac61323f386d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3951 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 JPDHLkV1fnmq5}W` diff --git a/kolourpaint/pics/custom/scale.png b/kolourpaint/pics/custom/scale.png deleted file mode 100644 index 6941475741702ae62c6943493f8204ffd2740725..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1724 zcmXYx4^$IJ9>*7`-U4dz4u}8(R;8 zJwsZ!nuXIgo+9xSS+E{kOU0FfZjj0X)eaz-MXC(7lU>LSgl@LcrZLVZdxR>OgyY8OBFi(B*_8svEA*E88n3zZqgifc+ zc4IQQk-XXD#%wa%&2Fq_v)$^3v|6RWL6TO|jh!SNlG*K&Bph}-C7Ht^NrG}XXorJw zP%K4Y6oFH2Xo_MenxzSx)?l>8kJhcGDF^L_p`|>{(G16Ea7KqQI-D`c7^%Pw%Sd?! zFf3rRG1e5pnq;g=$yy1PC0REd%L2}fb5@*VNsgsCH-O`KU{?Z%5>N)fm;pxvjs-xH z1P=fNKma`C%{WhDJZI&BQ~-Ehk_6;=0a|fL;*i!sRtY%+X&AZ@AVh*4 z7aX`iYXn9ouo{8Q7C46hC;`v{ZxEnefYMshR6&5EATWX(DL{hA3nCI7GLgbXN+!~n z$VgI%EGDuMBC8ZRg~(|{fQi6Q1PT$DL>?1)oya>xNQsaYAtyp!{NK8w8zf4%>%b5t zDFRV4L}Q4-5GzT8I1F(z#3>QL5Wo>wjervI7~*A!mx64>lZdAg#1O<0R3fNB(25|1 z1Plo)kYGZB83|ICM#uV5u*R^jUhxJq(O*6h(U;#j^o^1WRsqthmlaf zg>8mInHc8vOckfxQ9SG#u%rgX2RkPlQbx`vpWFKI=*k9}CBXaXg2@d^nPtZ5`^f3# zTR4#FQLU!6F_WDp;=APfUEg`8chvJUk29t?&pTPRg(_c5^@k@z`*Mn34f&|MV%?sL zyHZNhq6TGKgEp)&tcn?Z_H>c)`oZhRV#gb+QdM9;d#yVbtyLc(cPQ)$+s98sdu>?d zK4QLXAch#q%l*o9{OfgfFQ=sTegJE2R>texnon)*E#p);Db}2WI6BE z=)2!rVw-vTl#A%UXt}tnr_|3gZe+AHyk%mW{&m;Ig0}wq4UU`Nj#sw!41F!kO%N|u ze{$&Od9C}?FQer#fz{y}${xSIHAu8A{Wdz|*GJn6r`9Wt!1qq%1#3~RX6ZX0n+qRW z&IC_fX>UJNTKd^?pTn`Scw{)OpYELqo9Uf0KD)Iuv(OF#eO9IP1Zv96g&P~oZD;Ip z*%J@@eigS6NonNgCDE7i?hl(|h@;)i+q;I#VP=gY;%45X>NkG=A!Otq|Cye-+ftpQ z8Cmh*R_BQ#@5?J(d-Y!_BcZXruCA`3AtEho!-3j_!O5BHpMIf#Y4c}tCkh~zVWL6th4(l z>7O&Is9@eoDbQ-QdcEFgq}$qpf&%at*6k^4v4YB$$L$@vZ(d115W1uT$*(9pc7Hrt zmi$5M!0M?!|BYY3yO+VJ{AO=Qc3;E1W(z30eL8fpYVXaSY`*D)@l5;6dEd#*nW1{@T|M^=CAn%JQEL bnElPpd&c=yYtI);Ujn9zSI0HSYRmr%eQVWq diff --git a/kolourpaint/pics/custom/smooth_scale.png b/kolourpaint/pics/custom/smooth_scale.png deleted file mode 100644 index 6c391d8d70f62a1a72d3bead20f1434d0d92f4a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5039 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 FV1g$vsWSio diff --git a/kolourpaint/pics/custom/tool_spraycan_17x17.png b/kolourpaint/pics/custom/tool_spraycan_17x17.png deleted file mode 100644 index 9eb481d9617193c6bbe762f3d69f5447ef580126..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^f*{NRBpBq_B-DVEr>Bc!h=io>!A8ad1{?<#{P}Nk z+3&>3ldGnvFJ8K4#R~yX6(!M2&M6^YEp1c0yrrs^xTBp8Z+SX>5DGd*1#Ln>~SPUIFkV!+|F_y5x0 z3meUSX33gQ>qshD_e=KSnPe+1uMb~cJEnhBpT*s%>JXB!LVN-97VZlZXK#~f+r#lC zsqK;oj~KI5>V>dboYTJY8aKLKeWHFnHdNN_@hp%3c@tb#h!rlM8M15h`j0`e4Rg+a zuIV@Wvs-N`fPdj{hmU~72qJ80Z2c^4QA`i!JpF1DqSWj0! Jmvv4FO#r`lRkZ*B diff --git a/kolourpaint/pics/custom/tool_spraycan_9x9.png b/kolourpaint/pics/custom/tool_spraycan_9x9.png deleted file mode 100644 index 06c8639ef59741dd8e7584134b1379fe84739381..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^oFL2rBp8nViaZ0Pls#P>LpWqv4>B?Wc?}c(%@*eW2gm)GFJ0-+fo1q`09elF{r5}E)wuoRL2 diff --git a/kolourpaint/pixmapfx/kpPixmapFX.h b/kolourpaint/pixmapfx/kpPixmapFX.h deleted file mode 100644 index 90304ddb..00000000 --- a/kolourpaint/pixmapfx/kpPixmapFX.h +++ /dev/null @@ -1,281 +0,0 @@ - -// REFACTOR: Split this class into one for each distinct functionality category -// (e.g. effects, mask operations)? - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_PIXMAP_FX_H -#define KP_PIXMAP_FX_H - - -#include -#include - -#include - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - - -class kpAbstractSelection; - - -// -// QPixmap (view) Manipulation. -// -// Anything that is supposed to be manipulating the document contents -// (i.e. kpImage), should be moved to kpPainter. -// -// kpPainter uses us for its Qt backend but we don't use kpPainter. -// TODO: We should not use kpColor nor kpImage for the same reason. -// -class kpPixmapFX -{ -// -// Get/Set Parts of Pixmap -// - -public: - - // - // Returns the pixel and mask data found at the in . - // - static QImage getPixmapAt (const QImage &pm, const QRect &rect); - - // - // Sets the pixel and mask data at in <*destPixmapPtr> - // to . Neither 's width nor height are allowed - // to be bigger than 's (you can't copy more than you have). - // On the other hand, you can copy less than the size of - // - no scaling is done. - // - static void setPixmapAt (QImage *destPixmapPtr, const QRect &destRect, - const QImage &srcPixmap); - - // - // Sets the pixel and mask data at the rectangle in <*destPixmapPtr>, - // with the top-left and dimensions , - // to . - // - static void setPixmapAt (QImage *destPixmapPtr, const QPoint &destAt, - const QImage &srcPixmap); - static void setPixmapAt (QImage *destPixmapPtr, int destX, int destY, - const QImage &srcPixmap); - - // - // Draws on top of <*destPixmapPtr> at . - // The mask of <*destPixmapPtr> is adjusted so that all opaque - // pixels in will be opaque in <*destPixmapPtr>. - // - static void paintPixmapAt (QImage *destPixmapPtr, const QPoint &destAt, - const QImage &srcPixmap); - static void paintPixmapAt (QImage *destPixmapPtr, int destX, int destY, - const QImage &srcPixmap); - - // - // Returns the colour of the pixel at in . - // If the pixel is transparent, a value is returned such that - // kpTool::isColorTransparent() will return true. - // - static kpColor getColorAtPixel (const QImage &pm, const QPoint &at); - static kpColor getColorAtPixel (const QImage &pm, int x, int y); - -// -// Transforms -// - -public: - - // - // Resizes an image to the given width and height, - // filling any new areas with . - // - static void resize (QImage *destPtr, int w, int h, - const kpColor &backgroundColor); - static QImage resize (const QImage &pm, int w, int h, - const kpColor &backgroundColor); - - // - // Scales an image to the given width and height. - // If is true, a smooth scale will be used. - // - static void scale (QImage *destPtr, int w, int h, bool pretty = false); - static QImage scale (const QImage &pm, int w, int h, bool pretty = false); - - - // The minimum difference between 2 angles (in degrees) such that they are - // considered different. This gives you at least enough precision to - // rotate an image whose width <= 10000 such that its height increases - // by just 1 (and similarly with height <= 10000 and width). - // - // Currently used for skew & rotate operations. - static const double AngleInDegreesEpsilon; - - - // - // Skews an image. - // - // horizontal angle clockwise (-90 < x < 90) - // vertical angle clockwise (-90 < x < 90) - // color to fill new areas with - // if > 0, the desired width of the resultant pixmap - // if > 0, the desired height of the resultant pixmap - // - // Using & to generate preview pixmaps is - // significantly more efficient than skewing and then scaling yourself. - // - static QMatrix skewMatrix (int width, int height, double hangle, double vangle); - static QMatrix skewMatrix (const QImage &pixmap, double hangle, double vangle); - - static void skew (QImage *destPixmapPtr, double hangle, double vangle, - const kpColor &backgroundColor, - int targetWidth = -1, int targetHeight = -1); - static QImage skew (const QImage &pm, double hangle, double vangle, - const kpColor &backgroundColor, - int targetWidth = -1, int targetHeight = -1); - - // - // Rotates an image. - // - // clockwise angle to rotate by - // color to fill new areas with - // if > 0, the desired width of the resultant pixmap - // if > 0, the desired height of the resultant pixmap - // - // Using & to generate preview pixmaps is - // significantly more efficient than rotating and then scaling yourself. - // - static QMatrix rotateMatrix (int width, int height, double angle); - static QMatrix rotateMatrix (const QImage &pixmap, double angle); - - static bool isLosslessRotation (double angle); - - static void rotate (QImage *destPixmapPtr, double angle, - const kpColor &backgroundColor, - int targetWidth = -1, int targetHeight = -1); - static QImage rotate (const QImage &pm, double angle, - const kpColor &backgroundColor, - int targetWidth = -1, int targetHeight = -1); - -// -// Drawing Shapes -// - -public: - - // Returns a pen suitable for drawing a rectangle with 90 degree - // corners ("MiterJoin"). This is necessary since Qt4 defaults to - // "BevelJoin". is passed straight to QPen without modification. - static QPen QPainterDrawRectPen (const QColor &color, int qtWidth); - - // Returns a pen suitable for drawing lines / polylines / polygons / - // curves with rounded corners. This is necessary since Qt4 defaults - // to square corners ("SquareCap") and "BevelJoin". - // is passed straight to QPen without modification. - static QPen QPainterDrawLinePen (const QColor &color, int qtWidth); - - - // Draws a line from (x1,y1) to (x2,y2) onto , with - // and . The corners are rounded and centred at those - // coordinates so if > 1, the line is likely to extend past - // a rectangle with those corners. - // - // If is valid, it draws a stippled line alternating - // between long strips of and short strips of . - static void drawPolyline (QImage *image, - const QPolygon &points, - const kpColor &color, int penWidth, - const kpColor &stippleColor = kpColor::Invalid); - - static void drawLine (QImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth, - const kpColor &stippleColor = kpColor::Invalid); - - // = shape completed else drawing but haven't finalised. - // If not , the edge that would form the closure, if the - // shape were finalised now, is highlighted specially. - // - // Odd-even fill. - static void drawPolygon (QImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor = kpColor::Invalid, - bool isFinal = true, - const kpColor &fStippleColor = kpColor::Invalid); - // Cubic Beizer. - static void drawCurve (QImage *image, - const QPoint &startPoint, - const QPoint &controlPointP, const QPoint &controlPointQ, - const QPoint &endPoint, - const kpColor &color, int penWidth); - - static void fillRect (QImage *image, - int x, int y, int width, int height, - const kpColor &color, - const kpColor &stippleColor = kpColor::Invalid); - - // Draws a rectangle / rounded rectangle / ellipse with top-left at - // (x, y) with width and height . Unlike QPainter, - // this rectangle will really fit inside x and won't - // be one pixel higher or wider etc. - // - // and must be >= 0. - // - // must not be invalid. However, may be invalid - // to signify an unfilled rectangle / rounded rectangle /ellipse. - static void drawRect (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid, - const kpColor &fStippleColor = kpColor::Invalid); - - static void drawRoundedRect (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid, - const kpColor &fStippleColor = kpColor::Invalid); - - static void drawEllipse (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth = 1, - const kpColor &bcolor = kpColor::Invalid, - const kpColor &fStippleColor = kpColor::Invalid); -}; - - -#endif // KP_PIXMAP_FX_H diff --git a/kolourpaint/pixmapfx/kpPixmapFX_DrawShapes.cpp b/kolourpaint/pixmapfx/kpPixmapFX_DrawShapes.cpp deleted file mode 100644 index 13aff76f..00000000 --- a/kolourpaint/pixmapfx/kpPixmapFX_DrawShapes.cpp +++ /dev/null @@ -1,492 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PIXMAP_FX 0 - - -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -// Returns whether there is only 1 distinct point in . -static bool Only1PixelInPointArray (const QPolygon &points) -{ - if (points.count () == 0) - return false; - - for (int i = 1; i < (int) points.count (); i++) - { - if (points [i] != points [0]) - return false; - } - - return true; -} - -//--------------------------------------------------------------------- - -// Warp the given from 1 to 0. -// This is not always done (specifically if ) because -// width 0 sometimes looks worse. -// -// Qt lines of width 1 look like they have a width between 1-2 i.e.: -// -// # -// ## -// # -// # -// -// compared to Qt's special "width 0" which just means a "proper" width 1: -// -// # -// # -// # -// # -// -static int WidthToQPenWidth (int width, bool drawingEllipse = false) -{ - if (width == 1) - { - // 3x10 ellipse with Qt width 0 looks like rectangle. - // Therefore, do not apply this 1 -> 0 transformations for ellipses. - if (!drawingEllipse) - { - // Closer to looking width 1, for lines at least. - return 0; - } - } - - return width; -} - -//--------------------------------------------------------------------- - -static void QPainterSetPenWithStipple (QPainter *p, - const kpColor &fColor, - int penWidth, - const kpColor &fStippleColor = kpColor::Invalid, - bool isEllipseLike = false) -{ - if (!fStippleColor.isValid ()) - { - p->setPen ( - kpPixmapFX::QPainterDrawLinePen ( - fColor.toQColor(), - ::WidthToQPenWidth (penWidth, isEllipseLike))); - } - else - { - QPen usePen = kpPixmapFX::QPainterDrawLinePen ( - fColor.toQColor(), - ::WidthToQPenWidth (penWidth, isEllipseLike)); - usePen.setStyle (Qt::DashLine); - p->setPen (usePen); - - p->setBackground (fStippleColor.toQColor()); - p->setBackgroundMode (Qt::OpaqueMode); - } -} - -//--------------------------------------------------------------------- - -// public static -QPen kpPixmapFX::QPainterDrawRectPen (const QColor &color, int qtWidth) -{ - return QPen (color, qtWidth, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); -} - -//--------------------------------------------------------------------- - -// public static -QPen kpPixmapFX::QPainterDrawLinePen (const QColor &color, int qtWidth) -{ - return QPen (color, qtWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); -} - -//--------------------------------------------------------------------- -// -// drawPolyline() / drawLine() -// - -// public static -void kpPixmapFX::drawPolyline (QImage *image, - const QPolygon &points, - const kpColor &color, int penWidth, - const kpColor &stippleColor) -{ - QPainter painter(image); - - ::QPainterSetPenWithStipple(&painter, - color, penWidth, - stippleColor); - - // Qt bug: single point doesn't show up depending on penWidth. - if (Only1PixelInPointArray(points)) - { - #if DEBUG_KP_PIXMAP_FX - kDebug () << "\tinvoking single point hack"; - #endif - painter.drawPoint(points[0]); - return; - } - - painter.drawPolyline(points); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::drawLine (QImage *image, - int x1, int y1, int x2, int y2, - const kpColor &color, int penWidth, - const kpColor &stippleColor) -{ - QPolygon points; - points.append (QPoint (x1, y1)); - points.append (QPoint (x2, y2)); - - drawPolyline (image, - points, - color, penWidth, - stippleColor); -} - -//--------------------------------------------------------------------- -// -// drawPolygon() -// - -// public static -void kpPixmapFX::drawPolygon (QImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal, - const kpColor &fStippleColor) -{ - QPainter p(image); - - ::QPainterSetPenWithStipple (&p, - fcolor, penWidth, - fStippleColor); - - if (bcolor.isValid ()) - p.setBrush (QBrush (bcolor.toQColor())); - // HACK: seems to be needed if set_Pen_(Qt::color0) else fills with Qt::color0. - else - p.setBrush (Qt::NoBrush); - - // Qt bug: single point doesn't show up depending on penWidth. - if (Only1PixelInPointArray (points)) - { - #if DEBUG_KP_PIXMAP_FX - kDebug () << "\tinvoking single point hack"; - #endif - p.drawPoint(points [0]); - return; - } - - // TODO: why aren't the ends rounded? - p.drawPolygon(points, Qt::OddEvenFill); - - if ( isFinal ) - return; - - if ( points.count() <= 2 ) - return; - - p.setCompositionMode(QPainter::RasterOp_SourceXorDestination); - p.setPen(QPen(Qt::white)); - p.drawLine(points[0], points[points.count() - 1]); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::drawCurve (QImage *image, - const QPoint &startPoint, - const QPoint &controlPointP, const QPoint &controlPointQ, - const QPoint &endPoint, - const kpColor &color, int penWidth) -{ - QPainter p(image); - ::QPainterSetPenWithStipple (&p, - color, penWidth); - - // SYNC: Qt bug: single point doesn't show up depending on penWidth. - if (startPoint == controlPointP && - controlPointP == controlPointQ && - controlPointQ == endPoint) - { - #if DEBUG_KP_PIXMAP_FX - kDebug () << "\tinvoking single point hack"; - #endif - p.drawPoint (startPoint); - return; - } - - QPainterPath curvePath; - curvePath.moveTo(startPoint); - curvePath.cubicTo(controlPointP, controlPointQ, endPoint); - - p.strokePath(curvePath, p.pen()); -} - -//--------------------------------------------------------------------- -// public static -void kpPixmapFX::fillRect (QImage *image, - int x, int y, int width, int height, - const kpColor &color, - const kpColor &stippleColor) -{ - QPainter painter(image); - - if (!stippleColor.isValid ()) - { - painter.fillRect (x, y, width, height, color.toQColor()); - } - else - { - const int StippleSize = 4; - - painter.setClipRect (x, y, width, height); - - for (int dy = 0; dy < height; dy += StippleSize) - { - for (int dx = 0; dx < width; dx += StippleSize) - { - const bool parity = ((dy + dx) / StippleSize) % 2; - - kpColor useColor; - if (!parity) - useColor = color; - else - useColor = stippleColor; - - painter.fillRect (x + dx, y + dy, StippleSize, StippleSize, useColor.toQColor()); - } - } - - } -} - -//--------------------------------------------------------------------- -// Calls to drawRect(), drawRoundedRect() and drawEllipse() are -// forwarded here. is the respective QPainter function and -// may or may not be called. -static void DrawGenericRect (QImage *image, - int x, int y, int width, int height, - void (*func) (QPainter * /*p*/, int /*x*/, int /*y*/, - int /*width*/, int/*height*/), - const kpColor &fcolor, int penWidth, - kpColor bcolor, - const kpColor &fStippleColor, - bool isEllipseLike) -{ -#if DEBUG_KP_PIXMAP_FX - kDebug () << "kppixmapfx.cpp:DrawGenericRect(" << x << "," << y << "," - << width << "," << height << ",func=" << func << ")" - << " pen.color=" << (int *) fcolor.toQRgb () - << " penWidth=" << penWidth - << " bcolor=" - << (int *) (bcolor.isValid () ? - bcolor.toQRgb () : - 0xabadcafe) - << " isEllipseLike=" << isEllipseLike - << endl; - #endif - - - if ( (width == 0) || (height == 0) ) - return; - - Q_ASSERT (func); - - // Check foreground colour valid. - // Background is allowed to be invalid (no fill). - Q_ASSERT (fcolor.isValid ()); - - - if (width == 1 || height == 1) - { - #if DEBUG_KP_PIXMAP_FX - kDebug () << "\twidth=1 or height=1 - draw line"; - #endif - - kpPixmapFX::drawLine (image, - x, y, x + width - 1, y + height - 1, - fcolor, 1/*force pen width to 1*/, - fStippleColor); - return; - } - - - // Outline is so big that fill won't be seen? - if (penWidth * 2 >= width || penWidth * 2 >= height) - { - #if DEBUG_KP_PIXMAP_FX - kDebug () << "\toutline dominates fill - fill with outline"; - #endif - - // Fill with outline. - // TODO: doesn't emulate non-Qt::SolidLine pens - // TODO: Transition from this hack to normal drawing makes the - // ellipse look like it moves 1 pixel to the right due to - // Qt missing a pixel on the left of some sizes of ellipses. - penWidth = 1; - bcolor = fcolor; // Outline colour. - } - - QPainter painter(image); - - ::QPainterSetPenWithStipple(&painter, - fcolor, penWidth, - fStippleColor, - isEllipseLike); - - QPen pen = painter.pen(); - pen.setJoinStyle(Qt::MiterJoin); // rectangle shall always have square corners - painter.setPen(pen); - - if (bcolor.isValid ()) - painter.setBrush (QBrush (bcolor.toQColor())); - // HACK: seems to be needed if set_Pen_(Qt::color0) else fills with Qt::color0. - else - painter.setBrush (Qt::NoBrush); - - // Fight Qt behaviour of painting width = fill width + pen width - // and height = fill height + pen height. Get rid of pen width. - (*func) (&painter, - x + penWidth / 2, - y + penWidth / 2, - width - penWidth, - height - penWidth); -} - -//--------------------------------------------------------------------- - - -static void DrawRectHelper (QPainter *p, - int x, int y, int width, int height) -{ - // workaround for QTBUG-38617 - QPainterPath path; - path.addRect(x, y, width, height); - p->drawPath(path); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::drawRect (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - const kpColor &fStippleColor) -{ - ::DrawGenericRect (image, - x, y, width, height, - &::DrawRectHelper, - fcolor, penWidth, - bcolor, - fStippleColor, - false/*not ellipse-like*/); -} - -//--------------------------------------------------------------------- - - -static void DrawRoundedRectHelper (QPainter *p, - int x, int y, int width, int height) -{ - // (has default arguments for the roundness i.e. different prototype - // to QPainter::draw{Rect,Ellipse}(), therefore need pointer to these - // helpers instead of directly to a QPainter member function) - p->drawRoundedRect(x, y, width, height, 25, 25, Qt::RelativeSize); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::drawRoundedRect (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - const kpColor &fStippleColor) -{ - ::DrawGenericRect (image, - x, y, width, height, - &::DrawRoundedRectHelper, - fcolor, penWidth, - bcolor, - fStippleColor, - true/*ellipse like*/); -} - -//--------------------------------------------------------------------- - - -static void DrawEllipseHelper (QPainter *p, - int x, int y, int width, int height) -{ - p->drawEllipse (x, y, width, height); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::drawEllipse (QImage *image, - int x, int y, int width, int height, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - const kpColor &fStippleColor) -{ - ::DrawGenericRect (image, - x, y, width, height, - &::DrawEllipseHelper, - fcolor, penWidth, - bcolor, - fStippleColor, - true/*ellipse like*/); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp b/kolourpaint/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp deleted file mode 100644 index 58dfe27e..00000000 --- a/kolourpaint/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp +++ /dev/null @@ -1,143 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PIXMAP_FX 0 - - -#include - -#include - -#include -#include -#include -#include - -#include - -#include - -//--------------------------------------------------------------------- - -// public static -QImage kpPixmapFX::getPixmapAt (const QImage &image, const QRect &rect) -{ - return image.copy(rect); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::setPixmapAt(QImage *destPtr, const QRect &destRect, - const QImage &src) -{ -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "kpPixmapFX::setPixmapAt(destPixmap->rect=" - << destPtr->rect () - << ",destRect=" - << destRect - << ",src.rect=" - << src.rect () - << ")" - << endl; -#endif - - Q_ASSERT (destPtr); - - // You cannot copy more than what you have. - Q_ASSERT (destRect.width () <= src.width () && - destRect.height () <= src.height ()); - - QPainter painter(destPtr); - // destination shall be source only - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.drawImage(destRect.topLeft(), src, QRect(0, 0, destRect.width(), destRect.height())); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::setPixmapAt (QImage *destPtr, const QPoint &destAt, - const QImage &src) -{ - kpPixmapFX::setPixmapAt (destPtr, - QRect (destAt.x (), destAt.y (), - src.width (), src.height ()), - src); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::setPixmapAt (QImage *destPtr, int destX, int destY, - const QImage &src) -{ - kpPixmapFX::setPixmapAt (destPtr, QPoint (destX, destY), src); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::paintPixmapAt (QImage *destPtr, const QPoint &destAt, - const QImage &src) -{ - // draw image with SourceOver composition mode - QPainter painter(destPtr); - painter.drawImage(destAt, src); -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::paintPixmapAt (QImage *destPtr, int destX, int destY, - const QImage &src) -{ - kpPixmapFX::paintPixmapAt(destPtr, QPoint (destX, destY), src); -} - -//--------------------------------------------------------------------- - -// public static -kpColor kpPixmapFX::getColorAtPixel (const QImage &img, const QPoint &at) -{ - if (!img.valid (at.x (), at.y ())) - return kpColor::Invalid; - - QRgb rgba = img.pixel(at); - return kpColor (rgba); -} - -//--------------------------------------------------------------------- - -// public static -kpColor kpPixmapFX::getColorAtPixel (const QImage &img, int x, int y) -{ - return kpPixmapFX::getColorAtPixel (img, QPoint (x, y)); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/pixmapfx/kpPixmapFX_Transforms.cpp b/kolourpaint/pixmapfx/kpPixmapFX_Transforms.cpp deleted file mode 100644 index 400f9f35..00000000 --- a/kolourpaint/pixmapfx/kpPixmapFX_Transforms.cpp +++ /dev/null @@ -1,674 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PIXMAP_FX 0 - - -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::resize (QImage *destPtr, int w, int h, - const kpColor &backgroundColor) -{ -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "kpPixmapFX::resize()"; -#endif - - if (!destPtr) - return; - - const int oldWidth = destPtr->width (); - const int oldHeight = destPtr->height (); - - if (w == oldWidth && h == oldHeight) - return; - - QImage newImage (w, h, QImage::Format_ARGB32_Premultiplied); - - // Would have new undefined areas? - if (w > oldWidth || h > oldHeight) - newImage.fill (backgroundColor.toQRgb ()); - - // Copy over old pixmap. - QPainter painter(&newImage); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.drawImage(0, 0, *destPtr); - painter.end(); - - // Replace pixmap with new one. - *destPtr = newImage; -} - -//--------------------------------------------------------------------- - -// public static -QImage kpPixmapFX::resize (const QImage &image, int w, int h, - const kpColor &backgroundColor) -{ - QImage ret = image; - kpPixmapFX::resize (&ret, w, h, backgroundColor); - return ret; -} - -//--------------------------------------------------------------------- - -// public static -void kpPixmapFX::scale (QImage *destPtr, int w, int h, bool pretty) -{ - if (!destPtr) - return; - - *destPtr = kpPixmapFX::scale (*destPtr, w, h, pretty); -} - -//--------------------------------------------------------------------- - -// public static -QImage kpPixmapFX::scale (const QImage &image, int w, int h, bool pretty) -{ -#if DEBUG_KP_PIXMAP_FX && 0 - kDebug () << "kpPixmapFX::scale(oldRect=" << image.rect () - << ",w=" << w - << ",h=" << h - << ",pretty=" << pretty - << ")" - << endl; -#endif - - if (w == image.width () && h == image.height ()) - return image; - - return image.scaled(w, h, Qt::IgnoreAspectRatio, - pretty ? Qt::SmoothTransformation : Qt::FastTransformation); -} - -//--------------------------------------------------------------------- - -// public static -const double kpPixmapFX::AngleInDegreesEpsilon = - KP_RADIANS_TO_DEGREES (atan (1.0 / 10000.0)) - / (2.0/*max error allowed*/ * 2.0/*for good measure*/); - - -static void MatrixDebug (const QString matrixName, const QMatrix &matrix, - int srcPixmapWidth = -1, int srcPixmapHeight = -1) -{ -#if DEBUG_KP_PIXMAP_FX - const int w = srcPixmapWidth, h = srcPixmapHeight; - - kDebug () << matrixName << "=" << matrix; - // Sometimes this precision lets us see unexpected rounding errors. - fprintf (stderr, "m11=%.24f m12=%.24f m21=%.24f m22=%.24f dx=%.24f dy=%.24f\n", - matrix.m11 (), matrix.m12 (), - matrix.m21 (), matrix.m22 (), - matrix.dx (), matrix.dy ()); - if (w > 0 && h > 0) - { - kDebug () << "(0,0) ->" << matrix.map (QPoint (0, 0)); - kDebug () << "(w-1,0) ->" << matrix.map (QPoint (w - 1, 0)); - kDebug () << "(0,h-1) ->" << matrix.map (QPoint (0, h - 1)); - kDebug () << "(w-1,h-1) ->" << matrix.map (QPoint (w - 1, h - 1)); - } - -#if 0 - QMatrix trueMatrix = QPixmap::trueMatrix (matrix, w, h); - kDebug () << matrixName << "trueMatrix=" << trueMatrix; - if (w > 0 && h > 0) - { - kDebug () << "(0,0) ->" << trueMatrix.map (QPoint (0, 0)); - kDebug () << "(w-1,0) ->" << trueMatrix.map (QPoint (w - 1, 0)); - kDebug () << "(0,h-1) ->" << trueMatrix.map (QPoint (0, h - 1)); - kDebug () << "(w-1,h-1) ->" << trueMatrix.map (QPoint (w - 1, h - 1)); - } -#endif - -#else - - Q_UNUSED (matrixName); - Q_UNUSED (matrix); - Q_UNUSED (srcPixmapWidth); - Q_UNUSED (srcPixmapHeight); - -#endif // DEBUG_KP_PIXMAP_FX -} - -//--------------------------------------------------------------------- - -// Theoretically, this should act the same as QPixmap::trueMatrix() but -// it doesn't. As an example, if you rotate tests/transforms.png by 90 -// degrees clockwise, this returns the correct of 26 but -// QPixmap::trueMatrix() returns 27. -// -// You should use the returned matrix to map points accurately (e.g. selection -// borders). For QPainter::drawPixmap()/drawImage() + setWorldMatrix() -// rendering accuracy, pass the returned matrix through QPixmap::trueMatrix() -// and use that. -// -// TODO: If you put the flipMatrix() of tests/transforms.png through this, -// the output is the same as QPixmap::trueMatrix(): is one off -// (dy=27 instead of 26). -// SYNC: I bet this is a Qt4 bug. -static QMatrix MatrixWithZeroOrigin (const QMatrix &matrix, int width, int height) -{ -#if DEBUG_KP_PIXMAP_FX - kDebug () << "matrixWithZeroOrigin(w=" << width << ",h=" << height << ")"; - kDebug () << "\tmatrix: m11=" << matrix.m11 () - << "m12=" << matrix.m12 () - << "m21=" << matrix.m21 () - << "m22=" << matrix.m22 () - << "dx=" << matrix.dx () - << "dy=" << matrix.dy (); -#endif - - QRect mappedRect = matrix.mapRect (QRect (0, 0, width, height)); -#if DEBUG_KP_PIXMAP_FX - kDebug () << "\tmappedRect=" << mappedRect; -#endif - - QMatrix translatedMatrix ( - matrix.m11 (), matrix.m12 (), - matrix.m21 (), matrix.m22 (), - matrix.dx () - mappedRect.left (), matrix.dy () - mappedRect.top ()); - -#if DEBUG_KP_PIXMAP_FX - kDebug () << "\treturning" << translatedMatrix; - kDebug () << "(0,0) ->" << translatedMatrix.map (QPoint (0, 0)); - kDebug () << "(w-1,0) ->" << translatedMatrix.map (QPoint (width - 1, 0)); - kDebug () << "(0,h-1) ->" << translatedMatrix.map (QPoint (0, height - 1)); - kDebug () << "(w-1,h-1) ->" << translatedMatrix.map (QPoint (width - 1, height - 1)); -#endif - - return translatedMatrix; -} - -//--------------------------------------------------------------------- - -static double TrueMatrixEpsilon = 0.000001; - -// An attempt to reverse tiny rounding errors introduced by QPixmap::trueMatrix() -// when skewing tests/transforms.png by 45% horizontally (with TransformPixmap() -// using a QPixmap painter, prior to the 2007-10-09 change -- did not test after -// the change). -// Unfortunately, this does not work enough to stop the rendering errors -// that follow. But it was worth a try and might still help us given the -// sometimes excessive aliasing QPainter::draw{Pixmap,Image}() gives us, when -// QPainter::SmoothPixmapTransform is disabled. -static double TrueMatrixFixInts (double x) -{ - if (fabs (x - qRound (x)) < TrueMatrixEpsilon) - return qRound (x); - else - return x; -} - -//--------------------------------------------------------------------- - -static QMatrix TrueMatrix (const QMatrix &matrix, int srcPixmapWidth, int srcPixmapHeight) -{ - ::MatrixDebug ("TrueMatrix(): org", matrix); - - const QMatrix truMat = QPixmap::trueMatrix (matrix, srcPixmapWidth, srcPixmapHeight); - ::MatrixDebug ("TrueMatrix(): passed through QPixmap::trueMatrix()", truMat); - - const QMatrix retMat ( - ::TrueMatrixFixInts (truMat.m11 ()), - ::TrueMatrixFixInts (truMat.m12 ()), - ::TrueMatrixFixInts (truMat.m21 ()), - ::TrueMatrixFixInts (truMat.m22 ()), - ::TrueMatrixFixInts (truMat.dx ()), - ::TrueMatrixFixInts (truMat.dy ())); - ::MatrixDebug ("TrueMatrix(): fixed ints", retMat); - - return retMat; -} - -//--------------------------------------------------------------------- - -// Like QPixmap::transformed() but fills new areas with -// (unless is invalid) and works around internal QMatrix -// floating point -> integer oddities, that would otherwise give fatally -// incorrect results. If you don't believe me on this latter point, compare -// QPixmap::transformed() to us using a flip matrix or a rotate-by-multiple-of-90 -// matrix on tests/transforms.png -- QPixmap::transformed()'s output is 1 -// pixel too high or low depending on whether the matrix is passed through -// QPixmap::trueMatrix(). -// -// Use and to specify the intended output size -// of the pixmap. -1 if don't care. -static QImage TransformPixmap (const QImage &pm, const QMatrix &transformMatrix_, - const kpColor &backgroundColor, - int targetWidth, int targetHeight) -{ - QMatrix transformMatrix = transformMatrix_; - -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "kppixmapfx.cpp: TransformPixmap(pm.size=" << pm.size () - << ",targetWidth=" << targetWidth - << ",targetHeight=" << targetHeight - << ")" - << endl; -#endif - - QRect newRect = transformMatrix.mapRect (pm.rect ()); -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "\tmappedRect=" << newRect; - -#endif - - QMatrix scaleMatrix; - if (targetWidth > 0 && targetWidth != newRect.width ()) - { - #if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "\tadjusting for targetWidth"; - #endif - scaleMatrix.scale (double (targetWidth) / double (newRect.width ()), 1); - } - - if (targetHeight > 0 && targetHeight != newRect.height ()) - { - #if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "\tadjusting for targetHeight"; - #endif - scaleMatrix.scale (1, double (targetHeight) / double (newRect.height ())); - } - - if (!scaleMatrix.isIdentity ()) - { - #if DEBUG_KP_PIXMAP_FX && 1 - // TODO: What is going on here??? Why isn't matrix * working properly? - QMatrix wrongMatrix = transformMatrix * scaleMatrix; - QMatrix oldHat = transformMatrix; - if (targetWidth > 0 && targetWidth != newRect.width ()) - oldHat.scale (double (targetWidth) / double (newRect.width ()), 1); - if (targetHeight > 0 && targetHeight != newRect.height ()) - oldHat.scale (1, double (targetHeight) / double (newRect.height ())); - QMatrix altHat = transformMatrix; - altHat.scale ((targetWidth > 0 && targetWidth != newRect.width ()) ? double (targetWidth) / double (newRect.width ()) : 1, - (targetHeight > 0 && targetHeight != newRect.height ()) ? double (targetHeight) / double (newRect.height ()) : 1); - QMatrix correctMatrix = scaleMatrix * transformMatrix; - - kDebug () << "\tsupposedlyWrongMatrix: m11=" << wrongMatrix.m11 () // <<<---- this is the correct matrix??? - << " m12=" << wrongMatrix.m12 () - << " m21=" << wrongMatrix.m21 () - << " m22=" << wrongMatrix.m22 () - << " dx=" << wrongMatrix.dx () - << " dy=" << wrongMatrix.dy () - << " rect=" << wrongMatrix.mapRect (pm.rect ()) - << endl - << "\ti_used_to_use_thisMatrix: m11=" << oldHat.m11 () - << " m12=" << oldHat.m12 () - << " m21=" << oldHat.m21 () - << " m22=" << oldHat.m22 () - << " dx=" << oldHat.dx () - << " dy=" << oldHat.dy () - << " rect=" << oldHat.mapRect (pm.rect ()) - << endl - << "\tabove but scaled at the same time: m11=" << altHat.m11 () - << " m12=" << altHat.m12 () - << " m21=" << altHat.m21 () - << " m22=" << altHat.m22 () - << " dx=" << altHat.dx () - << " dy=" << altHat.dy () - << " rect=" << altHat.mapRect (pm.rect ()) - << endl - << "\tsupposedlyCorrectMatrix: m11=" << correctMatrix.m11 () - << " m12=" << correctMatrix.m12 () - << " m21=" << correctMatrix.m21 () - << " m22=" << correctMatrix.m22 () - << " dx=" << correctMatrix.dx () - << " dy=" << correctMatrix.dy () - << " rect=" << correctMatrix.mapRect (pm.rect ()) - << endl; - #endif - - transformMatrix = transformMatrix * scaleMatrix; - - newRect = transformMatrix.mapRect (pm.rect ()); - #if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "\tnewRect after targetWidth,targetHeight adjust=" << newRect; - #endif - } - - - ::MatrixDebug ("TransformPixmap(): before trueMatrix", transformMatrix, - pm.width (), pm.height ()); -#if DEBUG_KP_PIXMAP_FX && 1 - QMatrix oldMatrix = transformMatrix; -#endif - - // Translate the matrix to account for Qt rounding errors, - // so that flipping (if it used this method) and rotating by a multiple - // of 90 degrees actually work as expected (try tests/transforms.png). - // - // SYNC: This was not required with Qt3 so we are actually working - // around a Qt4 bug/feature. - // - // COMPAT: Qt4's rendering with a matrix enabled is low quality anyway - // but does this reduce quality even further? - // - // With or without it, skews by 45 degrees with the QImage - // painter below look bad (with it, you get an extra transparent - // line on the right; without, you get only about 1/4 of a source - // line on the left). In Qt3, with TrueMatrix(), the source - // image is translated 1 pixel off the destination image. - // - // Also, if you skew a rectangular selection, the skewed selection - // border does not line up with the skewed image data. - // TODO: do we need to pass through this new matrix? - transformMatrix = ::TrueMatrix (transformMatrix, - pm.width (), pm.height ()); - -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "trueMatrix changed matrix?" << (oldMatrix == transformMatrix); -#endif - ::MatrixDebug ("TransformPixmap(): after trueMatrix", transformMatrix, - pm.width (), pm.height ()); - - - QImage newQImage (targetWidth > 0 ? targetWidth : newRect.width (), - targetHeight > 0 ? targetHeight : newRect.height (), - QImage::Format_ARGB32_Premultiplied); - - if ((targetWidth > 0 && targetWidth != newRect.width ()) || - (targetHeight > 0 && targetHeight != newRect.height ())) - { - #if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "kppixmapfx.cpp: TransformPixmap(pm.size=" << pm.size () - << ",targetWidth=" << targetWidth - << ",targetHeight=" << targetHeight - << ") newRect=" << newRect - << " (you are a victim of rounding error)" - << endl; - #endif - } - - -#if DEBUG_KP_PIXMAP_FX && 0 - kDebug () << "\ttranslate top=" << painter.xForm (QPoint (0, 0)); - kDebug () << "\tmatrix: m11=" << painter.worldMatrix ().m11 () - << " m12=" << painter.worldMatrix ().m12 () - << " m21=" << painter.worldMatrix ().m21 () - << " m22=" << painter.worldMatrix ().m22 () - << " dx=" << painter.worldMatrix ().dx () - << " dy=" << painter.worldMatrix ().dy () - << endl; -#endif - - - // Note: Do _not_ use "p.setRenderHints (QPainter::SmoothPixmapTransform);" - // as the user does not want their image to get blurier every - // time they e.g. rotate it (especially important for multiples - // of 90 degrees but also true for every other angle). Being a - // pixel-based program, we generally like to preserve RGB values - // and avoid unnecessary blurs -- in the worst case, we'd rather - // drop pixels, than blur. - QPainter p (&newQImage); - { - // Make sure transparent pixels are drawn into the destination image. - p.setCompositionMode (QPainter::CompositionMode_Source); - - // Fill the entire new image with the background color. - if (backgroundColor.isValid ()) - { - p.fillRect (newQImage.rect (), backgroundColor.toQColor ()); - } - - p.setMatrix (transformMatrix); - p.drawImage (QPoint (0, 0), pm); - } - p.end (); - -#if DEBUG_KP_PIXMAP_FX && 1 - kDebug () << "Done" << endl << endl; -#endif - - return newQImage; -} - -//--------------------------------------------------------------------- - -// public static -QMatrix kpPixmapFX::skewMatrix (int width, int height, double hangle, double vangle) -{ - if (fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon) - { - return QMatrix (); - } - - - /* Diagram for completeness :) - * - * |---------- w ----------| - * (0,0) - * _ _______________________ (w,0) - * | |\~_ va | - * | | \ ~_ | - * | |ha\ ~__ | - * | \ ~__ | dy - * h | \ ~___ | - * | \ ~___ | - * | | \ ~___| (w,w*tan(va)=dy) - * | | \ * \ - * _ |________\________|_____|\ vertical shear factor - * (0,h) dx ^~_ | \ | - * | ~_ \________\________ General Point (x,y) V - * | ~__ \ Skewed Point (x + y*tan(ha),y + x*tan(va)) - * (h*tan(ha)=dx,h) ~__ \ ^ - * ~___ \ | - * ~___ \ horizontal shear factor - * Key: ~___\ - * ha = hangle (w + h*tan(ha)=w+dx,h + w*tan(va)=w+dy) - * va = vangle - * - * Skewing really just twists a rectangle into a parallelogram. - * - */ - - //QMatrix matrix (1, tan (KP_DEGREES_TO_RADIANS (vangle)), tan (KP_DEGREES_TO_RADIANS (hangle)), 1, 0, 0); - // I think this is clearer than above :) - QMatrix matrix; - matrix.shear (tan (KP_DEGREES_TO_RADIANS (hangle)), - tan (KP_DEGREES_TO_RADIANS (vangle))); - - return ::MatrixWithZeroOrigin (matrix, width, height); -} - -//--------------------------------------------------------------------- - -// public static -QMatrix kpPixmapFX::skewMatrix (const QImage &pixmap, double hangle, double vangle) -{ - return kpPixmapFX::skewMatrix (pixmap.width (), pixmap.height (), hangle, vangle); -} - -//--------------------------------------------------------------------- - - -// public static -void kpPixmapFX::skew (QImage *destPtr, double hangle, double vangle, - const kpColor &backgroundColor, - int targetWidth, int targetHeight) -{ - if (!destPtr) - return; - - *destPtr = kpPixmapFX::skew (*destPtr, hangle, vangle, - backgroundColor, - targetWidth, targetHeight); -} - -//--------------------------------------------------------------------- - -// public static -QImage kpPixmapFX::skew (const QImage &pm, double hangle, double vangle, - const kpColor &backgroundColor, - int targetWidth, int targetHeight) -{ -#if DEBUG_KP_PIXMAP_FX - kDebug () << "kpPixmapFX::skew() pm.width=" << pm.width () - << " pm.height=" << pm.height () - << " hangle=" << hangle - << " vangle=" << vangle - << " targetWidth=" << targetWidth - << " targetHeight=" << targetHeight - << endl; -#endif - - if (fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - (targetWidth <= 0 && targetHeight <= 0)/*don't want to scale?*/) - { - return pm; - } - - if (fabs (hangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon || - fabs (vangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon) - { - kError () << "kpPixmapFX::skew() passed hangle and/or vangle out of range (-90 < x < 90)" << endl; - return pm; - } - - - QMatrix matrix = skewMatrix (pm, hangle, vangle); - - return ::TransformPixmap (pm, matrix, backgroundColor, targetWidth, targetHeight); -} - -//--------------------------------------------------------------------- - - -// public static -QMatrix kpPixmapFX::rotateMatrix (int width, int height, double angle) -{ - if (fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon) - { - return QMatrix (); - } - - QMatrix matrix; - matrix.translate (width / 2, height / 2); - matrix.rotate (angle); - - return ::MatrixWithZeroOrigin (matrix, width, height); -} - -//--------------------------------------------------------------------- - -// public static -QMatrix kpPixmapFX::rotateMatrix (const QImage &pixmap, double angle) -{ - return kpPixmapFX::rotateMatrix (pixmap.width (), pixmap.height (), angle); -} - -//--------------------------------------------------------------------- - - -// public static -bool kpPixmapFX::isLosslessRotation (double angle) -{ - const double angleIn = angle; - - // Reflect angle into positive if negative - if (angle < 0) - angle = -angle; - - // Remove multiples of 90 to make sure 0 <= angle <= 90 - angle -= ((int) angle) / 90 * 90; - - // "Impossible" situation? - if (angle < 0 || angle > 90) - { - kError () << "kpPixmapFX::isLosslessRotation(" << angleIn - << ") result=" << angle - << endl; - return false; // better safe than sorry - } - - const bool ret = (angle < kpPixmapFX::AngleInDegreesEpsilon || - 90 - angle < kpPixmapFX::AngleInDegreesEpsilon); -#if DEBUG_KP_PIXMAP_FX - kDebug () << "kpPixmapFX::isLosslessRotation(" << angleIn << ")" - << " residual angle=" << angle - << " returning " << ret - << endl; -#endif - return ret; -} - -//--------------------------------------------------------------------- - - -// public static -void kpPixmapFX::rotate (QImage *destPtr, double angle, - const kpColor &backgroundColor, - int targetWidth, int targetHeight) -{ - if (!destPtr) - return; - - *destPtr = kpPixmapFX::rotate (*destPtr, angle, - backgroundColor, - targetWidth, targetHeight); -} - -//--------------------------------------------------------------------- - -// public static -QImage kpPixmapFX::rotate (const QImage &pm, double angle, - const kpColor &backgroundColor, - int targetWidth, int targetHeight) -{ - if (fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - (targetWidth <= 0 && targetHeight <= 0)/*don't want to scale?*/) - { - return pm; - } - - - QMatrix matrix = rotateMatrix (pm, angle); - - return ::TransformPixmap (pm, matrix, backgroundColor, targetWidth, targetHeight); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/stamp b/kolourpaint/stamp deleted file mode 100644 index 0b48b482..00000000 --- a/kolourpaint/stamp +++ /dev/null @@ -1,4 +0,0 @@ -Commit this file to make an arbitrary comment in SVN history. - -Increase this number to give you something to commit: 2 - diff --git a/kolourpaint/tests/45deg_line.png b/kolourpaint/tests/45deg_line.png deleted file mode 100644 index cab600cbdaa38aefe5f2f372fd1e51910ac1e9b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 94 zcmeAS@N?(olHy`uVBq!ia0vp^96-#@$P6U;r_YlGQfvV}A+G-!82Ko3tNOMs@R`hP`I=*$^7NTlG{Uko6j){_0?*mC;k z?4Z#~Z6t3@2OE5Z@5NFVw-S*xrc+a}`R0{SatjyJul kFPI$#e8}a_&xUOK=D7Un#QjKN4m-jA=!5@{G@DLc0k1A!DzfKP}kLo)+IHv_|eAYgct z_BD-xftkzG#WAGf*4x{LeYXunS|0X#g*ST1J5Ilmw$RD_qN*5E1%s?3TSUO+CmcKd zSFw0ZRoXrEV1??Z+yxg`KYJfzD7FTB5j_{f7OI^s%eM<@m3+<0IiQcQ6i6Le$f!iP~+|LHJQwKRO#%K zuB6U1qmZ@>K2}o}&+O3^^A^iNEZ-CMXIfs;-RLSHPNT)iqcGz6{dwgY*)Hu zCTnM@_MHrnKVdFD`|@Qk~Cvk&OVnq?+V)iVYmW>YJK5)!2ny_$MDdtWr5+jhxyCkQR_A|Kt~mn<{1irLKacRQM;WfTQi^ z60w6v`Vx}b{mYd1tTyj%DgT;gT>Jlt{?kZ{@`Ky*^X<3YpQNnzH@)qM@Hff*`~NQ7 z^ZwLLXQssW*QK0p_M5kT`2P5_z(2{(w*sFc7kQ_i=q=s1TA%0PJm0rm&MVS)v>y_9 z72BRxe!^?t>kZ~A8{f|_xvgmb^1FZA+X?soSUcWU-0!zv_{*nR;fMAupIX0mUZ>j5 zj~~zfnVKT^zxrM>g)z4*}Q$iB}rvhyI diff --git a/kolourpaint/tests/freeform-selection.png b/kolourpaint/tests/freeform-selection.png deleted file mode 100644 index 73133e2bb82b2c93d2b173ee179f4cca0e83ce9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^20*ON!VDyL|GzdJNC^e_gt#&^G%);UXaG_m{Qp10 z|BUUv4nWy*PZ!6Kid%0d9OP^;;Bhr>x{%hG6R?z-AXj| z+qJ!a1x_c-*?jN!)EDgX3g3>kmz_M#U-yCQ&6SD?cYnN`-v)F7gQu&X%Q~loCIHBw BQa=Cy diff --git a/kolourpaint/tests/kolourcircles.png b/kolourpaint/tests/kolourcircles.png deleted file mode 100644 index 9f544453d598cada3d4108f2c78f42d9cac9b631..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4889 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 NEX__*N=bjm{uhr&t(yP< diff --git a/kolourpaint/tests/paste_in_new_window.png b/kolourpaint/tests/paste_in_new_window.png deleted file mode 100644 index 7405071d8c54a96662ffeaba0f30c6aa5cfd54ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 227 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58JL)Xl%kBoS0Ke1;1l8sq=Df7|NqT*&tC$v z7)yfuf*Bm1-ADs+Iy_w*Ln>~)y}6OMK|!D`a9RTA_l1e}vu9uOsGS-$;qzbKjg_J& zr+Y|$f3~x);seNv2K~m0olFhYKqkYfB|ac3KrNN&k7&k8D~1im0xyjobmXuydgasU7T diff --git a/kolourpaint/tests/selections.txt b/kolourpaint/tests/selections.txt deleted file mode 100644 index 4b700073..00000000 --- a/kolourpaint/tests/selections.txt +++ /dev/null @@ -1,12 +0,0 @@ -An obscure testcase with the selection tool is: - -1. RMB-drag to create a selection and popup a menu. -2. LMB-drag outside of the menu, to close it. -3. While still holding down the LMB, hold down the RMB and continue - moving the mouse. -4. Let go of the LMB and continue moving the mouse. - -etc. - -KolourPaint should not crash or anything like that. - diff --git a/kolourpaint/tests/small16x16.png b/kolourpaint/tests/small16x16.png deleted file mode 100644 index 7eb1bc2fa09de2b7abb0a07aed946a4c78aa24ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 120 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9>wgA@|Ns9x%9;oQMRYw~ z978x{Sq~aAGAM8`9L#qT`R(sw!1PYzy=<4!LGN7|JB=DUTU%Z8&N*G=U+E$fTyQcK QsE>ic)78&qol`;+05w7&K>z>% diff --git a/kolourpaint/tests/tool_fill_xlimit.png b/kolourpaint/tests/tool_fill_xlimit.png deleted file mode 100644 index 97eb0e11c9c3c8d395effe02efb20b5e6ad170e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#=`Bp4pvH+~MJ>^xl@Ln>|^z2L~jpupjBvHZXH zbuG4K3qqebef%7F(c)Mt5P~- Rj#z_C^mO%eS?83{1OQ0%DCz(J diff --git a/kolourpaint/tests/transforms-rotate-me-90-clockwise.png b/kolourpaint/tests/transforms-rotate-me-90-clockwise.png deleted file mode 100644 index e18ee59e55a2de56d791ac10cdb6dbad6156ceff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^(m<@i!VDz;ip)s`Qi=gSA+A80fuVtc;Xe>IFf=qc z05OR3A4r0z|4YxTISy39SQ6wH%;50sMjDV4=IP=XqH#WX#R~@}VF@oMK?R-@v8@cJ z+r-K@ZWJ}Te&dEj=WdA;Tcv7ZnAy@&^q85Mg~}NxoNk?*-7r17Cu@q~1*Iz&9JsX? l9f}lSJfdbGqN&)($)LukuCvSKeJjug22WQ%mvv4FO#pGXK%W2r diff --git a/kolourpaint/tests/transforms.png b/kolourpaint/tests/transforms.png deleted file mode 100644 index 9c6ea1fce9006442e2424077956a3654cc223d45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<~!VDz;*jIFf=qc z05OR3A4r0z|4YxTISy39SQ6wH%;50sMjDXg>*?YcqH#W1<2aKt9X@VY_ZIf5XD`aI#C^RRk bi7_xd-5_G$&N49xXfT7PtDnm{r-UW|XL>pP diff --git a/kolourpaint/tests/transparent.png b/kolourpaint/tests/transparent.png deleted file mode 100644 index 699536654869f12098fa2759ead39427317f768f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_>3?$zOPHh5GLIFM@uK)l4XJGgbh9CmSldaxf z50qsr3GxeOaCmkj4ahO{ba4!^IGrqzbbv2JQl#L7fng6*R|7YX#e&lo2?lPdZEZa7 lEM!@kxeBHy`B|h)VSMkwx6*CKWgDPo22WQ%mvv4FO#mqdEiM26 diff --git a/kolourpaint/tests/transparent_selection.png b/kolourpaint/tests/transparent_selection.png deleted file mode 100644 index d779ee29968a184faaf403cb154fa4fcd65062bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^tw6k!i5W;%^N3UeDb4_&5Lbr(Ao%}3!=}*g7NB6g zr;B4q#jUqjb_+Hrh`0pK-eAJ1(O9R^*s%5z|18Vw0~QvK_kKK?aNotnWKZQzPNqf& zh5HJZggt}4s$^(K3zY}ycv`QV_Tt3E3m#@FWzopr0O)v3 AX#fBK diff --git a/kolourpaint/tools/flow/kpToolBrush.cpp b/kolourpaint/tools/flow/kpToolBrush.cpp deleted file mode 100644 index ac6458ea..00000000 --- a/kolourpaint/tools/flow/kpToolBrush.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -#include - -//--------------------------------------------------------------------- - -kpToolBrush::kpToolBrush (kpToolEnvironment *environ, QObject *parent) - : kpToolFlowPixmapBase (i18n ("Brush"), - i18n ("Draw using brushes of different shapes and sizes"), - Qt::Key_B, - environ, parent, "tool_brush") -{ -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpToolFlowBase] -QString kpToolBrush::haventBegunDrawUserMessage () const -{ - return i18n ("Click to draw dots or drag to draw strokes."); -} - -//--------------------------------------------------------------------- - -// See the our corresponding .h for brush selection. - -// Logic is in kpToolFlowPixmapBase. - - -#include "moc_kpToolBrush.cpp" diff --git a/kolourpaint/tools/flow/kpToolBrush.h b/kolourpaint/tools/flow/kpToolBrush.h deleted file mode 100644 index eedfbc81..00000000 --- a/kolourpaint/tools/flow/kpToolBrush.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_BRUSH_H -#define KP_TOOL_BRUSH_H - - -#include - - -// Brush = draws pixmaps, "interpolates" by "sweeping" pixmaps along a line (interesting brushes) -class kpToolBrush : public kpToolFlowPixmapBase -{ -Q_OBJECT - -public: - kpToolBrush (kpToolEnvironment *environ, QObject *parent); - -protected: - virtual QString haventBegunDrawUserMessage () const; - virtual bool haveDiverseBrushes () const { return true; } -}; - - -#endif // KP_TOOL_BRUSH_H diff --git a/kolourpaint/tools/flow/kpToolColorEraser.cpp b/kolourpaint/tools/flow/kpToolColorEraser.cpp deleted file mode 100644 index 68682051..00000000 --- a/kolourpaint/tools/flow/kpToolColorEraser.cpp +++ /dev/null @@ -1,163 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_COLOR_ERASER 0 - - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -kpToolColorEraser::kpToolColorEraser (kpToolEnvironment *environ, QObject *parent) - : kpToolFlowBase (i18n ("Color Eraser"), - i18n ("Replaces pixels of the foreground color with the background color"), - Qt::Key_O, - environ, parent, - "tool_color_eraser") -{ -} - -kpToolColorEraser::~kpToolColorEraser () -{ -} - - -// public virtual [base kpTool] -void kpToolColorEraser::globalDraw () -{ -#if DEBUG_KP_TOOL_COLOR_ERASER - kDebug () << "kpToolColorEraser::globalDraw()"; -#endif - if (!drawShouldProceed (QPoint ()/*unused*/, QPoint ()/*unused*/, QRect ()/*unused*/)) - return; - - QApplication::setOverrideCursor (Qt::WaitCursor); - - environ ()->flashColorSimilarityToolBarItem (); - - kpToolFlowCommand *cmd = new kpToolFlowCommand ( - i18n ("Color Eraser"), environ ()->commandEnvironment ()); - - const QRect dirtyRect = kpPainter::washRect (document ()->imagePointer (), - 0, 0, document ()->width (), document ()->height (), - backgroundColor ()/*color to draw in*/, - foregroundColor ()/*color to replace*/, - processedColorSimilarity ()); - - if (!dirtyRect.isEmpty ()) - { - document ()->slotContentsChanged (dirtyRect); - - - cmd->updateBoundingRect (dirtyRect); - cmd->finalize (); - - commandHistory ()->addCommand (cmd, false /* don't exec */); - - // don't delete - it's up to the commandHistory - cmd = 0; - } - else - { - #if DEBUG_KP_TOOL_COLOR_ERASER - kDebug () << "\tisNOP"; - #endif - delete cmd; - cmd = 0; - } - - QApplication::restoreOverrideCursor (); -} - -QString kpToolColorEraser::haventBegunDrawUserMessage () const -{ - return i18n ("Click or drag to erase pixels of the foreground color."); -} - - -bool kpToolColorEraser::drawShouldProceed (const QPoint & /*thisPoint*/, - const QPoint & /*lastPoint*/, - const QRect & /*normalizedRect*/) -{ - if (foregroundColor () == backgroundColor () && - processedColorSimilarity () == 0) - { - return false; - } - - return true; -} - - -QRect kpToolColorEraser::drawLine (const QPoint &thisPoint, const QPoint &lastPoint) -{ -#if DEBUG_KP_TOOL_COLOR_ERASER - kDebug () << "kpToolColorEraser::drawLine(thisPoint=" << thisPoint - << ",lastPoint=" << lastPoint << ")" << endl; -#endif - - environ ()->flashColorSimilarityToolBarItem (); - - const QRect dirtyRect = kpPainter::washLine (document ()->imagePointer (), - lastPoint.x (), lastPoint.y (), - thisPoint.x (), thisPoint.y (), - color (mouseButton ())/*color to draw in*/, - brushWidth (), brushHeight (), - color (1 - mouseButton ())/*color to replace*/, - processedColorSimilarity ()); - -#if DEBUG_KP_TOOL_COLOR_ERASER - kDebug () << "\tdirtyRect=" << dirtyRect; -#endif - - if (!dirtyRect.isEmpty ()) - { - document ()->slotContentsChanged (dirtyRect); - return dirtyRect; - } - - return QRect (); -} - -#include "moc_kpToolColorEraser.cpp" diff --git a/kolourpaint/tools/flow/kpToolColorEraser.h b/kolourpaint/tools/flow/kpToolColorEraser.h deleted file mode 100644 index f44eaf29..00000000 --- a/kolourpaint/tools/flow/kpToolColorEraser.h +++ /dev/null @@ -1,65 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_COLOR_ERASER_H -#define KP_TOOL_COLOR_ERASER_H - - -#include - - -// Color Eraser = Brush that replaces/washes the foreground color with the background color -class kpToolColorEraser : public kpToolFlowBase -{ -Q_OBJECT - -public: - kpToolColorEraser (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolColorEraser (); - - -public: - virtual void globalDraw (); - - -protected: - virtual QString haventBegunDrawUserMessage () const; - - virtual bool drawShouldProceed (const QPoint &thisPoint, - const QPoint &lastPoint, - const QRect &normalizedRect); - - virtual bool haveSquareBrushes () const { return true; } - virtual bool colorsAreSwapped () const { return true; } - - - virtual QRect drawLine (const QPoint &thisPoint, const QPoint &lastPoint); -}; - - -#endif // KP_TOOL_COLOR_ERASER_H diff --git a/kolourpaint/tools/flow/kpToolEraser.cpp b/kolourpaint/tools/flow/kpToolEraser.cpp deleted file mode 100644 index 3cfed3d1..00000000 --- a/kolourpaint/tools/flow/kpToolEraser.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_ERASER 0 - -#include - -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolEraser::kpToolEraser (kpToolEnvironment *environ, QObject *parent) - : kpToolFlowPixmapBase (i18n ("Eraser"), - i18n ("Lets you rub out mistakes"), - Qt::Key_A, - environ, parent, "tool_eraser") -{ -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolEraser::globalDraw () -{ -#if DEBUG_KP_TOOL_ERASER - kDebug () << "kpToolEraser::globalDraw()"; -#endif - - commandHistory ()->addCommand ( - new kpEffectClearCommand ( - false/*act on doc, not sel*/, - backgroundColor (), - environ ()->commandEnvironment ())); -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpToolFlowBase] -QString kpToolEraser::haventBegunDrawUserMessage () const -{ - return i18n ("Click or drag to erase."); -} - -//--------------------------------------------------------------------- - -// See the our corresponding .h for brush selection. - -// Logic is in kpToolFlowPixmapBase. - - -#include "moc_kpToolEraser.cpp" diff --git a/kolourpaint/tools/flow/kpToolEraser.h b/kolourpaint/tools/flow/kpToolEraser.h deleted file mode 100644 index 5f187921..00000000 --- a/kolourpaint/tools/flow/kpToolEraser.h +++ /dev/null @@ -1,55 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ERASER_H -#define KP_TOOL_ERASER_H - - -#include - - -// Eraser = Brush but with foreground & background colors swapped (a few square brushes) -class kpToolEraser : public kpToolFlowPixmapBase -{ -Q_OBJECT - -public: - kpToolEraser (kpToolEnvironment *environ, QObject *parent); - - virtual void globalDraw (); - - -protected: - virtual QString haventBegunDrawUserMessage () const; - - virtual bool haveSquareBrushes () const { return true; } - virtual bool colorsAreSwapped () const { return true; } -}; - - -#endif // KP_TOOL_ERASER_H diff --git a/kolourpaint/tools/flow/kpToolFlowBase.cpp b/kolourpaint/tools/flow/kpToolFlowBase.cpp deleted file mode 100644 index a0a1e8b6..00000000 --- a/kolourpaint/tools/flow/kpToolFlowBase.cpp +++ /dev/null @@ -1,492 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_FLOW_BASE 0 - -#include - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -struct kpToolFlowBasePrivate -{ - kpToolWidgetBrush *toolWidgetBrush; - kpToolWidgetEraserSize *toolWidgetEraserSize; - - - // - // Cursor and Brush Data - // (must be zero if unused) - // - - kpTempImage::UserFunctionType brushDrawFunc, cursorDrawFunc; - - // Can't use union since package types contain fields requiring - // constructors. - kpToolWidgetBrush::DrawPackage brushDrawPackageForMouseButton [2]; - kpToolWidgetEraserSize::DrawPackage eraserDrawPackageForMouseButton [2]; - - // Each element points to one of the above (both elements from the same - // array). - void *drawPackageForMouseButton [2]; - - int brushWidth, brushHeight; - int cursorWidth, cursorHeight; - - bool brushIsDiagonalLine; - - - kpToolFlowCommand *currentCommand; -}; - -//--------------------------------------------------------------------- - -kpToolFlowBase::kpToolFlowBase (const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, QObject *parent, const QString &name) - - : kpTool (text, description, key, environ, parent, name), - d (new kpToolFlowBasePrivate ()) -{ - d->toolWidgetBrush = 0; - d->toolWidgetEraserSize = 0; - - clearBrushCursorData (); - - d->currentCommand = 0; -} - -//--------------------------------------------------------------------- - -kpToolFlowBase::~kpToolFlowBase () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// private -void kpToolFlowBase::clearBrushCursorData () -{ - d->brushDrawFunc = d->cursorDrawFunc = 0; - - memset (&d->brushDrawPackageForMouseButton, - 0, - sizeof (d->brushDrawPackageForMouseButton)); - memset (&d->eraserDrawPackageForMouseButton, - 0, - sizeof (d->eraserDrawPackageForMouseButton)); - - memset (&d->drawPackageForMouseButton, - 0, - sizeof (d->drawPackageForMouseButton)); - - d->brushWidth = d->brushHeight = 0; - d->cursorWidth = d->cursorHeight = 0; - - d->brushIsDiagonalLine = false; -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::begin () -{ - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - - // TODO: Bad smell. Mutually exclusive. Use inheritance. - if (haveSquareBrushes ()) - { - d->toolWidgetEraserSize = tb->toolWidgetEraserSize (); - connect (d->toolWidgetEraserSize, SIGNAL (eraserSizeChanged (int)), - this, SLOT (updateBrushAndCursor ())); - d->toolWidgetEraserSize->show (); - - updateBrushAndCursor (); - - viewManager ()->setCursor (kpCursorProvider::lightCross ()); - } - else if (haveDiverseBrushes ()) - { - d->toolWidgetBrush = tb->toolWidgetBrush (); - connect (d->toolWidgetBrush, SIGNAL (brushChanged ()), - this, SLOT (updateBrushAndCursor ())); - d->toolWidgetBrush->show (); - - updateBrushAndCursor (); - - viewManager ()->setCursor (kpCursorProvider::lightCross ()); - } - - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::end () -{ - if (d->toolWidgetEraserSize) - { - disconnect (d->toolWidgetEraserSize, SIGNAL (eraserSizeChanged (int)), - this, SLOT (updateBrushAndCursor ())); - d->toolWidgetEraserSize = 0; - } - else if (d->toolWidgetBrush) - { - disconnect (d->toolWidgetBrush, SIGNAL (brushChanged ()), - this, SLOT (updateBrushAndCursor ())); - d->toolWidgetBrush = 0; - } - - kpViewManager *vm = viewManager (); - Q_ASSERT (vm); - - if (vm->tempImage () && vm->tempImage ()->isBrush ()) - vm->invalidateTempImage (); - - if (haveAnyBrushes ()) - vm->unsetCursor (); - - clearBrushCursorData (); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::beginDraw () -{ - d->currentCommand = new kpToolFlowCommand (text (), environ ()->commandEnvironment ()); - - // We normally show the brush cursor in the foreground colour but if the - // user starts drawing in the background color, we don't want to leave - // the brush cursor in the foreground colour -- just hide it in all cases - // to avoid confusion. - viewManager ()->invalidateTempImage (); - - setUserMessage (cancelUserMessage ()); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::hover (const QPoint &point) -{ -#if DEBUG_KP_TOOL_FLOW_BASE && 0 - kDebug () << "kpToolFlowBase::hover(" << point << ")" - << " hasBegun=" << hasBegun () - << " hasBegunDraw=" << hasBegunDraw () - << " cursorPixmap.isNull=" << m_cursorPixmap.isNull () - << endl; -#endif - if (point != KP_INVALID_POINT && d->cursorDrawFunc) - { - viewManager ()->setFastUpdates (); - - viewManager ()->setTempImage ( - kpTempImage (true/*brush*/, - hotRect ().topLeft (), - d->cursorDrawFunc, d->drawPackageForMouseButton [0/*left button*/], - d->cursorWidth, d->cursorHeight)); - - viewManager ()->restoreFastUpdates (); - } - - setUserShapePoints (point); -} - -//--------------------------------------------------------------------- - -// virtual -QRect kpToolFlowBase::drawPoint (const QPoint &point) -{ - return drawLine (point, point); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::draw (const QPoint &thisPoint, const QPoint &lastPoint, const QRect &normalizedRect) -{ - if (!/*virtual*/drawShouldProceed (thisPoint, lastPoint, normalizedRect)) - return; - - // sync: remember to restoreFastUpdates() in all exit paths - viewManager ()->setFastUpdates (); - - QRect dirtyRect; - - // TODO: I'm beginning to wonder this drawPoint() "optimization" actually - // optimises. Is it worth the complexity? Hence drawPoint() impl above. - if (d->brushIsDiagonalLine ? - currentPointCardinallyNextToLast () : - currentPointNextToLast ()) - { - dirtyRect = drawPoint (thisPoint); - } - // in reality, the system is too slow to give us all the MouseMove events - // so we "interpolate" the missing points :) - else - { - dirtyRect = drawLine (thisPoint, lastPoint); - } - - d->currentCommand->updateBoundingRect (dirtyRect); - - viewManager ()->restoreFastUpdates (); - setUserShapePoints (thisPoint); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::cancelShape () -{ - d->currentCommand->finalize (); - d->currentCommand->cancel (); - - delete d->currentCommand; - d->currentCommand = 0; - - updateBrushAndCursor (); - - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -//--------------------------------------------------------------------- - -void kpToolFlowBase::releasedAllButtons () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolFlowBase::endDraw (const QPoint &, const QRect &) -{ - d->currentCommand->finalize (); - environ ()->commandHistory ()->addCommand (d->currentCommand, - false/*don't exec*/); - - // don't delete - it's up to the commandHistory - d->currentCommand = 0; - - updateBrushAndCursor (); - - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// TODO: maybe the base should be virtual? -kpColor kpToolFlowBase::color (int which) -{ -#if DEBUG_KP_TOOL_FLOW_BASE && 0 - kDebug () << "kpToolFlowBase::color (" << which << ")"; -#endif - - // Pen & Brush - if (!colorsAreSwapped ()) - return kpTool::color (which); - // only the (Color) Eraser uses the opposite color - else - return kpTool::color (which ? 0 : 1); // don't trust !0 == 1 -} - -//--------------------------------------------------------------------- - -// protected -kpTempImage::UserFunctionType kpToolFlowBase::brushDrawFunction () const -{ - return d->brushDrawFunc; -} - -//--------------------------------------------------------------------- - -// protected -void *kpToolFlowBase::brushDrawFunctionData () const -{ - return d->drawPackageForMouseButton [mouseButton ()]; -} - - -// protected -int kpToolFlowBase::brushWidth () const -{ - return d->brushWidth; -} - -// protected -int kpToolFlowBase::brushHeight () const -{ - return d->brushHeight; -} - -// protected -bool kpToolFlowBase::brushIsDiagonalLine () const -{ - return d->brushIsDiagonalLine; -} - - -// protected -kpToolFlowCommand *kpToolFlowBase::currentCommand () const -{ - return d->currentCommand; -} - -//--------------------------------------------------------------------- - -// protected slot -void kpToolFlowBase::updateBrushAndCursor () -{ -#if DEBUG_KP_TOOL_FLOW_BASE && 1 - kDebug () << "kpToolFlowBase::updateBrushAndCursor()"; -#endif - - if (haveSquareBrushes ()) - { - d->brushDrawFunc = d->toolWidgetEraserSize->drawFunction (); - d->cursorDrawFunc = d->toolWidgetEraserSize->drawCursorFunction (); - - for (int i = 0; i < 2; i++) - { - d->drawPackageForMouseButton [i] = - &(d->eraserDrawPackageForMouseButton [i] = - d->toolWidgetEraserSize->drawFunctionData (color (i))); - } - - d->brushWidth = d->brushHeight = - d->cursorWidth = d->cursorHeight = - d->toolWidgetEraserSize->eraserSize (); - - d->brushIsDiagonalLine = false; - } - else if (haveDiverseBrushes ()) - { - d->brushDrawFunc = d->cursorDrawFunc = d->toolWidgetBrush->drawFunction (); - - for (int i = 0; i < 2; i++) - { - d->drawPackageForMouseButton [i] = - &(d->brushDrawPackageForMouseButton [i] = - d->toolWidgetBrush->drawFunctionData (color (i))); - } - - d->brushWidth = d->brushHeight = - d->cursorWidth = d->cursorHeight = - d->toolWidgetBrush->brushSize (); - - d->brushIsDiagonalLine = d->toolWidgetBrush->brushIsDiagonalLine (); - } - - hover (hasBegun () ? currentPoint () : calculateCurrentPoint ()); -} - -//--------------------------------------------------------------------- - -// virtual private slot -void kpToolFlowBase::slotForegroundColorChanged (const kpColor & /*col*/) -{ -#if DEBUG_KP_TOOL_FLOW_BASE - kDebug () << "kpToolFlowBase::slotForegroundColorChanged()"; -#endif - - updateBrushAndCursor (); -} - -//--------------------------------------------------------------------- - -// virtual private slot -void kpToolFlowBase::slotBackgroundColorChanged (const kpColor & /*col*/) -{ -#if DEBUG_KP_TOOL_FLOW_BASE - kDebug () << "kpToolFlowBase::slotBackgroundColorChanged()"; -#endif - - updateBrushAndCursor (); -} - -//--------------------------------------------------------------------- - -// public static -QRect kpToolFlowBase::hotRectForMousePointAndBrushWidthHeight ( - const QPoint &mousePoint, - int brushWidth, int brushHeight) -{ - /* - * e.g. - * Width 5: - * 0 1 2 3 4 - * ^ - * | - * Center - */ - return QRect (mousePoint.x () - brushWidth / 2, - mousePoint.y () - brushHeight / 2, - brushWidth, - brushHeight); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpToolFlowBase::hotRect () const -{ - return hotRectForMousePointAndBrushWidthHeight (currentPoint (), - d->brushWidth, d->brushHeight); -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolFlowBase.cpp" diff --git a/kolourpaint/tools/flow/kpToolFlowBase.h b/kolourpaint/tools/flow/kpToolFlowBase.h deleted file mode 100644 index 5827ced4..00000000 --- a/kolourpaint/tools/flow/kpToolFlowBase.h +++ /dev/null @@ -1,120 +0,0 @@ - -/* - Copyright(c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_FLOW_BASE_H -#define KP_TOOL_FLOW_BASE_H - - -#include - -#include -#include - - -#include -#include - -class kpColor; -class kpToolFlowCommand; - - -class kpToolFlowBase : public kpTool -{ - Q_OBJECT - - public: - kpToolFlowBase(const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, QObject *parent, const QString &name); - - virtual ~kpToolFlowBase(); - - // Returns the dirty rectangle for drawing a brush(of size - // x) at . will end - // up being the midpoint of the returned rectangle(subject to integer - // precision). - static QRect hotRectForMousePointAndBrushWidthHeight( - const QPoint &mousePoint, - int brushWidth, int brushHeight); - - virtual void begin(); - virtual void end(); - - virtual void beginDraw(); - virtual void hover(const QPoint &point); - - // drawPoint() normally calls drawLine(point,point). Override drawPoint() - // if you think you can be more efficient. - virtual QRect drawPoint(const QPoint &point); - virtual QRect drawLine(const QPoint &thisPoint, const QPoint &lastPoint) = 0; - - virtual bool drawShouldProceed(const QPoint & /*thisPoint*/, const QPoint & /*lastPoint*/, const QRect & /*normalizedRect*/) { return true; } - virtual void draw(const QPoint &thisPoint, const QPoint &lastPoint, const QRect &normalizedRect); - virtual void cancelShape(); - virtual void releasedAllButtons(); - virtual void endDraw(const QPoint &, const QRect &); - - protected: - virtual QString haventBegunDrawUserMessage() const = 0; - - virtual bool haveSquareBrushes() const { return false; } - virtual bool haveDiverseBrushes() const { return false; } - bool haveAnyBrushes() const - { - return(haveSquareBrushes() || haveDiverseBrushes()); - } - - virtual bool colorsAreSwapped() const { return false; } - - kpTempImage::UserFunctionType brushDrawFunction() const; - void *brushDrawFunctionData() const; - - int brushWidth() const; - int brushHeight() const; - - bool brushIsDiagonalLine() const; - - kpToolFlowCommand *currentCommand() const; - virtual kpColor color(int which); - QRect hotRect() const; - - protected slots: - void updateBrushAndCursor(); - - virtual void slotForegroundColorChanged(const kpColor &col); - virtual void slotBackgroundColorChanged(const kpColor &col); - - private: - void clearBrushCursorData(); - - private: - struct kpToolFlowBasePrivate *d; -}; - - -#endif // KP_TOOL_FLOW_BASE_H diff --git a/kolourpaint/tools/flow/kpToolFlowPixmapBase.cpp b/kolourpaint/tools/flow/kpToolFlowPixmapBase.cpp deleted file mode 100644 index b252977d..00000000 --- a/kolourpaint/tools/flow/kpToolFlowPixmapBase.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolFlowPixmapBase::kpToolFlowPixmapBase (const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, QObject *parent, const QString &name) - : kpToolFlowBase (text, description, key, environ, parent, name) -{ -} - -//--------------------------------------------------------------------- - -QRect kpToolFlowPixmapBase::drawLine (const QPoint &thisPoint, const QPoint &lastPoint) -{ - QRect docRect = kpPainter::normalizedRect(thisPoint, lastPoint); - docRect = neededRect (docRect, qMax (brushWidth (), brushHeight ())); - kpImage image = document ()->getImageAt (docRect); - - - QList points = kpPainter::interpolatePoints (lastPoint, thisPoint, - brushIsDiagonalLine ()); - - for (QList ::const_iterator pit = points.constBegin (); - pit != points.constEnd (); - ++pit) - { - const QPoint point = - hotRectForMousePointAndBrushWidthHeight ( - (*pit), brushWidth (), brushHeight ()) - .topLeft () - docRect.topLeft (); - - // OPT: This may be redrawing pixels that were drawn on a previous - // iteration, since the brush is usually bigger than 1 pixel. - // Maybe we could use QRegion to determine all the non-intersecting - // regions and only draw each region once. - // - // Try this at least for the easy case of the Eraser, which has - // square, simply-filled brushes. Profiling needs to be done as - // QRegion is known to be a CPU hog. - brushDrawFunction () (&image, point, brushDrawFunctionData ()); - } - - - document ()->setImageAt (image, docRect.topLeft ()); - return docRect; -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolFlowPixmapBase.cpp" diff --git a/kolourpaint/tools/flow/kpToolFlowPixmapBase.h b/kolourpaint/tools/flow/kpToolFlowPixmapBase.h deleted file mode 100644 index a8743f0a..00000000 --- a/kolourpaint/tools/flow/kpToolFlowPixmapBase.h +++ /dev/null @@ -1,58 +0,0 @@ - -// REFACTOR: Rename to kpAbstractFlowImageTool, and use kpImage instead of QPixmap - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_FLOW_PIXMAP_BASE_H -#define KP_TOOL_FLOW_PIXMAP_BASE_H - - -#include - - -/** - * @short Abstract base call for all continuous tools that draw pixmaps - * (e.g. Brush, Eraser). - * - * @author Clarence Dang - */ -class kpToolFlowPixmapBase : public kpToolFlowBase -{ -Q_OBJECT - -public: - kpToolFlowPixmapBase (const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, QObject *parent, const QString &name); - -protected: - virtual QRect drawLine (const QPoint &thisPoint, const QPoint &lastPoint); -}; - - -#endif // KP_TOOL_FLOW_PIXMAP_BASE_H diff --git a/kolourpaint/tools/flow/kpToolPen.cpp b/kolourpaint/tools/flow/kpToolPen.cpp deleted file mode 100644 index 4462b174..00000000 --- a/kolourpaint/tools/flow/kpToolPen.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -struct kpToolPenPrivate -{ -}; - -//--------------------------------------------------------------------- - -kpToolPen::kpToolPen (kpToolEnvironment *environ, QObject *parent) - : kpToolFlowBase (i18n ("Pen"), i18n ("Draws dots and freehand strokes"), - Qt::Key_P, - environ, parent, "tool_pen"), - d (new kpToolPenPrivate ()) -{ -} - -//--------------------------------------------------------------------- - -kpToolPen::~kpToolPen () -{ - delete d; -} - -//--------------------------------------------------------------------- - - -// protected virtual [base kpToolFlowBase] -QString kpToolPen::haventBegunDrawUserMessage () const -{ - return i18n ("Click to draw dots or drag to draw strokes."); -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpToolFlowBase] -QRect kpToolPen::drawLine (const QPoint &thisPoint, const QPoint &lastPoint) -{ - QRect docRect = kpPainter::normalizedRect(thisPoint, lastPoint); - docRect = neededRect (docRect, 1/*pen width*/); - kpImage image = document ()->getImageAt (docRect); - - const QPoint sp = lastPoint - docRect.topLeft (), - ep = thisPoint - docRect.topLeft (); - - kpPainter::drawLine (&image, - sp.x (), sp.y (), - ep.x (), ep.y (), - color (mouseButton ()), - 1/*pen width*/); - - document ()->setImageAt (image, docRect.topLeft ()); - return docRect; -} - - -#include "moc_kpToolPen.cpp" diff --git a/kolourpaint/tools/flow/kpToolPen.h b/kolourpaint/tools/flow/kpToolPen.h deleted file mode 100644 index 1e22a986..00000000 --- a/kolourpaint/tools/flow/kpToolPen.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_PEN_H -#define KP_TOOL_PEN_H - - -#include - - -// Pen = draws pixels, "interpolates" by "sweeping" pixels along a line (no brushes) -class kpToolPen : public kpToolFlowBase -{ -Q_OBJECT - -public: - kpToolPen (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolPen (); - -protected: - virtual QString haventBegunDrawUserMessage () const; - virtual QRect drawLine (const QPoint &thisPoint, const QPoint &lastPoint); - -private: - struct kpToolPenPrivate *d; -}; - - -#endif // KP_TOOL_PEN_H diff --git a/kolourpaint/tools/flow/kpToolSpraycan.cpp b/kolourpaint/tools/flow/kpToolSpraycan.cpp deleted file mode 100644 index e0cd80ac..00000000 --- a/kolourpaint/tools/flow/kpToolSpraycan.cpp +++ /dev/null @@ -1,264 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SPRAYCAN 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolSpraycan::kpToolSpraycan (kpToolEnvironment *environ, QObject *parent) - : kpToolFlowBase (i18n ("Spraycan"), i18n ("Sprays graffiti"), - Qt::Key_Y, - environ, parent, "tool_spraycan"), - m_toolWidgetSpraycanSize(0) -{ - m_timer = new QTimer (this); - m_timer->setInterval (25/*ms*/); - connect (m_timer, SIGNAL (timeout ()), this, SLOT (timeoutDraw ())); -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpToolFlowBase] -QString kpToolSpraycan::haventBegunDrawUserMessage () const -{ - return i18n ("Click or drag to spray graffiti."); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpToolFlowBase] -void kpToolSpraycan::begin () -{ - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - - m_toolWidgetSpraycanSize = tb->toolWidgetSpraycanSize (); - connect (m_toolWidgetSpraycanSize, SIGNAL (spraycanSizeChanged (int)), - this, SLOT (slotSpraycanSizeChanged (int))); - m_toolWidgetSpraycanSize->show (); - - kpToolFlowBase::begin (); -} - -// public virtual [base kpToolFlowBase] -void kpToolSpraycan::end () -{ - kpToolFlowBase::end (); - - disconnect (m_toolWidgetSpraycanSize, SIGNAL (spraycanSizeChanged (int)), - this, SLOT (slotSpraycanSizeChanged (int))); - m_toolWidgetSpraycanSize = 0; -} - - -// public virtual [base kpToolFlowBase] -void kpToolSpraycan::beginDraw () -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "kpToolSpraycan::beginDraw()"; -#endif - - kpToolFlowBase::beginDraw (); - - // We draw even if the user doesn't move the mouse. - // We still timeout-draw even if the user _does_ move the mouse. - m_timer->start (); -} - - -// protected -QRect kpToolSpraycan::drawLineWithProbability (const QPoint &thisPoint, - const QPoint &lastPoint, - double probability) -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "CALL(thisPoint=" << thisPoint - << ",lastPoint=" << lastPoint - << ")" << endl; -#endif - - QList docPoints = kpPainter::interpolatePoints (lastPoint, thisPoint, - false/*no need for cardinally adjacency points*/, - probability); -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "\tdocPoints=" << docPoints; -#endif - - - // By chance no points to draw? - if (docPoints.empty ()) - return QRect (); - - - // For efficiency, only get image after NOP check above. - QRect docRect = kpPainter::normalizedRect(thisPoint, lastPoint); - docRect = neededRect (docRect, spraycanSize ()); - kpImage image = document ()->getImageAt (docRect); - - - // Spray at each point, onto the image. - // - // Note in passing: Unlike other tools such as the Brush, drawing - // over the same point does result in a different - // appearance. - - QList imagePoints; - foreach (const QPoint &dp, docPoints) - imagePoints.append (dp - docRect.topLeft ()); - - kpPainter::sprayPoints (&image, - imagePoints, - color (mouseButton ()), - spraycanSize ()); - - - viewManager ()->setFastUpdates (); - document ()->setImageAt (image, docRect.topLeft ()); - viewManager ()->restoreFastUpdates (); - - - return docRect; -} - -// public virtual [base kpToolFlowBase] -QRect kpToolSpraycan::drawPoint (const QPoint &point) -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "kpToolSpraycan::drawPoint" << point - << " lastPoint=" << lastPoint () - << endl; -#endif - - // If this is the first in the flow or if the user is moving the spray, - // make the spray line continuous. - if (point != lastPoint ()) - { - // Draw at this single point without delay. - return drawLineWithProbability (point, point, - 1.0/*100% chance of drawing*/); - } - - return QRect (); -} - -// public virtual [base kpToolFlowBase] -QRect kpToolSpraycan::drawLine (const QPoint &thisPoint, const QPoint &lastPoint) -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "CALL(thisPoint=" << thisPoint << ",lastPoint=" << lastPoint; -#endif - - // Draw only every so often in response to movement. - return drawLineWithProbability (thisPoint, lastPoint, - 0.05/*less dense: select 5% of adjacent pixels - not all*/); -} - -// protected slot -void kpToolSpraycan::timeoutDraw () -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "kpToolSpraycan::timeoutDraw()"; -#endif - - // Draw at this single point without delay. - const QRect drawnRect = drawLineWithProbability (currentPoint (), currentPoint (), - 1.0/*100% chance of drawing*/); - - // kpToolFlowBase() does this after calling drawPoint() and drawLine() so - // we need to do it too. - currentCommand ()->updateBoundingRect (drawnRect); -} - - -// public virtual [base kpToolFlowBase] -void kpToolSpraycan::cancelShape () -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "kpToolSpraycan::cancelShape()"; -#endif - - m_timer->stop (); - kpToolFlowBase::cancelShape (); -} - -// public virtual [base kpToolFlowBase] -void kpToolSpraycan::endDraw (const QPoint &thisPoint, - const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_SPRAYCAN - kDebug () << "kpToolSpraycan::endDraw(thisPoint=" << thisPoint - << ")" << endl; -#endif - - m_timer->stop (); - kpToolFlowBase::endDraw (thisPoint, normalizedRect); -} - - -// protected -int kpToolSpraycan::spraycanSize () const -{ - return m_toolWidgetSpraycanSize->spraycanSize (); -} - -// protected slot -void kpToolSpraycan::slotSpraycanSizeChanged (int size) -{ - (void) size; -} - - -#include "moc_kpToolSpraycan.cpp" - diff --git a/kolourpaint/tools/flow/kpToolSpraycan.h b/kolourpaint/tools/flow/kpToolSpraycan.h deleted file mode 100644 index 02a1521a..00000000 --- a/kolourpaint/tools/flow/kpToolSpraycan.h +++ /dev/null @@ -1,90 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_SPRAYCAN_H -#define KP_TOOL_SPRAYCAN_H - - -#include - - -#include -#include -#include -#include - -class kpToolWidgetSpraycanSize; - - -class kpToolSpraycan : public kpToolFlowBase -{ -Q_OBJECT - -public: - kpToolSpraycan (kpToolEnvironment *environ, QObject *parent); - -protected: - virtual QString haventBegunDrawUserMessage () const; - - -public: - virtual void begin (); - virtual void end (); - - -public: - virtual void beginDraw (); -protected: - // (ASSUMPTION: is between 0.0 and 1.0 inclusive) - QRect drawLineWithProbability (const QPoint &thisPoint, - const QPoint &lastPoint, - double probability); -public: - virtual QRect drawPoint (const QPoint &point); - virtual QRect drawLine (const QPoint &thisPoint, const QPoint &lastPoint); - virtual void cancelShape (); - virtual void endDraw (const QPoint &thisPoint, - const QRect &normalizedRect); - -protected slots: - void timeoutDraw (); - - -protected: - int spraycanSize () const; -protected slots: - void slotSpraycanSizeChanged (int size); - - -protected: - QTimer *m_timer; - kpToolWidgetSpraycanSize *m_toolWidgetSpraycanSize; -}; - - -#endif // KP_TOOL_SPRAYCAN_H diff --git a/kolourpaint/tools/kpTool.cpp b/kolourpaint/tools/kpTool.cpp deleted file mode 100644 index 81dac91a..00000000 --- a/kolourpaint/tools/kpTool.cpp +++ /dev/null @@ -1,264 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool initialisation and basic accessors. -// - -#define DEBUG_KP_TOOL 0 - -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#undef environ // macro on win32 - -//--------------------------------------------------------------------- - -kpTool::kpTool(const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, - QObject *parent, const QString &name) - : QObject(parent), - d(new kpToolPrivate()) -{ - d->key = key; - d->action = 0; - d->ignoreColorSignals = 0; - d->shiftPressed = false, d->controlPressed = false, d->altPressed = false; // set in beginInternal() - d->beganDraw = false; - d->text = text, d->description = description; - d->began = false; - d->viewUnderStartPoint = 0; - d->userShapeStartPoint = KP_INVALID_POINT; - d->userShapeEndPoint = KP_INVALID_POINT; - d->userShapeSize = KP_INVALID_SIZE; - - d->environ = environ; - - setObjectName(name); - initAction(); -} - -//--------------------------------------------------------------------- - -kpTool::~kpTool () -{ - // before destructing, stop using the tool - if (d->began) - endInternal (); - - delete d->action; - - delete d; -} - -//--------------------------------------------------------------------- - -// private -void kpTool::initAction () -{ - KActionCollection *ac = d->environ->actionCollection (); - Q_ASSERT (ac); - - d->action = new kpToolAction(text(), objectName(), shortcutForKey(d->key), - this, SIGNAL(actionActivated()), - ac, objectName()); - - // Make tools mutually exclusive by placing them in the same group. - d->action->setActionGroup(d->environ->toolsActionGroup ()); - - d->action->setWhatsThis(d->description); - - connect(d->action, SIGNAL(changed()), this, SIGNAL (actionToolTipChanged())); -} - -//--------------------------------------------------------------------- -// public - -QString kpTool::text () const -{ - return d->text; -} - -//--------------------------------------------------------------------- - -static bool KeyIsText (int key) -{ - // TODO: should work like !QKeyEvent::text().isEmpty() - return !(key & (Qt::KeyboardModifierMask ^ Qt::ShiftModifier)); -} - -//--------------------------------------------------------------------- - -// public static -QString kpTool::toolTipForTextAndShortcut (const QString &text, - const KShortcut &shortcut) -{ - foreach(const QKeySequence &seq, shortcut.toList()) - { - if (seq.count () == 1 && ::KeyIsText (seq [0])) - return i18nc (" ()", - "%1 (%2)", text, seq.toString ().toUpper ()); - } - - return text; -} - -//--------------------------------------------------------------------- - -QString kpTool::toolTip () const -{ - return toolTipForTextAndShortcut(d->text, d->action->shortcut()); -} - -//--------------------------------------------------------------------- -// public static - -KShortcut kpTool::shortcutForKey (int key) -{ - KShortcut shortcut; - - if (key) - { - shortcut.setPrimary (key); - // (CTRL+, ALT+, CTRL+ALT+, CTRL+SHIFT+ - // all clash with global KDE shortcuts) - shortcut.setAlternate (Qt::ALT + Qt::SHIFT + key); - } - - return shortcut; -} - -//--------------------------------------------------------------------- -// public - -kpToolAction *kpTool::action () const -{ - return d->action; -} - -//--------------------------------------------------------------------- - -kpDocument *kpTool::document () const -{ - return d->environ->document (); -} - -//--------------------------------------------------------------------- - -kpViewManager *kpTool::viewManager () const -{ - return d->environ->viewManager (); -} - -//--------------------------------------------------------------------- - -kpToolToolBar *kpTool::toolToolBar () const -{ - return d->environ->toolToolBar (); -} - -//--------------------------------------------------------------------- - -kpColor kpTool::color (int which) const -{ - return d->environ->color (which); -} - -//--------------------------------------------------------------------- - -kpColor kpTool::foregroundColor () const -{ - return color (0); -} - -//--------------------------------------------------------------------- - -kpColor kpTool::backgroundColor () const -{ - return color (1); -} - -//--------------------------------------------------------------------- - -// TODO: Some of these might not be common enough. -// Just put in kpToolEnvironment? - -double kpTool::colorSimilarity () const -{ - return d->environ->colorSimilarity (); -} - -int kpTool::processedColorSimilarity () const -{ - return d->environ->processedColorSimilarity (); -} - - -kpColor kpTool::oldForegroundColor () const -{ - return d->environ->oldForegroundColor (); -} - -kpColor kpTool::oldBackgroundColor () const -{ - return d->environ->oldBackgroundColor (); -} - -double kpTool::oldColorSimilarity () const -{ - return d->environ->oldColorSimilarity (); -} - -kpCommandHistory *kpTool::commandHistory () const -{ - return d->environ->commandHistory (); -} - - -kpToolEnvironment *kpTool::environ () const -{ - return d->environ; -} - - -#include "moc_kpTool.cpp" diff --git a/kolourpaint/tools/kpTool.h b/kolourpaint/tools/kpTool.h deleted file mode 100644 index 29bc26a4..00000000 --- a/kolourpaint/tools/kpTool.h +++ /dev/null @@ -1,468 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_H -#define KP_TOOL_H - - -#include -#include -#include -#include -#include - -#include -#ifdef Q_OS_WIN - #include - #undef environ // macro on win32 -#endif - - -#include -#include -class QInputMethodEvent; -#include -#include -#include -#include - -class KShortcut; - -class kpColor; -class kpCommandHistory; -class kpDocument; -class kpView; -class kpViewManager; -class kpToolAction; -class kpToolEnvironment; -class kpToolToolBar; - - -struct kpToolPrivate; - -// Base class for all tools. -// REFACTOR: rearrange method order to make sense and reflect kpTool_*.cpp split. -class kpTool : public QObject -{ -Q_OBJECT - -public: - // = user-visible name of the tool e.g. "Color Picker" - // = user-visible description used for tooltips - // e.g. "Lets you select a color from the image" - // = optional shortcut key for switching to the tool, or 0 otherwise - // e.g. Qt::Key_C - // = internal QObject name (not user-visible) e.g. "tool_color_picker" - // used for fetching the icon(), the name of the action() and - // debug printing. - kpTool (const QString &text, const QString &description, - int key, - kpToolEnvironment *environ, - QObject *parent, const QString &name); - virtual ~kpTool (); - - kpToolAction *action () const; - - QString text () const; - - static QString toolTipForTextAndShortcut (const QString &text, const KShortcut &shortcut); - QString toolTip () const; - - // Given a single , returns a shortcut with - // (disabled when the user is editing text) and as an alternate, - // +. - static KShortcut shortcutForKey (int key); - - static QRect neededRect (const QRect &rect, int lineWidth); - static QImage neededPixmap (const QImage &image, const QRect &boundingRect); - - bool hasCurrentPoint () const; - // Returns the position of the cursor relative to the topleft point of - // the current view (viewUnderStartPoint() or viewUnderCursor() otherwise). - // - // If neither viewUnderStartPoint() nor viewUnderCursor() - // (i.e. !hasCurrentPoint()), then it returns KP_INVALID_POINT. - // - // If is set (default), then it returns the position in the - // document. This theoretically == m_currentPoint (when m_currentPoint - // is defined) but I wouldn't bet on it. This function is useful when - // m_currentPoint isn't necessarily defined (outside of beginDraw(),draw() - // and hover()). - // - // If is not set, then it returns an unzoomed view coordinate. - // - // Keep in mind that if viewUnderStartPoint(), this can return coordinates - // outside of the document/view. - QPoint calculateCurrentPoint (bool zoomToDoc = true) const; - -private: - // Only called by ctor to create action(). - void initAction (); - -signals: - void actionToolTipChanged(); - -public slots: - // Call this when something below the mouse cursor may have changed - // and/or if the view has moved relative to the cursor (as opposed to - // the cursor moving relative to the view, which would trigger a - // mouseMoveEvent and all would be well without such hacks) - // e.g. when zooming or scrolling the view or when deleting a selection. - // - // This calls hover() or draw() to let the tool know. The Brush Tool - // can then update the position of the Brush Cursor. The Selection - // Tool can update the real cursor. The Line Tool can update the current - // line. The statubar gets correct coordinates. etc. etc. - void somethingBelowTheCursorChanged (); - -private: - // Same as above except that you claim you know better than currentPoint() - void somethingBelowTheCursorChanged (const QPoint ¤tPoint_, - const QPoint ¤tViewPoint_); - -protected: - int mouseButton () const; - - bool shiftPressed () const; - bool controlPressed () const; - bool altPressed () const; - - QPoint startPoint () const; - - QPoint currentPoint () const; - QPoint currentViewPoint () const; - - QRect normalizedRect () const; - - QPoint lastPoint () const; - -public: // for kpMainWindow - kpView *viewUnderStartPoint () const; - -protected: - kpView *viewUnderCursor () const; - -public: - // Called when the tool is selected. - virtual void begin (); - - // Called when the tool is deselected. - virtual void end (); - - // Returns true after begin() has been called but returns false after end() - // after end() has been called. - bool hasBegun () const; - - bool hasBegunDraw () const; - - virtual bool hasBegunShape () const; - - // Called when user double-left-clicks on a tool in the Tool Box. - virtual void globalDraw (); - - // Called when the user clicks on a tool in the Tool Box even though it's - // already the current tool (used by the selection tools to deselect). - virtual void reselect (); - -signals: - // emitted after beginDraw() has been called - void beganDraw (const QPoint &point); - - // Emitted just before draw() is called in mouseMoveEvent(). Slots - // connected to this signal should return in whether the - // mouse pos may have changed. Used by drag scrolling. - void movedAndAboutToDraw (const QPoint ¤tPoint, const QPoint &lastPoint, - int zoomLevel, - bool *scrolled); - - // emitted after endDraw() has been called - void endedDraw (const QPoint &point); - - // emitted after cancelShape() has been called - void cancelledShape (const QPoint &point); - -signals: - // User clicked on the tool's action - i.e. select this tool - void actionActivated(); - -protected: - // (this method is called by kpTool just as it is needed - its value - // is not cached, so it is allowed to return different things at - // different times) - // REFACTOR: Misleadingly named as it's also called in cancelShapeInternal(). - // And it seems to be called in endShapeInternal() as well? - virtual bool returnToPreviousToolAfterEndDraw () const { return false; } - - virtual bool careAboutModifierState () const { return false; } - virtual bool careAboutColorsSwapped () const { return false; } - - virtual void beginDraw (); - - // mouse move without button pressed - // (only m_currentPoint & m_currentViewPoint is defined) - virtual void hover (const QPoint &point); - - // this is useful for "instant" tools like the Pen & Eraser - virtual void draw (const QPoint &thisPoint, const QPoint &lastPoint, - const QRect &normalizedRect); - -private: - void drawInternal (); - -protected: - // (m_mouseButton will not change from beginDraw()) - virtual void cancelShape (); - virtual void releasedAllButtons (); - - virtual void endDraw (const QPoint &thisPoint, const QRect &normalizedRect); - - // TODO: I think reimplementations of this should be calling this base - // implementation, so that endDraw() happens before the custom - // endShape() logic of the reimplementation. - virtual void endShape (const QPoint &thisPoint = QPoint (), - const QRect &normalizedRect = QRect ()) - { - endDraw (thisPoint, normalizedRect); - } - - kpDocument *document () const; - kpViewManager *viewManager () const; - kpToolToolBar *toolToolBar () const; - kpCommandHistory *commandHistory () const; - kpToolEnvironment *environ () const; - - kpColor color (int which) const; - - kpColor foregroundColor () const; - kpColor backgroundColor () const; - - double colorSimilarity () const; - int processedColorSimilarity () const; - -protected slots: - void slotColorsSwappedInternal (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor); - void slotForegroundColorChangedInternal (const kpColor &color); - void slotBackgroundColorChangedInternal (const kpColor &color); - void slotColorSimilarityChangedInternal (double similarity, int processedSimilarity); - -protected slots: // TODO: there is no reason why these should be slots - virtual void slotColorsSwapped (const kpColor & /*newForegroundColor*/, const kpColor & /*newBackgroundColor*/) {} - virtual void slotForegroundColorChanged (const kpColor & /*color*/) {} - virtual void slotBackgroundColorChanged (const kpColor & /*color*/) {} - virtual void slotColorSimilarityChanged (double /*similarity*/, int /*processedSimilarity*/) {} - -protected: - // (only valid in slots connected to the respective signals above) - kpColor oldForegroundColor () const; - kpColor oldBackgroundColor () const; - double oldColorSimilarity () const; - -protected: - // returns true if m_currentPoint <= 1 pixel away from m_lastPoint - // or if there was no lastPoint - bool currentPointNextToLast () const; // (includes diagonal adjacency) - bool currentPointCardinallyNextToLast () const; // (only cardinally adjacent i.e. horiz & vert; no diag) - -// TODO: We should rename these. -// These are accessed from kpTool logic and our friends, kpCommandHistory, -// kpMainWindow, kpToolToolBar and kpView. -public: - void beginInternal (); - void endInternal (); - - void beginDrawInternal (); - void endDrawInternal (const QPoint &thisPoint, const QRect &normalizedRect, - bool wantEndShape = false); - void cancelShapeInternal (); - // TODO: Who is actually calling endShapeInternal()? - // Tools seem to call endShape() directly. - void endShapeInternal (const QPoint &thisPoint = QPoint (), - const QRect &normalizedRect = QRect ()); - - -// -// Mouse Events -// - -public: - // Note: _All_ events are forwarded from a kpView. - // The existence of a kpView implies the existence of a kpDocument. - - // If you're reimplementing any of these, you probably don't know what - // you're doing - reimplement begin(),beginDraw(),draw(),cancelShape(), - // endDraw() etc. instead. - virtual void mousePressEvent (QMouseEvent *e); - virtual void mouseMoveEvent (QMouseEvent *e); - virtual void mouseReleaseEvent (QMouseEvent *e); - - virtual void wheelEvent (QWheelEvent *e); - - -// -// Keyboard Events -// - -protected: - void seeIfAndHandleModifierKey (QKeyEvent *e); - - void arrowKeyPressDirection (const QKeyEvent *e, int *dx, int *dy); - void seeIfAndHandleArrowKeyPress (QKeyEvent *e); - - bool isDrawKey (int key); - void seeIfAndHandleBeginDrawKeyPress (QKeyEvent *e); - void seeIfAndHandleEndDrawKeyPress (QKeyEvent *e); - -public: - virtual void keyPressEvent (QKeyEvent *e); - virtual void keyReleaseEvent (QKeyEvent *e); - - virtual void inputMethodEvent (QInputMethodEvent *) {} - -private: - void keyUpdateModifierState (QKeyEvent *e); - void notifyModifierStateChanged (); - -protected: - virtual void setShiftPressed (bool pressed); - virtual void setControlPressed (bool pressed); - - virtual void setAltPressed (bool pressed); - - -// -// Other Events - 1. View Events -// - -public: - // WARNING: Do not call this "event()" as our QObject parent has a - // virtual function called that, that will pass us - // QObject events. We only care about events forwarded by - // kpView. - // REFACTOR: rename mousePressEvent() -> viewMousePressEvent() etc. - // to remind us that events are coming from the view - the tool - // is not a visible object. - virtual bool viewEvent (QEvent *e); - -public: - virtual void focusInEvent (QFocusEvent *e); - virtual void focusOutEvent (QFocusEvent *e); - -public: - virtual void enterEvent (QEvent *e); - virtual void leaveEvent (QEvent *e); - - -// -// Other Events - 2. Non-view Events -// REFACTOR: Group methods under this. -// - -protected: - // 0 = left, 1 = right, -1 = other (none, left+right, mid) - static int mouseButton (Qt::MouseButtons mouseButtons); - -public: - static int calculateLength (int start, int end); - - // - // User Notifications (Status Bar) - // - -public: - // Returns "(Left|Right) click to cancel." where Left or Right is chosen - // depending on which one is the _opposite_ of - static QString cancelUserMessage (int mouseButton); - QString cancelUserMessage () const; - - QString userMessage () const; - // WARNING: setUserMessage() will store a message different to , - // in unspecified ways (e.g. the name of the tool, followed - // by a colon and a space, will be prepended). userMessage() - // will return this different string. - void setUserMessage (const QString &userMessage = QString ()); - - QPoint userShapeStartPoint () const; - QPoint userShapeEndPoint () const; - void setUserShapePoints (const QPoint &startPoint = KP_INVALID_POINT, - const QPoint &endPoint = KP_INVALID_POINT, - bool setSize = true); - - QSize userShapeSize () const; - int userShapeWidth () const; - int userShapeHeight () const; - void setUserShapeSize (const QSize &size = KP_INVALID_SIZE); - void setUserShapeSize (int width, int height); - -signals: - void userMessageChanged (const QString &userMessage); - void userShapePointsChanged (const QPoint &startPoint = KP_INVALID_POINT, - const QPoint &endPoint = KP_INVALID_POINT); - void userShapeSizeChanged (const QSize &size); - void userShapeSizeChanged (int width, int height); - - -public: - // Call this before the user tries to cause the document or selection - // to resize from x to x. - // If at least one dimension increases, the new dimensions will take a - // large amount of memory (which causes thrashing, instability) and - // the old dimensions did not take a large amount of memory, ask the - // user if s/he really wants to perform the operation. - // - // Returns true if the operation should proceed, false otherwise. - // - // In order to make the translators' lives possible, this function cannot - // generate the , nor (without - // concantenating sentences and words with tense). However, it is - // recommended that you give them the following values: - // - // e.g.: - // text = i18n ("

(Rotating|Skewing) the (image|selection) to" - // " %1x%2 may take a substantial amount of memory." - // " This can reduce system" - // " responsiveness and cause other application resource" - // " problems.

").arg (newWidth, newHeight) - // - // "

Are you sure want to (rotate|skew) the" - // " (image|selection)?

"); - // caption = i18n ("Rotate (Image|Selection)?"); - // continueButtonText = i18n ("Rotat&e (Image|Selection)"); - static bool warnIfBigImageSize (int oldWidth, int oldHeight, - int newWidth, int newHeight, - const QString &text, - const QString &caption, - const QString &continueButtonText, - QWidget *parent); - -private: - kpToolPrivate *d; -}; - - -#endif // KP_TOOL_H diff --git a/kolourpaint/tools/kpToolAction.cpp b/kolourpaint/tools/kpToolAction.cpp deleted file mode 100644 index 5a4c1ceb..00000000 --- a/kolourpaint/tools/kpToolAction.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright(c) 2003-2007 Clarence Dang - Copyright(c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpToolAction::kpToolAction(const QString &text, - const QString &pic, const KShortcut &shortcut, - const QObject *receiver, const char *slot, - KActionCollection *ac, const QString &name) - : KToggleAction(KIcon(pic), text, ac) -{ - KToggleAction::setShortcut(shortcut); - - if ( receiver && slot ) - connect(this, SIGNAL(triggered(bool)), receiver, slot); - - updateToolTip(); - connect(this, SIGNAL(changed()), this, SLOT(updateToolTip())); - - ac->addAction(name, this); -} - -//--------------------------------------------------------------------- - -// protected -void kpToolAction::updateToolTip() -{ - const QString newToolTip = - kpTool::toolTipForTextAndShortcut(text(), shortcut()); - - if ( newToolTip == toolTip() ) - return; - - setToolTip(newToolTip); -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolAction.cpp" diff --git a/kolourpaint/tools/kpToolAction.h b/kolourpaint/tools/kpToolAction.h deleted file mode 100644 index c02285c7..00000000 --- a/kolourpaint/tools/kpToolAction.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ACTION_H -#define KP_TOOL_ACTION_H - -#include - -class KActionCollection; - -// Same as KToggleAction but shows the first single key trigger in the tooltip. - -class kpToolAction : public KToggleAction -{ - Q_OBJECT - - public: - kpToolAction(const QString &text, - const QString &pic, const KShortcut &shortcut, - const QObject *receiver, const char *slot, - KActionCollection *ac, const QString &name); - - private slots: - void updateToolTip(); -}; - - -#endif // KP_TOOL_ACTION_H diff --git a/kolourpaint/tools/kpToolColorPicker.cpp b/kolourpaint/tools/kpToolColorPicker.cpp deleted file mode 100644 index 4a338883..00000000 --- a/kolourpaint/tools/kpToolColorPicker.cpp +++ /dev/null @@ -1,145 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_COLOR_PICKER 0 - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -kpToolColorPicker::kpToolColorPicker (kpToolEnvironment *environ, QObject *parent) - : kpTool (i18n ("Color Picker"), i18n ("Lets you select a color from the image"), - Qt::Key_C, - environ, parent, "tool_color_picker") -{ -} - -kpToolColorPicker::~kpToolColorPicker () -{ -} - - -// private -kpColor kpToolColorPicker::colorAtPixel (const QPoint &p) -{ -#if DEBUG_KP_TOOL_COLOR_PICKER && 0 - kDebug () << "kpToolColorPicker::colorAtPixel" << p; -#endif - - return kpPixmapFX::getColorAtPixel (document ()->image (), p); -} - - -// private -QString kpToolColorPicker::haventBegunDrawUserMessage () const -{ - return i18n ("Click to select a color."); -} - - -// public virtual [base kpTool] -void kpToolColorPicker::begin () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -// public virtual [base kpTool] -void kpToolColorPicker::beginDraw () -{ - m_oldColor = color (mouseButton ()); - - setUserMessage (cancelUserMessage ()); -} - -// public virtual [base kpTool] -void kpToolColorPicker::draw (const QPoint &thisPoint, const QPoint &, const QRect &) -{ - const kpColor color = colorAtPixel (thisPoint); - - if (color.isValid ()) - { - environ ()->setColor (mouseButton (), color); - setUserShapePoints (thisPoint); - } - else - { - environ ()->setColor (mouseButton (), m_oldColor); - setUserShapePoints (); - } -} - -// public virtual [base kpTool] -void kpToolColorPicker::cancelShape () -{ - environ ()->setColor (mouseButton (), m_oldColor); - - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -// public virtual [base kpTool] -void kpToolColorPicker::releasedAllButtons () -{ - setUserMessage (haventBegunDrawUserMessage ()); - -} - -// public virtual [base kpTool] -void kpToolColorPicker::endDraw (const QPoint &thisPoint, const QRect &) -{ - const kpColor color = colorAtPixel (thisPoint); - - if (color.isValid ()) - { - kpToolColorPickerCommand *cmd = - new kpToolColorPickerCommand ( - mouseButton (), - color, m_oldColor, - environ ()->commandEnvironment ()); - - environ ()->commandHistory ()->addCommand (cmd, false/*no exec*/); - setUserMessage (haventBegunDrawUserMessage ()); - } - else - { - cancelShape (); - } -} - - -#include "moc_kpToolColorPicker.cpp" diff --git a/kolourpaint/tools/kpToolColorPicker.h b/kolourpaint/tools/kpToolColorPicker.h deleted file mode 100644 index 89996ba2..00000000 --- a/kolourpaint/tools/kpToolColorPicker.h +++ /dev/null @@ -1,71 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_COLOR_PICKER_H -#define KP_TOOL_COLOR_PICKER_H - - -#include -#include - - -#include -#include - - -class kpToolColorPicker : public kpTool -{ -Q_OBJECT - -public: - kpToolColorPicker (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolColorPicker (); - - // generally the user goes to pick a color but wants to return to using - // his/her previous drawing tool - virtual bool returnToPreviousToolAfterEndDraw () const { return true; } - -private: - kpColor colorAtPixel (const QPoint &p); - - QString haventBegunDrawUserMessage () const; - -public: - virtual void begin (); - virtual void beginDraw (); - virtual void draw (const QPoint &thisPoint, const QPoint &, const QRect &); - virtual void cancelShape (); - virtual void releasedAllButtons (); - virtual void endDraw (const QPoint &thisPoint, const QRect &); - -private: - kpColor m_oldColor; -}; - - -#endif // KP_TOOL_COLOR_PICKER_H diff --git a/kolourpaint/tools/kpToolFloodFill.cpp b/kolourpaint/tools/kpToolFloodFill.cpp deleted file mode 100644 index b0cd0fe5..00000000 --- a/kolourpaint/tools/kpToolFloodFill.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_FLOOD_FILL 0 - - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -struct kpToolFloodFillPrivate -{ - kpToolFloodFillCommand *currentCommand; -}; - -//--------------------------------------------------------------------- - -kpToolFloodFill::kpToolFloodFill (kpToolEnvironment *environ, QObject *parent) - : kpTool (i18n ("Flood Fill"), i18n ("Fills regions in the image"), - Qt::Key_F, - environ, parent, "tool_flood_fill"), - d (new kpToolFloodFillPrivate ()) -{ - d->currentCommand = 0; -} - -//--------------------------------------------------------------------- - -kpToolFloodFill::~kpToolFloodFill () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// private -QString kpToolFloodFill::haventBegunDrawUserMessage () const -{ - return i18n ("Click to fill a region."); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::begin () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::beginDraw () -{ -#if DEBUG_KP_TOOL_FLOOD_FILL && 1 - kDebug () << "kpToolFloodFill::beginDraw()"; -#endif - - QApplication::setOverrideCursor (Qt::WaitCursor); - { - environ ()->flashColorSimilarityToolBarItem (); - - // Flood Fill is an expensive CPU operation so we only fill at a - // mouse click (beginDraw ()), not on mouse move (virtually draw()) - d->currentCommand = new kpToolFloodFillCommand ( - currentPoint ().x (), currentPoint ().y (), - color (mouseButton ()), processedColorSimilarity (), - environ ()->commandEnvironment ()); - - #if DEBUG_KP_TOOL_FLOOD_FILL && 1 - kDebug () << "\tperforming new-doc-corner-case check"; - #endif - - if (document ()->url ().isEmpty () && !document ()->isModified ()) - { - // Collect the colour that gets changed before we change the pixels - // (execute() below). Needed in unexecute(). - d->currentCommand->prepareColorToChange (); - - d->currentCommand->setFillEntireImage (); - } - - d->currentCommand->execute (); - } - QApplication::restoreOverrideCursor (); - - setUserMessage (cancelUserMessage ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::draw (const QPoint &thisPoint, const QPoint &, const QRect &) -{ - setUserShapePoints (thisPoint); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::cancelShape () -{ - d->currentCommand->unexecute (); - - delete d->currentCommand; - d->currentCommand = 0; - - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::releasedAllButtons () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpToolFloodFill::endDraw (const QPoint &, const QRect &) -{ - environ ()->commandHistory ()->addCommand (d->currentCommand, - false/*no exec - we already did it up there*/); - - // Don't delete - it just got added to the history. - d->currentCommand = 0; - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolFloodFill.cpp" diff --git a/kolourpaint/tools/kpToolFloodFill.h b/kolourpaint/tools/kpToolFloodFill.h deleted file mode 100644 index 49691e92..00000000 --- a/kolourpaint/tools/kpToolFloodFill.h +++ /dev/null @@ -1,60 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_FLOOD_FILL_H -#define KP_TOOL_FLOOD_FILL_H - - -#include - - -class kpToolFloodFill : public kpTool -{ -Q_OBJECT - -public: - kpToolFloodFill (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolFloodFill (); - -private: - QString haventBegunDrawUserMessage () const; - -public: - virtual void begin (); - virtual void beginDraw (); - virtual void draw (const QPoint &thisPoint, const QPoint &, const QRect &); - virtual void cancelShape (); - virtual void releasedAllButtons (); - virtual void endDraw (const QPoint &, const QRect &); - -private: - struct kpToolFloodFillPrivate * const d; -}; - - -#endif // KP_TOOL_FLOOD_FILL_H diff --git a/kolourpaint/tools/kpToolPrivate.h b/kolourpaint/tools/kpToolPrivate.h deleted file mode 100644 index 86609c56..00000000 --- a/kolourpaint/tools/kpToolPrivate.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolPrivate_H -#define kpToolPrivate_H - - -#include -#include - -#include -#ifdef Q_OS_WIN - #include - #undef environ // macro on win32 -#endif - -class kpToolAction; -class kpToolEnvironment; - - -struct kpToolPrivate -{ - // Initialisation / properties. - QString text; - QString description; - int key; - - kpToolAction *action; - - // Drawing state. - bool began; - bool beganDraw; // set after beginDraw() is called, unset before endDraw() is called - int mouseButton; /* 0 = left, 1 = right */ - bool shiftPressed, controlPressed, altPressed; // m_altPressed is unreliable - QPoint startPoint, - currentPoint, currentViewPoint, - lastPoint; - - kpView *viewUnderStartPoint; - - - // Set to 2 when the user swaps the foreground and background color. - // - // When nonzero, it suppresses the foreground and background "color changed" - // signals and is decremented back down to 0 separately by the foreground - // code and background code. - int ignoreColorSignals; - - // Statusbar. - QString userMessage; - QPoint userShapeStartPoint, userShapeEndPoint; - QSize userShapeSize; - - kpToolEnvironment *environ; -}; - - -#endif // kpToolPrivate_H diff --git a/kolourpaint/tools/kpToolZoom.cpp b/kolourpaint/tools/kpToolZoom.cpp deleted file mode 100644 index ab8780b8..00000000 --- a/kolourpaint/tools/kpToolZoom.cpp +++ /dev/null @@ -1,253 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_ZOOM 0 - - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -struct DrawZoomRectPackage -{ - QRect normalizedRect; -}; - -static void DrawZoomRect (kpImage *destImage, - const QPoint &topLeft, - void *userData) -{ - DrawZoomRectPackage *pack = static_cast (userData); - - kpPixmapFX::drawRect(destImage, - topLeft.x (), topLeft.y (), pack->normalizedRect.width (), pack->normalizedRect.height (), - kpColor::Yellow, 1/*pen width*/, - kpColor::Invalid/*no background*/, - kpColor::Green); -} - - -struct kpToolZoomPrivate -{ - bool dragHasBegun, dragCompleted; - DrawZoomRectPackage drawPackage; -}; - -kpToolZoom::kpToolZoom (kpToolEnvironment *environ, QWidget *parent) - : kpTool (i18n ("Zoom"), i18n ("Zooms in and out of the image"), - Qt::Key_Z, - environ, parent, "tool_zoom"), - d (new kpToolZoomPrivate ()) -{ - // different from objectName() - action()->setIcon(KIcon("zoom-original")); -} - -//--------------------------------------------------------------------- - -kpToolZoom::~kpToolZoom () -{ - delete d; -} - -//--------------------------------------------------------------------- -// public virtual [base kpTool] - -bool kpToolZoom::returnToPreviousToolAfterEndDraw () const -{ - // If the user clicks to zoom in or out, s/he generally wants to click - // some more to get the exact zoom level wanted. - // - // However, if they drag out a rectangle to zoom into a particular area, - // they probably don't need to do any further zooming so we can return - // them to their previous tool. - // - // Note that if they cancel a drag (cancelShape()), we do _not_ return - // them to their previous tool, unlike the Color Picker. This is because - // cancelling a drag generally means that the user got the top-left of - // the drag wrong and wants to try a different top-left. In contrast, - // with the Color Picket, if you've made a mistake while pressing the - // mouse, you can just keep holding down the mouse and drag to the intended - // color -- a cancel with a Color Picker really means "I've decided not - // to pick another color after all", not "I got the start of the drag wrong" - // because you can correct that drag. - return d->dragCompleted; -} - - -// private -QString kpToolZoom::haventBegunDrawUserMessage () const -{ - return i18n ("Click to zoom in/out or left drag to zoom into a specific area."); -} - - -// public virtual [base kpTool] -void kpToolZoom::begin () -{ - viewManager ()->setCursor (Qt::CrossCursor); - - setUserMessage (haventBegunDrawUserMessage ()); -} - -// public virtual [base kpTool] -void kpToolZoom::end () -{ - viewManager ()->unsetCursor (); -} - - -// public virtual [base kpTool] -void kpToolZoom::globalDraw () -{ -#if DEBUG_KP_TOOL_ZOOM - kDebug () << "CALL"; -#endif - environ ()->fitToPage (); -} - - -// public virtual [base kpTool] -void kpToolZoom::beginDraw () -{ - d->dragHasBegun = false; - d->dragCompleted = false; - - setUserMessage (cancelUserMessage ()); -} - -// public virtual [base kpTool] -void kpToolZoom::draw (const QPoint &thisPoint, const QPoint &, const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_ZOOM - kDebug () << "kpToomZoom::draw() currentPoint=" << currentPoint () - << " lastPoint=" << lastPoint () - << endl; -#endif - - // TODO: Need accidental drag detection from selection tool (when dragging - // out new selection) - - if (!d->dragHasBegun) - { - if (thisPoint == startPoint ()) - return; - - // Left mouse drags select an area to zoom into. - // However, it wouldn't make sense to select an area to "zoom out of" - // (using the right mouse button). Therefore, make RMB drags do the - // same as RMB clicks i.e. a simple zoom out, with no "area" to worry - // about. - if (mouseButton () == 1/*RMB*/) - return; - - d->dragHasBegun = true; - } - - - d->drawPackage.normalizedRect = normalizedRect; - - kpTempImage newTempImage (false/*always display*/, - normalizedRect.topLeft (), - &::DrawZoomRect, &d->drawPackage, - normalizedRect.width (), normalizedRect.height ()); - - viewManager ()->setFastUpdates (); - { - viewManager ()->setTempImage (newTempImage); - } - viewManager ()->restoreFastUpdates (); -} - -// public virtual [base kpTool] -void kpToolZoom::cancelShape () -{ - viewManager ()->invalidateTempImage (); - - // LOREFACTOR: A lot of tools use this - push up to kpTool? - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -// public virtual [base kpTool] -void kpToolZoom::releasedAllButtons () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -// public virtual [base kpTool] -void kpToolZoom::endDraw (const QPoint &, const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_ZOOM - kDebug () << "kpToolZoom::endDraw(rect=" << normalizedRect << ")" - << " dragHasBegun=" << d->dragHasBegun << endl; -#endif - - // TODO: This cursor doesn't stay on for long enough because zooming uses - // event loop tricks. - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - viewManager ()->invalidateTempImage (); - - // Click? - if (!d->dragHasBegun) - { - if (mouseButton () == 0/*LMB*/) - environ ()->zoomIn (true/*center under cursor*/); - else - environ ()->zoomOut (false/*don't center under cursor - as is - confusing behaviour when zooming - out*/); - } - // Drag? - else if (normalizedRect.isValid()) - { - environ ()->zoomToRect ( - normalizedRect, - false/*don't account for grips*/, - true/*care about width*/, true/*care about height*/); - - d->dragCompleted = true; - } -} - - -#include "moc_kpToolZoom.cpp" diff --git a/kolourpaint/tools/kpToolZoom.h b/kolourpaint/tools/kpToolZoom.h deleted file mode 100644 index 6d24c604..00000000 --- a/kolourpaint/tools/kpToolZoom.h +++ /dev/null @@ -1,66 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ZOOM_H -#define KP_TOOL_ZOOM_H - - -#include - - -class kpToolZoom : public kpTool -{ -Q_OBJECT - -public: - kpToolZoom (kpToolEnvironment *environ, QWidget *parent); - virtual ~kpToolZoom (); - - virtual bool returnToPreviousToolAfterEndDraw () const; - -private: - QString haventBegunDrawUserMessage () const; - -public: - virtual void begin (); - virtual void end (); - - virtual void globalDraw (); - - virtual void beginDraw (); - virtual void draw (const QPoint &thisPoint, const QPoint &, const QRect &); - virtual void cancelShape (); - virtual void releasedAllButtons (); - virtual void endDraw (const QPoint &thisPoint, const QRect &); - -private: - struct kpToolZoomPrivate *d; -}; - - -#endif // KP_TOOL_ZOOM_H diff --git a/kolourpaint/tools/kpTool_Drawing.cpp b/kolourpaint/tools/kpTool_Drawing.cpp deleted file mode 100644 index 101bbdba..00000000 --- a/kolourpaint/tools/kpTool_Drawing.cpp +++ /dev/null @@ -1,418 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool methods for drawing shapes (subclasses reimplement most of these). -// - - -#define DEBUG_KP_TOOL 0 - - -#include -#include - -#include - -#include - -#include -#include -#include -#include - -#undef environ // macro on win32 - -//--------------------------------------------------------------------- - -// protected -int kpTool::mouseButton () const -{ - return d->mouseButton; -} - -//--------------------------------------------------------------------- - -// protected -bool kpTool::shiftPressed () const -{ - return d->shiftPressed; -} - -//--------------------------------------------------------------------- - -// protected -bool kpTool::controlPressed () const -{ - return d->controlPressed; -} - -//--------------------------------------------------------------------- - -// protected -bool kpTool::altPressed () const -{ - return d->altPressed; -} - - -// protected -QPoint kpTool::startPoint () const -{ - return d->startPoint; -} - -//--------------------------------------------------------------------- - -// protected -QPoint kpTool::currentPoint () const -{ - // TODO: Q_ASSERT (hasBegun()) and similar in other accessors. - // We currently violate these kinds of invariants. - return d->currentPoint; -} - -//--------------------------------------------------------------------- - -// protected -QPoint kpTool::currentViewPoint () const -{ - return d->currentViewPoint; -} - -//--------------------------------------------------------------------- - -// protected -QRect kpTool::normalizedRect () const -{ - return kpPainter::normalizedRect(d->startPoint, d->currentPoint); -} - -//--------------------------------------------------------------------- - -// protected -QPoint kpTool::lastPoint () const -{ - return d->lastPoint; -} - -//--------------------------------------------------------------------- - -// protected -kpView *kpTool::viewUnderStartPoint () const -{ - return d->viewUnderStartPoint; -} - -//--------------------------------------------------------------------- - -// protected -kpView *kpTool::viewUnderCursor () const -{ - kpViewManager *vm = viewManager (); - return vm ? vm->viewUnderCursor () : 0; -} - -//--------------------------------------------------------------------- - -void kpTool::beginInternal () -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::beginInternal()"; -#endif - - if (!d->began) - { - // clear leftover statusbar messages - setUserMessage (); - d->currentPoint = calculateCurrentPoint (); - d->currentViewPoint = calculateCurrentPoint (false/*view point*/); - setUserShapePoints (d->currentPoint); - - // TODO: Audit all the code in this file - states like "d->began" & - // "d->beganDraw" should be set before calling user func. - // Also, d->currentPoint should be more frequently initialised. - - // call user virtual func - begin (); - - // we've starting using the tool... - d->began = true; - - // but we haven't started drawing with it - d->beganDraw = false; - - - uint keyState = QApplication::keyboardModifiers (); - - d->shiftPressed = (keyState & Qt::ShiftModifier); - d->controlPressed = (keyState & Qt::ControlModifier); - - // TODO: Can't do much about ALT - unless it's always KApplication::Modifier1? - // Ditto for everywhere else where I set SHIFT & CTRL but not alt. - // COMPAT: Later: This is now supported by Qt. - d->altPressed = false; - } -} - -//--------------------------------------------------------------------- - -void kpTool::endInternal () -{ - if (d->began) - { - // before we can stop using the tool, we must stop the current drawing operation (if any) - if (hasBegunShape ()) - endShapeInternal (d->currentPoint, normalizedRect ()); - - // call user virtual func - end (); - - // clear leftover statusbar messages - setUserMessage (); - setUserShapePoints (calculateCurrentPoint ()); - - // we've stopped using the tool... - d->began = false; - - // and so we can't be drawing with it - d->beganDraw = false; - - d->environ->hideAllToolWidgets (); - } -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::begin () -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::begin() base implementation"; -#endif -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::end () -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::end() base implementation"; -#endif -} - -//--------------------------------------------------------------------- - - -bool kpTool::hasBegun () const { return d->began; } - -//--------------------------------------------------------------------- - -bool kpTool::hasBegunDraw () const { return d->beganDraw; } - -//--------------------------------------------------------------------- - -// virtual -bool kpTool::hasBegunShape () const { return hasBegunDraw (); } - -//--------------------------------------------------------------------- - - -void kpTool::beginDrawInternal () -{ - if (!d->beganDraw) - { - beginDraw (); - - d->beganDraw = true; - emit beganDraw (d->currentPoint); - } -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::beginDraw () -{ -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::hover (const QPoint &point) -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::hover" << point - << " base implementation" - << endl; -#endif - - setUserShapePoints (point); -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::globalDraw () -{ -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::reselect () -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::reselect() base implementation"; -#endif -} - -//--------------------------------------------------------------------- - - -// virtual -void kpTool::draw (const QPoint &, const QPoint &, const QRect &) -{ -} - -//--------------------------------------------------------------------- - -// private -void kpTool::drawInternal () -{ - draw (d->currentPoint, d->lastPoint, normalizedRect ()); -} - -//--------------------------------------------------------------------- - - -// also called by kpView -void kpTool::cancelShapeInternal () -{ - if (hasBegunShape ()) - { - d->beganDraw = false; - cancelShape (); - d->viewUnderStartPoint = 0; - - emit cancelledShape (viewUnderCursor () ? d->currentPoint : KP_INVALID_POINT); - - if (viewUnderCursor ()) - hover (d->currentPoint); - else - { - d->currentPoint = KP_INVALID_POINT; - d->currentViewPoint = KP_INVALID_POINT; - hover (d->currentPoint); - } - - if (returnToPreviousToolAfterEndDraw ()) - { - d->environ->selectPreviousTool (); - } - } -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::cancelShape () -{ - kWarning () << "Tool cannot cancel operation!" ; -} - -//--------------------------------------------------------------------- - -void kpTool::releasedAllButtons () -{ -} - -//--------------------------------------------------------------------- - -void kpTool::endDrawInternal (const QPoint &thisPoint, const QRect &normalizedRect, - bool wantEndShape) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::endDrawInternal() wantEndShape=" << wantEndShape; -#endif - - if (wantEndShape && !hasBegunShape ()) - return; - else if (!wantEndShape && !hasBegunDraw ()) - return; - - d->beganDraw = false; - - if (wantEndShape) - { - #if DEBUG_KP_TOOL && 0 - kDebug () << "\tcalling endShape()"; - #endif - endShape (thisPoint, normalizedRect); - } - else - { - #if DEBUG_KP_TOOL && 0 - kDebug () << "\tcalling endDraw()"; - #endif - endDraw (thisPoint, normalizedRect); - } - d->viewUnderStartPoint = 0; - - emit endedDraw (d->currentPoint); - if (viewUnderCursor ()) - hover (d->currentPoint); - else - { - d->currentPoint = KP_INVALID_POINT; - d->currentViewPoint = KP_INVALID_POINT; - hover (d->currentPoint); - } - - if (returnToPreviousToolAfterEndDraw ()) - { - d->environ->selectPreviousTool (); - } -} - -//--------------------------------------------------------------------- - -// private -void kpTool::endShapeInternal (const QPoint &thisPoint, const QRect &normalizedRect) -{ - endDrawInternal (thisPoint, normalizedRect, true/*end shape*/); -} - -//--------------------------------------------------------------------- - -// virtual -void kpTool::endDraw (const QPoint &, const QRect &) -{ -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/kpTool_KeyboardEvents.cpp b/kolourpaint/tools/kpTool_KeyboardEvents.cpp deleted file mode 100644 index f81dcfab..00000000 --- a/kolourpaint/tools/kpTool_KeyboardEvents.cpp +++ /dev/null @@ -1,412 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool reaction to view keyboard input. -// - - -#define DEBUG_KP_TOOL 0 - - -// TODO: reduce number of includes -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -void kpTool::seeIfAndHandleModifierKey (QKeyEvent *e) -{ - switch (e->key ()) - { - case 0: - case Qt::Key_unknown: - #if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::seeIfAndHandleModifierKey() picked up unknown key!"; - #endif - // HACK: around Qt bug: if you hold a modifier before you start the - // program and then release it over the view, - // Qt reports it as the release of an unknown key - // Qt4 update: I don't think this happens anymore... - // --- fall thru and update all modifiers --- - - case Qt::Key_Alt: - case Qt::Key_Shift: - case Qt::Key_Control: - #if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::setIfAndHandleModifierKey() accepting"; - #endif - keyUpdateModifierState (e); - - e->accept (); - break; - } -} - -//--------------------------------------------------------------------- - -// Returns in and the direction the arrow key "e->key()" is -// pointing in or (0,0) if it's not a recognised arrow key. -void kpTool::arrowKeyPressDirection (const QKeyEvent *e, int *dx, int *dy) -{ - int dxLocal = 0, dyLocal = 0; - - switch (e->key ()) - { - case Qt::Key_Home: dxLocal = -1, dyLocal = -1; break; - case Qt::Key_Up: dyLocal = -1; break; - case Qt::Key_PageUp: dxLocal = +1, dyLocal = -1; break; - - case Qt::Key_Left: dxLocal = -1; break; - case Qt::Key_Right: dxLocal = +1; break; - - case Qt::Key_End: dxLocal = -1, dyLocal = +1; break; - case Qt::Key_Down: dyLocal = +1; break; - case Qt::Key_PageDown: dxLocal = +1, dyLocal = +1; break; - } - - if (dx) - *dx = dxLocal; - if (dy) - *dy = dyLocal; -} - -//--------------------------------------------------------------------- - -void kpTool::seeIfAndHandleArrowKeyPress (QKeyEvent *e) -{ - int dx, dy; - - arrowKeyPressDirection (e, &dx, &dy); - if (dx == 0 && dy == 0) - return; - - - kpView * const view = viewUnderCursor (); - if (!view) - return; - - - const QPoint oldPoint = view->mapFromGlobal (QCursor::pos ()); -#if DEBUG_KP_TOOL && 0 - kDebug () << "\toldPoint=" << oldPoint - << " dx=" << dx << " dy=" << dy << endl; -#endif - - - const int viewIncX = (dx ? qMax (1, view->zoomLevelX () / 100) * dx : 0); - const int viewIncY = (dy ? qMax (1, view->zoomLevelY () / 100) * dy : 0); - - int newViewX = oldPoint.x () + viewIncX; - int newViewY = oldPoint.y () + viewIncY; - - -#if DEBUG_KP_TOOL && 0 - kDebug () << "\tnewPoint=" << QPoint (newViewX, newViewY); -#endif - - // Make sure we really moved at least one doc point (needed due to - // rounding error). - - if (view->transformViewToDoc (QPoint (newViewX, newViewY)) == - view->transformViewToDoc (oldPoint)) - { - newViewX += viewIncX, newViewY += viewIncY; - - #if DEBUG_KP_TOOL && 0 - kDebug () << "\tneed adjust for doc - newPoint=" - << QPoint (newViewX, newViewY) << endl; - #endif - } - - - // TODO: visible width/height (e.g. with scrollbars) - const int x = qMin (qMax (newViewX, 0), view->width () - 1); - const int y = qMin (qMax (newViewY, 0), view->height () - 1); - - // QCursor::setPos conveniently causes mouseMoveEvents - QCursor::setPos (view->mapToGlobal (QPoint (x, y))); - e->accept (); -} - -//--------------------------------------------------------------------- - -bool kpTool::isDrawKey (int key) -{ - return (key == Qt::Key_Enter || - key == Qt::Key_Return || - key == Qt::Key_Insert || - key == Qt::Key_Clear/*Numpad 5 Key*/ || - key == Qt::Key_L); -} - -//--------------------------------------------------------------------- - -void kpTool::seeIfAndHandleBeginDrawKeyPress (QKeyEvent *e) -{ - if (e->isAutoRepeat ()) - return; - - if (!isDrawKey (e->key ())) - return; - -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::seeIfAndHandleBeginDrawKeyPress() accept"; -#endif - - - // TODO: wrong for dragging lines outside of view (for e.g.) - kpView * const view = viewUnderCursor (); - if (!view) - return; - - - // TODO: what about the modifiers? - QMouseEvent me (QEvent::MouseButtonPress, - view->mapFromGlobal (QCursor::pos ()), - Qt::LeftButton, - Qt::LeftButton/*button state after event*/, - Qt::NoModifier); - mousePressEvent (&me); - e->accept (); -} - -void kpTool::seeIfAndHandleEndDrawKeyPress (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::setIfAndHandleEndDrawKeyPress() key=" << e->key () - << " isAutoRepeat=" << e->isAutoRepeat () - << " isDrawKey=" << isDrawKey (e->key ()) - << " view=" << viewUnderCursor () - << endl; -#endif - - if (e->isAutoRepeat ()) - return; - - if (!isDrawKey (e->key ())) - return; - -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::seeIfAndHandleEndDrawKeyPress() accept"; -#endif - - - kpView * const view = viewUnderCursor (); - if (!view) - return; - - - // TODO: what about the modifiers? - QMouseEvent me (QEvent::MouseButtonRelease, - view->mapFromGlobal (QCursor::pos ()), - Qt::LeftButton, - Qt::NoButton/*button state after event*/, - Qt::NoModifier); - mouseReleaseEvent (&me); - - e->accept (); -} - -//--------------------------------------------------------------------- - -void kpTool::keyPressEvent (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::keyPressEvent() key=" << (int *) e->key () - << " stateAfter: modifiers=" << (int *) (int) e->modifiers () - << " isAutoRep=" << e->isAutoRepeat () - << endl; -#endif - - e->ignore (); - - - seeIfAndHandleModifierKey (e); - if (e->isAccepted ()) - return; - - seeIfAndHandleArrowKeyPress (e); - if (e->isAccepted ()) - return; - - seeIfAndHandleBeginDrawKeyPress (e); - if (e->isAccepted ()) - return; - - - switch (e->key ()) - { - case Qt::Key_Delete: - d->environ->deleteSelection (); - break; - - case Qt::Key_Escape: - if (hasBegunDraw ()) - { - cancelShapeInternal (); - e->accept (); - } - - break; - } -} - -//--------------------------------------------------------------------- - -void kpTool::keyReleaseEvent (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::keyReleaseEvent() key=" << (int *) e->key () - << " stateAfter: modifiers=" << (int *) (int) e->modifiers () - << " isAutoRep=" << e->isAutoRepeat () - << endl; -#endif - - e->ignore (); - - seeIfAndHandleModifierKey (e); - if (e->isAccepted ()) - return; - - seeIfAndHandleEndDrawKeyPress (e); - if (e->isAccepted ()) - return; -} - -//--------------------------------------------------------------------- - -// private -void kpTool::keyUpdateModifierState (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::keyUpdateModifierState() e->key=" << (int *) e->key (); - kDebug () << "\tshift=" - << (e->modifiers () & Qt::ShiftModifier) - << " control=" - << (e->modifiers () & Qt::ControlModifier) - << " alt=" - << (e->modifiers () & Qt::AltModifier) - << endl; -#endif - if (e->key () & (Qt::Key_Alt | Qt::Key_Shift | Qt::Key_Control)) - { - #if DEBUG_KP_TOOL && 0 - kDebug () << "\t\tmodifier changed - use e's claims"; - #endif - setShiftPressed (e->modifiers () & Qt::ShiftModifier); - setControlPressed (e->modifiers () & Qt::ControlModifier); - setAltPressed (e->modifiers () & Qt::AltModifier); - } - // See seeIfAndHandleModifierKey() for why this code path exists. - else - { - #if DEBUG_KP_TOOL && 0 - kDebug () << "\t\tmodifiers not changed - figure out the truth"; - #endif - const Qt::KeyboardModifiers keyState = QApplication::keyboardModifiers (); - - setShiftPressed (keyState & Qt::ShiftModifier); - setControlPressed (keyState & Qt::ControlModifier); - setAltPressed (keyState & Qt::AltModifier); - } -} - -//--------------------------------------------------------------------- - -void kpTool::notifyModifierStateChanged () -{ - if (careAboutModifierState ()) - { - if (d->beganDraw) - draw (d->currentPoint, d->lastPoint, normalizedRect ()); - else - { - d->currentPoint = calculateCurrentPoint (); - d->currentViewPoint = calculateCurrentPoint (false/*view point*/); - hover (d->currentPoint); - } - } -} - -//--------------------------------------------------------------------- - -void kpTool::setShiftPressed (bool pressed) -{ - if (pressed == d->shiftPressed) - return; - - d->shiftPressed = pressed; - - notifyModifierStateChanged (); -} - -//--------------------------------------------------------------------- - -void kpTool::setControlPressed (bool pressed) -{ - if (pressed == d->controlPressed) - return; - - d->controlPressed = pressed; - - notifyModifierStateChanged (); -} - -//--------------------------------------------------------------------- - -void kpTool::setAltPressed (bool pressed) -{ - if (pressed == d->altPressed) - return; - - d->altPressed = pressed; - - notifyModifierStateChanged (); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/kpTool_MouseEvents.cpp b/kolourpaint/tools/kpTool_MouseEvents.cpp deleted file mode 100644 index 83f5d12b..00000000 --- a/kolourpaint/tools/kpTool_MouseEvents.cpp +++ /dev/null @@ -1,337 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool reaction to view mouse input. -// - -#define DEBUG_KP_TOOL 0 - -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -// HITODO: If you press a mouse button and move it out of the view _really_ fast -// and let go of the mouse button outside of the view, a mouseRelease -// event will not be generated, so the tool will still be in drawing mode -// (this is especially noticeable with the spraycan). -// -// When you move the mouse back into the view, it will still continue -// continue drawing even though no mouse button is held down. -// -// It is somewhat hard to reproduce so the best way is to position the -// mouse close to an edge of the view. If you do it right, no mouseMoveEvent -// is generated at _all_, until you move it back into the view. -void kpTool::mousePressEvent (QMouseEvent *e) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::mousePressEvent pos=" << e->pos () - << " button=" << (int) e->button () - << " stateAfter: buttons=" << (int *) (int) e->buttons () - << " modifiers=" << (int *) (int) e->modifiers () - << " beganDraw=" << d->beganDraw << endl; -#endif - - if (e->button () == Qt::MiddleButton) - { - const QString text = QApplication::clipboard ()->text (QClipboard::Selection); - #if DEBUG_KP_TOOL && 1 - kDebug () << "\tMMB pasteText='" << text << "'"; - #endif - if (!text.isEmpty ()) - { - if (hasBegunShape ()) - { - #if DEBUG_KP_TOOL && 1 - kDebug () << "\t\thasBegunShape - end"; - #endif - endShapeInternal (d->currentPoint, normalizedRect ()); - } - - if (viewUnderCursor ()) - { - d->environ->pasteTextAt (text, - viewUnderCursor ()->transformViewToDoc (e->pos ()), - true/*adjust topLeft so that cursor isn't - on top of resize handle*/); - } - - return; - } - } - - int mb = mouseButton (e->buttons ()); -#if DEBUG_KP_TOOL && 1 - kDebug () << "\tmb=" << mb << " d->beganDraw=" << d->beganDraw; -#endif - - if (mb == -1 && !d->beganDraw) - { - // Ignore mouse press. - return; - } - - if (d->beganDraw) - { - if (mb == -1 || mb != d->mouseButton) - { - #if DEBUG_KP_TOOL && 1 - kDebug () << "\tCancelling operation as " << mb << " == -1 or != " << d->mouseButton; - #endif - - kpView *view = viewUnderStartPoint (); - Q_ASSERT (view); - - // if we get a mousePressEvent when we're drawing, then the other - // mouse button must have been pressed - d->currentPoint = view->transformViewToDoc (e->pos ()); - d->currentViewPoint = e->pos (); - cancelShapeInternal (); - } - - return; - } - - kpView *view = viewUnderCursor (); - Q_ASSERT (view); - -#if DEBUG_KP_TOOL && 1 - if (view) - kDebug () << "\tview=" << view->objectName (); -#endif - - - // let user know what mouse button is being used for entire draw - d->mouseButton = mouseButton (e->buttons ()); - d->shiftPressed = (e->modifiers () & Qt::ShiftModifier); - d->controlPressed = (e->modifiers () & Qt::ControlModifier); - d->altPressed = (e->modifiers () & Qt::AltModifier); - d->startPoint = d->currentPoint = view->transformViewToDoc (e->pos ()); - d->currentViewPoint = e->pos (); - d->viewUnderStartPoint = view; - d->lastPoint = QPoint (-1, -1); - -#if DEBUG_KP_TOOL && 1 - kDebug () << "\tBeginning draw @ " << d->currentPoint; -#endif - - beginDrawInternal (); - - draw (d->currentPoint, d->lastPoint, QRect (d->currentPoint, d->currentPoint)); - d->lastPoint = d->currentPoint; -} - -//--------------------------------------------------------------------- - -// OPT: If the mouse is moving in terms of view pixels, it still might -// not be moving in terms of document pixels (when zoomed in). -// -// So we should detect this and not call draw() or hover(). -// -// However, kpToolSelection needs hover() to be called on all view -// point changes, not just document points, since the selection resize -// handles may be smaller than document points. Also, I wonder if -// selections' accidental drag detection feature cares? -void kpTool::mouseMoveEvent (QMouseEvent *e) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::mouseMoveEvent pos=" << e->pos () - << " stateAfter: buttons=" << (int *) (int) e->buttons () - << " modifiers=" << (int *) (int) e->modifiers (); - kpView *v0 = viewUnderCursor (), - *v1 = viewManager ()->viewUnderCursor (true/*use Qt*/), - *v2 = viewUnderStartPoint (); - kDebug () << "\tviewUnderCursor=" << (v0 ? v0->objectName () : "(none)") - << " viewUnderCursorQt=" << (v1 ? v1->objectName () : "(none)") - << " viewUnderStartPoint=" << (v2 ? v2->objectName () : "(none)"); - kDebug () << "\tfocusWidget=" << kapp->focusWidget (); - kDebug () << "\tbeganDraw=" << d->beganDraw; -#endif - - d->shiftPressed = (e->modifiers () & Qt::ShiftModifier); - d->controlPressed = (e->modifiers () & Qt::ControlModifier); - d->altPressed = (e->modifiers () & Qt::AltModifier); - - if (d->beganDraw) - { - kpView *view = viewUnderStartPoint (); - Q_ASSERT (view); - - d->currentPoint = view->transformViewToDoc (e->pos ()); - d->currentViewPoint = e->pos (); - - #if DEBUG_KP_TOOL && 0 - kDebug () << "\tDraw!"; - #endif - - bool dragScrolled = false; - movedAndAboutToDraw (d->currentPoint, d->lastPoint, view->zoomLevelX (), &dragScrolled); - - if (dragScrolled) - { - d->currentPoint = calculateCurrentPoint (); - d->currentViewPoint = calculateCurrentPoint (false/*view point*/); - - // Scrollview has scrolled contents and has scheduled an update - // for the newly exposed region. If draw() schedules an update - // as well (instead of immediately updating), the scrollview's - // update will be executed first and it'll only update part of - // the screen resulting in ugly tearing of the viewManager's - // tempImage. - viewManager ()->setFastUpdates (); - } - - drawInternal (); - - if (dragScrolled) - viewManager ()->restoreFastUpdates (); - - d->lastPoint = d->currentPoint; - } - else - { - kpView *view = viewUnderCursor (); - if (!view) // possible if cancelShape()'ed but still holding down initial mousebtn - { - d->currentPoint = KP_INVALID_POINT; - d->currentViewPoint = KP_INVALID_POINT; - return; - } - - d->currentPoint = view->transformViewToDoc (e->pos ()); - d->currentViewPoint = e->pos (); - hover (d->currentPoint); - } -} - -//--------------------------------------------------------------------- - -void kpTool::mouseReleaseEvent (QMouseEvent *e) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::mouseReleaseEvent pos=" << e->pos () - << " button=" << (int) e->button () - << " stateAfter: buttons=" << (int *) (int) e->buttons () - << " modifiers=" << (int *) (int) e->modifiers () - << " beganDraw=" << d->beganDraw << endl; -#endif - - // Have _not_ already cancelShape()'ed by pressing other mouse button? - // (e.g. you can cancel a line dragged out with the LMB, by pressing - // the RMB) - if (d->beganDraw) - { - kpView *view = viewUnderStartPoint (); - Q_ASSERT (view); - - d->currentPoint = view->transformViewToDoc (e->pos ()); - d->currentViewPoint = e->pos (); - - drawInternal (); - - endDrawInternal (d->currentPoint, normalizedRect ()); - } - - if ((e->buttons () & Qt::MouseButtonMask) == 0) - { - releasedAllButtons (); - } -} - -//--------------------------------------------------------------------- - -void kpTool::wheelEvent (QWheelEvent *e) -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::wheelEvent() modifiers=" << (int *) (int) e->modifiers () - << " hasBegunDraw=" << hasBegunDraw () - << " delta=" << e->delta () - << endl; -#endif - - e->ignore (); - - // If CTRL not pressed, bye. - if ((e->modifiers () & Qt::ControlModifier) == 0) - { - #if DEBUG_KP_TOOL - kDebug () << "\tno CTRL -> bye"; - #endif - return; - } - - // If drawing, bye; don't care if a shape in progress though. - if (hasBegunDraw ()) - { - #if DEBUG_KP_TOOL - kDebug () << "\thasBegunDraw() -> bye"; - #endif - return; - } - - - // Zoom in/out depending on wheel direction. - - // Moved wheel away from user? - if (e->delta () > 0) - { - #if DEBUG_KP_TOOL - kDebug () << "\tzoom in"; - #endif - d->environ->zoomIn (true/*center under cursor*/); - e->accept (); - } - // Moved wheel towards user? - else if (e->delta () < 0) - { - #if DEBUG_KP_TOOL - kDebug () << "\tzoom out"; - #endif - #if 1 - d->environ->zoomOut (true/*center under cursor - make zoom in/out - stay under same doc pos*/); - #else - d->environ->zoomOut (false/*don't center under cursor - as is - confusing behaviour when zooming - out*/); - #endif - e->accept (); - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/kpTool_OtherEvents.cpp b/kolourpaint/tools/kpTool_OtherEvents.cpp deleted file mode 100644 index 2ccd54eb..00000000 --- a/kolourpaint/tools/kpTool_OtherEvents.cpp +++ /dev/null @@ -1,166 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool reaction to all remaining events. -// -// 1. View events -// 2. Non-view events -// - - -#define DEBUG_KP_TOOL 0 - - -#include -#include - -#include - -#include - -//--------------------------------------------------------------------- - -// -// 1. View Events -// - -bool kpTool::viewEvent (QEvent *e) -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool<" << objectName () - << "," << this << ">::viewEvent(type=" << e->type () - << ") returning false" << endl; -#else - (void) e; -#endif - - // Don't handle. - return false; -} - -//--------------------------------------------------------------------- - -void kpTool::focusInEvent (QFocusEvent *) -{ -} - -//--------------------------------------------------------------------- - -void kpTool::focusOutEvent (QFocusEvent *) -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::focusOutEvent() beganDraw=" << d->beganDraw; -#endif - - if (d->beganDraw) - endDrawInternal (d->currentPoint, normalizedRect ()); -} - -//--------------------------------------------------------------------- - -void kpTool::enterEvent (QEvent *) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::enterEvent() beganDraw=" << d->beganDraw; -#endif -} - -//--------------------------------------------------------------------- - -void kpTool::leaveEvent (QEvent *) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::leaveEvent() beganDraw=" << d->beganDraw; -#endif - - // if we haven't started drawing (e.g. dragging a rectangle)... - if (!d->beganDraw) - { - d->currentPoint = KP_INVALID_POINT; - d->currentViewPoint = KP_INVALID_POINT; - hover (d->currentPoint); - } -} - -//--------------------------------------------------------------------- -// -// 2. Non-view events -// - -void kpTool::slotColorsSwappedInternal (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor) -{ - if (careAboutColorsSwapped ()) - { - slotColorsSwapped (newForegroundColor, newBackgroundColor); - d->ignoreColorSignals = 2; - } - else - d->ignoreColorSignals = 0; -} - -//--------------------------------------------------------------------- - -void kpTool::slotForegroundColorChangedInternal (const kpColor &color) -{ - if (d->ignoreColorSignals > 0) - { - #if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::slotForegroundColorChangedInternal() ignoreColorSignals=" << d->ignoreColorSignals; - #endif - d->ignoreColorSignals--; - return; - } - - slotForegroundColorChanged (color); -} - -//--------------------------------------------------------------------- - -void kpTool::slotBackgroundColorChangedInternal (const kpColor &color) -{ - if (d->ignoreColorSignals > 0) - { - #if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::slotBackgroundColorChangedInternal() ignoreColorSignals=" << d->ignoreColorSignals; - #endif - d->ignoreColorSignals--; - return; - } - - slotBackgroundColorChanged (color); -} - -//--------------------------------------------------------------------- - -void kpTool::slotColorSimilarityChangedInternal (double similarity, int processedSimilarity) -{ - slotColorSimilarityChanged (similarity, processedSimilarity); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/kpTool_UserNotifications.cpp b/kolourpaint/tools/kpTool_UserNotifications.cpp deleted file mode 100644 index 2c65063c..00000000 --- a/kolourpaint/tools/kpTool_UserNotifications.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tools' statusbar updates. -// - -#include -#include - -#include - -//--------------------------------------------------------------------- - -// public static -QString kpTool::cancelUserMessage (int mouseButton) -{ - if (mouseButton == 0) - return i18n ("Right click to cancel."); - else - return i18n ("Left click to cancel."); -} - -//--------------------------------------------------------------------- - -// public -QString kpTool::cancelUserMessage () const -{ - return cancelUserMessage (d->mouseButton); -} - -//--------------------------------------------------------------------- - -// public -QString kpTool::userMessage () const -{ - return d->userMessage; -} - -//--------------------------------------------------------------------- - -// public -void kpTool::setUserMessage (const QString &userMessage) -{ - d->userMessage = userMessage; - - if (d->userMessage.isEmpty ()) - d->userMessage = text (); - else - d->userMessage.prepend (i18n ("%1: ", text ())); - - emit userMessageChanged (d->userMessage); -} - -//--------------------------------------------------------------------- - -// public -QPoint kpTool::userShapeStartPoint () const -{ - return d->userShapeStartPoint; -} - -//--------------------------------------------------------------------- - -// public -QPoint kpTool::userShapeEndPoint () const -{ - return d->userShapeEndPoint; -} - -//--------------------------------------------------------------------- - -// public -void kpTool::setUserShapePoints (const QPoint &startPoint, - const QPoint &endPoint, - bool setSize) -{ - d->userShapeStartPoint = startPoint; - d->userShapeEndPoint = endPoint; - emit userShapePointsChanged (d->userShapeStartPoint, d->userShapeEndPoint); - - if (setSize) - { - if (startPoint != KP_INVALID_POINT && - endPoint != KP_INVALID_POINT) - { - setUserShapeSize (calculateLength (startPoint.x (), endPoint.x ()), - calculateLength (startPoint.y (), endPoint.y ())); - } - else - { - setUserShapeSize (); - } - } -} - -//--------------------------------------------------------------------- - -// public -QSize kpTool::userShapeSize () const -{ - return d->userShapeSize; -} - -//--------------------------------------------------------------------- - -// public -int kpTool::userShapeWidth () const -{ - return d->userShapeSize.width (); -} - -//--------------------------------------------------------------------- - -// public -int kpTool::userShapeHeight () const -{ - return d->userShapeSize.height (); -} - -//--------------------------------------------------------------------- - -// public -void kpTool::setUserShapeSize (const QSize &size) -{ - d->userShapeSize = size; - - emit userShapeSizeChanged (d->userShapeSize); - emit userShapeSizeChanged (d->userShapeSize.width (), - d->userShapeSize.height ()); -} - -//--------------------------------------------------------------------- - -// public -void kpTool::setUserShapeSize (int width, int height) -{ - setUserShapeSize (QSize (width, height)); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/kpTool_Utilities.cpp b/kolourpaint/tools/kpTool_Utilities.cpp deleted file mode 100644 index e9f2b7c7..00000000 --- a/kolourpaint/tools/kpTool_Utilities.cpp +++ /dev/null @@ -1,291 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// -// Tool utility methods - mainly for subclasses' convenience. -// - - -#define DEBUG_KP_TOOL 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// static -QRect kpTool::neededRect (const QRect &rect, int lineWidth) -{ - int x1, y1, x2, y2; - rect.getCoords (&x1, &y1, &x2, &y2); - - if (lineWidth < 1) - lineWidth = 1; - - // TODO: why not divide by 2? - return QRect (QPoint (x1 - lineWidth + 1, y1 - lineWidth + 1), - QPoint (x2 + lineWidth - 1, y2 + lineWidth - 1)); -} - -//--------------------------------------------------------------------- - -// static -QImage kpTool::neededPixmap (const QImage &image, const QRect &boundingRect) -{ - return kpPixmapFX::getPixmapAt (image, boundingRect); -} - -//--------------------------------------------------------------------- - -// public -bool kpTool::hasCurrentPoint () const -{ - return (viewUnderStartPoint () || viewUnderCursor ()); -} - -//--------------------------------------------------------------------- - -// public -QPoint kpTool::calculateCurrentPoint (bool zoomToDoc) const -{ -#if DEBUG_KP_TOOL && 0 - kDebug () << "kpTool::currentPoint(zoomToDoc=" << zoomToDoc << ")"; - kDebug () << "\tviewUnderStartPoint=" - << (viewUnderStartPoint () ? viewUnderStartPoint ()->objectName () : "(none)") - << " viewUnderCursor=" - << (viewUnderCursor () ? viewUnderCursor ()->objectName () : "(none)") - << endl; -#endif - - kpView *v = viewUnderStartPoint (); - if (!v) - { - v = viewUnderCursor (); - if (!v) - { - #if DEBUG_KP_TOOL && 0 - kDebug () << "\tno view - returning sentinel"; - #endif - return KP_INVALID_POINT; - } - } - - - const QPoint globalPos = QCursor::pos (); - const QPoint viewPos = v->mapFromGlobal (globalPos); -#if DEBUG_KP_TOOL && 0 - kDebug () << "\tglobalPos=" << globalPos - << " viewPos=" << viewPos - << endl; -#endif - if (!zoomToDoc) - return viewPos; - - - const QPoint docPos = v->transformViewToDoc (viewPos); -#if DEBUG_KP_TOOL && 0 - kDebug () << "\tdocPos=" << docPos; -#endif - return docPos; -} - -//--------------------------------------------------------------------- - -// public slot -void kpTool::somethingBelowTheCursorChanged () -{ - somethingBelowTheCursorChanged (calculateCurrentPoint (), - calculateCurrentPoint (false/*view point*/)); -} - -//--------------------------------------------------------------------- - -// private -// TODO: don't dup code from mouseMoveEvent() -void kpTool::somethingBelowTheCursorChanged (const QPoint ¤tPoint_, - const QPoint ¤tViewPoint_) -{ -#if DEBUG_KP_TOOL && 1 - kDebug () << "kpTool::somethingBelowTheCursorChanged(docPoint=" - << currentPoint_ - << " viewPoint=" - << currentViewPoint_ - << ")" << endl; - kDebug () << "\tviewUnderStartPoint=" - << (viewUnderStartPoint () ? viewUnderStartPoint ()->objectName () : "(none)") - << " viewUnderCursor=" - << (viewUnderCursor () ? viewUnderCursor ()->objectName () : "(none)") - << endl; - kDebug () << "\tbegan draw=" << d->beganDraw; -#endif - - d->currentPoint = currentPoint_; - d->currentViewPoint = currentViewPoint_; - - if (d->beganDraw) - { - if (d->currentPoint != KP_INVALID_POINT) - { - draw (d->currentPoint, d->lastPoint, normalizedRect ()); - d->lastPoint = d->currentPoint; - } - } - else - { - hover (d->currentPoint); - } -} - -//--------------------------------------------------------------------- - -bool kpTool::currentPointNextToLast () const -{ - if (d->lastPoint == QPoint (-1, -1)) - return true; - - int dx = qAbs (d->currentPoint.x () - d->lastPoint.x ()); - int dy = qAbs (d->currentPoint.y () - d->lastPoint.y ()); - - return (dx <= 1 && dy <= 1); -} - -//--------------------------------------------------------------------- - -bool kpTool::currentPointCardinallyNextToLast () const -{ - if (d->lastPoint == QPoint (-1, -1)) - return true; - - return (d->currentPoint == d->lastPoint || - kpPainter::pointsAreCardinallyAdjacent (d->currentPoint, d->lastPoint)); -} - -//--------------------------------------------------------------------- - -// static -// TODO: we don't handle Qt::XButton1 and Qt::XButton2 at the moment. -int kpTool::mouseButton (Qt::MouseButtons mouseButtons) -{ - // we have nothing to do with mid-buttons - if (mouseButtons & Qt::MiddleButton) - return -1; - - // both left & right together is quite meaningless... - const Qt::MouseButtons bothButtons = (Qt::LeftButton | Qt::RightButton); - if ((mouseButtons & bothButtons) == bothButtons) - return -1; - - if (mouseButtons & Qt::LeftButton) - return 0; - else if (mouseButtons & Qt::RightButton) - return 1; - else - return -1; -} - -//--------------------------------------------------------------------- - -// public static -int kpTool::calculateLength (int start, int end) -{ - if (start <= end) - { - return end - start + 1; - } - else - { - return end - start - 1; - } -} - -//--------------------------------------------------------------------- - -// public static -bool kpTool::warnIfBigImageSize (int oldWidth, int oldHeight, - int newWidth, int newHeight, - const QString &text, - const QString &caption, - const QString &continueButtonText, - QWidget *parent) -{ -#if DEBUG_KP_TOOL - kDebug () << "kpTool::warnIfBigImageSize()" - << " old: w=" << oldWidth << " h=" << oldWidth - << " new: w=" << newWidth << " h=" << newHeight - << " pixmapSize=" - << kpPixmapFX::pixmapSize (newWidth, - newHeight, - QPixmap::defaultDepth ()) - << " vs BigImageSize=" << KP_BIG_IMAGE_SIZE - << endl; -#endif - - // Only got smaller or unchanged - don't complain - if (!(newWidth > oldWidth || newHeight > oldHeight)) - { - return true; - } - - // Was already large - user was warned before, don't annoy him/her again - if (kpCommandSize::PixmapSize (oldWidth, oldHeight, QPixmap::defaultDepth ()) >= - KP_BIG_IMAGE_SIZE) - { - return true; - } - - if (kpCommandSize::PixmapSize (newWidth, newHeight, QPixmap::defaultDepth ()) >= - KP_BIG_IMAGE_SIZE) - { - int accept = KMessageBox::warningContinueCancel (parent, - text, - caption, - KGuiItem (continueButtonText), - KStandardGuiItem::cancel(), - QLatin1String ("BigImageDontAskAgain")); - - return (accept == KMessageBox::Continue); - } - else - { - return true; - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/polygonal/kpToolCurve.cpp b/kolourpaint/tools/polygonal/kpToolCurve.cpp deleted file mode 100644 index 6a41caa1..00000000 --- a/kolourpaint/tools/polygonal/kpToolCurve.cpp +++ /dev/null @@ -1,182 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_CURVE 0 - - -#include - -#include -#include - -#include - - -static void DrawCurveShape (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal) -{ - (void) bcolor; - (void) isFinal; - - Q_ASSERT (points.count () >= 2 && points.count () <= 4); - - const QPoint startPoint = points [0]; - const QPoint endPoint = points [1]; - - QPoint controlPointP, controlPointQ; - - switch (points.count ()) - { - // Just a line? - case 2: - controlPointP = startPoint; - controlPointQ = endPoint; - break; - - // Single control point? - case 3: - controlPointP = controlPointQ = points [2]; - break; - - // Two control points? - case 4: - controlPointP = points [2]; - controlPointQ = points [3]; - break; - } - - kpPainter::drawCurve (image, - startPoint, - controlPointP, controlPointQ, - endPoint, - fcolor, penWidth); -} - - -kpToolCurve::kpToolCurve (kpToolEnvironment *environ, QObject *parent) - : kpToolPolygonalBase ( - i18n ("Curve"), - i18n ("Draws curves"), - &::DrawCurveShape, - Qt::Key_V, - environ, parent, - "tool_curve") -{ -} - -kpToolCurve::~kpToolCurve () -{ -} - - -// protected virtual [base kpToolPolygonalBase] -QString kpToolCurve::haventBegunShapeUserMessage () const -{ - return i18n ("Drag out the start and end points."); -} - - -// protected virtual [base kpToolPolygonalBase] -bool kpToolCurve::drawingALine () const -{ - // On the initial drag (consisting of 2 points) creates a line. - // Future drags are for control points. - return (points ()->count () == 2); -} - - -// public virtual [base kpTool] -void kpToolCurve::endDraw (const QPoint &, const QRect &) -{ -#if DEBUG_KP_TOOL_CURVE - kDebug () << "kpToolCurve::endDraw() points=" - << points ()->toList () << endl; -#endif - - switch (points ()->count ()) - { - // A click of the other mouse button (to finish shape, instead of adding - // another control point) would have caused endShape() to have been - // called in kpToolPolygonalBase::beginDraw(). The points list would now - // be empty. We are being called by kpTool::mouseReleaseEvent(). - case 0: - break; - - case 1: - Q_ASSERT (!"kpToolPolygonalBase::beginDraw() ensures we have >= 2 ctrl points"); - break; - - // Just completed initial line? - case 2: - if (originatingMouseButton () == 0) - { - setUserMessage ( - i18n ("Left drag to set the first control point or right click to finish.")); - } - else - { - setUserMessage ( - i18n ("Right drag to set the first control point or left click to finish.")); - } - - break; - - // Have initial line and first control point? - case 3: - if (originatingMouseButton () == 0) - { - setUserMessage ( - i18n ("Left drag to set the last control point or right click to finish.")); - } - else - { - setUserMessage ( - i18n ("Right drag to set the last control point or left click to finish.")); - } - - break; - - // Have initial line and both control points? - case 4: - #if DEBUG_KP_TOOL_CURVE - kDebug () << "\tending shape"; - #endif - endShape (); - break; - - default: - Q_ASSERT (!"Impossible number of points"); - break; - } -} - - -#include "moc_kpToolCurve.cpp" diff --git a/kolourpaint/tools/polygonal/kpToolCurve.h b/kolourpaint/tools/polygonal/kpToolCurve.h deleted file mode 100644 index 892873be..00000000 --- a/kolourpaint/tools/polygonal/kpToolCurve.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_CURVE_H -#define KP_TOOL_CURVE_H - - -#include - - -class kpToolCurve : public kpToolPolygonalBase -{ -Q_OBJECT - -public: - kpToolCurve (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolCurve (); - -protected: - virtual QString haventBegunShapeUserMessage () const; - - virtual bool drawingALine () const; - -public: - virtual void endDraw (const QPoint &, const QRect &); -}; - - -#endif // KP_TOOL_CURVE_H diff --git a/kolourpaint/tools/polygonal/kpToolLine.cpp b/kolourpaint/tools/polygonal/kpToolLine.cpp deleted file mode 100644 index 939e76b5..00000000 --- a/kolourpaint/tools/polygonal/kpToolLine.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_LINE 0 - - -#include - -#include -#include - -#include - - -static void DrawLineShape (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal) -{ - Q_ASSERT (points.count () == 2); - - kpToolPolyline::DrawShape (image, - points, - fcolor, penWidth, - bcolor, - isFinal); -} - - -kpToolLine::kpToolLine (kpToolEnvironment *environ, QObject *parent) - : kpToolPolygonalBase ( - i18n ("Line"), - i18n ("Draws lines"), - &::DrawLineShape, - Qt::Key_L, - environ, parent, - "tool_line") -{ -} - -kpToolLine::~kpToolLine () -{ -} - - -// private virtual [base kpToolPolygonalBase] -QString kpToolLine::haventBegunShapeUserMessage () const -{ - return i18n ("Drag to draw."); -} - - -// public virtual [base kpTool] -void kpToolLine::endDraw (const QPoint &, const QRect &) -{ -#if DEBUG_KP_TOOL_LINE - kDebug () << "kpToolLine::endDraw() points=" - << points ()->toList () << endl; -#endif - - // After the first drag, we should have a line. - Q_ASSERT (points ()->count () == 2); - endShape (); -} - - -#include "moc_kpToolLine.cpp" diff --git a/kolourpaint/tools/polygonal/kpToolLine.h b/kolourpaint/tools/polygonal/kpToolLine.h deleted file mode 100644 index 435f373d..00000000 --- a/kolourpaint/tools/polygonal/kpToolLine.h +++ /dev/null @@ -1,52 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_LINE_H -#define KP_TOOL_LINE_H - - -#include - - -class kpToolLine : public kpToolPolygonalBase -{ -Q_OBJECT - -public: - kpToolLine (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolLine (); - -private: - virtual QString haventBegunShapeUserMessage () const; - -public: - virtual void endDraw (const QPoint &, const QRect &); -}; - - -#endif // KP_TOOL_LINE_H diff --git a/kolourpaint/tools/polygonal/kpToolPolygon.cpp b/kolourpaint/tools/polygonal/kpToolPolygon.cpp deleted file mode 100644 index 3627f3c6..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolygon.cpp +++ /dev/null @@ -1,162 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_POLYGON 0 - - -#include - -#include - -#include -#include - - -static void DrawPolygonShape (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal) -{ - kpPainter::drawPolygon (image, - points, - fcolor, penWidth, - bcolor, - isFinal); -} - - -struct kpToolPolygonPrivate -{ - kpToolWidgetFillStyle *toolWidgetFillStyle; -}; - -kpToolPolygon::kpToolPolygon (kpToolEnvironment *environ, QObject *parent) - : kpToolPolygonalBase ( - i18n ("Polygon"), - i18n ("Draws polygons"), - &::DrawPolygonShape, - Qt::Key_G, - environ, parent, - "tool_polygon"), - d (new kpToolPolygonPrivate ()) -{ -} - -kpToolPolygon::~kpToolPolygon () -{ - delete d; -} - - -// private virtual [base kpToolPolygonBase] -QString kpToolPolygon::haventBegunShapeUserMessage () const -{ - return i18n ("Drag to draw the first line."); -} - - -// public virtual [base kpToolPolygonalBase] -void kpToolPolygon::begin () -{ - kpToolPolygonalBase::begin (); - - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - - d->toolWidgetFillStyle = tb->toolWidgetFillStyle (); - connect (d->toolWidgetFillStyle, - SIGNAL (fillStyleChanged (kpToolWidgetFillStyle::FillStyle)), - this, - SLOT (updateShape ())); - d->toolWidgetFillStyle->show (); -} - -// public virtual [base kpToolPolygonalBase] -void kpToolPolygon::end () -{ - kpToolPolygonalBase::end (); - - disconnect (d->toolWidgetFillStyle, - SIGNAL (fillStyleChanged (kpToolWidgetFillStyle::FillStyle)), - this, - SLOT (updateShape ())); - d->toolWidgetFillStyle = 0; -} - - -// TODO: code dup with kpToolRectangle -// protected virtual [base kpToolPolygonalBase] -kpColor kpToolPolygon::drawingBackgroundColor () const -{ - const kpColor foregroundColor = color (originatingMouseButton ()); - const kpColor backgroundColor = color (1 - originatingMouseButton ()); - - return d->toolWidgetFillStyle->drawingBackgroundColor ( - foregroundColor, backgroundColor); -} - - -// public virtual [base kpTool] -// TODO: dup with kpToolPolyline but we don't want to create another level of -// inheritance and readability. -void kpToolPolygon::endDraw (const QPoint &, const QRect &) -{ -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygon::endDraw() points=" - << points ()->toList () << endl; -#endif - - // A click of the other mouse button (to finish shape, instead of adding - // another control point) would have caused endShape() to have been - // called in kpToolPolygonalBase::beginDraw(). The points list would now - // be empty. We are being called by kpTool::mouseReleaseEvent(). - if (points ()->count () == 0) - return; - - if (points ()->count () >= kpToolPolygonalBase::MaxPoints) - { - #if DEBUG_KP_TOOL_POLYGON - kDebug () << "\tending shape"; - #endif - endShape (); - return; - } - - if (originatingMouseButton () == 0) - { - setUserMessage (i18n ("Left drag another line or right click to finish.")); - } - else - { - setUserMessage (i18n ("Right drag another line or left click to finish.")); - } -} - - -#include "moc_kpToolPolygon.cpp" diff --git a/kolourpaint/tools/polygonal/kpToolPolygon.h b/kolourpaint/tools/polygonal/kpToolPolygon.h deleted file mode 100644 index 939921ca..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolygon.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_POLYGON_H -#define KP_TOOL_POLYGON_H - - -#include - - -class kpToolPolygon : public kpToolPolygonalBase -{ -Q_OBJECT - -public: - kpToolPolygon (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolPolygon (); - -private: - virtual QString haventBegunShapeUserMessage () const; - -public: - virtual void begin (); - virtual void end (); - -protected: - virtual kpColor drawingBackgroundColor () const; - -public: - virtual void endDraw (const QPoint &, const QRect &); - -private: - struct kpToolPolygonPrivate *d; -}; - - -#endif // KP_TOOL_POLYGON_H diff --git a/kolourpaint/tools/polygonal/kpToolPolygonalBase.cpp b/kolourpaint/tools/polygonal/kpToolPolygonalBase.cpp deleted file mode 100644 index b389f0ed..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolygonalBase.cpp +++ /dev/null @@ -1,501 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_POLYGON 0 - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -struct kpToolPolygonalBasePrivate -{ - kpToolPolygonalBasePrivate () - : drawShapeFunc(0), toolWidgetLineWidth(0), originatingMouseButton(-1) - { - } - - kpToolPolygonalBase::DrawShapeFunc drawShapeFunc; - - kpToolWidgetLineWidth *toolWidgetLineWidth; - - int originatingMouseButton; - - QPolygon points; -}; - -//--------------------------------------------------------------------- - -kpToolPolygonalBase::kpToolPolygonalBase ( - const QString &text, - const QString &description, - DrawShapeFunc drawShapeFunc, - int key, - kpToolEnvironment *environ, QObject *parent, - const QString &name) - - : kpTool (text, description, key, environ, parent, name), - d (new kpToolPolygonalBasePrivate ()) -{ - d->drawShapeFunc = drawShapeFunc; - - d->toolWidgetLineWidth = 0; - - // (hopefully cause crash if we use it before initialising it) - d->originatingMouseButton = -1; -} - -//--------------------------------------------------------------------- - -kpToolPolygonalBase::~kpToolPolygonalBase () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolPolygonalBase::begin () -{ - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygonalBase::begin() tb=" << tb; -#endif - - d->toolWidgetLineWidth = tb->toolWidgetLineWidth (); - connect (d->toolWidgetLineWidth, SIGNAL (lineWidthChanged (int)), - this, SLOT (updateShape ())); - d->toolWidgetLineWidth->show (); - - viewManager ()->setCursor (QCursor (Qt::ArrowCursor)); - - d->originatingMouseButton = -1; - - setUserMessage (/*virtual*/haventBegunShapeUserMessage ()); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolPolygonalBase::end () -{ - // TODO: needed? - endShape (); - - disconnect (d->toolWidgetLineWidth, - SIGNAL (lineWidthChanged (int)), - this, - SLOT (updateShape ())); - d->toolWidgetLineWidth = 0; - - viewManager ()->unsetCursor (); -} - - -void kpToolPolygonalBase::beginDraw () -{ -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygonalBase::beginDraw() d->points=" << d->points.toList () - << ", startPoint=" << startPoint () << endl; -#endif - - bool endedShape = false; - - // We now need to start with dragging out the initial line? - if (d->points.count () == 0) - { - d->originatingMouseButton = mouseButton (); - - // The line starts and ends at the start point of the drag. - // draw() will modify the last point in d->points to reflect the - // mouse drag, as the drag proceeds. - d->points.append (startPoint ()); - d->points.append (startPoint ()); - } - // Already have control points - not dragging out initial line. - else - { - // Clicking the other mouse button? - if (mouseButton () != d->originatingMouseButton) - { - // Finish shape. TODO: I suspect we need to call endShapeInternal instead. - endShape (); - endedShape = true; - } - // Are we dragging out an extra control point? - else - { - // Add another control point. - d->points.append (startPoint ()); - } - } - -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "\tafterwards, d->points=" << d->points.toList (); -#endif - - if (!endedShape) - { - // We've started dragging. Print instructions on how to cancel shape. - setUserMessage (cancelUserMessage ()); - } -} - - -// protected -void kpToolPolygonalBase::applyModifiers () -{ - const int count = d->points.count (); - - QPoint &lineStartPoint = d->points [count - 2]; - QPoint &lineEndPoint = d->points [count - 1]; - -#if DEBUG_KP_TOOL_POLYGON && 1 - kDebug () << "kpToolPolygonalBase::applyModifiers() #pts=" << count - << " line: startPt=" << lineStartPoint - << " endPt=" << lineEndPoint - << " modifiers: shift=" << shiftPressed () - << " alt=" << altPressed () - << " ctrl=" << controlPressed () - << endl; -#endif - - // angles - if (shiftPressed () || controlPressed ()) - { - int diffx = lineEndPoint.x () - lineStartPoint.x (); - int diffy = lineEndPoint.y () - lineStartPoint.y (); - - double ratio; - if (diffx == 0) - ratio = DBL_MAX; - else - ratio = fabs (double (diffy) / double (diffx)); - #if DEBUG_KP_TOOL_POLYGON && 1 - kDebug () << "\tdiffx=" << diffx << " diffy=" << diffy - << " ratio=" << ratio - << endl; - #endif - - // Shift = 0, 45, 90 - // Ctrl = 0, 30, 60, 90 - // Shift + Ctrl = 0, 30, 45, 60, 90 - double angles [10]; // "ought to be enough for anybody" - int numAngles = 0; - angles [numAngles++] = 0; - if (controlPressed ()) - angles [numAngles++] = KP_PI / 6; - if (shiftPressed ()) - angles [numAngles++] = KP_PI / 4; - if (controlPressed ()) - angles [numAngles++] = KP_PI / 3; - angles [numAngles++] = KP_PI / 2; - Q_ASSERT (numAngles <= int (sizeof (angles) / sizeof (angles [0]))); - - double angle = angles [numAngles - 1]; - for (int i = 0; i < numAngles - 1; i++) - { - double acceptingRatio = tan ((angles [i] + angles [i + 1]) / 2.0); - if (ratio < acceptingRatio) - { - angle = angles [i]; - break; - } - } - - // horizontal (dist from start not maintained) - if (fabs (KP_RADIANS_TO_DEGREES (angle) - 0) - < kpPixmapFX::AngleInDegreesEpsilon) - { - lineEndPoint = - QPoint (lineEndPoint.x (), lineStartPoint.y ()); - } - // vertical (dist from start not maintained) - else if (fabs (KP_RADIANS_TO_DEGREES (angle) - 90) - < kpPixmapFX::AngleInDegreesEpsilon) - { - lineEndPoint = - QPoint (lineStartPoint.x (), lineEndPoint.y ()); - } - // diagonal (dist from start maintained) - else - { - const double dist = sqrt ((double)(diffx * diffx + diffy * diffy)); - - #define sgn(a) ((a)<0?-1:1) - // Round distances _before_ adding to any coordinate - // (ensures consistent rounding behaviour in x & y directions) - const int newdx = qRound (dist * cos (angle) * sgn (diffx)); - const int newdy = qRound (dist * sin (angle) * sgn (diffy)); - #undef sgn - - lineEndPoint = QPoint (lineStartPoint.x () + newdx, - lineStartPoint.y () + newdy); - - #if DEBUG_KP_TOOL_POLYGON && 1 - kDebug () << "\t\tdiagonal line: dist=" << dist - << " angle=" << (angle * 180 / KP_PI) - << " endPoint=" << lineEndPoint - << endl; - #endif - } - } // if (shiftPressed () || controlPressed ()) { - - // centring - if (altPressed () && 0/*ALT is unreliable*/) - { - // start = start - diff - // = start - (end - start) - // = start - end + start - // = 2 * start - end - if (count == 2) - lineStartPoint += (lineStartPoint - lineEndPoint); - else - lineEndPoint += (lineEndPoint - lineStartPoint); - } // if (altPressed ()) { -} - - -// protected -QPolygon *kpToolPolygonalBase::points () const -{ - return &d->points; -} - - -// protected -int kpToolPolygonalBase::originatingMouseButton () const -{ - Q_ASSERT (hasBegunShape ()); - return d->originatingMouseButton; -} - - -// virtual -void kpToolPolygonalBase::draw (const QPoint &, const QPoint &, const QRect &) -{ - // A click of the other mouse button (to finish shape, instead of adding - // another control point) would have caused endShape() to have been - // called in kpToolPolygonalBase::beginDraw(). The points list would now - // be empty. We are being called by kpTool::mouseReleaseEvent(). - if (d->points.count () == 0) - return; - -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygonalBase::draw() d->points=" << d->points.toList () - << ", endPoint=" << currentPoint () << endl; -#endif - - // Update points() so that last point reflects current mouse position. - const int count = d->points.count (); - d->points [count - 1] = currentPoint (); - -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "\tafterwards, d->points=" << d->points.toList (); -#endif - - // Are we drawing a line? - if (/*virtual*/drawingALine ()) - { - // Adjust the line (end points given by the last 2 points of points()) - // in response to keyboard modifiers. - applyModifiers (); - - // Update the preview of the shape. - updateShape (); - - // Inform the user that we're dragging out a line with 2 control points. - setUserShapePoints (d->points [count - 2], d->points [count - 1]); - } - // We're modifying a point. - else - { - // Update the preview of the shape. - updateShape (); - - // Informs the user that we're just modifying a point (perhaps, a control - // point of a Bezier). - setUserShapePoints (d->points [count - 1]); - } -} - - -// TODO: code dup with kpToolRectangle -// private -kpColor kpToolPolygonalBase::drawingForegroundColor () const -{ - return color (originatingMouseButton ()); -} - -// protected virtual -kpColor kpToolPolygonalBase::drawingBackgroundColor () const -{ - return kpColor::Invalid; -} - -// TODO: code dup with kpToolRectangle -// protected slot -void kpToolPolygonalBase::updateShape () -{ - if (d->points.count () == 0) - return; - - const QRect boundingRect = kpTool::neededRect ( - d->points.boundingRect (), - d->toolWidgetLineWidth->lineWidth ()); - -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygonalBase::updateShape() boundingRect=" - << boundingRect - << " lineWidth=" - << d->toolWidgetLineWidth->lineWidth () - << endl; -#endif - - kpImage image = document ()->getImageAt (boundingRect); - - QPolygon pointsTranslated = d->points; - pointsTranslated.translate (-boundingRect.x (), -boundingRect.y ()); - - (*d->drawShapeFunc) (&image, - pointsTranslated, - drawingForegroundColor (), d->toolWidgetLineWidth->lineWidth (), - /*virtual*/drawingBackgroundColor (), - false/*not final*/); - - kpTempImage newTempImage (false/*always display*/, - kpTempImage::SetImage/*render mode*/, - boundingRect.topLeft (), - image); - - viewManager ()->setFastUpdates (); - { - viewManager ()->setTempImage (newTempImage); - } - viewManager ()->restoreFastUpdates (); -} - -// virtual -void kpToolPolygonalBase::cancelShape () -{ - viewManager ()->invalidateTempImage (); - d->points.resize (0); - - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -void kpToolPolygonalBase::releasedAllButtons () -{ - if (!hasBegunShape ()) - setUserMessage (/*virtual*/haventBegunShapeUserMessage ()); - - // --- else case already handled by endDraw() --- -} - -// public virtual [base kpTool] -void kpToolPolygonalBase::endShape (const QPoint &, const QRect &) -{ -#if DEBUG_KP_TOOL_POLYGON - kDebug () << "kpToolPolygonalBase::endShape() d->points=" - << d->points.toList () << endl; -#endif - - if (!hasBegunShape ()) - return; - - viewManager ()->invalidateTempImage (); - - QRect boundingRect = kpTool::neededRect ( - d->points.boundingRect (), - d->toolWidgetLineWidth->lineWidth ()); - - commandHistory ()->addCommand ( - new kpToolPolygonalCommand ( - text (), - d->drawShapeFunc, - d->points, boundingRect, - drawingForegroundColor (), d->toolWidgetLineWidth->lineWidth (), - /*virtual*/drawingBackgroundColor (), - environ ()->commandEnvironment ())); - - d->points.resize (0); - setUserMessage (/*virtual*/haventBegunShapeUserMessage ()); - -} - -// public virtual [base kpTool] -bool kpToolPolygonalBase::hasBegunShape () const -{ - return (d->points.count () > 0); -} - - -// virtual protected slot [base kpTool] -void kpToolPolygonalBase::slotForegroundColorChanged (const kpColor &) -{ - updateShape (); -} - -// virtual protected slot [base kpTool] -void kpToolPolygonalBase::slotBackgroundColorChanged (const kpColor &) -{ - updateShape (); -} - - -#include "moc_kpToolPolygonalBase.cpp" diff --git a/kolourpaint/tools/polygonal/kpToolPolygonalBase.h b/kolourpaint/tools/polygonal/kpToolPolygonalBase.h deleted file mode 100644 index 3427551d..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolygonalBase.h +++ /dev/null @@ -1,209 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolPolygonalBase_H -#define kpToolPolygonalBase_H - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -#include -#include -#include -#include - -class kpView; - -class kpToolWidgetFillStyle; - - -struct kpToolPolygonalBasePrivate; - -// -// This tool base class is for shapes that contain at least an initial line that -// is dragged out (i.e. at least 2 control points). -// -// The tool can also choose to allow an additional point to be added for each -// additional drag or click. -// -// To specify whichever behavior, subclasses must implement endDraw() from -// kpTool and use points(): -// -// 1. If the shape is incomplete, call setUserMessage() with a message -// telling the user what can be done next. -// 2. If the shape is complete, call endShape(). See also MaxPoints. -// -// If additional points are supported by the user's implementation of endDraw(), -// beginDraw() will enforce the following behavior: -// -// Clicking the mouse button not used for the initial line drag will -// end the shape. -// -// This behavior cannot be altered by a subclass. -// -// beginDraw() will ensure that points() contains 2 points on the initial line -// drag. It will add an extra point for each additional point that is dragged. -// -// You may wish to reimplement drawingALine() if your shape does not consist of -// just connected lines e.g. while the Curve tool, on the initial drag, creates -// a line (consisting of the 2 points returned by points()), future drags do not -// create extra lines - they actually modify the Bezier control points. -// -// The actual rendering is performed by the function passed in -// the constructor. -// -class kpToolPolygonalBase : public kpTool -{ -Q_OBJECT - -public: - // (all arguments are as per kpPainter::drawPolygon()) - typedef void (*DrawShapeFunc) (kpImage * /*image*/, - const QPolygon &/*points*/, - const kpColor &/*fcolor*/, int /*penWidth = 1*/, - const kpColor &/*bcolor = kpColor::Invalid*/, - bool /*isFinal*/); - - // - kpToolPolygonalBase (const QString &text, const QString &description, - DrawShapeFunc drawShapeFunc, - int key, - kpToolEnvironment *environ, QObject *parent, - const QString &name); - virtual ~kpToolPolygonalBase (); - - virtual bool careAboutModifierState () const { return true; } - -protected: - // The maximum number of points() we should allow (mainly, to ensure - // good performance). Enforced by implementors of endShape(). - static const int MaxPoints = 50; - - virtual QString haventBegunShapeUserMessage () const = 0; - -public: - virtual void begin (); - virtual void end (); - - virtual void beginDraw (); - -protected: - // Adjusts the current line (end points given by the last 2 points of points()) - // in response to keyboard modifiers: - // - // No modifiers: Does nothing - // Shift : Clamps the line to 45 degrees increments - // Ctrl : Clamps the line to 30 degrees increments - // Alt : [currently disabled] Makes the starting point the center - // point of the line. - // - // It is possible to depress multiple modifiers for combined effects e.g. - // Ctrl+Shift clamps the line to 30 and 45 degree increments i.e. - // 0, 30, 45, 60, 90, 120, 135, 150, 180, 210, ... degrees. - // - // This really only makes sense if drawingALine() returns true, where draw() - // will call applyModifiers() automatically. Otherwise, if it returns false, - // it doesn't really make sense to call applyModifiers() (in a hypothetical - // reimplementation of draw()) because you're not manipulating a line - but - // you can still call applyModifiers() if you want. - void applyModifiers (); - - // Returns the current points in the shape. It is updated by beginDraw() - // (see the class description). - // - // draw() sets the last point to the currentPoint(). If drawingALine(), - // draw() then calls applyModifiers(). - QPolygon *points () const; - - // Returns the mouse button for the drag that created the initial line. - // Use this - instead of mouseButton() - for determining whether you should - // use the left mouse button's or right mouse button's color. This is because - // the user presses the other mouse button to finish the shape (so mouseButton() - // will return the wrong one, after the initial line). - // - // Only valid if kpTool::hasBegunShape() returns true. - int originatingMouseButton () const; - - // Returns true if the current drag is visually a line from the 2nd last point - // of points() to the last point of points() e.g. the initial line drag for - // a Curve and all drags for a Polygon or Polyline. draw() will call - // applyModifiers() and update the statusbar with those 2 points. - // - // Returns false if the current drag only draws something based on the last - // point of points() e.g. a control point of a Bezier curve. draw() will - // _not_ call applyModifiers(). It will update the statubar with just that - // point. - // - // Reimplement this if not all points are used to construct connected lines. - // For instance, the Curve tool will return "true" to construct a line, on - // the initial drag. However, for the following 2 control points, it returns - // "false". The Curve tool realises it is an initial drag if points() only - // returns 2 points. - virtual bool drawingALine () const { return true; } -public: - virtual void draw (const QPoint &, const QPoint &, const QRect &); -private: - kpColor drawingForegroundColor () const; -protected: - // This returns the invalid color so that there is never a fill. - // This is in contrast to kpToolRectangularBase, which sometimes fills by - // returning a valid color. - // - // Reimplemented in the Polygon tool for a fill. - virtual kpColor drawingBackgroundColor () const; -protected slots: - void updateShape (); -public: - virtual void cancelShape (); - virtual void releasedAllButtons (); - virtual void endShape (const QPoint & = QPoint (), const QRect & = QRect ()); - - virtual bool hasBegunShape () const; - -protected slots: - virtual void slotForegroundColorChanged (const kpColor &); - virtual void slotBackgroundColorChanged (const kpColor &); - -private: - kpToolPolygonalBasePrivate * const d; -}; - - -#endif // kpToolPolygonalBase_H diff --git a/kolourpaint/tools/polygonal/kpToolPolyline.cpp b/kolourpaint/tools/polygonal/kpToolPolyline.cpp deleted file mode 100644 index 3f0b5ba9..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolyline.cpp +++ /dev/null @@ -1,114 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_POLYLINE 0 - - -#include - -#include -#include - -#include - - -kpToolPolyline::kpToolPolyline (kpToolEnvironment *environ, QObject *parent) - : kpToolPolygonalBase ( - i18n ("Connected Lines"), - i18n ("Draws connected lines"), - &DrawShape, - Qt::Key_N, - environ, parent, - "tool_polyline") -{ -} - -kpToolPolyline::~kpToolPolyline () -{ -} - - -// private virtual [base kpToolPolygonalBase] -QString kpToolPolyline::haventBegunShapeUserMessage () const -{ - return i18n ("Drag to draw the first line."); -} - - -// public static -void kpToolPolyline::DrawShape (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal) -{ - (void) bcolor; - (void) isFinal; - - kpPainter::drawPolyline (image, - points, - fcolor, penWidth); -} - - -// public virtual [base kpTool] -void kpToolPolyline::endDraw (const QPoint &, const QRect &) -{ -#if DEBUG_KP_TOOL_POLYLINE - kDebug () << "kpToolPolyline::endDraw() points=" - << points ()->toList () << endl; -#endif - - // A click of the other mouse button (to finish shape, instead of adding - // another control point) would have caused endShape() to have been - // called in kpToolPolygonalBase::beginDraw(). The points list would now - // be empty. We are being called by kpTool::mouseReleaseEvent(). - if (points ()->count () == 0) - return; - - if (points ()->count () >= kpToolPolygonalBase::MaxPoints) - { - #if DEBUG_KP_TOOL_POLYLINE - kDebug () << "\tending shape"; - #endif - endShape (); - return; - } - - if (originatingMouseButton () == 0) - { - setUserMessage (i18n ("Left drag another line or right click to finish.")); - } - else - { - setUserMessage (i18n ("Right drag another line or left click to finish.")); - } -} - - -#include "moc_kpToolPolyline.cpp" diff --git a/kolourpaint/tools/polygonal/kpToolPolyline.h b/kolourpaint/tools/polygonal/kpToolPolyline.h deleted file mode 100644 index feb9c69e..00000000 --- a/kolourpaint/tools/polygonal/kpToolPolyline.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_POLYLINE_H -#define KP_TOOL_POLYLINE_H - - -#include - - -class kpToolPolyline : public kpToolPolygonalBase -{ -Q_OBJECT - -public: - kpToolPolyline (kpToolEnvironment *environ, QObject *parent); - virtual ~kpToolPolyline (); - -private: - virtual QString haventBegunShapeUserMessage () const; - -public: - // (used by kpToolLine) - static void DrawShape (kpImage *image, - const QPolygon &points, - const kpColor &fcolor, int penWidth, - const kpColor &bcolor, - bool isFinal); - - virtual void endDraw (const QPoint &, const QRect &); -}; - - -#endif // KP_TOOL_POLYLINE_H diff --git a/kolourpaint/tools/rectangular/kpToolEllipse.cpp b/kolourpaint/tools/rectangular/kpToolEllipse.cpp deleted file mode 100644 index a24173ed..00000000 --- a/kolourpaint/tools/rectangular/kpToolEllipse.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpToolEllipse::kpToolEllipse (kpToolEnvironment *environ, QObject *parent) - : kpToolRectangularBase (i18n ("Ellipse"), - i18n ("Draws ellipses and circles"), - &kpPainter::drawEllipse, - Qt::Key_E, - environ, parent, "tool_ellipse") -{ -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolEllipse.cpp" diff --git a/kolourpaint/tools/rectangular/kpToolEllipse.h b/kolourpaint/tools/rectangular/kpToolEllipse.h deleted file mode 100644 index 970d1617..00000000 --- a/kolourpaint/tools/rectangular/kpToolEllipse.h +++ /dev/null @@ -1,45 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ELLIPSE_H -#define KP_TOOL_ELLIPSE_H - - -#include - - -class kpToolEllipse : public kpToolRectangularBase -{ -Q_OBJECT - -public: - kpToolEllipse (kpToolEnvironment *environ, QObject *parent); -}; - - -#endif // KP_TOOL_ELLIPSE_H diff --git a/kolourpaint/tools/rectangular/kpToolRectangle.cpp b/kolourpaint/tools/rectangular/kpToolRectangle.cpp deleted file mode 100644 index aea3ab85..00000000 --- a/kolourpaint/tools/rectangular/kpToolRectangle.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include -#include - -#include - -//--------------------------------------------------------------------- - - -kpToolRectangle::kpToolRectangle (kpToolEnvironment *environ, QObject *parent) - : kpToolRectangularBase (i18n ("Rectangle"), - i18n ("Draws rectangles and squares"), - &kpPainter::drawRect, - Qt::Key_R, - environ, parent, "tool_rectangle") -{ -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolRectangle.cpp" diff --git a/kolourpaint/tools/rectangular/kpToolRectangle.h b/kolourpaint/tools/rectangular/kpToolRectangle.h deleted file mode 100644 index 60a0608a..00000000 --- a/kolourpaint/tools/rectangular/kpToolRectangle.h +++ /dev/null @@ -1,45 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_RECTANGLE_H -#define KP_TOOL_RECTANGLE_H - - -#include - - -class kpToolRectangle : public kpToolRectangularBase -{ -Q_OBJECT - -public: - kpToolRectangle (kpToolEnvironment *environ, QObject *parent); -}; - - -#endif // KP_TOOL_RECTANGLE_H diff --git a/kolourpaint/tools/rectangular/kpToolRectangularBase.cpp b/kolourpaint/tools/rectangular/kpToolRectangularBase.cpp deleted file mode 100644 index 675c9193..00000000 --- a/kolourpaint/tools/rectangular/kpToolRectangularBase.cpp +++ /dev/null @@ -1,394 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_RECTANGULAR_BASE 0 - - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//--------------------------------------------------------------------- - -struct kpToolRectangularBasePrivate -{ - kpToolRectangularBase::DrawShapeFunc drawShapeFunc; - - kpToolWidgetLineWidth *toolWidgetLineWidth; - kpToolWidgetFillStyle *toolWidgetFillStyle; - - QRect toolRectangleRect; -}; - -//--------------------------------------------------------------------- - -kpToolRectangularBase::kpToolRectangularBase ( - const QString &text, - const QString &description, - DrawShapeFunc drawShapeFunc, - int key, - kpToolEnvironment *environ, QObject *parent, - const QString &name) - - : kpTool (text, description, key, environ, parent, name), - d (new kpToolRectangularBasePrivate ()) -{ - d->drawShapeFunc = drawShapeFunc; - - d->toolWidgetLineWidth = 0, d->toolWidgetFillStyle = 0; -} - -//--------------------------------------------------------------------- - -kpToolRectangularBase::~kpToolRectangularBase () -{ - delete d; -} - -//--------------------------------------------------------------------- - - -// private slot virtual -void kpToolRectangularBase::slotLineWidthChanged () -{ - if (hasBegunDraw ()) - updateShape (); -} - -//--------------------------------------------------------------------- - -// private slot virtual -void kpToolRectangularBase::slotFillStyleChanged () -{ - if (hasBegunDraw ()) - updateShape (); -} - -//--------------------------------------------------------------------- - -// private -QString kpToolRectangularBase::haventBegunDrawUserMessage () const -{ - return i18n ("Drag to draw."); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolRectangularBase::begin () -{ -#if DEBUG_KP_TOOL_RECTANGULAR_BASE - kDebug () << "kpToolRectangularBase::begin ()"; -#endif - - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - -#if DEBUG_KP_TOOL_RECTANGULAR_BASE - kDebug () << "\ttoolToolBar=" << tb; -#endif - - d->toolWidgetLineWidth = tb->toolWidgetLineWidth (); - connect (d->toolWidgetLineWidth, - SIGNAL (lineWidthChanged (int)), - this, - SLOT (slotLineWidthChanged ())); - d->toolWidgetLineWidth->show (); - - d->toolWidgetFillStyle = tb->toolWidgetFillStyle (); - connect (d->toolWidgetFillStyle, - SIGNAL (fillStyleChanged (kpToolWidgetFillStyle::FillStyle)), - this, - SLOT (slotFillStyleChanged ())); - d->toolWidgetFillStyle->show (); - - viewManager ()->setCursor (QCursor (Qt::ArrowCursor)); - - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// virtual -void kpToolRectangularBase::end () -{ -#if DEBUG_KP_TOOL_RECTANGULAR_BASE - kDebug () << "kpToolRectangularBase::end ()"; -#endif - - if (d->toolWidgetLineWidth) - { - disconnect (d->toolWidgetLineWidth, - SIGNAL (lineWidthChanged (int)), - this, - SLOT (slotLineWidthChanged ())); - d->toolWidgetLineWidth = 0; - } - - if (d->toolWidgetFillStyle) - { - disconnect (d->toolWidgetFillStyle, - SIGNAL (fillStyleChanged (kpToolWidgetFillStyle::FillStyle)), - this, - SLOT (slotFillStyleChanged ())); - d->toolWidgetFillStyle = 0; - } - - viewManager ()->unsetCursor (); -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::applyModifiers () -{ - QRect rect = normalizedRect (); - -#if DEBUG_KP_TOOL_RECTANGULAR_BASE - kDebug () << "kpToolRectangularBase::applyModifiers(" << rect - << ") shift=" << shiftPressed () - << " ctrl=" << controlPressed () - << endl; -#endif - - // user wants to startPoint () == center - if (controlPressed ()) - { - int xdiff = qAbs (startPoint ().x () - currentPoint ().x ()); - int ydiff = qAbs (startPoint ().y () - currentPoint ().y ()); - rect = QRect (startPoint ().x () - xdiff, startPoint ().y () - ydiff, - xdiff * 2 + 1, ydiff * 2 + 1); - } - - // user wants major axis == minor axis: - // rectangle --> square - // rounded rectangle --> rounded square - // ellipse --> circle - if (shiftPressed ()) - { - if (!controlPressed ()) - { - if (rect.width () < rect.height ()) - { - if (startPoint ().y () == rect.y ()) - rect.setHeight (rect.width ()); - else - rect.setY (rect.bottom () - rect.width () + 1); - } - else - { - if (startPoint ().x () == rect.x ()) - rect.setWidth (rect.height ()); - else - rect.setX (rect.right () - rect.height () + 1); - } - } - // have to maintain the center - else - { - if (rect.width () < rect.height ()) - { - QPoint center = rect.center (); - rect.setHeight (rect.width ()); - rect.moveCenter (center); - } - else - { - QPoint center = rect.center (); - rect.setWidth (rect.height ()); - rect.moveCenter (center); - } - } - } - - d->toolRectangleRect = rect; -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::beginDraw () -{ - setUserMessage (cancelUserMessage ()); -} - -//--------------------------------------------------------------------- - - -// private -kpColor kpToolRectangularBase::drawingForegroundColor () const -{ - return color (mouseButton ()); -} - -//--------------------------------------------------------------------- - -// private -kpColor kpToolRectangularBase::drawingBackgroundColor () const -{ - const kpColor foregroundColor = color (mouseButton ()); - const kpColor backgroundColor = color (1 - mouseButton ()); - - return d->toolWidgetFillStyle->drawingBackgroundColor ( - foregroundColor, backgroundColor); -} - -//--------------------------------------------------------------------- - -// private -void kpToolRectangularBase::updateShape () -{ - kpImage image = document ()->getImageAt (d->toolRectangleRect); - - // Invoke shape drawing function passed in ctor. - (*d->drawShapeFunc) (&image, - 0, 0, d->toolRectangleRect.width (), d->toolRectangleRect.height (), - drawingForegroundColor (), d->toolWidgetLineWidth->lineWidth (), - drawingBackgroundColor ()); - - kpTempImage newTempImage (false/*always display*/, - kpTempImage::SetImage/*render mode*/, - d->toolRectangleRect.topLeft (), - image); - - viewManager ()->setFastUpdates (); - viewManager ()->setTempImage (newTempImage); - viewManager ()->restoreFastUpdates (); -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::draw (const QPoint &, const QPoint &, const QRect &) -{ - applyModifiers (); - - - updateShape (); - - - // Recover the start and end points from the transformed & normalized d->toolRectangleRect - - // S. or S or SC or S == C - // .C C - if (currentPoint ().x () >= startPoint ().x () && - currentPoint ().y () >= startPoint ().y ()) - { - setUserShapePoints (d->toolRectangleRect.topLeft (), - d->toolRectangleRect.bottomRight ()); - } - // .C or C - // S. S - else if (currentPoint ().x () >= startPoint ().x () && - currentPoint ().y () < startPoint ().y ()) - { - setUserShapePoints (d->toolRectangleRect.bottomLeft (), - d->toolRectangleRect.topRight ()); - } - // .S or CS - // C. - else if (currentPoint ().x () < startPoint ().x () && - currentPoint ().y () >= startPoint ().y ()) - { - setUserShapePoints (d->toolRectangleRect.topRight (), - d->toolRectangleRect.bottomLeft ()); - } - // C. - // .S - else - { - setUserShapePoints (d->toolRectangleRect.bottomRight (), - d->toolRectangleRect.topLeft ()); - } -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::cancelShape () -{ - viewManager ()->invalidateTempImage (); - - setUserMessage (i18n ("Let go of all the mouse buttons.")); -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::releasedAllButtons () -{ - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -void kpToolRectangularBase::endDraw (const QPoint &, const QRect &) -{ - applyModifiers (); - - // TODO: flicker - // Later: So why can't we use kpViewManager::setQueueUpdates()? Check SVN - // log to see if this method was not available at the time of the - // TODO, hence justifying the TODO. - // Later2: kpToolPolygonalBase, and perhaps, other shapes will have the - // same problem. - viewManager ()->invalidateTempImage (); - - environ ()->commandHistory ()->addCommand ( - new kpToolRectangularCommand ( - text (), - d->drawShapeFunc, d->toolRectangleRect, - drawingForegroundColor (), d->toolWidgetLineWidth->lineWidth (), - drawingBackgroundColor (), - environ ()->commandEnvironment ())); - - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - - -#include "moc_kpToolRectangularBase.cpp" diff --git a/kolourpaint/tools/rectangular/kpToolRectangularBase.h b/kolourpaint/tools/rectangular/kpToolRectangularBase.h deleted file mode 100644 index a9f1415c..00000000 --- a/kolourpaint/tools/rectangular/kpToolRectangularBase.h +++ /dev/null @@ -1,98 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_RECTANGULAR_BASE_H -#define KP_TOOL_RECTANGULAR_BASE_H - - -#include -#include - - -#include -#include -#include - -class kpColor; - - -struct kpToolRectangularBasePrivate; - - -// it turns out that these shapes are all really the same thing -// (same options, same feel) - the only real difference is the -// drawing function i.e. drawShape(). -class kpToolRectangularBase : public kpTool -{ -Q_OBJECT - -public: - typedef void (*DrawShapeFunc) (kpImage * /*image*/, - int /*x*/, int /*y*/, int /*width*/, int /*height*/, - const kpColor &/*fcolor*/, int /*penWidth = 1*/, - const kpColor &/*bcolor = kpColor::Invalid*/); - - kpToolRectangularBase (const QString &text, const QString &description, - DrawShapeFunc drawShapeFunc, - int key, - kpToolEnvironment *environ, QObject *parent, - const QString &name); - virtual ~kpToolRectangularBase (); - - virtual bool careAboutModifierState () const { return true; } - -private slots: - virtual void slotLineWidthChanged (); - virtual void slotFillStyleChanged (); - -private: - QString haventBegunDrawUserMessage () const; - -public: - virtual void begin (); - virtual void end (); - -private: - void applyModifiers (); - virtual void beginDraw (); -private: - kpColor drawingForegroundColor () const; - kpColor drawingBackgroundColor () const; - void updateShape (); -public: - virtual void draw (const QPoint &, const QPoint &, const QRect &); - virtual void cancelShape (); - virtual void releasedAllButtons (); - virtual void endDraw (const QPoint &, const QRect &); - -private: - kpToolRectangularBasePrivate * const d; -}; - - -#endif // KP_TOOL_RECTANGULAR_BASE_H diff --git a/kolourpaint/tools/rectangular/kpToolRoundedRectangle.cpp b/kolourpaint/tools/rectangular/kpToolRoundedRectangle.cpp deleted file mode 100644 index 603c70ae..00000000 --- a/kolourpaint/tools/rectangular/kpToolRoundedRectangle.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpToolRoundedRectangle::kpToolRoundedRectangle (kpToolEnvironment *environ, - QObject *parent) - : kpToolRectangularBase (i18n ("Rounded Rectangle"), - i18n ("Draws rectangles and squares with rounded corners"), - &kpPainter::drawRoundedRect, - Qt::Key_U, - environ, parent, "tool_rounded_rectangle") -{ -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolRoundedRectangle.cpp" diff --git a/kolourpaint/tools/rectangular/kpToolRoundedRectangle.h b/kolourpaint/tools/rectangular/kpToolRoundedRectangle.h deleted file mode 100644 index 58b270d5..00000000 --- a/kolourpaint/tools/rectangular/kpToolRoundedRectangle.h +++ /dev/null @@ -1,45 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ROUNDED_RECTANGLE_H -#define KP_TOOL_ROUNDED_RECTANGLE_H - - -#include - - -class kpToolRoundedRectangle : public kpToolRectangularBase -{ -Q_OBJECT - -public: - kpToolRoundedRectangle (kpToolEnvironment *environ, QObject *parent); -}; - - -#endif // KP_TOOL_ROUNDED_RECTANGLE_H diff --git a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.cpp b/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.cpp deleted file mode 100644 index 6e27b5c5..00000000 --- a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpAbstractImageSelectionTool::kpAbstractImageSelectionTool ( - const QString &text, const QString &description, - int key, - kpToolSelectionEnvironment *environ, QObject *parent, - const QString &name) - : kpAbstractSelectionTool (text, description, - key, environ, parent, name) -{ -} - -//--------------------------------------------------------------------- - -// protected virtual [kpAbstractSelectionTool] -kpAbstractSelectionContentCommand *kpAbstractImageSelectionTool::newGiveContentCommand () const -{ - kpAbstractImageSelection *imageSel = document ()->imageSelection (); - Q_ASSERT (imageSel && !imageSel->hasContent ()); - - if (imageSel->transparency ().isTransparent ()) - environ ()->flashColorSimilarityToolBarItem (); - - return new kpToolSelectionPullFromDocumentCommand ( - *imageSel, - environ ()->backgroundColor (), - QString()/*uninteresting child of macro cmd*/, - environ ()->commandEnvironment ()); -} - -//--------------------------------------------------------------------- -// protected virtual [kpAbstractSelectionTool] - -QString kpAbstractImageSelectionTool::nameOfCreateCommand () const -{ - return i18n ("Selection: Create"); -} - -//--------------------------------------------------------------------- -// protected virtual [kpAbstractSelectionTool] - -QString kpAbstractImageSelectionTool::haventBegunDrawUserMessageCreate () const -{ - // TODO: This is wrong because you can still use RMB. - return i18n ("Left drag to create selection."); -} - -//--------------------------------------------------------------------- -// protected virtual [kpAbstractSelectionTool] - -QString kpAbstractImageSelectionTool::haventBegunDrawUserMessageMove () const -{ - return i18n ("Left drag to move selection."); -} - -//--------------------------------------------------------------------- -// protected virtual [kpAbstractSelectionTool] - -QString kpAbstractImageSelectionTool::haventBegunDrawUserMessageResizeScale () const -{ - return i18n ("Left drag to scale selection."); -} - -//--------------------------------------------------------------------- - -#include "moc_kpAbstractImageSelectionTool.cpp" diff --git a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.h b/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.h deleted file mode 100644 index e7296158..00000000 --- a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool.h +++ /dev/null @@ -1,106 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAbstractImageSelectionTool_H -#define kpAbstractImageSelectionTool_H - - -#include - - -class kpImageSelectionTransparency; - - -// The only difference between the various subclasses of us is the kind of -// selection that they create e.g. elliptical vs rectangular. -// -// For every other operation, they act identically so, for instance, it is -// possible to move an elliptical selection while using the rectangular -// selection tool (this situation can arise when you paste an elliptical -// selection while using the rectangular selection tool; a tool change -// does not occur out of convenience to the user - see -// kpDocumentEnvironment::switchToCompatibleTool()). -class kpAbstractImageSelectionTool : public kpAbstractSelectionTool -{ -Q_OBJECT - -public: - kpAbstractImageSelectionTool (const QString &text, const QString &description, - int key, - kpToolSelectionEnvironment *environ, QObject *parent, - const QString &name); - - -// -// Drawing -// - -protected: - virtual kpAbstractSelectionContentCommand *newGiveContentCommand () const; - - virtual QString nameOfCreateCommand () const; - - -// -// Create, Move, Resize/Scale -// - -protected: - virtual QString haventBegunDrawUserMessageCreate () const; - virtual QString haventBegunDrawUserMessageMove () const; - virtual QString haventBegunDrawUserMessageResizeScale () const; - - -// -// User Changing Selection Transparency -// - -protected: - bool shouldChangeImageSelectionTransparency () const; - // You must derive , the old selection transparency, from the - // one obtained from the user's current settings, as given by the - // kpToolSelectionEnvironment. - // - // You must _not_ simply get the old selection transparency just by - // querying the selection i.e. do _not_ pass in - // "document()->imageSelection().transparency()". The reason is that - // transparency().transparentColor() might not be defined in Opaque - // Mode. - void changeImageSelectionTransparency ( - const QString &name, - const kpImageSelectionTransparency &newTrans, - const kpImageSelectionTransparency &oldTrans); - -protected slots: - virtual void slotIsOpaqueChanged (bool isOpaque); - virtual void slotBackgroundColorChanged (const kpColor &color); - virtual void slotColorSimilarityChanged (double similarity, int); -}; - - -#endif // kpAbstractImageSelectionTool_H diff --git a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool_Transparency.cpp b/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool_Transparency.cpp deleted file mode 100644 index e111949d..00000000 --- a/kolourpaint/tools/selection/image/kpAbstractImageSelectionTool_Transparency.cpp +++ /dev/null @@ -1,212 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include - -// LOREFACTOR: Remove unneeded #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected -bool kpAbstractImageSelectionTool::shouldChangeImageSelectionTransparency () const -{ - if (environ ()->settingImageSelectionTransparency ()) - { - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "\trecursion - abort setting selection transparency: " - << environ ()->settingImageSelectionTransparency () << endl; - #endif - return false; - } - - if (!document ()->imageSelection ()) - return false; - - // TODO: Can probably return false if the selection transparency mode - // is Opaque, since neither background color nor color similarity - // would matter. - - return true; -} - -// protected -void kpAbstractImageSelectionTool::changeImageSelectionTransparency ( - const QString &name, - const kpImageSelectionTransparency &newTrans, - const kpImageSelectionTransparency &oldTrans) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "CALL(" << name << ")"; -#endif - - kpSetOverrideCursorSaver cursorSaver (Qt::WaitCursor); - - if (hasBegunShape ()) - endShapeInternal (); - - kpAbstractImageSelection *imageSel = document ()->imageSelection (); - - if (imageSel->hasContent () && newTrans.isTransparent ()) - environ ()->flashColorSimilarityToolBarItem (); - - imageSel->setTransparency (newTrans); - - // We _must_ add the command even if kpAbstractImageSelection::setTransparency() - // above did not change the selection transparency mask at all. - // Consider the following case: - // - // 0. Ensure that selection transparency is opaque and any - // color other than red is the background color. Ensure that - // the color similarity setting is 0. - // - // 1. Select a solid red rectangle and pull it off. - // - // 2. Switch to transparent and set red as the background color. - // [the selection is now invisible as red is the background - // color, which is the same as the contents of the selection] - // - // 3. Invert Colors. - // [the selection is now cyan, red is still the background color] - // - // 4. Change the background color to green. - // [the selection transparency mask does not change so the - // selection is still cyan; green is the background color] - // - // 5. Undo - // - // If no transparency command were added for Step 4., the Undo - // in Step 5. would take us straight to the state after Step 2., - // where we would expect the red selection to be invisible. However, - // as the background color was changed to green in Step 4. and was not - // undone, the red selection is not invisible when it should be -- Undo - // has moved us to an incorrect state. - // - // KDE3: Copy this comment into the KDE 3 branch. - commandHistory ()->addCommand (new kpToolImageSelectionTransparencyCommand ( - name, - newTrans, oldTrans, - environ ()->commandEnvironment ()), - false/*no exec*/); -} - - -// protected slot virtual [kpAbstractSelectionTool] -void kpAbstractImageSelectionTool::slotIsOpaqueChanged (bool /*isOpaque*/) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractImageSelectionTool::slotIsOpaqueChanged()"; -#endif - - if (!shouldChangeImageSelectionTransparency ()) - return; - - kpImageSelectionTransparency st = environ ()->imageSelectionTransparency (); - - kpImageSelectionTransparency oldST = st; - oldST.setOpaque (!oldST.isOpaque ()); - - changeImageSelectionTransparency ( - st.isOpaque () ? - i18n ("Selection: Opaque") : - i18n ("Selection: Transparent"), - st, oldST); -} - -// protected slot virtual [base kpTool] -void kpAbstractImageSelectionTool::slotBackgroundColorChanged (const kpColor &) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractImageSelectionTool::slotBackgroundColorChanged()"; -#endif - - if (!shouldChangeImageSelectionTransparency ()) - return; - - kpImageSelectionTransparency st = environ ()->imageSelectionTransparency (); - - kpImageSelectionTransparency oldST = st; - oldST.setTransparentColor (oldBackgroundColor ()); - - changeImageSelectionTransparency ( - i18n ("Selection: Transparency Color"), - st, oldST); -} - -// protected slot virtual [base kpTool] -void kpAbstractImageSelectionTool::slotColorSimilarityChanged (double, int) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractImageSelectionTool::slotColorSimilarityChanged()"; -#endif - - if (!shouldChangeImageSelectionTransparency ()) - return; - - kpImageSelectionTransparency st = environ ()->imageSelectionTransparency (); - - kpImageSelectionTransparency oldST = st; - oldST.setColorSimilarity (oldColorSimilarity ()); - - changeImageSelectionTransparency ( - i18n ("Selection: Transparency Color Similarity"), - st, oldST); -} diff --git a/kolourpaint/tools/selection/image/kpToolEllipticalSelection.cpp b/kolourpaint/tools/selection/image/kpToolEllipticalSelection.cpp deleted file mode 100644 index 804d56a1..00000000 --- a/kolourpaint/tools/selection/image/kpToolEllipticalSelection.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_ELLIPTICAL_SELECTION 0 - - -#include - -#include -#include - -#include -#include -#include - - -kpToolEllipticalSelection::kpToolEllipticalSelection (kpToolSelectionEnvironment *environ, - QObject *parent) - : kpAbstractImageSelectionTool (i18n ("Selection (Elliptical)"), - i18n ("Makes an elliptical or circular selection"), - Qt::Key_I, - environ, parent, - "tool_elliptical_selection") -{ -} - -kpToolEllipticalSelection::~kpToolEllipticalSelection () -{ -} - - -// protected virtual [base kpAbstractSelectionTool] -bool kpToolEllipticalSelection::drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect) -{ - // Prevent unintentional creation of 1-pixel selections. - if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) - { - #if DEBUG_KP_TOOL_ELLIPTICAL_SELECTION && 1 - kDebug () << "\tnon-text NOP - return"; - #endif - setUserShapePoints (accidentalDragAdjustedPoint); - return false; - } - - Q_ASSERT (accidentalDragAdjustedPoint == currentPoint ()); - - document ()->setSelection ( - kpEllipticalImageSelection ( - normalizedRect, - environ ()->imageSelectionTransparency ())); - - setUserShapePoints (startPoint (), currentPoint ()); - - return true; -} diff --git a/kolourpaint/tools/selection/image/kpToolEllipticalSelection.h b/kolourpaint/tools/selection/image/kpToolEllipticalSelection.h deleted file mode 100644 index 583b4113..00000000 --- a/kolourpaint/tools/selection/image/kpToolEllipticalSelection.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_ELLIPTICAL_SELECTION_H -#define KP_TOOL_ELLIPTICAL_SELECTION_H - - -#include - - -class kpToolEllipticalSelection : public kpAbstractImageSelectionTool -{ -public: - kpToolEllipticalSelection (kpToolSelectionEnvironment *environ, QObject *parent); - virtual ~kpToolEllipticalSelection (); - -protected: - virtual bool drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect); -}; - - -#endif // KP_TOOL_ELLIPTICAL_SELECTION_H diff --git a/kolourpaint/tools/selection/image/kpToolFreeFormSelection.cpp b/kolourpaint/tools/selection/image/kpToolFreeFormSelection.cpp deleted file mode 100644 index 70dbf900..00000000 --- a/kolourpaint/tools/selection/image/kpToolFreeFormSelection.cpp +++ /dev/null @@ -1,141 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_FREE_FROM_SELECTION 0 - - -#include - -#include -#include - -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolFreeFormSelection::kpToolFreeFormSelection (kpToolSelectionEnvironment *environ, - QObject *parent) - : kpAbstractImageSelectionTool (i18n ("Selection (Free-Form)"), - i18n ("Makes a free-form selection"), - Qt::Key_M, - environ, parent, - "tool_free_form_selection") -{ -} - -//--------------------------------------------------------------------- - -kpToolFreeFormSelection::~kpToolFreeFormSelection () -{ -} - -//--------------------------------------------------------------------- - -// protected virtual [base kpAbstractSelectionTool] -bool kpToolFreeFormSelection::drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &/*normalizedRect*/) -{ -#if DEBUG_KP_TOOL_FREE_FROM_SELECTION - kDebug () << "kpToolFreeFormSelection::createMoreSelectionAndUpdateStatusBar(" - << "dragAccepted=" << dragAccepted - << ",accidentalDragAdjustedPoint=" << accidentalDragAdjustedPoint - << ")" << endl; -#endif - - // Prevent unintentional creation of 1-pixel selections. - if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) - { - #if DEBUG_KP_TOOL_FREE_FROM_SELECTION && 1 - kDebug () << "\tnon-text NOP - return"; - #endif - setUserShapePoints (accidentalDragAdjustedPoint); - return false; - } - - Q_ASSERT (accidentalDragAdjustedPoint == currentPoint ()); - Q_ASSERT (dragAccepted == (bool) document ()->selection ()); - - const kpFreeFormImageSelection *oldPointsSel = 0; - if (document ()->selection ()) - { - kpAbstractSelection *sel = document ()->selection (); - Q_ASSERT (dynamic_cast (sel)); - oldPointsSel = static_cast (sel); - } - - - QPolygon points; - - // First point in drag? - if (!dragAccepted) - { - points.append (startPoint ()); - } - // Not first point in drag. - else - { - if ( !oldPointsSel ) // assert above says we never reach this, but let's make coverity happy - return false; - - // Get existing points in selection. - points = oldPointsSel->cardinallyAdjacentPoints (); - } - - -#if DEBUG_KP_TOOL_FREE_FROM_SELECTION - kDebug () << "\tlast old point=" << points.last (); -#endif - - // TODO: There should be an upper limit on this before drawing the - // polygon becomes too slow. - points.append (accidentalDragAdjustedPoint); - - - document ()->setSelection ( - kpFreeFormImageSelection (points, environ ()->imageSelectionTransparency ())); - - // Prevent accidental usage of dangling pointer to old selection - // (deleted by kpDocument::setSelection()). - oldPointsSel = 0; - -#if DEBUG_KP_TOOL_FREE_FROM_SELECTION && 1 - kDebug () << "\t\tfreeform; #points=" - << document ()->selection ()->calculatePoints ().count () - << endl; -#endif - - setUserShapePoints (accidentalDragAdjustedPoint); - - return true; -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/selection/image/kpToolFreeFormSelection.h b/kolourpaint/tools/selection/image/kpToolFreeFormSelection.h deleted file mode 100644 index 7ad1a9d7..00000000 --- a/kolourpaint/tools/selection/image/kpToolFreeFormSelection.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_FREE_FORM_SELECTION_H -#define KP_TOOL_FREE_FORM_SELECTION_H - - -#include - - -class kpToolFreeFormSelection : public kpAbstractImageSelectionTool -{ -public: - kpToolFreeFormSelection (kpToolSelectionEnvironment *environ, QObject *parent); - virtual ~kpToolFreeFormSelection (); - -protected: - virtual bool drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect); -}; - - -#endif // KP_TOOL_FREE_FORM_SELECTION_H diff --git a/kolourpaint/tools/selection/image/kpToolRectSelection.cpp b/kolourpaint/tools/selection/image/kpToolRectSelection.cpp deleted file mode 100644 index ecbac4ec..00000000 --- a/kolourpaint/tools/selection/image/kpToolRectSelection.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_RECT_SELECTION 0 - -#include - -#include -#include - -#include -#include -#include - - -kpToolRectSelection::kpToolRectSelection (kpToolSelectionEnvironment *environ, - QObject *parent) - : kpAbstractImageSelectionTool (i18n ("Selection (Rectangular)"), - i18n ("Makes a rectangular selection"), - Qt::Key_S, - environ, parent, - "tool_rect_selection") -{ -} - -kpToolRectSelection::~kpToolRectSelection () -{ -} - - -// protected virtual [base kpAbstractSelectionTool] -bool kpToolRectSelection::drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect) -{ - // Prevent unintentional creation of 1-pixel selections. - // REFACTOR: This line is duplicated code with other tools. - if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) - { - #if DEBUG_KP_TOOL_RECT_SELECTION && 1 - kDebug () << "\tnon-text NOP - return"; - #endif - setUserShapePoints (accidentalDragAdjustedPoint); - return false; - } - - Q_ASSERT (accidentalDragAdjustedPoint == currentPoint ()); - - const QRect usefulRect = normalizedRect.intersected (document ()->rect ()); - document ()->setSelection ( - kpRectangularImageSelection ( - usefulRect, - environ ()->imageSelectionTransparency ())); - - setUserShapePoints (startPoint (), - QPoint (qMax (0, qMin (currentPoint ().x (), document ()->width () - 1)), - qMax (0, qMin (currentPoint ().y (), document ()->height () - 1)))); - - return true; -} diff --git a/kolourpaint/tools/selection/image/kpToolRectSelection.h b/kolourpaint/tools/selection/image/kpToolRectSelection.h deleted file mode 100644 index e55bf7fc..00000000 --- a/kolourpaint/tools/selection/image/kpToolRectSelection.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_RECT_SELECTION_H -#define KP_TOOL_RECT_SELECTION_H - - -#include - - -class kpToolRectSelection : public kpAbstractImageSelectionTool -{ -public: - kpToolRectSelection (kpToolSelectionEnvironment *environ, QObject *parent); - virtual ~kpToolRectSelection (); - -protected: - virtual bool drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect); -}; - - -#endif // KP_TOOL_RECT_SELECTION_H diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool.cpp b/kolourpaint/tools/selection/kpAbstractSelectionTool.cpp deleted file mode 100644 index f8dc8bf7..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool.cpp +++ /dev/null @@ -1,631 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// For either of these timers, they are only active during the "drawing" phase -// of kpTool. -static void AssertAllTimersInactive (struct kpAbstractSelectionToolPrivate *d) -{ - Q_ASSERT (!d->createNOPTimer->isActive ()); - Q_ASSERT (!d->RMBMoveUpdateGUITimer->isActive ()); -} - -//--------------------------------------------------------------------- - -kpAbstractSelectionTool::kpAbstractSelectionTool ( - const QString &text, - const QString &description, - int key, - kpToolSelectionEnvironment *environ, QObject *parent, - const QString &name) - - : kpTool (text, description, key, environ, parent, name), - d (new kpAbstractSelectionToolPrivate ()) -{ - d->drawType = None; - d->currentSelContentCommand = 0; - - // d->dragAccepted - // d->hadSelectionBeforeDrag - - // d->cancelledShapeButStillHoldingButtons - - d->toolWidgetOpaqueOrTransparent = 0; - - - initCreate (); - initMove (); - initResizeScale (); - - // It would be bad practice to have timers ticking even when this tool - // is not in use. - ::AssertAllTimersInactive (d); -} - -//--------------------------------------------------------------------- - -kpAbstractSelectionTool::~kpAbstractSelectionTool () -{ - uninitCreate (); - uninitMove (); - uninitResizeScale (); - - - // (state must be after construction, or after some time after end()) - Q_ASSERT (d->drawType == None); - Q_ASSERT (!d->currentSelContentCommand); - - // d->dragAccepted - // d->hadSelectionBeforeDraw - - // d->cancelledShapeButStillHoldingButtons - - // d->toolWidgetOpaqueOrTransparent - - - delete d; -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractSelectionTool::DrawType kpAbstractSelectionTool::drawType () const -{ - return d->drawType; -} - -//--------------------------------------------------------------------- - -// protected -bool kpAbstractSelectionTool::hadSelectionBeforeDraw () const -{ - return d->hadSelectionBeforeDraw; -} - -//--------------------------------------------------------------------- - -// protected overrides [base kpTool] -kpToolSelectionEnvironment *kpAbstractSelectionTool::environ () const -{ - kpToolEnvironment *e = kpTool::environ (); - Q_ASSERT (dynamic_cast (e)); - return static_cast (e); -} - -//--------------------------------------------------------------------- - -// protected -bool kpAbstractSelectionTool::controlOrShiftPressed () const -{ - return (controlPressed () || shiftPressed ()); -} - -//--------------------------------------------------------------------- - -// protected -void kpAbstractSelectionTool::pushOntoDocument () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpAbstractSelectionTool::pushOntoDocument() selection=" - << document ()->selection () << endl; -#endif - Q_ASSERT (document ()->selection ()); - environ ()->deselectSelection (); -} - -//--------------------------------------------------------------------- - -// protected -void kpAbstractSelectionTool::giveContentIfNeeded () -{ - kpAbstractSelection *sel = document ()->selection (); - Q_ASSERT (sel); - - if (sel->hasContent ()) - return; - - if (d->currentSelContentCommand) - return; - - d->currentSelContentCommand = /*virtual*/newGiveContentCommand (); - d->currentSelContentCommand->execute (); -} - -//--------------------------------------------------------------------- - -// protected -// REFACTOR: sync: Code dup with kpMainWindow::addImageOrSelectionCommand (). -void kpAbstractSelectionTool::addNeedingContentCommand (kpCommand *cmd) -{ - Q_ASSERT (cmd); - - // Did we fill the selection with content? - if (d->currentSelContentCommand) - { - // Make the border creation a command. - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "\thave currentSelContentCommand"; - #endif - commandHistory ()->addCreateSelectionCommand ( - new kpToolSelectionCreateCommand ( - /*virtual*/nameOfCreateCommand (), - *d->currentSelContentCommand->originalSelection (), - environ ()->commandEnvironment ()), - false/*no exec - user already dragged out sel*/); - } - - // Do we have a content setting command we need to commit? - // (yes, this is the same check as the previous "if") - if (d->currentSelContentCommand) - { - // Put the content command + given command (e.g. movement) together - // as a macro command, in the command history. - kpMacroCommand *macroCmd = new kpMacroCommand ( - cmd->name (), environ ()->commandEnvironment ()); - - macroCmd->addCommand (d->currentSelContentCommand); - d->currentSelContentCommand = 0; - - macroCmd->addCommand (cmd); - - commandHistory ()->addCommand (macroCmd, false/*no exec*/); - } - else - { - // Put the given command into the command history. - commandHistory ()->addCommand (cmd, false/*no exec*/); - } -} - -//--------------------------------------------------------------------- - - -// protected virtual -void kpAbstractSelectionTool::setSelectionBorderForHaventBegunDraw () -{ - viewManager ()->setQueueUpdates (); - { - viewManager ()->setSelectionBorderVisible (true); - viewManager ()->setSelectionBorderFinished (true); - } - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// private -QString kpAbstractSelectionTool::haventBegunDrawUserMessage () -{ -#if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "kpAbstractSelectionTool::haventBegunDrawUserMessage()" - " cancelledShapeButStillHoldingButtons=" - << d->cancelledShapeButStillHoldingButtons - << endl; -#endif - - if (d->cancelledShapeButStillHoldingButtons) - return i18n ("Let go of all the mouse buttons."); - - return operation (calculateDrawType (), HaventBegunDrawUserMessage).toString (); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::begin () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool<" << objectName () << ">::begin()"; -#endif - - ::AssertAllTimersInactive (d); - - // (state must be after construction, or after some time after end()) - Q_ASSERT (d->drawType == None); - Q_ASSERT (!d->currentSelContentCommand); - - d->dragAccepted = false; - // d->hadSelectionBeforeDraw - - d->cancelledShapeButStillHoldingButtons = false; - - - kpToolToolBar *tb = toolToolBar (); - Q_ASSERT (tb); - - d->toolWidgetOpaqueOrTransparent = tb->toolWidgetOpaqueOrTransparent (); - Q_ASSERT (d->toolWidgetOpaqueOrTransparent); - connect (d->toolWidgetOpaqueOrTransparent, SIGNAL (isOpaqueChanged (bool)), - this, SLOT (slotIsOpaqueChanged (bool))); - d->toolWidgetOpaqueOrTransparent->show (); - - /*virtual*/setSelectionBorderForHaventBegunDraw (); - - - beginCreate (); - beginMove (); - beginResizeScale (); - - - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::end () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool<" << objectName () << ">::end()"; -#endif - - if (document ()->selection ()) - pushOntoDocument (); - - - endCreate (); - endMove (); - endResizeScale (); - - - // (should have been killed by cancelShape() or endDraw()) - Q_ASSERT (d->drawType == None); - Q_ASSERT (!d->currentSelContentCommand); - - // d->dragAccepted - // d->hadSelectionBeforeDraw - - // d->cancelledShapeButStillHoldingButtons - - - Q_ASSERT (d->toolWidgetOpaqueOrTransparent); - disconnect (d->toolWidgetOpaqueOrTransparent, SIGNAL (isOpaqueChanged (bool)), - this, SLOT (slotIsOpaqueChanged (bool))); - d->toolWidgetOpaqueOrTransparent = 0; - - - viewManager ()->unsetCursor (); - - ::AssertAllTimersInactive (d); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::reselect () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool::reselect()"; -#endif - - if (document ()->selection ()) - pushOntoDocument (); -} - -//--------------------------------------------------------------------- - -// protected virtual -kpAbstractSelectionTool::DrawType kpAbstractSelectionTool::calculateDrawTypeInsideSelection () const -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\t\tis move"; -#endif - return kpAbstractSelectionTool::Move; -} - -//--------------------------------------------------------------------- - -// protected virtual -kpAbstractSelectionTool::DrawType kpAbstractSelectionTool::calculateDrawType () const -{ - kpAbstractSelection *sel = document ()->selection (); - if (!sel) - return Create; -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\thas sel region rect=" << sel->boundingRect (); -#endif - - if (onSelectionResizeHandle () && !controlOrShiftPressed ()) - return ResizeScale; - else if (sel->contains (currentPoint ())) - return /*virtual*/calculateDrawTypeInsideSelection (); - else - return Create; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::beginDraw () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool::beginDraw() startPoint ()=" - << startPoint () - << " QCursor::pos() view startPoint=" - << viewUnderStartPoint ()->mapFromGlobal (QCursor::pos ()) - << endl; -#endif - - // endDraw() and cancelShape() should have taken care of these. - ::AssertAllTimersInactive (d); - - // In case the cursor was wrong to start with - // (forgot to call kpTool::somethingBelowTheCursorChanged()), - // make sure it is correct during this operation. - hover (currentPoint ()); - - // Currently used only to end the current text - if (hasBegunShape ()) - { - endShape(currentPoint(), - kpPainter::normalizedRect(startPoint()/* TODO: wrong */, currentPoint())); - } - - d->drawType = calculateDrawType (); - d->dragAccepted = false; - - kpAbstractSelection *sel = document ()->selection (); - d->hadSelectionBeforeDraw = bool (sel); - - operation (d->drawType, BeginDraw); -} - -//--------------------------------------------------------------------- - - -// public virtual [base kpTool] -void kpAbstractSelectionTool::hover (const QPoint &point) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpAbstractSelectionTool::hover" << point; -#endif - - operation (calculateDrawType (), SetCursor); - - setUserShapePoints (point, KP_INVALID_POINT, false/*don't set size*/); - if (document () && document ()->selection ()) - { - setUserShapeSize (document ()->selection ()->width (), - document ()->selection ()->height ()); - } - else - { - setUserShapeSize (KP_INVALID_SIZE); - } - - QString mess = haventBegunDrawUserMessage (); - if (mess != userMessage ()) - setUserMessage (mess); -} - -//--------------------------------------------------------------------- - - -// public virtual [base kpTool] -void kpAbstractSelectionTool::draw (const QPoint &thisPoint, const QPoint & /*lastPoint*/, - const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpAbstractSelectionTool::draw (" << thisPoint - << ",startPoint=" << startPoint () - << ",normalizedRect=" << normalizedRect << ")" << endl; -#else - Q_UNUSED (thisPoint); - Q_UNUSED (normalizedRect); -#endif - - - // OPT: return when thisPoint == lastPoint () so that e.g. when creating - // Points sel, press modifiers doesn't add multiple points in same - // place - - - operation (d->drawType, Draw); -} - -//--------------------------------------------------------------------- - - -// public virtual [base kpTool] -void kpAbstractSelectionTool::cancelShape () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool::cancelShape() mouseButton=" - << mouseButton () << endl; -#endif - - const DrawType oldDrawType = d->drawType; - // kpTool::hasBegunDraw() returns false in this method so be consistent - // and clear "drawType" before dispatching the operation() below. - d->drawType = None; - - - viewManager ()->setQueueUpdates (); - { - operation (oldDrawType, Cancel); - - - if (d->currentSelContentCommand) - { - #if DEBUG_KP_TOOL_SELECTION - kDebug () << "\t\tundo sel content"; - #endif - d->currentSelContentCommand->unexecute (); - delete d->currentSelContentCommand; - d->currentSelContentCommand = 0; - } - - - /*virtual*/setSelectionBorderForHaventBegunDraw (); - } - viewManager ()->restoreQueueUpdates (); - - - d->cancelledShapeButStillHoldingButtons = true; - setUserMessage (i18n ("Let go of all the mouse buttons.")); - - - ::AssertAllTimersInactive (d); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::releasedAllButtons () -{ - d->cancelledShapeButStillHoldingButtons = false; - setUserMessage (haventBegunDrawUserMessage ()); -} - -//--------------------------------------------------------------------- - -// protected -void kpAbstractSelectionTool::popupRMBMenu () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "CALL - exec'ing menu"; -#endif - - QMenu *pop = environ ()->selectionToolRMBMenu (); - Q_ASSERT (pop); - - // Blocks until the menu closes. - // WARNING: Enters event loop - may re-enter view/tool event handlers. - pop->exec (QCursor::pos ()); -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "calling somethingBelowTheCursorChanged()"; -#endif - - // Cursor may have moved while the menu was up, triggering QMouseMoveEvents - // for the menu -- but not the view -- so we may have missed cursor moves. - // Update cursor position now. - somethingBelowTheCursorChanged (); -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "DONE"; -#endif -} - -//--------------------------------------------------------------------- - -// public virtual [base kpTool] -void kpAbstractSelectionTool::endDraw (const QPoint & /*thisPoint*/, - const QRect & /*normalizedRect*/) -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "kpAbstractSelectionTool::endDraw()"; -#endif - - const DrawType oldDrawType = d->drawType; - // kpTool::hasBegunDraw() returns false in this method so be consistent - // and clear "drawType" before dispatching the operation() below. - d->drawType = None; - - - viewManager ()->setQueueUpdates (); - { - operation (oldDrawType, EndDraw); - - /*virtual*/setSelectionBorderForHaventBegunDraw (); - } - viewManager ()->restoreQueueUpdates (); - - - setUserMessage (haventBegunDrawUserMessage ()); - - - ::AssertAllTimersInactive (d); - - - if (mouseButton () == 1/*right*/) - popupRMBMenu (); - - - // WARNING: Do not place any code after the popupRMBMenu() call - // (see the popupRMBMenu() API). -} - -//--------------------------------------------------------------------- - -// protected virtual -QVariant kpAbstractSelectionTool::operation (DrawType drawType, Operation op, - const QVariant &data1, const QVariant &data2) -{ - switch (drawType) - { - case None: - // NOP. - return QVariant (); - - case Create: - return operationCreate (op, data1, data2); - - case Move: - return operationMove (op, data1, data2); - - case ResizeScale: - return operationResizeScale (op, data1, data2); - - default: - Q_ASSERT (!"Unhandled draw type"); - return QVariant (); - } -} - -//--------------------------------------------------------------------- - - -#include "moc_kpAbstractSelectionTool.cpp" - diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool.h b/kolourpaint/tools/selection/kpAbstractSelectionTool.h deleted file mode 100644 index d2877631..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool.h +++ /dev/null @@ -1,600 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAbstractSelectionTool_H -#define kpAbstractSelectionTool_H - - -#include - -#include - - -#include -#include -#include - -class kpAbstractSelection; -class kpAbstractSelectionContentCommand; -class kpCommand; -class kpToolSelectionEnvironment; - - -// The abstract base for all selection tools. -// -// -// This provides methods to: -// -// 1. handle selection commands and the command history. -// -// 2. implement the kpTool drawing methods. -// -// 3. implement the "Create", "Move" and "Resize/Scale" selection -// draw types. -// -// "Drags" that consist of a single click generally have no effect in -// order to prevent accidently creating a 1x1 selection, doing a NOP move -// or doing a NOP resize/scale. However, doing a bigger drag and then -// dragging the mouse back to create a 1x1 selection or the NOP -// effects are allowed and are recorded in the command history. -// -// Additionally, the "Create" draw type is fitted with "accidental drag -// detection" which will not create a selection in response in small and -// quick drags. -// -// -// The internal architecture is as follows and is of interest for subclasses -// and for changing the existing implementation of the above selection -// draw types: -// -// beginDraw() initiates the action by determining the current draw type -// by calling the virtual calculateDrawType(). Later, all of this class' -// implementations of kpTool drawing methods (e.g. beginDraw(), draw(), -// endShape() etc.) call the virtual operation(), which is passed: -// -// 1. the current draw type (e.g. "Create" or "Move") -// -// 2. the operation, corresponding to the calling method (e.g. -// "BeginDraw" of called by beginDraw()). -// -// [Note: the documentation in these source files sometimes uses "operation" -// where "draw type" is meant and vice-versa] -// -// Note that these kpTool drawing methods do some other work before and after -// calling operation(). -// -// The default implementation of operation() is to dispatch the operation -// to draw-type-specific methods e.g. createOperation() handles all -// operations for the "Create" draw type. createOperation() will then -// call the method that corresponds to the operation e.g. beginDrawCreate() -// corresponds to the "BeginDraw" operation. -// -// For each draw type, all methods are grouped in a single source file -// e.g. kpAbstractSelectionTool_Create.cpp. -// -// To introduce a custom draw type, not implemented by code in this -// class (e.g. "SelectText"), you must: -// -// 1. Add it to "enum DrawType" below. -// -// 2. Override calculateDrawType() to determine the situations in which -// the new draw type is active. -// -// 3. Override operation() to catch all situations in which the new draw -// type is being used, and to implement the appropriate logic. -// -class kpAbstractSelectionTool : public kpTool -{ -Q_OBJECT - -public: - kpAbstractSelectionTool (const QString &text, const QString &description, - int key, - kpToolSelectionEnvironment *environ, QObject *parent, - const QString &name); - - virtual ~kpAbstractSelectionTool (); - - - // Inform kpTool to call draw() when CTRL, SHIFT and friends are - // pressed. CTRL is used for copying, instead of moving, the - // selection. SHIFT is used for sweeping. - virtual bool careAboutModifierState () const { return true; } - - -// -// Drawing - Subclass Accessors -// - -protected: - friend struct kpAbstractSelectionToolPrivate; - enum DrawType - { - None, Create, Move, SelectText, ResizeScale - }; - - - // The return value is not "None" during a drawing operation. - // - // The returned value is set by beginDraw(), after being determined - // by calculateDrawType(). It is cleared in cancelShape() and endDraw(). - DrawType drawType () const; - - bool hadSelectionBeforeDraw () const; - - -// -// Drawing -// - -protected: - // (overrides non-virtual method in kpTool) - kpToolSelectionEnvironment *environ () const; - - // Returns whether a CTRL or SHIFT key is currently pressed. - // Convenience method. - bool controlOrShiftPressed () const; - - -protected: - // Deselects the current selection: - // - // 1. If it has no content, it is simply deleted. - // 2. If it has content, it pushes it onto the document, adding the - // necessary commands to the command history. - // - // ASSUMPTIONS: - // 1. There is a current selection. - // 2. You have not called giveContentIfNeeded() nor - // addNeedingContentCommand() on the current selection. - void pushOntoDocument (); - - -// -// The command lifecycle is as follows: -// -// 1. Ensure that the document has a selection, with or without content. -// -// 2. Call giveContentIfNeeded(). -// -// 3. Create the command. -// -// 4. Process user input, mutate the selection directly and update the -// command with the user's input. -// -// 5. When the drawing operatinon is complete, call addNeedingContentCommand() -// with the command created in Step 3. -// -protected: - // Returns a new instance of the give-the-selection-content command - // that matches the current selection type. The command should not be - // executed by this method. - virtual kpAbstractSelectionContentCommand *newGiveContentCommand () const = 0; - - // Before changing a selection (e.g. moving or resizing), you must - // ensure that it has content. Call this method to ensure that. - // - // If the selection has no content, this calls newGiveContentCommand() - // and executes it. If the selection already has content, this does - // nothing. - // - // ASSUMPTION: There is a selection. - void giveContentIfNeeded (); - - // The name that should be given to command that is constructed in - // response to a drag that creates a new selection. - virtual QString nameOfCreateCommand () const = 0; - - // Add a command to the command history. - // The command is not executed. - // - // If the prior call to giveContentIfNeeded() created content, this - // will, in line with KolourPaint selection convention: - // - // 1. Adds a selection border creation command (this is a bit clever - // and may overwrite the last "Undo" command instead -- see - // kpCommandHistory::addCreateSelectionCommand()). - // - // 2. Group the content command created by giveContentIfNeeded() - // with , as a kpMacroCommand also named . - // - // ASSUMPTION: giveContentIfNeeded() must have been called before - // creating . - void addNeedingContentCommand (kpCommand *cmd); - - -protected: - // Sets the selection border mode when no drawing operation is active. - // - // Subclasses may wish to reimplement but should still call the base - // implementation. Reimplementations should wrap the whole - // reimplementation in a kpViewManager::setQueueUpdates() block. - virtual void setSelectionBorderForHaventBegunDraw (); -private: - // Returns the statusbar message from when no draw operation is in - // progress. Calls operation() with "HaventBegunDrawUserMessage". - // - // (not const due to purely syntactic issue: it calls the non-const - // operation(); it really acts like a const method though) - QString haventBegunDrawUserMessage (); - - -public: - virtual void begin (); - virtual void end (); - - -public: - virtual void reselect (); - - -// -// Drawing - Beginning a Drag -// - -protected: - // Called by calculateDrawType() to determine what type of draw type - // is being started in response to a drag inside the bounding rectangle of - // a selection. - // - // This implementation returns "Move". - // - // You are free to reimplement this and may choose to call this base - // implementation or not. - virtual DrawType calculateDrawTypeInsideSelection () const; - - // Called by beginDraw() to determine what type of draw type is - // being started. The returned draw type is passed to operation(). - // - // This implementation behaves according to the first rule that matches: - // - // 1. If the cursor is on top of a selection resize handle and no modifiers - // are held (i.e. not a smearing move draw type), it returns "ResizeScale". - // - // 2. If the cursor is inside the bounding rectangle of a selection, it - // calls calculateDrawTypeInsideSelection(). - // - // 3. Otherwise, it returns "Create". - // - // You are free to reimplement this and may choose to call this base - // implementation or not. Reimplementing allows you to support new - // draw types for different types of selections (e.g. kpToolText - // supports "SelectText"). It also allows you to make certain - // drags (e.g. dragging in the middle of a selection) do nothing by - // returning "None" instead of calling the base implementation. - virtual DrawType calculateDrawType () const; -public: - virtual void beginDraw (); - - -// -// Drawing - Mouse Movement -// - -public: - virtual void hover (const QPoint &point); - virtual void draw (const QPoint &thisPoint, const QPoint &lastPoint, - const QRect &normalizedRect); - - -// -// Drawing - Ending a Drag -// - -public: - virtual void cancelShape (); - virtual void releasedAllButtons (); - - -protected: - // Displays the right-mouse-button-triggered selection menu, re-entering - // the event loop and blocking until the menu closes. - // - // This menu is a subset of the main window's Edit and Selection menus. - // - // WARNING: This may cause a re-entry of view/tool event handlers. - // If you are calling this from a view/tool event handler, - // either make all your handlers re-entrant or do not put any - // code in your handler after the call. - void popupRMBMenu (); -public: - virtual void endDraw (const QPoint &thisPoint, const QRect &normalizedRect); - - -// -// Drawing - Operation Dispatching -// - -protected: - enum Operation - { - // - // These may be called outside of a drawing operation where - // drawType() will return None. - // - - // Returns the message for the given draw type and operation. - HaventBegunDrawUserMessage, - - SetCursor, - - - // - // Called to start, to end, or inside, a drawing operation. - // - - BeginDraw, Draw, Cancel, EndDraw - }; - - // (See the class API Doc for a description). - virtual QVariant operation (DrawType drawType, Operation op, - const QVariant &data1 = QVariant (), const QVariant &data2 = QVariant ()); - - -// -// Create -// - -private: - // Called by constructor to initialize the "Create" draw type. - void initCreate (); - // Called by destructor to uninitialize the "Create" draw type. - void uninitCreate (); - - -private: - void beginCreate (); - void endCreate (); - - -protected: - virtual QString haventBegunDrawUserMessageCreate () const = 0; -private: - void setCursorCreate (); - - -protected: - // Sets the selection border mode when beginning to drag to create a - // selection. - // - // Subclasses may wish to reimplement but should still call the base - // implementation. Reimplementations should wrap the whole - // reimplementation in a kpViewManager::setQueueUpdates() block. - virtual void setSelectionBorderForBeginDrawCreate (); -private: - void beginDrawCreate (); - - -protected: - // - // If the drag has already been substantial enough to be considered as a - // non-NOP drag (), you must return "true". - // - // If it has not, you should return whether you think the drag should - // be started. This criteria usually includes "if - // is not equal to startPoint()". - // - // If you are returning true, you must: - // - // 1. Set the document's selection (which may not have previously - // existed) to the specified size. - // - // 2. Update the status bar by calling kpTool::setUserShapePoints(). - // - // If you return false, you are still permitted to do the above, - // although it would be unusual (kpToolText does the above to allow a - // single click -- with no dragging -- to create a new text box). - // - // The return value will be fed into the next call as . - // - // Arguments: - // - // 1. : - // This is the same as currentPoint() but is set to startPoint() - // if the mouse has not been moved much (6 manhatten length pixels - // from startPoint() within a short period of time (200ms)). - // This provides the accidental drag detection, referred to in the - // class' API Doc. - // - // 2. : - // This is as passed to kpTool::draw(). - // - virtual bool drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRect) = 0; - void drawCreate (const QPoint &thisPoint, const QRect &normalizedRect); -private slots: - void delayedDrawCreate (); - - -private: - void cancelCreate (); - void endDrawCreate (); - - -private: - QVariant operationCreate (Operation op, - const QVariant &data1, const QVariant &data2); - - -// -// Move -// - -private: - // Called by constructor to initialize the "Move" draw type. - void initMove (); - // Called by destructor to uninitialize the "Move" draw type. - void uninitMove (); - - -private: - void beginMove (); - void endMove (); - - -protected: - virtual QString haventBegunDrawUserMessageMove () const = 0; -private: - void setCursorMove (); - - -protected: - // Sets the selection border mode when beginning to drag to move a - // selection. - // - // Subclasses may wish to reimplement but should still call the base - // implementation. Reimplementations should wrap the whole - // reimplementation in a kpViewManager::setQueueUpdates() block. - virtual void setSelectionBorderForBeginDrawMove (); -private: - void beginDrawMove (); -private slots: - void slotRMBMoveUpdateGUI (); - - -private: - void drawMove (const QPoint &thisPoint, const QRect &normalizedRect); - - -private: - void cancelMove (); -protected: - // Returns what the name of the command that moves -- but does not smear - // (not holding SHIFT) -- the selection, should be. - virtual QString nonSmearMoveCommandName () const; -private: - void endDrawMove (); - - -private: - QVariant operationMove (Operation op, - const QVariant &data1, const QVariant &data2); - - -// -// Resize/Scale -// - -private: - int onSelectionResizeHandle () const; - - -private: - // Called by constructor to initialize the "Resize/Scale" draw type. - void initResizeScale (); - // Called by destructor to uninitialize the "Resize/Scale" draw type. - void uninitResizeScale (); - - -private: - void beginResizeScale (); - void endResizeScale (); - - -protected: - virtual QString haventBegunDrawUserMessageResizeScale () const = 0; -private: - void setCursorResizeScale (); - - -protected: - // Sets the selection border mode when beginning to drag to resize or - // scale a selection. - // - // Subclasses may wish to reimplement but should still call the base - // implementation. Reimplementations should wrap the whole - // reimplementation in a kpViewManager::setQueueUpdates() block. - virtual void setSelectionBorderForBeginDrawResizeScale (); -private: - void beginDrawResizeScale (); - - -private: - // drawResizeScaleCalculateNewSelectionPosSize() calls us with what the - // x should be, but before any aspect maintenance - // operations. - // - // specifies whether a horizontal grip is being - // dragged. specifies whether a vertical grip is - // being dragged. - // - // The selection before any resizing/scaling (before the sequence of - // drags, where the mouse has been held down) is . - // - // The method should output its attempt at maintaining the aspect ratio. - // We say "attempt" because it is constrained by the minimum allowed - // size of the selection. - void drawResizeScaleTryKeepAspect (int newWidth, int newHeight, - bool horizontalGripDragged, bool verticalGripDragged, - const kpAbstractSelection &originalSelection, - int *newWidthOut, int *newHeightOut); - - void drawResizeScaleCalculateNewSelectionPosSize ( - const kpAbstractSelection &originalSelection, - int *newX, int *newY, - int *newWidth, int *newHeight); - - void drawResizeScale (const QPoint &thisPoint, const QRect &normalizedRect); - - -private: - void cancelResizeScale (); - void endDrawResizeScale (); - - -private: - QVariant operationResizeScale (Operation op, - const QVariant &data1, const QVariant &data2); - - -// -// User Setting Selection Options -// - -protected slots: - virtual void slotIsOpaqueChanged (bool isOpaque) = 0; - - -// -// Keyboard Events -// - -protected: - // Reimplemented to trap Esc presses for deselecting the selection. - // All other keypresses are passed to the base implementation. - virtual void keyPressEvent (QKeyEvent *e); - - -private: - struct kpAbstractSelectionToolPrivate * const d; -}; - - -#endif // kpAbstractSelectionTool_H diff --git a/kolourpaint/tools/selection/kpAbstractSelectionToolPrivate.h b/kolourpaint/tools/selection/kpAbstractSelectionToolPrivate.h deleted file mode 100644 index ea4a6ac5..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionToolPrivate.h +++ /dev/null @@ -1,92 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpAbstractSelectionToolPrivate_H -#define kpAbstractSelectionToolPrivate_H - - -#include - -#include - - -#include - -class kpAbstractSelectionContentCommand; -class kpToolSelectionMoveCommand; -class kpToolSelectionResizeScaleCommand; -class kpToolWidgetOpaqueOrTransparent; - - -struct kpAbstractSelectionToolPrivate -{ - kpAbstractSelectionTool::DrawType drawType; - kpAbstractSelectionContentCommand *currentSelContentCommand; - - // Whether the drag has been substantial enough to be considered as a - // non-NOP drag. The "substantial enough" critera is draw-type - // dependent and is usually based on how far the mouse has been - // dragged. See kpAbstractSelectionTool's API Doc for details. - bool dragAccepted; - - bool hadSelectionBeforeDraw; - - bool cancelledShapeButStillHoldingButtons; - - kpToolWidgetOpaqueOrTransparent *toolWidgetOpaqueOrTransparent; - - - // - // Create - // - - QTimer *createNOPTimer; - - - // - // Move - // - - kpToolSelectionMoveCommand *currentMoveCommand; - bool currentMoveCommandIsSmear; - - QPoint startMoveDragFromSelectionTopLeft; - - QTimer *RMBMoveUpdateGUITimer; - - - // - // Resize / Scale - // - - kpToolSelectionResizeScaleCommand *currentResizeScaleCommand; - int resizeScaleType; -}; - - -#endif // kpAbstractSelectionToolPrivate_H diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool_Create.cpp b/kolourpaint/tools/selection/kpAbstractSelectionTool_Create.cpp deleted file mode 100644 index 32ca20bb..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool_Create.cpp +++ /dev/null @@ -1,305 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// private -void kpAbstractSelectionTool::initCreate () -{ - d->createNOPTimer = new QTimer (this); - d->createNOPTimer->setSingleShot (true); - connect (d->createNOPTimer, SIGNAL (timeout ()), - this, SLOT (delayedDrawCreate ())); -} - -// private -void kpAbstractSelectionTool::uninitCreate () -{ - // d->createNOPTimer (deleted by QObject mechanism) -} - - -// private -void kpAbstractSelectionTool::beginCreate () -{ - // d->createNOPTimer -} - -// private -void kpAbstractSelectionTool::endCreate () -{ - // d->createNOPTimer -} - -//--------------------------------------------------------------------- -// use a crosshair cursor which is really always exactly 1 pixel wide -// to the contrary of the "themed" crosshair cursors which might look nice -// but does not allow to exactly position the hot-spot. -/* XPM */ -static const char *crosshair[]={ -"17 17 3 1", -". c None", -"x c #FFFFFF", -"# c #000000", -".......xxx.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -"xxxxxxxx#xxxxxxxx", -"x#######.#######x", -"xxxxxxxx#xxxxxxxx", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......x#x.......", -".......xxx......."}; - -// private -void kpAbstractSelectionTool::setCursorCreate () -{ - viewManager()->setCursor(QCursor(QPixmap(crosshair), 8, 8)); -} - -//--------------------------------------------------------------------- - -// protected virtual -void kpAbstractSelectionTool::setSelectionBorderForBeginDrawCreate () -{ - viewManager ()->setQueueUpdates (); - { - // LOREFACTOR: I suspect some calls to viewManager() in this - // file (including this) are redundant since any - // code that tweaks such settings, returns them to - // their original state, after the code is complete. - viewManager ()->setSelectionBorderVisible (true); - - viewManager ()->setSelectionBorderFinished (false); - } - viewManager ()->restoreQueueUpdates (); -} - -// private -void kpAbstractSelectionTool::beginDrawCreate () -{ - if (document ()->selection ()) - pushOntoDocument (); - - /*virtual*/setSelectionBorderForBeginDrawCreate (); - - // (single shot) - d->createNOPTimer->start (200/*ms*/); - - setUserMessage (cancelUserMessage ()); -} - - -// private -void kpAbstractSelectionTool::drawCreate (const QPoint &thisPoint, - const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\tnot moving - resizing rect to" << normalizedRect - << endl; - kDebug () << "\t\tcreateNOPTimer->isActive()=" - << d->createNOPTimer->isActive () - << " viewManhattanLength from startPoint=" - << viewUnderStartPoint ()->transformDocToViewX ((thisPoint - startPoint ()).manhattanLength ()) - << endl; -#endif - - QPoint accidentalDragAdjustedPoint = thisPoint; - if (d->createNOPTimer->isActive ()) - { - // See below "d->createNOPTimer->stop()". - Q_ASSERT (!d->dragAccepted); - - if (viewUnderStartPoint ()->transformDocToViewX ( - (accidentalDragAdjustedPoint - startPoint ()).manhattanLength ()) <= 6) - { - #if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tsuppress accidental movement"; - #endif - accidentalDragAdjustedPoint = startPoint (); - } - else - { - #if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tit's a \"big\" intended move - stop timer"; - #endif - d->createNOPTimer->stop (); - } - } - - - const bool hadSelection = document ()->selection (); - - const bool oldDrawAcceptedAsDrag = d->dragAccepted; - d->dragAccepted = /*virtual*/drawCreateMoreSelectionAndUpdateStatusBar ( - d->dragAccepted, - accidentalDragAdjustedPoint, - normalizedRect); - if (oldDrawAcceptedAsDrag) - Q_ASSERT (d->dragAccepted); - if (d->dragAccepted) - { - #if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tdrawHasDoneSomething - kill create timer"; - #endif - // No longer a NOP. - d->createNOPTimer->stop (); - } - - // Did we just create a selection? - if (!hadSelection && document ()->selection ()) - viewManager ()->setSelectionBorderVisible (true); -} - -// private slot -void kpAbstractSelectionTool::delayedDrawCreate () -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "kpAbstractSelectionTool::delayedDrawCreate() hasBegunDraw=" - << hasBegunDraw () - << " currentPoint=" << currentPoint () - << " lastPoint=" << lastPoint () - << " startPoint=" << startPoint () - << endl; -#endif - - // (just in case not called from single shot) - d->createNOPTimer->stop (); - - if (hasBegunDraw ()) - { - draw (currentPoint (), lastPoint (), normalizedRect ()); - } -} - - -// private -void kpAbstractSelectionTool::cancelCreate () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\twas creating sel - kill"; -#endif - - d->createNOPTimer->stop (); - - // TODO: should we give the user back the selection s/he had before (if any)? - if (document ()->selection ()) - document ()->selectionDelete (); -} - -// private -void kpAbstractSelectionTool::endDrawCreate () -{ - d->createNOPTimer->stop (); -} - - -// private -QVariant kpAbstractSelectionTool::operationCreate (Operation op, - const QVariant &data1, const QVariant &data2) -{ - (void) data1; - (void) data2; - - - switch (op) - { - case HaventBegunDrawUserMessage: - return /*virtual*/haventBegunDrawUserMessageCreate (); - - case SetCursor: - setCursorCreate (); - break; - - case BeginDraw: - beginDrawCreate (); - break; - - case Draw: - drawCreate (currentPoint (), normalizedRect ()); - break; - - case Cancel: - cancelCreate (); - break; - - case EndDraw: - endDrawCreate (); - break; - - default: - Q_ASSERT (!"Unhandled operation"); - break; - } - - - return QVariant (); -} diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool_KeyboardEvents.cpp b/kolourpaint/tools/selection/kpAbstractSelectionTool_KeyboardEvents.cpp deleted file mode 100644 index 038124c2..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool_KeyboardEvents.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include -#include -#include -#include -#include -#include - -#include - -#include - -//--------------------------------------------------------------------- - -// protected virtual [base kpTool] -void kpAbstractSelectionTool::keyPressEvent (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "kpAbstractSelectionTool::keyPressEvent(e->text='" - << e->text () << "')" << endl; -#endif - - e->ignore (); - - if (document ()->selection () && - !hasBegunDraw () && - e->key () == Qt::Key_Escape) - { - #if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "\tescape pressed with sel when not begun draw - deselecting" - << endl; - #endif - - pushOntoDocument (); - e->accept (); - } - else - { - #if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "\tkey processing did not accept (text was '" - << e->text () - << "') - passing on event to kpTool" - << endl; - #endif - - if ( document()->selection() && !hasBegunDraw() && - ((e->key() == Qt::Key_Left) || - (e->key() == Qt::Key_Right) || - (e->key() == Qt::Key_Up) || - (e->key() == Qt::Key_Down)) ) - { - // move selection with cursor keys pixel-wise - giveContentIfNeeded(); - - if ( !d->currentMoveCommand ) - { - d->currentMoveCommand = new kpToolSelectionMoveCommand( - QString()/*uninteresting child of macro cmd*/, - environ()->commandEnvironment()); - d->currentMoveCommandIsSmear = false; - } - - int dx, dy; - arrowKeyPressDirection(e, &dx, &dy); - d->currentMoveCommand->moveTo(document()->selection()->topLeft() + QPoint(dx, dy)); - endDrawMove(); - } - else - kpTool::keyPressEvent(e); - } -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool_Move.cpp b/kolourpaint/tools/selection/kpAbstractSelectionTool_Move.cpp deleted file mode 100644 index 65ee111e..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool_Move.cpp +++ /dev/null @@ -1,401 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::initMove () -{ - d->currentMoveCommand = 0; - - // d->currentMoveCommandIsSmear - - // d->startMoveDragFromSelectionTopLeft - - d->RMBMoveUpdateGUITimer = new QTimer (this); - d->RMBMoveUpdateGUITimer->setSingleShot (true); - connect (d->RMBMoveUpdateGUITimer, SIGNAL (timeout ()), - this, SLOT (slotRMBMoveUpdateGUI ())); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::uninitMove () -{ - // (state must be after construction, or after some time after endMove()) - Q_ASSERT (!d->currentMoveCommand); - - // d->currentMoveCommandIsSmear - - // d->startMoveDragFromSelectionTopLeft - - // d->RMBMoveUpdateGUITimer (deleted by QObject mechanism) -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::beginMove () -{ - // (state must be after construction, or after some time after endMove()) - Q_ASSERT (!d->currentMoveCommand); - - // d->currentMoveCommandIsSmear - - // d->startMoveDragFromSelectionTopLeft; - - // d->RMBMoveUpdateGUITimer -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::endMove () -{ - // (should have been killed by cancelMove() or endDrawMove()) - Q_ASSERT (!d->currentMoveCommand); - - // d->currentMoveCommandIsSmear - - // d->startMoveDragFromSelectionTopLeft - - // d->RMBMoveUpdateGUITimer -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::setCursorMove () -{ - viewManager ()->setCursor (Qt::SizeAllCursor); -} - -//--------------------------------------------------------------------- - -// protected virtual -void kpAbstractSelectionTool::setSelectionBorderForBeginDrawMove () -{ - // don't show border while moving - viewManager ()->setQueueUpdates (); - { - viewManager ()->setSelectionBorderVisible (false); - viewManager ()->setSelectionBorderFinished (true); - } - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::beginDrawMove () -{ - d->startMoveDragFromSelectionTopLeft = - currentPoint () - document ()->selection ()->topLeft (); - - if (mouseButton () == 0) - { - /*virtual*/setSelectionBorderForBeginDrawMove (); - } - else - { - // Don't hide sel border momentarily if user is just - // right _clicking_ selection. - // (single shot timer) - d->RMBMoveUpdateGUITimer->start (100/*ms*/); - } - - setUserMessage (cancelUserMessage ()); -} - -//--------------------------------------------------------------------- - -// private slot -void kpAbstractSelectionTool::slotRMBMoveUpdateGUI () -{ - // (just in case not called from single shot) - d->RMBMoveUpdateGUITimer->stop (); - - /*virtual*/setSelectionBorderForBeginDrawMove (); - - kpAbstractSelection * const sel = document ()->selection (); - if (sel) - setUserShapePoints (sel->topLeft ()); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::drawMove (const QPoint &thisPoint, const QRect &/*normalizedRect*/) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\tmoving selection"; -#endif - - kpAbstractSelection *sel = document ()->selection (); - - QRect targetSelRect (thisPoint.x () - d->startMoveDragFromSelectionTopLeft.x (), - thisPoint.y () - d->startMoveDragFromSelectionTopLeft.y (), - sel->width (), - sel->height ()); - -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tstartPoint=" << startPoint () - << " thisPoint=" << thisPoint - << " startDragFromSel=" << d->startMoveDragFromSelectionTopLeft - << " targetSelRect=" << targetSelRect - << endl; -#endif - - // Try to make sure selection still intersects document so that it's - // reachable. - - if (targetSelRect.right () < 0) - targetSelRect.translate (-targetSelRect.right (), 0); - else if (targetSelRect.left () >= document ()->width ()) - targetSelRect.translate (document ()->width () - targetSelRect.left () - 1, 0); - - if (targetSelRect.bottom () < 0) - targetSelRect.translate (0, -targetSelRect.bottom ()); - else if (targetSelRect.top () >= document ()->height ()) - targetSelRect.translate (0, document ()->height () - targetSelRect.top () - 1); - -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\t\tafter ensure sel rect clickable=" << targetSelRect; -#endif - - - if (!d->dragAccepted && - targetSelRect.topLeft () + d->startMoveDragFromSelectionTopLeft == startPoint ()) - { - #if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\t\t\tnop"; - #endif - - - if (!d->RMBMoveUpdateGUITimer->isActive ()) - { - // (slotRMBMoveUpdateGUI() calls similar line) - setUserShapePoints (sel->topLeft ()); - } - - // Prevent both NOP drag-moves - return; - } - - - if (d->RMBMoveUpdateGUITimer->isActive ()) - { - d->RMBMoveUpdateGUITimer->stop (); - slotRMBMoveUpdateGUI (); - } - - - giveContentIfNeeded (); - - - if (!d->currentMoveCommand) - { - d->currentMoveCommand = new kpToolSelectionMoveCommand ( - QString()/*uninteresting child of macro cmd*/, - environ ()->commandEnvironment ()); - d->currentMoveCommandIsSmear = false; - } - - - //viewManager ()->setQueueUpdates (); - //viewManager ()->setFastUpdates (); - - if (shiftPressed ()) - d->currentMoveCommandIsSmear = true; - - if (!d->dragAccepted && (controlPressed () || shiftPressed ())) - d->currentMoveCommand->copyOntoDocument (); - - d->currentMoveCommand->moveTo (targetSelRect.topLeft ()); - - if (shiftPressed ()) - d->currentMoveCommand->copyOntoDocument (); - - //viewManager ()->restoreFastUpdates (); - //viewManager ()->restoreQueueUpdates (); - - // REFACTOR: yuck, yuck - kpAbstractSelection *orgSel = d->currentMoveCommand->originalSelectionClone (); - QPoint start = orgSel->topLeft (); - delete orgSel; - QPoint end = targetSelRect.topLeft (); - setUserShapePoints (start, end, false/*don't set size*/); - setUserShapeSize (end.x () - start.x (), end.y () - start.y ()); - - - d->dragAccepted = true; -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::cancelMove () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\twas drag moving - undo drag and undo acquire"; -#endif - - d->RMBMoveUpdateGUITimer->stop (); - - // NOP drag? - if (!d->currentMoveCommand) - return; - -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\t\tundo currentMoveCommand"; -#endif - d->currentMoveCommand->finalize (); - d->currentMoveCommand->unexecute (); - delete d->currentMoveCommand; - d->currentMoveCommand = 0; -} - -//--------------------------------------------------------------------- - -// protected virtual -QString kpAbstractSelectionTool::nonSmearMoveCommandName () const -{ - return i18n ("Selection: Move"); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::endDrawMove () -{ - d->RMBMoveUpdateGUITimer->stop (); - - // NOP drag? - if (!d->currentMoveCommand) - return; - - d->currentMoveCommand->finalize (); - - kpMacroCommand *renamedCmd = 0; -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\thave moveCommand"; -#endif - if (d->currentMoveCommandIsSmear) - { - renamedCmd = new kpMacroCommand (i18n ("%1: Smear", - document ()->selection ()->name ()), - environ ()->commandEnvironment ()); - } - else - { - renamedCmd = new kpMacroCommand ( - /*virtual*/nonSmearMoveCommandName (), - environ ()->commandEnvironment ()); - } - - renamedCmd->addCommand (d->currentMoveCommand); - d->currentMoveCommand = 0; - - addNeedingContentCommand (renamedCmd); -} - -//--------------------------------------------------------------------- - -// private -QVariant kpAbstractSelectionTool::operationMove (Operation op, - const QVariant &data1, const QVariant &data2) -{ - (void) data1; - (void) data2; - - - switch (op) - { - case HaventBegunDrawUserMessage: - return /*virtual*/haventBegunDrawUserMessageMove (); - - case SetCursor: - setCursorMove (); - break; - - case BeginDraw: - beginDrawMove (); - break; - - case Draw: - drawMove (currentPoint (), normalizedRect ()); - break; - - case Cancel: - cancelMove (); - break; - - case EndDraw: - endDrawMove (); - break; - - default: - Q_ASSERT (!"Unhandled operation"); - break; - } - - return QVariant (); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/selection/kpAbstractSelectionTool_ResizeScale.cpp b/kolourpaint/tools/selection/kpAbstractSelectionTool_ResizeScale.cpp deleted file mode 100644 index 69e3f933..00000000 --- a/kolourpaint/tools/selection/kpAbstractSelectionTool_ResizeScale.cpp +++ /dev/null @@ -1,454 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_SELECTION 0 - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// private -int kpAbstractSelectionTool::onSelectionResizeHandle () const -{ - kpView *v = viewManager ()->viewUnderCursor (); - if (!v) - return 0; - - return v->mouseOnSelectionResizeHandle (currentViewPoint ()); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::initResizeScale () -{ - d->currentResizeScaleCommand = 0; - - // d->resizeScaleType -} - -// private -void kpAbstractSelectionTool::uninitResizeScale () -{ - // (state must be after construction, or after some time after endResizeScale()) - Q_ASSERT (!d->currentResizeScaleCommand); - - // d->resizeScaleType -} - - -// private -void kpAbstractSelectionTool::beginResizeScale () -{ - // (state must be after construction, or after some time after endResizeScale()) - Q_ASSERT (!d->currentResizeScaleCommand); - - // d->resizeScaleType -} - -// private -void kpAbstractSelectionTool::endResizeScale () -{ - // (should have been killed by cancelResizeScale() or endResizeScale()) - Q_ASSERT (!d->currentResizeScaleCommand); - - // d->resizeScaleType -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::setCursorResizeScale () -{ -#if DEBUG_KP_TOOL_SELECTION && 0 - kDebug () << "\tonSelectionResizeHandle=" - << onSelectionResizeHandle () << endl; -#endif - Qt::CursorShape shape = Qt::ArrowCursor; - - switch (onSelectionResizeHandle ()) - { - case (kpView::Top | kpView::Left): - case (kpView::Bottom | kpView::Right): - shape = Qt::SizeFDiagCursor; - break; - - case (kpView::Bottom | kpView::Left): - case (kpView::Top | kpView::Right): - shape = Qt::SizeBDiagCursor; - break; - - case kpView::Top: - case kpView::Bottom: - shape = Qt::SizeVerCursor; - break; - - case kpView::Left: - case kpView::Right: - shape = Qt::SizeHorCursor; - break; - } - - viewManager ()->setCursor (shape); -} - -//--------------------------------------------------------------------- - -// protected virtual -void kpAbstractSelectionTool::setSelectionBorderForBeginDrawResizeScale () -{ - viewManager ()->setQueueUpdates (); - { - viewManager ()->setSelectionBorderVisible (true); - viewManager ()->setSelectionBorderFinished (true); - } - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::beginDrawResizeScale () -{ - d->resizeScaleType = onSelectionResizeHandle (); - - /*virtual*/setSelectionBorderForBeginDrawResizeScale (); - - setUserMessage (cancelUserMessage ()); -} - -//--------------------------------------------------------------------- - - -// private -void kpAbstractSelectionTool::drawResizeScaleTryKeepAspect ( - int newWidth, int newHeight, - bool horizontalGripDragged, bool verticalGripDragged, - const kpAbstractSelection &originalSelection, - int *newWidthOut, int *newHeightOut) -{ - const int oldWidth = originalSelection.width (), - oldHeight = originalSelection.height (); - - // Width changed more than height? At equality, favor width. - // Fix width, change height. - // - // We use and to prevent - // e.g. the situation where we've dragged such that newWidth < oldWidth but - // we're not dragging a vertical grip. We certainly don't want this - // code to modify the width - we want to fix the width and change the - // height. - if ((horizontalGripDragged ? double (newWidth) / oldWidth : 0) >= - (verticalGripDragged ? double (newHeight) / oldHeight : 0)) - { - *newHeightOut = newWidth * oldHeight / oldWidth; - *newHeightOut = qMax (originalSelection.minimumHeight (), *newHeightOut); - } - // Height changed more than width? - // Fix height, change width. - else - { - *newWidthOut = newHeight * oldWidth / oldHeight; - *newWidthOut = qMax (originalSelection.minimumWidth (), *newWidthOut); - } -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::drawResizeScaleCalculateNewSelectionPosSize ( - const kpAbstractSelection &originalSelection, - int *newX, int *newY, - int *newWidth, int *newHeight) -{ - // - // Determine new width. - // - - // Dragging left or right grip? - // If left, positive X drags decrease width. - // If right, positive X drags increase width. - int userXSign = 0; - if (d->resizeScaleType & kpView::Left) - userXSign = -1; - else if (d->resizeScaleType & kpView::Right) - userXSign = +1; - - // Calcluate new width. - *newWidth = originalSelection.width () + - userXSign * (currentPoint ().x () - startPoint ().x ()); - - // Don't allow new width to be less than that kind of selection type's - // minimum. - *newWidth = qMax (originalSelection.minimumWidth (), *newWidth); - - - // - // Determine new height. - // - - // Dragging top or bottom grip? - // If top, positive Y drags decrease height. - // If bottom, positive Y drags increase height. - int userYSign = 0; - if (d->resizeScaleType & kpView::Top) - userYSign = -1; - else if (d->resizeScaleType & kpView::Bottom) - userYSign = +1; - - // Calcluate new height. - *newHeight = originalSelection.height () + - userYSign * (currentPoint ().y () - startPoint ().y ()); - - // Don't allow new height to be less than that kind of selection type's - // minimum. - *newHeight = qMax (originalSelection.minimumHeight (), *newHeight); - - - // Keep aspect ratio? - if (shiftPressed ()) - { - drawResizeScaleTryKeepAspect (*newWidth, *newHeight, - (userXSign != 0)/*X or XY grip dragged*/, - (userYSign != 0)/*Y or XY grip dragged*/, - originalSelection, - newWidth/*ptr*/, newHeight/*ptr*/); - } - - - *newX = originalSelection.x (); - *newY = originalSelection.y (); - - - // - // Adjust x/y to new width/height for left/top resizes. - // - - if (d->resizeScaleType & kpView::Left) - { - *newX -= (*newWidth - originalSelection.width ()); - } - - if (d->resizeScaleType & kpView::Top) - { - *newY -= (*newHeight - originalSelection.height ()); - } - -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tnewX=" << *newX - << " newY=" << *newY - << " newWidth=" << *newWidth - << " newHeight=" << *newHeight - << endl; -#endif -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::drawResizeScale ( - const QPoint &thisPoint, - const QRect &/*normalizedRect*/) -{ -#if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\tresize/scale"; -#endif - - kpAbstractSelection *sel = document ()->selection (); - - if (!d->dragAccepted && thisPoint == startPoint ()) - { - #if DEBUG_KP_TOOL_SELECTION && 1 - kDebug () << "\t\tnop"; - #endif - - setUserShapePoints (QPoint (sel->width (), sel->height ())); - return; - } - - - giveContentIfNeeded (); - - - if (!d->currentResizeScaleCommand) - { - d->currentResizeScaleCommand - = new kpToolSelectionResizeScaleCommand (environ ()->commandEnvironment ()); - } - - - const kpAbstractSelection *originalSelection = - d->currentResizeScaleCommand->originalSelection (); - - - // There is nothing illegal about position (-1,-1) but why not. - int newX = -1, newY = -1, - newWidth = 0, newHeight = 0; - - // This should change all of the above values. - drawResizeScaleCalculateNewSelectionPosSize ( - *originalSelection, - &newX, &newY, - &newWidth, &newHeight); - - - viewManager ()->setFastUpdates (); - { - d->currentResizeScaleCommand->resizeAndMoveTo ( - newWidth, newHeight, - QPoint (newX, newY), - true/*smooth scale delayed*/); - } - viewManager ()->restoreFastUpdates (); - - setUserShapePoints (QPoint (originalSelection->width (), - originalSelection->height ()), - QPoint (newWidth, - newHeight), - false/*don't set size*/); - setUserShapeSize (newWidth - originalSelection->width (), - newHeight - originalSelection->height ()); - - - d->dragAccepted = true; -} - -//--------------------------------------------------------------------- - - -// private -void kpAbstractSelectionTool::cancelResizeScale () -{ -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\twas resize/scale sel - kill"; -#endif - - // NOP drag? - if (!d->currentResizeScaleCommand) - return; - -#if DEBUG_KP_TOOL_SELECTION - kDebug () << "\t\tundo currentResizeScaleCommand"; -#endif - d->currentResizeScaleCommand->finalize (); // (unneeded but let's be safe) - d->currentResizeScaleCommand->unexecute (); - delete d->currentResizeScaleCommand; - d->currentResizeScaleCommand = 0; -} - -//--------------------------------------------------------------------- - -// private -void kpAbstractSelectionTool::endDrawResizeScale () -{ - // NOP drag? - if (!d->currentResizeScaleCommand) - return; - - d->currentResizeScaleCommand->finalize (); - - addNeedingContentCommand (d->currentResizeScaleCommand); - d->currentResizeScaleCommand = 0; -} - -//--------------------------------------------------------------------- - -// private -QVariant kpAbstractSelectionTool::operationResizeScale (Operation op, - const QVariant &data1, const QVariant &data2) -{ - (void) data1; - (void) data2; - - - switch (op) - { - case HaventBegunDrawUserMessage: - return /*virtual*/haventBegunDrawUserMessageResizeScale (); - - case SetCursor: - setCursorResizeScale (); - break; - - case BeginDraw: - beginDrawResizeScale (); - break; - - case Draw: - drawResizeScale (currentPoint (), normalizedRect ()); - break; - - case Cancel: - cancelResizeScale (); - break; - - case EndDraw: - endDrawResizeScale (); - break; - - default: - Q_ASSERT (!"Unhandled operation"); - break; - } - - - return QVariant (); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/selection/text/kpToolText.cpp b/kolourpaint/tools/selection/text/kpToolText.cpp deleted file mode 100644 index d05ac354..00000000 --- a/kolourpaint/tools/selection/text/kpToolText.cpp +++ /dev/null @@ -1,221 +0,0 @@ - -// REFACTOR: For all files involved in the class, refactor remaining bits and pieces and add APIDoc - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -kpToolText::kpToolText (kpToolSelectionEnvironment *environ, QObject *parent) - : kpAbstractSelectionTool (i18n ("Text"), i18n ("Writes text"), - Qt::Key_T, - environ, parent, "tool_text"), - d (new kpToolTextPrivate ()) -{ -} - -kpToolText::~kpToolText () -{ - delete d; -} - - -// protected virtual [kpAbstractSelectionTool] -kpAbstractSelectionContentCommand *kpToolText::newGiveContentCommand () const -{ - kpTextSelection *textSel = document ()->textSelection (); -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::newGiveContentCommand()" - << " textSel=" << textSel - << "; hasContent=" << textSel->hasContent () << endl; -#endif - Q_ASSERT (textSel && !textSel->hasContent ()); - - return new kpToolTextGiveContentCommand ( - *textSel, - QString()/*uninteresting child of macro cmd*/, - environ ()->commandEnvironment ()); -} - - -// protected virtual [kpAbstractSelectionTool] -QString kpToolText::nameOfCreateCommand () const -{ - return i18n ("Text: Create Box"); -} - - -// protected virtual [base kpAbstractSelectionTool] -void kpToolText::setSelectionBorderForHaventBegunDraw () -{ - viewManager ()->setQueueUpdates (); - { - kpAbstractSelectionTool::setSelectionBorderForHaventBegunDraw (); - viewManager ()->setTextCursorEnabled (true); - } - viewManager ()->restoreQueueUpdates (); -} - - -// public virtual [base kpAbstractSelectionTool] -void kpToolText::begin () -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "kpToolText::begin()"; -#endif - - environ ()->enableTextToolBarActions (true); - - // We don't actually need this since begin() already calls it via - // setSelectionBorderForHaventBegunDraw(). We leave this in for - // consistency with end(). - viewManager ()->setTextCursorEnabled (true); - viewManager()->setInputMethodEnabled (true); - - endTypingCommands (); - - kpAbstractSelectionTool::begin (); -} - -// public virtual [base kpAbstractSelectionTool] -void kpToolText::end () -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "kpToolText::end()"; -#endif - - kpAbstractSelectionTool::end (); - - viewManager()->setInputMethodEnabled (false); - viewManager ()->setTextCursorEnabled (false); - environ ()->enableTextToolBarActions (false); -} - - -// public -bool kpToolText::hasBegunText () const -{ - return (d->insertCommand || - d->enterCommand || - d->backspaceCommand || - d->backspaceWordCommand || - d->deleteCommand || - d->deleteWordCommand); -} - -// public virtual [base kpTool] -bool kpToolText::hasBegunShape () const -{ - return (hasBegunDraw () || hasBegunText ()); -} - - -// protected virtual [base kpAbstractSelectionTool] -kpAbstractSelectionTool::DrawType kpToolText::calculateDrawTypeInsideSelection () const -{ - if (onSelectionToSelectText () && !controlOrShiftPressed ()) - { - return kpAbstractSelectionTool::SelectText; - } - - return kpAbstractSelectionTool::calculateDrawTypeInsideSelection (); -} - - -// public virtual [base kpAbstractSelectionTool] -void kpToolText::cancelShape () -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::cancelShape()"; -#endif - - if (drawType () != None) - kpAbstractSelectionTool::cancelShape (); - else if (hasBegunText ()) - { - endTypingCommands (); - - commandHistory ()->undo (); - } - else - kpAbstractSelectionTool::cancelShape (); -} - - -// public virtual [base kpTool] -void kpToolText::endShape (const QPoint &thisPoint, const QRect &normalizedRect) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::endShape()"; -#endif - - if (drawType () != None) - kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); - else if (hasBegunText ()) - endTypingCommands (); - else - kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); -} - - -// protected virtual [base kpAbstractSelectionTool] -QVariant kpToolText::operation (DrawType drawType, Operation op, - const QVariant &data1, const QVariant &data2) -{ - if (drawType == SelectText) - return selectTextOperation (op, data1, data2); - else - return kpAbstractSelectionTool::operation (drawType, op, data1, data2); -} - - -#include "moc_kpToolText.cpp" diff --git a/kolourpaint/tools/selection/text/kpToolText.h b/kolourpaint/tools/selection/text/kpToolText.h deleted file mode 100644 index 9c1ffe00..00000000 --- a/kolourpaint/tools/selection/text/kpToolText.h +++ /dev/null @@ -1,725 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TEXT_H -#define KP_TOOL_TEXT_H - - -#include - - -#include - -class kpColor; -class kpTextStyle; - -class kpToolTextInsertCommand; -class kpToolTextEnterCommand; -class kpToolTextBackspaceCommand; -class kpToolTextDeleteCommand; - - -// -// kpAbstractSelectionTool considers a drawing operation to be a mouse -// drag that creates, moves or resize/scales a selection. -// -// kpToolText also considers any such drawing operation and alternatively, -// any active text command (e.g. inserting text), to be the "current -// shape". kpTool's shape methods (e.g. hasBegunShape() and endShape()) -// have been overloaded to ensure that they operate on whatever operation -// (drawing or text) is active. -// -// It is not possible to have a drawing command and text command active -// simultaneously. However, it is possible to have neither active. -// -// Text commands do not end until a different kind of key is pressed or -// a drawing command commences. For instance, if you were to -// type a character of text, a kpToolTextInsertCommand would be added to -// the command history but stays active so that future typed characters -// would simply be added to this command. As soon as the user presses -// a different kind of key (e.g. arrow key, backspace) or drags the mouse, -// the command is no longer kept active. -// -// -// kpToolText implements a new drawing type, "SelectText", for moving the -// text cursor to the clicked location. -// -// -// As an exception to the standard kpAbstractSelectionTool behavior, -// a single click -- with no dragging -- can be used to create a new text -// box. -// -class kpToolText : public kpAbstractSelectionTool -{ -Q_OBJECT - -public: - kpToolText (kpToolSelectionEnvironment *environ, QObject *parent); - virtual ~kpToolText (); - - -// -// Text Command Handling -// - -private: - /** - * Indicates that no current text editing command is active. - * You must call this, via endShape(), when ending the current command - * (e.g. changing from backspacing to inserting text - * e.g.2. changing from moving/resizing to inserting text). - * - * It achieves this by zero'ing out all the d->.+Command pointers. - * It does not delete the pointers as they should be owned by the - * commandHistory(). - * - * If you call this excessively, you will break up commands into many - * smaller commands e.g. a text insertion command with 10 characters - * might be split into 10 text insertion commands, each containing 1 - * character. - */ - void endTypingCommands (); - - - /** - * Ends the current text editing command by eventually calling - * endTypingCommands(), returns a new - * kpToolTextBackspaceCommand and adds it to the commandHistory(). - * - * @param cmd A Pointer to one of the d->backspace.*Command pointers. - * On function return, the pointed-to d->backspace.*Command - * pointer will point to a new kpToolTextBackspaceCommand. - */ - void addNewBackspaceCommand (kpToolTextBackspaceCommand **cmd); - - /** - * Ends the current text editing command by eventually calling - * endTypingCommands(), returns a new - * kpToolTextDeleteCommand and adds it to the commandHistory(). - * - * @param cmd A Pointer to one of the d->delete.*Command pointers. On - * function return, the pointed-to d->delete.*Command pointer - * will point to a new kpToolTextDeleteCommand. - */ - void addNewDeleteCommand (kpToolTextDeleteCommand **cmd); - - void addNewEnterCommand (kpToolTextEnterCommand **cmd); - - void addNewInsertCommand (kpToolTextInsertCommand **cmd); - - -// -// Drawing -// - -protected: - virtual kpAbstractSelectionContentCommand *newGiveContentCommand () const; - - virtual QString nameOfCreateCommand () const; - - -protected: - virtual void setSelectionBorderForHaventBegunDraw (); - - -public: - virtual void begin (); - virtual void end (); - - -public: - bool hasBegunText () const; - virtual bool hasBegunShape () const; - - -// -// Drawing - Beginning a Drag -// - -protected: - virtual DrawType calculateDrawTypeInsideSelection () const; - - -public: - virtual void cancelShape (); - - -public: - virtual void endShape (const QPoint &thisPoint, const QRect &normalizedRect); - - -// -// Drawing - Operation Dispatching -// - -protected: - virtual QVariant operation (DrawType drawType, Operation op, - const QVariant &data1 = QVariant (), const QVariant &data2 = QVariant ()); - - -// -// Create -// - -protected: - virtual QString haventBegunDrawUserMessageCreate () const; - - -protected: - virtual void setSelectionBorderForBeginDrawCreate (); - - -private: - // Returns the suggested width/height of a click-created text box: - // - // = starting X/Y of the entire drag - // = current ending X/Y of the entire drag - // - // = the preferred minimum width/height of the selection - // = the legal minimum width/height of the selection - // - // = the width/height of the document - int calcClickCreateDimension (int mouseStart, int mouseEnd, - int preferredMin, int smallestMin, - int docSize); - bool shouldCreate ( - bool drawAcceptedAsDrag, - const QPoint &accidentalDragAdjustedPoint, - const kpTextStyle &textStyle, - int *minimumWidthOut, int *minimumHeightOut, - bool *newDragHasBegun); -protected: - virtual bool drawCreateMoreSelectionAndUpdateStatusBar ( - bool drawAcceptedAsDrag, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRectIn); - - -// -// Move -// - -protected: - virtual QString haventBegunDrawUserMessageMove () const; - - -protected: - virtual void setSelectionBorderForBeginDrawMove (); - - -protected: - virtual QString nonSmearMoveCommandName () const; - - -// -// Resize/Scale -// - -protected: - virtual QString haventBegunDrawUserMessageResizeScale () const; - - -protected: - virtual void setSelectionBorderForBeginDrawResizeScale (); - - -// -// Select Text -// - -private: - bool onSelectionToSelectText () const; - - -private: - QString haventBegunDrawUserMessageSelectText () const; - - void setCursorSelectText (); - - -private: - void beginDrawSelectText (); - - -protected: - virtual QVariant selectTextOperation (Operation op, - const QVariant &data1 = QVariant (), const QVariant &data2 = QVariant ()); - - -// -// User Changing Text Style Elements -// - -protected: - bool shouldChangeTextStyle () const; - - /** - * Adds a kpToolTextChangeStyleCommand to commandHistory(). - * - * Call this when an element of the text style changes (e.g. user - * changes font size, boldness, color etc.). - * - * @param name Name of the command in the command history. - * @param newTextStyle The new and current text style. - * @param oldTextStyle The old and previous text style. - * - * You should only call this if shouldChangeTextStyle() returns true. - */ - void changeTextStyle (const QString &name, - const kpTextStyle &newTextStyle, - const kpTextStyle &oldTextStyle); - -protected slots: - virtual void slotIsOpaqueChanged (bool isOpaque); - - -protected: - /** - * Asks kpTool to call slotColorsSwapped() when the foreground and - * background color are swapped. - * - * Re-implemented from kpTool. - */ - virtual bool careAboutColorsSwapped () const { return true; } - -protected slots: - virtual void slotColorsSwapped (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor); - - virtual void slotForegroundColorChanged (const kpColor &color); - virtual void slotBackgroundColorChanged (const kpColor &color); - virtual void slotColorSimilarityChanged (double, int); - -public slots: - void slotFontFamilyChanged (const QString &fontFamily, const QString &oldFontFamily); - void slotFontSizeChanged (int fontSize, int oldFontSize); - void slotBoldChanged (bool isBold); - void slotItalicChanged (bool isItalic); - void slotUnderlineChanged (bool isUnderline); - void slotStrikeThruChanged (bool isStrikeThru); - - -// -// Text Cursor Calculations (all static, no mutations) -// - -protected: - /** - * @param textLines One or more lines of text. - * @param cursorRow Current row of the cursor. - * @param cursorCol Current column of the cursor. - * - * @returns whether the cursor is currently on a word character - * (not a space). - */ - static bool CursorIsOnWordChar (const QList &textLines, - int cursorRow, int cursorCol); - - - /** - * @param textLines One or more lines of text. - * @param cursorRow Current row of the cursor. - * @param cursorCol Current column of the cursor. - * - * @returns whether the given cursor position is at the start of - * textLines (on the first character of the first line) - * i.e. when moveCursorLeft() won't do anything. - */ - static bool CursorIsAtStart (const QList &textLines, - int cursorRow, int cursorCol); - - /** - * @param textLines One or more lines of text. - * @param cursorRow Current row of the cursor. - * @param cursorCol Current column of the cursor. - * - * @returns whether the given cursor position is at the end of - * textLines (after the last character of the last line) - * i.e. when moveCursorRight() won't do anything. - */ - static bool CursorIsAtEnd (const QList &textLines, - int cursorRow, int cursorCol); - - - /** - * Moves the given cursor position one character to the left, if - * this is possible (i.e. if not cursorIsAtStart()). This may move the - * cursor one line up. - * - * @param textLines One or more lines of text. - * @param cursorRow Value-result parameter, initially containing - * the current row of the cursor and modified on - * return to indicate the new row. - * @param cursorCol Value-result parameter, initially containing - * the current column of the cursor and modified on - * return to indicate the new column. - */ - static void MoveCursorLeft (const QList &textLines, - int *cursorRow, int *cursorCol); - - /** - * Moves the given cursor position one character to the right, if - * this is possible (i.e. if not cursorIsAtEnd()). This may move the - * cursor one line down. - * - * @param textLines One or more lines of text. - * @param cursorRow Value-result parameter, initially containing - * the current row of the cursor and modified on - * return to indicate the new row. - * @param cursorCol Value-result parameter, initially containing - * the current column of the cursor and modified on - * return to indicate the new column. - */ - static void MoveCursorRight (const QList &textLines, - int *cursorRow, int *cursorCol); - - - /** - * Moves the row and column values, representing the current cursor - * location, to the start of the current word. If the cursor is - * on a space, it will move to the start of the previous word. - * - * This is normally used for a CTRL+Left or CTRL+Backspace behaviour. - * - * @param textLines One or more lines of text. - * @param cursorRow Value-result parameter, initially containing - * the current row of the cursor and modified on - * return to indicate the new row. - * @param cursorCol Value-result parameter, initially containing - * the current column of the cursor and modified on - * return to indicate the new column. - * - * @returns the number of times, it attempted to move left. - * Note: Attempting to moving left when cursorIsAtStart() - * may still be counted as a move. - */ - static int MoveCursorToWordStart (const QList &textLines, - int *cursorRow, int *cursorCol); - - /** - * Moves the row and column values, representing the current cursor - * location, to the start of the next word. This is regardless of - * whether the cursor starts on a space or not. - * - * This is normally used for a CTRL+Right or CTRL+Delete behaviour. - * - * @param textLines One or more lines of text. - * @param cursorRow Value-result parameter, initially containing - * the current row of the cursor and modified on - * return to indicate the new row. - * @param cursorCol Value-result parameter, initially containing - * the current column of the cursor and modified on - * return to indicate the new column. - * - * @returns the number of times, it attempted to move right. - * Note: Attempting to moving right when cursorIsAtEnd() - * may still be counted as a move. - */ - static int MoveCursorToNextWordStart (const QList &textLines, - int *cursorRow, int *cursorCol); - - -// -// Keyboard Events - Handling Arrow Keys -// -// These methods always: -// -// 1. Before doing anything, end the current shape (e.g. a text editing command or -// selection move command). This is done for 2 reasons: -// -// a) The user has interrupted the current command e.g. if I were to -// type some text, press an arrow key and then type text again, the two -// periods of text typing should be separate commands due to the arrow -// key interruption. -// -// b) To simplify the code by avoiding interference with the current command -// esp. since commands do not expect the cursor to move in the middle. -// -// 2. Accept the event as it is always intended for the method. This is even -// if the operation could not complete e.g. an attempt to move the cursor -// left when it is already at column 0. -// -protected: - /** - * Moves the text cursor up one character. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleUpKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - /** - * Moves the text cursor down one character. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleDownKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - /** - * Moves the text cursor left one character or if CTRL is held, one - * word. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleLeftKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - /** - * Moves the text cursor right one character or if CTRL is held, one - * word. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleRightKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - - /** - * Moves the text cursor to the start of the line and if CTRL is held, - * to the first line. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleHomeKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - /** - * Moves the text cursor to after the last character of the current - * text line or if CTRL is held, after the last character of the last - * line. Accepts the key event @p e. - * - * If there was an active text editing or selection command, it ends it first. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleEndKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - -// -// Keyboard Events - Handling Typing Keys -// -// For each method, if the respective event was actually intended for the -// method: -// -// 1. If the event will not be a NOP: -// -// If the current command is not the same as what this method would produce, -// it starts a new one, ending the current one (using the addNew*Command() -// methods). If the current command is the same, it simply extends the -// current command e.g. if the current command was a kpToolTextInsertCommand -// and the user typed another character of text, that character would just be -// added to that command. -// -// 2. Accept the event. This is even if the operation could not complete e.g. -// an attempt backspace when the cursor is at column 0. -// -// If the event was not intended for the method (e.g. pressing CTRL, Caps Lock -// or any other key that does not produce text, in handleTextTyped()), nothing -// happens. -// -protected: - /** - * Backspaces and if the active text editing command is not - * d->backspaceCommand, it calls addNewBackspaceCommand() on - * d->backspaceCommand first. - * - * If CTRL is held, it backspaces to the start of the active word - * and if the current text editing command was not - * d->backspaceWordCommand, it calls addNewBackspaceCommand() on - * d->backspaceWordCommand first. - * - * In this way, Backspace and CTRL+Backspace are separate entries - * in the commandHistory(). - * - * Accepts the key event @p e. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleBackspaceKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - /** - * Deletes and if the active text editing command is not - * d->deleteCommand, it calls addNewDeleteCommand() on - * d->deleteCommand first. - * - * If CTRL is held, it deletes to the start of the next word - * and if the active text editing command was not - * d->deleteWordCommand, it calls addNewDeleteCommand() on - * d->deleteWordCommand first. - * - * In this way, Delete and CTRL+Delete are separate entries - * in the commandHistory(). - * - * Accepts the key event @p e. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleDeleteKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - - /** - * Enters and if the active text editing command is not - * d->enterCommand, it ends the command, constructs d->enterCommand adding - * it to commandHistory(), first. - * - * Accepts the key event @p e. - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleEnterKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - - /** - * Inserts the printable characters of e->text() and accepts the key - * event @p e. If the active text editing command is not - * d->insertCommand, it ends the command, constructs d->insertCommand - * adding it to commandHistory(), first. - * - * If e->text() does not contain any printable characters, it does not - * do anything. As a result, it would not accept the key event @e. - * This printability restriction prevents control characters from being - * typed when they should be trapped by a keyPressEvent() that is lower - * in the call chain (for e.g. CTRL+Z for Undo). - * - * @param e Mutable key event information. - * @param textLines One or more lines of text (convenience parameter). - * @param cursorRow Current row of the cursor (convenience parameter). - * @param cursorCol Current column of the cursor (convenience parameter). - * - * Called by keyPressEvent(). - */ - void handleTextTyped (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol); - - -// -// Keyboard Events -// - -protected: - // Prevents actions with single letter/number shortcuts from eating - // keystrokes while a text selection is active. This is important - // because the Tool Box actions default to single letter/number - // shortcuts. - virtual bool viewEvent (QEvent *e); - - /** - * Handles key press events. - * - * If the user is currently drawing/resizing something or if the - * document doesn't have a text selection, it passes control to the - * otherwise overridden kpAbstractSelectionTool::keyPressEvent(). - * - * Else, for a recognised key it calls handle.*Press(). If a - * recognised key was not pressed, it assumes that one or more text - * characters was typed, and calls handleTextTyped(). If none of the - * handle.*() methods call e->accept(), it passes control to the - * otherwise overridden kpAbstractSelectionTool::keyPressEvent(). - * - * @param e Mutable key event information. - * - * Re-implemented from kpAbstractSelectionTool. - */ - - virtual void keyPressEvent (QKeyEvent *e); - - -// -// Input Method Text Entry -// - -protected: - virtual void inputMethodEvent (QInputMethodEvent *e); - - -private: - struct kpToolTextPrivate * const d; -}; - - -#endif // KP_TOOL_TEXT_H diff --git a/kolourpaint/tools/selection/text/kpToolTextPrivate.h b/kolourpaint/tools/selection/text/kpToolTextPrivate.h deleted file mode 100644 index 4a74e253..00000000 --- a/kolourpaint/tools/selection/text/kpToolTextPrivate.h +++ /dev/null @@ -1,51 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpToolTextPrivate_H -#define kpToolTextPrivate_H - - -#include - - -class kpToolTextInsertCommand; -class kpToolTextEnterCommand; -class kpToolTextBackspaceCommand; -class kpToolTextDeleteCommand; - - -struct kpToolTextPrivate -{ - kpToolTextInsertCommand *insertCommand; - kpToolTextEnterCommand *enterCommand; - kpToolTextBackspaceCommand *backspaceCommand, *backspaceWordCommand; - kpToolTextDeleteCommand *deleteCommand, *deleteWordCommand; -}; - - -#endif // kpToolTextPrivate_H diff --git a/kolourpaint/tools/selection/text/kpToolText_Commands.cpp b/kolourpaint/tools/selection/text/kpToolText_Commands.cpp deleted file mode 100644 index d87ab573..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_Commands.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - - -// private -void kpToolText::endTypingCommands () -{ - d->insertCommand = 0; - d->enterCommand = 0; - - d->backspaceCommand = 0; - d->backspaceWordCommand = 0; - - d->deleteCommand = 0; - d->deleteWordCommand = 0; -} - - -// private -void kpToolText::addNewBackspaceCommand (kpToolTextBackspaceCommand **cmd) -{ - // TODO: why not endShapeInternal(); ditto for everywhere else in kpToolText*.cpp? - if (hasBegunShape ()) - { - endShape (currentPoint (), normalizedRect ()); - } - - giveContentIfNeeded (); - - *cmd = new kpToolTextBackspaceCommand (i18n ("Text: Backspace"), - viewManager ()->textCursorRow (), viewManager ()->textCursorCol (), - kpToolTextBackspaceCommand::DontAddBackspaceYet, - environ ()->commandEnvironment ()); - addNeedingContentCommand (*cmd); -} - -// private -void kpToolText::addNewDeleteCommand (kpToolTextDeleteCommand **cmd) -{ - if (hasBegunShape ()) - { - endShape (currentPoint (), normalizedRect ()); - } - - giveContentIfNeeded (); - - *cmd = new kpToolTextDeleteCommand (i18n ("Text: Delete"), - viewManager ()->textCursorRow (), viewManager ()->textCursorCol (), - kpToolTextDeleteCommand::DontAddDeleteYet, - environ ()->commandEnvironment ()); - addNeedingContentCommand (*cmd); -} - -// private -void kpToolText::addNewEnterCommand (kpToolTextEnterCommand **cmd) -{ - if (hasBegunShape ()) - { - endShape (currentPoint (), normalizedRect ()); - } - - giveContentIfNeeded (); - - *cmd = new kpToolTextEnterCommand (i18n ("Text: New Line"), - viewManager ()->textCursorRow (), viewManager ()->textCursorCol (), - kpToolTextEnterCommand::DontAddEnterYet, - environ ()->commandEnvironment ()); - addNeedingContentCommand (*cmd); -} - -// private -void kpToolText::addNewInsertCommand (kpToolTextInsertCommand **cmd) -{ - if (hasBegunShape ()) - { - endShape (currentPoint (), normalizedRect ()); - } - - giveContentIfNeeded (); - - *cmd = new kpToolTextInsertCommand (i18n ("Text: Write"), - viewManager ()->textCursorRow (), viewManager ()->textCursorCol (), - QString (), - environ ()->commandEnvironment ()); - addNeedingContentCommand (*cmd); -} diff --git a/kolourpaint/tools/selection/text/kpToolText_Create.cpp b/kolourpaint/tools/selection/text/kpToolText_Create.cpp deleted file mode 100644 index c2c85681..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_Create.cpp +++ /dev/null @@ -1,288 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include - - -// protected virtual [kpAbstractSelectionTool] -QString kpToolText::haventBegunDrawUserMessageCreate () const -{ - return i18n ("Left drag to create text box."); -} - - -// protected virtual [base kpAbstractSelectionTool] -void kpToolText::setSelectionBorderForBeginDrawCreate () -{ - viewManager ()->setQueueUpdates (); - { - kpAbstractSelectionTool::setSelectionBorderForBeginDrawCreate (); - viewManager ()->setTextCursorEnabled (false); - } - viewManager ()->restoreQueueUpdates (); -} - - -// private -int kpToolText::calcClickCreateDimension (int mouseStart, int mouseEnd, - int preferredMin, int smallestMin, - int docSize) -{ - Q_ASSERT (preferredMin >= smallestMin); - Q_ASSERT (docSize > 0); - - // Get reasonable width/height for a text box. - int ret = preferredMin; - - // X or Y increasing? - if (mouseEnd >= mouseStart) - { - // Text box extends past document width/height? - if (mouseStart + ret - 1 >= docSize) - { - // Cap width/height to not extend past but not below smallest - // possible selection width/height - ret = qMax (smallestMin, docSize - mouseStart); - } - } - // X or Y decreasing - else - { - // Text box extends past document start? - // TODO: I doubt this code can be invoked for a click. - // Maybe very tricky interplay with accidental drag detection? - if (mouseStart - ret + 1 < 0) - { - // Cap width/height to not extend past but not below smallest - // possible selection width/height. - ret = qMax (smallestMin, mouseStart + 1); - } - } - - return ret; -} - -// private -bool kpToolText::shouldCreate (bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const kpTextStyle &textStyle, - int *minimumWidthOut, int *minimumHeightOut, - bool *newDragAccepted) -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "CALL(dragAccepted=" << dragAccepted - << ",accidentalDragAdjustedPoint=" << accidentalDragAdjustedPoint - << ")"; -#endif - *newDragAccepted = dragAccepted; - - // Is the drag so short that we're essentially just clicking? - // Basically, we're trying to prevent unintentional creation of 1-pixel - // selections. - if (!dragAccepted && accidentalDragAdjustedPoint == startPoint ()) - { - // We had an existing text box before the click? - if (hadSelectionBeforeDraw ()) - { - #if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "\ttext box deselect - NOP - return"; - #endif - // We must be attempting to deselect the text box. - // This deselection has already been done by kpAbstractSelectionTool::beginDraw(). - // Therefore, we are not doing a drag. - return false; - } - // We are probably creating a new box. - else - { - // This drag is currently a click -- not a drag. - // As a special case, allow user to create a text box, - // of reasonable ("preferred minimum") size, using a single - // click. - // - // If the user drags further, the normal drag-to-create-a-textbox - // branch [x] will execute and the size will be determined based on - // the size of the drag instead. - - #if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "\tclick creating text box"; - #endif - - // (Click creating text box with RMB would not be obvious - // since RMB menu most likely hides text box immediately - // afterwards) - // TODO: I suspect this logic is simply too late - // TODO: We setUserShapePoints() on return but didn't before. - if (mouseButton () == 1) - return false/*do not create text box*/; - - - // Calculate suggested width. - *minimumWidthOut = calcClickCreateDimension ( - startPoint ().x (), - accidentalDragAdjustedPoint.x (), - kpTextSelection::PreferredMinimumWidthForTextStyle (textStyle), - kpTextSelection::MinimumWidthForTextStyle (textStyle), - document ()->width ()); - - // Calculate suggested height. - *minimumHeightOut = calcClickCreateDimension ( - startPoint ().y (), - accidentalDragAdjustedPoint.y (), - kpTextSelection::PreferredMinimumHeightForTextStyle (textStyle), - kpTextSelection::MinimumHeightForTextStyle (textStyle), - document ()->height ()); - - - // Do _not_ set "newDragAccepted" to true as we want - // this text box to remain at the click-given size, in the absence - // of any dragging. In other words, if draw() is called again - // and therefore, we are called again, but the mouse has not - // moved, we do want this branch to execute again, not - // Branch [x]. - return true/*do create text box*/; - } - } - // Dragging to create a text box [x]. - // - // The size will be determined based on the size of the drag. - else - { - #if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "\tdrag creating text box"; - #endif - *minimumWidthOut = kpTextSelection::MinimumWidthForTextStyle (textStyle); - *minimumHeightOut = kpTextSelection::MinimumHeightForTextStyle (textStyle); - - *newDragAccepted = true; - return true/*do create text box*/; - } - -} - -// protected virtual [kpAbstractSelectionTool] -bool kpToolText::drawCreateMoreSelectionAndUpdateStatusBar ( - bool dragAccepted, - const QPoint &accidentalDragAdjustedPoint, - const QRect &normalizedRectIn) -{ - // (will mutate this) - QRect normalizedRect = normalizedRectIn; - - const kpTextStyle textStyle = environ ()->textStyle (); - - - // - // Calculate Text Box Rectangle. - // - - bool newDragAccepted = dragAccepted; - - // (will set both variables) - int minimumWidth = 0, minimumHeight = 0; - if (!shouldCreate (dragAccepted, accidentalDragAdjustedPoint, textStyle, - &minimumWidth, &minimumHeight, &newDragAccepted)) - { - setUserShapePoints (accidentalDragAdjustedPoint); - return newDragAccepted; - } - - - // Make sure the dragged out rectangle is of the minimum width we just - // calculated. - if (normalizedRect.width () < minimumWidth) - { - if (accidentalDragAdjustedPoint.x () >= startPoint ().x ()) - normalizedRect.setWidth (minimumWidth); - else - normalizedRect.setX (normalizedRect.right () - minimumWidth + 1); - } - - // Make sure the dragged out rectangle is of the minimum height we just - // calculated. - if (normalizedRect.height () < minimumHeight) - { - if (accidentalDragAdjustedPoint.y () >= startPoint ().y ()) - normalizedRect.setHeight (minimumHeight); - else - normalizedRect.setY (normalizedRect.bottom () - minimumHeight + 1); - } - -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "\t\tnormalizedRect=" << normalizedRect - << " kpTextSelection::preferredMinimumSize=" - << QSize (minimumWidth, minimumHeight) - << endl; -#endif - - - // - // Construct and Deploy Text Box. - // - - // Create empty text box. - QList textLines; - kpTextSelection textSel (normalizedRect, textLines, textStyle); - - // Render. - viewManager ()->setTextCursorPosition (0, 0); - document ()->setSelection (textSel); - - - // - // Update Status Bar. - // - - QPoint actualEndPoint = KP_INVALID_POINT; - if (startPoint () == normalizedRect.topLeft ()) - actualEndPoint = normalizedRect.bottomRight (); - else if (startPoint () == normalizedRect.bottomRight ()) - actualEndPoint = normalizedRect.topLeft (); - else if (startPoint () == normalizedRect.topRight ()) - actualEndPoint = normalizedRect.bottomLeft (); - else if (startPoint () == normalizedRect.bottomLeft ()) - actualEndPoint = normalizedRect.topRight (); - - setUserShapePoints (startPoint (), actualEndPoint); - - return newDragAccepted; -} - diff --git a/kolourpaint/tools/selection/text/kpToolText_CursorCalc.cpp b/kolourpaint/tools/selection/text/kpToolText_CursorCalc.cpp deleted file mode 100644 index aa636369..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_CursorCalc.cpp +++ /dev/null @@ -1,215 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected static -bool kpToolText::CursorIsOnWordChar (const QList &textLines, - int cursorRow, int cursorCol) -{ - return (cursorRow >= 0 && cursorRow < (int) textLines.size () && - cursorCol >= 0 && cursorCol < (int) textLines [cursorRow].length () && - !textLines [cursorRow][cursorCol].isSpace ()); -} - - -// protected static -bool kpToolText::CursorIsAtStart (const QList &, - int cursorRow, int cursorCol) -{ - return (cursorRow == 0 && cursorCol == 0); -} - -// protected static -bool kpToolText::CursorIsAtEnd (const QList &textLines, - int cursorRow, int cursorCol) -{ - if (textLines.isEmpty ()) - return (cursorRow == 0 && cursorCol == 0); - - return (cursorRow == (int) textLines.size () - 1 && - cursorCol == (int) textLines [cursorRow].length ()); -} - - -// protected static -void kpToolText::MoveCursorLeft (const QList &textLines, - int *cursorRow, int *cursorCol) -{ - if (textLines.isEmpty ()) - return; - - (*cursorCol)--; - - if (*cursorCol < 0) - { - (*cursorRow)--; - if (*cursorRow < 0) - { - *cursorRow = 0; - *cursorCol = 0; - } - else - *cursorCol = textLines [*cursorRow].length (); - } -} - -// protected static -void kpToolText::MoveCursorRight (const QList &textLines, - int *cursorRow, int *cursorCol) -{ - if (textLines.isEmpty ()) - return; - - (*cursorCol)++; - - if (*cursorCol > (int) textLines [*cursorRow].length ()) - { - (*cursorRow)++; - if (*cursorRow > (int) textLines.size () - 1) - { - *cursorRow = textLines.size () - 1; - *cursorCol = textLines [*cursorRow].length (); - } - else - *cursorCol = 0; - } -} - - -#define IS_ON_SPACE_OR_EOL() !CursorIsOnWordChar (textLines, *cursorRow, *cursorCol) - -// protected static -int kpToolText::MoveCursorToWordStart (const QList &textLines, - int *cursorRow, int *cursorCol) -{ - if (textLines.isEmpty ()) - return 0; - - int numMoves = 0; - -#define IS_ON_ANCHOR() \ - (CursorIsOnWordChar (textLines, *cursorRow, *cursorCol) && \ - (cursorCol == 0 || \ - !CursorIsOnWordChar (textLines, *cursorRow, *cursorCol - 1))) -#define MOVE_CURSOR_LEFT() \ - (MoveCursorLeft (textLines, cursorRow, cursorCol), ++numMoves) - - - // (these comments will exclude the row=0,col=0 boundary case) - - if (IS_ON_ANCHOR ()) - MOVE_CURSOR_LEFT (); - - // --- now we're not on an anchor point (start of word) --- - - // End up on a letter... - while (!(*cursorRow == 0 && *cursorCol == 0) && - (IS_ON_SPACE_OR_EOL ())) - { - MOVE_CURSOR_LEFT (); - } - - // --- now we're on a letter --- - - // Find anchor point - while (!(*cursorRow == 0 && *cursorCol == 0) && !IS_ON_ANCHOR ()) - { - MOVE_CURSOR_LEFT (); - } - - -#undef IS_ON_ANCHOR -#undef MOVE_CURSOR_LEFT - - return numMoves; -} - -// protected static -int kpToolText::MoveCursorToNextWordStart (const QList &textLines, - int *cursorRow, int *cursorCol) -{ - if (textLines.isEmpty ()) - return 0; - - int numMoves = 0; - -#define IS_AT_END() CursorIsAtEnd (textLines, *cursorRow, *cursorCol) -#define MOVE_CURSOR_RIGHT() \ - (MoveCursorRight (textLines, cursorRow, cursorCol), ++numMoves) - - - // (these comments will exclude the last row,end col boundary case) - - // Find space - while (!IS_AT_END () && !IS_ON_SPACE_OR_EOL ()) - { - MOVE_CURSOR_RIGHT (); - } - - // --- now we're on a space --- - - // Find letter - while (!IS_AT_END () && IS_ON_SPACE_OR_EOL ()) - { - MOVE_CURSOR_RIGHT (); - } - - // --- now we're on a letter --- - - -#undef IS_AT_END -#undef MOVE_CURSOR_RIGHT - - return numMoves; -} - -#undef IS_ON_SPACE_OR_EOL - diff --git a/kolourpaint/tools/selection/text/kpToolText_InputMethodEvents.cpp b/kolourpaint/tools/selection/text/kpToolText_InputMethodEvents.cpp deleted file mode 100644 index d7f8b443..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_InputMethodEvents.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2005 Kazuki Ohta - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -void kpToolText::inputMethodEvent (QInputMethodEvent *e) -{ -#if DEBUG_KP_TOOL_TEXT && 1 - kDebug () << "kpToolText::inputMethodEvent() preeditString='" << e->preeditString () - << "commitString = " << e->commitString () - << " replacementStart=" << e->replacementStart () - << " replacementLength=" << e->replacementLength () - << endl; -#endif - kpTextSelection *textSel = document ()->textSelection (); - if (hasBegunDraw() || !textSel) - { - e->ignore(); - return; - } - - kpPreeditText previous = textSel->preeditText (); - kpPreeditText next (e); - - int textCursorRow = viewManager ()->textCursorRow (); - int textCursorCol = viewManager ()->textCursorCol (); - if (!next.isEmpty ()) - { - if (previous.position().x () < 0 && previous.position().y () < 0) - { - next.setPosition (QPoint(textCursorCol, textCursorRow)); - } - else - { - next.setPosition(previous.position ()); - } - } - textSel->setPreeditText (next); - textCursorCol = textCursorCol - previous.cursorPosition () + next.cursorPosition (); - viewManager ()->setTextCursorPosition (textCursorRow, textCursorCol); - - QString commitString = e->commitString (); - if (!commitString.isEmpty ()) - { - // commit string - if (!d->insertCommand) - addNewInsertCommand (&d->insertCommand); - - d->insertCommand->addText (commitString); - } - e->accept (); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents.cpp b/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents.cpp deleted file mode 100644 index 02eb8834..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents.cpp +++ /dev/null @@ -1,215 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected virtual [base kpTool] -bool kpToolText::viewEvent (QEvent *e) -{ - const bool isShortcutOverrideEvent = - (e->type () == QEvent::ShortcutOverride); - const bool haveTextSelection = document ()->textSelection (); - -#if DEBUG_KP_TOOL_TEXT && 0 - kDebug () << "kpToolText::viewEvent() type=" << e->type () - << " isShortcutOverrideEvent=" << isShortcutOverrideEvent - << " haveTextSel=" << haveTextSelection - << endl; -#endif - - if (!isShortcutOverrideEvent || !haveTextSelection) - return kpAbstractSelectionTool::viewEvent (e); - - QKeyEvent *ke = static_cast (e); -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::viewEvent() key=" << ke->key () - << " modifiers=" << ke->modifiers () - << " QChar.isPrint()=" << QChar (ke->key ()).isPrint () - << endl; -#endif - - // Can't be shortcut? - if (ke->key () == 0 && ke->key () == Qt::Key_unknown) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tcan't be shortcut - safe to not react"; - #endif - } - // Normal letter (w/ or w/o shift, keypad button ok)? - // TODO: don't like this check - else if ((ke->modifiers () & - (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == 0 && - !( ke->text ().isEmpty ())) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tis text - grab"; - #endif - e->accept (); - } - else - { - // Strickly speaking, we should grab stuff like the arrow keys - // and enter. In any case, should be done down in kpTool (as that - // uses arrow keys too). - } - - return kpAbstractSelectionTool::event (e); -} - - -// protected virtual [base kpAbstractSelectionTool] -void kpToolText::keyPressEvent (QKeyEvent *e) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::keyPressEvent(e->text='" << e->text () << "')"; -#endif - - - e->ignore (); - - - if (hasBegunDraw ()) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\talready began draw with mouse - passing on event to kpTool"; - #endif - kpAbstractSelectionTool::keyPressEvent (e); - return; - } - - - kpTextSelection * const textSel = document ()->textSelection (); - - if (!textSel) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tno text sel - passing on event to kpTool"; - #endif - //if (hasBegunShape ()) - // endShape (currentPoint (), normalizedRect ()); - - kpAbstractSelectionTool::keyPressEvent (e); - return; - } - - - // (All handle.+()'s require this info) - const QList textLines = textSel->textLines (); - const int cursorRow = viewManager ()->textCursorRow (); - const int cursorCol = viewManager ()->textCursorCol (); - - - // TODO: KTextEdit::keyPressEvent() uses KStandardShortcut instead of hardcoding; same fix for kpTool? - switch (e->key ()) - { - case Qt::Key_Up: - handleUpKeyPress (e, textLines, cursorRow, cursorCol); - break; - - case Qt::Key_Down: - handleDownKeyPress (e, textLines, cursorRow, cursorCol); - break; - - case Qt::Key_Left: - handleLeftKeyPress (e, textLines, cursorRow, cursorCol); - break; - - case Qt::Key_Right: - handleRightKeyPress (e, textLines, cursorRow, cursorCol); - break; - - - case Qt::Key_Home: - handleHomeKeyPress (e, textLines, cursorRow, cursorCol); - break; - - case Qt::Key_End: - handleEndKeyPress (e, textLines, cursorRow, cursorCol); - break; - - - case Qt::Key_Backspace: - handleBackspaceKeyPress (e, textLines, cursorRow, cursorCol); - break; - - case Qt::Key_Delete: - handleDeleteKeyPress (e, textLines, cursorRow, cursorCol); - break; - - - case Qt::Key_Enter: - case Qt::Key_Return: - handleEnterKeyPress (e, textLines, cursorRow, cursorCol); - break; - - - default: - handleTextTyped (e, textLines, cursorRow, cursorCol); - break; - } - - - if (!e->isAccepted ()) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tkey processing did not accept (text was '" - << e->text () - << "') - passing on event to kpAbstractSelectionTool" - << endl; - #endif - //if (hasBegunShape ()) - // endShape (currentPoint (), normalizedRect ()); - - kpAbstractSelectionTool::keyPressEvent (e); - return; - } -} diff --git a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp b/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp deleted file mode 100644 index e989ff68..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp +++ /dev/null @@ -1,216 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected -void kpToolText::handleUpKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tup pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty () && cursorRow > 0) - { - cursorRow--; - cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ()); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - - e->accept (); -} - -// protected -void kpToolText::handleDownKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tdown pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty () && cursorRow < (int) textLines.size () - 1) - { - cursorRow++; - cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ()); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - - e->accept (); -} - -// protected -void kpToolText::handleLeftKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tleft pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty ()) - { - if ((e->modifiers () & Qt::ControlModifier) == 0) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tmove single char"; - #endif - - MoveCursorLeft (textLines, &cursorRow, &cursorCol); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - else - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tmove to start of word"; - #endif - - MoveCursorToWordStart (textLines, &cursorRow, &cursorCol); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - } - - e->accept (); -} - -// protected -void kpToolText::handleRightKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tright pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty ()) - { - if ((e->modifiers () & Qt::ControlModifier) == 0) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tmove single char"; - #endif - - MoveCursorRight (textLines, &cursorRow, &cursorCol); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - else - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tmove to start of next word"; - #endif - - MoveCursorToNextWordStart (textLines, &cursorRow, &cursorCol); - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - } - - e->accept (); -} - - -// protected -void kpToolText::handleHomeKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\thome pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty ()) - { - if (e->modifiers () & Qt::ControlModifier) - cursorRow = 0; - - cursorCol = 0; - - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - - e->accept (); -} - -// protected -void kpToolText::handleEndKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tend pressed"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - if (!textLines.isEmpty ()) - { - if (e->modifiers () & Qt::ControlModifier) - cursorRow = textLines.size () - 1; - - cursorCol = textLines [cursorRow].length (); - - viewManager ()->setTextCursorPosition (cursorRow, cursorCol); - } - - e->accept (); -} diff --git a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleTypingKeys.cpp b/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleTypingKeys.cpp deleted file mode 100644 index 95ca2565..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_KeyboardEvents_HandleTypingKeys.cpp +++ /dev/null @@ -1,198 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//--------------------------------------------------------------------- - -// protected -void kpToolText::handleBackspaceKeyPress (QKeyEvent *e, - const QList &textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tbackspace pressed"; -#endif - - if (!textLines.isEmpty ()) - { - if ((e->modifiers () & Qt::ControlModifier) == 0) - { - if (!d->backspaceCommand) - addNewBackspaceCommand (&d->backspaceCommand); - - d->backspaceCommand->addBackspace (); - } - else - { - if (!d->backspaceWordCommand) - addNewBackspaceCommand (&d->backspaceWordCommand); - - const int numMoves = MoveCursorToWordStart (textLines, - &cursorRow, &cursorCol); - - viewManager ()->setQueueUpdates (); - { - for (int i = 0; i < numMoves; i++) - d->backspaceWordCommand->addBackspace (); - } - viewManager ()->restoreQueueUpdates (); - - Q_ASSERT (cursorRow == viewManager ()->textCursorRow ()); - Q_ASSERT (cursorCol == viewManager ()->textCursorCol ()); - } - } - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected -void kpToolText::handleDeleteKeyPress (QKeyEvent *e, - const QList & textLines, int cursorRow, int cursorCol) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tdelete pressed"; -#endif - - if (!textLines.isEmpty ()) - { - if ((e->modifiers () & Qt::ControlModifier) == 0) - { - if (!d->deleteCommand) - addNewDeleteCommand (&d->deleteCommand); - - d->deleteCommand->addDelete (); - } - else - { - if (!d->deleteWordCommand) - addNewDeleteCommand (&d->deleteWordCommand); - - // We don't want to know the cursor pos of the next word start - // as delete should keep cursor in same pos. - int cursorRowThrowAway = cursorRow, - cursorColThrowAway = cursorCol; - const int numMoves = MoveCursorToNextWordStart (textLines, - &cursorRowThrowAway, &cursorColThrowAway); - - viewManager ()->setQueueUpdates (); - { - for (int i = 0; i < numMoves; i++) - d->deleteWordCommand->addDelete (); - } - viewManager ()->restoreQueueUpdates (); - - // Assert unchanged as delete should keep cursor in same pos. - Q_ASSERT (cursorRow == viewManager ()->textCursorRow ()); - Q_ASSERT (cursorCol == viewManager ()->textCursorCol ()); - } - } - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected -void kpToolText::handleEnterKeyPress (QKeyEvent *e, - const QList & /*textLines*/, int /*cursorRow*/, int /*cursorCol*/) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tenter pressed"; -#endif - - // It's OK for to be empty. - - if (!d->enterCommand) - addNewEnterCommand (&d->enterCommand); - - d->enterCommand->addEnter (); - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected -void kpToolText::handleTextTyped (QKeyEvent *e, - const QList & /*textLines*/, int /*cursorRow*/, int /*cursorCol*/) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\ttext=" << e->text(); -#endif - QString usableText; - for (int i = 0; i < (int) e->text ().length (); i++) - { - if (e->text ().at (i).isPrint ()) - usableText += e->text ().at (i); - } -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\tusableText=" << usableText; -#endif - - if (usableText.isEmpty ()) - { - // Don't end the current shape nor accept the event -- the event - // wasn't for us. - return; - } - - // --- It's OK for to be empty. --- - - if (!d->insertCommand) - addNewInsertCommand (&d->insertCommand); - - d->insertCommand->addText (usableText); - - e->accept (); -} diff --git a/kolourpaint/tools/selection/text/kpToolText_Move.cpp b/kolourpaint/tools/selection/text/kpToolText_Move.cpp deleted file mode 100644 index aec93ffe..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_Move.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include - -#include - - -// protected virtual [kpAbstractSelectionTool] -QString kpToolText::haventBegunDrawUserMessageMove () const -{ - return i18n ("Left drag to move text box."); -} - - -// protected virtual [base kpAbstractSelectionTool] -void kpToolText::setSelectionBorderForBeginDrawMove () -{ - viewManager ()->setQueueUpdates (); - { - kpAbstractSelectionTool::setSelectionBorderForBeginDrawMove (); - viewManager ()->setTextCursorEnabled (false); - } - viewManager ()->restoreQueueUpdates (); -} - - -// protected virtual [kpAbstractSelectionTool] -QString kpToolText::nonSmearMoveCommandName () const -{ - return i18n ("Text: Move Box"); -} - diff --git a/kolourpaint/tools/selection/text/kpToolText_ResizeScale.cpp b/kolourpaint/tools/selection/text/kpToolText_ResizeScale.cpp deleted file mode 100644 index 75ecd93e..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_ResizeScale.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include - -#include - - -// protected virtual [kpAbstractSelectionTool] -QString kpToolText::haventBegunDrawUserMessageResizeScale () const -{ - return i18n ("Left drag to resize text box."); -} - - -// protected virtual [base kpAbstractSelectionTool] -void kpToolText::setSelectionBorderForBeginDrawResizeScale () -{ - viewManager ()->setQueueUpdates (); - { - kpAbstractSelectionTool::setSelectionBorderForBeginDrawResizeScale (); - viewManager ()->setTextCursorEnabled (false); - } - viewManager ()->restoreQueueUpdates (); -} diff --git a/kolourpaint/tools/selection/text/kpToolText_SelectText.cpp b/kolourpaint/tools/selection/text/kpToolText_SelectText.cpp deleted file mode 100644 index aa292b44..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_SelectText.cpp +++ /dev/null @@ -1,136 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include - -#include -#include -#include -#include - - -// private -bool kpToolText::onSelectionToSelectText () const -{ - kpView *v = viewManager ()->viewUnderCursor (); - if (!v) - return 0; - - return v->mouseOnSelectionToSelectText (currentViewPoint ()); -} - - -// private -QString kpToolText::haventBegunDrawUserMessageSelectText () const -{ - return i18n ("Left click to change cursor position."); -} - -// private -void kpToolText::setCursorSelectText () -{ - viewManager ()->setCursor (Qt::IBeamCursor); -} - - -// private -void kpToolText::beginDrawSelectText () -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\t\tis select cursor pos"; -#endif - kpTextSelection *textSel = document ()->textSelection (); - Q_ASSERT (textSel); - - int newRow, newCol; - - if (textSel->hasContent ()) - { - newRow = textSel->closestTextRowForPoint (currentPoint ()); - newCol = textSel->closestTextColForPoint (currentPoint ()); - } - else - { - newRow = newCol = 0; - } - -#if DEBUG_KP_TOOL_TEXT - kDebug () << "\t\t\told: row=" << viewManager ()->textCursorRow () - << "col=" << viewManager ()->textCursorCol (); - kDebug () << "\t\t\tnew: row=" << newRow << "col=" << newCol; -#endif - viewManager ()->setTextCursorPosition (newRow, newCol); -} - - -// protected virtual -QVariant kpToolText::selectTextOperation (Operation op, - const QVariant &data1, const QVariant &data2) -{ - (void) data1; - (void) data2; - - - switch (op) - { - case HaventBegunDrawUserMessage: - return haventBegunDrawUserMessageSelectText (); - - case SetCursor: - setCursorSelectText (); - break; - - case BeginDraw: - beginDrawSelectText (); - break; - - case Draw: - // Do nothing. - break; - - case Cancel: - // Not called. REFACTOR: Change this? - break; - - case EndDraw: - // Do nothing. - break; - - default: - Q_ASSERT (!"Unhandled operation"); - break; - } - - - return QVariant (); -} diff --git a/kolourpaint/tools/selection/text/kpToolText_TextStyle.cpp b/kolourpaint/tools/selection/text/kpToolText_TextStyle.cpp deleted file mode 100644 index 0c6f8806..00000000 --- a/kolourpaint/tools/selection/text/kpToolText_TextStyle.cpp +++ /dev/null @@ -1,331 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_TEXT 0 - - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// protected -bool kpToolText::shouldChangeTextStyle () const -{ - if (environ ()->settingTextStyle ()) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\trecursion - abort setting text style: " - << environ ()->settingTextStyle () - << endl; - #endif - return false; - } - - if (!document ()->textSelection ()) - { - #if DEBUG_KP_TOOL_TEXT - kDebug () << "\tno text selection - abort setting text style"; - #endif - return false; - } - - return true; -} - -// protected -void kpToolText::changeTextStyle (const QString &name, - const kpTextStyle &newTextStyle, - const kpTextStyle &oldTextStyle) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::changeTextStyle(" << name << ")"; -#endif - - if (hasBegunShape ()) - endShape (currentPoint (), normalizedRect ()); - - commandHistory ()->addCommand ( - new kpToolTextChangeStyleCommand ( - name, - newTextStyle, - oldTextStyle, - environ ()->commandEnvironment ())); -} - - -// protected slot virtual [base kpAbstractSelectionTool] -void kpToolText::slotIsOpaqueChanged (bool isOpaque) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotIsOpaqueChanged()"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setBackgroundOpaque (!isOpaque); - - changeTextStyle (newTextStyle.isBackgroundOpaque () ? - i18n ("Text: Opaque Background") : - i18n ("Text: Transparent Background"), - newTextStyle, - oldTextStyle); -} - -// protected slot virtual [base kpTool] -void kpToolText::slotColorsSwapped (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotColorsSwapped()"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setForegroundColor (newBackgroundColor); - oldTextStyle.setBackgroundColor (newForegroundColor); - - changeTextStyle (i18n ("Text: Swap Colors"), - newTextStyle, - oldTextStyle); -} - -// protected slot virtual [base kpTool] -void kpToolText::slotForegroundColorChanged (const kpColor & /*color*/) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotForegroundColorChanged()"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setForegroundColor (oldForegroundColor ()); - - changeTextStyle (i18n ("Text: Foreground Color"), - newTextStyle, - oldTextStyle); -} - -// protected slot virtual [base kpAbstractSelectionTool] -void kpToolText::slotBackgroundColorChanged (const kpColor & /*color*/) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotBackgroundColorChanged()"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setBackgroundColor (oldBackgroundColor ()); - - changeTextStyle (i18n ("Text: Background Color"), - newTextStyle, - oldTextStyle); -} - -// protected slot virtual [base kpAbstractSelectionTool] -void kpToolText::slotColorSimilarityChanged (double, int) -{ - // --- don't pass on event to kpAbstractSelectionTool which would have set the - // SelectionTransparency - not relevant to the Text Tool --- -} - - -// public slot -void kpToolText::slotFontFamilyChanged (const QString &fontFamily, - const QString &oldFontFamily) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotFontFamilyChanged() new=" - << fontFamily - << " old=" - << oldFontFamily - << endl; -#else - (void) fontFamily; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setFontFamily (oldFontFamily); - - changeTextStyle (i18n ("Text: Font"), - newTextStyle, - oldTextStyle); -} - -// public slot -void kpToolText::slotFontSizeChanged (int fontSize, int oldFontSize) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotFontSizeChanged() new=" - << fontSize - << " old=" - << oldFontSize - << endl; -#else - (void) fontSize; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setFontSize (oldFontSize); - - changeTextStyle (i18n ("Text: Font Size"), - newTextStyle, - oldTextStyle); -} - - -// public slot -void kpToolText::slotBoldChanged (bool isBold) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotBoldChanged(" << isBold << ")"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setBold (!isBold); - - changeTextStyle (i18n ("Text: Bold"), - newTextStyle, - oldTextStyle); -} - -// public slot -void kpToolText::slotItalicChanged (bool isItalic) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotItalicChanged(" << isItalic << ")"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setItalic (!isItalic); - - changeTextStyle (i18n ("Text: Italic"), - newTextStyle, - oldTextStyle); -} - -// public slot -void kpToolText::slotUnderlineChanged (bool isUnderline) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotUnderlineChanged(" << isUnderline << ")"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setUnderline (!isUnderline); - - changeTextStyle (i18n ("Text: Underline"), - newTextStyle, - oldTextStyle); -} - -// public slot -void kpToolText::slotStrikeThruChanged (bool isStrikeThru) -{ -#if DEBUG_KP_TOOL_TEXT - kDebug () << "kpToolText::slotStrikeThruChanged(" << isStrikeThru << ")"; -#endif - - if (!shouldChangeTextStyle ()) - return; - - kpTextStyle newTextStyle = environ ()->textStyle (); - - // Figure out old text style. - kpTextStyle oldTextStyle = newTextStyle; - oldTextStyle.setStrikeThru (!isStrikeThru); - - changeTextStyle (i18n ("Text: Strike Through"), - newTextStyle, - oldTextStyle); -} diff --git a/kolourpaint/views/kpThumbnailView.cpp b/kolourpaint/views/kpThumbnailView.cpp deleted file mode 100644 index 51508294..00000000 --- a/kolourpaint/views/kpThumbnailView.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_THUMBNAIL_VIEW 0 - - -#include - -#include - - -kpThumbnailView::kpThumbnailView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent) - - : kpView (document, toolToolBar, viewManager, - buddyView, - scrollableContainer, - parent) -{ -} - -kpThumbnailView::~kpThumbnailView () -{ -} - - -// protected -void kpThumbnailView::setMaskToCoverDocument () -{ -#if DEBUG_KP_THUMBNAIL_VIEW - kDebug () << "kpThumbnailView::setMaskToCoverDocument()" - << " origin=" << origin () - << " zoomedDoc: width=" << zoomedDocWidth () - << " height=" << zoomedDocHeight () - << endl; -#endif - - setMask (QRegion (QRect (origin ().x (), origin ().y (), - zoomedDocWidth (), zoomedDocHeight ()))); -} - - -// protected virtual [base kpView] -void kpThumbnailView::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_THUMBNAIL_VIEW - kDebug () << "kpThumbnailView(" << name () << ")::resizeEvent()" - << endl; -#endif - - // For QResizeEvent's, Qt already throws an entire widget repaint into - // the event loop. So eat useless update() calls that can only slow - // things down. - // TODO: this doesn't seem to work. - // Later: In Qt4, setUpdatesEnabled(true) calls update(). - const bool oldIsUpdatesEnabled = updatesEnabled (); - setUpdatesEnabled (false); - - { - kpView::resizeEvent (e); - - adjustToEnvironment (); - } - - setUpdatesEnabled (oldIsUpdatesEnabled); -} - - -#include "moc_kpThumbnailView.cpp" - diff --git a/kolourpaint/views/kpThumbnailView.h b/kolourpaint/views/kpThumbnailView.h deleted file mode 100644 index 735a6e05..00000000 --- a/kolourpaint/views/kpThumbnailView.h +++ /dev/null @@ -1,90 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_THUMBNAIL_VIEW_H -#define KP_THUMBNAIL_VIEW_H - - -#include - - -/** - * @short Abstract base class for all thumbnail views. - * - * @author Clarence Dang - */ -class kpThumbnailView : public kpView -{ -Q_OBJECT - -public: - /** - * Constructs a thumbnail view. - * - * You must call adjustEnvironment() at the end of your constructor. - */ - kpThumbnailView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent); - - /** - * Destructs this thumbnail view. - */ - virtual ~kpThumbnailView (); - - - /** - * @returns the caption to display in an enclosing thumbnail window. - */ - virtual QString caption () const = 0; - - -protected: - /** - * Sets the mask to cover the rectangle with top-left, origin() and - * dimensions equal to or slightly less than (in case of rounding - * error) the size of the document in view coordinates. This ensures - * that all pixels are initialised with either document pixels or the - * standard widget background. - */ - void setMaskToCoverDocument (); - - - /** - * Calls adjustToEnvironment() in response to a resize event. - * - * Extends @ref kpView. - */ - virtual void resizeEvent (QResizeEvent *e); -}; - - -#endif // KP_THUMBNAIL_VIEW_H diff --git a/kolourpaint/views/kpUnzoomedThumbnailView.cpp b/kolourpaint/views/kpUnzoomedThumbnailView.cpp deleted file mode 100644 index 45aab8c0..00000000 --- a/kolourpaint/views/kpUnzoomedThumbnailView.cpp +++ /dev/null @@ -1,218 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW 0 - - -#include - -#include -#include - -#include -#include -#include - -#include - -//--------------------------------------------------------------------- - -struct kpUnzoomedThumbnailViewPrivate -{ -}; - - -kpUnzoomedThumbnailView::kpUnzoomedThumbnailView ( - kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent) - - : kpThumbnailView (document, toolToolBar, viewManager, - buddyView, - scrollableContainer, - parent), - d (new kpUnzoomedThumbnailViewPrivate ()) -{ - if (buddyViewScrollableContainer ()) - { - connect (buddyViewScrollableContainer (), - SIGNAL (contentsMoved()), - this, - SLOT (adjustToEnvironment ())); - } - - // Call to virtual function - this is why the class is sealed - adjustToEnvironment (); -} - -//--------------------------------------------------------------------- - -kpUnzoomedThumbnailView::~kpUnzoomedThumbnailView () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public virtual [base kpThumbnailView] -QString kpUnzoomedThumbnailView::caption () const -{ - return i18n ("Unzoomed Mode - Thumbnail"); -} - -//--------------------------------------------------------------------- - -// public slot virtual [base kpView] -void kpUnzoomedThumbnailView::adjustToEnvironment () -{ - if (!buddyView () || !buddyViewScrollableContainer () || !document ()) - return; - - const int scrollViewContentsX = - buddyViewScrollableContainer()->horizontalScrollBar()->value(); - const int scrollViewContentsY = - buddyViewScrollableContainer ()->verticalScrollBar()->value(); - -#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW - kDebug () << "kpUnzoomedThumbnailView(" << name () - << ")::adjustToEnvironment(" - << scrollViewContentsX - << "," - << scrollViewContentsY - << ") width=" << width () - << " height=" << height () - << endl; -#endif - - -#if 1 - int x; - if (document ()->width () > width ()) - { - x = (int) buddyView ()->transformViewToDocX (scrollViewContentsX); - const int rightMostAllowedX = qMax (0, document ()->width () - width ()); - #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW - kDebug () << "\tdocX=" << x - << " docWidth=" << document ()->width () - << " rightMostAllowedX=" << rightMostAllowedX - << endl; - #endif - if (x > rightMostAllowedX) - x = rightMostAllowedX; - } - // Thumbnail width <= doc width - else - { - // Center X (rather than flush left to be consistent with - // kpZoomedThumbnailView) - x = -(width () - document ()->width ()) / 2; - } - - - int y; - if (document ()->height () > height ()) - { - y = (int) buddyView ()->transformViewToDocY (scrollViewContentsY); - const int bottomMostAllowedY = qMax (0, document ()->height () - height ()); - #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW - kDebug () << "\tdocY=" << y - << " docHeight=" << document ()->height () - << " bottomMostAllowedY=" << bottomMostAllowedY - << endl; - #endif - if (y > bottomMostAllowedY) - y = bottomMostAllowedY; - } - // Thumbnail height <= doc height - else - { - // Center Y (rather than flush top to be consistent with - // kpZoomedThumbnailView) - y = -(height () - document ()->height ()) / 2; - } -// Prefer to keep visible area centred in thumbnail instead of flushed left. -// Gives more editing context to the left and top. -// But feels awkward for left-to-right users. So disabled for now. -// Not totally tested. -#else - if (!buddyViewScrollableContainer ()) - return; - - QRect docRect = buddyView ()->transformViewToDoc ( - QRect (buddyViewScrollableContainer ()->horizontalScrollBar()->value(), - buddyViewScrollableContainer ()->verticalScrollBar()->value(), - qMin (buddyView ()->width (), buddyViewScrollableContainer ()->viewport()->width ()), - qMin (buddyView ()->height (), buddyViewScrollableContainer ()->viewport()->height ()))); - - x = docRect.x () - (width () - docRect.width ()) / 2; - kDebug () << "\tnew suggest x=" << x; - const int rightMostAllowedX = qMax (0, document ()->width () - width ()); - if (x < 0) - x = 0; - if (x > rightMostAllowedX) - x = rightMostAllowedX; - - y = docRect.y () - (height () - docRect.height ()) / 2; - kDebug () << "\tnew suggest y=" << y; - const int bottomMostAllowedY = qMax (0, document ()->height () - height ()); - if (y < 0) - y = 0; - if (y > bottomMostAllowedY) - y = bottomMostAllowedY; -#endif - - - if (viewManager ()) - { - viewManager ()->setFastUpdates (); - viewManager ()->setQueueUpdates (); - } - - { - // OPT: scrollView impl would be much, much faster - setOrigin (QPoint (-x, -y)); - setMaskToCoverDocument (); - - // Above might be a NOP even if e.g. doc size changed so force - // update - if (viewManager ()) - viewManager ()->updateView (this); - } - - if (viewManager ()) - { - viewManager ()->restoreQueueUpdates (); - viewManager ()->restoreFastUpdates (); - } -} - - -#include "moc_kpUnzoomedThumbnailView.cpp" diff --git a/kolourpaint/views/kpUnzoomedThumbnailView.h b/kolourpaint/views/kpUnzoomedThumbnailView.h deleted file mode 100644 index 024bc728..00000000 --- a/kolourpaint/views/kpUnzoomedThumbnailView.h +++ /dev/null @@ -1,106 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_UNZOOMED_THUMBNAIL_VIEW_H -#define KP_UNZOOMED_THUMBNAIL_VIEW_H - - -#include - - -class kpViewScrollableContainer; - - -/** - * @short Unzoomed thumbnail view of a document. - * - * This is an unzoomed thumbnail view of a document. Unlike - * @ref kpZoomedThumbnailView, it never changes the zoom level. And unlike - * @ref kpZoomedView, it never resizes itself. Instead, it changes its - * origin according to the main view's scrollable container so that the - * top-left most document pixel displayed in the scrollable container will - * be visible. - * - * Do not call setZoomLevel() nor setOrigin(). - * - * This class is sealed. Do not derive from it. - * - * @author Clarence Dang - */ -/*sealed*/ class kpUnzoomedThumbnailView : public kpThumbnailView -{ -Q_OBJECT - -public: - /** - * Constructs an unzoomed thumbnail view. - */ - kpUnzoomedThumbnailView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent); - - /** - * Destructs an unzoomed thumbnail view. - */ - virtual ~kpUnzoomedThumbnailView (); - - - /** - * Implements @ref kpThumbnailView. - */ - QString caption () const; - - -public slots: - /** - * Changes its origin according to the main view's scrollable container - * so that the top-left most document pixel displayed in the scrollable - * container will be visible. - * - * It tries to maximise the used area of this view. Unused areas will - * be set to the widget background thanks to the mask. - * - * Call this if the size of the document changes. - * Already connected to buddyViewScrollableContainer()'s - * contentsMoved() signal. - * Already called by @ref kpThumbnailView resizeEvent(). - * - * Implements @ref kpView. - */ - virtual void adjustToEnvironment (); - - -private: - struct kpUnzoomedThumbnailViewPrivate *d; -}; - - -#endif // KP_UNZOOMED_THUMBNAIL_VIEW_H diff --git a/kolourpaint/views/kpView.cpp b/kolourpaint/views/kpView.cpp deleted file mode 100644 index e3aa76a4..00000000 --- a/kolourpaint/views/kpView.cpp +++ /dev/null @@ -1,672 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2005 Kazuki Ohta - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW 0 -#define DEBUG_KP_VIEW_RENDERER ((DEBUG_KP_VIEW && 1) || 0) - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// public static -const int kpView::MinZoomLevel = 1; -const int kpView::MaxZoomLevel = 3200; - -//--------------------------------------------------------------------- - -kpView::kpView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent) - : QWidget (parent), - d (new kpViewPrivate ()) -{ - d->document = document; - d->toolToolBar = toolToolBar; - d->viewManager = viewManager; - d->buddyView = buddyView; - d->scrollableContainer = scrollableContainer; - - d->hzoom = 100, d->vzoom = 100; - d->origin = QPoint (0, 0); - d->showGrid = false; - d->isBuddyViewScrollableContainerRectangleShown = false; - - // Don't waste CPU drawing default background since its overridden by - // our fully opaque drawing. In reality, this seems to make no - // difference in performance. - setAttribute(Qt::WA_OpaquePaintEvent, true); - - setFocusPolicy (Qt::WheelFocus); - setMouseTracking (true); // mouseMoveEvent's even when no mousebtn down - setAttribute (Qt::WA_KeyCompression, true); -} - -//--------------------------------------------------------------------- - -kpView::~kpView () -{ - setHasMouse (false); - - delete d; -} - -//--------------------------------------------------------------------- - -// public -kpDocument *kpView::document () const -{ - return d->document; -} - -//--------------------------------------------------------------------- - -// protected -kpAbstractSelection *kpView::selection () const -{ - return document () ? document ()->selection () : 0; -} - -//--------------------------------------------------------------------- - -// protected -kpTextSelection *kpView::textSelection () const -{ - return document () ? document ()->textSelection () : 0; -} - -//--------------------------------------------------------------------- - -// public -kpToolToolBar *kpView::toolToolBar () const -{ - return d->toolToolBar; -} - -// protected -kpTool *kpView::tool () const -{ - return toolToolBar () ? toolToolBar ()->tool () : 0; -} - -// public -kpViewManager *kpView::viewManager () const -{ - return d->viewManager; -} - -// public -kpView *kpView::buddyView () const -{ - return d->buddyView; -} - -// public -kpViewScrollableContainer *kpView::buddyViewScrollableContainer () const -{ - return (buddyView () ? buddyView ()->scrollableContainer () : 0); -} - -// public -kpViewScrollableContainer *kpView::scrollableContainer () const -{ - return d->scrollableContainer; -} - - -// public -int kpView::zoomLevelX (void) const -{ - return d->hzoom; -} - -// public -int kpView::zoomLevelY (void) const -{ - return d->vzoom; -} - -// public virtual -void kpView::setZoomLevel (int hzoom, int vzoom) -{ - hzoom = qBound (MinZoomLevel, hzoom, MaxZoomLevel); - vzoom = qBound (MinZoomLevel, vzoom, MaxZoomLevel); - - if (hzoom == d->hzoom && vzoom == d->vzoom) - return; - - d->hzoom = hzoom; - d->vzoom = vzoom; - - if (viewManager ()) - viewManager ()->updateView (this); - - emit zoomLevelChanged (hzoom, vzoom); -} - - -// public -QPoint kpView::origin () const -{ - return d->origin; -} - -// public virtual -void kpView::setOrigin (const QPoint &origin) -{ -#if DEBUG_KP_VIEW - kDebug () << "kpView(" << objectName () << ")::setOrigin" << origin; -#endif - - if (origin == d->origin) - { - #if DEBUG_KP_VIEW - kDebug () << "\tNOP"; - #endif - return; - } - - d->origin = origin; - - if (viewManager ()) - viewManager ()->updateView (this); - - emit originChanged (origin); -} - - -// public -bool kpView::canShowGrid () const -{ - // (minimum zoom level < 400% would probably be reported as a bug by - // users who thought that the grid was a part of the image!) - return ((zoomLevelX () >= 400 && zoomLevelX () % 100 == 0) && - (zoomLevelY () >= 400 && zoomLevelY () % 100 == 0)); -} - -// public -bool kpView::isGridShown () const -{ - return d->showGrid; -} - -// public -void kpView::showGrid (bool yes) -{ - if (d->showGrid == yes) - return; - - if (yes && !canShowGrid ()) - return; - - d->showGrid = yes; - - if (viewManager ()) - viewManager ()->updateView (this); -} - - -// public -bool kpView::isBuddyViewScrollableContainerRectangleShown () const -{ - return d->isBuddyViewScrollableContainerRectangleShown; -} - -// public -void kpView::showBuddyViewScrollableContainerRectangle (bool yes) -{ - if (yes == d->isBuddyViewScrollableContainerRectangleShown) - return; - - d->isBuddyViewScrollableContainerRectangleShown = yes; - - if (d->isBuddyViewScrollableContainerRectangleShown) - { - // Got these connect statements by analysing deps of - // updateBuddyViewScrollableContainerRectangle() rect update code. - - connect (this, SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - connect (this, SIGNAL (originChanged (const QPoint &)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - - if (buddyViewScrollableContainer ()) - { - connect (buddyViewScrollableContainer (), SIGNAL (contentsMoved()), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - connect (buddyViewScrollableContainer (), SIGNAL (resized ()), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - } - - if (buddyView ()) - { - connect (buddyView (), SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - connect (buddyView (), SIGNAL (originChanged (const QPoint &)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - - connect (buddyView (), SIGNAL (sizeChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - } - - } - else - { - disconnect (this, SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - disconnect (this, SIGNAL (originChanged (const QPoint &)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - - if (buddyViewScrollableContainer ()) - { - disconnect (buddyViewScrollableContainer (), SIGNAL (contentsMoved()), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - disconnect (buddyViewScrollableContainer (), SIGNAL (resized ()), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - } - - if (buddyView ()) - { - disconnect (buddyView (), SIGNAL (zoomLevelChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - disconnect (buddyView (), SIGNAL (originChanged (const QPoint &)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - - disconnect (buddyView (), SIGNAL (sizeChanged (int, int)), - this, SLOT (updateBuddyViewScrollableContainerRectangle ())); - } - - } - - updateBuddyViewScrollableContainerRectangle (); -} - - -// protected -QRect kpView::buddyViewScrollableContainerRectangle () const -{ - return d->buddyViewScrollableContainerRectangle; -} - -// protected slot -void kpView::updateBuddyViewScrollableContainerRectangle () -{ - if (viewManager ()) - viewManager ()->setQueueUpdates (); - - { - if (d->buddyViewScrollableContainerRectangle.isValid ()) - { - if (viewManager ()) - { - // Erase last - viewManager ()->updateViewRectangleEdges (this, - d->buddyViewScrollableContainerRectangle); - } - } - - - QRect newRect; - if (isBuddyViewScrollableContainerRectangleShown () && - buddyViewScrollableContainer () && buddyView ()) - { - QRect docRect = buddyView ()->transformViewToDoc ( - QRect (buddyViewScrollableContainer ()->horizontalScrollBar()->value(), - buddyViewScrollableContainer ()->verticalScrollBar()->value(), - qMin (buddyView ()->width (), - buddyViewScrollableContainer ()->viewport()->width ()), - qMin (buddyView ()->height (), - buddyViewScrollableContainer ()->viewport()->height ()))); - - - QRect viewRect = this->transformDocToView (docRect); - - - // (Surround the area of interest by moving outwards by 1 pixel in each - // direction - don't overlap area) - newRect = QRect (viewRect.x () - 1, - viewRect.y () - 1, - viewRect.width () + 2, - viewRect.height () + 2); - } - else - { - newRect = QRect (); - } - - if (newRect != d->buddyViewScrollableContainerRectangle) - { - // (must set before updateView() for paintEvent() to see new - // rect) - d->buddyViewScrollableContainerRectangle = newRect; - - if (newRect.isValid ()) - { - if (viewManager ()) - { - viewManager ()->updateViewRectangleEdges (this, - d->buddyViewScrollableContainerRectangle); - } - } - } - } - - if (viewManager ()) - viewManager ()->restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// public -double kpView::transformViewToDocX (double viewX) const -{ - return (viewX - origin ().x ()) * 100.0 / zoomLevelX (); -} - -//--------------------------------------------------------------------- - -// public -double kpView::transformViewToDocY (double viewY) const -{ - return (viewY - origin ().y ()) * 100.0 / zoomLevelY (); -} - -//--------------------------------------------------------------------- - -// public -QPoint kpView::transformViewToDoc (const QPoint &viewPoint) const -{ - return QPoint ((int) transformViewToDocX (viewPoint.x ()), - (int) transformViewToDocY (viewPoint.y ())); -} - -//--------------------------------------------------------------------- - -// public -QRect kpView::transformViewToDoc (const QRect &viewRect) const -{ - if (zoomLevelX () == 100 && zoomLevelY () == 100) - { - return QRect (viewRect.x () - origin ().x (), - viewRect.y () - origin ().y (), - viewRect.width (), - viewRect.height ()); - } - else - { - const QPoint docTopLeft = transformViewToDoc (viewRect.topLeft ()); - - // (don't call transformViewToDoc[XY]() - need to round up dimensions) - const int docWidth = qRound (double (viewRect.width ()) * 100.0 / double (zoomLevelX ())); - const int docHeight = qRound (double (viewRect.height ()) * 100.0 / double (zoomLevelY ())); - - // (like QWMatrix::Areas) - return QRect (docTopLeft.x (), docTopLeft.y (), docWidth, docHeight); - } -} - -//--------------------------------------------------------------------- - -// public -double kpView::transformDocToViewX (double docX) const -{ - return (docX * zoomLevelX () / 100.0) + origin ().x (); -} - -// public -double kpView::transformDocToViewY (double docY) const -{ - return (docY * zoomLevelY () / 100.0) + origin ().y (); -} - -// public -QPoint kpView::transformDocToView (const QPoint &docPoint) const -{ - return QPoint ((int) transformDocToViewX (docPoint.x ()), - (int) transformDocToViewY (docPoint.y ())); -} - -// public -QRect kpView::transformDocToView (const QRect &docRect) const -{ - if (zoomLevelX () == 100 && zoomLevelY () == 100) - { - return QRect (docRect.x () + origin ().x (), - docRect.y () + origin ().y (), - docRect.width (), - docRect.height ()); - } - else - { - const QPoint viewTopLeft = transformDocToView (docRect.topLeft ()); - - // (don't call transformDocToView[XY]() - need to round up dimensions) - const int viewWidth = qRound (double (docRect.width ()) * double (zoomLevelX ()) / 100.0); - const int viewHeight = qRound (double (docRect.height ()) * double (zoomLevelY ()) / 100.0); - - // (like QWMatrix::Areas) - return QRect (viewTopLeft.x (), viewTopLeft.y (), viewWidth, viewHeight); - } -} - - -// public -QPoint kpView::transformViewToOtherView (const QPoint &viewPoint, - const kpView *otherView) -{ - if (this == otherView) - return viewPoint; - - const double docX = transformViewToDocX (viewPoint.x ()); - const double docY = transformViewToDocY (viewPoint.y ()); - - const double otherViewX = otherView->transformDocToViewX (docX); - const double otherViewY = otherView->transformDocToViewY (docY); - - return QPoint ((int) otherViewX, (int) otherViewY); -} - - -// public -int kpView::zoomedDocWidth () const -{ - return document () ? document ()->width () * zoomLevelX () / 100 : 0; -} - -// public -int kpView::zoomedDocHeight () const -{ - return document () ? document ()->height () * zoomLevelY () / 100 : 0; -} - - -// public -void kpView::setHasMouse (bool yes) -{ - kpViewManager *vm = viewManager (); - if (!vm) - return; - -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () - << ")::setHasMouse(" << yes - << ") existing viewUnderCursor=" - << (vm->viewUnderCursor () ? vm->viewUnderCursor ()->objectName () : "(none)") - << endl; -#endif - if (yes && vm->viewUnderCursor () != this) - vm->setViewUnderCursor (this); - else if (!yes && vm->viewUnderCursor () == this) - vm->setViewUnderCursor (0); -} - -//--------------------------------------------------------------------- - -// public -void kpView::addToQueuedArea (const QRegion ®ion) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () - << ")::addToQueuedArea() already=" << d->queuedUpdateArea - << " - plus - " << region - << endl; -#endif - d->queuedUpdateArea += region; -} - -//--------------------------------------------------------------------- - -// public -void kpView::addToQueuedArea (const QRect &rect) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () - << ")::addToQueuedArea() already=" << d->queuedUpdateArea - << " - plus - " << rect - << endl; -#endif - d->queuedUpdateArea += rect; -} - -//--------------------------------------------------------------------- - -// public -void kpView::invalidateQueuedArea () -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView::invalidateQueuedArea()"; -#endif - - d->queuedUpdateArea = QRegion (); -} - -//--------------------------------------------------------------------- - -// public -void kpView::updateQueuedArea () -{ - kpViewManager *vm = viewManager (); -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () - << ")::updateQueuedArea() vm=" << (bool) vm - << " queueUpdates=" << (vm && vm->queueUpdates ()) - << " fastUpdates=" << (vm && vm->fastUpdates ()) - << " area=" << d->queuedUpdateArea - << endl; -#endif - - if (!vm) - return; - - if (vm->queueUpdates ()) - return; - - if (!d->queuedUpdateArea.isEmpty ()) - vm->updateView (this, d->queuedUpdateArea); - - invalidateQueuedArea (); -} - -//--------------------------------------------------------------------- - -// public -QPoint kpView::mouseViewPoint (const QPoint &returnViewPoint) const -{ - if (returnViewPoint != KP_INVALID_POINT) - return returnViewPoint; - else - { - // TODO: I don't think this is right for the main view since that's - // inside the scrollview (which can scroll). - return mapFromGlobal (QCursor::pos ()); - } -} - -//--------------------------------------------------------------------- - -// public virtual -QVariant kpView::inputMethodQuery (Qt::InputMethodQuery query) const -{ -#if DEBUG_KP_VIEW && 1 - kDebug () << "kpView(" << objectName () << ")::inputMethodQuery()"; -#endif - QVariant ret; - switch (query) - { - case Qt::ImMicroFocus: - { - QRect r = d->viewManager->textCursorRect (); - r.setTopLeft (r.topLeft () + origin ()); - r.setHeight (r.height() + 2); - r = transformDocToView (r); - ret = r; - break; - } - case Qt::ImFont: - { - if (textSelection ()) - { - ret = textSelection ()->textStyle ().font (); - } - break; - } - default: - break; - } - return ret; -} - -//--------------------------------------------------------------------- - -#include "moc_kpView.cpp" - diff --git a/kolourpaint/views/kpView.h b/kolourpaint/views/kpView.h deleted file mode 100644 index d1779b07..00000000 --- a/kolourpaint/views/kpView.h +++ /dev/null @@ -1,599 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_VIEW_H -#define KP_VIEW_H - - -#include - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class kpAbstractSelection; -class kpDocument; -class kpTextSelection; -class kpTool; -class kpToolToolBar; -class kpViewManager; -class kpViewScrollableContainer; - - -/** - * @short Abstract base class for all views. - * - * This is the abstract base class for all views. A view is a widget that - * renders a possibly zoomed onscreen representation of a document. - * - * 1 view corresponds to 1 document. - * 1 document corresponds to 0 or more views. - * - * @see kpViewManager - * - * @author Clarence Dang - */ -class kpView : public QWidget -{ -Q_OBJECT - -public: - /** - * Constructs a view. - * - * @param document The document this view is representing. - * @param toolToolBar The tool tool bar. - * @param viewManager The view manager. - * @param buddyView The view this view watches over (e.g. a thumbnail - * view would watch over the main view). May be 0. - * See for example, highlightBuddyViewRectangle(). - * @param scrollableContainer This view's scrollable container. - * May be 0. - * - * You must call adjustEnvironment() at the end of your constructor. - */ - kpView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent); - - /** - * Destructs this view. Informs the viewManager() that the mouse - * cursor is no longer above this view. - */ - virtual ~kpView (); - - - // - // Constants (enforced by methods) - // - static const int MinZoomLevel, MaxZoomLevel; - - - /** - * @returns the document. - */ - kpDocument *document () const; - -protected: - /** - * @returns the document's selection. - */ - kpAbstractSelection *selection () const; - - kpTextSelection *textSelection () const; - -public: - /** - * @returns the tool tool bar. - */ - kpToolToolBar *toolToolBar () const; - -protected: - /** - * @returns the currently selected tool. - */ - kpTool *tool () const; - -public: - /** - * @returns the view manager. - */ - kpViewManager *viewManager () const; - - /** - * @returns the buddy view. - */ - kpView *buddyView () const; - - /** - * @returns the buddyView()'s scrollable container. - */ - kpViewScrollableContainer *buddyViewScrollableContainer () const; - - /** - * @returns this view's scrollable container. - */ - kpViewScrollableContainer *scrollableContainer () const; - - - /** - * @returns the horizontal zoom level (100 is unzoomed). - */ - int zoomLevelX (void) const; - - /** - * @returns the vertical zoom level (100 is unzoomed). - */ - int zoomLevelY (void) const; - - /** - * Sets the horizontal and vertical zoom levels. - * - * @param hzoom Horizontal zoom level. - * @param vzoom Vertical zoom level. - * - * This method automatically bounds and to be between - * MinZoomLevel and MaxZoomLevel inclusive. - * - * If reimplementing, you must call this base implementation. - */ - virtual void setZoomLevel (int hzoom, int vzoom); - - - /** - * @returns in views coordinates, where the top-left document() pixel - * will be rendered (default: (0,0)). - */ - QPoint origin () const; - - /** - * Sets the origin. - * - * @param origin New origin. - * - * If reimplementing, you must call this base implementation. - */ - virtual void setOrigin (const QPoint &origin); - - - /** - * @returns whether at this zoom level, the grid can be enabled. - * This is based on whether the grid can be sensibly rendered. - */ - bool canShowGrid () const; - - /** - * @returns whether the grid is currently shown. - */ - bool isGridShown () const; - - /** - * Turns on/off the grid. - * - * @param yes Whether to enable the grid. - */ - void showGrid (bool yes = true); - - - /** - * @returns whether to draw a rectangle highlighting the area of - * buddyView() visible through buddyViewScrollableContainer(). - */ - bool isBuddyViewScrollableContainerRectangleShown () const; - - /** - * Turns on/off the rectangle highlighting the area of buddyView() - * visible through buddyViewScrollableContainer() and redraws. - * - * @param yes Whether to turn on the rectangle. - */ - void showBuddyViewScrollableContainerRectangle (bool yes = true); - -protected: - /** - * @returns the current rectangle highlighting the area of buddyView() - * visible through buddyViewScrollableContainer(), that is being - * rendered by this view. - */ - QRect buddyViewScrollableContainerRectangle () const; - -protected slots: - /** - * Updates the buddyViewScrollableContainerRectangle() and redraws - * appropriately. - * - * This is already connected to zoomLevelChanged() and originChanged(); - * buddyView() and buddyViewScrollableContainer() signals. There is probably no - * need to call this function directly. - */ - void updateBuddyViewScrollableContainerRectangle (); - - -public: - - /** - * @param viewX Horizontal position in view coordinates. - * - * @returns viewX transformed to document coordinates, based on the - * origin() and zoomLevelX(). - */ - double transformViewToDocX (double viewX) const; - - /** - * @param viewY Vertical position in view coordinates. - * - * @returns viewY transformed to document coordinates, based on the - * origin() and zoomLevelY(). - */ - double transformViewToDocY (double viewY) const; - - /** - * @param viewPoint Position in view coordinates. - * - * @returns viewPoint transformed to document coordinates, based on the - * origin(), zoomLevelX() and zoomLevelY(). - */ - QPoint transformViewToDoc (const QPoint &viewPoint) const; - - /** - * @param viewRect Rectangle in view coordinates. - * - * @returns viewRect transformed to document coordinates based on the - * origin(), zoomLevelX() and zoomLevelY(). - * - * For bounding rectangles, you should use this function instead of - * transformViewToDocX(), transformViewToDocY() or - * transformViewToDoc(const QPoint &) which act on coordinates only. - */ - QRect transformViewToDoc (const QRect &viewRect) const; - - - /** - * @param docX Horizontal position in document coordinates. - * - * @returns docX transformed to view coordinates, based on the origin() - * and zoomLevelX(). - */ - double transformDocToViewX (double docX) const; - - /** - * @param docY Vertical position in document coordinates. - * - * @returns docY transformed to view coordinates, based on the origin() - * and zoomLevelY(). - */ - double transformDocToViewY (double docY) const; - - /** - * @param docPoint Position in document coordinates. - * - * @returns docPoint transformed to view coordinates, based on the - * origin(), zoomLevelX(), zoomLevelY(). - */ - QPoint transformDocToView (const QPoint &docPoint) const; - - /** - * @param docRect Rectangle in document coordinates. - * - * @return docRect transformed to view coordinates, based on the - * origin(), zoomLevelX() and zoomLevelY(). - * - * For bounding rectangles, you should use this function instead of - * transformDocToViewX(), transformDocToViewY() or - * transformDocToView(const QPoint &) which act on coordinates only. - */ - QRect transformDocToView (const QRect &docRect) const; - - - /** - * @param viewPoint Position in view coordinates. - * @param otherView View whose coordinate system the return value will - * be in. - * - * @returns viewPoint transformed to the coordinate system of - * @param otherView based on this and otherView's origin(), - * zoomLevelX() and zoomLevelY(). This has less rounding - * error than otherView->transformDocToView (transformViewToDoc (viewPoint)). - */ - QPoint transformViewToOtherView (const QPoint &viewPoint, - const kpView *otherView); - - - /** - * @returns the approximate view width required to display the entire - * document(), based on the zoom level only. - */ - int zoomedDocWidth () const; - - /** - * @returns the approximate view height required to display the entire - * document(), based on the zoom level only. - */ - int zoomedDocHeight () const; - - -protected: - /** - * Updates the viewManager() on whether or not the mouse is directly - * above this view. Among other things, this ensures the brush cursor - * is updated. - * - * This should be called in event handlers. - * - * @param yes Whether the mouse is directly above this view. - */ - void setHasMouse (bool yes = true); - - -public: - /** - * Adds a region (in view coordinates) to the dirty area that is - * repainted when the parent @ref kpViewManager is set not to queue - * updates. - * - * @param region Region (in view coordinates) that needs repainting. - */ - void addToQueuedArea (const QRegion ®ion); - - /** - * Convenience function. Same as above. - * - * Adds a rectangle (in view coordinates) to the dirty area that is - * repainted when the parent @ref kpViewManager is set not to queue - * updates. - * - * @param rect Rectangle (in view coordinates) that needs repainting. - */ - void addToQueuedArea (const QRect &rect); - - /** - * Removes the dirty region that has been queued for updating. - * Does not update the view. - */ - void invalidateQueuedArea (); - - /** - * Updates the part of the view described by dirty region and then - * calls invalidateQueuedArea(). Does nothing if @ref kpViewManager - * is set to queue updates. - */ - void updateQueuedArea (); - - QVariant inputMethodQuery (Qt::InputMethodQuery query) const; - -public slots: - /** - * Call this when the "environment" (e.g. document size) changes. The - * environment is defined by the caller and should be based on the type - * of view. For instance, an unzoomed thumbnail view would also - * include in its environment the contents position of an associated - * scrollable container. - * - * This is never called by the kpView base class. - * - * Implementors should change whatever state is necessary for their - * type of view. For instance, an unzoomed view would resize itself; - * a zoomed thumbnail would change the zoom level. - */ - virtual void adjustToEnvironment () = 0; - - -public: - // If is not KP_INVALID_POINT, it spits it back. - // Else, it returns the current mouse position in view coordinates. - // REFACTOR: Seems like a bad API. - QPoint mouseViewPoint (const QPoint &returnViewPoint = KP_INVALID_POINT) const; - - -signals: - /** - * Emitted after all zooming code has been executed. - * - * @param zoomLevelX New zoomLevelX() - * @param zoomLevelY New zoomLevelY() - */ - void zoomLevelChanged (int zoomLevelX, int zoomLevelY); - - /** - * Emitted after all resizing code has been executed. - * - * @param size New view size. - */ - void sizeChanged (const QSize &size); - - /** - * Convenience signal - same as above. - * - * Emitted after all resizing code has been executed. - * - * @param width New view width. - * @param height New view height. - */ - void sizeChanged (int width, int height); - - /** - * Emitted after all origin changing code has been executed. - * - * @param origin The new origin. - */ - void originChanged (const QPoint &origin); - - - -// -// Selections -// - -public: - QRect selectionViewRect () const; - - // (if is KP_INVALID_POINT, it uses QCursor::pos()) - - QPoint mouseViewPointRelativeToSelection (const QPoint &viewPoint = KP_INVALID_POINT) const; - bool mouseOnSelection (const QPoint &viewPoint = KP_INVALID_POINT) const; - - int textSelectionMoveBorderAtomicSize () const; - bool mouseOnSelectionToMove (const QPoint &viewPoint = KP_INVALID_POINT) const; - -protected: - bool selectionLargeEnoughToHaveResizeHandlesIfAtomicSize (int atomicSize) const; -public: - int selectionResizeHandleAtomicSize () const; - bool selectionLargeEnoughToHaveResizeHandles () const; - - QRegion selectionResizeHandlesViewRegion (bool forRenderer = false) const; - - enum SelectionResizeType - { - None = 0, - Left = 1, - Right = 2, - Top = 4, - Bottom = 8 - }; - - // Returns a bitwise OR of the SelectionResizeType's - int mouseOnSelectionResizeHandle (const QPoint &viewPoint = KP_INVALID_POINT) const; - - bool mouseOnSelectionToSelectText (const QPoint &viewPoint = KP_INVALID_POINT) const; - - -// -// Events -// - -protected: - virtual void mouseMoveEvent (QMouseEvent *e); - virtual void mousePressEvent (QMouseEvent *e); - virtual void mouseReleaseEvent (QMouseEvent *e); -public: - // (needs to be public as it may also get event from - // QScrollView::contentsWheelEvent()) - virtual void wheelEvent (QWheelEvent *e); - - -protected: - virtual void keyPressEvent (QKeyEvent *e); - virtual void keyReleaseEvent (QKeyEvent *e); - -protected: - virtual void inputMethodEvent (QInputMethodEvent *e); - -protected: - virtual bool event (QEvent *e); - - -protected: - virtual void focusInEvent (QFocusEvent *e); - virtual void focusOutEvent (QFocusEvent *e); - - -protected: - virtual void enterEvent (QEvent *e); - virtual void leaveEvent (QEvent *e); - - -protected: - virtual void dragEnterEvent (QDragEnterEvent *); - virtual void dragLeaveEvent (QDragLeaveEvent *); - - -protected: - virtual void resizeEvent (QResizeEvent *e); - - -// -// Painting -// - -protected: - // Returns the document rectangle that, when scaled to the view, - // is "guaranteed" to at least cover and possibly more - // ("guaranteed" in quotes because it doesn't seem so reliable for - // zoom levels that aren't multiples of 100%). - QRect paintEventGetDocRect (const QRect &viewRect) const; -public: - /** - * Draws an opaque background representing transparency. - * - * Currently, it draws a checkerboard which, if it were to be drawn - * in its entirety, is tiled from . - * - * @param painter Painter. - * @param patternOrigin Logical top-left point of the checkerboard, - * relative to the painter, if it were to be - * drawn in its entirety. - * @param viewRect Rectangle to paint in relative to the painter. - * @param isPreview Whether the view is for a preview as opposed to - * e.g. editing. If set, this function may render - * slightly differently. - */ - static void drawTransparentBackground (QPainter *painter, - const QPoint &patternOrigin, - const QRect &viewRect, - bool isPreview = false); -protected: - // Draws a checkerboard that looks static even if the view is scrollable. - void paintEventDrawCheckerBoard (QPainter *painter, - const QRect &viewRect); - - // Draws the selection and its border onto . - // is the part of the document given by . - void paintEventDrawSelection (QImage *destPixmap, const QRect &docRect); - - // Draws the parts of the selection's resize handles that are inside - // onto the view - void paintEventDrawSelectionResizeHandles (const QRect &clipRect); - void paintEventDrawTempImage (QImage *destPixmap, const QRect &docRect); - - // Draws the parts of the grid lines that are inside on - // . - void paintEventDrawGridLines (QPainter *painter, const QRect &viewRect); - - void paintEventDrawDoc_Unclipped (const QRect &viewRect); - virtual void paintEvent (QPaintEvent *e); - - -private: - struct kpViewPrivate *d; -}; - - -#endif // KP_VIEW_H diff --git a/kolourpaint/views/kpViewPrivate.h b/kolourpaint/views/kpViewPrivate.h deleted file mode 100644 index 3d3a82ad..00000000 --- a/kolourpaint/views/kpViewPrivate.h +++ /dev/null @@ -1,78 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpViewPrivate_H -#define kpViewPrivate_H - - -#include -#include -#include -#include - - -class kpDocument; -class kpToolToolBar; -class kpViewmanager; -class kpView; -class kpViewScrollableContainer; - - -struct kpViewPrivate -{ - // sync: kpView::paintEvent() - // - // Normally, these pointers must be valid while the kpView is alive. - // Generally, the objects they point to are deleted only after kpView - // is deleted. - // - // However, sometimes we use deleteLater() for the kpView. - // Before the delayed deletion is executed, those objects are deleted - // and then our paintEvent() is called. paintEvent() must therefore - // have some way of realising that those objects have been deleted so - // we use guardded pointers. - // - // For more details, see SVN commit: - // "r385274 | dang | 2005-02-02 22:08:27 +1100 (Wed, 02 Feb 2005) | 21 lines". - QPointer document; - QPointer toolToolBar; - QPointer viewManager; - QPointer buddyView; - QPointer scrollableContainer; - - int hzoom, vzoom; - QPoint origin; - bool showGrid; - bool isBuddyViewScrollableContainerRectangleShown; - QRect buddyViewScrollableContainerRectangle; - - QRegion queuedUpdateArea; -}; - - -#endif // kpViewPrivate_H diff --git a/kolourpaint/views/kpView_Events.cpp b/kolourpaint/views/kpView_Events.cpp deleted file mode 100644 index 604b621f..00000000 --- a/kolourpaint/views/kpView_Events.cpp +++ /dev/null @@ -1,272 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2005 Kazuki Ohta - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW 0 -#define DEBUG_KP_VIEW_RENDERER ((DEBUG_KP_VIEW && 1) || 0) - - -#include -#include - -#if DEBUG_KP_VIEW -#include -#endif - -#include - - -#include - -#include - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::mouseMoveEvent (QMouseEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::mouseMoveEvent (" - << e->x () << "," << e->y () << ")" - << endl; -#endif - - // TODO: This is wrong if you leaveEvent the mainView by mouseMoving on the - // mainView, landing on top of the thumbnailView cleverly put on top - // of the mainView. - setHasMouse (rect ().contains (e->pos ())); - - if (tool ()) - tool ()->mouseMoveEvent (e); - - e->accept (); -} - -// protected virtual [base QWidget] -void kpView::mousePressEvent (QMouseEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::mousePressEvent (" - << e->x () << "," << e->y () << ")" - << endl; -#endif - - setHasMouse (true); - - if (tool ()) - tool ()->mousePressEvent (e); - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::mouseReleaseEvent (QMouseEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::mouseReleaseEvent (" - << e->x () << "," << e->y () << ")" - << endl; -#endif - - setHasMouse (rect ().contains (e->pos ())); - - if (tool ()) - tool ()->mouseReleaseEvent (e); - - e->accept (); -} - -//--------------------------------------------------------------------- - -// public virtual [base QWidget] -void kpView::wheelEvent (QWheelEvent *e) -{ - if (tool ()) - tool ()->wheelEvent (e); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::keyPressEvent (QKeyEvent *e) -{ -#if DEBUG_KP_VIEW - kDebug () << "kpView(" << objectName () << ")::keyPressEvent()" << e->text(); -#endif - - if (tool ()) - tool ()->keyPressEvent (e); - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::keyReleaseEvent (QKeyEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::keyReleaseEvent()"; -#endif - - if (tool ()) - tool ()->keyReleaseEvent (e); - - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::inputMethodEvent (QInputMethodEvent *e) -{ -#if DEBUG_KP_VIEW && 1 - kDebug () << "kpView(" << objectName () << ")::inputMethodEvent()"; -#endif - - if (tool ()) - tool ()->inputMethodEvent (e); - e->accept (); -} - -// protected virtual [base QWidget] -bool kpView::event (QEvent *e) -{ -#if DEBUG_KP_VIEW - kDebug () << "kpView::event() invoking kpTool::event()"; -#endif - if (tool () && tool ()->viewEvent (e)) - { - #if DEBUG_KP_VIEW - kDebug () << "\tkpView::event() - tool said eat event, ret true"; - #endif - return true; - } - -#if DEBUG_KP_VIEW - kDebug () << "\tkpView::event() - no tool or said false, call QWidget::event()"; -#endif - return QWidget::event (e); -} - - -// protected virtual [base QWidget] -void kpView::focusInEvent (QFocusEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::focusInEvent()"; -#endif - if (tool ()) - tool ()->focusInEvent (e); -} - -// protected virtual [base QWidget] -void kpView::focusOutEvent (QFocusEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::focusOutEvent()"; -#endif - if (tool ()) - tool ()->focusOutEvent (e); -} - - -// protected virtual [base QWidget] -void kpView::enterEvent (QEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::enterEvent()"; -#endif - - // Don't call setHasMouse(true) as it displays the brush cursor (if - // active) when dragging open a menu and then dragging - // past the extents of the menu due to Qt sending us an EnterEvent. - // We're already covered by MouseMoveEvent anyway. - // - // But disabling this causes a more serious problem: RMB on a text - // box and Esc. We have no other reliable way to determine if the - // mouse is still above the view (user could have moved mouse out - // while RMB menu was up) and hence the cursor is not updated. - setHasMouse (true); - - if (tool ()) - tool ()->enterEvent (e); -} - -// protected virtual [base QWidget] -void kpView::leaveEvent (QEvent *e) -{ -#if DEBUG_KP_VIEW && 0 - kDebug () << "kpView(" << objectName () << ")::leaveEvent()"; -#endif - - setHasMouse (false); - if (tool ()) - tool ()->leaveEvent (e); -} - - -// protected virtual [base QWidget] -void kpView::dragEnterEvent (QDragEnterEvent *) -{ -#if DEBUG_KP_VIEW && 1 - kDebug () << "kpView(" << objectName () << ")::dragEnterEvent()"; -#endif - - setHasMouse (true); -} - -// protected virtual [base QWidget] -void kpView::dragLeaveEvent (QDragLeaveEvent *) -{ -#if DEBUG_KP_VIEW && 1 - kDebug () << "kpView(" << objectName () << ")::dragLeaveEvent"; -#endif - - setHasMouse (false); -} - - -// protected virtual [base QWidget] -void kpView::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_VIEW && 1 - kDebug () << "kpView(" << objectName () << ")::resizeEvent(" - << e->size () - << " vs actual=" << size () - << ") old=" << e->oldSize () << endl; -#endif - - QWidget::resizeEvent (e); - - emit sizeChanged (width (), height ()); - emit sizeChanged (size ()); -} diff --git a/kolourpaint/views/kpView_Paint.cpp b/kolourpaint/views/kpView_Paint.cpp deleted file mode 100644 index 674a76df..00000000 --- a/kolourpaint/views/kpView_Paint.cpp +++ /dev/null @@ -1,628 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW 0 -#define DEBUG_KP_VIEW_RENDERER ((DEBUG_KP_VIEW && 1) || 0) - - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -// protected -QRect kpView::paintEventGetDocRect (const QRect &viewRect) const -{ -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView::paintEventGetDocRect(" << viewRect << ")"; -#endif - - QRect docRect; - - // From the "we aren't sure whether to round up or round down" department: - - if (zoomLevelX () < 100 || zoomLevelY () < 100) - docRect = transformViewToDoc (viewRect); - else - { - // think of a grid - you need to fully cover the zoomed-in pixels - // when docRect is zoomed back to the view later - docRect = QRect (transformViewToDoc (viewRect.topLeft ()), // round down - transformViewToDoc (viewRect.bottomRight ())); // round down - } - - if (zoomLevelX () % 100 || zoomLevelY () % 100) - { - // at least round up the bottom-right point and deal with matrix weirdness: - // - helpful because it ensures we at least cover the required area - // at e.g. 67% or 573% - docRect.setBottomRight (docRect.bottomRight () + QPoint (2, 2)); - } - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tdocRect=" << docRect; -#endif - kpDocument *doc = document (); - if (doc) - { - docRect = docRect.intersected (doc->rect ()); - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tintersect with doc=" << docRect; - #endif - } - - return docRect; -} - -//--------------------------------------------------------------------- - -// public static -void kpView::drawTransparentBackground (QPainter *painter, - const QPoint &patternOrigin, - const QRect &viewRect, - bool isPreview) -{ -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView::drawTransparentBackground() patternOrigin=" - << patternOrigin - << " viewRect=" << viewRect - << " isPreview=" << isPreview - << endl; -#endif - - const int cellSize = !isPreview ? 16 : 10; - - // TODO: % is unpredictable with negatives. - - int starty = viewRect.y (); - if ((starty - patternOrigin.y ()) % cellSize) - starty -= ((starty - patternOrigin.y ()) % cellSize); - - int startx = viewRect.x (); - if ((startx - patternOrigin.x ()) % cellSize) - startx -= ((startx - patternOrigin.x ()) % cellSize); - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tstartXY=" << QPoint (startx, starty); -#endif - - painter->save (); - - // Clip to as we may draw outside it on all sides. - painter->setClipRect (viewRect, Qt::IntersectClip/*honor existing clip*/); - - for (int y = starty; y <= viewRect.bottom (); y += cellSize) - { - for (int x = startx; x <= viewRect.right (); x += cellSize) - { - bool parity = ((x - patternOrigin.x ()) / cellSize + - (y - patternOrigin.y ()) / cellSize) % 2; - QColor col; - - if (parity) - { - if (!isPreview) - col = QColor (213, 213, 213); - else - col = QColor (224, 224, 224); - } - else - col = Qt::white; - - painter->fillRect (x, y, cellSize, cellSize, col); - } - } - - painter->restore (); -} - -//--------------------------------------------------------------------- - -// protected -void kpView::paintEventDrawCheckerBoard (QPainter *painter, const QRect &viewRect) -{ -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView(" << objectName () - << ")::paintEventDrawCheckerBoard(viewRect=" << viewRect - << ") origin=" << origin () << endl; -#endif - - kpDocument *doc = document (); - if (!doc) - return; - - QPoint patternOrigin = origin (); - - if (scrollableContainer ()) - { - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tscrollableContainer: contents[XY]=" - << QPoint (scrollableContainer ()->horizontalScrollBar()->value (), - scrollableContainer ()->verticalScrollBar()->value ()) - << endl; - #endif - // Make checkerboard appear static relative to the scroll view. - // This makes it more obvious that any visible bits of the - // checkboard represent transparent pixels and not gray and white - // squares. - patternOrigin = QPoint (scrollableContainer ()->horizontalScrollBar()->value(), - scrollableContainer ()->verticalScrollBar()->value()); - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\t\tpatternOrigin=" << patternOrigin; - #endif - } - - // TODO: this static business doesn't work yet - patternOrigin = QPoint (0, 0); - - drawTransparentBackground (painter, patternOrigin, viewRect); -} - -//--------------------------------------------------------------------- - -// protected -void kpView::paintEventDrawSelection (QImage *destPixmap, const QRect &docRect) -{ -#if DEBUG_KP_VIEW_RENDERER && 1 || 0 - kDebug () << "kpView::paintEventDrawSelection() docRect=" << docRect; -#endif - - kpDocument *doc = document (); - if (!doc) - { - #if DEBUG_KP_VIEW_RENDERER && 1 || 0 - kDebug () << "\tno doc - abort"; - #endif - return; - } - - kpAbstractSelection *sel = doc->selection (); - if (!sel) - { - #if DEBUG_KP_VIEW_RENDERER && 1 || 0 - kDebug () << "\tno sel - abort"; - #endif - return; - } - - - // - // Draw selection pixmap (if there is one) - // -#if DEBUG_KP_VIEW_RENDERER && 1 || 0 - kDebug () << "\tdraw sel pixmap @ " << sel->topLeft (); -#endif - sel->paint (destPixmap, docRect); - - - // - // Draw selection border - // - - kpViewManager *vm = viewManager (); -#if DEBUG_KP_VIEW_RENDERER && 1 || 0 - kDebug () << "\tsel border visible=" - << vm->selectionBorderVisible () - << endl; -#endif - if (vm->selectionBorderVisible ()) - { - sel->paintBorder (destPixmap, docRect, vm->selectionBorderFinished ()); - } - - - // - // Draw text cursor - // - - // TODO: It would be nice to display the text cursor even if it's not - // within the text box (this can happen if the text box is too - // small for the text it contains). - // - // However, too much selection repaint code assumes that it - // only paints inside its kpAbstractSelection::boundingRect(). - kpTextSelection *textSel = dynamic_cast (sel); - if (textSel && - vm->textCursorEnabled () && - (vm->textCursorBlinkState () || - // For the current main window: - // As long as _any_ view has focus, blink _all_ views not just the - // one with focus. - !vm->hasAViewWithFocus ())) // sync: call will break when vm is not held by 1 mainWindow - { - QRect rect = vm->textCursorRect (); - rect = rect.intersected (textSel->textAreaRect ()); - if (!rect.isEmpty ()) - { - kpPixmapFX::fillRect(destPixmap, - rect.x () - docRect.x (), rect.y () - docRect.y (), - rect.width (), rect.height (), - kpColor::LightGray, kpColor::DarkGray); - } - } -} - -//--------------------------------------------------------------------- - -// protected -void kpView::paintEventDrawSelectionResizeHandles (const QRect &clipRect) -{ -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView::paintEventDrawSelectionResizeHandles(" - << clipRect << ")" << endl; -#endif - - if (!selectionLargeEnoughToHaveResizeHandles ()) - { - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tsel not large enough to have resize handles"; - #endif - return; - } - - kpViewManager *vm = viewManager (); - if (!vm || !vm->selectionBorderVisible () || !vm->selectionBorderFinished ()) - { - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tsel border not visible or not finished"; - #endif - - return; - } - - const QRect selViewRect = selectionViewRect (); -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tselViewRect=" << selViewRect; -#endif - if (!selViewRect.intersects (clipRect)) - { - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tdoesn't intersect viewRect"; - #endif - return; - } - - QRegion selResizeHandlesRegion = selectionResizeHandlesViewRegion (true/*for renderer*/); -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tsel resize handles view region=" - << selResizeHandlesRegion << endl; -#endif - - QPainter painter(this); - painter.setPen(Qt::black); - painter.setBrush(Qt::cyan); - - foreach (const QRect &r, selResizeHandlesRegion.rects()) - painter.drawRect(r); -} - -//--------------------------------------------------------------------- - -// protected -void kpView::paintEventDrawTempImage (QImage *destPixmap, const QRect &docRect) -{ - kpViewManager *vm = viewManager (); - if (!vm) - return; - - const kpTempImage *tpi = vm->tempImage (); -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView::paintEventDrawTempImage() tempImage=" - << tpi - << " isVisible=" - << (tpi ? tpi->isVisible (vm) : false) - << endl; -#endif - - if (!tpi || !tpi->isVisible (vm)) - return; - - tpi->paint (destPixmap, docRect); -} - -//--------------------------------------------------------------------- - -// protected -void kpView::paintEventDrawGridLines (QPainter *painter, const QRect &viewRect) -{ - int hzoomMultiple = zoomLevelX () / 100; - int vzoomMultiple = zoomLevelY () / 100; - - painter->setPen(Qt::gray); - - // horizontal lines - int starty = viewRect.top(); - if (starty % vzoomMultiple) - starty = (starty + vzoomMultiple) / vzoomMultiple * vzoomMultiple; - - for (int y = starty; y <= viewRect.bottom(); y += vzoomMultiple) - painter->drawLine(viewRect.left(), y, viewRect.right(), y); - - // vertical lines - int startx = viewRect.left(); - if (startx % hzoomMultiple) - startx = (startx + hzoomMultiple) / hzoomMultiple * hzoomMultiple; - - for (int x = startx; x <= viewRect.right(); x += hzoomMultiple) - painter->drawLine(x, viewRect.top (), x, viewRect.bottom()); -} - -//--------------------------------------------------------------------- - -// This is called "_Unclipped" because it may draw outside of -// . -// -// There are 2 reasons for doing so: -// -// A. If, for instance: -// -// 1. = QRect (0, 0, 2, 3) [top-left of the view] -// 2. zoomLevelX() == 800 -// 3. zoomLevelY() == 800 -// -// Then, the local variable will be QRect (0, 0, 1, 1). -// When the part of the document corresponding to -// (a single document pixel) is drawn with QPainter::scale(), the -// view rectangle QRect (0, 0, 7, 7) will be overwritten due to the -// 8x zoom. This view rectangle is bigger than . -// -// We can't use QPainter::setClipRect() since it is buggy in Qt 4.3.1 -// and clips too many pixels when used in combination with scale() -// [qt-bugs@trolltech.com issue N181038]. ==> MK 10.2.2011 - fixed since Qt-4.4.4 -// -// B. paintEventGetDocRect() may, by design, return a larger document -// rectangle than what corresponds to, if the zoom levels -// are not perfectly divisible by 100. -// -// This over-drawing is dangerous -- see the comments in paintEvent(). -// This over-drawing is only safe from Qt's perspective since Qt -// automatically clips all drawing in paintEvent() (which calls us) to -// QPaintEvent::region(). -void kpView::paintEventDrawDoc_Unclipped (const QRect &viewRect) -{ -#if DEBUG_KP_VIEW_RENDERER - QTime timer; - timer.start (); - kDebug () << "\tviewRect=" << viewRect; -#endif - - kpViewManager *vm = viewManager (); - const kpDocument *doc = document (); - - Q_ASSERT (vm); - Q_ASSERT (doc); - - if (viewRect.isEmpty ()) - return; - - QRect docRect = paintEventGetDocRect (viewRect); - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tdocRect=" << docRect; -#endif - - QPainter painter (this); - //painter.setCompositionMode(QPainter::CompositionMode_Source); - - QImage docPixmap; - bool tempImageWillBeRendered = false; - - // LOTODO: I think being empty would be a bug. - if (!docRect.isEmpty ()) - { - docPixmap = doc->getImageAt (docRect); - - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tdocPixmap.hasAlphaChannel()=" - << docPixmap.hasAlphaChannel () << endl; - #endif - - tempImageWillBeRendered = - (!doc->selection () && - vm->tempImage () && - vm->tempImage ()->isVisible (vm) && - docRect.intersects (vm->tempImage ()->rect ())); - - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\ttempImageWillBeRendered=" << tempImageWillBeRendered - << " (sel=" << doc->selection () - << " tempImage=" << vm->tempImage () - << " tempImage.isVisible=" << (vm->tempImage () ? vm->tempImage ()->isVisible (vm) : false) - << " docRect.intersects(tempImage.rect)=" << (vm->tempImage () ? docRect.intersects (vm->tempImage ()->rect ()) : false) - << ")" - << endl; - #endif - } - - - // - // Draw checkboard for transparent images and/or views with borders - // - - if (docPixmap.hasAlphaChannel() || - (tempImageWillBeRendered && vm->tempImage ()->paintMayAddMask ())) - { - paintEventDrawCheckerBoard (&painter, viewRect); - } - - if (!docRect.isEmpty ()) - { - // - // Draw docPixmap + tempImage - // - - if (doc->selection ()) - { - paintEventDrawSelection (&docPixmap, docRect); - } - else if (tempImageWillBeRendered) - { - paintEventDrawTempImage (&docPixmap, docRect); - } - - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\torigin=" << origin (); - #endif - // Blit scaled version of docPixmap + tempImage. - #if DEBUG_KP_VIEW_RENDERER && 1 - QTime scaleTimer; scaleTimer.start (); - #endif - // This is the only troublesome part of the method that draws unclipped. - painter.translate (origin ().x (), origin ().y ()); - painter.scale (double (zoomLevelX ()) / 100.0, - double (zoomLevelY ()) / 100.0); - painter.drawImage (docRect, docPixmap); - //painter.resetMatrix (); // back to 1-1 scaling - #if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tscale time=" << scaleTimer.elapsed (); - #endif - - } // if (!docRect.isEmpty ()) { - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tdrawDocRect done in: " << timer.restart () << "ms"; -#endif -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpView::paintEvent (QPaintEvent *e) -{ - // sync: kpViewPrivate - // WARNING: document(), viewManager() and friends might be 0 in this method. - // TODO: I'm not 100% convinced that we always check if their friends are 0. - -#if DEBUG_KP_VIEW_RENDERER && 1 - QTime timer; - timer.start (); -#endif - - kpViewManager *vm = viewManager (); - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "kpView(" << objectName () << ")::paintEvent() vm=" << (bool) vm - << " queueUpdates=" << (vm && vm->queueUpdates ()) - << " fastUpdates=" << (vm && vm->fastUpdates ()) - << " viewRect=" << e->rect () - << " topLeft=" << QPoint (x (), y ()) - << endl; -#endif - - if (!vm) - return; - - if (vm->queueUpdates ()) - { - // OPT: if this update was due to the document, - // use document coordinates (in case of a zoom change in - // which view coordinates become out of date) - addToQueuedArea (e->region ()); - return; - } - - kpDocument *doc = document (); - if (!doc) - return; - - - // It seems that e->region() is already clipped by Qt to the visible - // part of the view (which could be quite small inside a scrollview). - QRegion viewRegion = e->region (); - QVector rects = viewRegion.rects (); -#if DEBUG_KP_VIEW_RENDERER - kDebug () << "\t#rects = " << rects.count (); -#endif - - // Draw all of the requested regions of the document _before_ drawing - // the grid lines, buddy rectangle and selection resize handles. - // This ordering is important since paintEventDrawDoc_Unclipped() - // may draw outside of the view rectangle passed to it. - // - // To illustrate this, suppose we changed each iteration of the loop - // to call paintEventDrawDoc_Unclipped() _and_ then, - // paintEventDrawGridLines(). If there are 2 or more iterations of this - // loop, paintEventDrawDoc_Unclipped() in one iteration may draw over - // parts of nearby grid lines (which were drawn in a previous iteration) - // with document pixels. Those grid line parts are probably not going to - // be redrawn, so will appear to be missing. - foreach (const QRect &r, rects) - { - paintEventDrawDoc_Unclipped (r); - } - - // - // Draw Grid Lines - // - - if ( isGridShown() ) - { - QPainter painter(this); - foreach (const QRect &r, rects) - paintEventDrawGridLines(&painter, r); - } - - const QRect r = buddyViewScrollableContainerRectangle(); - if ( !r.isEmpty() ) - { - QPainter painter(this); - - painter.setPen(QPen(Qt::lightGray, 1/*width*/, Qt::DotLine)); - painter.setBackground(Qt::darkGray); - painter.setBackgroundMode(Qt::OpaqueMode); - - painter.drawRect(r.x(), r.y(), r.width() - 1, r.height() - 1); - } - - if (doc->selection ()) - { - // Draw resize handles on top of possible grid lines - paintEventDrawSelectionResizeHandles (e->rect ()); - } - -#if DEBUG_KP_VIEW_RENDERER && 1 - kDebug () << "\tall done in: " << timer.restart () << "ms"; -#endif -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/views/kpView_Selections.cpp b/kolourpaint/views/kpView_Selections.cpp deleted file mode 100644 index e865135e..00000000 --- a/kolourpaint/views/kpView_Selections.cpp +++ /dev/null @@ -1,362 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW 0 -#define DEBUG_KP_VIEW_RENDERER ((DEBUG_KP_VIEW && 1) || 0) - - -#include -#include - -#include -#include -#include - - -// public -QRect kpView::selectionViewRect () const -{ - return selection () ? - transformDocToView (selection ()->boundingRect ()) : - QRect (); - -} - - -// public -QPoint kpView::mouseViewPointRelativeToSelection (const QPoint &viewPoint) const -{ - if (!selection ()) - return KP_INVALID_POINT; - - return mouseViewPoint (viewPoint) - transformDocToView (selection ()->topLeft ()); -} - -// public -bool kpView::mouseOnSelection (const QPoint &viewPoint) const -{ - const QRect selViewRect = selectionViewRect (); - if (!selViewRect.isValid ()) - return false; - - return selViewRect.contains (mouseViewPoint (viewPoint)); -} - - -// public -int kpView::textSelectionMoveBorderAtomicSize () const -{ - if (!textSelection ()) - return 0; - - return qMax (4, zoomLevelX () / 100); -} - -// public -bool kpView::mouseOnSelectionToMove (const QPoint &viewPoint) const -{ - if (!mouseOnSelection (viewPoint)) - return false; - - if (!textSelection ()) - return true; - - if (mouseOnSelectionResizeHandle (viewPoint)) - return false; - - - const QPoint viewPointRelSel = mouseViewPointRelativeToSelection (viewPoint); - - // Middle point should always be selectable - const QPoint selCenterDocPoint = selection ()->boundingRect ().center (); - if (tool () && - tool ()->calculateCurrentPoint () == selCenterDocPoint) - { - return false; - } - - - const int atomicSize = textSelectionMoveBorderAtomicSize (); - const QRect selViewRect = selectionViewRect (); - - return (viewPointRelSel.x () < atomicSize || - viewPointRelSel.x () >= selViewRect.width () - atomicSize || - viewPointRelSel.y () < atomicSize || - viewPointRelSel.y () >= selViewRect.height () - atomicSize); -} - -//--------------------------------------------------------------------- - -// protected -bool kpView::selectionLargeEnoughToHaveResizeHandlesIfAtomicSize (int atomicSize) const -{ - if (!selection ()) - return false; - - const QRect selViewRect = selectionViewRect (); - - return (selViewRect.width () >= atomicSize * 5 || - selViewRect.height () >= atomicSize * 5); -} - -//--------------------------------------------------------------------- - -// public -int kpView::selectionResizeHandleAtomicSize () const -{ - int atomicSize = qMin (13, qMax (9, zoomLevelX () / 100)); - while (atomicSize > 0 && - !selectionLargeEnoughToHaveResizeHandlesIfAtomicSize (atomicSize)) - { - atomicSize--; - } - - return atomicSize; -} - -//--------------------------------------------------------------------- - -// public -bool kpView::selectionLargeEnoughToHaveResizeHandles () const -{ - return (selectionResizeHandleAtomicSize () > 0); -} - -//--------------------------------------------------------------------- - -// public -QRegion kpView::selectionResizeHandlesViewRegion (bool forRenderer) const -{ - const int atomicLength = selectionResizeHandleAtomicSize (); - if (atomicLength <= 0) - return QRegion (); - - - // HACK: At low zoom (e.g. 100%), resize handles will probably be too - // big and overlap text / cursor / too much of selection. - // - // So limit the _visual_ size of handles at low zoom. The - // handles' grab area remains the same for usability; so yes, - // there are a few pixels that don't look grabable but they are. - // - // The real solution is to be able to partially render the - // handles outside of the selection view rect. If not possible, - // at least for text boxes, render text on top of handles. - int normalAtomicLength = atomicLength; - int vertEdgeAtomicLength = atomicLength; - if (forRenderer && selection ()) - { - if (zoomLevelX () <= 150) - { - if (normalAtomicLength > 1) - normalAtomicLength--; - - if (vertEdgeAtomicLength > 1) - vertEdgeAtomicLength--; - } - - // 1 line of text? - if (textSelection () && textSelection ()->textLines ().size () == 1) - { - if (zoomLevelX () <= 150) - vertEdgeAtomicLength = qMin (vertEdgeAtomicLength, qMax (2, zoomLevelX () / 100)); - else if (zoomLevelX () <= 250) - vertEdgeAtomicLength = qMin (vertEdgeAtomicLength, qMax (3, zoomLevelX () / 100)); - } - } - - - const QRect selViewRect = selectionViewRect (); - QRegion ret; - - // top left - ret += QRect(0, 0, normalAtomicLength, normalAtomicLength); - - // top middle - ret += QRect((selViewRect.width() - normalAtomicLength) / 2, 0, - normalAtomicLength, normalAtomicLength); - - // top right - ret += QRect(selViewRect.width() - normalAtomicLength - 1, 0, - normalAtomicLength, normalAtomicLength); - - // left middle - ret += QRect(0, (selViewRect.height() - vertEdgeAtomicLength) / 2, - vertEdgeAtomicLength, vertEdgeAtomicLength); - - // right middle - ret += QRect(selViewRect.width() - vertEdgeAtomicLength - 1, (selViewRect.height() - vertEdgeAtomicLength) / 2, - vertEdgeAtomicLength, vertEdgeAtomicLength); - - // bottom left - ret += QRect(0, selViewRect.height() - normalAtomicLength - 1, - normalAtomicLength, normalAtomicLength); - - // bottom middle - ret += QRect((selViewRect.width() - normalAtomicLength) / 2, selViewRect.height() - normalAtomicLength - 1, - normalAtomicLength, normalAtomicLength); - - // bottom right - ret += QRect(selViewRect.width() - normalAtomicLength - 1, selViewRect.height() - normalAtomicLength - 1, - normalAtomicLength, normalAtomicLength); - - ret.translate (selViewRect.x (), selViewRect.y ()); - ret = ret.intersect (selViewRect); - - return ret; -} - -//--------------------------------------------------------------------- - -// public -// REFACTOR: use QFlags as the return type for better type safety. -int kpView::mouseOnSelectionResizeHandle (const QPoint &viewPoint) const -{ -#if DEBUG_KP_VIEW - kDebug () << "kpView::mouseOnSelectionResizeHandle(viewPoint=" - << viewPoint << ")" << endl; -#endif - - if (!mouseOnSelection (viewPoint)) - { - #if DEBUG_KP_VIEW - kDebug () << "\tmouse not on sel"; - #endif - return 0; - } - - - const QRect selViewRect = selectionViewRect (); -#if DEBUG_KP_VIEW - kDebug () << "\tselViewRect=" << selViewRect; -#endif - - - const int atomicLength = selectionResizeHandleAtomicSize (); -#if DEBUG_KP_VIEW - kDebug () << "\tatomicLength=" << atomicLength; -#endif - - if (atomicLength <= 0) - { - #if DEBUG_KP_VIEW - kDebug () << "\tsel not large enough to have resize handles"; - #endif - // Want to make it possible to move a small selection - return 0; - } - - - const QPoint viewPointRelSel = mouseViewPointRelativeToSelection (viewPoint); -#if DEBUG_KP_VIEW - kDebug () << "\tviewPointRelSel=" << viewPointRelSel; -#endif - - -#define LOCAL_POINT_IN_BOX_AT(x,y) \ - QRect ((x), (y), atomicLength, atomicLength).contains (viewPointRelSel) - - // Favour the bottom & right and the corners. - if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength, - selViewRect.height () - atomicLength)) - { - return kpView::Bottom | kpView::Right; - } - else if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength, 0)) - { - return kpView::Top | kpView::Right; - } - else if (LOCAL_POINT_IN_BOX_AT (0, selViewRect.height () - atomicLength)) - { - return kpView::Bottom | kpView::Left; - } - else if (LOCAL_POINT_IN_BOX_AT (0, 0)) - { - return kpView::Top | kpView::Left; - } - else if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength, - (selViewRect.height () - atomicLength) / 2)) - { - return kpView::Right; - } - else if (LOCAL_POINT_IN_BOX_AT ((selViewRect.width () - atomicLength) / 2, - selViewRect.height () - atomicLength)) - { - return kpView::Bottom; - } - else if (LOCAL_POINT_IN_BOX_AT ((selViewRect.width () - atomicLength) / 2, 0)) - { - return kpView::Top; - } - else if (LOCAL_POINT_IN_BOX_AT (0, (selViewRect.height () - atomicLength) / 2)) - { - return kpView::Left; - } - else - { - #if DEBUG_KP_VIEW - kDebug () << "\tnot on sel resize handle"; - #endif - return 0; - } -#undef LOCAL_POINT_IN_BOX_AT -} - -// public -bool kpView::mouseOnSelectionToSelectText (const QPoint &viewPoint) const -{ -#if DEBUG_KP_VIEW - kDebug () << "kpView::mouseOnSelectionToSelectText(viewPoint=" - << viewPoint << ")" << endl; -#endif - - if (!mouseOnSelection (viewPoint)) - { - #if DEBUG_KP_VIEW - kDebug () << "\tmouse non on sel"; - #endif - return false; - } - - if (!textSelection ()) - { - #if DEBUG_KP_VIEW - kDebug () << "\tsel not text"; - #endif - return false; - } - -#if DEBUG_KP_VIEW - kDebug () << "\tmouse on sel: to move=" << mouseOnSelectionToMove () - << " to resize=" << mouseOnSelectionResizeHandle () - << endl; -#endif - - return (!mouseOnSelectionToMove (viewPoint) && - !mouseOnSelectionResizeHandle (viewPoint)); -} diff --git a/kolourpaint/views/kpZoomedThumbnailView.cpp b/kolourpaint/views/kpZoomedThumbnailView.cpp deleted file mode 100644 index 3050c7e4..00000000 --- a/kolourpaint/views/kpZoomedThumbnailView.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_ZOOMED_THUMBNAIL_VIEW 0 - - -#include - -#include -#include - -#include -#include - - -kpZoomedThumbnailView::kpZoomedThumbnailView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent ) - - : kpThumbnailView (document, toolToolBar, viewManager, - buddyView, - scrollableContainer, - parent) -{ - // Call to virtual function - this is why the class is sealed - adjustToEnvironment (); -} - - -kpZoomedThumbnailView::~kpZoomedThumbnailView () -{ -} - - -// public virtual [base kpThumbnailView] -QString kpZoomedThumbnailView::caption () const -{ - return i18n ("%1% - Thumbnail", zoomLevelX ()); -} - - -// public slot virtual [base kpView] -void kpZoomedThumbnailView::adjustToEnvironment () -{ -#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW - kDebug () << "kpZoomedThumbnailView(" << name () - << ")::adjustToEnvironment()" - << " width=" << width () - << " height=" << height () - << endl; -#endif - - if (!document ()) - return; - -#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW - kDebug () << "\tdoc: width=" << document ()->width () - << " height=" << document ()->height () - << endl; -#endif - - if (document ()->width () <= 0 || document ()->height () <= 0) - { - kError () << "kpZoomedThumbnailView::adjustToEnvironment() doc:" - << " width=" << document ()->width () - << " height=" << document ()->height () - << endl; - return; - } - - - int hzoom = qMax (1, width () * 100 / document ()->width ()); - int vzoom = qMax (1, height () * 100 / document ()->height ()); - - // keep aspect ratio - if (hzoom < vzoom) - vzoom = hzoom; - else - hzoom = vzoom; - -#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW && 1 - kDebug () << "\tproposed zoom=" << hzoom; -#endif - if (hzoom > 100 || vzoom > 100) - { - #if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW && 1 - kDebug () << "\twon't magnify - setting zoom to 100%"; - #endif - hzoom = 100, vzoom = 100; - } - - - if (viewManager ()) - viewManager ()->setQueueUpdates (); - - { - setZoomLevel (hzoom, vzoom); - - setOrigin (QPoint ((width () - zoomedDocWidth ()) / 2, - (height () - zoomedDocHeight ()) / 2)); - setMaskToCoverDocument (); - - if (viewManager ()) - viewManager ()->updateView (this); - } - - if (viewManager ()) - viewManager ()->restoreQueueUpdates (); -} - - -#include "moc_kpZoomedThumbnailView.cpp" diff --git a/kolourpaint/views/kpZoomedThumbnailView.h b/kolourpaint/views/kpZoomedThumbnailView.h deleted file mode 100644 index 30f67bd4..00000000 --- a/kolourpaint/views/kpZoomedThumbnailView.h +++ /dev/null @@ -1,95 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_ZOOMED_THUMBNAIL_VIEW_H -#define KP_ZOOMED_THUMBNAIL_VIEW_H - - -#include - - -/** - * @short Zoomed thumbnail view of a document. - * - * This is a zoomed thumbnail view of a document. Unlike @ref kpZoomedView, - * it never resizes itself. Instead, it changes its zoom level to - * accommodate the display of entire document in the view, while - * maintaining aspect. - * - * Do not call setZoomLevel() nor setOrigin(). - * - * This class is sealed. Do not derive from it. - * - * @author Clarence Dang - */ -/*sealed*/ class kpZoomedThumbnailView : public kpThumbnailView -{ -Q_OBJECT - -public: - /** - * Constructs a zoomed thumbnail view. - */ - kpZoomedThumbnailView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent); - - /** - * Destructs a zoomed thumbnail view. - */ - virtual ~kpZoomedThumbnailView (); - - - /** - * Implements @ref kpThumbnailView. - */ - QString caption () const; - - -public slots: - /** - * Changes its zoom level to accommodate the display of entire document - * in the view. It maintains aspect by changing the origin and mask. - * - * Call this if the size of the document changes. - * Already called by @ref kpThumbnailView resizeEvent(). - * - * Implements @ref kpView. - */ - virtual void adjustToEnvironment (); - - -private: - struct kpZoomedThumbnailViewPrivate *d; -}; - - -#endif // KP_ZOOMED_THUMBNAIL_VIEW_H diff --git a/kolourpaint/views/kpZoomedView.cpp b/kolourpaint/views/kpZoomedView.cpp deleted file mode 100644 index 8bbcd0cf..00000000 --- a/kolourpaint/views/kpZoomedView.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_ZOOMED_VIEW 0 - - -#include - -#include - -#include -#include -#include - - -kpZoomedView::kpZoomedView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent) - - : kpView (document, toolToolBar, viewManager, - buddyView, - scrollableContainer, - parent) -{ - // Call to virtual function - this is why the class is sealed - adjustToEnvironment (); -} - -kpZoomedView::~kpZoomedView () -{ -} - - -// public virtual [base kpView] -void kpZoomedView::setZoomLevel (int hzoom, int vzoom) -{ -#if DEBUG_KP_ZOOMED_VIEW - kDebug () << "kpZoomedView(" << name () << ")::setZoomLevel(" - << hzoom << "," << vzoom << ")" << endl; -#endif - - if (viewManager ()) - viewManager ()->setQueueUpdates (); - - { - kpView::setZoomLevel (hzoom, vzoom); - - adjustToEnvironment (); - } - - if (viewManager ()) - viewManager ()->restoreQueueUpdates (); -} - - -// public slot virtual [base kpView] -void kpZoomedView::adjustToEnvironment () -{ -#if DEBUG_KP_ZOOMED_VIEW - kDebug () << "kpZoomedView(" << name () << ")::adjustToEnvironment()" - << " doc: width=" << document ()->width () - << " height=" << document ()->height () - << endl; -#endif - - if (document ()) - { - // TODO: use zoomedDocWidth() & zoomedDocHeight()? - resize ((int) transformDocToViewX (document ()->width ()), - (int) transformDocToViewY (document ()->height ())); - } -} - - -#include "moc_kpZoomedView.cpp" diff --git a/kolourpaint/views/kpZoomedView.h b/kolourpaint/views/kpZoomedView.h deleted file mode 100644 index 4bd9b307..00000000 --- a/kolourpaint/views/kpZoomedView.h +++ /dev/null @@ -1,96 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_ZOOMED_VIEW_H -#define KP_ZOOMED_VIEW_H - - -#include - - -/** - * @short Zoomed view of a document. Suitable as an ordinary editing view. - * - * This is a zoomed view of a document. It resizes according to the size - * of the document and the zoom level. Do not manually call resize() for - * this reason. - * - * It is suitable as an ordinary editing view. - * - * Do not call setOrigin(). REFACTOR: this is bad class design - derived classes should only add functionality - not remove - * - * This class is sealed. Do not derive from it. REFACTOR: this is also bad class design - * - * @author Clarence Dang - */ -/*sealed*/ class kpZoomedView : public kpView -{ -Q_OBJECT - -public: - /** - * Constructs a zoomed view. - */ - kpZoomedView (kpDocument *document, - kpToolToolBar *toolToolBar, - kpViewManager *viewManager, - kpView *buddyView, - kpViewScrollableContainer *scrollableContainer, - QWidget *parent); - - /** - * Destructs an unzoomed view. - */ - virtual ~kpZoomedView (); - - - /** - * Extends @kpView. Calls adjustToEnvironment(). - */ - virtual void setZoomLevel (int hzoom, int vzoom); - - -public slots: - /** - * Resizes itself so that the entire document in the zoom level fits - * almost perfectly. - * - * Call this if the size of the document changes. - * Already called by setZoomLevel(). - * - * Implements @ref kpView. - */ - virtual void adjustToEnvironment (); - - -private: - struct kpZoomedViewPrivate *d; -}; - - -#endif // KP_ZOOMED_VIEW_H diff --git a/kolourpaint/views/manager/kpViewManager.cpp b/kolourpaint/views/manager/kpViewManager.cpp deleted file mode 100644 index bdeb14a8..00000000 --- a/kolourpaint/views/manager/kpViewManager.cpp +++ /dev/null @@ -1,365 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW_MANAGER 0 - - -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpViewManager::kpViewManager (kpMainWindow *mainWindow) - : d (new kpViewManagerPrivate ()) -{ - Q_ASSERT (mainWindow); - - d->mainWindow = mainWindow; - - // d->views - d->viewUnderCursor = 0; - - // d->cursor - - d->tempImage = 0; - - d->selectionBorderVisible = false; - d->selectionBorderFinished = false; - - - d->textCursorBlinkTimer = 0; - - d->textCursorRow = -1; - d->textCursorCol = -1; - - d->textCursorBlinkState = true; - - - d->queueUpdatesCounter = d->fastUpdatesCounter = 0; - - d->inputMethodEnabled = false; -} - -//--------------------------------------------------------------------- - -kpViewManager::~kpViewManager () -{ - unregisterAllViews (); - - delete d->tempImage; - delete d; -} - -//--------------------------------------------------------------------- - -// private -kpDocument *kpViewManager::document () const -{ - return d->mainWindow->document (); -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::registerView (kpView *view) -{ -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::registerView (" << view << ")"; -#endif - Q_ASSERT (view); - Q_ASSERT (!d->views.contains (view)); - -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "\tadded view"; -#endif - view->setCursor (d->cursor); - d->views.append (view); -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::unregisterView (kpView *view) -{ - Q_ASSERT (view); - Q_ASSERT (d->views.contains (view)); - - if (view == d->viewUnderCursor) - d->viewUnderCursor = 0; - - view->unsetCursor (); - d->views.removeAll (view); -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::unregisterAllViews () -{ - d->views.clear (); -} - -//--------------------------------------------------------------------- - -// public -kpView *kpViewManager::viewUnderCursor (bool usingQt) const -{ - if (!usingQt) - { - Q_ASSERT (!d->viewUnderCursor || d->views.contains (d->viewUnderCursor)); - return d->viewUnderCursor; - } - else - { - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - if ((*it)->underMouse ()) - return (*it); - } - - return 0; - } -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::setViewUnderCursor (kpView *view) -{ -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::setViewUnderCursor (" - << (view ? view->objectName () : "(none)") << ")" - << " old=" << (d->viewUnderCursor ? d->viewUnderCursor->objectName () : "(none)") - << endl; -#endif - if (view == d->viewUnderCursor) - return; - - d->viewUnderCursor = view; - - if (d->viewUnderCursor) - d->viewUnderCursor->setAttribute (Qt::WA_InputMethodEnabled, d->inputMethodEnabled); - - if (!d->viewUnderCursor) - { - // Hide the brush if the mouse cursor just left the view. - if (d->tempImage && d->tempImage->isBrush ()) - { - #if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "\thiding brush pixmap since cursor left view"; - #endif - updateViews (d->tempImage->rect ()); - } - } - else - { - if (d->mainWindow->tool ()) - { - #if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "\tnotify tool that something changed below cursor"; - #endif - d->mainWindow->tool ()->somethingBelowTheCursorChanged (); - } - } -} - -//--------------------------------------------------------------------- - -// public -bool kpViewManager::hasAViewWithFocus () const -{ - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - if ((*it)->isActiveWindow ()) - return true; - } - - return false; -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::setCursor (const QCursor &cursor) -{ - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - (*it)->setCursor (cursor); - } - - d->cursor = cursor; -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::unsetCursor () -{ - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - (*it)->unsetCursor (); - } - - d->cursor = QCursor (); -} - -//--------------------------------------------------------------------- - -// public -const kpTempImage *kpViewManager::tempImage () const -{ - return d->tempImage; -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::setTempImage (const kpTempImage &tempImage) -{ -#if DEBUG_KP_VIEW_MANAGER - kDebug () << "kpViewManager::setTempImage(isBrush=" - << tempImage.isBrush () - << ",topLeft=" << tempImage.topLeft () - << ",image.rect=" << tempImage.image ().rect () - << ")" << endl; -#endif - - QRect oldRect; - - if (d->tempImage) - { - oldRect = d->tempImage->rect (); - delete d->tempImage; - d->tempImage = 0; - } - - d->tempImage = new kpTempImage (tempImage); - - setQueueUpdates (); - { - if (oldRect.isValid ()) - updateViews (oldRect); - updateViews (d->tempImage->rect ()); - } - restoreQueueUpdates (); -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::invalidateTempImage () -{ - if (!d->tempImage) - return; - - QRect oldRect = d->tempImage->rect (); - - delete d->tempImage; - d->tempImage = 0; - - updateViews (oldRect); -} - -//--------------------------------------------------------------------- - -// public -bool kpViewManager::selectionBorderVisible () const -{ - return d->selectionBorderVisible; -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::setSelectionBorderVisible (bool yes) -{ - if (d->selectionBorderVisible == yes) - return; - - d->selectionBorderVisible = yes; - - if (document ()->selection ()) - updateViews (document ()->selection ()->boundingRect ()); -} - -//--------------------------------------------------------------------- - -// public -bool kpViewManager::selectionBorderFinished () const -{ - return d->selectionBorderFinished; -} - -//--------------------------------------------------------------------- - -// public -void kpViewManager::setSelectionBorderFinished (bool yes) -{ - if (d->selectionBorderFinished == yes) - return; - - d->selectionBorderFinished = yes; - - if (document ()->selection ()) - updateViews (document ()->selection ()->boundingRect ()); -} - -//--------------------------------------------------------------------- - -void kpViewManager::setInputMethodEnabled (bool inputMethodEnabled) -{ - d->inputMethodEnabled = inputMethodEnabled; - if (d->viewUnderCursor) - d->viewUnderCursor->setAttribute (Qt::WA_InputMethodEnabled, inputMethodEnabled); -} - -//--------------------------------------------------------------------- - -#include "moc_kpViewManager.cpp" diff --git a/kolourpaint/views/manager/kpViewManager.h b/kolourpaint/views/manager/kpViewManager.h deleted file mode 100644 index 35187b9b..00000000 --- a/kolourpaint/views/manager/kpViewManager.h +++ /dev/null @@ -1,256 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_VIEW_MANAGER_H -#define KP_VIEW_MANAGER_H - - -#include - - -#include -#include -#include -#include - -class kpDocument; -class kpView; -class kpMainWindow; -class kpTempImage; - - -class kpViewManager : public QObject -{ -Q_OBJECT - -public: - kpViewManager (kpMainWindow *mainWindow); - ~kpViewManager (); - - -private: - kpDocument *document () const; - - -// -// Registering views -// - -public: - void registerView (kpView *view); - void unregisterView (kpView *view); - void unregisterAllViews (); - - -// -// View -// - -public: - kpView *viewUnderCursor (bool usingQt = false) const; - - // - // QWidget::hasMouse() is unreliable: - // - // "bool QWidget::hasMouse () const - // ... See the "underMouse" property for details. - // . - // . - // . - // bool underMouse - // ... This value is not updated properly during drag and drop operations." - // - // i.e. it's possible that hasMouse() returns false in a mousePressEvent()! - // - // This hack needs to be called from kpView so that viewUnderCursor() works - // as a reasonable replacement (although there is at least one case where - // it still won't work - just after a fake drag onto the view). - // - void setViewUnderCursor (kpView *view); - - -public: - // Returns whether at least 1 view has keyboard focus. - // A pointer is not returned to such a view because more than one can - // have focus at the same time (see QWidget::isActiveWindow()). - bool hasAViewWithFocus () const; - - -// -// Mouse Cursors -// - -public: - void setCursor (const QCursor &cursor); - void unsetCursor (); - - -// -// Temp Image -// - -public: - const kpTempImage *tempImage () const; - void setTempImage (const kpTempImage &tempImage); - void invalidateTempImage (); - - -// -// Selections -// - -public: - bool selectionBorderVisible () const; - void setSelectionBorderVisible (bool yes = true); - - bool selectionBorderFinished () const; - void setSelectionBorderFinished (bool yes = true); - - -// -// Text Cursor -// - -public: - // If you enable the text cursor, a timer will start ticking to update - // the text cursor. If no text selection is active, the update will - // be a NOP but the timer will still tick and textCursorEnabled() will - // still return true. - bool textCursorEnabled () const; - void setTextCursorEnabled (bool yes = true); - - bool textCursorBlinkState () const; - void setTextCursorBlinkState (bool on = true); - - // By convention, a text box with no content (i.e. no text lines) should - // have a cursor position of (row=0,col=0). Some code assumes this. - // - // (no error checking is performed - the row and col are as per - // setTextCursorPosition() so may be out of the bounds of the - // text selection) - int textCursorRow () const; - int textCursorCol () const; - // See kpToolText::beginDrawSelectText() for a correct use of this - // method, satisfying the above convention. - // - // WARNING: If the previous row and column are invalid (e.g. you just - // called kpTextSelection::setTextLines() such that the previous - // row and column now point outside the lines), this will not - // be able to erase the cursor at the old position. - // - // Always ensure that the text cursor position is valid. - // TODO: We need to check this in all source files. - // e.g. It's definitely wrong for kpToolTextBackspaceCommand. - void setTextCursorPosition (int row, int col); - - // Returns the document rectangle where cursor would be placed, using - // textCursorRow() and textCursorCol (). - // - // For a text selection without any content, this returns a rectangle - // corresponding to the first text row and column. - // - // If there is no text selection or textCursorRow() or - // textCursorCol() are invalid, it returns an empty rectangle. - QRect textCursorRect () const; - -protected: - // If textCursorRect() is valid, updates all views at that rectangle. - // The cursor blink state and timer are not affected at all. - // TODO: This and other methods will happily execute even if - // !textCursorEnabled(). We should fix this. - void updateTextCursor (); - -protected slots: - void slotTextCursorBlink (); - - -// -// View Updates -// - -public: - // Specifies whether to queue _all_ paint events - // (generated by you or the window system), until the - // corresponding call to restoreQueueUpdates(). Use this - // before multiple, big, non-interactive changes to the - // document to eliminate virtually all flicker. - // - // This is better than QWidget::setUpdatesEnabled() because - // restoreQueueUpdates() automatically restores, for each view, - // only the _regions_ that need to be repainted. - // - // You can nest blocks of setQueueUpdates()/restoreQueueUpdates(). - bool queueUpdates () const; - void setQueueUpdates (); - void restoreQueueUpdates (); - -public: - // Controls behaviour of updateViews(): - // - // Slow: Let Qt buffer paint events via QWidget::update(). - // Results in less flicker. Paint events are probably merged - // so long-term efficiency is increased at the expense of - // reduced responsiveness (default). Generally, the paint - // event happens a while later -- when you return to the event - // loop. - // Fast: Force Qt to redraw immediately. No paint events - // are merged so there is great potential for flicker, - // if used inappropriately. Use this when the redraw - // area is small and responsiveness is critical. - // Continual use of this mode can result in - // unnecessary redraws and incredibly slugish performance. - // - // You can nest blocks of setFastUpdates()/restoreFastUpdates(). - bool fastUpdates () const; - void setFastUpdates (); - void restoreFastUpdates (); - -public slots: - void updateView (kpView *v); - void updateView (kpView *v, const QRect &viewRect); - void updateView (kpView *v, int x, int y, int w, int h); - void updateView (kpView *v, const QRegion &viewRegion); - - void updateViewRectangleEdges (kpView *v, const QRect &viewRect); - - void updateViews (); - void updateViews (const QRect &docRect); - void updateViews (int x, int y, int w, int h); - -public slots: - void adjustViewsToEnvironment (); - -public slots: - void setInputMethodEnabled (bool inputMethodEnabled); - -private: - struct kpViewManagerPrivate * const d; -}; - - -#endif // KP_VIEW_MANAGER_H diff --git a/kolourpaint/views/manager/kpViewManagerPrivate.h b/kolourpaint/views/manager/kpViewManagerPrivate.h deleted file mode 100644 index 97e84a65..00000000 --- a/kolourpaint/views/manager/kpViewManagerPrivate.h +++ /dev/null @@ -1,86 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpViewManagerPrivate_H -#define kpViewManagerPrivate_H - - -#include -#include - - -class kpMainWindow; -class kpTempPixmap; -#include -class kpView; - - -struct kpViewManagerPrivate -{ - kpMainWindow *mainWindow; - - QLinkedList views; - kpView *viewUnderCursor; - - QCursor cursor; - - kpTempImage *tempImage; - - bool selectionBorderVisible; - bool selectionBorderFinished; - - - // - // Text Cursor - // - - // Exists only if the text cursor is enabled. 0 otherwise. - QTimer *textCursorBlinkTimer; - - // (undefined if there is not currently a text selection) - int textCursorRow, textCursorCol; - - // (undefined if there is not currently a text selection) - bool textCursorBlinkState; - - - // - // View Updates - // - - int queueUpdatesCounter, fastUpdatesCounter; - - // - // Input Method - // - - bool inputMethodEnabled; -}; - - -#endif // kpViewManagerPrivate_H diff --git a/kolourpaint/views/manager/kpViewManager_TextCursor.cpp b/kolourpaint/views/manager/kpViewManager_TextCursor.cpp deleted file mode 100644 index cefe014c..00000000 --- a/kolourpaint/views/manager/kpViewManager_TextCursor.cpp +++ /dev/null @@ -1,242 +0,0 @@ - -// TODO: This is bad design as it's easy to get out of sync with the selection. -// e.g. You could have textCursorEnabled() but no text selection or -// vice versa. And the cursor could be outside of the selection. -// -// In fact, our text commands momentarily violate these "invariants": -// -// 1. A text box with content must have the cursor somewhere on an -// existing text line, possibly 1 position after the last character -// on a line. -// -// 2. Special case: A content-less text box (i.e. no text lines) must -// have the cursor at (0,0). -// -// We don't assert-check them at the moment. We should when we fix -// the design so that the invariants are always maintained. - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2005 Kazuki Ohta - Copyright (c) 2010 Tasuku Suzuki - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW_MANAGER 0 - - -#include -#include - -#include -#include -#include -#ifndef QT_NO_IM -#include -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include - - -// public -bool kpViewManager::textCursorEnabled () const -{ - return (bool) d->textCursorBlinkTimer; -} - -// public -void kpViewManager::setTextCursorEnabled (bool yes) -{ -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::setTextCursorEnabled(" << yes << ")"; -#endif - - if (yes == textCursorEnabled ()) - return; - - delete d->textCursorBlinkTimer; - d->textCursorBlinkTimer = 0; - - setFastUpdates (); - setQueueUpdates (); - { - if (yes) - { - d->textCursorBlinkTimer = new QTimer (this); - d->textCursorBlinkTimer->setSingleShot (true); - connect (d->textCursorBlinkTimer, SIGNAL (timeout ()), - this, SLOT (slotTextCursorBlink ())); - - d->textCursorBlinkState = true; - slotTextCursorBlink (); - } - else - { - d->textCursorBlinkState = false; - updateTextCursor (); - } - } - restoreQueueUpdates (); - restoreFastUpdates (); -} - - -// public -bool kpViewManager::textCursorBlinkState () const -{ - return d->textCursorBlinkState; -} - -// public -void kpViewManager::setTextCursorBlinkState (bool on) -{ - if (on == d->textCursorBlinkState) - return; - - d->textCursorBlinkState = on; - - updateTextCursor (); -} - - -// public -int kpViewManager::textCursorRow () const -{ - return d->textCursorRow; -} - -// public -int kpViewManager::textCursorCol () const -{ - return d->textCursorCol; -} - -// public -void kpViewManager::setTextCursorPosition (int row, int col) -{ - if (row == d->textCursorRow && col == d->textCursorCol) - return; - - setFastUpdates (); - setQueueUpdates (); - { - // Clear the old cursor. - d->textCursorBlinkState = false; - updateTextCursor (); - - d->textCursorRow = row; - d->textCursorCol = col; - - // Render the new cursor. - d->textCursorBlinkState = true; - updateTextCursor (); - } - restoreQueueUpdates (); - restoreFastUpdates (); - -#ifndef QT_NO_IM - if (d->viewUnderCursor) { - QInputContext *inputContext = d->viewUnderCursor->inputContext (); - if (inputContext) { - inputContext->update (); - } - } -#endif -} - - -// public -QRect kpViewManager::textCursorRect () const -{ - kpTextSelection *textSel = document ()->textSelection (); - if (!textSel) - return QRect (); - - QPoint topLeft = textSel->pointForTextRowCol (d->textCursorRow, d->textCursorCol); - if (topLeft == KP_INVALID_POINT) - { - // Text cursor row/col hasn't been specified yet? - if (textSel->hasContent ()) - return QRect (); - - // Empty text box should still display a cursor so that the user - // knows where typed text will go. - topLeft = textSel->textAreaRect ().topLeft (); - } - - Q_ASSERT (topLeft != KP_INVALID_POINT); - - return QRect (topLeft.x (), topLeft.y (), - 1, textSel->textStyle ().fontMetrics ().height ()); -} - - -// protected -void kpViewManager::updateTextCursor () -{ -#if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "kpViewManager::updateTextCursor()"; -#endif - - const QRect r = textCursorRect (); - if (!r.isValid ()) - return; - - setFastUpdates (); - { - // If !textCursorEnabled(), this will clear. - updateViews (r); - } - restoreFastUpdates (); -} - -// protected slot -void kpViewManager::slotTextCursorBlink () -{ -#if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "kpViewManager::slotTextCursorBlink() cursorBlinkState=" - << d->textCursorBlinkState << endl; -#endif - - if (d->textCursorBlinkTimer) - { - // (single shot) - d->textCursorBlinkTimer->start (QApplication::cursorFlashTime () / 2); - } - - updateTextCursor (); - // TODO: Shouldn't this be done _before_ updating the text cursor - // because textCursorBlinkState() is supposed to reflect what - // updateTextCursor() just rendered, until the next timer tick? - d->textCursorBlinkState = !d->textCursorBlinkState; -} diff --git a/kolourpaint/views/manager/kpViewManager_ViewUpdates.cpp b/kolourpaint/views/manager/kpViewManager_ViewUpdates.cpp deleted file mode 100644 index 3504a456..00000000 --- a/kolourpaint/views/manager/kpViewManager_ViewUpdates.cpp +++ /dev/null @@ -1,268 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_VIEW_MANAGER 0 - - -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - - -// public slot -bool kpViewManager::queueUpdates () const -{ - return (d->queueUpdatesCounter > 0); -} - -// public slot -void kpViewManager::setQueueUpdates () -{ - d->queueUpdatesCounter++; -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::setQueueUpdates() counter=" - << d->queueUpdatesCounter << endl; -#endif -} - -// public slot -void kpViewManager::restoreQueueUpdates () -{ - d->queueUpdatesCounter--; -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::restoreQueueUpdates() counter=" - << d->queueUpdatesCounter << endl; -#endif - Q_ASSERT (d->queueUpdatesCounter >= 0); - - if (d->queueUpdatesCounter == 0) - { - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - (*it)->updateQueuedArea (); - } - } -} - - -// public slot -bool kpViewManager::fastUpdates () const -{ - return (d->fastUpdatesCounter > 0); -} - -// public slot -void kpViewManager::setFastUpdates () -{ - d->fastUpdatesCounter++; -#if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "kpViewManager::setFastUpdates() counter=" - << d->fastUpdatesCounter << endl; -#endif -} - -// public slot -void kpViewManager::restoreFastUpdates () -{ - d->fastUpdatesCounter--; -#if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "kpViewManager::restoreFastUpdates() counter=" - << d->fastUpdatesCounter << endl; -#endif - Q_ASSERT (d->fastUpdatesCounter >= 0); -} - - -// public slot -void kpViewManager::updateView (kpView *v) -{ - updateView (v, QRect (0, 0, v->width (), v->height ())); -} - -// public slot -void kpViewManager::updateView (kpView *v, const QRect &viewRect) -{ - if (!queueUpdates ()) - { - if (fastUpdates ()) - v->repaint (viewRect); - else - v->update (viewRect); - } - else - v->addToQueuedArea (viewRect); -} - -// public slot -void kpViewManager::updateView (kpView *v, int x, int y, int w, int h) -{ - updateView (v, QRect (x, y, w, h)); -} - -// public slot -void kpViewManager::updateView (kpView *v, const QRegion &viewRegion) -{ - if (!queueUpdates ()) - { - if (fastUpdates ()) - v->repaint (viewRegion); - else - v->update (viewRegion.boundingRect ()); - } - else - v->addToQueuedArea (viewRegion); -} - - -// public slot -void kpViewManager::updateViewRectangleEdges (kpView *v, const QRect &viewRect) -{ - if (viewRect.height () <= 0 || viewRect.width () <= 0) - return; - - // Top line - updateView (v, QRect (viewRect.x (), viewRect.y (), - viewRect.width (), 1)); - - if (viewRect.height () >= 2) - { - // Bottom line - updateView (v, QRect (viewRect.x (), viewRect.bottom (), - viewRect.width (), 1)); - - if (viewRect.height () > 2) - { - // Left line - updateView (v, QRect (viewRect.x (), viewRect.y () + 1, - 1, viewRect.height () - 2)); - - if (viewRect.width () >= 2) - { - // Right line - updateView (v, QRect (viewRect.right (), viewRect.y () + 1, - 1, viewRect.height () - 2)); - } - } - } -} - - -// public slot -void kpViewManager::updateViews () -{ - kpDocument *doc = document (); - if (doc) - updateViews (QRect (0, 0, doc->width (), doc->height ())); -} - -// public slot -void kpViewManager::updateViews (const QRect &docRect) -{ -#if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "kpViewManager::updateViews (" << docRect << ")"; -#endif - - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - kpView *view = *it; - - #if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "\tupdating view " << view->name (); - #endif - if (view->zoomLevelX () % 100 == 0 && view->zoomLevelY () % 100 == 0) - { - #if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "\t\tviewRect=" << view->transformDocToView (docRect); - #endif - updateView (view, view->transformDocToView (docRect)); - } - else - { - QRect viewRect = view->transformDocToView (docRect); - - int diff = qRound (double (qMax (view->zoomLevelX (), view->zoomLevelY ())) / 100.0) + 1; - - QRect newRect = QRect (viewRect.x () - diff, - viewRect.y () - diff, - viewRect.width () + 2 * diff, - viewRect.height () + 2 * diff) - .intersected (QRect (0, 0, view->width (), view->height ())); - - #if DEBUG_KP_VIEW_MANAGER && 0 - kDebug () << "\t\tviewRect (+compensate)=" << newRect; - #endif - updateView (view, newRect); - } - } -} - -// public slot -void kpViewManager::updateViews (int x, int y, int w, int h) -{ - updateViews (QRect (x, y, w, h)); -} - - -// public slot -void kpViewManager::adjustViewsToEnvironment () -{ -#if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "kpViewManager::adjustViewsToEnvironment()" - << " numViews=" << d->views.count () - << endl; -#endif - for (QLinkedList ::const_iterator it = d->views.begin (); - it != d->views.end (); - ++it) - { - kpView *view = *it; - - #if DEBUG_KP_VIEW_MANAGER && 1 - kDebug () << "\tview: " << view->name () - << endl; - #endif - view->adjustToEnvironment (); - } -} diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp deleted file mode 100644 index 123d8fef..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp +++ /dev/null @@ -1,234 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_SIMILARITY_CUBE 0 - - -#include - -#include - -#include -#include - -#include - -#include -#include - -//--------------------------------------------------------------------- - -static QColor Color (int redOrGreenOrBlue, - int baseBrightness, - double colorSimilarity, - int similarityDirection, - int highlight) -{ - int brightness = int (baseBrightness + - similarityDirection * - .5 * colorSimilarity * kpColorSimilarityHolder::ColorCubeDiagonalDistance); - - if (brightness < 0) - brightness = 0; - else if (brightness > 255) - brightness = 255; - - switch (redOrGreenOrBlue) - { - default: - case 0: return QColor (brightness, highlight, highlight); - case 1: return QColor (highlight, brightness, highlight); - case 2: return QColor (highlight, highlight, brightness); - } -} - -//--------------------------------------------------------------------- - -static QPointF PointBetween(const QPointF &p, const QPointF &q) -{ - return QPointF((p.x() + q.x()) / 2.0, (p.y() + q.y()) / 2.0); -} - -//--------------------------------------------------------------------- - -static void DrawQuadrant(QPaintDevice *target, - const QColor &col, - const QPointF &p1, const QPointF &p2, const QPointF &p3, - const QPointF &pointNotOnOutline) -{ - QPolygonF points (4); - points [0] = p1; - points [1] = p2; - points [2] = p3; - points [3] = pointNotOnOutline; - - QPainter p(target); - p.setRenderHints(QPainter::Antialiasing, true); - - // Polygon fill. - p.setPen(col); - p.setBrush(col); - p.drawPolygon(points); - - // do not draw a black border. It looks ugly -} - -//--------------------------------------------------------------------- - -static void DrawFace (QPaintDevice *target, - double colorSimilarity, - int redOrGreenOrBlue, - const QPointF &tl, const QPointF &tr, - const QPointF &bl, const QPointF &br, - int highlight) -{ -#if DEBUG_KP_COLOR_SIMILARITY_CUBE - kDebug () << "kpColorSimilarityCubeRenderer.cpp:DrawFace(RorGorB=" << redOrGreenOrBlue - << ",tl=" << tl - << ",tr=" << tr - << ",bl=" << bl - << ",br=" << br - << ")" - << endl; -#endif - - // tl --- tm --- tr - // | | | - // | | | - // ml --- mm --- mr - // | | | - // | | | - // bl --- bm --- br - - const QPointF tm (::PointBetween (tl, tr)); - const QPointF bm (::PointBetween (bl, br)); - - const QPointF ml (::PointBetween (tl, bl)); - const QPointF mr (::PointBetween (tr, br)); - const QPointF mm (::PointBetween (ml, mr)); - - - const int baseBrightness = - qMax (127, - 255 - int (kpColorSimilarityHolder::MaxColorSimilarity * - kpColorSimilarityHolder::ColorCubeDiagonalDistance / 2)); - QColor colors [2] = - { - ::Color (redOrGreenOrBlue, baseBrightness, colorSimilarity, -1, highlight), - ::Color (redOrGreenOrBlue, baseBrightness, colorSimilarity, +1, highlight) - }; - -#if DEBUG_KP_COLOR_SIMILARITY_CUBE - kDebug () << "\tmaxColorSimilarity=" << kpColorSimilarityHolder::MaxColorSimilarity - << " colorCubeDiagDist=" << kpColorSimilarityHolder::ColorCubeDiagonalDistance - << endl - << "\tbaseBrightness=" << baseBrightness - << " color[0]=" << ((colors [0].rgba() & RGB_MASK) >> ((2 - redOrGreenOrBlue) * 8)) - << " color[1]=" << ((colors [1].rgba() & RGB_MASK) >> ((2 - redOrGreenOrBlue) * 8)) - << endl; -#endif - - - ::DrawQuadrant(target, colors [0], tm, tl, ml, mm); - ::DrawQuadrant(target, colors [1], tm, tr, mr, mm); - ::DrawQuadrant(target, colors [1], ml, bl, bm, mm); - ::DrawQuadrant(target, colors [0], bm, br, mr, mm); -} - -//--------------------------------------------------------------------- - -// public static -void kpColorSimilarityCubeRenderer::Paint(QPaintDevice *target, - int x, int y, int cubeRectSize, - double colorSimilarity, - int highlight) -{ - Q_ASSERT (highlight >= 0 && highlight <= 255); - - // - // P------- Q --- --- - // / / | | | - // /A / | side | - // R-------S T --- cubeRectSize - // | | / / | - // S | | / side | - // U-------V --- --- - // |-------| - // side - // |-----------| - // cubeRectSize - // - // - - const double angle = KP_DEGREES_TO_RADIANS (45); - // S + S sin A = cubeRectSize - // (1 + sin A) x S = cubeRectSize - const double side = double(cubeRectSize) / (1.0 + sin(angle)); - - - const QPointF pointP(x + (side * cos (angle)), - y); - const QPointF pointQ(x + cubeRectSize - 1, - y); - const QPointF pointR(x, - y + (side * sin (angle))); - const QPointF pointS(x + (side), - y + (side * sin (angle))); - const QPointF pointT(x + cubeRectSize - 1, - y + (side)); - const QPointF pointU(x, - y + cubeRectSize - 1); - const QPointF pointV(x + (side), - y + cubeRectSize - 1); - - - // Top Face - ::DrawFace(target, - colorSimilarity, 0/*red*/, - pointP, pointQ, - pointR, pointS, - highlight); - - - // Front Face - ::DrawFace(target, - colorSimilarity, 1/*green*/, - pointR, pointS, - pointU, pointV, - highlight); - - - // Right Face - ::DrawFace(target, - colorSimilarity, 2/*blue*/, - pointS, pointQ, - pointV, pointT, - highlight); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.h b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.h deleted file mode 100644 index 639ce48f..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorSimilarityCubeRenderer_H -#define kpColorSimilarityCubeRenderer_H - - -#include - - -class kpColorSimilarityCubeRenderer -{ -public: - // is used for animations: - // - // 0 = no highlight - // . - // . - // . - // 255 = full highlight - - static void Paint(QPaintDevice *target, - int x, int y, int size, - double colorSimilarity, - int highlight = 0); -}; - - -#endif // kpColorSimilarityCubeRenderer_H diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.cpp b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.cpp deleted file mode 100644 index 727f02da..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_SIMILARITY_CUBE 0 - - -#include - -#include - -#include - -//--------------------------------------------------------------------- - -kpColorSimilarityFrame::kpColorSimilarityFrame(QWidget *parent) - : QWidget(parent) -{ - setWhatsThis (WhatsThis ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpColorSimilarityHolder] -void kpColorSimilarityFrame::setColorSimilarity (double similarity) -{ - kpColorSimilarityHolder::setColorSimilarity (similarity); - - repaint (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -QSize kpColorSimilarityFrame::sizeHint () const -{ - return QSize (52, 52); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpColorSimilarityFrame::paintEvent (QPaintEvent *) -{ - int cubeRectSize = qMin(width() * 6 / 8, height() * 6 / 8); - int x = (width() - cubeRectSize) / 2; - int y = (height() - cubeRectSize) / 2; - - kpColorSimilarityCubeRenderer::Paint(this, - x, y, cubeRectSize, - colorSimilarity()); -} - -//--------------------------------------------------------------------- diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.h b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.h deleted file mode 100644 index cbeec8d1..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityFrame.h +++ /dev/null @@ -1,52 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorSimilarityFrame_H -#define kpColorSimilarityFrame_H - - -#include - -#include - - -class kpColorSimilarityFrame : public QWidget, public kpColorSimilarityHolder -{ -public: - kpColorSimilarityFrame(QWidget *parent); - - virtual void setColorSimilarity (double similarity); - - virtual QSize sizeHint () const; - -protected: - virtual void paintEvent (QPaintEvent *e); -}; - - -#endif // kpColorSimilarityFrame_H diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.cpp b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.cpp deleted file mode 100644 index c32051d7..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.cpp +++ /dev/null @@ -1,189 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_SIMILARITY_CUBE 0 - - -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - - -// public static -const double kpColorSimilarityHolder::ColorCubeDiagonalDistance = - sqrt ((double)255 * 255 * 3); - -// public static -const double kpColorSimilarityHolder::MaxColorSimilarity = .30; - - -kpColorSimilarityHolder::kpColorSimilarityHolder () - : m_colorSimilarity (0) -{ -} - -kpColorSimilarityHolder::~kpColorSimilarityHolder () -{ -} - - -// Don't cause the translators grief by appending strings etc. -// - duplicate text with 2 cases - -// public static -QString kpColorSimilarityHolder::WhatsThisWithClickInstructions () -{ - return i18n ("" - "

Color Similarity is how similar the colors of different pixels" - " must be, for operations to consider them to be the same.

" - - "

If you set it to something other than Exact Match," - " you can work more effectively with dithered" - " images and photos, in a comparable manner to the \"Magic Wand\"" - " feature of other paint programs.

" - - "

This feature applies to:

" - - "
    " - - "
  • Selections: In Transparent mode, any color in the" - " selection that is similar to the background color will" - " be made transparent.
  • " - - "
  • Flood Fill: For regions with similar - but not" - " identical - colored pixels, a higher setting is likely to" - " fill more pixels.
  • " - - "
  • Color Eraser: Any pixel whose color is similar" - " to the foreground color will be replaced with the background" - " color.
  • " - - "
  • Autocrop and Remove Internal Border: For" - " borders with similar - but not identical - colored pixels," - " a higher setting is more likely to crop the whole border.
  • " - - "
" - - "

Higher settings mean that operations consider an increased range" - " of colors to be sufficiently similar so as to be the same. Therefore," - " you should increase the setting if the above operations are not" - " affecting pixels whose colors you consider to be similar enough.

" - - "

However, if they are having too much of an effect and are changing" - " pixels whose colors you do not consider to be similar" - " (e.g. if Flood Fill is changing too many pixels), you" - " should decrease this setting.

" - - // sync: Compared to the other string below, we've added this line. - "

To configure it, click on the cube.

" - - "
"); -} - -// public static -QString kpColorSimilarityHolder::WhatsThis () -{ - return i18n ("" - "

Color Similarity is how similar the colors of different pixels" - " must be, for operations to consider them to be the same.

" - - "

If you set it to something other than Exact Match," - " you can work more effectively with dithered" - " images and photos, in a comparable manner to the \"Magic Wand\"" - " feature of other paint programs.

" - - "

This feature applies to:

" - - "
    " - - "
  • Selections: In Transparent mode, any color in the" - " selection that is similar to the background color will" - " be made transparent.
  • " - - "
  • Flood Fill: For regions with similar - but not" - " identical - colored pixels, a higher setting is likely to" - " fill more pixels.
  • " - - "
  • Color Eraser: Any pixel whose color is similar" - " to the foreground color will be replaced with the background" - " color.
  • " - - "
  • Autocrop and Remove Internal Border: For" - " borders with similar - but not identical - colored pixels," - " a higher setting is more likely to crop the whole border.
  • " - - "
" - - "

Higher settings mean that operations consider an increased range" - " of colors to be sufficiently similar so as to be the same. Therefore," - " you should increase the setting if the above operations are not" - " affecting pixels whose colors you consider to be similar enough.

" - - "

However, if they are having too much of an effect and are changing" - " pixels whose colors you do not consider to be similar" - " (e.g. if Flood Fill is changing too many pixels), you" - " should decrease this setting.

" - - "
"); -} - - -// public -double kpColorSimilarityHolder::colorSimilarity () const -{ - return m_colorSimilarity; -} - -// public virtual -void kpColorSimilarityHolder::setColorSimilarity (double similarity) -{ -#if DEBUG_KP_COLOR_SIMILARITY_CUBE - kDebug () << "kpColorSimilarityHolder::setColorSimilarity(" << similarity << ")"; -#endif - - if (m_colorSimilarity == similarity) - return; - - if (similarity < 0) - similarity = 0; - else if (similarity > MaxColorSimilarity) - similarity = MaxColorSimilarity; - - m_colorSimilarity = similarity; -} diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.h b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.h deleted file mode 100644 index 29c1446e..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityHolder.h +++ /dev/null @@ -1,65 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorSimilarityHolder_H -#define kpColorSimilarityHolder_H - - -#include - - -class kpColorSimilarityHolder -{ -public: - kpColorSimilarityHolder (); - virtual ~kpColorSimilarityHolder (); - - static const double ColorCubeDiagonalDistance; - static const double MaxColorSimilarity; - - static QString WhatsThisWithClickInstructions (); - static QString WhatsThis (); - - double colorSimilarity () const; - - // This automatically restricts the given to the range - // 0 .. MaxColorSimilarity inclusive. - // - // Override this if you need to act on mutations. - // Remember to call this base implementation though. - // - // WARNING: The base constructor does not call this as virtual method - // calls in constructors do not invoke overrides anyway. - virtual void setColorSimilarity (double similarity); - -private: - double m_colorSimilarity; -}; - - -#endif // kpColorSimilarityHolder_H diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.cpp b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.cpp deleted file mode 100644 index 2618759c..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.cpp +++ /dev/null @@ -1,282 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM 0 - - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpColorSimilarityToolBarItem::kpColorSimilarityToolBarItem (QWidget *parent) - : QToolButton (parent), - kpColorSimilarityHolder (), - - m_oldColorSimilarity (0), - m_processedColorSimilarity (kpColor::Exact), - m_flashTimer (new QTimer (this)), - m_flashHighlight (0), - m_suppressingFlashCounter (0) -{ - setAutoRaise (true); - setFixedSize (52, 52); - - setWhatsThis (WhatsThisWithClickInstructions ()); - - connect (this, SIGNAL (clicked ()), SLOT (openDialog ())); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - setColorSimilarityInternal (cfg.readEntry (kpSettingColorSimilarity, 0.0), - false/*don't write config*/); - - m_flashTimer->setInterval (100/*ms*/); - connect (m_flashTimer, SIGNAL (timeout ()), - SLOT (slotFlashTimerTimeout ())); -} - -//--------------------------------------------------------------------- - -// public -int kpColorSimilarityToolBarItem::processedColorSimilarity () const -{ - return m_processedColorSimilarity; -} - -//--------------------------------------------------------------------- - -// private -void kpColorSimilarityToolBarItem::setColorSimilarityInternal (double similarity, - bool writeConfig) -{ -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::setColorSimilarityInternal(" - << "similarity=" << similarity << ",writeConfig=" << writeConfig - << ")" << endl; -#endif - - m_oldColorSimilarity = colorSimilarity (); - - kpColorSimilarityHolder::setColorSimilarity (similarity); - m_processedColorSimilarity = kpColor::processSimilarity (colorSimilarity ()); - - updateIcon (); - updateToolTip (); - - if (writeConfig) - { - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral); - cfg.writeEntry (kpSettingColorSimilarity, colorSimilarity ()); - cfg.sync (); - } - - emit colorSimilarityChanged (colorSimilarity (), m_processedColorSimilarity); -} - -//--------------------------------------------------------------------- - -// public virtual [base kopColorSimilarityHolder] -void kpColorSimilarityToolBarItem::setColorSimilarity (double similarity) -{ - // (this calls the base setColorSimilarity() as required by base) - setColorSimilarityInternal (similarity, true/*write config*/); -} - -//--------------------------------------------------------------------- - -// public -double kpColorSimilarityToolBarItem::oldColorSimilarity () const -{ - return m_oldColorSimilarity; -} - -//--------------------------------------------------------------------- - -// public -void kpColorSimilarityToolBarItem::openDialog () -{ - kpColorSimilarityDialog dialog (this); - dialog.setColorSimilarity (colorSimilarity ()); - if (dialog.exec ()) - { - setColorSimilarity (dialog.colorSimilarity ()); - } -} - -//--------------------------------------------------------------------- - -// private slot: -void kpColorSimilarityToolBarItem::slotFlashTimerTimeout () -{ -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::slotFlashTimerTimeout()" - << " highlight=" << m_flashHighlight << endl; -#endif - int newHigh = m_flashHighlight - 20; - if (newHigh < 0) - newHigh = 0; - - m_flashHighlight = newHigh; - - updateIcon (); - - if (newHigh == 0) - m_flashTimer->stop (); -} - -//--------------------------------------------------------------------- - -// public -void kpColorSimilarityToolBarItem::flash () -{ -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::flash()"; -#endif - if (isSuppressingFlash ()) - return; - - if (m_flashHighlight == 255) - { - #if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "\tNOP"; - #endif - } - else - { - m_flashHighlight = 255; - - updateIcon (); - } - - m_flashTimer->start (); -} - -//--------------------------------------------------------------------- - -// public -bool kpColorSimilarityToolBarItem::isSuppressingFlash () const -{ - return (m_suppressingFlashCounter > 0); -} - -//--------------------------------------------------------------------- - -// public -void kpColorSimilarityToolBarItem::suppressFlash () -{ - m_suppressingFlashCounter++; -} - -//--------------------------------------------------------------------- - -// public -void kpColorSimilarityToolBarItem::unsupressFlash () -{ - m_suppressingFlashCounter--; - Q_ASSERT (m_suppressingFlashCounter >= 0); -} - -//--------------------------------------------------------------------- - -// private -void kpColorSimilarityToolBarItem::updateToolTip () -{ -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::updateToolTip()"; -#endif - - if (colorSimilarity () > 0) - { - setToolTip ( - i18n ("

Color Similarity: %1%

" - "

Click to configure.

", - qRound (colorSimilarity () * 100))); - } - else - { - setToolTip ( - i18n ("

Color Similarity: Exact Match

" - "

Click to configure.

")); - } -} - -//--------------------------------------------------------------------- - -// private -// LOOPT: This gets called twice on KolourPaint startup by: -// -// 1. setColorSimilarityInternal() called by the ctor -// 2. resizeEvent() when it's first shown() -// -// We could get rid of the first and save a few milliseconds. -void kpColorSimilarityToolBarItem::updateIcon () -{ - const int side = width () * 6 / 8; -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::updateIcon() width=" << width () - << " side=" << side << endl; -#endif - - QPixmap icon(side, side); - icon.fill(Qt::transparent); - - kpColorSimilarityCubeRenderer::Paint (&icon, - 0/*x*/, 0/*y*/, side, - colorSimilarity (), m_flashHighlight); - - setIconSize(QSize(side, side)); - setIcon(icon); -} - -//--------------------------------------------------------------------- - -// private virtual [base QWidget] -void kpColorSimilarityToolBarItem::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM - kDebug () << "kpColorSimilarityToolBarItem::resizeEvent() size=" << size () - << " oldSize=" << e->oldSize () << endl; -#endif - QToolButton::resizeEvent (e); - - updateIcon (); -} - -//--------------------------------------------------------------------- - -#include "moc_kpColorSimilarityToolBarItem.cpp" diff --git a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.h b/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.h deleted file mode 100644 index 018bcc0b..00000000 --- a/kolourpaint/widgets/colorSimilarity/kpColorSimilarityToolBarItem.h +++ /dev/null @@ -1,106 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorSimilarityToolBarItem_H -#define kpColorSimilarityToolBarItem_H - - -#include - -#include - - -#include -#include -#include - - -class kpColorSimilarityToolBarItem : public QToolButton, - public kpColorSimilarityHolder -{ -Q_OBJECT - -public: - // (reads the color similarity config setting) - kpColorSimilarityToolBarItem (QWidget *parent); - - int processedColorSimilarity () const; - -private: - // specifies whether to write the color similarity config - // setting. - void setColorSimilarityInternal (double similarity, bool writeConfig); -public: - virtual void setColorSimilarity (double similarity); - -signals: - void colorSimilarityChanged (double similarity, int processedSimilarity); - -public: - // (only valid in slots connected to colorSimilarityChanged()); - double oldColorSimilarity () const; - - -public slots: - // Open configuration dialog for color similarity. - void openDialog (); - -private slots: - void slotFlashTimerTimeout (); - -public: - // Animates the cube, so that the user is aware of its existence. - // Call this whenever a tool or command uses color similarity. - void flash (); - -public: - // Whether to ignore calls to flash(). - // You can nest blocks of suppressFlash()/unsuppressFlash(). - bool isSuppressingFlash () const; - void suppressFlash (); - void unsupressFlash (); - - -private: - void updateToolTip (); - void updateIcon (); - - virtual void resizeEvent (QResizeEvent *e); - - -private: - double m_oldColorSimilarity; - int m_processedColorSimilarity; - - QTimer *m_flashTimer; - int m_flashHighlight; - int m_suppressingFlashCounter; -}; - - -#endif // kpColorSimilarityToolBarItem_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.cpp deleted file mode 100644 index a2bbe275..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.cpp +++ /dev/null @@ -1,325 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BALANCE 0 - - -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - - -#if DEBUG_KP_EFFECT_BALANCE - #include -#endif - - -kpEffectBalanceWidget::kpEffectBalanceWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QGridLayout *lay = new QGridLayout (this); - lay->setMargin (marginHint ()); - lay->setSpacing (spacingHint ()); - - - QLabel *brightnessLabel = new QLabel (i18n ("&Brightness:"), this); - m_brightnessInput = new KIntNumInput (0/*value*/, this); - m_brightnessInput->setRange (-50, 50); - m_brightnessInput->setSliderEnabled(); - QPushButton *brightnessResetPushButton = new QPushButton (i18n ("Re&set"), this); - - QLabel *contrastLabel = new QLabel (i18n ("Co&ntrast:"), this); - m_contrastInput = new KIntNumInput (0/*value*/, this); - m_contrastInput->setRange (-50, 50); - m_contrastInput->setSliderEnabled(); - QPushButton *contrastResetPushButton = new QPushButton (i18n ("&Reset"), this); - - QLabel *gammaLabel = new QLabel (i18n ("&Gamma:"), this); - m_gammaInput = new KIntNumInput (0/*value*/, this); - m_gammaInput->setRange (-50, 50); - m_gammaInput->setSliderEnabled(); - // TODO: This is what should be shown in the m_gammaInput spinbox - m_gammaLabel = new QLabel (this); - // TODO: This doesn't seem to be wide enough with some fonts so the - // whole layout moves when we drag the gamma slider. - m_gammaLabel->setMinimumWidth (m_gammaLabel->fontMetrics ().width (QLatin1String (" 10.00 "))); - m_gammaLabel->setAlignment (m_gammaLabel->alignment () | Qt::AlignRight); - QPushButton *gammaResetPushButton = new QPushButton (i18n ("Rese&t"), this); - - - QWidget *spaceWidget = new QLabel (this); - spaceWidget->setFixedSize (1, spacingHint ()); - - - QLabel *channelLabel = new QLabel (i18n ("C&hannels:"), this); - m_channelsComboBox = new KComboBox (this); - m_channelsComboBox->addItem (i18n ("All")); - m_channelsComboBox->addItem (i18n ("Red")); - m_channelsComboBox->addItem (i18n ("Green")); - m_channelsComboBox->addItem (i18n ("Blue")); - - - QPushButton *resetPushButton = new QPushButton (i18n ("Reset &All Values"), this); - - - brightnessLabel->setBuddy (m_brightnessInput); - contrastLabel->setBuddy (m_contrastInput); - gammaLabel->setBuddy (m_gammaInput); - - channelLabel->setBuddy (m_channelsComboBox); - - - lay->addWidget (brightnessLabel, 0, 0); - lay->addWidget (m_brightnessInput, 0, 1, 1, 2); - lay->addWidget (brightnessResetPushButton, 0, 4); - - lay->addWidget (contrastLabel, 1, 0); - lay->addWidget (m_contrastInput, 1, 1, 1, 2); - lay->addWidget (contrastResetPushButton, 1, 4); - - lay->addWidget (gammaLabel, 2, 0); - lay->addWidget (m_gammaInput, 2, 1, 1, 2); - lay->addWidget (m_gammaLabel, 2, 3); - lay->addWidget (gammaResetPushButton, 2, 4); - - lay->addWidget (spaceWidget, 3, 0, 1, 5); - lay->addWidget (resetPushButton, 4, 2, 1, 3, Qt::AlignRight); - - lay->addWidget (channelLabel, 4, 0); - lay->addWidget (m_channelsComboBox, 4, 1, Qt::AlignLeft); - //lay->addWidget (resetPushButton, 4, 2, Qt::AlignRight); - - lay->setColumnStretch (1, 1); - - - // (no need for settingsChangedDelayed() since BCG effect is so fast :)) - connect (m_brightnessInput, SIGNAL (valueChanged (int)), - this, SIGNAL (settingsChangedNoWaitCursor ())); - connect (m_contrastInput, SIGNAL (valueChanged (int)), - this, SIGNAL (settingsChangedNoWaitCursor ())); - - connect (m_gammaInput, SIGNAL (valueChanged (int)), - this, SLOT (recalculateGammaLabel ())); - connect (m_gammaInput, SIGNAL (valueChanged (int)), - this, SIGNAL (settingsChangedNoWaitCursor ())); - - connect (m_channelsComboBox, SIGNAL (activated (int)), - this, SIGNAL (settingsChanged ())); - - connect (brightnessResetPushButton, SIGNAL (clicked ()), - this, SLOT (resetBrightness ())); - connect (contrastResetPushButton, SIGNAL (clicked ()), - this, SLOT (resetContrast ())); - connect (gammaResetPushButton, SIGNAL (clicked ()), - this, SLOT (resetGamma ())); - - connect (resetPushButton, SIGNAL (clicked ()), - this, SLOT (resetAll ())); - - - recalculateGammaLabel (); -} - -kpEffectBalanceWidget::~kpEffectBalanceWidget () -{ -} - - -// public virtual [base kpEffectWidgetBase] -QString kpEffectBalanceWidget::caption () const -{ - return i18n ("Settings"); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectBalanceWidget::isNoOp () const -{ - return (brightness () == 0 && contrast () == 0 && gamma () == 0); -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectBalanceWidget::applyEffect (const kpImage &image) -{ - return kpEffectBalance::applyEffect (image, - channels (), brightness (), contrast (), gamma ()); -} - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectBalanceWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectBalanceCommand (channels (), - brightness (), contrast (), gamma (), - m_actOnSelection, - cmdEnviron); -} - - -// protected -int kpEffectBalanceWidget::channels () const -{ - switch (m_channelsComboBox->currentIndex ()) - { - default: - case 0: - return kpEffectBalance::RGB; - - case 1: - return kpEffectBalance::Red; - - case 2: - return kpEffectBalance::Green; - - case 3: - return kpEffectBalance::Blue; - } -} - - -// protected -int kpEffectBalanceWidget::brightness () const -{ - return m_brightnessInput->value (); -} - -// protected -int kpEffectBalanceWidget::contrast () const -{ - return m_contrastInput->value (); -} - -// protected -int kpEffectBalanceWidget::gamma () const -{ - return m_gammaInput->value (); -} - - -// protected slot -void kpEffectBalanceWidget::recalculateGammaLabel () -{ - m_gammaLabel->setText ( - QLatin1String (" ") + - QString::number (pow (10, gamma () / 50.0), - 'f'/*[-]9.9*/, - 2/*precision*/) + - QLatin1String (" ")); - m_gammaLabel->repaint (); -} - - -// protected slot -void kpEffectBalanceWidget::resetBrightness () -{ - if (brightness () == 0) - return; - - bool sb = signalsBlocked (); - - if (!sb) blockSignals (true); - m_brightnessInput->setValue (0); - if (!sb) blockSignals (false); - - // Immediate update (if signals aren't blocked) - emit settingsChanged (); -} - -// protected slot -void kpEffectBalanceWidget::resetContrast () -{ - if (contrast () == 0) - return; - - bool sb = signalsBlocked (); - - if (!sb) blockSignals (true); - m_contrastInput->setValue (0); - if (!sb) blockSignals (false); - - // Immediate update (if signals aren't blocked) - emit settingsChanged (); -} - -// protected slot -void kpEffectBalanceWidget::resetGamma () -{ - if (gamma () == 0) - return; - - bool sb = signalsBlocked (); - - if (!sb) blockSignals (true); - m_gammaInput->setValue (0); - recalculateGammaLabel (); - if (!sb) blockSignals (false); - - // Immediate update (if signals aren't blocked) - emit settingsChanged (); -} - - -// protected slot -void kpEffectBalanceWidget::resetAll () -{ - if (isNoOp ()) - return; - - // Prevent multiple settingsChanged() which would normally result in - // redundant, expensive preview repaints - blockSignals (true); - - resetBrightness (); - resetContrast (); - resetGamma (); - - recalculateGammaLabel (); - - blockSignals (false); - - emit settingsChanged (); -} - - -#include "moc_kpEffectBalanceWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.h deleted file mode 100644 index 0236e8e6..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectBalanceWidget.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBalanceWidget_H -#define kpEffectBalanceWidget_H - - -#include -#include - - -#include - -class KComboBox; -class KIntNumInput; - - - -class kpEffectBalanceWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectBalanceWidget (bool actOnSelection, QWidget *parent); - virtual ~kpEffectBalanceWidget (); - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected: - int channels () const; - - int brightness () const; - int contrast () const; - int gamma () const; - -protected slots: - void recalculateGammaLabel (); - - void resetBrightness (); - void resetContrast (); - void resetGamma (); - - void resetAll (); - -protected: - KIntNumInput *m_brightnessInput, - *m_contrastInput, - *m_gammaInput; - QLabel *m_gammaLabel; - KComboBox *m_channelsComboBox; -}; - - -#endif // kpEffectBalanceWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.cpp deleted file mode 100644 index 1a97d243..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.cpp +++ /dev/null @@ -1,185 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_BLUR_SHARPEN 0 - - -#include - -#include -#include - -#include -#include -#include - -#include - - -kpEffectBlurSharpenWidget::kpEffectBlurSharpenWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QGridLayout *lay = new QGridLayout (this); - lay->setSpacing (spacingHint ()); - lay->setMargin (marginHint ()); - - - QLabel *amountLabel = new QLabel (i18n ("&Amount:"), this); - m_amountInput = new KIntNumInput (this); - m_amountInput->setRange (-kpEffectBlurSharpen::MaxStrength/*- for blur*/, - +kpEffectBlurSharpen::MaxStrength/*+ for sharpen*/); - - m_typeLabel = new QLabel (this); - - // Make sure doesn't expand when the effect type changes, - // as otherwise, that would cause the preview pixmap label in the - // "More Effects" dialog (which our widget is inside) to contract, - // which would look a bit weird. - // - // We do this by setting the label to every possible string it could - // contain and fixing its height to the maximum seen size hint height. - - int h = m_typeLabel->sizeHint ().height (); -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "initial size hint height=" << h; -#endif - - m_typeLabel->setText ( - kpEffectBlurSharpenCommand::nameForType (kpEffectBlurSharpen::Blur)); - h = qMax (h, m_typeLabel->sizeHint ().height ()); - - m_typeLabel->setText ( - kpEffectBlurSharpenCommand::nameForType (kpEffectBlurSharpen::Sharpen)); - h = qMax (h, m_typeLabel->sizeHint ().height ()); - - // Set this text last as the label's text needs to reflect the default - // effect of "None". - m_typeLabel->setText ( - kpEffectBlurSharpenCommand::nameForType (kpEffectBlurSharpen::None)); - h = qMax (h, m_typeLabel->sizeHint ().height ()); - -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "maximum size hint height" << h; -#endif - m_typeLabel->setFixedHeight (h); - m_typeLabel->setAlignment (Qt::AlignCenter); - - - amountLabel->setBuddy (m_amountInput); - - - lay->addWidget (amountLabel, 0, 0); - lay->addWidget (m_amountInput, 0, 1); - - lay->addWidget (m_typeLabel, 1, 0, 1, 2, Qt::AlignCenter); - - lay->setColumnStretch (1, 1); - - - connect (m_amountInput, SIGNAL (valueChanged (int)), - this, SIGNAL (settingsChangedDelayed ())); - - connect (m_amountInput, SIGNAL (valueChanged (int)), - this, SLOT (slotUpdateTypeLabel ())); -} - -kpEffectBlurSharpenWidget::~kpEffectBlurSharpenWidget () -{ -} - - -// public virtual [base kpEffectWidgetBase] -QString kpEffectBlurSharpenWidget::caption () const -{ - return QString(); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectBlurSharpenWidget::isNoOp () const -{ - return (type () == kpEffectBlurSharpen::None); -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectBlurSharpenWidget::applyEffect (const kpImage &image) -{ - return kpEffectBlurSharpen::applyEffect (image, - type (), strength ()); -} - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectBlurSharpenWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectBlurSharpenCommand (type (), strength (), - m_actOnSelection, - cmdEnviron); -} - - -// protected slot -void kpEffectBlurSharpenWidget::slotUpdateTypeLabel () -{ - QString text = kpEffectBlurSharpenCommand::nameForType (type ()); - -#if DEBUG_KP_EFFECT_BLUR_SHARPEN - kDebug () << "kpEffectBlurSharpenWidget::slotUpdateTypeLabel() text=" - << text << endl; -#endif - const int h = m_typeLabel->height (); - m_typeLabel->setText (text); - if (m_typeLabel->height () != h) - { - kError () << "Label changed height despite the hack in ctor:" - << "was=" << h - << "now=" << m_typeLabel->height (); - } -} - - -// protected -kpEffectBlurSharpen::Type kpEffectBlurSharpenWidget::type () const -{ - if (m_amountInput->value () == 0) - return kpEffectBlurSharpen::None; - else if (m_amountInput->value () < 0) - return kpEffectBlurSharpen::Blur; - else - return kpEffectBlurSharpen::Sharpen; -} - -// protected -int kpEffectBlurSharpenWidget::strength () const -{ - return qAbs (m_amountInput->value ()); -} - - -#include "moc_kpEffectBlurSharpenWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.h deleted file mode 100644 index 896f66f0..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectBlurSharpenWidget.h +++ /dev/null @@ -1,72 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectBlurSharpenWidget_H -#define kpEffectBlurSharpenWidget_H - - -#include - -#include -#include - - -#include - -class KIntNumInput; - - -class kpEffectBlurSharpenWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectBlurSharpenWidget (bool actOnSelection, QWidget *parent); - virtual ~kpEffectBlurSharpenWidget (); - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected slots: - void slotUpdateTypeLabel (); - -protected: - kpEffectBlurSharpen::Type type () const; - int strength () const; - - KIntNumInput *m_amountInput; - QLabel *m_typeLabel; -}; - - -#endif // kpEffectBlurSharpenWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.cpp deleted file mode 100644 index de91a313..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.cpp +++ /dev/null @@ -1,131 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_EMBOSS 0 - - -#include - -#include -#include - -#include -#include - -#include -#include - - -kpEffectEmbossWidget::kpEffectEmbossWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QGridLayout *lay = new QGridLayout (this); - lay->setSpacing (spacingHint ()); - lay->setMargin (marginHint ()); - - -#if 0 - QLabel *amountLabel = new QLabel (i18n ("&Amount:"), this); - m_amountInput = new KIntNumInput (this); - m_amountInput->setRange (kpEffectEmboss::MinStrength, - kpEffectEmboss::MaxStrength, 1/*step*/, true/*slider*/); - m_amountInput->setSpecialValueText (i18n ("None")); - - - amountLabel->setBuddy (m_amountInput); - - - lay->addWidget (amountLabel, 0, 0); - lay->addWidget (m_amountInput, 0, 1); - - lay->setColumnStretch (1, 1); - - - connect (m_amountInput, SIGNAL (valueChanged (int)), - this, SIGNAL (settingsChanged ())); -#endif - - m_enableCheckBox = new QCheckBox (i18n ("E&nable"), this); - - - lay->addWidget (m_enableCheckBox, 0, 0, 1, 2, Qt::AlignCenter); - - - // (settingsChangedDelayed() instead of settingsChanged() so that the - // user can quickly press OK to apply effect to document directly and - // not have to wait for the also slow preview) - connect (m_enableCheckBox, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChangedDelayed ())); -} - -kpEffectEmbossWidget::~kpEffectEmbossWidget () -{ -} - - -// public virtual [base kpEffectWidgetBase] -QString kpEffectEmbossWidget::caption () const -{ - return QString(); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectEmbossWidget::isNoOp () const -{ - //return (m_amountInput->value () == 0); - return !m_enableCheckBox->isChecked (); -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectEmbossWidget::applyEffect (const kpImage &image) -{ - if (isNoOp ()) - return image; - - return kpEffectEmboss::applyEffect (image, strength ()); -} - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectEmbossWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectEmbossCommand (strength (), - m_actOnSelection, - cmdEnviron); -} - -// protected -int kpEffectEmbossWidget::strength () const -{ - return kpEffectEmboss::MaxStrength; -} - - -#include "moc_kpEffectEmbossWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.h deleted file mode 100644 index f7442e6b..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectEmbossWidget.h +++ /dev/null @@ -1,66 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectEmbossWidget_H -#define kpEffectEmbossWidget_H - - -#include -#include - - -#include - -class KIntNumInput; - - -class kpEffectEmbossWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectEmbossWidget (bool actOnSelection, QWidget *parent); - virtual ~kpEffectEmbossWidget (); - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected: - int strength () const; - - //KIntNumInput *m_amountInput; - QCheckBox *m_enableCheckBox; -}; - - -#endif // kpEffectEmbossWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.cpp deleted file mode 100644 index 1367bd90..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.cpp +++ /dev/null @@ -1,187 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_FLATTEN 0 - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -// public static -QColor kpEffectFlattenWidget::s_lastColor1; -QColor kpEffectFlattenWidget::s_lastColor2; - -kpEffectFlattenWidget::kpEffectFlattenWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - if (!s_lastColor1.isValid () || !s_lastColor2.isValid ()) - { - KConfigGroup cfgGroupSaver (KGlobal::config (), kpSettingsGroupFlattenEffect); - - s_lastColor1 = cfgGroupSaver.readEntry (kpSettingFlattenEffectColor1, QColor ()); - if (!s_lastColor1.isValid ()) - s_lastColor1 = Qt::red; - - s_lastColor2 = cfgGroupSaver.readEntry (kpSettingFlattenEffectColor2, QColor ()); - if (!s_lastColor2.isValid ()) - s_lastColor2 = Qt::blue; - } - - - m_enableCheckBox = new QCheckBox (i18n ("E&nable"), this); - - KVBox *colorButtonContainer = new KVBox (this); - colorButtonContainer->setMargin (KDialog::marginHint () / 2); - colorButtonContainer->setSpacing (spacingHint ()); - m_color1Button = new KColorButton (s_lastColor1, colorButtonContainer); - m_color2Button = new KColorButton (s_lastColor2, colorButtonContainer); - - - m_color1Button->setEnabled (false); - m_color2Button->setEnabled (false); - - - QVBoxLayout *lay = new QVBoxLayout (this); - lay->setSpacing(spacingHint ()); - lay->setMargin(marginHint ()); - lay->addWidget (m_enableCheckBox); - lay->addWidget (colorButtonContainer); - - - connect (m_enableCheckBox, SIGNAL (toggled (bool)), - this, SLOT (slotEnableChanged (bool))); - - connect (m_color1Button, SIGNAL (changed (const QColor &)), - this, SIGNAL (settingsChanged ())); - connect (m_color2Button, SIGNAL (changed (const QColor &)), - this, SIGNAL (settingsChanged ())); -} - -kpEffectFlattenWidget::~kpEffectFlattenWidget () -{ - s_lastColor1 = color1 (); - s_lastColor2 = color2 (); - - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupFlattenEffect); - - cfg.writeEntry (kpSettingFlattenEffectColor1, s_lastColor1); - cfg.writeEntry (kpSettingFlattenEffectColor2, s_lastColor2); - cfg.sync (); -} - - -// public -QColor kpEffectFlattenWidget::color1 () const -{ - return m_color1Button->color (); -} - -// public -QColor kpEffectFlattenWidget::color2 () const -{ - return m_color2Button->color (); -} - - -// -// kpEffectFlattenWidget implements kpEffectWidgetBase interface -// - -// public virtual [base kpEffectWidgetBase] -QString kpEffectFlattenWidget::caption () const -{ - return i18n ("Colors"); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectFlattenWidget::isNoOp () const -{ - return !m_enableCheckBox->isChecked (); -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectFlattenWidget::applyEffect (const kpImage &image) -{ -#if DEBUG_KP_EFFECT_FLATTEN - kDebug () << "kpEffectFlattenWidget::applyEffect() nop=" - << isNoOp () << endl; -#endif - - if (isNoOp ()) - return image; - - return kpEffectFlatten::applyEffect (image, color1 (), color2 ()); -} - - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectFlattenWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectFlattenCommand (color1 (), color2 (), - m_actOnSelection, - cmdEnviron); -} - - -// protected slot: -void kpEffectFlattenWidget::slotEnableChanged (bool enable) -{ -#if DEBUG_KP_EFFECT_FLATTEN - kDebug () << "kpEffectFlattenWidget::slotEnableChanged(" << enable - << ") enableButton=" << m_enableCheckBox->isChecked () - << endl; -#endif - - m_color1Button->setEnabled (enable); - m_color2Button->setEnabled (enable); - - emit settingsChanged (); -} - - -#include "moc_kpEffectFlattenWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.h deleted file mode 100644 index dc3e7659..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectFlattenWidget.h +++ /dev/null @@ -1,80 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectFlattenWidget_H -#define kpEffectFlattenWidget_H - - -#include - -#include - - -#include - -class KColorButton; - - -class kpEffectFlattenWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectFlattenWidget (bool actOnSelection, QWidget *parent); - virtual ~kpEffectFlattenWidget (); - - - static QColor s_lastColor1, s_lastColor2; - - - QColor color1 () const; - QColor color2 () const; - - - // - // kpEffectWidgetBase interface - // - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected slots: - void slotEnableChanged (bool enable); - -protected: - QCheckBox *m_enableCheckBox; - KColorButton *m_color1Button, *m_color2Button; -}; - - -#endif // kpEffectFlattenWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.cpp deleted file mode 100644 index e08a7a9f..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include -#include - -#include -#include - - -kpEffectHSVWidget::kpEffectHSVWidget (bool actOnSelection, QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QGridLayout *lay = new QGridLayout (this); - lay->setSpacing (spacingHint ()); - lay->setMargin (marginHint ()); - - QLabel *hueLabel = new QLabel (i18n ("&Hue:"), this); - QLabel *saturationLabel = new QLabel (i18n ("&Saturation:"), this); - QLabel *valueLabel = new QLabel (i18nc ("The V of HSV", "&Value:"), this); - - m_hueInput = new KDoubleNumInput (this); - m_hueInput->setRange (-180, 180, 15/*step*/, true/*slider*/); - - m_saturationInput = new KDoubleNumInput (this); - m_saturationInput->setRange (-1, 1, .1/*step*/, true/*slider*/); - - m_valueInput = new KDoubleNumInput (this); - m_valueInput->setRange (-1, 1, .1/*step*/, true/*slider*/); - - hueLabel->setBuddy (m_hueInput); - saturationLabel->setBuddy (m_saturationInput); - valueLabel->setBuddy (m_valueInput); - - lay->addWidget (hueLabel, 0, 0); - lay->addWidget (m_hueInput, 0, 1); - - lay->addWidget (saturationLabel, 1, 0); - lay->addWidget (m_saturationInput, 1, 1); - - lay->addWidget (valueLabel, 2, 0); - lay->addWidget (m_valueInput, 2, 1); - - lay->setColumnStretch (1, 1); - - - connect (m_hueInput, SIGNAL (valueChanged (double)), - this, SIGNAL (settingsChangedDelayed ())); - - connect (m_saturationInput, SIGNAL (valueChanged (double)), - this, SIGNAL (settingsChangedDelayed ())); - - connect (m_valueInput, SIGNAL (valueChanged (double)), - this, SIGNAL (settingsChangedDelayed ())); -} - -kpEffectHSVWidget::~kpEffectHSVWidget () -{ -} - - -// public virtual [base kpEffectWidgetBase] -QString kpEffectHSVWidget::caption () const -{ - // TODO: Why doesn't this have a caption? Ditto for the other effects. - return QString(); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectHSVWidget::isNoOp () const -{ - if (m_hueInput->value () == 0 && m_saturationInput->value () == 0 && m_valueInput->value () == 0) - return true; - else - return false; -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectHSVWidget::applyEffect (const kpImage &image) -{ - return kpEffectHSV::applyEffect (image, - m_hueInput->value (), m_saturationInput->value (), m_valueInput->value ()); -} - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectHSVWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectHSVCommand ( - m_hueInput->value (), m_saturationInput->value (), m_valueInput->value (), - m_actOnSelection, - cmdEnviron); -} - - -#include "moc_kpEffectHSVWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.h deleted file mode 100644 index 54baa202..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectHSVWidget.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - Copyright (c) 2007 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectHSVWidget_H -#define kpEffectHSVWidget_H - - -#include - - -class KDoubleNumInput; - - -class kpEffectHSVWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectHSVWidget (bool actOnSelection, QWidget *parent); - virtual ~kpEffectHSVWidget (); - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected: - KDoubleNumInput *m_hueInput; - KDoubleNumInput *m_saturationInput; - KDoubleNumInput *m_valueInput; -}; - - -#endif // kpEffectHSVWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.cpp deleted file mode 100644 index ea43efc7..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.cpp +++ /dev/null @@ -1,211 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_INVERT 0 - - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -kpEffectInvertWidget::kpEffectInvertWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QVBoxLayout *topLevelLay = new QVBoxLayout (this); - topLevelLay->setSpacing(spacingHint ()); - topLevelLay->setMargin(marginHint ()); - - - QWidget *centerWidget = new QWidget (this); - topLevelLay->addWidget (centerWidget, 0/*stretch*/, Qt::AlignCenter); - - - QVBoxLayout *centerWidgetLay = new QVBoxLayout (centerWidget ); - centerWidgetLay->setSpacing( spacingHint() ); - - m_redCheckBox = new QCheckBox (i18n ("&Red"), centerWidget); - m_greenCheckBox = new QCheckBox (i18n ("&Green"), centerWidget); - m_blueCheckBox = new QCheckBox (i18n ("&Blue"), centerWidget); - - QWidget *spaceWidget = new QWidget (centerWidget); - spaceWidget->setFixedSize (1, spacingHint ()); - - m_allCheckBox = new QCheckBox (i18n ("&All"), centerWidget); - - - m_redCheckBox->setChecked (false); - m_greenCheckBox->setChecked (false); - m_blueCheckBox->setChecked (false); - - m_allCheckBox->setChecked (false); - - - centerWidgetLay->addWidget (m_redCheckBox); - centerWidgetLay->addWidget (m_greenCheckBox); - centerWidgetLay->addWidget (m_blueCheckBox); - - centerWidgetLay->addWidget (spaceWidget); - - centerWidgetLay->addWidget (m_allCheckBox); - - - m_inSignalHandler = false; - connect (m_redCheckBox, SIGNAL (toggled (bool)), - this, SLOT (slotRGBCheckBoxToggled ())); - connect (m_greenCheckBox, SIGNAL (toggled (bool)), - this, SLOT (slotRGBCheckBoxToggled ())); - connect (m_blueCheckBox, SIGNAL (toggled (bool)), - this, SLOT (slotRGBCheckBoxToggled ())); - - connect (m_allCheckBox, SIGNAL (toggled (bool)), - this, SLOT (slotAllCheckBoxToggled ())); -} - -kpEffectInvertWidget::~kpEffectInvertWidget () -{ -} - - -// public -int kpEffectInvertWidget::channels () const -{ -#if DEBUG_KP_EFFECT_INVERT - kDebug () << "kpEffectInvertWidget::channels()" - << " isChecked: r=" << m_redCheckBox->isChecked () - << " g=" << m_greenCheckBox->isChecked () - << " b=" << m_blueCheckBox->isChecked () - << endl; -#endif - - int channels = 0; - - - if (m_redCheckBox->isChecked ()) - channels |= kpEffectInvert::Red; - - if (m_greenCheckBox->isChecked ()) - channels |= kpEffectInvert::Green; - - if (m_blueCheckBox->isChecked ()) - channels |= kpEffectInvert::Blue; - - -#if DEBUG_KP_EFFECT_INVERT - kDebug () << "\treturning channels=" << (int *) channels; -#endif - return channels; -} - - -// -// kpEffectInvertWidget implements kpEffectWidgetBase interface -// - -// public virtual [base kpEffectWidgetBase] -QString kpEffectInvertWidget::caption () const -{ - return i18n ("Channels"); -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectInvertWidget::isNoOp () const -{ - return (channels () == kpEffectInvert::None); -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectInvertWidget::applyEffect (const kpImage &image) -{ - return kpEffectInvert::applyEffect (image, channels ()); -} - - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectInvertWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectInvertCommand (channels (), - m_actOnSelection, - cmdEnviron); -} - - -// protected slots -void kpEffectInvertWidget::slotRGBCheckBoxToggled () -{ - if (m_inSignalHandler) - return; - - m_inSignalHandler = true; - - //blockSignals (true); - m_allCheckBox->setChecked (m_redCheckBox->isChecked () && - m_blueCheckBox->isChecked () && - m_greenCheckBox->isChecked ()); - //blockSignals (false); - - emit settingsChanged (); - - m_inSignalHandler = false; -} - -// protected slot -void kpEffectInvertWidget::slotAllCheckBoxToggled () -{ - if (m_inSignalHandler) - return; - - m_inSignalHandler = true; - - //blockSignals (true); - m_redCheckBox->setChecked (m_allCheckBox->isChecked ()); - m_greenCheckBox->setChecked (m_allCheckBox->isChecked ()); - m_blueCheckBox->setChecked (m_allCheckBox->isChecked ()); - //blockSignals (false); - - emit settingsChanged (); - - m_inSignalHandler = false; -} - - -#include "moc_kpEffectInvertWidget.cpp" - diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.h deleted file mode 100644 index 9413947d..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectInvertWidget.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectInvertWidget_H -#define kpEffectInvertWidget_H - - -#include - - -#include - - -class kpEffectInvertWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectInvertWidget (bool actOnSelection, - QWidget *parent); - virtual ~kpEffectInvertWidget (); - - - int channels () const; - - - // - // kpEffectWidgetBase interface - // - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected slots: - void slotRGBCheckBoxToggled (); - void slotAllCheckBoxToggled (); - -protected: - QCheckBox *m_redCheckBox, *m_greenCheckBox, *m_blueCheckBox, - *m_allCheckBox; - - // blockSignals() didn't seem to work - bool m_inSignalHandler; -}; - - -#endif // kpEffectInvertWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.cpp deleted file mode 100644 index abf0f041..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.cpp +++ /dev/null @@ -1,177 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_EFFECT_REDUCE_COLORS 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -kpEffectReduceColorsWidget::kpEffectReduceColorsWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent) -{ - QVBoxLayout *lay = new QVBoxLayout (this); - lay->setSpacing(spacingHint ()); - lay->setMargin(marginHint ()); - - - m_blackAndWhiteRadioButton = - new QRadioButton (i18n ("&Monochrome"), this); - - m_blackAndWhiteDitheredRadioButton = - new QRadioButton (i18n ("Mo&nochrome (dithered)"), this); - - m_8BitRadioButton = new QRadioButton (i18n ("256 co&lor"), this); - - m_8BitDitheredRadioButton = new QRadioButton (i18n ("256 colo&r (dithered)"), this); - - m_24BitRadioButton = new QRadioButton (i18n ("24-&bit color"), this); - - - // LOCOMPAT: don't think this is needed - QButtonGroup *buttonGroup = new QButtonGroup (this); - buttonGroup->addButton (m_blackAndWhiteRadioButton); - buttonGroup->addButton (m_blackAndWhiteDitheredRadioButton); - buttonGroup->addButton (m_8BitRadioButton); - buttonGroup->addButton (m_8BitDitheredRadioButton); - buttonGroup->addButton (m_24BitRadioButton); - - m_defaultRadioButton = m_24BitRadioButton; - m_defaultRadioButton->setChecked (true); - - lay->addWidget (m_blackAndWhiteRadioButton); - lay->addWidget (m_blackAndWhiteDitheredRadioButton); - lay->addWidget (m_8BitRadioButton); - lay->addWidget (m_8BitDitheredRadioButton); - lay->addWidget (m_24BitRadioButton); - - connect (m_blackAndWhiteRadioButton, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChanged ())); - connect (m_blackAndWhiteDitheredRadioButton, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChanged ())); - connect (m_8BitRadioButton, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChanged ())); - connect (m_8BitDitheredRadioButton, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChanged ())); - connect (m_24BitRadioButton, SIGNAL (toggled (bool)), - this, SIGNAL (settingsChanged ())); -} - -//--------------------------------------------------------------------- - -// public -int kpEffectReduceColorsWidget::depth () const -{ - // These values (1, 8, 32) are QImage's supported depths. - // TODO: Qt-4.7.1: 1, 8, 16, 24 and 32 - if (m_blackAndWhiteRadioButton->isChecked () || - m_blackAndWhiteDitheredRadioButton->isChecked ()) - { - return 1; - } - else if (m_8BitRadioButton->isChecked () || - m_8BitDitheredRadioButton->isChecked ()) - { - return 8; - } - else if (m_24BitRadioButton->isChecked ()) - { - return 32; - } - else - { - return 0; - } -} - -//--------------------------------------------------------------------- - -// public -bool kpEffectReduceColorsWidget::dither () const -{ - return (m_blackAndWhiteDitheredRadioButton->isChecked () || - m_8BitDitheredRadioButton->isChecked ()); -} - -//--------------------------------------------------------------------- -// -// kpEffectReduceColorsWidget implements kpEffectWidgetBase interface -// - -// public virtual [base kpEffectWidgetBase] -QString kpEffectReduceColorsWidget::caption () const -{ - return i18n ("Reduce To"); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpEffectWidgetBase] -bool kpEffectReduceColorsWidget::isNoOp () const -{ - return (!m_defaultRadioButton || m_defaultRadioButton->isChecked ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectReduceColorsWidget::applyEffect (const kpImage &image) -{ - return kpEffectReduceColors::applyEffect (image, depth (), dither ()); -} - -//--------------------------------------------------------------------- - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectReduceColorsWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectReduceColorsCommand (depth (), dither (), - m_actOnSelection, - cmdEnviron); -} - -//--------------------------------------------------------------------- - -#include "moc_kpEffectReduceColorsWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.h deleted file mode 100644 index 0fd0066f..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectReduceColorsWidget.h +++ /dev/null @@ -1,73 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectReduceColorsWidget_H -#define kpEffectReduceColorsWidget_H - - -#include - - -#include - - -class kpEffectReduceColorsWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectReduceColorsWidget (bool actOnSelection, - QWidget *parent); - - int depth () const; - bool dither () const; - - - // - // kpEffectWidgetBase interface - // - - virtual QString caption () const; - - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected: - QRadioButton *m_blackAndWhiteRadioButton, - *m_blackAndWhiteDitheredRadioButton, - *m_8BitRadioButton, - *m_8BitDitheredRadioButton, - *m_24BitRadioButton; - QRadioButton *m_defaultRadioButton; -}; - - -#endif // kpEffectReduceColorsWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp deleted file mode 100644 index cc3334f6..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp +++ /dev/null @@ -1,144 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - - -kpEffectToneEnhanceWidget::kpEffectToneEnhanceWidget (bool actOnSelection, - QWidget *parent) - : kpEffectWidgetBase (actOnSelection, parent), - m_granularityInput (0), - m_amountInput (0) - -{ - QGridLayout *lay = new QGridLayout (this); - lay->setSpacing (spacingHint ()); - lay->setMargin (marginHint ()); - - - // See kpEffectToneEnhance::applyEffect(). - { - QLabel *granularityLabel = new QLabel (i18n ("&Granularity:"), this); - - QLabel *amountLabel = new QLabel (i18n ("&Amount:"), this); - - m_granularityInput = new KDoubleNumInput (this); - m_granularityInput->setRange (0, 1, .1/*step*/, true/*slider*/); - - m_amountInput = new KDoubleNumInput (this); - m_amountInput->setRange (0, 1, .1/*step*/, true/*slider*/); - - granularityLabel->setBuddy (m_granularityInput); - amountLabel->setBuddy (m_amountInput); - - - lay->addWidget (granularityLabel, 0, 0); - lay->addWidget (m_granularityInput, 0, 1); - - lay->addWidget (amountLabel, 1, 0); - lay->addWidget (m_amountInput, 1, 1); - - lay->setColumnStretch (1, 1); - - - connect (m_granularityInput, SIGNAL (valueChanged (double)), - this, SIGNAL (settingsChangedDelayed ())); - - connect (m_amountInput, SIGNAL (valueChanged (double)), - this, SIGNAL (settingsChangedDelayed ())); - } -} - -kpEffectToneEnhanceWidget::~kpEffectToneEnhanceWidget () -{ -} - - -// public virtual [base kpEffectWidgetBase] -QString kpEffectToneEnhanceWidget::caption () const -{ - // TODO: Why doesn't this have a caption? Ditto for the other effects. - return QString(); -} - - -// private -double kpEffectToneEnhanceWidget::amount () const -{ - return m_amountInput ? m_amountInput->value () : 0; -} - -// private -double kpEffectToneEnhanceWidget::granularity () const -{ - return m_granularityInput ? m_granularityInput->value () : 0; -} - - -// public virtual [base kpEffectWidgetBase] -bool kpEffectToneEnhanceWidget::isNoOp () const -{ - // If the "amount" is 0, nothing happens regardless of the granularity. - // Note that if "granularity" is 0 but "amount" > 0, the effect _is_ active. - // Therefore, "granularity" should have no involvement in this check. - if (amount () == 0) - return true; - else - return false; -} - -// public virtual [base kpEffectWidgetBase] -kpImage kpEffectToneEnhanceWidget::applyEffect (const kpImage &image) -{ - return kpEffectToneEnhance::applyEffect (image, - granularity (), amount ()); -} - -// public virtual [base kpEffectWidgetBase] -kpEffectCommandBase *kpEffectToneEnhanceWidget::createCommand ( - kpCommandEnvironment *cmdEnviron) const -{ - return new kpEffectToneEnhanceCommand (granularity (), amount (), - m_actOnSelection, - cmdEnviron); -} - - -#include "moc_kpEffectToneEnhanceWidget.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.h b/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.h deleted file mode 100644 index 825f2d03..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectToneEnhanceWidget.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2006 Mike Gashler - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectToneEnhanceWidget_H -#define kpEffectToneEnhanceWidget_H - - -#include - - -class KDoubleNumInput; - - -class kpEffectToneEnhanceWidget : public kpEffectWidgetBase -{ -Q_OBJECT - -public: - kpEffectToneEnhanceWidget (bool actOnSelection, - QWidget *parent); - virtual ~kpEffectToneEnhanceWidget (); - - virtual QString caption () const; - -private: - double amount () const; - double granularity () const; - -public: - virtual bool isNoOp () const; - virtual kpImage applyEffect (const kpImage &image); - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const; - -protected: - KDoubleNumInput *m_granularityInput; - KDoubleNumInput *m_amountInput; -}; - - -#endif // kpEffectToneEnhanceWidget_H diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.cpp b/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.cpp deleted file mode 100644 index 69ca29d9..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - - -kpEffectWidgetBase::kpEffectWidgetBase (bool actOnSelection, - QWidget *parent) - : QWidget (parent), - m_actOnSelection (actOnSelection) -{ -} - -kpEffectWidgetBase::~kpEffectWidgetBase () -{ -} - - -// public -QString kpEffectWidgetBase::caption () const -{ - return QString(); -} - - -// protected -int kpEffectWidgetBase::marginHint () const -{ - return 0; -} - -// protected -int kpEffectWidgetBase::spacingHint () const -{ - return KDialog::spacingHint (); -} - - -#include "moc_kpEffectWidgetBase.cpp" diff --git a/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.h b/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.h deleted file mode 100644 index 311e7718..00000000 --- a/kolourpaint/widgets/imagelib/effects/kpEffectWidgetBase.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpEffectWidgetBase_H -#define kpEffectWidgetBase_H - - -#include - -#include - - -class kpCommandEnvironment; -class kpEffectCommandBase; - - -class kpEffectWidgetBase : public QWidget -{ -Q_OBJECT - -public: - kpEffectWidgetBase (bool actOnSelection, QWidget *parent); - virtual ~kpEffectWidgetBase (); - -signals: - void settingsChangedNoWaitCursor (); - - void settingsChanged (); - - // (same as settingsChanged() but preview doesn't update until there - // has been no activity for a while - used for sliders in slow effects) - void settingsChangedDelayed (); - -public: - virtual QString caption () const; - - virtual bool isNoOp () const = 0; - virtual kpImage applyEffect (const kpImage &image) = 0; - - virtual kpEffectCommandBase *createCommand ( - kpCommandEnvironment *cmdEnviron) const = 0; - -protected: - int marginHint () const; - int spacingHint () const; - -protected: - bool m_actOnSelection; -}; - - -#endif // kpEffectWidgetBase_H diff --git a/kolourpaint/widgets/kpColorCells.cpp b/kolourpaint/widgets/kpColorCells.cpp deleted file mode 100644 index af8da8a0..00000000 --- a/kolourpaint/widgets/kpColorCells.cpp +++ /dev/null @@ -1,597 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_CELLS 0 - - -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include - -//--------------------------------------------------------------------- -// -// Table Geometry -// - - -// The number of columns that the table normally has. -const int TableDefaultNumColumns = 11; - -const int TableDefaultWidth = ::TableDefaultNumColumns * 26; - -const int TableDefaultHeight = 52; - - -static int TableNumColumns (const kpColorCollection &colorCol) -{ - if (colorCol.count () == 0) - return 0; - - return ::TableDefaultNumColumns; -} - -static int TableNumRows (const kpColorCollection &colorCol) -{ - const int cols = ::TableNumColumns (colorCol); - if (cols == 0) - return 0; - - return (colorCol.count () + (cols - 1)) / cols; -} - - -static int TableCellWidth (const kpColorCollection &colorCol) -{ - Q_UNUSED (colorCol); - - return ::TableDefaultWidth / ::TableDefaultNumColumns; -} - -static int TableCellHeight (const kpColorCollection &colorCol) -{ - if (::TableNumRows (colorCol) <= 2) - return ::TableDefaultHeight / 2; - else - return ::TableDefaultHeight / 3; -} - - -// -// kpColorCells -// - - -struct kpColorCellsPrivate -{ - Qt::Orientation orientation; - - // REFACTOR: This is data duplication with kpColorCellsBase::color[]. - // We've probably forgotten to synchronize them in some points. - // - // Calls to kpColorCellsBase::setColor() (which also come from - // kpColorCellsBase itself) will automatically update both - // kpColorCellsBase::d->color[] and the table cells. setColor() emits - // colorChanged(), which is caught by our slotColorChanged(), - // which synchronizes this color collection and updates the modified flag. - // - // Avoid calling our grandparent's, QTableWidget's, mutating methods as we - // don't override enough of them, to fire signals that we can catch to update - // this color collection. - // - // If you modify this color collection directly (e.g. in setColorCollection(), - // openColorCollection(), appendRow(), deleteLastRow(), ...), you must work - // the other way and call makeCellsMatchColorCollection() to synchronize - // kpColorCellsBase::d->color[] and the table cells. You still need to update - // the modified flag. - kpColorCollection colorCol; - - KUrl url; - bool isModified; - - bool blockColorChangedSig; -}; - -//--------------------------------------------------------------------- - -kpColorCells::kpColorCells (QWidget *parent, - Qt::Orientation o) - : kpColorCellsBase (parent, 0/*rows for now*/, 0/*cols for now*/), - d (new kpColorCellsPrivate ()) -{ - d->orientation = o; - d->isModified = false; - d->blockColorChangedSig = false; - - - // When a text box is active, clicking to change the background color - // should not move the keyboard focus away from the text box. - setFocusPolicy (Qt::TabFocus); - - setShading (false); // no 3D look - - setAcceptDrops (true); - setAcceptDrags (true); - - - setCellsResizable (false); - - if (o == Qt::Horizontal) - { - // Reserve enough room for the default color collection's cells _and_ - // a vertical scrollbar, which only appears when it's required. - // This ensures that if the vertical scrollbar appears, it does not obscure - // any cells or require the addition of a horizontal scrollbar, which would - // look ugly and take even more precious room. - // - // We do not dynamically reserve room based on the actual number of rows - // of cells, as that would make our containing widgets too big. - setMinimumSize (::TableDefaultWidth + frameWidth () * 2 + - verticalScrollBar()->sizeHint().width(), - ::TableDefaultHeight + frameWidth () * 2); - } - else - { - Q_ASSERT (!"implemented"); - } - - setVerticalScrollBarPolicy (Qt::ScrollBarAsNeeded); - - // The default QTableWidget policy of QSizePolicy::Expanding forces our - // containing widgets to get too big. Override it. - setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); - - - connect (this, SIGNAL (colorSelected (int, const QColor &, Qt::MouseButton)), - SLOT (slotColorSelected (int, const QColor &, Qt::MouseButton))); - connect (this, SIGNAL (colorDoubleClicked (int, const QColor &)), - SLOT (slotColorDoubleClicked (int, const QColor &))); - connect (this, SIGNAL (colorChanged (int, const QColor &)), - SLOT (slotColorChanged (int, const QColor &))); - - - setColorCollection (DefaultColorCollection ()); - - - setWhatsThis ( - i18n ( - "" - - "

To select the foreground color that tools use to draw," - " left-click on a filled-in color cell." - " To select the background color, right-click instead.

" - - "

To change the color of a color cell itself, double-click on it.

" - - "

You can also swap the color of a filled-in cell with any other" - " cell using drag and drop." - " Also, if you hold down the Ctrl key, the destination" - " cell's color will be" - " overwritten, instead of being swapped with the color of the source cell.

" - - "
")); -} - -//--------------------------------------------------------------------- - -kpColorCells::~kpColorCells () -{ - delete d; -} - -//--------------------------------------------------------------------- - - -// public static -kpColorCollection kpColorCells::DefaultColorCollection () -{ - return kpDefaultColorCollection (); -} - -//--------------------------------------------------------------------- - - -// public -Qt::Orientation kpColorCells::orientation () const -{ - return d->orientation; -} - -//--------------------------------------------------------------------- - -// public -void kpColorCells::setOrientation (Qt::Orientation o) -{ - d->orientation = o; - - makeCellsMatchColorCollection (); -} - -//--------------------------------------------------------------------- - - -// protected -// OPT: Find out why this is being called multiple times on startup. -void kpColorCells::makeCellsMatchColorCollection () -{ - int c, r; - - if (orientation () == Qt::Horizontal) - { - c = ::TableNumColumns (d->colorCol); - r = ::TableNumRows (d->colorCol); - } - else - { - c = ::TableNumRows (d->colorCol); - r = ::TableNumColumns (d->colorCol);; - } - -#if DEBUG_KP_COLOR_CELLS - kDebug () << "kpColorCells::makeCellsMatchColorCollection():" - << "r=" << r << "c=" << c; - kDebug () << "verticalScrollBar=" << verticalScrollBar () - << " sizeHint=" - << (verticalScrollBar () ? - verticalScrollBar ()->sizeHint () : - QSize (-12, -34)); -#endif - - // Delete all cell widgets. This ensures that there will be no left-over - // cell widgets, for the colors in the new color collection that are - // actually invalid (which should not have cell widgets). - clearContents (); - - setRowCount (r); - setColumnCount (c); - - - int CellWidth = ::TableCellWidth (d->colorCol), - CellHeight = ::TableCellHeight (d->colorCol); - - // TODO: Take a screenshot of KolourPaint, magnify it and you'll find the - // cells don't have exactly the sizes requested here. e.g. the - // top row of cells is 1 pixel shorter than the bottom row. There - // are probably other glitches. - for (int y = 0; y < r; y++) - setRowHeight (y, CellHeight); - for (int x = 0; x < c; x++) - setColumnWidth (x, CellWidth); - - - const bool oldBlockColorChangedSig = d->blockColorChangedSig; - d->blockColorChangedSig = true; - // The last "(rowCount() * columnCount()) - d->colorCol.count()" cells - // will be empty because we did not initialize them. - for (int i = 0; i < d->colorCol.count (); i++) - { - int y, x; - int pos; - - if (orientation () == Qt::Horizontal) - { - y = i / c; - x = i % c; - pos = i; - } - else - { - y = i % r; - x = i / r; - // int x = c - 1 - i / r; - pos = y * c + x; - } - #if DEBUG_KP_COLOR_CELLS && 0 - kDebug () << "\tSetting cell " << i << ": y=" << y << " x=" << x - << " pos=" << pos << endl; - kDebug () << "\t\tcolor=" << (int *) d->colorCol.color (i).rgba() - << "isValid=" << d->colorCol.color (i).isValid (); - #endif - - // (color may be invalid resulting in a hole in the middle of the table) - setColor (pos, d->colorCol.color (i)); - //this->setToolTip( cellGeometry (y, x), colors [i].name ()); - } - d->blockColorChangedSig = oldBlockColorChangedSig; -} - -//--------------------------------------------------------------------- - - -bool kpColorCells::isModified () const -{ - return d->isModified; -} - -//--------------------------------------------------------------------- - -void kpColorCells::setModified (bool yes) -{ -#if DEBUG_KP_COLOR_CELLS - kDebug () << "kpColorCells::setModified(" << yes << ")"; -#endif - - if (yes == d->isModified) - return; - - d->isModified = yes; - - emit isModifiedChanged (yes); -} - -//--------------------------------------------------------------------- - -void kpColorCells::setModified () -{ - setModified (true); -} - -//--------------------------------------------------------------------- - - -KUrl kpColorCells::url () const -{ - return d->url; -} - -//--------------------------------------------------------------------- - -QString kpColorCells::name () const -{ - return d->colorCol.name (); -} - -//--------------------------------------------------------------------- - - -const kpColorCollection *kpColorCells::colorCollection () const -{ - return &d->colorCol; -} - -//--------------------------------------------------------------------- - - -void kpColorCells::ensureHaveAtLeastOneRow () -{ - if (d->colorCol.count () == 0) - d->colorCol.resize (::TableDefaultNumColumns); -} - -//--------------------------------------------------------------------- - -void kpColorCells::setColorCollection (const kpColorCollection &colorCol, const KUrl &url) -{ - d->colorCol = colorCol; - ensureHaveAtLeastOneRow (); - - d->url = url; - setModified (false); - - makeCellsMatchColorCollection (); - - emit rowCountChanged (rowCount ()); - emit urlChanged (d->url); - emit nameChanged (name ()); -} - -//--------------------------------------------------------------------- - - -bool kpColorCells::openColorCollection (const KUrl &url) -{ - // (this will pop up an error dialog on failure) - if (d->colorCol.open (url, this)) - { - ensureHaveAtLeastOneRow (); - - d->url = url; - setModified (false); - - makeCellsMatchColorCollection (); - - emit rowCountChanged (rowCount ()); - emit urlChanged (d->url); - emit nameChanged (name ()); - - return true; - } - - return false; -} - -//--------------------------------------------------------------------- - -bool kpColorCells::saveColorCollectionAs (const KUrl &url) -{ - // (this will pop up an error dialog on failure) - if (d->colorCol.saveAs (url, true/*show overwrite prompt*/, this)) - { - d->url = url; - setModified (false); - - emit urlChanged (d->url); - return true; - } - - return false; -} - -//--------------------------------------------------------------------- - -bool kpColorCells::saveColorCollection () -{ - // (this will pop up an error dialog on failure) - if (d->colorCol.saveAs (d->url, false/*no overwrite prompt*/, this)) - { - setModified (false); - return true; - } - - return false; -} - -//--------------------------------------------------------------------- - - -void kpColorCells::appendRow () -{ - // This is the easiest implementation: change the color collection - // and then synchronize the table cells. The other way is to call - // setRowCount() and then, synchronize the color collection. - - const int targetNumCells = (rowCount () + 1) * ::TableDefaultNumColumns; - d->colorCol.resize (targetNumCells); - - setModified (true); - - makeCellsMatchColorCollection (); - - emit rowCountChanged (rowCount ()); -} - -//--------------------------------------------------------------------- - -void kpColorCells::deleteLastRow () -{ - // This is the easiest implementation: change the color collection - // and then synchronize the table cells. The other way is to call - // setRowCount() and then, synchronize the color collection. - - const int targetNumCells = - qMax (0, (rowCount () - 1) * ::TableDefaultNumColumns); - d->colorCol.resize (targetNumCells); - - // If there was only one row of colors to start with, the effect of this - // line (after the above resize()) is to change that row to a row of - // invalid colors. - ensureHaveAtLeastOneRow (); - - setModified (true); - - makeCellsMatchColorCollection (); - - emit rowCountChanged (rowCount ()); -} - -//--------------------------------------------------------------------- - - -// protected virtual [base QWidget] -void kpColorCells::contextMenuEvent (QContextMenuEvent *e) -{ - // Eat right-mouse press to prevent it from getting to the toolbar. - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpColorCells::slotColorSelected (int cell, const QColor &color, - Qt::MouseButton button) -{ -#if DEBUG_KP_COLOR_CELLS - kDebug () << "kpColorCells::slotColorSelected(cell=" << cell - << ") mouseButton = " << button - << " rgb=" << (int *) color.rgba() - << endl; -#else - Q_UNUSED (cell); -#endif - - if (button == Qt::LeftButton) - { - emit foregroundColorChanged (kpColor (color.rgba())); - } - else if (button == Qt::RightButton) - { - emit backgroundColorChanged (kpColor (color.rgba())); - } - - // REFACTOR: Make selectedness configurable inside kpColorCellsBase? - // - // Deselect the selected cell (selected by above kpColorCellsBase::mouseReleaseEvent()). - // KolourPaint's palette has no concept of a current cell/color: you can - // pick a color but you can't mark a cell as selected. In any case, a - // selected cell would be rendered as violet, which would ruin the cell. - // - // setSelectionMode (kpColorCellsBase::NoSelection); does not work so we - // clearSelection(). I think setSelectionMode() concerns when the user - // directly selects a cell - not when kpColorCellsBase::mouseReleaseEvent() - // selects a cell programmatically. - clearSelection (); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpColorCells::slotColorDoubleClicked (int cell, const QColor &) -{ - KColorDialog dialog(this); - dialog.setColor(kpColorCellsBase::color(cell)); - dialog.setAlphaChannelEnabled(true); - dialog.setButtons(KDialog::Ok | KDialog::Cancel); - if ( dialog.exec() == QDialog::Accepted ) - setColor (cell, dialog.color()); -} - -//--------------------------------------------------------------------- - -// protected slot -void kpColorCells::slotColorChanged (int cell, const QColor &color) -{ -#if DEBUG_KP_COLOR_CELLS - kDebug () << "cell=" << cell << "color=" << (const int *) color.rgba() - << "d->colorCol.count()=" << d->colorCol.count (); -#endif - - if (d->blockColorChangedSig) - return; - - // Cater for adding new colors to the end. - if (cell >= d->colorCol.count ()) - d->colorCol.resize (cell + 1); - - // TODO: We lose color names on a color swap (during drag-and-drop). - const int ret = d->colorCol.changeColor (cell, color, - QString ()/*color name*/); - Q_ASSERT (ret == cell); - - setModified (true); -} - -#include "moc_kpColorCells.cpp" diff --git a/kolourpaint/widgets/kpColorCells.h b/kolourpaint/widgets/kpColorCells.h deleted file mode 100644 index 571458ba..00000000 --- a/kolourpaint/widgets/kpColorCells.h +++ /dev/null @@ -1,169 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorCells_H -#define kpColorCells_H - - -#include - -#include - - -#include - -class kpColorCollection; - -class kpColor; - - -// This widget consists of rows of 11 cells of colors. The cells become -// shorter as soon as there are 3 rows. After that, a vertical scrollbar -// is usually displayed. -// -// By default, it is set to the DefaultColorCollection(), with 2 rows. -// -// -// Cell widgets might not exist for 2 reasons: -// -// 1. The respective colors in the color collection are invalid. -// An easy way to create this situation is to appendRow(). -// -// 2. The number of colors in the color collection is not divisible by -// the columnCount() [currently fixed at 11], so some cells in the -// last row might not be linked to colors in the color collection. -// -// Currently, this class always ensures that there is at least one -// visual/table row (which might contain no cell widgets). -// -// -// To determine where the color collection came from: -// -// 1. If url() is non-empty, it came from a file. -// -// 2. If url() is empty: -// a) If name() is non-empty, it came from KDE-managed color collection. -// b) If name() is empty, it came from DefaultColorCollection(). -// -// -// See also the API documentation for kpColorCellsBase. -// -// TODO: For now, only horizontal orientation is supported. -class kpColorCells : public kpColorCellsBase -{ -Q_OBJECT - -public: - kpColorCells (QWidget *parent, - Qt::Orientation o = Qt::Horizontal); - virtual ~kpColorCells (); - - static kpColorCollection DefaultColorCollection (); - - Qt::Orientation orientation () const; - void setOrientation (Qt::Orientation o); - -protected: - void makeCellsMatchColorCollection (); - -public: - bool isModified () const; - // (this emits isModifiedChanged() if the modified state changes) - void setModified (bool yes); -public slots: - // (this emits isModifiedChanged() if the modified state changes) - void setModified (); - -public: - // The source URL of the kpColorCollection. Empty for color - // collections that did not come from files. - KUrl url () const; - - // The name of the kpColorCollection. Empty for color collections - // managed by KDE. - QString name () const; - - const kpColorCollection *colorCollection () const; - -private: - // Ensures there's a least one row of cells, to avoid a confusing UI. - void ensureHaveAtLeastOneRow (); -public: - void setColorCollection (const kpColorCollection &colorCol, - const KUrl &url = KUrl ()); - - bool openColorCollection (const KUrl &url); - bool saveColorCollectionAs (const KUrl &url); - bool saveColorCollection (); - - // These add and delete visual/table rows, independent of whether the number - // of colors in the color collection is divisible by the columnCount() - // [currently fixed at 11]. - // - // For instance, if you only had 15 colors in the color collection, there are - // visually 2 rows (22 cells in total): - // - // 1. appendRow() will add a visual row so that there will be 3 visual rows - // (33 cells in total). (22 - 15) + 11 invalid colors will be added to - // the back of the color collection. Note that invalid colors are not - // saved by kpColorCollection, so those new cells not initialized by the - // user will not be saved. - // 2. deleteRow() will delete a visual row so that there will be 1 visual - // row (11 cells in total) remaining. (15 - 11) colors will be deleted - // from the back of the color collection. - void appendRow (); - void deleteLastRow (); - -signals: - void foregroundColorChanged (const kpColor &color); - void backgroundColorChanged (const kpColor &color); - - void rowCountChanged (int rowCount); - - void nameChanged (const QString &name); - void urlChanged (const KUrl &url); - - // Emitted when setModified() is called and the modified state changes. - // It may be called at other times, even when the modified state did - // not change. - void isModifiedChanged (bool isModified); - -protected: - virtual void contextMenuEvent (QContextMenuEvent *e); - -protected slots: - void slotColorSelected (int cell, const QColor &color, Qt::MouseButton button); - void slotColorDoubleClicked (int cell, const QColor &color); - void slotColorChanged (int cell, const QColor &color); - -private: - struct kpColorCellsPrivate * const d; -}; - - -#endif // kpColorCells_H diff --git a/kolourpaint/widgets/kpColorPalette.cpp b/kolourpaint/widgets/kpColorPalette.cpp deleted file mode 100644 index 420e729a..00000000 --- a/kolourpaint/widgets/kpColorPalette.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_PALETTE 0 - - -#include - -#include - -#include -#include - -//--------------------------------------------------------------------- - -struct kpColorPalettePrivate -{ - Qt::Orientation orientation; - - QBoxLayout *boxLayout; - - kpTransparentColorCell *transparentColorCell; - - kpColorCells *colorCells; -}; - -//--------------------------------------------------------------------- - -kpColorPalette::kpColorPalette (QWidget *parent, Qt::Orientation o) - : QWidget (parent), - d (new kpColorPalettePrivate ()) -{ - d->boxLayout = 0; - - d->transparentColorCell = new kpTransparentColorCell (this); - connect (d->transparentColorCell, SIGNAL (foregroundColorChanged (const kpColor &)), - this, SIGNAL (foregroundColorChanged (const kpColor &))); - connect (d->transparentColorCell, SIGNAL (backgroundColorChanged (const kpColor &)), - this, SIGNAL (backgroundColorChanged (const kpColor &))); - - d->colorCells = new kpColorCells (this); - connect (d->colorCells, SIGNAL (foregroundColorChanged (const kpColor &)), - this, SIGNAL (foregroundColorChanged (const kpColor &))); - connect (d->colorCells, SIGNAL (backgroundColorChanged (const kpColor &)), - this, SIGNAL (backgroundColorChanged (const kpColor &))); - - setOrientation (o); -} - -//--------------------------------------------------------------------- - -kpColorPalette::~kpColorPalette () -{ - delete d; -} - -//--------------------------------------------------------------------- - -// public -Qt::Orientation kpColorPalette::orientation () const -{ - return d->orientation; -} - -//--------------------------------------------------------------------- - -void kpColorPalette::setOrientation (Qt::Orientation o) -{ - d->colorCells->setOrientation (o); - - delete d->boxLayout; - - if (o == Qt::Horizontal) - { - d->boxLayout = new QBoxLayout (QBoxLayout::LeftToRight, this); - d->boxLayout->addWidget (d->transparentColorCell, 0/*stretch*/, Qt::AlignTop); - d->boxLayout->addWidget (d->colorCells); - } - else - { - d->boxLayout = new QBoxLayout (QBoxLayout::TopToBottom, this); - d->boxLayout->addWidget (d->transparentColorCell, 0/*stretch*/, Qt::AlignTop); - d->boxLayout->addWidget (d->colorCells); - } - d->boxLayout->setSpacing (5); - - d->orientation = o; -} - -//--------------------------------------------------------------------- - -// public -kpColorCells *kpColorPalette::colorCells () const -{ - return d->colorCells; -} - -//--------------------------------------------------------------------- - -#include "moc_kpColorPalette.cpp" diff --git a/kolourpaint/widgets/kpColorPalette.h b/kolourpaint/widgets/kpColorPalette.h deleted file mode 100644 index fd68cf07..00000000 --- a/kolourpaint/widgets/kpColorPalette.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpColorPalette_H -#define kpColorPalette_H - - -#include - - -class kpColor; -class kpColorCells; - - -class kpColorPalette : public QWidget -{ -Q_OBJECT - -public: - kpColorPalette (QWidget *parent, - Qt::Orientation o = Qt::Horizontal); - virtual ~kpColorPalette (); - - Qt::Orientation orientation () const; - void setOrientation (Qt::Orientation o); - - kpColorCells *colorCells () const; - -signals: - void foregroundColorChanged (const kpColor &color); - void backgroundColorChanged (const kpColor &color); - -private: - struct kpColorPalettePrivate * const d; -}; - - -#endif // kpColorPalette_H diff --git a/kolourpaint/widgets/kpDefaultColorCollection.cpp b/kolourpaint/widgets/kpDefaultColorCollection.cpp deleted file mode 100644 index 2548710b..00000000 --- a/kolourpaint/widgets/kpDefaultColorCollection.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include - - -kpDefaultColorCollection::kpDefaultColorCollection () -{ - kpColor colors [] = - { - kpColor::Black, - kpColor::Gray, - kpColor::Red, - kpColor::Orange, - kpColor::Yellow, - kpColor::Green, - kpColor::Aqua, - kpColor::Blue, - kpColor::Purple, - kpColor::Pink, - kpColor::LightGreen, - - kpColor::White, - kpColor::LightGray, - kpColor::DarkRed, - kpColor::DarkOrange, - kpColor::DarkYellow, - kpColor::DarkGreen, - kpColor::DarkAqua, - kpColor::DarkBlue, - kpColor::DarkPurple, - kpColor::LightBlue, - kpColor::Tan - }; - - for (int i = 0; i < (int) (sizeof (colors) / sizeof (colors [0])); i++) - { - addColor (colors [i].toQColor ()); - } -} - -kpDefaultColorCollection::~kpDefaultColorCollection () -{ -} diff --git a/kolourpaint/widgets/kpDefaultColorCollection.h b/kolourpaint/widgets/kpDefaultColorCollection.h deleted file mode 100644 index d34704dc..00000000 --- a/kolourpaint/widgets/kpDefaultColorCollection.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDefaultColorCollection_H -#define kpDefaultColorCollection_H - - -#include - - -// -// The default set of colors offered by KolourPaint to the user. -// -// It contains all of the ordinary colors (black, white, gray, colors of -// the rainbow etc.) and a few others. -// -class kpDefaultColorCollection : public kpColorCollection -{ -public: - kpDefaultColorCollection (); - ~kpDefaultColorCollection (); -}; - - -#endif // kpDefaultColorCollection_H diff --git a/kolourpaint/widgets/kpDocumentSaveOptionsWidget.cpp b/kolourpaint/widgets/kpDocumentSaveOptionsWidget.cpp deleted file mode 100644 index 4fb5dcc6..00000000 --- a/kolourpaint/widgets/kpDocumentSaveOptionsWidget.cpp +++ /dev/null @@ -1,768 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -kpDocumentSaveOptionsWidget::kpDocumentSaveOptionsWidget ( - const QImage &docPixmap, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - QWidget *parent) - : QWidget (parent), - m_visualParent (parent) -{ - init (); - setDocumentSaveOptions (saveOptions); - setDocumentPixmap (docPixmap); - setDocumentMetaInfo (metaInfo); -} - -kpDocumentSaveOptionsWidget::kpDocumentSaveOptionsWidget ( - QWidget *parent) - : QWidget (parent), - m_visualParent (parent) -{ - init (); -} - -// private -void kpDocumentSaveOptionsWidget::init () -{ - m_documentPixmap = 0; - m_previewDialog = 0; - m_visualParent = 0; - - - m_colorDepthLabel = new QLabel (i18n ("Convert &to:"), this); - m_colorDepthCombo = new KComboBox (this); - - m_colorDepthSpaceWidget = new QWidget (this); - - m_qualityLabel = new QLabel (i18n ("Quali&ty:"), this); - m_qualityInput = new KIntNumInput (this); - // Note that we set min to 1 not 0 since "0 Quality" is a bit misleading - // and 101 quality settings would be weird. So we lose 1 quality setting - // according to QImage::save(). - // TODO: 100 quality is also misleading since that implies perfect quality. - m_qualityInput->setRange (1, 100); - - m_previewButton = new KPushButton (i18n ("&Preview"), this); - m_previewButton->setCheckable (true); - - - m_colorDepthLabel->setBuddy (m_colorDepthCombo); - - m_qualityLabel->setBuddy (m_qualityInput); - - - QHBoxLayout *lay = new QHBoxLayout (this); - lay->setSpacing(KDialog::spacingHint ()); - lay->setMargin(0/*margin*/); - - lay->addWidget (m_colorDepthLabel, 0/*stretch*/, Qt::AlignLeft); - lay->addWidget (m_colorDepthCombo, 0/*stretch*/); - - lay->addWidget (m_colorDepthSpaceWidget, 1/*stretch*/); - - lay->addWidget (m_qualityLabel, 0/*stretch*/, Qt::AlignLeft); - lay->addWidget (m_qualityInput, 2/*stretch*/); - - lay->addWidget (m_previewButton, 0/*stretch*/, Qt::AlignRight); - - - connect (m_colorDepthCombo, SIGNAL (activated (int)), - this, SLOT (slotColorDepthSelected ())); - connect (m_colorDepthCombo, SIGNAL (activated (int)), - this, SLOT (updatePreview ())); - - connect (m_qualityInput, SIGNAL (valueChanged (int)), - this, SLOT (updatePreviewDelayed ())); - - connect (m_previewButton, SIGNAL (toggled (bool)), - this, SLOT (showPreview (bool))); - - - m_updatePreviewDelay = 200/*ms*/; - - m_updatePreviewTimer = new QTimer (this); - m_updatePreviewTimer->setSingleShot (true); - connect (m_updatePreviewTimer, SIGNAL (timeout ()), - this, SLOT (updatePreview ())); - - m_updatePreviewDialogLastRelativeGeometryTimer = new QTimer (this); - connect (m_updatePreviewDialogLastRelativeGeometryTimer, SIGNAL (timeout ()), - this, SLOT (updatePreviewDialogLastRelativeGeometry ())); - - - setMode (None); - - slotColorDepthSelected (); -} - -kpDocumentSaveOptionsWidget::~kpDocumentSaveOptionsWidget () -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::()"; -#endif - hidePreview (); - - delete m_documentPixmap; -} - - -// public -void kpDocumentSaveOptionsWidget::setVisualParent (QWidget *visualParent) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::setVisualParent(" - << visualParent << ")" << endl; -#endif - - m_visualParent = visualParent; -} - - -// protected -bool kpDocumentSaveOptionsWidget::mimeTypeHasConfigurableColorDepth () const -{ - return kpDocumentSaveOptions::mimeTypeHasConfigurableColorDepth (mimeType ()); -} - -// protected -bool kpDocumentSaveOptionsWidget::mimeTypeHasConfigurableQuality () const -{ - return kpDocumentSaveOptions::mimeTypeHasConfigurableQuality (mimeType ()); -} - - -// public -QString kpDocumentSaveOptionsWidget::mimeType () const -{ - return m_baseDocumentSaveOptions.mimeType (); -} - -// public slots -void kpDocumentSaveOptionsWidget::setMimeType (const QString &string) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::setMimeType(" << string - << ") maxColorDepth=" - << kpDocumentSaveOptions::mimeTypeMaximumColorDepth (string) - << endl; -#endif - - const int newMimeTypeMaxDepth = - kpDocumentSaveOptions::mimeTypeMaximumColorDepth (string); - -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\toldMimeType=" << mimeType () - << " maxColorDepth=" - << kpDocumentSaveOptions::mimeTypeMaximumColorDepth ( - mimeType ()) - << endl; -#endif - - if (mimeType ().isEmpty () || - kpDocumentSaveOptions::mimeTypeMaximumColorDepth (mimeType ()) != - newMimeTypeMaxDepth) - { - m_colorDepthCombo->clear (); - - m_colorDepthCombo->insertItem (0, i18n ("Monochrome")); - m_colorDepthCombo->insertItem (1, i18n ("Monochrome (Dithered)")); - - if (newMimeTypeMaxDepth >= 8) - { - m_colorDepthCombo->insertItem (2, i18n ("256 Color")); - m_colorDepthCombo->insertItem (3, i18n ("256 Color (Dithered)")); - } - - if (newMimeTypeMaxDepth >= 24) - { - m_colorDepthCombo->insertItem (4, i18n ("24-bit Color")); - } - - if (m_colorDepthComboLastSelectedItem >= 0 && - m_colorDepthComboLastSelectedItem < m_colorDepthCombo->count ()) - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tsetting colorDepthCombo to " - << m_colorDepthComboLastSelectedItem << endl; - #endif - - m_colorDepthCombo->setCurrentIndex (m_colorDepthComboLastSelectedItem); - } - else - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tsetting colorDepthCombo to max item since" - << " m_colorDepthComboLastSelectedItem=" - << m_colorDepthComboLastSelectedItem - << " out of range" << endl; - #endif - - m_colorDepthCombo->setCurrentIndex (m_colorDepthCombo->count () - 1); - } - } - - - m_baseDocumentSaveOptions.setMimeType (string); - - if (mimeTypeHasConfigurableColorDepth ()) - setMode (ColorDepth); - else if (mimeTypeHasConfigurableQuality ()) - setMode (Quality); - else - setMode (None); - - updatePreview (); -} - - -// public -int kpDocumentSaveOptionsWidget::colorDepth () const -{ - if (mode () & ColorDepth) - { - // The returned values match QImage's supported depths. - switch (m_colorDepthCombo->currentIndex ()) - { - case 0: - case 1: - return 1; - - case 2: - case 3: - return 8; - - case 4: - // 24-bit is known as 32-bit with QImage. - return 32; - - default: - return kpDocumentSaveOptions::invalidColorDepth (); - } - } - else - { - return m_baseDocumentSaveOptions.colorDepth (); - } -} - -// public -bool kpDocumentSaveOptionsWidget::dither () const -{ - if (mode () & ColorDepth) - { - return (m_colorDepthCombo->currentIndex () == 1 || - m_colorDepthCombo->currentIndex () == 3); - } - else - { - return m_baseDocumentSaveOptions.dither (); - } -} - -// protected static -int kpDocumentSaveOptionsWidget::colorDepthComboItemFromColorDepthAndDither ( - int depth, bool dither) -{ - if (depth == 1) - { - if (!dither) - { - return 0; - } - else - { - return 1; - } - } - else if (depth == 8) - { - if (!dither) - { - return 2; - } - else - { - return 3; - } - } - else if (depth == 32) - { - return 4; - } - else - { - return -1; - } -} - -// public slots -void kpDocumentSaveOptionsWidget::setColorDepthDither (int newDepth, bool newDither) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::setColorDepthDither(" - << "depth=" << newDepth - << ",dither=" << newDither - << ")" << endl; -#endif - - m_baseDocumentSaveOptions.setColorDepth (newDepth); - m_baseDocumentSaveOptions.setDither (newDither); - - - const int comboItem = colorDepthComboItemFromColorDepthAndDither ( - newDepth, newDither); - // TODO: Ignoring when comboItem >= m_colorDepthCombo->count() is wrong. - // This happens if this mimeType has configurable colour depth - // and an incorrect maximum colour depth (less than a QImage of - // this mimeType, opened by kpDocument). - if (comboItem >= 0 && comboItem < m_colorDepthCombo->count ()) - m_colorDepthCombo->setCurrentIndex (comboItem); - - - slotColorDepthSelected (); -} - - -// protected slot -void kpDocumentSaveOptionsWidget::slotColorDepthSelected () -{ - if (mode () & ColorDepth) - { - m_colorDepthComboLastSelectedItem = m_colorDepthCombo->currentIndex (); - } - else - { - m_colorDepthComboLastSelectedItem = - colorDepthComboItemFromColorDepthAndDither ( - m_baseDocumentSaveOptions.colorDepth (), - m_baseDocumentSaveOptions.dither ()); - } - -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::slotColorDepthSelected()" - << " mode&ColorDepth=" << (mode () & ColorDepth) - << " colorDepthComboLastSelectedItem=" - << m_colorDepthComboLastSelectedItem - << endl; -#endif -} - - -// public -int kpDocumentSaveOptionsWidget::quality () const -{ - if (mode () & Quality) - { - return m_qualityInput->value (); - } - else - { - return m_baseDocumentSaveOptions.quality (); - } -} - -// public -void kpDocumentSaveOptionsWidget::setQuality (int newQuality) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::setQuality(" - << newQuality << ")" << endl; -#endif - - m_baseDocumentSaveOptions.setQuality (newQuality); - m_qualityInput->setValue (newQuality == -1/*QImage::save() default*/ ? - 75 : - newQuality); -} - - -// public -kpDocumentSaveOptions kpDocumentSaveOptionsWidget::documentSaveOptions () const -{ - return kpDocumentSaveOptions (mimeType (), colorDepth (), dither (), quality ()); -} - -// public -void kpDocumentSaveOptionsWidget::setDocumentSaveOptions ( - const kpDocumentSaveOptions &saveOptions) -{ - setMimeType (saveOptions.mimeType ()); - setColorDepthDither (saveOptions.colorDepth (), saveOptions.dither ()); - setQuality (saveOptions.quality ()); -} - - -// public -void kpDocumentSaveOptionsWidget::setDocumentPixmap (const QImage &documentPixmap) -{ - delete m_documentPixmap; - m_documentPixmap = new QImage (documentPixmap); - - updatePreview (); -} - -// public -void kpDocumentSaveOptionsWidget::setDocumentMetaInfo ( - const kpDocumentMetaInfo &metaInfo) -{ - m_documentMetaInfo = metaInfo; - - updatePreview (); -} - - -// public -kpDocumentSaveOptionsWidget::Mode kpDocumentSaveOptionsWidget::mode () const -{ - return m_mode; -} - -// public -void kpDocumentSaveOptionsWidget::setMode (Mode mode) -{ - m_mode = mode; - - - // If mode == None, we show still show the Color Depth widgets but disabled - m_colorDepthLabel->setVisible (mode != Quality); - m_colorDepthCombo->setVisible (mode != Quality); - m_colorDepthSpaceWidget->setVisible (mode != Quality); - - m_qualityLabel->setVisible (mode == Quality); - m_qualityInput->setVisible (mode == Quality); - - - m_colorDepthLabel->setEnabled (mode == ColorDepth); - m_colorDepthCombo->setEnabled (mode == ColorDepth); - - m_qualityLabel->setEnabled (mode == Quality); - m_qualityInput->setEnabled (mode == Quality); - - - // SYNC: HACK: When changing between color depth and quality widgets, - // we change the height of "this", causing the text on the labels - // to move but the first instance of the text doesn't get erased. - // Qt bug. - QTimer::singleShot (0, this, SLOT (repaintLabels ())); -} - -// protected slot -void kpDocumentSaveOptionsWidget::repaintLabels () -{ - if (mode () != Quality) - m_colorDepthLabel->repaint (); - if (mode () == Quality) - m_qualityLabel->repaint (); -} - - -// protected slot -void kpDocumentSaveOptionsWidget::showPreview (bool yes) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::showPreview(" << yes << ")" - << " m_previewDialog=" << bool (m_previewDialog) - << endl; -#endif - - if (yes == bool (m_previewDialog)) - return; - - if (!m_visualParent) - return; - - if (yes) - { - m_previewDialog = new kpDocumentSaveOptionsPreviewDialog( m_visualParent ); - m_previewDialog->setObjectName( QLatin1String( "previewSaveDialog" ) ); - updatePreview (); - - connect (m_previewDialog, SIGNAL (finished ()), - this, SLOT (hidePreview ())); - - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupPreviewSave); - - if (cfg.hasKey (kpSettingPreviewSaveUpdateDelay)) - { - m_updatePreviewDelay = cfg.readEntry (kpSettingPreviewSaveUpdateDelay, 0); - } - else - { - cfg.writeEntry (kpSettingPreviewSaveUpdateDelay, m_updatePreviewDelay); - cfg.sync (); - } - - if (m_updatePreviewDelay < 0) - m_updatePreviewDelay = 0; - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tread cfg preview dialog update delay=" - << m_updatePreviewDelay - << endl; - #endif - - - if (m_previewDialogLastRelativeGeometry.isEmpty ()) - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tread cfg preview dialog last rel geometry"; - #endif - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupPreviewSave); - - m_previewDialogLastRelativeGeometry = cfg.readEntry ( - kpSettingPreviewSaveGeometry, QRect ()); - } - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tpreviewDialogLastRelativeGeometry=" - << m_previewDialogLastRelativeGeometry - << " visualParent->rect()=" << m_visualParent->rect () - << endl; - #endif - - QRect relativeGeometry; - if (!m_previewDialogLastRelativeGeometry.isEmpty () && - m_visualParent->rect ().intersects (m_previewDialogLastRelativeGeometry)) - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tok"; - #endif - relativeGeometry = m_previewDialogLastRelativeGeometry; - } - else - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\t\tinvalid"; - #endif - const int margin = 20; - - relativeGeometry = - QRect (m_visualParent->width () - - m_previewDialog->preferredMinimumSize ().width () - - margin, - margin * 2, // Avoid folder combo - m_previewDialog->preferredMinimumSize ().width (), - m_previewDialog->preferredMinimumSize ().height ()); - } - - - const QRect globalGeometry = - kpWidgetMapper::toGlobal (m_visualParent, - relativeGeometry); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\trelativeGeometry=" << relativeGeometry - << " globalGeometry=" << globalGeometry - << endl; - #endif - - m_previewDialog->resize (globalGeometry.size ()); - m_previewDialog->move (globalGeometry.topLeft ()); - - - m_previewDialog->show (); - - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tgeometry after show=" - << QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ()) - << endl; - #endif - - updatePreviewDialogLastRelativeGeometry (); - - connect (m_previewDialog, SIGNAL (moved ()), - this, SLOT (updatePreviewDialogLastRelativeGeometry ())); - connect (m_previewDialog, SIGNAL (resized ()), - this, SLOT (updatePreviewDialogLastRelativeGeometry ())); - - m_updatePreviewDialogLastRelativeGeometryTimer->start (200/*ms*/); - } - else - { - m_updatePreviewDialogLastRelativeGeometryTimer->stop (); - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupPreviewSave); - - cfg.writeEntry (kpSettingPreviewSaveGeometry, m_previewDialogLastRelativeGeometry); - cfg.sync (); - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tsaving preview geometry " - << m_previewDialogLastRelativeGeometry - << " (Qt would have us believe " - << kpWidgetMapper::fromGlobal (m_visualParent, - QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ())) - << ")" - << endl; - #endif - - m_previewDialog->deleteLater (); - m_previewDialog = 0; - } -} - -// protected slot -void kpDocumentSaveOptionsWidget::hidePreview () -{ - if (m_previewButton->isChecked ()) - m_previewButton->toggle (); -} - - -// protected slot -void kpDocumentSaveOptionsWidget::updatePreviewDelayed () -{ - // (single shot) - m_updatePreviewTimer->start (m_updatePreviewDelay); -} - -// protected slot -void kpDocumentSaveOptionsWidget::updatePreview () -{ - if (!m_previewDialog || !m_documentPixmap) - return; - - - m_updatePreviewTimer->stop (); - - - QApplication::setOverrideCursor (Qt::WaitCursor); - - QByteArray data; - - QBuffer buffer (&data); - buffer.open (QIODevice::WriteOnly); - bool savedOK = kpDocument::savePixmapToDevice (*m_documentPixmap, - &buffer, - documentSaveOptions (), - m_documentMetaInfo, - false/*no lossy prompt*/, - this); - buffer.close (); - - - QImage image; - - // Ignore any failed saves. - // - // Failed saves might literally have written half a file. The final - // save (when the user clicks OK), _will_ fail so we shouldn't have a - // preview even if this "half a file" is actually loadable by - // QImage::loadFormData(). - if (savedOK) - { - const QStringList types = KImageIO::typeForMime (mimeType ()); - // kpDocument::savePixmapToDevice() would have failed otherwise. - Q_ASSERT (!types.isEmpty ()); - - // It's safe to arbitrarily choose the 0th type as any type in the list - // should invoke the same KImageIO image loader. - image.loadFromData (data, types [0].toLatin1 ()); - } - else - { - // Leave as invalid. - // TODO: This code path has not been well tested. - // Will we trigger divide by zero errors in "m_previewDialog"? - } - - // REFACTOR: merge with kpDocument::getPixmapFromFile() - m_previewDialog->setFilePixmapAndSize (image, data.size ()); - - QApplication::restoreOverrideCursor (); -} - -// protected slot -void kpDocumentSaveOptionsWidget::updatePreviewDialogLastRelativeGeometry () -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "kpDocumentSaveOptionsWidget::" - << "updatePreviewDialogLastRelativeGeometry()" - << endl; -#endif - - if (m_previewDialog && m_previewDialog->isVisible ()) - { - m_previewDialogLastRelativeGeometry = - kpWidgetMapper::fromGlobal (m_visualParent, - QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ())); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tcaching pos = " - << m_previewDialogLastRelativeGeometry - << endl; - #endif - } - else - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - kDebug () << "\tnot visible - ignoring geometry"; - #endif - } -} - - -#include "moc_kpDocumentSaveOptionsWidget.cpp" diff --git a/kolourpaint/widgets/kpDocumentSaveOptionsWidget.h b/kolourpaint/widgets/kpDocumentSaveOptionsWidget.h deleted file mode 100644 index abe769c7..00000000 --- a/kolourpaint/widgets/kpDocumentSaveOptionsWidget.h +++ /dev/null @@ -1,157 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentSaveOptionsWidget_H -#define kpDocumentSaveOptionsWidget_H - - -#include -#include -#include - -#include -#include - - -class KComboBox; -#include -#include -#include - -class KIntNumInput; -class KPushButton; - -class kpDocumentSaveOptionsPreviewDialog; - - -class kpDocumentSaveOptionsWidget : public QWidget -{ -Q_OBJECT - -public: - kpDocumentSaveOptionsWidget (const QImage &docPixmap, - const kpDocumentSaveOptions &saveOptions, - const kpDocumentMetaInfo &metaInfo, - QWidget *parent); - kpDocumentSaveOptionsWidget (QWidget *parent); -private: - void init (); -public: - virtual ~kpDocumentSaveOptionsWidget (); - - - // is usually the filedialog - void setVisualParent (QWidget *visualParent); - - -protected: - bool mimeTypeHasConfigurableColorDepth () const; - bool mimeTypeHasConfigurableQuality () const; - -public: - QString mimeType () const; -public slots: - void setMimeType (const QString &string); - -public: - int colorDepth () const; - bool dither () const; -protected: - static int colorDepthComboItemFromColorDepthAndDither (int depth, bool dither); -public slots: - void setColorDepthDither (int depth, - bool dither = kpDocumentSaveOptions::initialDither ()); -protected slots: - void slotColorDepthSelected (); - -public: - int quality () const; -public slots: - void setQuality (int newQuality); - -public: - kpDocumentSaveOptions documentSaveOptions () const; -public slots: - void setDocumentSaveOptions (const kpDocumentSaveOptions &saveOptions); - - -public: - void setDocumentPixmap (const QImage &documentPixmap); - void setDocumentMetaInfo (const kpDocumentMetaInfo &metaInfo); - - -protected: - enum Mode - { - // (mutually exclusive) - None, ColorDepth, Quality - }; - - Mode mode () const; - void setMode (Mode mode); - -protected slots: - void repaintLabels (); - - -protected slots: - void showPreview (bool yes = true); - void hidePreview (); - void updatePreviewDelayed (); - void updatePreview (); - void updatePreviewDialogLastRelativeGeometry (); - - -protected: - QWidget *m_visualParent; - - Mode m_mode; - - QImage *m_documentPixmap; - - kpDocumentSaveOptions m_baseDocumentSaveOptions; - kpDocumentMetaInfo m_documentMetaInfo; - - QLabel *m_colorDepthLabel; - KComboBox *m_colorDepthCombo; - int m_colorDepthComboLastSelectedItem; - QWidget *m_colorDepthSpaceWidget; - - QLabel *m_qualityLabel; - KIntNumInput *m_qualityInput; - - KPushButton *m_previewButton; - kpDocumentSaveOptionsPreviewDialog *m_previewDialog; - QRect m_previewDialogLastRelativeGeometry; - QTimer *m_updatePreviewTimer; - int m_updatePreviewDelay; - QTimer *m_updatePreviewDialogLastRelativeGeometryTimer; -}; - - -#endif // kpDocumentSaveOptionsWidget_H diff --git a/kolourpaint/widgets/kpDualColorButton.cpp b/kolourpaint/widgets/kpDualColorButton.cpp deleted file mode 100644 index 5c53a64a..00000000 --- a/kolourpaint/widgets/kpDualColorButton.cpp +++ /dev/null @@ -1,464 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_DUAL_COLOR_BUTTON 0 - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpDualColorButton::kpDualColorButton (QWidget *parent) - : QFrame (parent), - m_dragStartPoint (KP_INVALID_POINT) -{ - setSizePolicy (QSizePolicy::Fixed/*horizontal*/, - QSizePolicy::Fixed/*vertical*/); - setFrameStyle (QFrame::Panel | QFrame::Sunken); - - m_color [0] = kpColor (0, 0, 0); // black - m_color [1] = kpColor (255, 255, 255); // white - - setAcceptDrops (true); -} - -//--------------------------------------------------------------------- - -kpColor kpDualColorButton::color (int which) const -{ - Q_ASSERT (which == 0 || which == 1); - - return m_color [which]; -} - -//--------------------------------------------------------------------- - -kpColor kpDualColorButton::foregroundColor () const -{ - return color (0); -} - -//--------------------------------------------------------------------- - -kpColor kpDualColorButton::backgroundColor () const -{ - return color (1); -} - -//--------------------------------------------------------------------- - -void kpDualColorButton::setColor (int which, const kpColor &color) -{ - Q_ASSERT (which == 0 || which == 1); - - if (m_color [which] == color) - return; - - m_oldColor [which] = m_color [which]; - m_color [which] = color; - update (); - - if (which == 0) - emit foregroundColorChanged (color); - else - emit backgroundColorChanged (color); -} - -//--------------------------------------------------------------------- - -void kpDualColorButton::setForegroundColor (const kpColor &color) -{ - setColor (0, color); -} - -//--------------------------------------------------------------------- - -void kpDualColorButton::setBackgroundColor (const kpColor &color) -{ - setColor (1, color); -} - -//--------------------------------------------------------------------- - - -// public -kpColor kpDualColorButton::oldForegroundColor () const -{ - return m_oldColor [0]; -} - -//--------------------------------------------------------------------- - -// public -kpColor kpDualColorButton::oldBackgroundColor () const -{ - return m_oldColor [1]; -} - -//--------------------------------------------------------------------- - - -// public virtual [base QWidget] -QSize kpDualColorButton::sizeHint () const -{ - return QSize (52, 52); -} - -//--------------------------------------------------------------------- - - -// protected -QRect kpDualColorButton::swapPixmapRect () const -{ - QPixmap swapPixmap = UserIcon ("colorbutton_swap_16x16"); - - return QRect (contentsRect ().width () - swapPixmap.width (), - 0, - swapPixmap.width (), - swapPixmap.height ()); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpDualColorButton::foregroundBackgroundRect () const -{ - QRect cr (contentsRect ()); - return QRect (cr.width () / 8, - cr.height () / 8, - cr.width () * 6 / 8, - cr.height () * 6 / 8); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpDualColorButton::foregroundRect () const -{ - QRect fbr (foregroundBackgroundRect ()); - return QRect (fbr.x (), - fbr.y (), - fbr.width () * 3 / 4, - fbr.height () * 3 / 4); -} - -//--------------------------------------------------------------------- - -// protected -QRect kpDualColorButton::backgroundRect () const -{ - QRect fbr (foregroundBackgroundRect ()); - return QRect (fbr.x () + fbr.width () / 4, - fbr.y () + fbr.height () / 4, - fbr.width () * 3 / 4, - fbr.height () * 3 / 4); -} - -//--------------------------------------------------------------------- - - -// protected virtual -void kpDualColorButton::dragEnterEvent (QDragEnterEvent *e) -{ -#if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "kpDualColorButton::dragEnterEvent() canDecode=" - << KColorMimeData::canDecode (e->mimeData ()) - << endl; -#endif - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpDualColorButton::dragMoveEvent (QDragMoveEvent *e) -{ -#if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "kpDualColorButton::dragMoveEvent() canDecode=" - << KColorMimeData::canDecode (e->mimeData ()) - << endl; -#endif - e->setAccepted ( - (foregroundRect ().contains (e->pos ()) || - backgroundRect ().contains (e->pos ())) && - KColorMimeData::canDecode (e->mimeData ())); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpDualColorButton::dropEvent (QDropEvent *e) -{ - QColor col = KColorMimeData::fromMimeData (e->mimeData ()); -#if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "kpDualColorButton::dropEvent() col=" - << (int *) col.rgba() - << " (with alpha=" << (int *) col.rgba () << ")" << endl; -#endif - - if (col.isValid ()) - { - if (foregroundRect ().contains (e->pos ())) - setForegroundColor (kpColor (col.rgba())); - else if (backgroundRect ().contains (e->pos ())) - setBackgroundColor (kpColor (col.rgba())); - } -} - -//--------------------------------------------------------------------- - - -// protected virtual [base QWidget] -void kpDualColorButton::mousePressEvent (QMouseEvent *e) -{ -#if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "kpDualColorButton::mousePressEvent() pos=" << e->pos (); -#endif - - m_dragStartPoint = KP_INVALID_POINT; - - if (e->button () == Qt::LeftButton) - m_dragStartPoint = e->pos (); -} - -//--------------------------------------------------------------------- - -void kpDualColorButton::mouseMoveEvent (QMouseEvent *e) -{ -#if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "kpDualColorButton::mouseMoveEvent() pos=" << e->pos () - << " buttons=" << e->buttons () - << " dragStartPoint=" << m_dragStartPoint << endl; -#endif - - if (m_dragStartPoint == KP_INVALID_POINT) - return; - - if (!(e->buttons () & Qt::LeftButton)) - { - m_dragStartPoint = KP_INVALID_POINT; - return; - } - - const int delay = KGlobalSettings::dndEventDelay (); - if (e->x () < m_dragStartPoint.x () - delay || - e->x () > m_dragStartPoint.x () + delay || - e->y () < m_dragStartPoint.y () - delay || - e->y () > m_dragStartPoint.y () + delay) - { - #if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "\tstarting drag as long as it's in a rectangle"; - #endif - - kpColor color; - - if (foregroundRect ().contains (m_dragStartPoint)) - color = foregroundColor (); - else if (backgroundRect ().contains (m_dragStartPoint)) - color = backgroundColor (); - else - { - // "color" is left as invalid. - } - - #if DEBUG_KP_DUAL_COLOR_BUTTON - kDebug () << "\tcolor.isValid=" << color.isValid () - << " rgb=" << (color.isValid () ? (int *) color.toQRgb () : 0) - << endl; - #endif - - if (color.isValid ()) - { - if (!color.isTransparent ()) - KColorMimeData::createDrag (color.toQColor (), this)->exec (); - } - - m_dragStartPoint = KP_INVALID_POINT; - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpDualColorButton::mouseReleaseEvent (QMouseEvent *e) -{ - m_dragStartPoint = KP_INVALID_POINT; - - if (swapPixmapRect ().contains (e->pos ()) && - m_color [0] != m_color [1]) - { - #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 - kDebug () << "kpDualColorButton::mouseReleaseEvent() swap colors:"; - #endif - m_oldColor [0] = m_color [0]; - m_oldColor [1] = m_color [1]; - - kpColor temp = m_color [0]; - m_color [0] = m_color [1]; - m_color [1] = temp; - - update (); - - emit colorsSwapped (m_color [0], m_color [1]); - emit foregroundColorChanged (m_color [0]); - emit backgroundColorChanged (m_color [1]); - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpDualColorButton::mouseDoubleClickEvent (QMouseEvent *e) -{ - int whichColor = -1; - - if (foregroundRect ().contains (e->pos ())) - whichColor = 0; - else if (backgroundRect ().contains (e->pos ())) - whichColor = 1; - - if (whichColor == 0 || whichColor == 1) - { - KColorDialog dialog(this); - dialog.setColor(color(whichColor).toQColor()); - dialog.setAlphaChannelEnabled(true); - dialog.setButtons(KDialog::Ok | KDialog::Cancel); - if ( dialog.exec() == QDialog::Accepted ) - setColor(whichColor, kpColor(dialog.color().rgba())); - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpDualColorButton::paintEvent (QPaintEvent *e) -{ -#if DEBUG_KP_DUAL_COLOR_BUTTON && 1 - kDebug () << "kpDualColorButton::draw() rect=" << rect () - << " contentsRect=" << contentsRect () - << endl; -#endif - - // Draw frame first. - QFrame::paintEvent (e); - - QPainter painter (this); - - // Fill with background. - if (isEnabled ()) - { - kpView::drawTransparentBackground (&painter, - contentsRect ().topLeft ()/*checkerboard top-left*/, - contentsRect (), - true/*preview*/); - } - else - { - // Use default widget background. - } - - - painter.translate (contentsRect ().x (), contentsRect ().y ()); - - - // Draw "Swap Colours" button (top-right). - QPixmap swapPixmap = UserIcon ("colorbutton_swap_16x16"); - if (!isEnabled ()) - { - // Don't let the fill() touch the mask. - QBitmap swapBitmapMask = swapPixmap.mask (); - swapPixmap.setMask (QBitmap ()); - - // Grey out the opaque parts of "swapPixmap". - swapPixmap.fill (palette ().color (QPalette::Dark)); - - swapPixmap.setMask (swapBitmapMask); - } - painter.drawPixmap (swapPixmapRect ().topLeft (), swapPixmap); - - - // Draw background colour patch. - QRect bgRect = backgroundRect (); - QRect bgRectInside = QRect (bgRect.x () + 2, bgRect.y () + 2, - bgRect.width () - 4, bgRect.height () - 4); - if (isEnabled ()) - { - #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 - kDebug () << "\tbackgroundColor=" << (int *) m_color [1].toQRgb () - << endl; - #endif - if (m_color [1].isTransparent ()) // only if fully transparent - painter.drawPixmap (bgRectInside, UserIcon ("color_transparent_26x26")); - else - painter.fillRect (bgRectInside, m_color [1].toQColor ()); - } - else - painter.fillRect (bgRectInside, palette().color (QPalette::Button)); - qDrawShadePanel (&painter, bgRect, palette(), - false/*not sunken*/, 2/*lineWidth*/, - 0/*never fill*/); - - - // Draw foreground colour patch. - // Must be drawn after background patch since we're on top. - QRect fgRect = foregroundRect (); - QRect fgRectInside = QRect (fgRect.x () + 2, fgRect.y () + 2, - fgRect.width () - 4, fgRect.height () - 4); - if (isEnabled ()) - { - #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 - kDebug () << "\tforegroundColor=" << (int *) m_color [0].toQRgb () - << endl; - #endif - if (m_color [0].isTransparent ()) // only if fully transparent - painter.drawPixmap (fgRectInside, UserIcon ("color_transparent_26x26")); - else - painter.fillRect (fgRectInside, m_color [0].toQColor ()); - } - else - painter.fillRect (fgRectInside, palette ().color (QPalette::Button)); - - qDrawShadePanel (&painter, fgRect, palette (), - false/*not sunken*/, 2/*lineWidth*/, - 0/*never fill*/); -} - - -#include "moc_kpDualColorButton.cpp" diff --git a/kolourpaint/widgets/kpDualColorButton.h b/kolourpaint/widgets/kpDualColorButton.h deleted file mode 100644 index 65000652..00000000 --- a/kolourpaint/widgets/kpDualColorButton.h +++ /dev/null @@ -1,96 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDualColorButton_H -#define kpDualColorButton_H - - -#include - -#include - - -class kpDualColorButton : public QFrame -{ -Q_OBJECT - -public: - kpDualColorButton (QWidget *parent); - - kpColor color (int which) const; - kpColor foregroundColor () const; - kpColor backgroundColor () const; - -public slots: - void setColor (int which, const kpColor &color); - void setForegroundColor (const kpColor &color); - void setBackgroundColor (const kpColor &color); - -signals: - // If you connect to this signal, ignore the following - // foregroundColorChanged() and backgroundColorChanged() signals - void colorsSwapped (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor); - - void foregroundColorChanged (const kpColor &color); - void backgroundColorChanged (const kpColor &color); - -public: - // (only valid in slots connected to foregroundColorChanged()) - kpColor oldForegroundColor () const; - // (only valid in slots connected to backgroundColorChanged()) - kpColor oldBackgroundColor () const; - -public: - virtual QSize sizeHint () const; - -protected: - QRect swapPixmapRect () const; - QRect foregroundBackgroundRect () const; - QRect foregroundRect () const; - QRect backgroundRect () const; - - virtual void dragEnterEvent (QDragEnterEvent *e); - virtual void dragMoveEvent (QDragMoveEvent *e); - virtual void dropEvent (QDropEvent *e); - - virtual void mousePressEvent (QMouseEvent *e); - virtual void mouseMoveEvent (QMouseEvent *e); - virtual void mouseReleaseEvent (QMouseEvent *e); - - virtual void mouseDoubleClickEvent (QMouseEvent *e); - - virtual void paintEvent (QPaintEvent *e); - - QPoint m_dragStartPoint; - kpColor m_color [2]; - kpColor m_oldColor [2]; -}; - - -#endif // kpDualColorButton_H diff --git a/kolourpaint/widgets/kpPrintDialogPage.cpp b/kolourpaint/widgets/kpPrintDialogPage.cpp deleted file mode 100644 index acc05687..00000000 --- a/kolourpaint/widgets/kpPrintDialogPage.cpp +++ /dev/null @@ -1,101 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2007 John Layt - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_PRINT_DIALOG_PAGE 0 - - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include - - -struct kpPrintDialogPagePrivate -{ - QRadioButton *printCenteredRadio, *printTopLeftRadio; -}; - -kpPrintDialogPage::kpPrintDialogPage (QWidget *parent) - : QWidget (parent), - d (new kpPrintDialogPagePrivate ()) -{ -#if DEBUG_KP_PRINT_DIALOG_PAGE - kDebug () << "kpPrintDialogPage::()"; -#endif - - setWindowTitle (i18nc ("@title:tab", "I&mage Position")); - - KVBox *base = new KVBox (this); - base->setMargin (KDialog::marginHint ()); - - d->printCenteredRadio = new QRadioButton (i18n ("&Center of the page"), - base); - d->printTopLeftRadio = new QRadioButton (i18n ("Top-&left of the page"), - base); - - setPrintImageCenteredOnPage (true); -} - -kpPrintDialogPage::~kpPrintDialogPage () -{ - delete d; -} - - -bool kpPrintDialogPage::printImageCenteredOnPage () -{ -#if DEBUG_KP_PRINT_DIALOG_PAGE - kDebug () << "kpPrintDialogPage::printImageCenteredOnPage()" - << " returning " << d->printCenteredRadio->isChecked() << endl; -#endif - return d->printCenteredRadio->isChecked (); -} - - -void kpPrintDialogPage::setPrintImageCenteredOnPage (bool printCentered) -{ -#if DEBUG_KP_PRINT_DIALOG_PAGE - kDebug () << "kpPrintDialogPage::setOptions(" << printCentered << ")"; -#endif - if (printCentered) - d->printCenteredRadio->setChecked (true); - else - d->printTopLeftRadio->setChecked (true); -} - - -#include "moc_kpPrintDialogPage.cpp" diff --git a/kolourpaint/widgets/kpPrintDialogPage.h b/kolourpaint/widgets/kpPrintDialogPage.h deleted file mode 100644 index beb16cf2..00000000 --- a/kolourpaint/widgets/kpPrintDialogPage.h +++ /dev/null @@ -1,52 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2007 John Layt - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpPrintDialogPage_H -#define kpPrintDialogPage_H - -#include - - -class kpPrintDialogPage : public QWidget -{ -Q_OBJECT - -public: - kpPrintDialogPage (QWidget *parent); - virtual ~kpPrintDialogPage (); - - bool printImageCenteredOnPage (); - void setPrintImageCenteredOnPage (bool printCentered); - -private: - struct kpPrintDialogPagePrivate * const d; -}; - - -#endif // kpPrintDialogPage_H diff --git a/kolourpaint/widgets/kpTransparentColorCell.cpp b/kolourpaint/widgets/kpTransparentColorCell.cpp deleted file mode 100644 index 60ef9238..00000000 --- a/kolourpaint/widgets/kpTransparentColorCell.cpp +++ /dev/null @@ -1,129 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TRANSPARENT_COLOR_CELL 0 - - -#include - -#include - -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -kpTransparentColorCell::kpTransparentColorCell (QWidget *parent) - : QFrame (parent) -{ - setSizePolicy (QSizePolicy::Fixed/*horizontal*/, - QSizePolicy::Fixed/*vertical*/); - setFrameStyle (QFrame::Panel | QFrame::Sunken); - - m_pixmap = UserIcon ("color_transparent_26x26"); - - this->setToolTip( i18n ("Transparent")); -} - -//--------------------------------------------------------------------- - -// public virtual [base QWidget] -QSize kpTransparentColorCell::sizeHint () const -{ - return QSize (m_pixmap.width () + frameWidth () * 2, - m_pixmap.height () + frameWidth () * 2); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpTransparentColorCell::mousePressEvent (QMouseEvent * /*e*/) -{ - // Eat press so that we own the mouseReleaseEvent(). - // [http://blogs.qtdeveloper.net/archives/2006/05/27/mouse-event-propagation/] - // - // However, contrary to that blog, it doesn't seem to be needed? -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpTransparentColorCell::contextMenuEvent (QContextMenuEvent *e) -{ - // Eat right-mouse press to prevent it from getting to the toolbar. - e->accept (); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpTransparentColorCell::mouseReleaseEvent (QMouseEvent *e) -{ - if (rect ().contains (e->pos ())) - { - if (e->button () == Qt::LeftButton) - { - emit transparentColorSelected (0); - emit foregroundColorChanged (kpColor::Transparent); - } - else if (e->button () == Qt::RightButton) - { - emit transparentColorSelected (1); - emit backgroundColorChanged (kpColor::Transparent); - } - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpTransparentColorCell::paintEvent (QPaintEvent *e) -{ - // Draw frame first. - QFrame::paintEvent (e); - - if (isEnabled ()) - { - #if DEBUG_KP_TRANSPARENT_COLOR_CELL - kDebug () << "kpTransparentColorCell::paintEvent() contentsRect=" - << contentsRect () - << endl; - #endif - QPainter p (this); - p.drawPixmap (contentsRect (), m_pixmap); - } -} - -//--------------------------------------------------------------------- - - -#include "moc_kpTransparentColorCell.cpp" diff --git a/kolourpaint/widgets/kpTransparentColorCell.h b/kolourpaint/widgets/kpTransparentColorCell.h deleted file mode 100644 index 31396036..00000000 --- a/kolourpaint/widgets/kpTransparentColorCell.h +++ /dev/null @@ -1,66 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpTransparentColorCell_H -#define kpTransparentColorCell_H - - -#include - - -class kpColor; - - -class kpTransparentColorCell : public QFrame -{ -Q_OBJECT - -public: - kpTransparentColorCell (QWidget *parent); - - virtual QSize sizeHint () const; - -signals: - void transparentColorSelected (int mouseButton); - - // lazy - void foregroundColorChanged (const kpColor &color); - void backgroundColorChanged (const kpColor &color); - -protected: - virtual void mousePressEvent (QMouseEvent *e); - virtual void contextMenuEvent (QContextMenuEvent *e); - virtual void mouseReleaseEvent (QMouseEvent *e); - - virtual void paintEvent (QPaintEvent *e); - - QPixmap m_pixmap; -}; - - -#endif // kpTransparentColorCell_H diff --git a/kolourpaint/widgets/toolbars/kpColorToolBar.cpp b/kolourpaint/widgets/toolbars/kpColorToolBar.cpp deleted file mode 100644 index 891d6237..00000000 --- a/kolourpaint/widgets/toolbars/kpColorToolBar.cpp +++ /dev/null @@ -1,329 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_COLOR_TOOL_BAR 0 - - -#include - -#include -#include - - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpColorToolBar::kpColorToolBar (const QString &label, QWidget *parent) - : QDockWidget (parent) -{ - setWindowTitle (label); - - // not closable, as it's not a KDE toolbar yet and can not be made shown easily again - setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); - - setAcceptDrops (true); - - QWidget *base = new QWidget (this); - m_boxLayout = new QBoxLayout (QBoxLayout::LeftToRight, base); - m_boxLayout->setMargin (5); - m_boxLayout->setSpacing (10 * 3); - - // This holds the current global foreground and background colors, for - // tools. - m_dualColorButton = new kpDualColorButton (base); - connect (m_dualColorButton, SIGNAL (colorsSwapped (const kpColor &, const kpColor &)), - this, SIGNAL (colorsSwapped (const kpColor &, const kpColor &))); - connect (m_dualColorButton, SIGNAL (foregroundColorChanged (const kpColor &)), - this, SIGNAL (foregroundColorChanged (const kpColor &))); - connect (m_dualColorButton, SIGNAL (backgroundColorChanged (const kpColor &)), - this, SIGNAL (backgroundColorChanged (const kpColor &))); - m_boxLayout->addWidget (m_dualColorButton, 0/*stretch*/, Qt::AlignVCenter); - - m_colorPalette = new kpColorPalette (base); - connect (m_colorPalette, SIGNAL (foregroundColorChanged (const kpColor &)), - m_dualColorButton, SLOT (setForegroundColor (const kpColor &))); - connect (m_colorPalette, SIGNAL (backgroundColorChanged (const kpColor &)), - m_dualColorButton, SLOT (setBackgroundColor (const kpColor &))); - - connect (m_colorPalette->colorCells (), SIGNAL (isModifiedChanged (bool)), - SLOT (updateNameOrUrlLabel ())); - connect (m_colorPalette->colorCells (), SIGNAL (urlChanged (const KUrl &)), - SLOT (updateNameOrUrlLabel ())); - connect (m_colorPalette->colorCells (), SIGNAL (nameChanged (const QString &)), - SLOT (updateNameOrUrlLabel ())); - updateNameOrUrlLabel (); - - m_boxLayout->addWidget (m_colorPalette, 0/*stretch*/); - - m_colorSimilarityToolBarItem = new kpColorSimilarityToolBarItem (base); - connect (m_colorSimilarityToolBarItem, SIGNAL (colorSimilarityChanged (double, int)), - this, SIGNAL (colorSimilarityChanged (double, int))); - m_boxLayout->addWidget (m_colorSimilarityToolBarItem, 0/*stretch*/); - - // Pad out all the horizontal space on the right of the Color Tool Bar so that - // that the real Color Tool Bar widgets aren't placed in the center of the - // Color Tool Bar. - m_boxLayout->addItem ( - new QSpacerItem (1, 1, QSizePolicy::Expanding, QSizePolicy::Preferred)); - - adjustToOrientation (Qt::Horizontal); - - setWidget (base); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::adjustToOrientation (Qt::Orientation o) -{ -#if DEBUG_KP_COLOR_TOOL_BAR - kDebug () << "kpColorToolBar::adjustToOrientation(" - << (o == Qt::Vertical ? "vertical" : "horizontal") - << ") called!"; -#endif - - Q_ASSERT (o == Qt::Horizontal); - - if (o == Qt::Horizontal) - { - m_boxLayout->setDirection (QBoxLayout::LeftToRight); - } - else - { - m_boxLayout->setDirection (QBoxLayout::TopToBottom); - } - - m_colorPalette->setOrientation (o); -} - -//--------------------------------------------------------------------- - -// public -kpColorCells *kpColorToolBar::colorCells () const -{ - return m_colorPalette->colorCells (); -} - -//--------------------------------------------------------------------- - -kpColor kpColorToolBar::color (int which) const -{ - Q_ASSERT (which == 0 || which == 1); - - return m_dualColorButton->color (which); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::setColor (int which, const kpColor &color) -{ - Q_ASSERT (which == 0 || which == 1); - - m_dualColorButton->setColor (which, color); -} - -//--------------------------------------------------------------------- - -kpColor kpColorToolBar::foregroundColor () const -{ - return m_dualColorButton->foregroundColor (); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::setForegroundColor (const kpColor &color) -{ -#if DEBUG_KP_COLOR_TOOL_BAR - kDebug () << "kpColorToolBar::setForegroundColor(" - << (int *) color.toQRgb () << ")" << endl; -#endif - m_dualColorButton->setForegroundColor (color); -} - -//--------------------------------------------------------------------- - -kpColor kpColorToolBar::backgroundColor () const -{ - return m_dualColorButton->backgroundColor (); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::setBackgroundColor (const kpColor &color) -{ -#if DEBUG_KP_COLOR_TOOL_BAR - kDebug () << "kpColorToolBar::setBackgroundColor(" - << (int *) color.toQRgb () << ")" << endl; -#endif - m_dualColorButton->setBackgroundColor (color); -} - -//--------------------------------------------------------------------- - - -kpColor kpColorToolBar::oldForegroundColor () const -{ - return m_dualColorButton->oldForegroundColor (); -} - -//--------------------------------------------------------------------- - -kpColor kpColorToolBar::oldBackgroundColor () const -{ - return m_dualColorButton->oldBackgroundColor (); -} - -//--------------------------------------------------------------------- - -double kpColorToolBar::oldColorSimilarity () const -{ - return m_colorSimilarityToolBarItem->oldColorSimilarity (); -} - -//--------------------------------------------------------------------- - -double kpColorToolBar::colorSimilarity () const -{ - return m_colorSimilarityToolBarItem->colorSimilarity (); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::setColorSimilarity (double similarity) -{ - m_colorSimilarityToolBarItem->setColorSimilarity (similarity); -} - -//--------------------------------------------------------------------- - -int kpColorToolBar::processedColorSimilarity () const -{ - return m_colorSimilarityToolBarItem->processedColorSimilarity (); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::openColorSimilarityDialog () -{ - m_colorSimilarityToolBarItem->openDialog (); -} - -//--------------------------------------------------------------------- - -void kpColorToolBar::flashColorSimilarityToolBarItem () -{ - m_colorSimilarityToolBarItem->flash (); -} - -//--------------------------------------------------------------------- - -// private slot -void kpColorToolBar::updateNameOrUrlLabel () -{ - QString name; - - kpColorCells *colorCells = m_colorPalette->colorCells (); - if (!colorCells->url ().isEmpty ()) - name = kpUrlFormatter::PrettyFilename (colorCells->url ()); - else - { - if (!colorCells->name ().isEmpty ()) - name = colorCells->name (); - else - name = i18n ("KolourPaint Defaults"); - } - - if (name.isEmpty ()) - name = i18n ("Untitled"); - - - KLocalizedString labelStr; - - if (!m_colorPalette->colorCells ()->isModified ()) - { - labelStr = - ki18nc ("Colors: name_or_url_of_color_palette", - "Colors: %1") - .subs (name); - } - else - { - labelStr = - ki18nc ("Colors: name_or_url_of_color_palette [modified]", - "Colors: %1 [modified]") - .subs (name); - } - - // Kill 2 birds with 1 stone: - // - // 1. Hide the windowTitle() when it's docked. - // 2. Add a label containing the name of the open color palette. - // - // TODO: This currently hides the windowTitle() even when it's not docked, - // because we've abused it to show the name of open color palette - // instead. - setWindowTitle (labelStr.toString ()); -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpColorToolBar::dragEnterEvent (QDragEnterEvent *e) -{ - // Grab the color drag for this widget, preventing it from being - // handled by our parent, the main window. - e->setAccepted (KColorMimeData::canDecode (e->mimeData ()) == true); -#if DEBUG_KP_COLOR_TOOL_BAR - kDebug () << "isAccepted=" << e->isAccepted (); -#endif -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpColorToolBar::dragMoveEvent (QDragMoveEvent *e) -{ - // Stop the grabbed drag from being dropped. - e->setAccepted (KColorMimeData::canDecode (e->mimeData ()) == false); -#if DEBUG_KP_COLOR_TOOL_BAR - kDebug () << "isAccepted=" << e->isAccepted (); -#endif -} - -//--------------------------------------------------------------------- - -#include "moc_kpColorToolBar.cpp" diff --git a/kolourpaint/widgets/toolbars/kpColorToolBar.h b/kolourpaint/widgets/toolbars/kpColorToolBar.h deleted file mode 100644 index f1b1c126..00000000 --- a/kolourpaint/widgets/toolbars/kpColorToolBar.h +++ /dev/null @@ -1,124 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_COLOR_TOOLBAR_H -#define KP_COLOR_TOOLBAR_H - - -#include -#include -#include - -#include - - -#include - -class kpColorCells; -class kpColorPalette; -class kpColorSimilarityToolBarItem; -class kpDualColorButton; - - -// COMPAT: Vertical orientation and undocking were broken by the Qt4 port -// so kpMainWindow::init() keeps this tool bar in a constant position for -// the time being. To help make this workaround possible, we use QDockWidget, -// instead of KToolBar, to prevent XMLGUI from managing the tool -// bar position. This also allows us to use QMainWindow::setCorner(). -// -// A nice must-have side-effect is that we are now resizeable, which -// is good for configurable (and potentially large) color collections. -// So we should probably keep it as a QDockWidget in the long-term -// and once we fix orientation and undocking, we should put XMLGUI -// support back in, somehow (create a "KDockWidget" class?). -class kpColorToolBar : public QDockWidget -{ -Q_OBJECT - -public: - kpColorToolBar (const QString &label, QWidget *parent); - - kpColorCells *colorCells () const; - - kpColor color (int which) const; - void setColor (int which, const kpColor &color); - - kpColor foregroundColor () const; - kpColor backgroundColor () const; - - double colorSimilarity () const; - void setColorSimilarity (double similarity); - int processedColorSimilarity () const; - - void openColorSimilarityDialog (); - void flashColorSimilarityToolBarItem (); - -signals: - // If you connect to this signal, ignore the following - // foregroundColorChanged() and backgroundColorChanged() signals - void colorsSwapped (const kpColor &newForegroundColor, - const kpColor &newBackgroundColor); - - void foregroundColorChanged (const kpColor &color); - void backgroundColorChanged (const kpColor &color); - void colorSimilarityChanged (double similarity, int processedSimilarity); - -public: - // (only valid in slots connected to foregroundColorChanged()) - kpColor oldForegroundColor () const; - // (only valid in slots connected to backgroundColorChanged()) - kpColor oldBackgroundColor () const; - - // (only valid in slots connected to colorSimilarityChanged()) - double oldColorSimilarity () const; - -public slots: - void setForegroundColor (const kpColor &color); - void setBackgroundColor (const kpColor &color); - -private slots: - void updateNameOrUrlLabel (); - -protected: - // Eat color drops (which are usually accidental drags from one of our - // child widgets) to prevent them from being pasted as text in the - // main window (by kpMainWindow::dropEvent()). - virtual void dragEnterEvent (QDragEnterEvent *e); - virtual void dragMoveEvent (QDragMoveEvent *e); - -private: - void adjustToOrientation (Qt::Orientation o); - - QBoxLayout *m_boxLayout; - kpDualColorButton *m_dualColorButton; - kpColorPalette *m_colorPalette; - kpColorSimilarityToolBarItem *m_colorSimilarityToolBarItem; -}; - - -#endif // KP_COLOR_TOOLBAR_H diff --git a/kolourpaint/widgets/toolbars/kpToolToolBar.cpp b/kolourpaint/widgets/toolbars/kpToolToolBar.cpp deleted file mode 100644 index 8db16e5c..00000000 --- a/kolourpaint/widgets/toolbars/kpToolToolBar.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_TOOL_BAR 0 - - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -class kpToolButton : public QToolButton -{ -public: - kpToolButton (kpTool *tool, QWidget *parent) - : QToolButton (parent), - m_tool (tool) - { - } - - kpTool *tool() const { return m_tool; } - -protected: - virtual void mouseDoubleClickEvent(QMouseEvent *e) - { - if (e->button () == Qt::LeftButton && m_tool) - m_tool->globalDraw (); - } - - kpTool *m_tool; -}; - -//--------------------------------------------------------------------- - -kpToolToolBar::kpToolToolBar(const QString &name, int colsOrRows, QMainWindow *parent) - : KToolBar(name, parent, Qt::LeftToolBarArea), - m_vertCols (colsOrRows), - m_buttonGroup (0), - m_baseWidget (0), - m_baseLayout (0), - m_toolLayout (0), - m_previousTool (0), m_currentTool (0) -{ - m_baseWidget = new QWidget(this); - - m_toolWidgets.append (m_toolWidgetBrush = - new kpToolWidgetBrush (m_baseWidget, "Tool Widget Brush")); - m_toolWidgets.append (m_toolWidgetEraserSize = - new kpToolWidgetEraserSize (m_baseWidget, "Tool Widget Eraser Size")); - m_toolWidgets.append (m_toolWidgetFillStyle = - new kpToolWidgetFillStyle (m_baseWidget, "Tool Widget Fill Style")); - m_toolWidgets.append (m_toolWidgetLineWidth = - new kpToolWidgetLineWidth (m_baseWidget, "Tool Widget Line Width")); - m_toolWidgets.append (m_toolWidgetOpaqueOrTransparent = - new kpToolWidgetOpaqueOrTransparent (m_baseWidget, "Tool Widget Opaque/Transparent")); - m_toolWidgets.append (m_toolWidgetSpraycanSize = - new kpToolWidgetSpraycanSize (m_baseWidget, "Tool Widget Spraycan Size")); - - foreach(kpToolWidgetBase *w, m_toolWidgets) - { - connect(w, SIGNAL(optionSelected(int, int)), - this, SIGNAL(toolWidgetOptionSelected())); - } - - adjustToOrientation(orientation()); - connect(this, SIGNAL(orientationChanged(Qt::Orientation)), - this, SLOT(adjustToOrientation(Qt::Orientation))); - - m_buttonGroup = new QButtonGroup (this); - connect (m_buttonGroup, SIGNAL (buttonClicked (int)), SLOT (slotToolButtonClicked ())); - - hideAllToolWidgets (); - - addWidget(m_baseWidget); - - connect(this, SIGNAL(iconSizeChanged(const QSize &)), - this, SLOT(slotIconSizeChanged(const QSize &))); - - connect(this, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), - this, SLOT(slotToolButtonStyleChanged(Qt::ToolButtonStyle))); -} - -//--------------------------------------------------------------------- - -kpToolToolBar::~kpToolToolBar() -{ - while ( !m_toolButtons.isEmpty() ) - delete m_toolButtons.takeFirst(); -} - -//--------------------------------------------------------------------- - -// public -void kpToolToolBar::registerTool (kpTool *tool) -{ - foreach (const kpToolButton *b, m_toolButtons) - { - if ( b->tool() == tool ) // already given - return; - } - - kpToolButton *b = new kpToolButton(tool, m_baseWidget); - - b->setToolButtonStyle(toolButtonStyle()); - b->setIconSize(iconSize()); - b->setAutoRaise(true); - - // tell layout to make all with equal width (much better when text-below-icon) - b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - b->setDefaultAction(tool->action()); - - m_buttonGroup->addButton(b); - addButton(b, orientation(), m_toolButtons.count()); - - m_toolButtons.append(b); - - connect (tool, SIGNAL (actionActivated ()), - this, SLOT (slotToolActionActivated ())); - - adjustSizeConstraint(); -} - -//--------------------------------------------------------------------- -// public - -void kpToolToolBar::unregisterTool(kpTool *tool) -{ - for (int i = 0; i < m_toolButtons.count(); i++) - { - if ( m_toolButtons[i]->tool() == tool ) - { - delete m_toolButtons.takeAt(i); - disconnect(tool, SIGNAL(actionActivated()), - this, SLOT(slotToolActionActivated())); - return; - } - } -} - -//--------------------------------------------------------------------- -// public - -kpTool *kpToolToolBar::tool () const -{ - return m_currentTool; -} - -//--------------------------------------------------------------------- - -// public -void kpToolToolBar::selectTool (const kpTool *tool, bool reselectIfSameTool) -{ -#if DEBUG_KP_TOOL_TOOL_BAR - kDebug () << "kpToolToolBar::selectTool (tool=" << tool - << ") currentTool=" << m_currentTool - << endl; -#endif - - if (!reselectIfSameTool && tool == m_currentTool) - return; - - if (tool) - { - tool->action()->setChecked(true); - slotToolButtonClicked(); - } - else - { - QAbstractButton *b = m_buttonGroup->checkedButton(); - if (b) - { - // HACK: qbuttongroup.html says the following about exclusive - // button groups: - // - // "to untoggle a button you must click on another button - // in the group" - // - // But we don't want any button to be selected. - // So don't be an exclusive button group temporarily. - m_buttonGroup->setExclusive (false); - b->setChecked (false); - m_buttonGroup->setExclusive (true); - - slotToolButtonClicked (); - } - } -} - -//--------------------------------------------------------------------- - -// public -kpTool *kpToolToolBar::previousTool () const -{ - return m_previousTool; -} - -//--------------------------------------------------------------------- - -// public -void kpToolToolBar::selectPreviousTool () -{ - selectTool (m_previousTool); -} - -//--------------------------------------------------------------------- - -// public -void kpToolToolBar::hideAllToolWidgets () -{ - foreach(kpToolWidgetBase *w, m_toolWidgets) - w->hide (); -} - -//--------------------------------------------------------------------- - -// public -kpToolWidgetBase *kpToolToolBar::shownToolWidget (int which) const -{ - int uptoVisibleWidget = 0; - - foreach(kpToolWidgetBase *w, m_toolWidgets) - { - if ( !w->isHidden() ) - { - if (which == uptoVisibleWidget) - return w; - - uptoVisibleWidget++; - } - } - - return 0; -} - -//--------------------------------------------------------------------- - -// private slot -void kpToolToolBar::slotToolButtonClicked () -{ - QAbstractButton *b = m_buttonGroup->checkedButton(); - -#if DEBUG_KP_TOOL_TOOL_BAR - kDebug () << "kpToolToolBar::slotToolButtonClicked() button=" << b; -#endif - - kpTool *tool = 0; - foreach (const kpToolButton *button, m_toolButtons) - { - if ( button == b ) - { - tool = button->tool(); - break; - } - } - -#if DEBUG_KP_TOOL_TOOL_BAR - kDebug () << "\ttool=" << tool - << " currentTool=" << m_currentTool - << endl; -#endif - - if (tool == m_currentTool) - { - if (m_currentTool) - m_currentTool->reselect (); - - return; - } - - if (m_currentTool) - m_currentTool->endInternal (); - - m_previousTool = m_currentTool; - m_currentTool = tool; - - if (m_currentTool) - { - kpToolAction *action = m_currentTool->action (); - if (action) - { - action->setChecked (true); - } - - m_currentTool->beginInternal (); - } - - emit sigToolSelected (m_currentTool); - m_baseLayout->activate(); - adjustSizeConstraint(); -} - -//--------------------------------------------------------------------- - -// private slot -void kpToolToolBar::slotToolActionActivated () -{ - const kpTool *tool = dynamic_cast(sender()); - -#if DEBUG_KP_TOOL_TOOL_BAR - kDebug () << "kpToolToolBar::slotToolActionActivated() tool=" - << (tool ? tool->objectName () : "null") - << endl; -#endif - - selectTool (tool, true/*reselect if same tool*/); -} - -//--------------------------------------------------------------------- - -// public -void kpToolToolBar::adjustToOrientation(Qt::Orientation o) -{ -#if DEBUG_KP_TOOL_TOOL_BAR - kDebug () << "kpToolToolBar::adjustToOrientation(" - << (o == Qt::Vertical ? "vertical" : "horizontal") - << ") called!" << endl; -#endif - - delete m_baseLayout; - if (o == Qt::Vertical) - { - m_baseLayout = new QBoxLayout (QBoxLayout::TopToBottom, m_baseWidget); - } - else // if (o == Qt::Horizontal) - { - m_baseLayout = new QBoxLayout (QBoxLayout::LeftToRight, m_baseWidget); - } - m_baseLayout->setSizeConstraint(QLayout::SetFixedSize); - m_baseLayout->setContentsMargins(0, 0, 0, 0); - - m_toolLayout = new QGridLayout(); - m_toolLayout->setContentsMargins(0, 0, 0, 0); - - // (ownership is transferred to m_baseLayout) - m_baseLayout->addItem (m_toolLayout); - - int num = 0; - - foreach (kpToolButton *b, m_toolButtons) - { - addButton(b, o, num); - num++; - } - - foreach(kpToolWidgetBase *w, m_toolWidgets) - { - m_baseLayout->addWidget(w, - 0/*stretch*/, - o == Qt::Vertical ? Qt::AlignHCenter : Qt::AlignVCenter); - } - - adjustSizeConstraint(); -} - -//--------------------------------------------------------------------- -// this makes the size handled correctly during dragging/undocking the toolbar - -void kpToolToolBar::adjustSizeConstraint() -{ - // remove constraints - setFixedSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); - - if ( orientation() == Qt::Vertical ) - { - setFixedWidth(m_baseLayout->sizeHint().width() + - layout()->contentsMargins().left() + - layout()->contentsMargins().right()); - } - else - { - setFixedHeight(m_baseLayout->sizeHint().height() + - layout()->contentsMargins().top() + - layout()->contentsMargins().bottom()); - } -} - -//--------------------------------------------------------------------- - -// private -void kpToolToolBar::addButton(QAbstractButton *button, Qt::Orientation o, int num) -{ - if (o == Qt::Vertical) - m_toolLayout->addWidget (button, num / m_vertCols, num % m_vertCols); - else - { - // maps Left (o = vertical) to Bottom (o = horizontal) - int row = (m_vertCols - 1) - (num % m_vertCols); - m_toolLayout->addWidget (button, row, num / m_vertCols); - } -} - -//--------------------------------------------------------------------- - -void kpToolToolBar::slotIconSizeChanged(const QSize &size) -{ - foreach (kpToolButton *b, m_toolButtons) - b->setIconSize(size); - - m_baseLayout->activate(); - adjustSizeConstraint(); -} - -//--------------------------------------------------------------------- - -void kpToolToolBar::slotToolButtonStyleChanged(Qt::ToolButtonStyle style) -{ - foreach (kpToolButton *b, m_toolButtons) - b->setToolButtonStyle(style); - - m_baseLayout->activate(); - adjustSizeConstraint(); -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolToolBar.cpp" diff --git a/kolourpaint/widgets/toolbars/kpToolToolBar.h b/kolourpaint/widgets/toolbars/kpToolToolBar.h deleted file mode 100644 index df927652..00000000 --- a/kolourpaint/widgets/toolbars/kpToolToolBar.h +++ /dev/null @@ -1,123 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - Copyright (c) 2011 Martin Koller - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_TOOL_BAR_H -#define KP_TOOL_TOOL_BAR_H - - -#include - -#include - - -#include -#include -#include -#include -#include - -class kpTool; -class kpToolButton; - -class kpToolWidgetBase; -class kpToolWidgetBrush; -class kpToolWidgetEraserSize; -class kpToolWidgetFillStyle; -class kpToolWidgetLineWidth; -class kpToolWidgetOpaqueOrTransparent; -class kpToolWidgetSpraycanSize; - -class kpToolToolBar : public KToolBar -{ -Q_OBJECT - -public: - kpToolToolBar (const QString &name, int colsOrRows, QMainWindow *parent); - virtual ~kpToolToolBar (); - - void registerTool(kpTool *tool); - void unregisterTool(kpTool *tool); - - kpTool *tool () const; - void selectTool (const kpTool *tool, bool reselectIfSameTool = false); - - kpTool *previousTool () const; - void selectPreviousTool (); - - void hideAllToolWidgets (); - // could this be cleaner (the tools have to access them individually somehow)? - kpToolWidgetBrush *toolWidgetBrush () const { return m_toolWidgetBrush; } - kpToolWidgetEraserSize *toolWidgetEraserSize () const { return m_toolWidgetEraserSize; } - kpToolWidgetFillStyle *toolWidgetFillStyle () const { return m_toolWidgetFillStyle; } - kpToolWidgetLineWidth *toolWidgetLineWidth () const { return m_toolWidgetLineWidth; } - kpToolWidgetOpaqueOrTransparent *toolWidgetOpaqueOrTransparent () const { return m_toolWidgetOpaqueOrTransparent; } - kpToolWidgetSpraycanSize *toolWidgetSpraycanSize () const { return m_toolWidgetSpraycanSize; } - - kpToolWidgetBase *shownToolWidget (int which) const; - -signals: - void sigToolSelected (kpTool *tool); // tool may be 0 - void toolWidgetOptionSelected (); - -private slots: - void slotToolButtonClicked (); - - void slotToolActionActivated (); - - void adjustToOrientation(Qt::Orientation o); - void slotIconSizeChanged(const QSize &); - void slotToolButtonStyleChanged(Qt::ToolButtonStyle style); - -private: - void addButton (QAbstractButton *button, Qt::Orientation o, int num); - void adjustSizeConstraint(); - - int m_vertCols; - - QButtonGroup *m_buttonGroup; - QWidget *m_baseWidget; - QBoxLayout *m_baseLayout; - QGridLayout *m_toolLayout; - - kpToolWidgetBrush *m_toolWidgetBrush; - kpToolWidgetEraserSize *m_toolWidgetEraserSize; - kpToolWidgetFillStyle *m_toolWidgetFillStyle; - kpToolWidgetLineWidth *m_toolWidgetLineWidth; - kpToolWidgetOpaqueOrTransparent *m_toolWidgetOpaqueOrTransparent; - kpToolWidgetSpraycanSize *m_toolWidgetSpraycanSize; - - QList m_toolWidgets; - - QList m_toolButtons; - - kpTool *m_previousTool, *m_currentTool; -}; - - -#endif // KP_TOOL_TOOL_BAR_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.cpp deleted file mode 100644 index 072675e8..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.cpp +++ /dev/null @@ -1,723 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_WIDGET_BASE 0 - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - - -//--------------------------------------------------------------------- - -kpToolWidgetBase::kpToolWidgetBase (QWidget *parent, const QString &name) - : QFrame(parent), m_baseWidget(0), - m_selectedRow(-1), m_selectedCol(-1) -{ - setObjectName (name); - - setFrameStyle (QFrame::Panel | QFrame::Sunken); - - setFixedSize (44, 66); - setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); -} - -//--------------------------------------------------------------------- - -kpToolWidgetBase::~kpToolWidgetBase () -{ -} - -//--------------------------------------------------------------------- - -// public -void kpToolWidgetBase::addOption (const QPixmap &pixmap, const QString &toolTip) -{ - if (m_pixmaps.isEmpty ()) - startNewOptionRow (); - - m_pixmaps.last ().append (pixmap); - m_pixmapRects.last ().append (QRect ()); - m_toolTips.last ().append (toolTip); -} - -//--------------------------------------------------------------------- - -// public -void kpToolWidgetBase::startNewOptionRow () -{ - m_pixmaps.append (QList ()); - m_pixmapRects.append (QList ()); - m_toolTips.append (QList ()); -} - -//--------------------------------------------------------------------- - -// public -void kpToolWidgetBase::finishConstruction (int fallBackRow, int fallBackCol) -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase(" << objectName () - << ")::kpToolWidgetBase(fallBack:row=" << fallBackRow - << ",col=" << fallBackCol - << ")" - << endl; -#endif - - relayoutOptions (); - - // HACK: Undo the maximum half of setFixedSize() in the ctor to avoid - // bizarre redraw errors when tool widgets are hidden and others - // are shown. - // - // The reason why we didn't just use setMinimumSize() in the ctor is - // because all tool widgets construct pixmaps whose sizes are dependent - // on the size() in the ctor, so we needed to get the correct size - // in there. This is bad design because it means that tool widgets - // can't really be resized. - setMaximumSize (QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); - - const QPair rowColPair = defaultSelectedRowAndCol (); - if (!setSelected (rowColPair.first, rowColPair.second, false/*don't save*/)) - { - if (!setSelected (fallBackRow, fallBackCol)) - { - if (!setSelected (0, 0)) - { - kError () << "kpToolWidgetBase::finishConstruction() " - "can't even fall back to setSelected(row=0,col=0)" << endl; - } - } - } -} - -//--------------------------------------------------------------------- - -// private -QList kpToolWidgetBase::spreadOutElements (const QList &sizes, int max) -{ - if (sizes.count () == 0) - return QList (); - else if (sizes.count () == 1) - { - QList ret; - ret.append (sizes.first () > max ? 0 : 1/*margin*/); - return ret; - } - - QList retOffsets; - for (int i = 0; i < sizes.count (); i++) - retOffsets.append (0); - - int totalSize = 0; - for (int i = 0; i < (int) sizes.count (); i++) - totalSize += sizes [i]; - - int margin = 1; - - // if don't fit with margin, then just return elements - // packed right next to each other - if (totalSize + margin * 2 > max) - { - retOffsets [0] = 0; - for (int i = 1; i < (int) sizes.count (); i++) - retOffsets [i] = retOffsets [i - 1] + sizes [i - 1]; - - return retOffsets; - } - - int maxLeftOver = max - (totalSize + margin * 2 * sizes.count()); - - int startCompensating = -1; - int numCompensate = 0; - - int spacing = 0; - - spacing = maxLeftOver / (sizes.count () - 1); - if (spacing * int (sizes.count () - 1) < maxLeftOver) - { - numCompensate = maxLeftOver - spacing * (sizes.count () - 1); - startCompensating = ((sizes.count () - 1) - numCompensate) / 2; - } - - retOffsets [0] = margin; - for (int i = 1; i < (int) sizes.count (); i++) - { - retOffsets [i] += retOffsets [i - 1] + - sizes [i - 1] + - spacing + - ((numCompensate && - i >= startCompensating && - i < startCompensating + numCompensate) ? 1 : 0); - } - - return retOffsets; -} - -//--------------------------------------------------------------------- - -// public -QPair kpToolWidgetBase::defaultSelectedRowAndCol () const -{ - int row = -1, col = -1; - - if (!objectName ().isEmpty ()) - { - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupTools); - - row = cfg.readEntry (objectName () + QLatin1String (" Row"), -1); - col = cfg.readEntry (objectName () + QLatin1String (" Col"), -1); - } - -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase(" << objectName () - << ")::defaultSelectedRowAndCol() returning row=" << row - << " col=" << col - << endl; -#endif - - return qMakePair (row, col); -} - -//--------------------------------------------------------------------- - -// public -int kpToolWidgetBase::defaultSelectedRow () const -{ - return defaultSelectedRowAndCol ().first; -} - -//--------------------------------------------------------------------- - -// public -int kpToolWidgetBase::defaultSelectedCol () const -{ - return defaultSelectedRowAndCol ().second; -} - -//--------------------------------------------------------------------- - -// public -void kpToolWidgetBase::saveSelectedAsDefault () const -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase(" << objectName () - << ")::saveSelectedAsDefault() row=" << m_selectedRow - << " col=" << m_selectedCol << endl; -#endif - - if (objectName ().isEmpty ()) - return; - - KConfigGroup cfg (KGlobal::config (), kpSettingsGroupTools); - - cfg.writeEntry (objectName () + QLatin1String (" Row"), m_selectedRow); - cfg.writeEntry (objectName () + QLatin1String (" Col"), m_selectedCol); - cfg.sync (); -} - -//--------------------------------------------------------------------- - -// public -void kpToolWidgetBase::relayoutOptions () -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase::relayoutOptions() size=" << size (); -#endif - - while (!m_pixmaps.isEmpty () && m_pixmaps.last ().count () == 0) - { - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tkilling #" << m_pixmaps.count () - 1; - #endif - m_pixmaps.removeLast (); - m_pixmapRects.removeLast (); - m_toolTips.removeLast (); - } - - if (m_pixmaps.isEmpty ()) - return; - -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tsurvived killing of empty rows"; - kDebug () << "\tfinding heights of rows:"; -#endif - - QList maxHeightOfRow; - for (int r = 0; r < m_pixmaps.count (); r++) - maxHeightOfRow.append (0); - - for (int r = 0; r < (int) m_pixmaps.count (); r++) - { - for (int c = 0; c < (int) m_pixmaps [r].count (); c++) - { - if (c == 0 || m_pixmaps [r][c].height () > maxHeightOfRow [r]) - maxHeightOfRow [r] = m_pixmaps [r][c].height (); - } - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\t\t" << r << ": " << maxHeightOfRow [r]; - #endif - } - - QList rowYOffset = spreadOutElements (maxHeightOfRow, height ()); -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tspread out offsets of rows:"; - for (int r = 0; r < (int) rowYOffset.count (); r++) - kDebug () << "\t\t" << r << ": " << rowYOffset [r]; -#endif - - for (int r = 0; r < (int) m_pixmaps.count (); r++) - { - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tlaying out row " << r << ":"; - #endif - - QList widths; - for (int c = 0; c < (int) m_pixmaps [r].count (); c++) - widths.append (m_pixmaps [r][c].width ()); - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\t\twidths of cols:"; - for (int c = 0; c < (int) m_pixmaps [r].count (); c++) - kDebug () << "\t\t\t" << c << ": " << widths [c]; - #endif - - QList colXOffset = spreadOutElements (widths, width ()); - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\t\tspread out offsets of cols:"; - for (int c = 0; c < (int) colXOffset.count (); c++) - kDebug () << "\t\t\t" << c << ": " << colXOffset [c]; - #endif - - for (int c = 0; c < (int) colXOffset.count (); c++) - { - int x = colXOffset [c]; - int y = rowYOffset [r]; - int w, h; - - if (c == (int) colXOffset.count () - 1) - { - if (x + m_pixmaps [r][c].width () >= width ()) - w = m_pixmaps [r][c].width (); - else - w = width () - 1 - x; - } - else - w = colXOffset [c + 1] - x; - - if (r == (int) m_pixmaps.count () - 1) - { - if (y + m_pixmaps [r][c].height () >= height ()) - h = m_pixmaps [r][c].height (); - else - h = height () - 1 - y; - } - else - h = rowYOffset [r + 1] - y; - - m_pixmapRects [r][c] = QRect (x, y, w, h); - } - } - - update (); -} - -//--------------------------------------------------------------------- - - -// public -int kpToolWidgetBase::selectedRow () const -{ - return m_selectedRow; -} - -//--------------------------------------------------------------------- - -// public -int kpToolWidgetBase::selectedCol () const -{ - return m_selectedCol; -} - -//--------------------------------------------------------------------- - -// public -int kpToolWidgetBase::selected () const -{ - if (m_selectedRow < 0 || - m_selectedRow >= (int) m_pixmaps.count () || - m_selectedCol < 0) - { - return -1; - } - - int upto = 0; - for (int y = 0; y < m_selectedRow; y++) - upto += m_pixmaps [y].count (); - - if (m_selectedCol >= (int) m_pixmaps [m_selectedRow].count ()) - return -1; - - upto += m_selectedCol; - - return upto; -} - -//--------------------------------------------------------------------- - - -// public -bool kpToolWidgetBase::hasPreviousOption (int *row, int *col) const -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase(" << objectName () - << ")::hasPreviousOption() current row=" << m_selectedRow - << " col=" << m_selectedCol - << endl; -#endif - if (row) - *row = -1; - if (col) - *col = -1; - - - if (m_selectedRow < 0 || m_selectedCol < 0) - return false; - - int newRow = m_selectedRow, - newCol = m_selectedCol; - - newCol--; - if (newCol < 0) - { - newRow--; - if (newRow < 0) - return false; - - newCol = m_pixmaps [newRow].count () - 1; - if (newCol < 0) - return false; - } - - - if (row) - *row = newRow; - if (col) - *col = newCol; - - return true; -} - -//--------------------------------------------------------------------- - -// public -bool kpToolWidgetBase::hasNextOption (int *row, int *col) const -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase(" << objectName () - << ")::hasNextOption() current row=" << m_selectedRow - << " col=" << m_selectedCol - << endl; -#endif - - if (row) - *row = -1; - if (col) - *col = -1; - - - if (m_selectedRow < 0 || m_selectedCol < 0) - return false; - - int newRow = m_selectedRow, - newCol = m_selectedCol; - - newCol++; - if (newCol >= (int) m_pixmaps [newRow].count ()) - { - newRow++; - if (newRow >= (int) m_pixmaps.count ()) - return false; - - newCol = 0; - if (newCol >= (int) m_pixmaps [newRow].count ()) - return false; - } - - - if (row) - *row = newRow; - if (col) - *col = newCol; - - return true; -} - -//--------------------------------------------------------------------- - - -// public slot virtual -bool kpToolWidgetBase::setSelected (int row, int col, bool saveAsDefault) -{ -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase::setSelected(row=" << row - << ",col=" << col - << ",saveAsDefault=" << saveAsDefault - << ")" - << endl; -#endif - - if (row < 0 || col < 0 || - row >= (int) m_pixmapRects.count () || col >= (int) m_pixmapRects [row].count ()) - { - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tout of range"; - #endif - return false; - } - - if (row == m_selectedRow && col == m_selectedCol) - { - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tNOP"; - #endif - - if (saveAsDefault) - saveSelectedAsDefault (); - - return true; - } - - const int wasSelectedRow = m_selectedRow; - const int wasSelectedCol = m_selectedCol; - - m_selectedRow = row, m_selectedCol = col; - - if (wasSelectedRow >= 0 && wasSelectedCol >= 0) - { - // unhighlight old option - update (m_pixmapRects [wasSelectedRow][wasSelectedCol]); - } - - // highlight new option - update (m_pixmapRects [row][col]); - -#if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tOK"; -#endif - - if (saveAsDefault) - saveSelectedAsDefault (); - - emit optionSelected (row, col); - return true; -} - -//--------------------------------------------------------------------- - -// public slot -bool kpToolWidgetBase::setSelected (int row, int col) -{ - return setSelected (row, col, true/*set as default*/); -} - -//--------------------------------------------------------------------- - - -// public slot -bool kpToolWidgetBase::selectPreviousOption () -{ - int newRow, newCol; - if (!hasPreviousOption (&newRow, &newCol)) - return false; - - return setSelected (newRow, newCol); -} - -//--------------------------------------------------------------------- - -// public slot -bool kpToolWidgetBase::selectNextOption () -{ - int newRow, newCol; - if (!hasNextOption (&newRow, &newCol)) - return false; - - return setSelected (newRow, newCol); -} - -//--------------------------------------------------------------------- - - -// protected virtual [base QWidget] -bool kpToolWidgetBase::event (QEvent *e) -{ - // TODO: It's unclear when we should call the base, call accept() and - // return true or false. Look at other event() handlers. The - // kpToolText one is wrong since after calling accept(), it calls - // its base which calls ignore() :) - if (e->type () == QEvent::ToolTip) - { - QHelpEvent *he = (QHelpEvent *) e; - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "kpToolWidgetBase::event() QHelpEvent pos=" << he->pos (); - #endif - - bool showedText = false; - for (int r = 0; r < (int) m_pixmapRects.count (); r++) - { - for (int c = 0; c < (int) m_pixmapRects [r].count (); c++) - { - if (m_pixmapRects [r][c].contains (he->pos ())) - { - const QString tip = m_toolTips [r][c]; - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\tin option: r=" << r << "c=" << c - << "tip='" << tip << "'" << endl; - #endif - if (!tip.isEmpty ()) - { - QToolTip::showText (he->globalPos (), tip, this); - showedText = true; - } - - e->accept (); - goto exit_loops; - } - } - } - - exit_loops: - if (!showedText) - { - #if DEBUG_KP_TOOL_WIDGET_BASE - kDebug () << "\thiding text"; - #endif - QToolTip::hideText (); - } - - return true; - } - else - return QWidget::event (e); -} - -//--------------------------------------------------------------------- - - -// protected virtual [base QWidget] -void kpToolWidgetBase::mousePressEvent (QMouseEvent *e) -{ - e->ignore (); - - if (e->button () != Qt::LeftButton) - return; - - - for (int i = 0; i < (int) m_pixmapRects.count (); i++) - { - for (int j = 0; j < (int) m_pixmapRects [i].count (); j++) - { - if (m_pixmapRects [i][j].contains (e->pos ())) - { - setSelected (i, j); - e->accept (); - return; - } - } - } -} - -//--------------------------------------------------------------------- - -// protected virtual [base QWidget] -void kpToolWidgetBase::paintEvent (QPaintEvent *e) -{ -#if DEBUG_KP_TOOL_WIDGET_BASE && 1 - kDebug () << "kpToolWidgetBase::paintEvent(): rect=" << contentsRect (); -#endif - - // Draw frame first. - QFrame::paintEvent (e); - - QPainter painter (this); - - for (int i = 0; i < (int) m_pixmaps.count (); i++) - { - #if DEBUG_KP_TOOL_WIDGET_BASE && 1 - kDebug () << "\tRow: " << i; - #endif - - for (int j = 0; j < (int) m_pixmaps [i].count (); j++) - { - QRect rect = m_pixmapRects [i][j]; - QPixmap pixmap = m_pixmaps [i][j]; - - #if DEBUG_KP_TOOL_WIDGET_BASE && 1 - kDebug () << "\t\tCol: " << j << " rect=" << rect; - #endif - - if (i == m_selectedRow && j == m_selectedCol) - { - painter.fillRect(rect, palette().color(QPalette::Highlight).rgb()); - } - - #if DEBUG_KP_TOOL_WIDGET_BASE && 1 - kDebug () << "\t\t\tdraw pixmap @ x=" - << rect.x () + (rect.width () - pixmap.width ()) / 2 - << " y=" - << rect.y () + (rect.height () - pixmap.height ()) / 2 - << endl; - - #endif - - painter.drawPixmap(QPoint(rect.x () + (rect.width () - pixmap.width ()) / 2, - rect.y () + (rect.height () - pixmap.height ()) / 2), - pixmap); - } - } -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolWidgetBase.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.h deleted file mode 100644 index 9d991596..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetBase.h +++ /dev/null @@ -1,114 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_BASE_H -#define KP_TOOL_WIDGET_BASE_H - - -#include -#include -#include -#include -#include -#include - - -#include - - -// TODO: This is a crazy and overcomplicated class that invents its own (buggy) -// layout management. It should be simplified or removed. -class kpToolWidgetBase : public QFrame -{ -Q_OBJECT - -public: - // (must provide a for config to work) - kpToolWidgetBase (QWidget *parent, const QString &name); - virtual ~kpToolWidgetBase (); - -public: - void addOption (const QPixmap &pixmap, const QString &toolTip = QString()); - void startNewOptionRow (); - - // Call this at the end of your constructor. - // If the default row & col could not be read from the config, - // & are passed to setSelected(). - void finishConstruction (int fallBackRow, int fallBackCol); - -private: - QList spreadOutElements (const QList &sizes, int maxSize); - -public: // (only have to use these if you don't use finishConstruction()) - // (rereads from config file) - QPair defaultSelectedRowAndCol () const; - int defaultSelectedRow () const; - int defaultSelectedCol () const; - - void saveSelectedAsDefault () const; - - void relayoutOptions (); - -public: - int selectedRow () const; - int selectedCol () const; - - int selected () const; - - bool hasPreviousOption (int *row = 0, int *col = 0) const; - bool hasNextOption (int *row = 0, int *col = 0) const; - -public slots: - // (returns whether and were in range) - virtual bool setSelected (int row, int col, bool saveAsDefault); - bool setSelected (int row, int col); - - bool selectPreviousOption (); - bool selectNextOption (); - -signals: - void optionSelected (int row, int col); - -protected: - virtual bool event (QEvent *e); - - virtual void mousePressEvent (QMouseEvent *e); - virtual void paintEvent (QPaintEvent *e); - - QWidget *m_baseWidget; - - QList < QList > m_pixmaps; - QList < QList > m_toolTips; - - QList < QList > m_pixmapRects; - - int m_selectedRow, m_selectedCol; -}; - - -#endif // KP_TOOL_WIDGET_BASE_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.cpp deleted file mode 100644 index 7f363649..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.cpp +++ /dev/null @@ -1,299 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_WIDGET_BRUSH 0 - - -#include - -#include -#include - -#include -#include - -#include - -//--------------------------------------------------------------------- - -// LOREFACTOR: more OO, no arrays (use safer structs). -/* sync: */ -static int BrushSizes [][3] = -{ - {8, 4, 1/*like Pen*/}, - {9, 5, 2}, - {9, 5, 2}, - {9, 5, 2} -}; - -#define BRUSH_SIZE_NUM_COLS (int (sizeof (::BrushSizes [0]) / sizeof (::BrushSizes [0][0]))) -#define BRUSH_SIZE_NUM_ROWS (int (sizeof (::BrushSizes) / sizeof (::BrushSizes [0]))) - - -//--------------------------------------------------------------------- - -static void Draw (kpImage *destImage, const QPoint &topLeft, void *userData) -{ - kpToolWidgetBrush::DrawPackage *pack = - static_cast (userData); - -#if DEBUG_KP_TOOL_WIDGET_BRUSH - kDebug () << "kptoolwidgetbrush.cpp:Draw(destImage,topLeft=" - << topLeft << " pack: row=" << pack->row << " col=" << pack->col - << " color=" << (int *) pack->color.toQRgb () - << endl; -#endif - const int size = ::BrushSizes [pack->row][pack->col]; -#if DEBUG_KP_TOOL_WIDGET_BRUSH - kDebug () << "\tsize=" << size; -#endif - - QPainter painter(destImage); - - if ( size == 1 ) - { - painter.setPen(pack->color.toQColor()); - painter.drawPoint(topLeft); - return; - } - - // sync: - switch (pack->row/*shape*/) - { - case 0: - { - // work around ugly circle when using QPainter on QImage - if ( size == 4 ) - { - // do not draw a pixel twice, as with an alpha color it will become darker - painter.setPen(Qt::NoPen); - painter.setBrush(pack->color.toQColor()); - painter.drawRect(topLeft.x() + 1, topLeft.y(), 2, size); - painter.setPen(pack->color.toQColor()); - painter.drawLine(topLeft.x(), topLeft.y() + 1, topLeft.x(), topLeft.y() + 2); - painter.drawLine(topLeft.x() + 3, topLeft.y() + 1, topLeft.x() + 3, topLeft.y() + 2); - } - else if ( size == 8 ) // size defined in BrushSizes above - { - // do not draw a pixel twice, as with an alpha color it will become darker - painter.setPen(Qt::NoPen); - painter.setBrush(pack->color.toQColor()); - painter.drawRect(topLeft.x() + 2, topLeft.y(), 4, size); - painter.drawRect(topLeft.x(), topLeft.y() + 2, 2, 4); - painter.drawRect(topLeft.x() + 6, topLeft.y() + 2, 2, 4); - painter.setPen(pack->color.toQColor()); - painter.drawPoint(topLeft.x() + 1, topLeft.y() + 1); - painter.drawPoint(topLeft.x() + 6, topLeft.y() + 1); - painter.drawPoint(topLeft.x() + 1, topLeft.y() + 6); - painter.drawPoint(topLeft.x() + 6, topLeft.y() + 6); - } - else - { - Q_ASSERT(!"illegal size"); - } - break; - } - - case 1: - { - // only paint filling so that a color with an alpha channel does not - // create a darker border due to drawing some pixels twice with composition - painter.setPen(Qt::NoPen); - painter.setBrush(pack->color.toQColor()); - painter.drawRect(topLeft.x(), topLeft.y(), size, size); - break; - } - - case 2: - { - painter.setPen(pack->color.toQColor()); - painter.drawLine(topLeft.x() + size - 1, topLeft.y(), - topLeft.x(), topLeft.y() + size - 1); - break; - } - - case 3: - { - painter.setPen(pack->color.toQColor()); - painter.drawLine(topLeft.x(), topLeft.y(), - topLeft.x() + size - 1, topLeft.y() + size - 1); - break; - } - - default: - Q_ASSERT (!"Unknown row"); - break; - } -} - -//--------------------------------------------------------------------- - -kpToolWidgetBrush::kpToolWidgetBrush (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ - for (int shape = 0; shape < BRUSH_SIZE_NUM_ROWS; shape++) - { - for (int i = 0; i < BRUSH_SIZE_NUM_COLS; i++) - { - const int s = ::BrushSizes [shape][i]; - - - const int w = (width () - 2/*margin*/ - 2/*spacing*/) - / BRUSH_SIZE_NUM_COLS; - const int h = (height () - 2/*margin*/ - 3/*spacing*/) - / BRUSH_SIZE_NUM_ROWS; - Q_ASSERT (w >= s && h >= s); - QImage previewPixmap (w, h, QImage::Format_ARGB32_Premultiplied); - previewPixmap.fill(0); - - DrawPackage pack = drawFunctionDataForRowCol (kpColor::Black, shape, i); - ::Draw (&previewPixmap, - QPoint ((previewPixmap.width () - s) / 2, - (previewPixmap.height () - s) / 2), - &pack); - - - addOption (QPixmap::fromImage(previewPixmap), brushName (shape, i)/*tooltip*/); - } - - startNewOptionRow (); - } - - finishConstruction (0, 0); -} - -//--------------------------------------------------------------------- - -kpToolWidgetBrush::~kpToolWidgetBrush () -{ -} - -//--------------------------------------------------------------------- - -// private -QString kpToolWidgetBrush::brushName (int shape, int whichSize) const -{ - int s = ::BrushSizes [shape][whichSize]; - - if (s == 1) - return i18n ("1x1"); - - QString shapeName; - - // sync: - switch (shape) - { - case 0: - shapeName = i18n ("Circle"); - break; - case 1: - shapeName = i18n ("Square"); - break; - case 2: - // TODO: is this really the name of a shape? :) - shapeName = i18n ("Slash"); - break; - case 3: - // TODO: is this really the name of a shape? :) - shapeName = i18n ("Backslash"); - break; - } - - if (shapeName.isEmpty ()) - return QString(); - - return i18n ("%1x%2 %3", s, s, shapeName); -} - -//--------------------------------------------------------------------- - -// public -int kpToolWidgetBrush::brushSize () const -{ - return ::BrushSizes [selectedRow ()][selectedCol ()]; -} - -//--------------------------------------------------------------------- - -// public -bool kpToolWidgetBrush::brushIsDiagonalLine () const -{ - // sync: - return (selectedRow () >= 2); -} - -//--------------------------------------------------------------------- - - -// public -kpTempImage::UserFunctionType kpToolWidgetBrush::drawFunction () const -{ - return &::Draw; -} - -//--------------------------------------------------------------------- - - -// public static -kpToolWidgetBrush::DrawPackage kpToolWidgetBrush::drawFunctionDataForRowCol ( - const kpColor &color, int row, int col) -{ - Q_ASSERT (row >= 0 && col >= 0); - - DrawPackage pack; - - pack.row = row; - pack.col = col; - pack.color = color; - - return pack; -} - -//--------------------------------------------------------------------- - -// public -kpToolWidgetBrush::DrawPackage kpToolWidgetBrush::drawFunctionData ( - const kpColor &color) const -{ - return drawFunctionDataForRowCol (color, selectedRow (), selectedCol ()); -} - -//--------------------------------------------------------------------- - -// protected slot virtual [base kpToolWidgetBase] -bool kpToolWidgetBrush::setSelected (int row, int col, bool saveAsDefault) -{ - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit brushChanged (); - return ret; -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolWidgetBrush.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.h deleted file mode 100644 index 1ab63948..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetBrush.h +++ /dev/null @@ -1,81 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_BRUSH_H -#define KP_TOOL_WIDGET_BRUSH_H - - -#include - -#include -#include -#include - - -class kpToolWidgetBrush : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetBrush (QWidget *parent, const QString &name); - virtual ~kpToolWidgetBrush (); - -private: - QString brushName (int shape, int whichSize) const; - -public: - int brushSize () const; - bool brushIsDiagonalLine () const; - - struct DrawPackage - { - int row; - int col; - kpColor color; - }; - - // Call the function returned by to render the current - // brush onto an image/document, in . Pass the pointer returned by - // to it. - // - // TODO: change function + data -> object - kpTempImage::UserFunctionType drawFunction () const; - - static DrawPackage drawFunctionDataForRowCol (const kpColor &color, - int row, int col); - DrawPackage drawFunctionData (const kpColor &color) const; - -signals: - void brushChanged (); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_BRUSH_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.cpp deleted file mode 100644 index e2a60872..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.cpp +++ /dev/null @@ -1,188 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_WIDGET_ERASER_SIZE 0 - - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - - -static int EraserSizes [] = {2, 3, 5, 9, 17, 29}; -static const int NumEraserSizes = - int (sizeof (::EraserSizes) / sizeof (::EraserSizes [0])); - - -static void DrawImage (kpImage *destImage, const QPoint &topLeft, void *userData) -{ - kpToolWidgetEraserSize::DrawPackage *pack = - static_cast (userData); - - const int size = ::EraserSizes [pack->selected]; - - kpPainter::fillRect (destImage, - topLeft.x (), topLeft.y (), size, size, - pack->color); -} - -static void DrawCursor (kpImage *destImage, const QPoint &topLeft, void *userData) -{ - ::DrawImage (destImage, topLeft, userData); - - - kpToolWidgetEraserSize::DrawPackage *pack = - static_cast (userData); - - const int size = ::EraserSizes [pack->selected]; - - // Would 1-pixel border on all sides completely cover the color of the - // eraser? - if (size <= 2) - return; - - // Draw 1-pixel border on all sides. - kpPainter::drawRect (destImage, - topLeft.x (), topLeft.y (), size, size, - kpColor::Black); -} - -//--------------------------------------------------------------------- - -kpToolWidgetEraserSize::kpToolWidgetEraserSize (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ - for (int i = 0; i < ::NumEraserSizes; i++) - { - if (i == 3 || i == 5) - startNewOptionRow (); - - const int s = ::EraserSizes [i]; - - QImage previewPixmap (s, s, QImage::Format_ARGB32_Premultiplied); - if (i < 3) - { - // HACK: kpToolWidgetBase's layout code sucks and gives uneven spacing - previewPixmap = QImage ((width () - 4) / 3, 9, QImage::Format_ARGB32_Premultiplied); - Q_ASSERT (previewPixmap.width () >= s && - previewPixmap.height () >= s); - } - - previewPixmap.fill(0); - - DrawPackage pack = drawFunctionDataForSelected (kpColor::Black, i); - ::DrawImage (&previewPixmap, - QPoint ((previewPixmap.width () - s) / 2, - (previewPixmap.height () - s) / 2), - &pack); - - - addOption (QPixmap::fromImage(previewPixmap), i18n ("%1x%2", s, s)/*tooltip*/); - } - - finishConstruction (1, 0); -} - -//--------------------------------------------------------------------- - -kpToolWidgetEraserSize::~kpToolWidgetEraserSize () -{ -} - -//--------------------------------------------------------------------- - - -// public -int kpToolWidgetEraserSize::eraserSize () const -{ - return ::EraserSizes[selected() < 0 ? 0 : selected()]; -} - - -// public -kpTempImage::UserFunctionType kpToolWidgetEraserSize::drawFunction () const -{ - return &::DrawImage; -} - -// public -kpTempImage::UserFunctionType kpToolWidgetEraserSize::drawCursorFunction () const -{ - return &::DrawCursor; -} - -//--------------------------------------------------------------------- - - -// public static -kpToolWidgetEraserSize::DrawPackage kpToolWidgetEraserSize::drawFunctionDataForSelected ( - const kpColor &color, int selectedIndex) -{ - DrawPackage pack; - - pack.selected = selectedIndex; - pack.color = color; - - return pack; -} - -//--------------------------------------------------------------------- - -// public -kpToolWidgetEraserSize::DrawPackage kpToolWidgetEraserSize::drawFunctionData ( - const kpColor &color) const -{ - return drawFunctionDataForSelected (color, selected ()); -} - -//--------------------------------------------------------------------- - - -// protected slot virtual [base kpToolWidgetBase] -bool kpToolWidgetEraserSize::setSelected (int row, int col, bool saveAsDefault) -{ - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit eraserSizeChanged (eraserSize ()); - return ret; -} - -//--------------------------------------------------------------------- - - -#include "moc_kpToolWidgetEraserSize.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.h deleted file mode 100644 index df8f2208..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetEraserSize.h +++ /dev/null @@ -1,82 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_ERASER_SIZE_H -#define KP_TOOL_WIDGET_ERASER_SIZE_H - - -#include - -#include -#include -#include - - -class kpColor; - - -class kpToolWidgetEraserSize : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetEraserSize (QWidget *parent, const QString &name); - virtual ~kpToolWidgetEraserSize (); - - int eraserSize () const; - - struct DrawPackage - { - int selected; - kpColor color; - }; - - // Call the function returned by to render the current - // brush onto an image/document, in . Pass the pointer returned by - // to it. - // - // is to same as but adds a black - // border suitable as a cursor only. - // - // TODO: change function + data -> object - kpTempImage::UserFunctionType drawFunction () const; - kpTempImage::UserFunctionType drawCursorFunction () const; - - static DrawPackage drawFunctionDataForSelected (const kpColor &color, - int selectedIndex); - DrawPackage drawFunctionData (const kpColor &color) const; - -signals: - void eraserSizeChanged (int size); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_ERASER_SIZE_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.cpp deleted file mode 100644 index 94731679..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.cpp +++ /dev/null @@ -1,182 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_WIDGET_FILL_STYLE 0 - - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -//--------------------------------------------------------------------- - -kpToolWidgetFillStyle::kpToolWidgetFillStyle (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ - for (int i = 0; i < (int) FillStyleNum; i++) - { - QPixmap pixmap; - - pixmap = fillStylePixmap ((FillStyle) i, - (width () - 2/*margin*/) * 3 / 4, - (height () - 2/*margin*/ - 2/*spacing*/) * 3 / (3 * 4)); - addOption (pixmap, fillStyleName ((FillStyle) i)/*tooltip*/); - - startNewOptionRow (); - } - - finishConstruction (0, 0); -} - -//--------------------------------------------------------------------- - -kpToolWidgetFillStyle::~kpToolWidgetFillStyle () -{ -} - -//--------------------------------------------------------------------- - -// private -QPixmap kpToolWidgetFillStyle::fillStylePixmap (FillStyle fs, int w, int h) -{ - QPixmap pixmap ((w <= 0 ? width () : w), (h <= 0 ? height () : h)); - pixmap.fill(palette().color(QPalette::Window)); - - const int penWidth = 2; - - const QRect rectRect(1, 1, w - 2, h - 2); - - QPainter painter(&pixmap); - painter.setPen(kpPixmapFX::QPainterDrawRectPen(Qt::black, penWidth)); - - switch ( fs ) - { - case NoFill: - { - painter.setBrush(Qt::NoBrush); - break; - } - case FillWithBackground: - { - painter.setBrush(Qt::gray); - break; - } - case FillWithForeground: - { - painter.setBrush(Qt::black); - break; - } - default: ; - } - - painter.drawRect(rectRect); - painter.end(); - - return pixmap; -} - -//--------------------------------------------------------------------- - -// private -QString kpToolWidgetFillStyle::fillStyleName (FillStyle fs) const -{ - // do not complain about the "useless" breaks - // as the return statements might not be return statements one day - - switch (fs) - { - case NoFill: - return i18n ("No Fill"); - break; - case FillWithBackground: - return i18n ("Fill with Background Color"); - break; - case FillWithForeground: - return i18n ("Fill with Foreground Color"); - break; - default: - return QString(); - break; - } -} - -//--------------------------------------------------------------------- - -// public -kpToolWidgetFillStyle::FillStyle kpToolWidgetFillStyle::fillStyle () const -{ -#if DEBUG_KP_TOOL_WIDGET_FILL_STYLE - kDebug () << "kpToolWidgetFillStyle::fillStyle() selected=" - << selectedRow () - << endl; -#endif - return (FillStyle) selectedRow (); -} - -//--------------------------------------------------------------------- - -kpColor kpToolWidgetFillStyle::drawingBackgroundColor ( - const kpColor &foregroundColor, const kpColor &backgroundColor) const -{ - switch (fillStyle ()) - { - default: - case NoFill: - return kpColor::Invalid; - - case FillWithBackground: - return backgroundColor; - - case FillWithForeground: - return foregroundColor; - } -} - -//--------------------------------------------------------------------- - -// virtual protected slot [base kpToolWidgetBase] -bool kpToolWidgetFillStyle::setSelected (int row, int col, bool saveAsDefault) -{ - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit fillStyleChanged (fillStyle ()); - return ret; -} - -//--------------------------------------------------------------------- - -#include "moc_kpToolWidgetFillStyle.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.h deleted file mode 100644 index 1313e005..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetFillStyle.h +++ /dev/null @@ -1,79 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_FILL_STYLE_H -#define KP_TOOL_WIDGET_FILL_STYLE_H - - -#include - - -#include -#include - -class kpColor; - - -class kpToolWidgetFillStyle : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetFillStyle (QWidget *parent, const QString &name); - virtual ~kpToolWidgetFillStyle (); - - enum FillStyle - { - NoFill, - FillWithBackground, - FillWithForeground, - FillStyleNum /* not (a valid FillStyle) */ - }; - -private: - QPixmap fillStylePixmap (FillStyle fs, int width, int height); - QString fillStyleName (FillStyle fs) const; - -public: - FillStyle fillStyle () const; - - // Returns the actual fill colour. - // e.g. "FillWithBackground" fillStyle() -> , - // "FillWithForeground" fillStyle() -> . - kpColor drawingBackgroundColor ( - const kpColor &foregroundColor, const kpColor &backgroundColor) const; - -signals: - void fillStyleChanged (kpToolWidgetFillStyle::FillStyle fillStyle); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_FILL_STYLE_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.cpp deleted file mode 100644 index daa6f08e..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include - -#include -#include -#include - -#include - -#include -#include - - -static int lineWidths [] = {1, 2, 3, 5, 8}; - -kpToolWidgetLineWidth::kpToolWidgetLineWidth (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ - int numLineWidths = sizeof (lineWidths) / sizeof (lineWidths [0]); - - int w = (width () - 2/*margin*/) * 3 / 4; - int h = (height () - 2/*margin*/ - (numLineWidths - 1)/*spacing*/) * 3 / (numLineWidths * 4); - - for (int i = 0; i < numLineWidths; i++) - { - QImage image ((w <= 0 ? width () : w), - (h <= 0 ? height () : h), QImage::Format_ARGB32_Premultiplied); - image.fill(QColor(Qt::transparent).rgba()); - - - kpPixmapFX::fillRect (&image, - 0, (image.height () - lineWidths [i]) / 2, - image.width (), lineWidths [i], - kpColor::Black); - - - addOption (QPixmap::fromImage(image), QString::number (lineWidths [i])); - startNewOptionRow (); - } - - finishConstruction (0, 0); -} - -kpToolWidgetLineWidth::~kpToolWidgetLineWidth () -{ -} - -int kpToolWidgetLineWidth::lineWidth () const -{ - return lineWidths [selectedRow ()]; -} - -// virtual protected slot [base kpToolWidgetBase] -bool kpToolWidgetLineWidth::setSelected (int row, int col, bool saveAsDefault) -{ - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit lineWidthChanged (lineWidth ()); - return ret; -} - - -#include "moc_kpToolWidgetLineWidth.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.h deleted file mode 100644 index 14398b31..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_LINE_WIDTH_H -#define KP_TOOL_WIDGET_LINE_WIDTH_H - - -#include - - -class kpToolWidgetLineWidth : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetLineWidth (QWidget *parent, const QString &name); - virtual ~kpToolWidgetLineWidth (); - - int lineWidth () const; - -signals: - void lineWidthChanged (int width); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_LINE_WIDTH_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.cpp deleted file mode 100644 index d96d42ae..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT 0 - - -#include - -#include -#include -#include - - -//--------------------------------------------------------------------- - -kpToolWidgetOpaqueOrTransparent::kpToolWidgetOpaqueOrTransparent (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ - addOption (UserIcon ("option_opaque"), i18n ("Opaque")/*tooltip*/); - startNewOptionRow (); - addOption (UserIcon ("option_transparent"), i18n ("Transparent")/*tooltip*/); - - finishConstruction (0, 0); -} - -//--------------------------------------------------------------------- - -kpToolWidgetOpaqueOrTransparent::~kpToolWidgetOpaqueOrTransparent () -{ -} - -//--------------------------------------------------------------------- - - -// public -bool kpToolWidgetOpaqueOrTransparent::isOpaque () const -{ - return (selected () == 0); -} - -// public -bool kpToolWidgetOpaqueOrTransparent::isTransparent () const -{ - return (!isOpaque ()); -} - -// public -void kpToolWidgetOpaqueOrTransparent::setOpaque (bool yes) -{ -#if DEBUG_KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT && 1 - kDebug () << "kpToolWidgetOpaqueOrTransparent::setOpaque(" << yes << ")"; -#endif - setSelected (yes ? 0 : 1, 0, false/*don't save*/); -} - -// public -void kpToolWidgetOpaqueOrTransparent::setTransparent (bool yes) -{ -#if DEBUG_KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT && 1 - kDebug () << "kpToolWidgetOpaqueOrTransparent::setTransparent(" << yes << ")"; -#endif - setSelected (yes ? 1 : 0, 0, false/*don't save*/); -} - - -// protected slot virtual [base kpToolWidgetBase] -bool kpToolWidgetOpaqueOrTransparent::setSelected (int row, int col, bool saveAsDefault) -{ -#if DEBUG_KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT && 1 - kDebug () << "kpToolWidgetOpaqueOrTransparent::setSelected(" - << row << "," << col << ")" << endl; -#endif - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit isOpaqueChanged (isOpaque ()); - return ret; -} - - -#include "moc_kpToolWidgetOpaqueOrTransparent.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.h deleted file mode 100644 index bca63f9a..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetOpaqueOrTransparent.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT_H -#define KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT_H - - -#include - - -class kpToolWidgetOpaqueOrTransparent : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetOpaqueOrTransparent (QWidget *parent, const QString &name); - virtual ~kpToolWidgetOpaqueOrTransparent (); - - bool isOpaque () const; - bool isTransparent () const; - void setOpaque (bool yes = true); - void setTransparent (bool yes = true); - -signals: - void isOpaqueChanged (bool isOpaque); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_OPAQUE_OR_TRANSPARENT_H diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.cpp b/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.cpp deleted file mode 100644 index 745b96fe..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.cpp +++ /dev/null @@ -1,120 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#define DEBUG_KP_TOOL_WIDGET_SPRAYCAN_SIZE 0 - - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - - -static int spraycanSizes [] = {9, 17, 29}; - -kpToolWidgetSpraycanSize::kpToolWidgetSpraycanSize (QWidget *parent, const QString &name) - : kpToolWidgetBase (parent, name) -{ -#if DEBUG_KP_TOOL_WIDGET_SPRAYCAN_SIZE - kDebug () << "kpToolWidgetSpraycanSize::kpToolWidgetSpraycanSize() CALLED!"; -#endif - - for (int i = 0; i < int (sizeof (spraycanSizes) / sizeof (spraycanSizes [0])); i++) - { - int s = spraycanSizes [i]; - QString iconName = QString ("tool_spraycan_%1x%2").arg (s).arg(s); - - #if DEBUG_KP_TOOL_WIDGET_SPRAYCAN_SIZE - kDebug () << "\ticonName=" << iconName; - #endif - - QPixmap pixmap (s, s); - pixmap.fill (Qt::white); - - QPainter painter (&pixmap); - painter.drawPixmap (0, 0, UserIcon (iconName)); - painter.end (); - - QImage image = pixmap.toImage(); - - QBitmap mask (pixmap.width (), pixmap.height ()); - mask.fill (Qt::color0); - - painter.begin (&mask); - painter.setPen (Qt::color1); - - for (int y = 0; y < image.height (); y++) - { - for (int x = 0; x < image.width (); x++) - { - if ((image.pixel (x, y) & RGB_MASK) == 0/*black*/) - painter.drawPoint (x, y); // mark as opaque - } - } - - painter.end (); - - pixmap.setMask (mask); - - addOption (pixmap, i18n ("%1x%2", s, s)/*tooltip*/); - if (i == 1) - startNewOptionRow (); - } - - finishConstruction (0, 0); -} - -kpToolWidgetSpraycanSize::~kpToolWidgetSpraycanSize () -{ -} - - -// public -int kpToolWidgetSpraycanSize::spraycanSize () const -{ - return spraycanSizes[selected() < 0 ? 0 : selected()]; -} - -// protected slot virtual [base kpToolWidgetBase] -bool kpToolWidgetSpraycanSize::setSelected (int row, int col, bool saveAsDefault) -{ - const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault); - if (ret) - emit spraycanSizeChanged (spraycanSize ()); - return ret; -} - -#include "moc_kpToolWidgetSpraycanSize.cpp" diff --git a/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.h b/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.h deleted file mode 100644 index b604efb2..00000000 --- a/kolourpaint/widgets/toolbars/options/kpToolWidgetSpraycanSize.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef KP_TOOL_WIDGET_SPRAYCAN_SIZE_H -#define KP_TOOL_WIDGET_SPRAYCAN_SIZE_H - - -#include - - -class kpToolWidgetSpraycanSize : public kpToolWidgetBase -{ -Q_OBJECT - -public: - kpToolWidgetSpraycanSize (QWidget *parent, const QString &name); - virtual ~kpToolWidgetSpraycanSize (); - - int spraycanSize () const; - -signals: - void spraycanSizeChanged (int size); - -protected slots: - virtual bool setSelected (int row, int col, bool saveAsDefault); -}; - - -#endif // KP_TOOL_WIDGET_SPRAYCAN_SIZE_H diff --git a/kuser/CMakeLists.txt b/kuser/CMakeLists.txt index d382de72..9812d14f 100644 --- a/kuser/CMakeLists.txt +++ b/kuser/CMakeLists.txt @@ -16,7 +16,7 @@ add_subdirectory(toolbar) add_subdirectory(icon) # use the project-specific _SOURCE_DIR variable (set by the project() call above), Alex -include_directories(${kuser_SOURCE_DIR} ${KDEPIMLIBS_INCLUDE_DIR}) +include_directories(${kuser_SOURCE_DIR}) set(KU_HOMEDIR_PERM 0700 CACHE STRING "Default home directory permissions") set(KU_MAILBOX_GID 0 CACHE STRING "Default GID of the created mbox file") diff --git a/libkscreen/CMakeLists.txt b/libkscreen/CMakeLists.txt index c8c2a1b6..a6604412 100644 --- a/libkscreen/CMakeLists.txt +++ b/libkscreen/CMakeLists.txt @@ -33,11 +33,6 @@ set_package_properties(X11_XCB PROPERTIES DESCRIPTION "XCB extension to work wit PURPOSE "Needed to build XRandR 1.1 backend" ) -if(ENABLE_TESTING) - find_package(QJSON 0.8 REQUIRED) - link_directories(${QJSON_LIBRARY_DIRS}) -endif() - check_cxx_compiler_flag(-fvisibility=hidden _HAVE_VISIBILITY) if (_HAVE_VISIBILITY AND NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") diff --git a/libkscreen/backends/fake/CMakeLists.txt b/libkscreen/backends/fake/CMakeLists.txt index 9f54e3ed..febc156e 100644 --- a/libkscreen/backends/fake/CMakeLists.txt +++ b/libkscreen/backends/fake/CMakeLists.txt @@ -1,7 +1,7 @@ -include_directories(${CMAKE_SOURCE_DIR}/src - ${CMAKE_BUILD_DIR} - ${QT_INCLUDES} - ${QJSON_INCLUDE_DIR} +include_directories( + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BUILD_DIR} + ${QT_INCLUDES} ) set(fake_SRCS @@ -12,11 +12,12 @@ set(fake_SRCS add_library(KSC_Fake MODULE ${fake_SRCS}) set_target_properties(KSC_Fake PROPERTIES PREFIX "") -target_link_libraries(KSC_Fake ${QT_QTCORE_LIBRARY} - ${QJSON_LIBRARIES} - kscreen +target_link_libraries(KSC_Fake + ${QT_QTCORE_LIBRARY} + kscreen ) -install(TARGETS KSC_Fake DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/kscreen/) - - +install( + TARGETS KSC_Fake + DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/kscreen/ +)