File indexing completed on 2024-12-22 04:15:07

0001 /*
0002  * SPDX-FileCopyrightText: 2013 Lukáš Tvrdý <lukast.dev@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef DLG_OFFSETIMAGE
0008 #define DLG_OFFSETIMAGE
0009 
0010 #include <KoDialog.h>
0011 #include <kis_global.h>
0012 #include <QDebug>
0013 #include "ui_wdg_offsetimage.h"
0014 
0015 class KisDocumentAwareSpinBoxUnitManager;
0016 
0017 class WdgOffsetImage : public QWidget, public Ui::WdgOffsetImage
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     WdgOffsetImage(QWidget *parent) : QWidget(parent) {
0023         setupUi(this);
0024     }
0025 };
0026 
0027 class DlgOffsetImage: public KoDialog
0028 {
0029 
0030     Q_OBJECT
0031 
0032 public:
0033 
0034     static const QString PARAM_PREFIX;
0035     static const QString PARAM_XOFFSET_UNIT;
0036     static const QString PARAM_YOFFSET_UNIT;
0037 
0038     DlgOffsetImage(QWidget * parent = 0, const char* name = 0, QSize imageSize = QSize());
0039     ~DlgOffsetImage() override;
0040 
0041     int offsetX() const { return m_offsetX; }
0042     int offsetY() const { return m_offsetY; }
0043 
0044 
0045 private Q_SLOTS:
0046     void okClicked();
0047     void slotOffsetXChanged(double);
0048     void slotOffsetYChanged(double);
0049     void slotMiddleOffset();
0050 
0051 private:
0052     WdgOffsetImage * m_page {0};
0053     int m_offsetX {0};
0054     int m_offsetY {0};
0055     bool m_lock {false};
0056     QSize m_offsetSize;
0057 
0058     KisDocumentAwareSpinBoxUnitManager* _widthUnitManager {0};
0059     KisDocumentAwareSpinBoxUnitManager* _heightUnitManager {0};
0060 
0061 };
0062 
0063 #endif // DLG_OFFSETIMAGE