summaryrefslogtreecommitdiffstats
path: root/chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-05-23 20:48:35 +0900
committerMichele Calgaro <[email protected]>2021-05-29 15:16:28 +0900
commit8b78a8791bc539bcffe7159f9d9714d577cb3d7d (patch)
tree1328291f966f19a22d7b13657d3f01a588eb1083 /chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
parent95834e2bdc5e01ae1bd21ac0dfa4fa1d2417fae9 (diff)
downloadkoffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.tar.gz
koffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc')
-rw-r--r--chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc234
1 files changed, 0 insertions, 234 deletions
diff --git a/chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc b/chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
deleted file mode 100644
index 1a4932b7..00000000
--- a/chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * kis_tool_select_contiguous - part of Krayon^WChalk
- *
- * Copyright (c) 1999 Michael Koch <[email protected]>
- * Copyright (c) 2002 Patrick Julien <[email protected]>
- * Copyright (c) 2004 Boudewijn Rempt <[email protected]>
- *
- * 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 <tqpainter.h>
-#include <tqlayout.h>
-#include <tqlabel.h>
-#include <tqapplication.h>
-#include <tqcheckbox.h>
-
-#include <tdeaction.h>
-#include <kdebug.h>
-#include <tdelocale.h>
-#include <knuminput.h>
-#include <kcolorbutton.h>
-
-#include <kis_cursor.h>
-#include <kis_selection_manager.h>
-#include <kis_canvas_subject.h>
-#include <kis_image.h>
-#include <kis_layer.h>
-#include <kis_paint_device.h>
-#include <kis_button_press_event.h>
-#include <kis_canvas_subject.h>
-#include <kis_selection_options.h>
-#include <kis_selection.h>
-#include <kis_paint_device.h>
-#include <kis_iterators_pixel.h>
-#include <kis_selection_options.h>
-#include <kis_canvas_observer.h>
-#include <kis_fill_painter.h>
-#include <kis_undo_adapter.h>
-#include <kis_selected_transaction.h>
-
-#include "kis_tool_select_contiguous.h"
-
-KisToolSelectContiguous::KisToolSelectContiguous() : super(i18n("Contiguous Select"))
-{
- setName("tool_select_contiguous");
- m_subject = 0;
- m_optWidget = 0;
- m_fuzziness = 20;
- m_sampleMerged = false;
- m_selectAction = SELECTION_ADD;
-
- setCursor(KisCursor::load("tool_contiguous_selection_cursor.png", 6, 6));
-}
-
-KisToolSelectContiguous::~KisToolSelectContiguous()
-{
-}
-
-void KisToolSelectContiguous::activate()
-{
- super::activate();
-
- if (!m_optWidget)
- return;
-
- m_optWidget->slotActivated();
-}
-
-void KisToolSelectContiguous::buttonPress(KisButtonPressEvent * e)
-{
- if (m_subject) {
-
- KisImageSP img;
- KisPaintDeviceSP dev;
- TQPoint pos;
-
- if (e->button() != Qt::LeftButton && e->button() != Qt::RightButton)
- return;
-
- if (!(img = m_subject->currentImg()))
- return;
-
- dev = img->activeDevice();
-
- if (!dev || !img->activeLayer()->visible())
- return;
-
- TQApplication::setOverrideCursor(KisCursor::waitCursor());
-
- pos = TQPoint(e->pos().floorX(), e->pos().floorY());
-
- KisFillPainter fillpainter(dev);
- fillpainter.setFillThreshold(m_fuzziness);
- fillpainter.setSampleMerged(m_sampleMerged);
- KisSelectionSP selection = fillpainter.createFloodSelection(pos.x(), pos.y());
- KisSelectedTransaction *t = 0;
- if (img->undo()) t = new KisSelectedTransaction(i18n("Contiguous Area Selection"), dev);
-
- if (!dev->hasSelection()) {
- dev->selection()->clear();
- if(m_selectAction==SELECTION_SUBTRACT)
- selection->invert();
- }
-
- switch (m_selectAction) {
- case SELECTION_SUBTRACT:
- dev->subtractSelection(selection);
- break;
- case SELECTION_ADD:
- default:
- dev->addSelection(selection);
- break;
-
- }
-
- dev->setDirty(selection->selectedRect()); // A bit too wide, but that's not that bad
- dev->emitSelectionChanged();
-
-
- if (img->undo())
- img->undoAdapter()->addCommand(t);
-
- TQApplication::restoreOverrideCursor();
- }
-
-}
-
-void KisToolSelectContiguous::setup(TDEActionCollection *collection)
-{
- m_action = static_cast<TDERadioAction *>(collection->action(name()));
-
- if (m_action == 0) {
- m_action = new TDERadioAction(i18n("&Contiguous Area Selection"),
- "tool_contiguous_selection" ,
- 0,
- this,
- TQT_SLOT(activate()),
- collection,
- name());
- TQ_CHECK_PTR(m_action);
- m_action->setToolTip(i18n("Select a contiguous area"));
- m_action->setExclusiveGroup("tools");
- m_ownAction = true;
- }
-}
-
-void KisToolSelectContiguous::update(KisCanvasSubject *subject)
-{
- super::update(subject);
- m_subject = subject;
-}
-
-void KisToolSelectContiguous::slotSetFuzziness(int fuzziness)
-{
- m_fuzziness = fuzziness;
-}
-
-
-void KisToolSelectContiguous::slotSetAction(int action)
-{
- if (action >= SELECTION_ADD && action <= SELECTION_SUBTRACT)
- m_selectAction =(enumSelectionMode)action;
-// XXX: Fix cursors when then are done.
-// switch(m_selectAction) {
-// case SELECTION_ADD:
-// m_subject->setCanvasCursor(KisCursor::pickerPlusCursor());
-// break;
-// case SELECTION_SUBTRACT:
-// m_subject->setCanvasCursor(KisCursor::pickerMinusCursor());
-// };
-}
-
-
-TQWidget* KisToolSelectContiguous::createOptionWidget(TQWidget* parent)
-{
- m_optWidget = new KisSelectionOptions(parent, m_subject);
- TQ_CHECK_PTR(m_optWidget);
- m_optWidget->setCaption(i18n("Contiguous Area Selection"));
-
- TQVBoxLayout * l = dynamic_cast<TQVBoxLayout*>(m_optWidget->layout());
- l->setSpacing( 6 );
-
- connect (m_optWidget, TQT_SIGNAL(actionChanged(int)), this, TQT_SLOT(slotSetAction(int)));
-
- TQHBoxLayout * hbox = new TQHBoxLayout(l);
- TQ_CHECK_PTR(hbox);
-
- TQLabel * lbl = new TQLabel(i18n("Fuzziness: "), m_optWidget);
- hbox->addWidget(lbl);
-
- KIntNumInput * input = new KIntNumInput(m_optWidget, "fuzziness");
- TQ_CHECK_PTR(input);
-
- input->setRange(0, 200, 10, true);
- input->setValue(20);
- hbox->addWidget(input);
- connect(input, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotSetFuzziness(int)));
-
- TQCheckBox* samplemerged = new TQCheckBox(i18n("Sample merged"), m_optWidget);
- l->addWidget( samplemerged );
- samplemerged->setChecked(m_sampleMerged);
- connect(samplemerged, TQT_SIGNAL(stateChanged(int)),
- this, TQT_SLOT(slotSetSampleMerged(int)));
-
- l->addItem(new TQSpacerItem(1, 1, TQSizePolicy::Fixed, TQSizePolicy::Expanding));
-
- return m_optWidget;
-}
-
-TQWidget* KisToolSelectContiguous::optionWidget()
-{
- return m_optWidget;
-}
-
-void KisToolSelectContiguous::slotSetSampleMerged(int state)
-{
- if (state == TQButton::NoChange)
- return;
- m_sampleMerged = (state == TQButton::On);
-}
-
-#include "kis_tool_select_contiguous.moc"