diff --git a/plugins/paintops/roundmarker/kis_roundmarker_option.cpp b/plugins/paintops/roundmarker/kis_roundmarker_option.cpp index ec7349f800..708f3e455c 100644 --- a/plugins/paintops/roundmarker/kis_roundmarker_option.cpp +++ b/plugins/paintops/roundmarker/kis_roundmarker_option.cpp @@ -1,78 +1,85 @@ /* * Copyright (c) 2016 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_roundmarker_option.h" #include "kis_signals_blocker.h" +#include +#include +#include + #include "ui_kis_roundmarker_option.h" + class KisRoundMarkerOptionWidget: public QWidget, public Ui::WdgKisRoundMarkerOption { public: KisRoundMarkerOptionWidget(QWidget *parent = 0) : QWidget(parent) { setupUi(this); - dblDiameter->setRange(0.01, 1000, 2); + const int maxBrushSize = KSharedConfig::openConfig()->group("").readEntry("maximumBrushSize", 1000); + + dblDiameter->setRange(0.01, maxBrushSize, 2); dblDiameter->setSuffix(i18n(" px")); } }; KisRoundMarkerOption::KisRoundMarkerOption() : KisPaintOpOption(KisPaintOpOption::GENERAL, false) { m_checkable = false; m_options = new KisRoundMarkerOptionWidget(); connect(m_options->spacingWidget, SIGNAL(sigSpacingChanged()), this, SLOT(emitSettingChanged())); connect(m_options->dblDiameter, SIGNAL(valueChanged(qreal)), this, SLOT(emitSettingChanged())); setConfigurationPage(m_options); setObjectName("KisRoundMarkerOption"); } KisRoundMarkerOption::~KisRoundMarkerOption() { } void KisRoundMarkerOption::writeOptionSetting(KisPropertiesConfigurationSP config) const { RoundMarkerOption op; op.diameter = m_options->dblDiameter->value(); op.spacing = m_options->spacingWidget->spacing(); op.use_auto_spacing = m_options->spacingWidget->autoSpacingActive(); op.auto_spacing_coeff = m_options->spacingWidget->autoSpacingCoeff(); op.writeOptionSetting(config); } void KisRoundMarkerOption::readOptionSetting(KisPropertiesConfigurationSP config) { RoundMarkerOption op; op.readOptionSetting(*config); KisSignalsBlocker b(m_options->dblDiameter, m_options->spacingWidget); m_options->dblDiameter->setValue(op.diameter); m_options->spacingWidget->setSpacing(op.use_auto_spacing, op.use_auto_spacing ? op.auto_spacing_coeff : op.spacing); } diff --git a/plugins/paintops/roundmarker/kis_roundmarkerop_settings.cpp b/plugins/paintops/roundmarker/kis_roundmarkerop_settings.cpp index 0a1018f5c3..90fc235852 100644 --- a/plugins/paintops/roundmarker/kis_roundmarkerop_settings.cpp +++ b/plugins/paintops/roundmarker/kis_roundmarkerop_settings.cpp @@ -1,103 +1,103 @@ /* * Copyright (c) 2016 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_roundmarkerop_settings.h" #include "kis_roundmarker_option.h" struct KisRoundMarkerOpSettings::Private { }; KisRoundMarkerOpSettings::KisRoundMarkerOpSettings() : KisOutlineGenerationPolicy(KisCurrentOutlineFetcher::SIZE_OPTION | KisCurrentOutlineFetcher::ROTATION_OPTION | KisCurrentOutlineFetcher::MIRROR_OPTION), m_d(new Private) { } KisRoundMarkerOpSettings::~KisRoundMarkerOpSettings() { } bool KisRoundMarkerOpSettings::paintIncremental() { return false; } void KisRoundMarkerOpSettings::setPaintOpSize(qreal value) { RoundMarkerOption op; op.readOptionSetting(*this); - op.diameter = qBound(0.01, value, 1000.0); + op.diameter = value; op.writeOptionSetting(this); } qreal KisRoundMarkerOpSettings::paintOpSize() const { RoundMarkerOption op; op.readOptionSetting(*this); return op.diameter; } QPainterPath KisRoundMarkerOpSettings::brushOutline(const KisPaintInformation &info, const OutlineMode &mode) { QPainterPath path; if (mode.isVisible) { qreal finalScale = 1.0; RoundMarkerOption op; op.readOptionSetting(*this); const qreal radius = 0.5 * op.diameter; QPainterPath realOutline; realOutline.addEllipse(QPointF(), radius, radius); path = outlineFetcher()->fetchOutline(info, this, realOutline, mode, finalScale); if (mode.showTiltDecoration) { QPainterPath tiltLine = makeTiltIndicator(info, realOutline.boundingRect().center(), realOutline.boundingRect().width() * 0.5, 3.0); path.addPath(outlineFetcher()->fetchOutline(info, this, tiltLine, mode, finalScale, 0.0, true, realOutline.boundingRect().center().x(), realOutline.boundingRect().center().y())); } } return path; } #include "kis_standard_uniform_properties_factory.h" QList KisRoundMarkerOpSettings::uniformProperties(KisPaintOpSettingsSP settings) { QList props; { using namespace KisStandardUniformPropertiesFactory; Q_FOREACH (KisUniformPaintOpPropertySP prop, KisPaintOpSettings::uniformProperties(settings)) { if (prop->id() != flow.id()) { props.prepend(prop); } } } return props; }