File indexing completed on 2024-04-28 04:32:04

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef MainWindow_H
0012 #define MainWindow_H
0013 
0014 #include <KXmlGuiWindow>
0015 
0016 class QPrinter;
0017 class QString;
0018 class QUndoView;
0019 class QUrl;
0020 
0021 class Document;
0022 class Editor;
0023 class Palette;
0024 class Preview;
0025 class Scale;
0026 class ScaledPixmapLabel;
0027 class SchemeManager;
0028 
0029 class MainWindow : public KXmlGuiWindow
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     MainWindow();
0035     explicit MainWindow(const QUrl &);
0036     explicit MainWindow(const QString &);
0037     virtual ~MainWindow();
0038 
0039     Editor *editor();
0040     Preview *preview();
0041     Palette *palette();
0042 
0043     void loadSettings();
0044 
0045     void updateBackgroundImageActionLists();
0046 
0047 protected:
0048     virtual bool queryClose() Q_DECL_OVERRIDE;
0049 
0050 protected slots:
0051     // File menu
0052     void fileNew();
0053     void fileOpen();
0054     void fileOpen(const QUrl &);
0055     void fileSave();
0056     void fileSaveAs();
0057     void fileRevert();
0058     void filePrintSetup();
0059     void filePrint();
0060     void printPages();
0061     void fileImportImage();
0062     void fileProperties();
0063     void fileAddBackgroundImage();
0064     void fileRemoveBackgroundImage();
0065     void fileClose();
0066     void fileQuit();
0067 
0068     // Edit menu
0069     void editUndo();
0070     void editRedo();
0071     void undoTextChanged(const QString &);
0072     void redoTextChanged(const QString &);
0073     void clipboardDataChanged();
0074 
0075     // Tool menu
0076 
0077     // Palette menu
0078     void paletteManager();
0079     void paletteShowSymbols(bool);
0080     void paletteClearUnused();
0081     void paletteCalibrateScheme();
0082     void paletteSwapColors(int, int);
0083     void paletteReplaceColor(int, int);
0084 
0085     // View menu
0086     void viewFitBackgroundImage();
0087     void viewShowBackgroundImage();
0088 
0089     // Library menu
0090 
0091     // Pattern menu
0092     void patternExtend();
0093     void patternCentre();
0094     void patternCrop();
0095     void patternCropToSelection();
0096     void insertColumns();
0097     void insertRows();
0098 
0099     // Settings menu
0100     void preferences();
0101     void settingsChanged();
0102 
0103     void documentModified(bool);
0104 
0105 private slots:
0106     void paletteContextMenu(const QPoint &);
0107 
0108 private:
0109     void setupMainWindow();
0110     void setupLayout();
0111     void setupDockWindows();
0112     void setupActions();
0113     void setupDocument();
0114     void setupConnections();
0115     void setupActionDefaults();
0116     void setupActionsFromDocument();
0117     void convertImage(const QString &);
0118     void convertPreview(const QString &, const QRect &);
0119     QPrinter *printer();
0120 
0121     Document *m_document;
0122     Editor *m_editor;
0123     Palette *m_palette;
0124     Preview *m_preview;
0125     QUndoView *m_history;
0126 
0127     ScaledPixmapLabel *m_imageLabel;
0128 
0129     Scale *m_horizontalScale;
0130     Scale *m_verticalScale;
0131 
0132     QPrinter *m_printer;
0133 };
0134 
0135 #endif // MainWindow_H