summaryrefslogtreecommitdiffstats
path: root/krita/plugins/tools/tool_polyline
diff options
context:
space:
mode:
Diffstat (limited to 'krita/plugins/tools/tool_polyline')
-rw-r--r--krita/plugins/tools/tool_polyline/Makefile.am36
-rw-r--r--krita/plugins/tools/tool_polyline/kis_tool_polyline.cc271
-rw-r--r--krita/plugins/tools/tool_polyline/kis_tool_polyline.h109
-rw-r--r--krita/plugins/tools/tool_polyline/kritatoolpolyline.desktop49
-rw-r--r--krita/plugins/tools/tool_polyline/polyline.pngbin587 -> 0 bytes
-rw-r--r--krita/plugins/tools/tool_polyline/tool_polyline.cc64
-rw-r--r--krita/plugins/tools/tool_polyline/tool_polyline.h43
-rw-r--r--krita/plugins/tools/tool_polyline/tool_polyline_cursor.pngbin397 -> 0 bytes
8 files changed, 0 insertions, 572 deletions
diff --git a/krita/plugins/tools/tool_polyline/Makefile.am b/krita/plugins/tools/tool_polyline/Makefile.am
deleted file mode 100644
index 1df08602..00000000
--- a/krita/plugins/tools/tool_polyline/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-kde_services_DATA = kritatoolpolyline.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)
-
-kritatoolpolyline_la_SOURCES = \
- tool_polyline.cc \
- kis_tool_polyline.cc
-
-# Install this plugin in the KDE modules directory
-kde_module_LTLIBRARIES = kritatoolpolyline.la
-
-noinst_HEADERS = \
- tool_polyline.h \
- kis_tool_polyline.h
-
-kritatoolpolyline_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
-kritatoolpolyline_la_LIBADD = ../../../libkritacommon.la
-
-kritatoolpolyline_la_METASOURCES = AUTO
-
-KDE_OPTIONS = nofinal
-
-kritapics_DATA = \
- tool_polyline_cursor.png \
- polyline.png
-
-kritapicsdir = $(kde_datadir)/krita/pics
-
diff --git a/krita/plugins/tools/tool_polyline/kis_tool_polyline.cc b/krita/plugins/tools/tool_polyline/kis_tool_polyline.cc
deleted file mode 100644
index baeb946d..00000000
--- a/krita/plugins/tools/tool_polyline/kis_tool_polyline.cc
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * kis_tool_polyline.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_polyline.h"
-
-KisToolPolyline::KisToolPolyline()
- : super(i18n ("Polyline")),
- m_dragging (false),
- m_currentImage (0)
-{
- setName("tool_polyline");
- setCursor(KisCursor::load("tool_polyline_cursor.png", 6, 6));
-}
-
-KisToolPolyline::~KisToolPolyline()
-{
-}
-
-void KisToolPolyline::update (KisCanvasSubject *subject)
-{
- super::update (subject);
- if (m_subject)
- m_currentImage = m_subject->currentImg ();
-}
-
-void KisToolPolyline::buttonPress(KisButtonPressEvent *event)
-{
- if (m_currentImage) {
- if (event->button() == LeftButton && event->state() != TQt::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() == TQt::ShiftButton ) {
- finish();
- }
- }
-}
-
-void KisToolPolyline::deactivate()
-{
- draw();
- m_points.clear();
- m_dragging = false;
-}
-
-void KisToolPolyline::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 ("Polyline"));
-
- painter.setPaintColor(m_subject->fgColor());
- painter.setBrush(m_subject->currentBrush());
- 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
-
- KisPoint start,end;
- KisPointVector::iterator it;
- for( it = m_points.begin(); it != m_points.end(); ++it )
- {
- if( it == m_points.begin() )
- {
- start = (*it);
- } else {
- end = (*it);
- painter.paintLine(start, PRESSURE_DEFAULT, 0, 0, end, PRESSURE_DEFAULT, 0, 0);
- start = end;
- }
- }
- m_points.clear();
-
- device->setDirty( painter.dirtyRect() );
- notifyModified();
-
- if (m_currentImage->undo()) {
- m_currentImage->undoAdapter()->addCommand(painter.endTransaction());
- }
-
-}
-void KisToolPolyline::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 KisToolPolyline::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 KisToolPolyline::doubleClick(KisDoubleClickEvent *)
-{
- finish();
-}
-
-
-void KisToolPolyline::paint(KisCanvasPainter& gc)
-{
- draw(gc);
-}
-
-void KisToolPolyline::paint(KisCanvasPainter& gc, const TQRect&)
-{
- draw(gc);
-}
-
-void KisToolPolyline::draw()
-{
- if (m_subject) {
- KisCanvasController *controller = m_subject->canvasController();
- KisCanvas *canvas = controller->kiscanvas();
- KisCanvasPainter gc(canvas);
-
- draw(gc);
- }
-}
-
-void KisToolPolyline::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 KisToolPolyline::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("&Polyline"),
- "polyline",
- shortcut,
- this,
- TQT_SLOT(activate()),
- collection,
- name());
- Q_CHECK_PTR(m_action);
-
- m_action->setToolTip(i18n("Draw a polyline. Shift-mouseclick ends the polyline."));
- m_action->setExclusiveGroup("tools");
- m_ownAction = true;
- }
-}
-
-TQString KisToolPolyline::quickHelp() const
-{
- return i18n("Press shift-mouseclick to end the polyline.");
-}
-
-void KisToolPolyline::keyPress(TQKeyEvent *e)
-{
- if (e->key()==TQt::Key_Escape) {
- // erase old lines on canvas
- draw();
- m_dragging = false;
- m_points.clear();
- }
-}
-
-#include "kis_tool_polyline.moc"
diff --git a/krita/plugins/tools/tool_polyline/kis_tool_polyline.h b/krita/plugins/tools/tool_polyline/kis_tool_polyline.h
deleted file mode 100644
index b234c53b..00000000
--- a/krita/plugins/tools/tool_polyline/kis_tool_polyline.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * kis_tool_polyline.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_POLYLINE_H_
-#define KIS_TOOL_POLYLINE_H_
-
-#include <tqvaluevector.h>
-#include <tqstring.h>
-
-#include "kis_tool_paint.h"
-#include "kis_point.h"
-
-class KisCanvas;
-class KisDoc;
-class KisPainter;
-class KisView;
-class KisRect;
-
-
-class KisToolPolyline : public KisToolPaint {
-
- typedef KisToolPaint super;
- Q_OBJECT
- TQ_OBJECT
-
-public:
- KisToolPolyline();
- virtual ~KisToolPolyline();
-
- //
- // 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 5; }
-
- virtual void buttonPress(KisButtonPressEvent *event);
- virtual void doubleClick(KisDoubleClickEvent *e);
- virtual void move(KisMoveEvent *event);
- virtual void buttonRelease(KisButtonReleaseEvent *event);
- virtual TQString quickHelp() const;
- void finish();
- virtual void keyPress(TQKeyEvent *e);
-
-public slots:
-
- void deactivate();
-
-protected:
- virtual void paint(KisCanvasPainter& gc);
- virtual void paint(KisCanvasPainter& gc, const TQRect& rc);
- void draw(KisCanvasPainter& gc);
- void draw();
-
-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 KisToolPolylineFactory : public KisToolFactory {
- typedef KisToolFactory super;
-public:
- KisToolPolylineFactory() : super() {};
- virtual ~KisToolPolylineFactory(){};
-
- virtual KisTool * createTool(KActionCollection * ac) {
- KisTool * t = new KisToolPolyline();
- Q_CHECK_PTR(t);
- t->setup(ac);
- return t;
- }
- virtual KisID id() { return KisID("polyline", i18n("Polyline Tool")); }
-};
-
-
-#endif //__KIS_TOOL_POLYLINE_H__
diff --git a/krita/plugins/tools/tool_polyline/kritatoolpolyline.desktop b/krita/plugins/tools/tool_polyline/kritatoolpolyline.desktop
deleted file mode 100644
index fc0db01c..00000000
--- a/krita/plugins/tools/tool_polyline/kritatoolpolyline.desktop
+++ /dev/null
@@ -1,49 +0,0 @@
-[Desktop Entry]
-Name=Polyline Tool
-Name[bg]=Инструмент съставна линия
-Name[br]=Ostilh lieslinenn
-Name[ca]=Eina de polilínia
-Name[cy]=Erfyn Polylinell
-Name[da]=Flerlinjeværktøj
-Name[de]=Linienketten-Werkzeug
-Name[el]=Εργαλείο συνεχούς γραμμής
-Name[eo]=Plurlinio-ilo
-Name[es]=Herramienta Polilínea
-Name[et]=Kompleksjoone tööriist
-Name[eu]=Polilerroa tresna
-Name[fa]=ابزار چندخطی
-Name[fr]=Outil lignes multiples
-Name[fy]=Brútsen-streek-ark
-Name[ga]=Uirlis Il-líne
-Name[gl]=Ferramenta de Liñas Poligonais
-Name[he]=כלי קו שבור
-Name[hu]=Sokszögvonal eszköz
-Name[is]=Fjöllínutól
-Name[it]=Strumento polilinea
-Name[ja]=ポリラインツール
-Name[km]=ឧបករណ៍​ពហុបន្ទាត់
-Name[ms]=Alat Poligaris
-Name[nb]=Verktøy for flerstrekslinje
-Name[nds]=Lienenkeden-Warktüüch (Polygon-Tog)
-Name[ne]=बहुरेखा उपकरण
-Name[nl]=Gebroken-lijngereedschap
-Name[nn]=Verktøy for fleirstrekslinje
-Name[pl]=Narzędzie do rysowania łamanej
-Name[pt]=Ferramenta de Linhas Poligonais
-Name[pt_BR]=Ferramenta Poli-linha
-Name[ru]=Ломаная
-Name[se]=Moanálinnjáreaidu
-Name[sk]=Lomená čiara
-Name[sl]=Orodje za lomljeno črto
-Name[sr]=Алат за полилиније
-Name[sr@Latn]=Alat za polilinije
-Name[sv]=Flerlinjesverktyg
-Name[uk]=Засіб ламаної лінії
-Name[uz]=Koʻpburchak asbobi
-Name[uz@cyrillic]=Кўпбурчак асбоби
-Name[zh_CN]=折线工具
-Name[zh_TW]=任意線工具
-ServiceTypes=Krita/Tool
-Type=Service
-X-KDE-Library=kritatoolpolyline
-X-Krita-Version=2
diff --git a/krita/plugins/tools/tool_polyline/polyline.png b/krita/plugins/tools/tool_polyline/polyline.png
deleted file mode 100644
index df36313e..00000000
--- a/krita/plugins/tools/tool_polyline/polyline.png
+++ /dev/null
Binary files differ
diff --git a/krita/plugins/tools/tool_polyline/tool_polyline.cc b/krita/plugins/tools/tool_polyline/tool_polyline.cc
deleted file mode 100644
index 830a2d22..00000000
--- a/krita/plugins/tools/tool_polyline/tool_polyline.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * tool_polyline.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 <kis_view.h>
-
-#include "tool_polyline.h"
-#include "kis_tool_polyline.h"
-
-
-typedef KGenericFactory<ToolPolyline> ToolPolylineFactory;
-K_EXPORT_COMPONENT_FACTORY( kritatoolpolyline, ToolPolylineFactory( "krita" ) )
-
-
-ToolPolyline::ToolPolyline(TQObject *tqparent, const char *name, const TQStringList &)
- : KParts::Plugin(tqparent, name)
-{
- setInstance(ToolPolylineFactory::instance());
-
- if ( tqparent->inherits("KisToolRegistry") )
- {
- KisToolRegistry * r = dynamic_cast<KisToolRegistry*>(tqparent);
-
- r->add(new KisToolPolylineFactory());
- }
-
-}
-
-ToolPolyline::~ToolPolyline()
-{
-}
-
-#include "tool_polyline.moc"
diff --git a/krita/plugins/tools/tool_polyline/tool_polyline.h b/krita/plugins/tools/tool_polyline/tool_polyline.h
deleted file mode 100644
index 9f483363..00000000
--- a/krita/plugins/tools/tool_polyline/tool_polyline.h
+++ /dev/null
@@ -1,43 +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_POLYLINE_H_
-#define TOOL_POLYLINE_H_
-
-#include <kparts/plugin.h>
-
-class KisView;
-
-/**
- * A module that provides a polyline tool.
- */
-class ToolPolyline : public KParts::Plugin
-{
- Q_OBJECT
- TQ_OBJECT
-public:
- ToolPolyline(TQObject *tqparent, const char *name, const TQStringList &);
- virtual ~ToolPolyline();
-
-private:
-
- KisView * m_view;
-
-};
-
-#endif // TOOL_POLYLINE_H_
diff --git a/krita/plugins/tools/tool_polyline/tool_polyline_cursor.png b/krita/plugins/tools/tool_polyline/tool_polyline_cursor.png
deleted file mode 100644
index b60c2db0..00000000
--- a/krita/plugins/tools/tool_polyline/tool_polyline_cursor.png
+++ /dev/null
Binary files differ