87 m_d->ui =
new Ui_KisToolLazyBrushOptionsWidget();
88 m_d->ui->setupUi(
this);
91 m_d->ui->colorView->setPaletteModel(
m_d->colorModel);
92 m_d->ui->colorView->setAllowModification(
false);
93 m_d->ui->colorView->setCrossedKeyword(
"transparent");
96 m_d->ui->colorView->viewport()->installEventFilter(filter);
104 m_d->ui->intEdgeDetectionSize->setRange(0, 100);
105 m_d->ui->intEdgeDetectionSize->setExponentRatio(2.0);
106 m_d->ui->intEdgeDetectionSize->setSuffix(i18n(
" px"));
107 m_d->ui->intEdgeDetectionSize->setPrefix(i18n(
"Edge detection: "));
108 m_d->ui->intEdgeDetectionSize->setToolTip(
109 i18nc(
"@info:tooltip",
110 "Activate for images with vast solid areas. "
111 "Set the value to the width of the thinnest "
112 "lines on the image"));
114 m_d->ui->intRadius->setRange(0, 1000);
115 m_d->ui->intRadius->setExponentRatio(3.0);
116 m_d->ui->intRadius->setSuffix(i18n(
" px"));
117 m_d->ui->intRadius->setPrefix(i18n(
"Gap close hint: "));
118 m_d->ui->intRadius->setToolTip(
119 i18nc(
"@info:tooltip",
120 "The mask will try to close non-closed contours "
121 "if the gap is smaller than \"Gap close hint\" value"));
123 m_d->ui->intCleanUp->setRange(0, 100);
125 i18nc(
"{n} is the number value, % is the percent sign",
"Clean up: {n}%"));
126 m_d->ui->intCleanUp->setToolTip(
127 i18nc(
"@info:tooltip",
128 "The mask will try to remove parts of the key strokes "
129 "that are placed outside the closed contours. 0% - no effect, 100% - max effect"));
136 connect(
m_d->ui->chkAutoUpdates, SIGNAL(toggled(
bool)),
m_d->ui->btnUpdate, SLOT(setDisabled(
bool)));
145 m_d->provider = provider;
147 m_d->colorModel->setColorSet(
m_d->colorSet);
206 QModelIndex candidateIdx =
m_d->colorModel->indexForClosest(color);
207 if (
m_d->colorModel->getSwatch(candidateIdx).color() == color) {
211 m_d->ui->btnRemove->setEnabled(found);
212 m_d->ui->btnTransparent->setEnabled(found);
216 m_d->ui->btnTransparent->setChecked(
false);
219 QModelIndex newIndex = found ? candidateIdx : QModelIndex();
222 m_d->ui->colorView->selectionModel()->clear();
224 if (newIndex.isValid() && newIndex !=
m_d->ui->colorView->currentIndex()) {
225 m_d->ui->colorView->setCurrentIndex(newIndex);
226 m_d->ui->colorView->update(newIndex);
252 m_d->ui->chkShowKeyStrokes,
253 m_d->ui->chkShowOutput);
255 m_d->ui->intEdgeDetectionSize,
258 m_d->ui->chkLimitToDevice);
262 m_d->ui->chkAutoUpdates->setEnabled(
false);
263 m_d->ui->chkAutoUpdates->setVisible(
false);
268 m_d->ui->btnUpdate->setEnabled(
m_d->activeMask && !
m_d->ui->chkAutoUpdates->isChecked() &&
value);
271 m_d->ui->chkShowKeyStrokes->setEnabled(
m_d->activeMask);
272 m_d->ui->chkShowKeyStrokes->setChecked(
value);
275 m_d->ui->chkShowOutput->setEnabled(
m_d->activeMask);
276 m_d->ui->chkShowOutput->setChecked(
value);
278 m_d->ui->chkUseEdgeDetection->setEnabled(
m_d->activeMask);
279 m_d->ui->chkUseEdgeDetection->setChecked(
m_d->activeMask &&
m_d->activeMask->useEdgeDetection());
281 m_d->ui->intEdgeDetectionSize->setEnabled(
m_d->activeMask &&
m_d->ui->chkUseEdgeDetection->isChecked());
282 m_d->ui->intEdgeDetectionSize->setValue(
m_d->activeMask ?
m_d->activeMask->edgeDetectionSize() : 4.0);
283 m_d->ui->intRadius->setEnabled(
m_d->activeMask);
284 m_d->ui->intRadius->setValue(2 * (
m_d->activeMask ?
m_d->activeMask->fuzzyRadius() : 15));
285 m_d->ui->intCleanUp->setEnabled(
m_d->activeMask);
286 m_d->ui->intCleanUp->setValue(100 * (
m_d->activeMask ?
m_d->activeMask->cleanUpAmount() : 0.7));
288 m_d->ui->chkLimitToDevice->setEnabled(
m_d->activeMask);
289 m_d->ui->chkLimitToDevice->setChecked(
m_d->activeMask &&
m_d->activeMask->limitToDeviceBounds());
318 QModelIndex index =
m_d->ui->colorView->currentIndex();
319 KisSwatch activeSwatch =
m_d->colorModel->getSwatch(index);
320 if (!index.isValid())
return;
323 Q_FOREACH (
const QString &groupName,
m_d->colorSet->swatchGroupNames()) {
325 Q_FOREACH (
const KisSwatchGroup::SwatchInfo &info, group->infoList()) {
326 infoList.append(info);
331 std::sort(infoList.begin(), infoList.end(), sortSwatchInfo);
334 for (
const KisSwatchGroup::SwatchInfo &info : infoList) {
335 if (activeSwatch == info.swatch && enableTransparency) {
338 colors.
colors << info.swatch.color();
342 m_d->activeMask->setKeyStrokesColors(colors);
411bool KisToolLazyBrushOptionsWidget::sortSwatchInfo(
const KisSwatchGroup::SwatchInfo &first,
const KisSwatchGroup::SwatchInfo &second)