summaryrefslogtreecommitdiffstats
path: root/krita/plugins/viewplugins/modify_selection
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /krita/plugins/viewplugins/modify_selection
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/plugins/viewplugins/modify_selection')
-rw-r--r--krita/plugins/viewplugins/modify_selection/Makefile.am26
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_border_selection.cc76
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_border_selection.h48
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_grow_selection.cc76
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_grow_selection.h48
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc81
-rw-r--r--krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.h49
-rw-r--r--krita/plugins/viewplugins/modify_selection/kritamodifyselection.desktop40
-rw-r--r--krita/plugins/viewplugins/modify_selection/modify_selection.cc158
-rw-r--r--krita/plugins/viewplugins/modify_selection/modify_selection.h46
-rw-r--r--krita/plugins/viewplugins/modify_selection/modify_selection.rc10
-rw-r--r--krita/plugins/viewplugins/modify_selection/wdg_border_selection.ui57
-rw-r--r--krita/plugins/viewplugins/modify_selection/wdg_grow_selection.ui57
-rw-r--r--krita/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui68
14 files changed, 840 insertions, 0 deletions
diff --git a/krita/plugins/viewplugins/modify_selection/Makefile.am b/krita/plugins/viewplugins/modify_selection/Makefile.am
new file mode 100644
index 00000000..f70b7cf2
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/Makefile.am
@@ -0,0 +1,26 @@
+kritarcdir = $(kde_datadir)/kritaplugins
+kritarc_DATA = modify_selection.rc
+EXTRA_DIST = $(kritarc_DATA)
+
+kde_services_DATA = kritamodifyselection.desktop
+
+
+INCLUDES = -I$(srcdir)/../../../sdk \
+ -I$(srcdir)/../../../core \
+ -I$(srcdir)/../../../kritacolor/ \
+ -I$(srcdir)/../../../ui \
+ $(KOFFICE_INCLUDES) \
+ $(all_includes)
+
+kritamodifyselection_la_SOURCES = wdg_grow_selection.ui wdg_shrink_selection.ui wdg_border_selection.ui \
+dlg_grow_selection.cc dlg_shrink_selection.cc dlg_border_selection.cc modify_selection.cc
+
+noinst_HEADERS = wdg_grow_selection.h wdg_shrink_selection.h wdg_border_selection.h dlg_grow_selection.h \
+dlg_shrink_selection.h dlg_border_selection.h modify_selection.h
+
+kde_module_LTLIBRARIES = kritamodifyselection.la
+
+kritamodifyselection_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kritamodifyselection_la_LIBADD = ../../../libkritacommon.la
+
+kritamodifyselection_la_METASOURCES = AUTO
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_border_selection.cc b/krita/plugins/viewplugins/modify_selection/dlg_border_selection.cc
new file mode 100644
index 00000000..748c5b9b
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_border_selection.cc
@@ -0,0 +1,76 @@
+/*
+ * dlg_border_selection.cc - part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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 <config.h>
+
+#include <math.h>
+
+#include <iostream>
+
+using namespace std;
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_border_selection.h"
+#include "wdg_border_selection.h"
+
+DlgBorderSelection::DlgBorderSelection( QWidget * parent, const char * name) : super (parent, name, true, i18n("Border Selection"), Ok | Cancel, Ok)
+{
+ m_page = new WdgBorderSelection(this, "border_selection");
+ Q_CHECK_PTR(m_page);
+
+ setMainWidget(m_page);
+ resize(m_page->sizeHint());
+
+ connect(this, SIGNAL(okClicked()), this, SLOT(okClicked()));
+}
+
+DlgBorderSelection::~DlgBorderSelection()
+{
+ delete m_page;
+}
+
+Q_INT32 DlgBorderSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+Q_INT32 DlgBorderSelection::yradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+
+// SLOTS
+
+void DlgBorderSelection::okClicked()
+{
+ accept();
+}
+
+#include "dlg_border_selection.moc"
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_border_selection.h b/krita/plugins/viewplugins/modify_selection/dlg_border_selection.h
new file mode 100644
index 00000000..baf716d4
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_border_selection.h
@@ -0,0 +1,48 @@
+/*
+ * dlg_border_selection.h -- part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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.
+ */
+#ifndef DLG_BORDER_SELECTION_H
+#define DLG_BORDER_SELECTION_H
+
+#include <kdialogbase.h>
+
+class WdgBorderSelection;
+
+class DlgBorderSelection: public KDialogBase {
+ typedef KDialogBase super;
+ Q_OBJECT
+
+public:
+
+ DlgBorderSelection(QWidget * parent = 0, const char* name = 0);
+ ~DlgBorderSelection();
+
+ Q_INT32 xradius();
+ Q_INT32 yradius();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgBorderSelection * m_page;
+};
+
+#endif // DLG_BORDER_SELECTION_H
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.cc b/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.cc
new file mode 100644
index 00000000..82055aeb
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.cc
@@ -0,0 +1,76 @@
+/*
+ * dlg_grow_selection.cc - part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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 <config.h>
+
+#include <math.h>
+
+#include <iostream>
+
+using namespace std;
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_grow_selection.h"
+#include "wdg_grow_selection.h"
+
+DlgGrowSelection::DlgGrowSelection( QWidget * parent, const char * name) : super (parent, name, true, i18n("Grow Selection"), Ok | Cancel, Ok)
+{
+ m_page = new WdgGrowSelection(this, "grow_selection");
+ Q_CHECK_PTR(m_page);
+
+ setMainWidget(m_page);
+ resize(m_page->sizeHint());
+
+ connect(this, SIGNAL(okClicked()), this, SLOT(okClicked()));
+}
+
+DlgGrowSelection::~DlgGrowSelection()
+{
+ delete m_page;
+}
+
+Q_INT32 DlgGrowSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+Q_INT32 DlgGrowSelection::yradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+
+// SLOTS
+
+void DlgGrowSelection::okClicked()
+{
+ accept();
+}
+
+#include "dlg_grow_selection.moc"
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.h b/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.h
new file mode 100644
index 00000000..f5cd36ff
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_grow_selection.h
@@ -0,0 +1,48 @@
+/*
+ * dlg_grow_selection.h -- part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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.
+ */
+#ifndef DLG_GROW_SELECTION_H
+#define DLG_GROW_SELECTION_H
+
+#include <kdialogbase.h>
+
+class WdgGrowSelection;
+
+class DlgGrowSelection: public KDialogBase {
+ typedef KDialogBase super;
+ Q_OBJECT
+
+public:
+
+ DlgGrowSelection(QWidget * parent = 0, const char* name = 0);
+ ~DlgGrowSelection();
+
+ Q_INT32 xradius();
+ Q_INT32 yradius();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgGrowSelection * m_page;
+};
+
+#endif // DLG_GROW_SELECTION_H
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc b/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc
new file mode 100644
index 00000000..69e31d1d
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc
@@ -0,0 +1,81 @@
+/*
+ * dlg_shrink_selection.cc - part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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 <config.h>
+
+#include <math.h>
+
+#include <iostream>
+
+using namespace std;
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_shrink_selection.h"
+#include "wdg_shrink_selection.h"
+
+DlgShrinkSelection::DlgShrinkSelection( QWidget * parent, const char * name) : super (parent, name, true, i18n("Shrink Selection"), Ok | Cancel, Ok)
+{
+ m_page = new WdgShrinkSelection(this, "shrink_selection");
+ Q_CHECK_PTR(m_page);
+
+ setMainWidget(m_page);
+ resize(m_page->sizeHint());
+
+ connect(this, SIGNAL(okClicked()), this, SLOT(okClicked()));
+}
+
+DlgShrinkSelection::~DlgShrinkSelection()
+{
+ delete m_page;
+}
+
+Q_INT32 DlgShrinkSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+Q_INT32 DlgShrinkSelection::yradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+bool DlgShrinkSelection::shrinkFromImageBorder()
+{
+ return m_page->shrinkFromImageBorderCheckBox->isChecked();
+}
+
+
+// SLOTS
+
+void DlgShrinkSelection::okClicked()
+{
+ accept();
+}
+
+#include "dlg_shrink_selection.moc"
diff --git a/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.h b/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.h
new file mode 100644
index 00000000..e8e32f43
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/dlg_shrink_selection.h
@@ -0,0 +1,49 @@
+/*
+ * dlg_shrink_selection.h -- part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler <[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.
+ */
+#ifndef DLG_SHRINK_SELECTION_H
+#define DLG_SHRINK_SELECTION_H
+
+#include <kdialogbase.h>
+
+class WdgShrinkSelection;
+
+class DlgShrinkSelection: public KDialogBase {
+ typedef KDialogBase super;
+ Q_OBJECT
+
+public:
+
+ DlgShrinkSelection(QWidget * parent = 0, const char* name = 0);
+ ~DlgShrinkSelection();
+
+ Q_INT32 xradius();
+ Q_INT32 yradius();
+ bool shrinkFromImageBorder();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgShrinkSelection * m_page;
+};
+
+#endif // DLG_SHRINK_SELECTION_H
diff --git a/krita/plugins/viewplugins/modify_selection/kritamodifyselection.desktop b/krita/plugins/viewplugins/modify_selection/kritamodifyselection.desktop
new file mode 100644
index 00000000..cc3acc48
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/kritamodifyselection.desktop
@@ -0,0 +1,40 @@
+[Desktop Entry]
+Name=Modify Selection
+Name[bg]=Промяна на маркираното
+Name[br]=Kemmañ an dibab
+Name[ca]=Selecció de modificació
+Name[da]=Ændr markering
+Name[de]=Auswahl verändern
+Name[el]=Τροποποίηση επιλογής
+Name[eo]=Modifi elekton
+Name[es]=Modificar selección
+Name[et]=Valiku muutmine
+Name[fa]=تغییر گزینش
+Name[fr]=Modifier la sélection
+Name[fy]=Seleksje oanpasse
+Name[ga]=Athraigh an Roghnúchán
+Name[gl]=Modificación da Selección
+Name[hu]=A kijelölés módosítása
+Name[it]=Modifica la selezione
+Name[ja]=選択領域を変更
+Name[km]=កែប្រែ​ការ​ជ្រើស
+Name[lv]=Mainīt izvēli
+Name[nb]=Endre utvalg
+Name[nds]=Utwahl ännern
+Name[ne]=चयन परिमार्जन गर्नुहोस्
+Name[nl]=Selectie aanpassen
+Name[pl]=Zmiana wyboru
+Name[pt]=Modificar a Selecção
+Name[pt_BR]=Modificar a Seleção
+Name[ru]=Выделение
+Name[sk]=Zmeniť výber
+Name[sl]=Spremeni izbiro
+Name[sr]=Измена избора
+Name[sr@Latn]=Izmena izbora
+Name[sv]=Ändra markering
+Name[uk]=Зміна виділення
+Name[zh_TW]=變更選取
+ServiceTypes=Krita/ViewPlugin
+Type=Service
+X-KDE-Library=kritamodifyselection
+X-Krita-Version=2
diff --git a/krita/plugins/viewplugins/modify_selection/modify_selection.cc b/krita/plugins/viewplugins/modify_selection/modify_selection.cc
new file mode 100644
index 00000000..6f2d0511
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/modify_selection.cc
@@ -0,0 +1,158 @@
+/*
+ * modify_selection.cc -- Part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler ([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 <math.h>
+
+#include <stdlib.h>
+
+#include <qslider.h>
+#include <qpoint.h>
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kstdaction.h>
+
+#include <kis_doc.h>
+#include <kis_config.h>
+#include <kis_image.h>
+#include <kis_layer.h>
+#include <kis_global.h>
+#include <kis_types.h>
+#include <kis_view.h>
+#include <kis_selection.h>
+#include <kis_selection_manager.h>
+#include <kis_transaction.h>
+
+#include "modify_selection.h"
+#include "dlg_grow_selection.h"
+#include "dlg_shrink_selection.h"
+#include "dlg_border_selection.h"
+
+typedef KGenericFactory<ModifySelection> ModifySelectionFactory;
+K_EXPORT_COMPONENT_FACTORY( kritamodifyselection, ModifySelectionFactory( "krita" ) )
+
+ModifySelection::ModifySelection(QObject *parent, const char *name, const QStringList &)
+ : KParts::Plugin(parent, name)
+{
+ if ( parent->inherits("KisView") )
+ {
+ setInstance(ModifySelectionFactory::instance());
+ setXMLFile(locate("data","kritaplugins/modify_selection.rc"), true);
+
+ m_view = (KisView*) parent;
+
+ // Selection manager takes ownership?
+ KAction* a = new KAction(i18n("Grow Selection..."), 0, 0, this, SLOT(slotGrowSelection()), actionCollection(), "growselection");
+ KAction* b = new KAction(i18n("Shrink Selection..."), 0, 0, this, SLOT(slotShrinkSelection()), actionCollection(), "shrinkselection");
+ KAction* c = new KAction(i18n("Border Selection..."), 0, 0, this, SLOT(slotBorderSelection()), actionCollection(), "borderselection");
+
+ Q_CHECK_PTR(a);
+ Q_CHECK_PTR(b);
+ Q_CHECK_PTR(c);
+
+ m_view ->canvasSubject()-> selectionManager()->addSelectionAction(a);
+ m_view ->canvasSubject()-> selectionManager()->addSelectionAction(b);
+ m_view ->canvasSubject()-> selectionManager()->addSelectionAction(c);
+ }
+}
+
+ModifySelection::~ModifySelection()
+{
+ m_view = 0;
+}
+
+void ModifySelection::slotGrowSelection()
+{
+ KisImageSP image = m_view->canvasSubject()->currentImg();
+
+ if (!image) return;
+
+ DlgGrowSelection * dlgGrowSelection = new DlgGrowSelection(m_view, "GrowSelection");
+ Q_CHECK_PTR(dlgGrowSelection);
+
+ dlgGrowSelection->setCaption(i18n("Grow Selection"));
+
+ KisConfig cfg;
+
+ if (dlgGrowSelection->exec() == QDialog::Accepted) {
+ Q_INT32 xradius = dlgGrowSelection->xradius();
+ Q_INT32 yradius = dlgGrowSelection->yradius();
+
+ m_view ->canvasSubject()-> selectionManager()->grow(xradius, yradius);
+ }
+
+ delete dlgGrowSelection;
+}
+
+void ModifySelection::slotShrinkSelection()
+{
+ KisImageSP image = m_view->canvasSubject()->currentImg();
+
+ if (!image) return;
+
+ DlgShrinkSelection * dlgShrinkSelection = new DlgShrinkSelection(m_view, "ShrinkSelection");
+ Q_CHECK_PTR(dlgShrinkSelection);
+
+ dlgShrinkSelection->setCaption(i18n("Shrink Selection"));
+
+ KisConfig cfg;
+
+ if (dlgShrinkSelection->exec() == QDialog::Accepted) {
+ Q_INT32 xradius = dlgShrinkSelection->xradius();
+ Q_INT32 yradius = dlgShrinkSelection->yradius();
+ bool shrinkFromImageBorder = dlgShrinkSelection->shrinkFromImageBorder();
+
+ m_view ->canvasSubject()-> selectionManager()->shrink(xradius, yradius, shrinkFromImageBorder);
+ }
+
+ delete dlgShrinkSelection;
+}
+
+void ModifySelection::slotBorderSelection()
+{
+ KisImageSP image = m_view->canvasSubject()->currentImg();
+
+ if (!image) return;
+
+ DlgBorderSelection * dlgBorderSelection = new DlgBorderSelection(m_view, "BorderSelection");
+ Q_CHECK_PTR(dlgBorderSelection);
+
+ dlgBorderSelection->setCaption(i18n("Border Selection"));
+
+ KisConfig cfg;
+
+ if (dlgBorderSelection->exec() == QDialog::Accepted) {
+ Q_INT32 xradius = dlgBorderSelection->xradius();
+ Q_INT32 yradius = dlgBorderSelection->yradius();
+
+ m_view ->canvasSubject()-> selectionManager()->border(xradius, yradius);
+ }
+
+ delete dlgBorderSelection;
+}
+
+#include "modify_selection.moc"
diff --git a/krita/plugins/viewplugins/modify_selection/modify_selection.h b/krita/plugins/viewplugins/modify_selection/modify_selection.h
new file mode 100644
index 00000000..d3677088
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/modify_selection.h
@@ -0,0 +1,46 @@
+/*
+ * modify_selection.h -- Part of Krita
+ *
+ * Copyright (c) 2006 Michael Thaler ([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.
+ */
+#ifndef MODIFY_SELECTION_H
+#define MODIFY_SELECTION_H
+
+#include <kparts/plugin.h>
+
+class KisView;
+
+class ModifySelection : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ ModifySelection(QObject *parent, const char *name, const QStringList &);
+ virtual ~ModifySelection();
+
+private slots:
+
+ void slotGrowSelection();
+ void slotShrinkSelection();
+ void slotBorderSelection();
+
+private:
+
+ KisView * m_view;
+
+};
+
+#endif // MODIFY_SELECTION_H
diff --git a/krita/plugins/viewplugins/modify_selection/modify_selection.rc b/krita/plugins/viewplugins/modify_selection/modify_selection.rc
new file mode 100644
index 00000000..131534e3
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/modify_selection.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="kritamodifyselection" version="6">
+ <MenuBar>
+ <Menu name="Select"><text>&amp;Select</text>
+ <Action name="growselection"/>
+ <Action name="shrinkselection"/>
+ <Action name="borderselection"/>
+ </Menu>
+ </MenuBar>
+</kpartgui>
diff --git a/krita/plugins/viewplugins/modify_selection/wdg_border_selection.ui b/krita/plugins/viewplugins/modify_selection/wdg_border_selection.ui
new file mode 100644
index 00000000..621685da
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/wdg_border_selection.ui
@@ -0,0 +1,57 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WdgBorderSelection</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WdgBorderSelection</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>255</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Border selection by</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="0">
+ <property name="name">
+ <cstring>radiusSpinBox</cstring>
+ </property>
+ <property name="maxValue">
+ <number>10000</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>pixels</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboBox1</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>radiusSpinBox</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/krita/plugins/viewplugins/modify_selection/wdg_grow_selection.ui b/krita/plugins/viewplugins/modify_selection/wdg_grow_selection.ui
new file mode 100644
index 00000000..d2eb12aa
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/wdg_grow_selection.ui
@@ -0,0 +1,57 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WdgGrowSelection</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WdgGrowSelection</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>255</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Grow selection by</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="0">
+ <property name="name">
+ <cstring>radiusSpinBox</cstring>
+ </property>
+ <property name="maxValue">
+ <number>10000</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>pixels</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboBox1</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>radiusSpinBox</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/krita/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui b/krita/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui
new file mode 100644
index 00000000..2896325f
--- /dev/null
+++ b/krita/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui
@@ -0,0 +1,68 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WdgShrinkSelection</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WdgShrinkSelection</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>255</width>
+ <height>117</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Shrink selection by</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="0">
+ <property name="name">
+ <cstring>radiusSpinBox</cstring>
+ </property>
+ <property name="maxValue">
+ <number>10000</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>pixels</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboBox1</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>shrinkFromImageBorderCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Shrink from image border</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>radiusSpinBox</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>