summaryrefslogtreecommitdiffstats
path: root/chalk/plugins/viewplugins/modify_selection
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
commit698569f8428ca088f764d704034a1330517b98c0 (patch)
treebf45be6946ebbbee9cce5a5bcf838f4c952d87e6 /chalk/plugins/viewplugins/modify_selection
parent2785103a6bd4de55bd26d79e34d0fdd4b329a73a (diff)
downloadkoffice-698569f8428ca088f764d704034a1330517b98c0.tar.gz
koffice-698569f8428ca088f764d704034a1330517b98c0.zip
Finish rebranding of Krita as Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'chalk/plugins/viewplugins/modify_selection')
-rw-r--r--chalk/plugins/viewplugins/modify_selection/Makefile.am27
-rw-r--r--chalk/plugins/viewplugins/modify_selection/chalkmodifyselection.desktop40
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_border_selection.cc76
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_border_selection.h49
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.cc76
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.h49
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc81
-rw-r--r--chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.h50
-rw-r--r--chalk/plugins/viewplugins/modify_selection/modify_selection.cc158
-rw-r--r--chalk/plugins/viewplugins/modify_selection/modify_selection.h47
-rw-r--r--chalk/plugins/viewplugins/modify_selection/modify_selection.rc10
-rw-r--r--chalk/plugins/viewplugins/modify_selection/wdg_border_selection.ui57
-rw-r--r--chalk/plugins/viewplugins/modify_selection/wdg_grow_selection.ui57
-rw-r--r--chalk/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui68
14 files changed, 845 insertions, 0 deletions
diff --git a/chalk/plugins/viewplugins/modify_selection/Makefile.am b/chalk/plugins/viewplugins/modify_selection/Makefile.am
new file mode 100644
index 00000000..6e0f14c5
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/Makefile.am
@@ -0,0 +1,27 @@
+chalkrcdir = $(kde_datadir)/chalkplugins
+chalkrc_DATA = modify_selection.rc
+EXTRA_DIST = $(chalkrc_DATA)
+
+kde_services_DATA = chalkmodifyselection.desktop
+
+
+INCLUDES = -I$(srcdir)/../../../sdk \
+ -I$(srcdir)/../../../core \
+ -I$(srcdir)/../../../chalkcolor/ \
+ -I$(srcdir)/../../../ui \
+ $(KOFFICE_INCLUDES) \
+ $(all_includes)
+
+chalkmodifyselection_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 = chalkmodifyselection.la
+
+chalkmodifyselection_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) chalkblurfilter_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -L../../../../chalk/chalkcolor/.libs -lchalkcolor -L../../../../chalk/core/.libs -lchalkimage \
+ -L../../../../chalk/ui/.libs -lchalkui -L../../../../lib/kofficeui/.libs -lkofficeui
+chalkmodifyselection_la_LIBADD = ../../../libchalkcommon.la
+
+chalkmodifyselection_la_METASOURCES = AUTO
diff --git a/chalk/plugins/viewplugins/modify_selection/chalkmodifyselection.desktop b/chalk/plugins/viewplugins/modify_selection/chalkmodifyselection.desktop
new file mode 100644
index 00000000..aa4a9d58
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/chalkmodifyselection.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=Chalk/ViewPlugin
+Type=Service
+X-KDE-Library=chalkmodifyselection
+X-Chalk-Version=2
diff --git a/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.cc b/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.cc
new file mode 100644
index 00000000..dcda5c7e
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.cc
@@ -0,0 +1,76 @@
+/*
+ * dlg_border_selection.cc - part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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 <tqradiobutton.h>
+#include <tqcheckbox.h>
+#include <tqbuttongroup.h>
+#include <tqlabel.h>
+#include <tqcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_border_selection.h"
+#include "wdg_border_selection.h"
+
+DlgBorderSelection::DlgBorderSelection( TQWidget * tqparent, const char * name) : super (tqparent, 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->tqsizeHint());
+
+ connect(this, TQT_SIGNAL(okClicked()), this, TQT_SLOT(okClicked()));
+}
+
+DlgBorderSelection::~DlgBorderSelection()
+{
+ delete m_page;
+}
+
+TQ_INT32 DlgBorderSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+TQ_INT32 DlgBorderSelection::yradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+
+// SLOTS
+
+void DlgBorderSelection::okClicked()
+{
+ accept();
+}
+
+#include "dlg_border_selection.moc"
diff --git a/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.h b/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.h
new file mode 100644
index 00000000..472f01ef
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_border_selection.h
@@ -0,0 +1,49 @@
+/*
+ * dlg_border_selection.h -- part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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
+ TQ_OBJECT
+
+public:
+
+ DlgBorderSelection(TQWidget * tqparent = 0, const char* name = 0);
+ ~DlgBorderSelection();
+
+ TQ_INT32 xradius();
+ TQ_INT32 yradius();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgBorderSelection * m_page;
+};
+
+#endif // DLG_BORDER_SELECTION_H
diff --git a/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.cc b/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.cc
new file mode 100644
index 00000000..b889ccde
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.cc
@@ -0,0 +1,76 @@
+/*
+ * dlg_grow_selection.cc - part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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 <tqradiobutton.h>
+#include <tqcheckbox.h>
+#include <tqbuttongroup.h>
+#include <tqlabel.h>
+#include <tqcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_grow_selection.h"
+#include "wdg_grow_selection.h"
+
+DlgGrowSelection::DlgGrowSelection( TQWidget * tqparent, const char * name) : super (tqparent, 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->tqsizeHint());
+
+ connect(this, TQT_SIGNAL(okClicked()), this, TQT_SLOT(okClicked()));
+}
+
+DlgGrowSelection::~DlgGrowSelection()
+{
+ delete m_page;
+}
+
+TQ_INT32 DlgGrowSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+TQ_INT32 DlgGrowSelection::yradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+
+// SLOTS
+
+void DlgGrowSelection::okClicked()
+{
+ accept();
+}
+
+#include "dlg_grow_selection.moc"
diff --git a/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.h b/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.h
new file mode 100644
index 00000000..61785b20
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.h
@@ -0,0 +1,49 @@
+/*
+ * dlg_grow_selection.h -- part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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
+ TQ_OBJECT
+
+public:
+
+ DlgGrowSelection(TQWidget * tqparent = 0, const char* name = 0);
+ ~DlgGrowSelection();
+
+ TQ_INT32 xradius();
+ TQ_INT32 yradius();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgGrowSelection * m_page;
+};
+
+#endif // DLG_GROW_SELECTION_H
diff --git a/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc b/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc
new file mode 100644
index 00000000..eb50c6cf
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc
@@ -0,0 +1,81 @@
+/*
+ * dlg_shrink_selection.cc - part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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 <tqradiobutton.h>
+#include <tqcheckbox.h>
+#include <tqbuttongroup.h>
+#include <tqlabel.h>
+#include <tqcombobox.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <kdebug.h>
+
+#include "dlg_shrink_selection.h"
+#include "wdg_shrink_selection.h"
+
+DlgShrinkSelection::DlgShrinkSelection( TQWidget * tqparent, const char * name) : super (tqparent, 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->tqsizeHint());
+
+ connect(this, TQT_SIGNAL(okClicked()), this, TQT_SLOT(okClicked()));
+}
+
+DlgShrinkSelection::~DlgShrinkSelection()
+{
+ delete m_page;
+}
+
+TQ_INT32 DlgShrinkSelection::xradius()
+{
+ return m_page->radiusSpinBox->value();
+}
+
+TQ_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/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.h b/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.h
new file mode 100644
index 00000000..53ce386b
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.h
@@ -0,0 +1,50 @@
+/*
+ * dlg_shrink_selection.h -- part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * 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
+ TQ_OBJECT
+
+public:
+
+ DlgShrinkSelection(TQWidget * tqparent = 0, const char* name = 0);
+ ~DlgShrinkSelection();
+
+ TQ_INT32 xradius();
+ TQ_INT32 yradius();
+ bool shrinkFromImageBorder();
+
+private slots:
+
+ void okClicked();
+
+private:
+
+ WdgShrinkSelection * m_page;
+};
+
+#endif // DLG_SHRINK_SELECTION_H
diff --git a/chalk/plugins/viewplugins/modify_selection/modify_selection.cc b/chalk/plugins/viewplugins/modify_selection/modify_selection.cc
new file mode 100644
index 00000000..78a75778
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/modify_selection.cc
@@ -0,0 +1,158 @@
+/*
+ * modify_selection.cc -- Part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler (michael.thaler@physik.tu-muenchen.de)
+ *
+ * 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 <tqslider.h>
+#include <tqpoint.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( chalkmodifyselection, ModifySelectionFactory( "chalk" ) )
+
+ModifySelection::ModifySelection(TQObject *tqparent, const char *name, const TQStringList &)
+ : KParts::Plugin(tqparent, name)
+{
+ if ( tqparent->inherits("KisView") )
+ {
+ setInstance(ModifySelectionFactory::instance());
+ setXMLFile(locate("data","chalkplugins/modify_selection.rc"), true);
+
+ m_view = (KisView*) tqparent;
+
+ // Selection manager takes ownership?
+ KAction* a = new KAction(i18n("Grow Selection..."), 0, 0, this, TQT_SLOT(slotGrowSelection()), actionCollection(), "growselection");
+ KAction* b = new KAction(i18n("Shrink Selection..."), 0, 0, this, TQT_SLOT(slotShrinkSelection()), actionCollection(), "shrinkselection");
+ KAction* c = new KAction(i18n("Border Selection..."), 0, 0, this, TQT_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() == TQDialog::Accepted) {
+ TQ_INT32 xradius = dlgGrowSelection->xradius();
+ TQ_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() == TQDialog::Accepted) {
+ TQ_INT32 xradius = dlgShrinkSelection->xradius();
+ TQ_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() == TQDialog::Accepted) {
+ TQ_INT32 xradius = dlgBorderSelection->xradius();
+ TQ_INT32 yradius = dlgBorderSelection->yradius();
+
+ m_view ->canvasSubject()-> selectionManager()->border(xradius, yradius);
+ }
+
+ delete dlgBorderSelection;
+}
+
+#include "modify_selection.moc"
diff --git a/chalk/plugins/viewplugins/modify_selection/modify_selection.h b/chalk/plugins/viewplugins/modify_selection/modify_selection.h
new file mode 100644
index 00000000..db5dd1b7
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/modify_selection.h
@@ -0,0 +1,47 @@
+/*
+ * modify_selection.h -- Part of Chalk
+ *
+ * Copyright (c) 2006 Michael Thaler (michael.thaler@physik.tu-muenchen.de)
+ *
+ * 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
+ TQ_OBJECT
+public:
+ ModifySelection(TQObject *tqparent, const char *name, const TQStringList &);
+ virtual ~ModifySelection();
+
+private slots:
+
+ void slotGrowSelection();
+ void slotShrinkSelection();
+ void slotBorderSelection();
+
+private:
+
+ KisView * m_view;
+
+};
+
+#endif // MODIFY_SELECTION_H
diff --git a/chalk/plugins/viewplugins/modify_selection/modify_selection.rc b/chalk/plugins/viewplugins/modify_selection/modify_selection.rc
new file mode 100644
index 00000000..999aaaaa
--- /dev/null
+++ b/chalk/plugins/viewplugins/modify_selection/modify_selection.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalkmodifyselection" 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/chalk/plugins/viewplugins/modify_selection/wdg_border_selection.ui b/chalk/plugins/viewplugins/modify_selection/wdg_border_selection.ui
new file mode 100644
index 00000000..06d01e9f
--- /dev/null
+++ b/chalk/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="TQWidget">
+ <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="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Border selection by</string>
+ </property>
+ </widget>
+ <widget class="TQSpinBox" 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="TQComboBox" 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>
+<tqlayoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/chalk/plugins/viewplugins/modify_selection/wdg_grow_selection.ui b/chalk/plugins/viewplugins/modify_selection/wdg_grow_selection.ui
new file mode 100644
index 00000000..d1180803
--- /dev/null
+++ b/chalk/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="TQWidget">
+ <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="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Grow selection by</string>
+ </property>
+ </widget>
+ <widget class="TQSpinBox" 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="TQComboBox" 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>
+<tqlayoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/chalk/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui b/chalk/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui
new file mode 100644
index 00000000..28429d72
--- /dev/null
+++ b/chalk/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="TQWidget">
+ <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="TQLabel" 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="TQSpinBox" 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="TQComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>pixels</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboBox1</cstring>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" 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>
+<tqlayoutdefaults spacing="6" margin="11"/>
+</UI>