summaryrefslogtreecommitdiffstats
path: root/krita/plugins/tools/tool_polygon
diff options
context:
space:
mode:
Diffstat (limited to 'krita/plugins/tools/tool_polygon')
-rw-r--r--krita/plugins/tools/tool_polygon/Makefile.am36
-rw-r--r--krita/plugins/tools/tool_polygon/kis_tool_polygon.cc252
-rw-r--r--krita/plugins/tools/tool_polygon/kis_tool_polygon.h102
-rw-r--r--krita/plugins/tools/tool_polygon/kritatoolpolygon.desktop52
-rw-r--r--krita/plugins/tools/tool_polygon/tool_polygon.cc62
-rw-r--r--krita/plugins/tools/tool_polygon/tool_polygon.h39
-rw-r--r--krita/plugins/tools/tool_polygon/tool_polygon.pngbin773 -> 0 bytes
-rw-r--r--krita/plugins/tools/tool_polygon/tool_polygon_cursor.pngbin402 -> 0 bytes
8 files changed, 0 insertions, 543 deletions
diff --git a/krita/plugins/tools/tool_polygon/Makefile.am b/krita/plugins/tools/tool_polygon/Makefile.am
deleted file mode 100644
index cb5b5e62..00000000
--- a/krita/plugins/tools/tool_polygon/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-kde_services_DATA = kritatoolpolygon.desktop
-
-# all_includes must remain last!
-INCLUDES = -I$(srcdir)/../../../sdk \
- -I$(srcdir)/../../../core \
- -I$(srcdir)/../../../kritacolor/ \
- -I$(srcdir)/../../../ui \
- -I$/../../../ui \
- $(KOFFICE_INCLUDES) \
- $(all_includes)
-
-kritatoolpolygon_la_SOURCES = \
- tool_polygon.cc \
- kis_tool_polygon.cc
-
-# Install this plugin in the KDE modules directory
-kde_module_LTLIBRARIES = kritatoolpolygon.la
-
-noinst_HEADERS = \
- tool_polygon.h \
- kis_tool_polygon.h
-
-kritatoolpolygon_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -L../../../../krita/kritacolor/.libs -lkritacolor -L../../../../krita/core/.libs -lkritaimage \
- -L../../../../krita/ui/.libs -lkritaui
-kritatoolpolygon_la_LIBADD = ../../../libkritacommon.la
-
-kritatoolpolygon_la_METASOURCES = AUTO
-
-KDE_OPTIONS = nofinal
-
-kritapics_DATA = \
- tool_polygon_cursor.png \
- tool_polygon.png
-
-kritapicsdir = $(kde_datadir)/krita/pics
-
diff --git a/krita/plugins/tools/tool_polygon/kis_tool_polygon.cc b/krita/plugins/tools/tool_polygon/kis_tool_polygon.cc
deleted file mode 100644
index 35ffd5ed..00000000
--- a/krita/plugins/tools/tool_polygon/kis_tool_polygon.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * kis_tool_polygon.cc -- part of Krita
- *
- * Copyright (c) 2004 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 <tqpainter.h>
-#include <tqspinbox.h>
-
-#include <kaction.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <knuminput.h>
-
-#include "kis_doc.h"
-#include "kis_view.h"
-#include "kis_painter.h"
-#include "kis_canvas_subject.h"
-#include "kis_canvas_controller.h"
-#include "kis_button_press_event.h"
-#include "kis_button_release_event.h"
-#include "kis_move_event.h"
-#include "kis_paintop_registry.h"
-#include "kis_canvas.h"
-#include "kis_canvas_painter.h"
-#include "kis_cursor.h"
-
-#include "kis_tool_polygon.h"
-
-KisToolPolygon::KisToolPolygon()
- : super(i18n ("Polygon")),
- m_dragging (false),
- m_currentImage (0)
-{
- setName("tool_polygon");
- setCursor(KisCursor::load("tool_polygon_cursor.png", 6, 6));
-}
-
-KisToolPolygon::~KisToolPolygon()
-{
-}
-
-void KisToolPolygon::update (KisCanvasSubject *subject)
-{
- super::update (subject);
- if (m_subject)
- m_currentImage = m_subject->currentImg ();
-}
-
-void KisToolPolygon::buttonPress(KisButtonPressEvent *event)
-{
- if (m_currentImage) {
- if (event->button() == LeftButton && event->state() != ShiftButton) {
-
- m_dragging = true;
-
- if (m_points.isEmpty())
- {
- m_dragStart = event->pos();
- m_dragEnd = event->pos();
- m_points.append(m_dragStart);
- } else {
- m_dragStart = m_dragEnd;
- m_dragEnd = event->pos();
- draw();
- }
- } else if (event->button() == LeftButton && event->state() == ShiftButton) {
- finish();
- }
- }
-}
-
-void KisToolPolygon::finish()
-{
- // erase old lines on canvas
- draw();
- m_dragging = false;
-
- KisPaintDeviceSP device = m_currentImage->activeDevice ();
- if (!device) return;
-
- KisPainter painter (device);
- if (m_currentImage->undo()) painter.beginTransaction (i18n ("Polygon"));
-
- painter.setPaintColor(m_subject->fgColor());
- painter.setBackgroundColor(m_subject->bgColor());
- painter.setFillStyle(fillStyle());
- painter.setBrush(m_subject->currentBrush());
- painter.setPattern(m_subject->currentPattern());
- painter.setOpacity(m_opacity);
- painter.setCompositeOp(m_compositeOp);
- KisPaintOp * op = KisPaintOpRegistry::instance()->paintOp(m_subject->currentPaintop(), m_subject->currentPaintopSettings(), &painter);
- painter.setPaintOp(op); // Painter takes ownership
-
- painter.paintPolygon(m_points);
-
- m_points.clear();
-
- device->setDirty( painter.dirtyRect() );
- notifyModified();
-
- if (m_currentImage->undo()) {
- m_currentImage->undoAdapter()->addCommand(painter.endTransaction());
- }
-}
-
-void KisToolPolygon::doubleClick( KisDoubleClickEvent * )
-{
- finish();
-}
-
-void KisToolPolygon::move(KisMoveEvent *event)
-{
- if (m_dragging) {
- // erase old lines on canvas
- draw();
- // get current mouse position
- m_dragEnd = event->pos();
- // draw new lines on canvas
- draw();
- }
-}
-
-void KisToolPolygon::buttonRelease(KisButtonReleaseEvent *event)
-{
- if (!m_subject || !m_currentImage)
- return;
-
- if (m_dragging && event->button() == LeftButton) {
- m_dragging = false;
- m_points.append (m_dragEnd);
- }
-
- if (m_dragging && event->button() == RightButton) {
-
- }
-}
-
-void KisToolPolygon::paint(KisCanvasPainter& gc)
-{
- draw(gc);
-}
-
-void KisToolPolygon::paint(KisCanvasPainter& gc, const TQRect&)
-{
- draw(gc);
-}
-
-void KisToolPolygon::draw()
-{
- if (m_subject) {
- KisCanvasController *controller = m_subject->canvasController();
- KisCanvas *canvas = controller->kiscanvas();
- KisCanvasPainter gc(canvas);
-
- draw(gc);
- }
-}
-
-void KisToolPolygon::draw(KisCanvasPainter& gc)
-{
- if (!m_subject || !m_currentImage)
- return;
-
- TQPen pen(TQt::white, 0, TQt::SolidLine);
-
- gc.setPen(pen);
- gc.setRasterOp(TQt::XorROP);
-
- KisCanvasController *controller = m_subject->canvasController();
- KisPoint start, end;
- TQPoint startPos;
- TQPoint endPos;
-
- if (m_dragging) {
- startPos = controller->windowToView(m_dragStart.floorTQPoint());
- endPos = controller->windowToView(m_dragEnd.floorTQPoint());
- gc.drawLine(startPos, endPos);
- } else {
- for (KisPointVector::iterator it = m_points.begin(); it != m_points.end(); ++it) {
-
- if (it == m_points.begin())
- {
- start = (*it);
- } else {
- end = (*it);
-
- startPos = controller->windowToView(start.floorTQPoint());
- endPos = controller->windowToView(end.floorTQPoint());
-
- gc.drawLine(startPos, endPos);
-
- start = end;
- }
- }
- }
-}
-
-
-
-void KisToolPolygon::setup(KActionCollection *collection)
-{
- m_action = static_cast<KRadioAction *>(collection->action(name()));
-
- if (m_action == 0) {
- KShortcut shortcut(TQt::Key_Plus);
- shortcut.append(KShortcut(TQt::Key_F9));
- m_action = new KRadioAction(i18n("&Polygon"),
- "tool_polygon",
- shortcut,
- this,
- TQT_SLOT(activate()),
- collection,
- name());
- Q_CHECK_PTR(m_action);
-
- m_action->setToolTip(i18n("Draw a polygon. Shift-mouseclick ends the polygon."));
- m_action->setExclusiveGroup("tools");
- m_ownAction = true;
- }
-}
-
-void KisToolPolygon::keyPress(TQKeyEvent *e)
-{
- if (e->key()==TQt::Key_Escape) {
- // erase old lines on canvas
- draw();
- m_dragging = false;
- m_points.clear();
- }
-}
-
-
-#include "kis_tool_polygon.moc"
diff --git a/krita/plugins/tools/tool_polygon/kis_tool_polygon.h b/krita/plugins/tools/tool_polygon/kis_tool_polygon.h
deleted file mode 100644
index f68cae64..00000000
--- a/krita/plugins/tools/tool_polygon/kis_tool_polygon.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * kis_tool_polygon.h - part of Krita
- *
- * Copyright (c) 2004 Michael Thaler <michael [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 KIS_TOOL_POLYGON_H_
-#define KIS_TOOL_POLYGON_H_
-
-#include <tqvaluevector.h>
-
-#include "kis_tool_shape.h"
-
-class KisCanvas;
-class KisDoc;
-class KisPainter;
-class KisView;
-class KisRect;
-
-class KisToolPolygon : public KisToolShape {
-
- typedef KisToolShape super;
- Q_OBJECT
- TQ_OBJECT
-
-public:
- KisToolPolygon();
- virtual ~KisToolPolygon();
-
- //
- // KisCanvasObserver interface
- //
-
- virtual void update (KisCanvasSubject *subject);
-
- //
- // KisToolPaint interface
- //
-
- virtual void setup(KActionCollection *collection);
- virtual enumToolType toolType() { return TOOL_SHAPE; }
- virtual TQ_UINT32 priority() { return 4; }
- virtual void buttonPress(KisButtonPressEvent *event);
- virtual void move(KisMoveEvent *event);
- virtual void buttonRelease(KisButtonReleaseEvent *event);
- virtual TQString quickHelp() const {
- return i18n("Shift-click will end the polygon.");
- }
- virtual void doubleClick(KisDoubleClickEvent * event);
-
-protected:
- virtual void paint(KisCanvasPainter& gc);
- virtual void paint(KisCanvasPainter& gc, const TQRect& rc);
- void draw(KisCanvasPainter& gc);
- void draw();
- void finish();
- virtual void keyPress(TQKeyEvent *e);
-protected:
- KisPoint m_dragStart;
- KisPoint m_dragEnd;
-
- bool m_dragging;
- KisImageSP m_currentImage;
-private:
- typedef TQValueVector<KisPoint> KisPointVector;
- KisPointVector m_points;
-};
-
-
-#include "kis_tool_factory.h"
-
-class KisToolPolygonFactory : public KisToolFactory {
- typedef KisToolFactory super;
-public:
- KisToolPolygonFactory() : super() {};
- virtual ~KisToolPolygonFactory(){};
-
- virtual KisTool * createTool(KActionCollection * ac) {
- KisTool * t = new KisToolPolygon();
- Q_CHECK_PTR(t);
- t->setup(ac);
- return t;
- }
- virtual KisID id() { return KisID("polygon", i18n("Polygon Tool")); }
-};
-
-
-#endif //__KIS_TOOL_POLYGON_H__
diff --git a/krita/plugins/tools/tool_polygon/kritatoolpolygon.desktop b/krita/plugins/tools/tool_polygon/kritatoolpolygon.desktop
deleted file mode 100644
index 08d8b162..00000000
--- a/krita/plugins/tools/tool_polygon/kritatoolpolygon.desktop
+++ /dev/null
@@ -1,52 +0,0 @@
-[Desktop Entry]
-Name=Polygon Tool
-Name[bg]=Инструмент многоъгълник
-Name[br]=Ostilh liestueg
-Name[ca]=Eina de polígon
-Name[cy]=Erfyn Polygon
-Name[da]=Polygonværktøj
-Name[de]=Vieleck-Werkzeug
-Name[el]=Εργαλείο πολυγώνου
-Name[eo]=Poligon-ilo
-Name[es]=Herramienta Polígono
-Name[et]=Hulknurga tööriist
-Name[eu]=Poligonoa tresna
-Name[fa]=ابزار چندضلعی
-Name[fi]=Monikulmiotyökalu
-Name[fr]=Outil polygone
-Name[fy]=Meardere-hoek-ark
-Name[ga]=Uirlis Pholagáin
-Name[gl]=Ferramenta de Polígonos
-Name[he]=כלי מצולע
-Name[hu]=Sokszög eszköz
-Name[is]=Marghyrnitól
-Name[it]=Strumento poligono
-Name[ja]=多角形ツール
-Name[km]=ឧបករណ៍​រាង​ពហុកោណ
-Name[lt]=Daugiakampio įrankis
-Name[lv]=Poligonu rīks
-Name[ms]=Alat Poligon
-Name[nb]=Verktøy for mangekanter
-Name[nds]=Veeleck-Warktüüch
-Name[ne]=बहुभुज उपकरण
-Name[nl]=Veelhoeksgereedschap
-Name[nn]=Verktøy for mangekant
-Name[pl]=Narzędzie do rysowania wielokątów
-Name[pt]=Ferramenta de Polígonos
-Name[pt_BR]=Ferramenta Polígono
-Name[ru]=Многоугольник
-Name[se]=Moanáčiegareaidu
-Name[sk]=Mnohouholník
-Name[sl]=Orodje za poligon
-Name[sr]=Алат за полигоне
-Name[sr@Latn]=Alat za poligone
-Name[sv]=Polygonverktyg
-Name[uk]=Засіб багатокутника
-Name[uz]=Pligon vositasi
-Name[uz@cyrillic]=Плигон воситаси
-Name[zh_CN]=多边形工具
-Name[zh_TW]=多邊形工具
-ServiceTypes=Krita/Tool
-Type=Service
-X-KDE-Library=kritatoolpolygon
-X-Krita-Version=2
diff --git a/krita/plugins/tools/tool_polygon/tool_polygon.cc b/krita/plugins/tools/tool_polygon/tool_polygon.cc
deleted file mode 100644
index 81abbb95..00000000
--- a/krita/plugins/tools/tool_polygon/tool_polygon.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * tool_polygon.cc -- Part of Krita
- *
- * Copyright (c) 2004 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 <stdlib.h>
-#include <vector>
-
-#include <tqpoint.h>
-
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kinstance.h>
-#include <kmessagebox.h>
-#include <kstandarddirs.h>
-#include <kdebug.h>
-#include <kgenericfactory.h>
-
-#include <kis_global.h>
-#include <kis_types.h>
-#include <kis_tool_registry.h>
-#include "tool_polygon.h"
-#include "tool_polygon.moc"
-#include "kis_tool_polygon.h"
-
-
-typedef KGenericFactory<ToolPolygon> ToolPolygonFactory;
-K_EXPORT_COMPONENT_FACTORY( kritatoolpolygon, ToolPolygonFactory( "krita" ) )
-
-
-ToolPolygon::ToolPolygon(TQObject *tqparent, const char *name, const TQStringList &)
- : KParts::Plugin(tqparent, name)
-{
- setInstance(ToolPolygonFactory::instance());
-
- if ( tqparent->inherits("KisToolRegistry") )
- {
- KisToolRegistry * r = dynamic_cast<KisToolRegistry*>( tqparent );
- r->add(new KisToolPolygonFactory());
- }
-
-}
-
-ToolPolygon::~ToolPolygon()
-{
-}
-
-//#include "tool_polygon.moc"
diff --git a/krita/plugins/tools/tool_polygon/tool_polygon.h b/krita/plugins/tools/tool_polygon/tool_polygon.h
deleted file mode 100644
index ec816736..00000000
--- a/krita/plugins/tools/tool_polygon/tool_polygon.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2004 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 TOOL_POLYGON_H_
-#define TOOL_POLYGON_H_
-
-#include <kparts/plugin.h>
-
-/**
- * A module that provides a polygon tool.
- */
-class ToolPolygon : public KParts::Plugin
-{
- Q_OBJECT
- TQ_OBJECT
-
-public:
-
- ToolPolygon(TQObject *tqparent, const char *name, const TQStringList &);
- virtual ~ToolPolygon();
-
-};
-
-#endif // TOOL_POLYGON_H_
diff --git a/krita/plugins/tools/tool_polygon/tool_polygon.png b/krita/plugins/tools/tool_polygon/tool_polygon.png
deleted file mode 100644
index 654083c6..00000000
--- a/krita/plugins/tools/tool_polygon/tool_polygon.png
+++ /dev/null
Binary files differ
diff --git a/krita/plugins/tools/tool_polygon/tool_polygon_cursor.png b/krita/plugins/tools/tool_polygon/tool_polygon_cursor.png
deleted file mode 100644
index bca4bffd..00000000
--- a/krita/plugins/tools/tool_polygon/tool_polygon_cursor.png
+++ /dev/null
Binary files differ