File indexing completed on 2024-06-23 04:28:30
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_TOOL_TRANSFORM_CONFIG_WIDGET_H 0008 #define __KIS_TOOL_TRANSFORM_CONFIG_WIDGET_H 0009 0010 #include "transform_transaction_properties.h" 0011 #include "tool_transform_args.h" 0012 #include "ui_wdg_tool_transform.h" 0013 0014 class KisCanvas2; 0015 0016 0017 class KisToolTransformConfigWidget : public QWidget, private Ui::WdgToolTransform 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, QWidget *parent); 0023 0024 void setApplyResetDisabled(bool disabled); 0025 void resetRotationCenterButtons(); 0026 void setDefaultWarpPoints(int pointsPerLine = -1); 0027 void setTooBigLabelVisible(bool value); 0028 0029 public Q_SLOTS: 0030 void updateConfig(const ToolTransformArgs &config); 0031 void slotUpdateIcons(); 0032 0033 Q_SIGNALS: 0034 void sigConfigChanged(bool needsPreviewRecalculation); 0035 void sigApplyTransform(); 0036 void sigResetTransform(ToolTransformArgs::TransformMode mode); 0037 void sigCancelTransform(); 0038 void sigRestartTransform(); 0039 void sigUpdateGlobalConfig(); 0040 void sigRestartAndContinueTransform(); 0041 void sigEditingFinished(); 0042 0043 public Q_SLOTS: 0044 0045 void slotFilterChanged(const KoID &filter); 0046 void slotWarpTypeChanged(int index); 0047 void slotRotationCenterChanged(int index); 0048 void slotTransformAroundRotationCenter(bool value); 0049 0050 void slotSetScaleX(int value); 0051 void slotSetScaleY(int value); 0052 0053 void slotSetShearX(qreal value); 0054 void slotSetShearY(qreal value); 0055 0056 void slotSetTranslateX(int value); 0057 void slotSetTranslateY(int value); 0058 0059 void slotSetAX(qreal value); 0060 void slotSetAY(qreal value); 0061 void slotSetAZ(qreal value); 0062 void slotSetCameraHeight(qreal value); 0063 0064 void slotFlipX(); 0065 void slotFlipY(); 0066 void slotRotateCW(); 0067 void slotRotateCCW(); 0068 0069 void slotSetWarpAlpha(qreal value); 0070 void slotSetWarpDensity(int value); 0071 0072 void slotSetKeepAspectRatio(bool value); 0073 0074 void slotTransformAreaVisible(bool value); 0075 0076 void slotWarpDefaultPointsButtonClicked(bool value); 0077 void slotWarpCustomPointsButtonClicked(bool value); 0078 void slotWarpLockPointsButtonClicked(); 0079 void slotWarpResetPointsButtonClicked(); 0080 0081 void slotSetFreeTransformModeButtonClicked(bool); 0082 void slotSetWarpModeButtonClicked(bool); 0083 void slotSetCageModeButtonClicked(bool); 0084 void slotCageOptionsChanged(int); 0085 0086 void slotSetPerspectiveModeButtonClicked(bool); 0087 void slotSetLiquifyModeButtonClicked(bool); 0088 void slotButtonBoxClicked(QAbstractButton *button); 0089 0090 void slotSetMeshModeButtonClicked(bool); 0091 0092 0093 void slotEditCagePoints(bool value); 0094 0095 void liquifySizeChanged(qreal value); 0096 void liquifyAmountChanged(qreal value); 0097 void liquifyFlowChanged(qreal value); 0098 void liquifyBuildUpChanged(int value); 0099 void liquifySpacingChanged(qreal value); 0100 void liquifySizePressureChanged(bool value); 0101 void liquifyAmountPressureChanged(bool value); 0102 void liquifyReverseDirectionChanged(bool value); 0103 0104 void slotLiquifyModeChanged(int value); 0105 0106 void notifyEditingFinished(); 0107 0108 void slotGranularityChanged(QString value); 0109 void slotPreviewGranularityChanged(QString value); 0110 0111 void slotMeshSizeChanged(); 0112 void slotMeshShowHandlesChanged(); 0113 void slotMeshSymmetricalHandlesChanged(); 0114 void slotMeshScaleHandlesChanged(); 0115 0116 void slotPreviewChanged(int index); 0117 0118 private: 0119 0120 void blockNotifications(); 0121 void unblockNotifications(); 0122 void notifyConfigChanged(bool needsPreviewRecalculation = true); 0123 0124 void blockUiSlots(); 0125 void unblockUiSlots(); 0126 0127 void activateCustomWarpPoints(bool enabled); 0128 0129 void updateLockPointsButtonCaption(); 0130 0131 void updateLiquifyControls(); 0132 0133 void resetUIOptions(); 0134 0135 private: 0136 static const int DEFAULT_POINTS_PER_LINE; 0137 0138 private: 0139 TransformTransactionProperties *m_transaction; 0140 QPointF m_handleDir[9]; 0141 QButtonGroup *m_rotationCenterButtons; 0142 int m_notificationsBlocked; 0143 int m_uiSlotsBlocked; 0144 double m_scaleRatio; 0145 bool m_configChanged; 0146 }; 0147 0148 #endif /* __KIS_TOOL_TRANSFORM_CONFIG_WIDGET_H */