File indexing completed on 2025-01-26 04:11:18

0001 /*
0002  *  SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
0003  *  SPDX-FileCopyrightText: 2004-2008 Boudewijn Rempt <boud@valdyas.org>
0004  *  SPDX-FileCopyrightText: 2004 Clarence Dang <dang@kde.org>
0005  *  SPDX-FileCopyrightText: 2004 Adrian Page <adrian@pagenet.plus.com>
0006  *  SPDX-FileCopyrightText: 2004 Cyrille Berger <cberger@cberger.net>
0007  *
0008  *  SPDX-License-Identifier: GPL-2.0-or-later
0009  */
0010 
0011 #include "kis_duplicateop_settings_widget.h"
0012 #include "KisDuplicateOptionData.h"
0013 #include "kis_duplicateop_settings.h"
0014 
0015 #include <KisCompositeOpOptionWidget.h>
0016 #include <KisDuplicateOptionWidget.h>
0017 #include <KisMirrorOptionWidget.h>
0018 #include <KisPaintOpOptionWidgetUtils.h>
0019 #include <KisSizeOptionWidget.h>
0020 #include <KisStandardOptionData.h>
0021 #include <KisTextureOptionWidget.h>
0022 #include <brushengine/kis_paintop_lod_limitations.h>
0023 #include <kis_image.h>
0024 #include <kis_paintop_settings_widget.h>
0025 #include <kis_properties_configuration.h>
0026 
0027 KisDuplicateOpSettingsWidget::KisDuplicateOpSettingsWidget(QWidget* parent, KisResourcesInterfaceSP resourcesInterface, KoCanvasResourcesInterfaceSP canvasResourcesInterface)
0028     : KisBrushBasedPaintopOptionWidget(KisBrushOptionWidgetFlag::SupportsPrecision,
0029                                        parent)
0030 {
0031     Q_UNUSED(canvasResourcesInterface)
0032     namespace kpowu = KisPaintOpOptionWidgetUtils;
0033 
0034     setObjectName("brush option widget");
0035 
0036     addPaintOpOption(kpowu::createOptionWidget<KisCompositeOpOptionWidget>());
0037     addPaintOpOption(kpowu::createOpacityOptionWidget());
0038     addPaintOpOption(kpowu::createOptionWidget<KisSizeOptionWidget>());
0039     addPaintOpOption(kpowu::createRotationOptionWidget());
0040     addPaintOpOption(kpowu::createOptionWidget<KisMirrorOptionWidget>());
0041     addPaintOpOption(kpowu::createOptionWidget<KisDuplicateOptionWidget>());
0042     addPaintOpOption(kpowu::createOptionWidget<KisTextureOptionWidget>(KisTextureOptionData(), resourcesInterface));
0043     addPaintOpOption(kpowu::createCurveOptionWidget(KisStrengthOptionData(),
0044                                                     KisPaintOpOption::TEXTURE,
0045                                                     i18n("Weak"),
0046                                                     i18n("Strong")));
0047 }
0048 
0049 KisDuplicateOpSettingsWidget::~KisDuplicateOpSettingsWidget()
0050 {
0051 }
0052 
0053 KisPropertiesConfigurationSP KisDuplicateOpSettingsWidget::configuration() const
0054 {
0055     KisDuplicateOpSettings *config = new KisDuplicateOpSettings(resourcesInterface());
0056     config->setProperty("paintop", "duplicate"); // XXX: make this a const id string
0057     writeConfiguration(config);
0058     return config;
0059 }
0060 
0061 KisPaintopLodLimitations KisDuplicateOpSettingsWidget::lodLimitations() const
0062 {
0063     KisPaintopLodLimitations l = KisBrushBasedPaintopOptionWidget::lodLimitations();
0064     l.blockers << KoID("clone-brush", i18nc("PaintOp instant preview limitation", "Clone Brush (temporarily disabled)"));
0065     return l;
0066 }