File indexing completed on 2024-04-28 04:20:22
0001 /* 0002 Copyright (c) 2003-2007 Clarence Dang <dang@kde.org> 0003 Copyright (c) 2014 Martin Koller <kollix@aon.at> 0004 All rights reserved. 0005 0006 Redistribution and use in source and binary forms, with or without 0007 modification, are permitted provided that the following conditions 0008 are met: 0009 0010 1. Redistributions of source code must retain the above copyright 0011 notice, this list of conditions and the following disclaimer. 0012 2. Redistributions in binary form must reproduce the above copyright 0013 notice, this list of conditions and the following disclaimer in the 0014 documentation and/or other materials provided with the distribution. 0015 0016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0017 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0018 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0019 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0020 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0021 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0022 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0023 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0025 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 */ 0027 0028 0029 #ifndef kpMainWindowPrivate_H 0030 #define kpMainWindowPrivate_H 0031 0032 0033 #define DEBUG_KP_MAIN_WINDOW 0 0034 0035 0036 #include "document/kpDocumentSaveOptions.h" 0037 0038 0039 class QAction; 0040 class QActionGroup; 0041 class QLabel; 0042 0043 class KSelectAction; 0044 class KToggleAction; 0045 class KSqueezedTextLabel; 0046 class KRecentFilesAction; 0047 class KFontAction; 0048 class KFontSizeAction; 0049 class KToggleFullScreenAction; 0050 class kpCommandEnvironment; 0051 class kpDocumentEnvironment; 0052 class kpToolSelectionEnvironment; 0053 class kpTransformDialogEnvironment; 0054 class kpViewScrollableContainer; 0055 class kpZoomedView; 0056 class kpThumbnail; 0057 class kpThumbnailView; 0058 class kpDocument; 0059 class kpViewManager; 0060 class kpColorToolBar; 0061 class kpToolToolBar; 0062 class kpCommandHistory; 0063 class kpTool; 0064 class kpToolText; 0065 class SaneDialog; 0066 0067 0068 struct kpMainWindowPrivate 0069 { 0070 kpMainWindowPrivate () 0071 : isFullyConstructed(false), 0072 scrollView(nullptr), 0073 mainView(nullptr), 0074 thumbnail(nullptr), 0075 thumbnailView(nullptr), 0076 document(nullptr), 0077 viewManager(nullptr), 0078 colorToolBar(nullptr), 0079 toolToolBar(nullptr), 0080 commandHistory(nullptr), 0081 0082 configFirstTime(false), 0083 configShowGrid(false), 0084 configShowPath(false), 0085 configThumbnailShown(false), 0086 configZoomedThumbnail(false), 0087 0088 documentEnvironment(nullptr), 0089 commandEnvironment(nullptr), 0090 0091 // Tools 0092 0093 toolSelectionEnvironment(nullptr), 0094 toolsActionGroup(nullptr), 0095 0096 toolSpraycan(nullptr), 0097 toolBrush(nullptr), 0098 toolColorEraser(nullptr), 0099 toolColorPicker(nullptr), 0100 toolCurve(nullptr), 0101 toolEllipse(nullptr), 0102 toolEllipticalSelection(nullptr), 0103 toolEraser(nullptr), 0104 toolFloodFill(nullptr), 0105 toolFreeFormSelection(nullptr), 0106 toolLine(nullptr), 0107 toolPen(nullptr), 0108 toolPolygon(nullptr), 0109 toolPolyline(nullptr), 0110 toolRectangle(nullptr), 0111 toolRectSelection(nullptr), 0112 toolRoundedRectangle(nullptr), 0113 toolZoom(nullptr), 0114 toolText(nullptr), 0115 0116 lastToolNumber(0), 0117 toolActionsEnabled(false), 0118 actionPrevToolOptionGroup1(nullptr), 0119 actionNextToolOptionGroup1(nullptr), 0120 actionPrevToolOptionGroup2(nullptr), 0121 actionNextToolOptionGroup2(nullptr), 0122 0123 settingImageSelectionTransparency(0), 0124 0125 docResizeWidth(0), 0126 docResizeHeight(0), 0127 docResizeToBeCompleted(false), 0128 0129 configOpenImagesInSameWindow(false), 0130 configPrintImageCenteredOnPage(false), 0131 0132 actionNew(nullptr), 0133 actionOpen(nullptr), 0134 actionOpenRecent(nullptr), 0135 actionScan(nullptr), 0136 actionScreenshot(nullptr), 0137 actionProperties(nullptr), 0138 actionSave(nullptr), 0139 actionSaveAs(nullptr), 0140 actionExport(nullptr), 0141 actionReload(nullptr), 0142 actionPrint(nullptr), 0143 actionPrintPreview(nullptr), 0144 actionMail(nullptr), 0145 actionClose(nullptr), 0146 actionQuit(nullptr), 0147 0148 scanDialog(nullptr), 0149 0150 exportFirstTime(false), 0151 0152 // Edit Menu 0153 0154 editMenuDocumentActionsEnabled(false), 0155 0156 actionUndo(nullptr), 0157 actionRedo(nullptr), 0158 actionCut(nullptr), 0159 actionCopy(nullptr), 0160 actionPaste(nullptr), 0161 actionPasteInNewWindow(nullptr), 0162 actionDelete(nullptr), 0163 actionSelectAll(nullptr), 0164 actionDeselect(nullptr), 0165 actionCopyToFile(nullptr), 0166 actionPasteFromFile(nullptr), 0167 0168 copyToFirstTime(false), 0169 0170 // View Menu 0171 0172 configThumbnailShowRectangle(false), 0173 actionShowThumbnailRectangle(nullptr), 0174 0175 viewMenuDocumentActionsEnabled(false), 0176 0177 actionActualSize(nullptr), 0178 actionFitToPage(nullptr), 0179 actionFitToWidth(nullptr), 0180 actionFitToHeight(nullptr), 0181 actionZoomIn(nullptr), 0182 actionZoomOut(nullptr), 0183 actionZoom(nullptr), 0184 actionShowGrid(nullptr), 0185 actionShowThumbnail(nullptr), 0186 actionZoomedThumbnail(nullptr), 0187 0188 thumbnailSaveConfigTimer(nullptr), 0189 0190 // Image Menu 0191 0192 transformDialogEnvironment(nullptr), 0193 0194 imageMenuDocumentActionsEnabled(false), 0195 0196 actionResizeScale(nullptr), 0197 actionCrop(nullptr), 0198 actionAutoCrop(nullptr), 0199 actionFlip(nullptr), 0200 actionMirror(nullptr), 0201 actionRotate(nullptr), 0202 actionRotateLeft(nullptr), 0203 actionRotateRight(nullptr), 0204 actionSkew(nullptr), 0205 actionConvertToBlackAndWhite(nullptr), 0206 actionConvertToGrayscale(nullptr), 0207 actionBlur(nullptr), 0208 actionMoreEffects(nullptr), 0209 actionInvertColors(nullptr), 0210 actionClear(nullptr), 0211 0212 actionDrawOpaque(nullptr), 0213 actionDrawColorSimilarity(nullptr), 0214 0215 moreEffectsDialogLastEffect(0), 0216 0217 // Colors Menu 0218 0219 colorMenuDocumentActionsEnabled(false), 0220 0221 actionColorsDefault(nullptr), 0222 actionColorsKDE(nullptr), 0223 actionColorsOpen(nullptr), 0224 actionColorsReload(nullptr), 0225 actionColorsSave(nullptr), 0226 actionColorsSaveAs(nullptr), 0227 actionColorsAppendRow(nullptr), 0228 actionColorsDeleteRow(nullptr), 0229 0230 // Settings Menu 0231 0232 actionShowPath(nullptr), 0233 actionKeyBindings(nullptr), 0234 actionConfigureToolbars(nullptr), 0235 actionConfigure(nullptr), 0236 actionFullScreen(nullptr), 0237 0238 // Status Bar 0239 0240 statusBarCreated(false), 0241 statusBarMessageLabel(nullptr), 0242 statusBarShapeLastPointsInitialised(false), 0243 statusBarShapeLastSizeInitialised(false), 0244 0245 // Text ToolBar 0246 0247 actionTextFontFamily(nullptr), 0248 actionTextFontSize(nullptr), 0249 actionTextBold(nullptr), 0250 actionTextItalic(nullptr), 0251 actionTextUnderline(nullptr), 0252 actionTextStrikeThru(nullptr), 0253 settingTextStyle(0), 0254 textOldFontSize(0) 0255 { 0256 } 0257 0258 bool isFullyConstructed; 0259 0260 kpViewScrollableContainer *scrollView; 0261 kpZoomedView *mainView; 0262 kpThumbnail *thumbnail; 0263 kpThumbnailView *thumbnailView; 0264 kpDocument *document; 0265 kpViewManager *viewManager; 0266 kpColorToolBar *colorToolBar; 0267 kpToolToolBar *toolToolBar; 0268 kpCommandHistory *commandHistory; 0269 0270 bool configFirstTime; 0271 bool configShowGrid; 0272 bool configShowPath; 0273 0274 bool configThumbnailShown; 0275 QRect configThumbnailGeometry; 0276 bool configZoomedThumbnail; 0277 0278 kpDocumentEnvironment *documentEnvironment; 0279 kpCommandEnvironment *commandEnvironment; 0280 0281 // 0282 // Tools 0283 // 0284 0285 kpToolSelectionEnvironment *toolSelectionEnvironment; 0286 QActionGroup *toolsActionGroup; 0287 0288 kpTool *toolSpraycan, *toolBrush, 0289 *toolColorEraser, *toolColorPicker, 0290 *toolCurve, *toolEllipse, 0291 *toolEllipticalSelection, *toolEraser, 0292 *toolFloodFill, *toolFreeFormSelection, 0293 *toolLine, *toolPen, *toolPolygon, 0294 *toolPolyline, *toolRectangle, *toolRectSelection, 0295 *toolRoundedRectangle, *toolZoom; 0296 kpToolText *toolText; 0297 0298 QList <kpTool *> tools; 0299 int lastToolNumber; 0300 0301 bool toolActionsEnabled; 0302 QAction *actionPrevToolOptionGroup1, 0303 *actionNextToolOptionGroup1, 0304 *actionPrevToolOptionGroup2, 0305 *actionNextToolOptionGroup2; 0306 0307 int settingImageSelectionTransparency; 0308 0309 int docResizeWidth, docResizeHeight; 0310 bool docResizeToBeCompleted; 0311 0312 // 0313 // File Menu 0314 // 0315 0316 bool configOpenImagesInSameWindow, configPrintImageCenteredOnPage; 0317 0318 QAction *actionNew, *actionOpen; 0319 KRecentFilesAction *actionOpenRecent; 0320 QAction *actionScan, *actionScreenshot, *actionProperties, 0321 *actionSave, *actionSaveAs, *actionExport, 0322 *actionReload, 0323 *actionPrint, *actionPrintPreview, 0324 *actionMail, 0325 *actionClose, *actionQuit; 0326 0327 SaneDialog *scanDialog; 0328 0329 QUrl lastExportURL; 0330 kpDocumentSaveOptions lastExportSaveOptions; 0331 bool exportFirstTime; 0332 0333 // 0334 // Edit Menu 0335 // 0336 0337 bool editMenuDocumentActionsEnabled; 0338 0339 QAction *actionUndo, *actionRedo, 0340 *actionCut, *actionCopy, 0341 *actionPaste, *actionPasteInNewWindow, 0342 *actionDelete, 0343 *actionSelectAll, *actionDeselect, 0344 *actionCopyToFile, *actionPasteFromFile; 0345 0346 QUrl lastCopyToURL; 0347 kpDocumentSaveOptions lastCopyToSaveOptions; 0348 bool copyToFirstTime; 0349 0350 // 0351 // View Menu 0352 // 0353 0354 bool configThumbnailShowRectangle; 0355 KToggleAction *actionShowThumbnailRectangle; 0356 0357 bool viewMenuDocumentActionsEnabled; 0358 0359 QAction *actionActualSize, 0360 *actionFitToPage, *actionFitToWidth, *actionFitToHeight, 0361 *actionZoomIn, *actionZoomOut; 0362 KSelectAction *actionZoom; 0363 KToggleAction *actionShowGrid, 0364 *actionShowThumbnail, *actionZoomedThumbnail; 0365 0366 QList <int> zoomList; 0367 0368 QTimer *thumbnailSaveConfigTimer; 0369 0370 // 0371 // Image Menu 0372 // 0373 0374 kpTransformDialogEnvironment *transformDialogEnvironment; 0375 0376 bool imageMenuDocumentActionsEnabled; 0377 0378 QAction *actionResizeScale, 0379 *actionCrop, *actionAutoCrop, 0380 *actionFlip, *actionMirror, 0381 *actionRotate, *actionRotateLeft, *actionRotateRight, 0382 *actionSkew, 0383 *actionConvertToBlackAndWhite, *actionConvertToGrayscale, 0384 *actionBlur, *actionMoreEffects, 0385 *actionInvertColors, *actionClear; 0386 0387 // Implemented in kpMainWindow_Tools.cpp, not kpImageWindow_Image.cpp 0388 // since they're really setting tool options. 0389 KToggleAction *actionDrawOpaque; 0390 QAction *actionDrawColorSimilarity; 0391 0392 int moreEffectsDialogLastEffect; 0393 0394 // 0395 // Colors Menu 0396 // 0397 0398 bool colorMenuDocumentActionsEnabled; 0399 0400 QAction *actionColorsDefault; 0401 KSelectAction *actionColorsKDE; 0402 QAction *actionColorsOpen, *actionColorsReload; 0403 0404 QAction *actionColorsSave, *actionColorsSaveAs; 0405 0406 QAction *actionColorsAppendRow; 0407 QAction *actionColorsDeleteRow; 0408 0409 // 0410 // Settings Menu 0411 // 0412 0413 KToggleAction *actionShowPath; 0414 QAction *actionKeyBindings, *actionConfigureToolbars, *actionConfigure; 0415 KToggleFullScreenAction *actionFullScreen; 0416 0417 // 0418 // Status Bar 0419 // 0420 0421 bool statusBarCreated; 0422 KSqueezedTextLabel *statusBarMessageLabel; 0423 QList<QLabel *> statusBarLabels; 0424 0425 bool statusBarShapeLastPointsInitialised; 0426 QPoint statusBarShapeLastStartPoint, statusBarShapeLastEndPoint; 0427 bool statusBarShapeLastSizeInitialised; 0428 QSize statusBarShapeLastSize; 0429 0430 // 0431 // Text ToolBar 0432 // 0433 0434 KFontAction *actionTextFontFamily; 0435 KFontSizeAction *actionTextFontSize; 0436 KToggleAction *actionTextBold, *actionTextItalic, 0437 *actionTextUnderline, *actionTextStrikeThru; 0438 0439 int settingTextStyle; 0440 QString textOldFontFamily; 0441 int textOldFontSize; 0442 }; 0443 0444 0445 #endif // kpMainWindowPrivate_H