diff options
Diffstat (limited to 'kivio/plugins/kivioselecttool')
-rw-r--r-- | kivio/plugins/kivioselecttool/plugin.cpp | 10 | ||||
-rw-r--r-- | kivio/plugins/kivioselecttool/plugin.h | 11 | ||||
-rw-r--r-- | kivio/plugins/kivioselecttool/tool_select.cpp | 128 | ||||
-rw-r--r-- | kivio/plugins/kivioselecttool/tool_select.h | 57 |
4 files changed, 104 insertions, 102 deletions
diff --git a/kivio/plugins/kivioselecttool/plugin.cpp b/kivio/plugins/kivioselecttool/plugin.cpp index 49e68cac..c6d22e64 100644 --- a/kivio/plugins/kivioselecttool/plugin.cpp +++ b/kivio/plugins/kivioselecttool/plugin.cpp @@ -31,8 +31,8 @@ K_EXPORT_COMPONENT_FACTORY( libkivioselecttool, SelectToolFactory ) KInstance* SelectToolFactory::s_global = 0; -SelectToolFactory::SelectToolFactory( QObject* parent, const char* name ) -: KLibFactory( parent, name ) +SelectToolFactory::SelectToolFactory( TQObject* tqparent, const char* name ) +: KLibFactory( tqparent, name ) { s_global = new KInstance("kivio"); } @@ -42,12 +42,12 @@ SelectToolFactory::~SelectToolFactory() delete s_global; } -QObject* SelectToolFactory::createObject( QObject* parent, const char*, const char*, const QStringList& ) +TQObject* SelectToolFactory::createObject( TQObject* tqparent, const char*, const char*, const TQStringList& ) { - if ( !parent->inherits("KivioView") ) + if ( !tqparent->inherits("KivioView") ) return 0; - QObject *obj = new SelectTool( (KivioView*)parent ); + TQObject *obj = new SelectTool( (KivioView*)tqparent ); return obj; } diff --git a/kivio/plugins/kivioselecttool/plugin.h b/kivio/plugins/kivioselecttool/plugin.h index 4fbb6f20..dffe4161 100644 --- a/kivio/plugins/kivioselecttool/plugin.h +++ b/kivio/plugins/kivioselecttool/plugin.h @@ -19,8 +19,8 @@ #ifndef SELECT_PLUGIN_H #define SELECT_PLUGIN_H -#include <qstringlist.h> -#include <qobject.h> +#include <tqstringlist.h> +#include <tqobject.h> #include <klibloader.h> @@ -28,12 +28,13 @@ class KInstance; class SelectToolFactory : public KLibFactory { Q_OBJECT + TQ_OBJECT public: - SelectToolFactory( QObject* parent = 0, const char* name = 0 ); + SelectToolFactory( TQObject* tqparent = 0, const char* name = 0 ); ~SelectToolFactory(); - virtual QObject* createObject( QObject* parent = 0, const char* name = 0, - const char* classname = "QObject", const QStringList &args = QStringList() ); + virtual TQObject* createObject( TQObject* tqparent = 0, const char* name = 0, + const char* classname = TQOBJECT_OBJECT_NAME_STRING, const TQStringList &args = TQStringList() ); static KInstance* global(); diff --git a/kivio/plugins/kivioselecttool/tool_select.cpp b/kivio/plugins/kivioselecttool/tool_select.cpp index 333416f9..898a3508 100644 --- a/kivio/plugins/kivioselecttool/tool_select.cpp +++ b/kivio/plugins/kivioselecttool/tool_select.cpp @@ -44,24 +44,24 @@ #include <KoGuides.h> #include "kivio_command.h" -#include <qwmatrix.h> +#include <tqwmatrix.h> #include "kivio_pluginmanager.h" -SelectTool::SelectTool( KivioView* parent ) : Kivio::MouseTool(parent, "Selection Mouse Tool") +SelectTool::SelectTool( KivioView* tqparent ) : Kivio::MouseTool(tqparent, "Selection Mouse Tool") { view()->pluginManager()->setDefaultTool(this); KShortcut selectShortCut(Key_Space); - selectShortCut.setSeq(1, QKeySequence(Key_Escape)); + selectShortCut.setSeq(1, TQKeySequence(Key_Escape)); m_selectAction = new KRadioAction(i18n("&Select"), "select", selectShortCut, actionCollection(), "select"); - connect(m_selectAction, SIGNAL(toggled(bool)), this, SLOT(setActivated(bool))); + connect(m_selectAction, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setActivated(bool))); m_textEditAction = new KAction(i18n("&Edit Text..."), "text", Key_F2, - this, SLOT(editStencilText()), actionCollection(), "editText"); - (void) new KAction(i18n("Format &Stencils && Connectors..."), 0, 0, view(), SLOT(stencilFormat()), + this, TQT_SLOT(editStencilText()), actionCollection(), "editText"); + (void) new KAction(i18n("Format &Stencils && Connectors..."), 0, 0, TQT_TQOBJECT(view()), TQT_SLOT(stencilFormat()), actionCollection(), "formatStencil"); - m_arrowHeadAction = new KAction(i18n("Format &Arrowheads..."), 0, 0, view(), SLOT(arrowHeadFormat()), + m_arrowHeadAction = new KAction(i18n("Format &Arrowheads..."), 0, 0, TQT_TQOBJECT(view()), TQT_SLOT(arrowHeadFormat()), actionCollection(), "formatConnector"); m_mode = stmNone; @@ -84,17 +84,17 @@ SelectTool::~SelectTool() * @param e The event to be identified and processed * */ -bool SelectTool::processEvent(QEvent* e) +bool SelectTool::processEvent(TQEvent* e) { KivioCanvas* canvas = view()->canvasWidget(); - QMouseEvent *m; + TQMouseEvent *m; switch (e->type()) { - case QEvent::MouseButtonDblClick: - m = (QMouseEvent *)e; + case TQEvent::MouseButtonDblClick: + m = (TQMouseEvent *)e; - if( m->button() == LeftButton ) { + if( m->button() == Qt::LeftButton ) { leftDoubleClick(m->pos()); } @@ -102,12 +102,12 @@ bool SelectTool::processEvent(QEvent* e) return true; break; - case QEvent::MouseButtonPress: - m = (QMouseEvent *)e; + case TQEvent::MouseButtonPress: + m = (TQMouseEvent *)e; - if( m->button() == RightButton ) { + if( m->button() == Qt::RightButton ) { showPopupMenu(m->globalPos()); - } else if( m->button() == LeftButton ) { + } else if( m->button() == Qt::LeftButton ) { if(m->state() & ControlButton) { m_controlKey = true; } else { @@ -121,20 +121,20 @@ bool SelectTool::processEvent(QEvent* e) return true; break; - case QEvent::MouseButtonRelease: - mouseRelease( ((QMouseEvent *)e)->pos() ); + case TQEvent::MouseButtonRelease: + mouseRelease( ((TQMouseEvent *)e)->pos() ); canvas->setFocus(); return true; break; - case QEvent::MouseMove: - mouseMove( static_cast<QMouseEvent*>(e)); + case TQEvent::MouseMove: + mouseMove( TQT_TQMOUSEEVENT(e)); return true; break; - case QEvent::KeyPress: - if((static_cast<QKeyEvent*>(e)->key() >= Key_Left) && (static_cast<QKeyEvent*>(e)->key() <= Key_Down)) { - keyPress(static_cast<QKeyEvent*>(e)); + case TQEvent::KeyPress: + if((TQT_TQKEYEVENT(e)->key() >= Key_Left) && (TQT_TQKEYEVENT(e)->key() <= Key_Down)) { + keyPress(TQT_TQKEYEVENT(e)); return true; } break; @@ -162,11 +162,11 @@ void SelectTool::setActivated(bool a) /** * Selects all stencils inside a given rect */ -void SelectTool::select(const QRect &r) +void SelectTool::select(const TQRect &r) { // Calculate the start and end clicks in terms of page coordinates - KoPoint startPoint = view()->canvasWidget()->mapFromScreen( QPoint( r.x(), r.y() ) ); - KoPoint releasePoint = view()->canvasWidget()->mapFromScreen( QPoint( r.x() + r.width(), r.y() + r.height() ) ); + KoPoint startPoint = view()->canvasWidget()->mapFromScreen( TQPoint( r.x(), r.y() ) ); + KoPoint releasePoint = view()->canvasWidget()->mapFromScreen( TQPoint( r.x() + r.width(), r.y() + r.height() ) ); double x, y, w, h; @@ -192,7 +192,7 @@ void SelectTool::select(const QRect &r) view()->activePage()->selectStencils( x, y, w, h ); } -void SelectTool::mousePress(const QPoint &pos) +void SelectTool::mousePress(const TQPoint &pos) { // Last point is used for undrawing at the last position and calculating the distance the mouse has moved m_lastPoint = view()->canvasWidget()->mapFromScreen(pos); @@ -239,7 +239,7 @@ void SelectTool::mousePress(const QPoint &pos) /** * Tests if we should start rubber banding (always returns true). */ -bool SelectTool::startRubberBanding(const QPoint &pos) +bool SelectTool::startRubberBanding(const TQPoint &pos) { KivioCanvas* canvas = view()->canvasWidget(); // We didn't find a stencil, so unselect everything if we aren't holding the control key down @@ -247,7 +247,7 @@ bool SelectTool::startRubberBanding(const QPoint &pos) canvas->activePage()->unselectAllStencils(); canvas->startRectDraw( pos, KivioCanvas::Rubber ); - canvas->repaint(); + canvas->tqrepaint(); return true; } @@ -256,7 +256,7 @@ bool SelectTool::startRubberBanding(const QPoint &pos) /** * Tests if we can start dragging a stencil. */ -bool SelectTool::startDragging(const QPoint &pos, bool onlySelected) +bool SelectTool::startDragging(const TQPoint &pos, bool onlySelected) { KivioCanvas* canvas = view()->canvasWidget(); KivioPage *pPage = canvas->activePage(); @@ -299,7 +299,7 @@ bool SelectTool::startDragging(const QPoint &pos, bool onlySelected) // Create a new painter object canvas->beginUnclippedSpawnerPainter(); - // Build the list of old geometry + // Build the list of old tqgeometry KivioSelectDragData *pData; m_lstOldGeometry.clear(); pStencil = canvas->activePage()->selectedStencils()->first(); @@ -322,7 +322,7 @@ bool SelectTool::startDragging(const QPoint &pos, bool onlySelected) return true; } -bool SelectTool::startCustomDragging(const QPoint &pos, bool selectedOnly ) +bool SelectTool::startCustomDragging(const TQPoint &pos, bool selectedOnly ) { KivioCanvas* canvas = view()->canvasWidget(); KivioPage *pPage = canvas->activePage(); @@ -365,7 +365,7 @@ bool SelectTool::startCustomDragging(const QPoint &pos, bool selectedOnly ) m_customDragOrigPoint = pStencil->customIDPoint(m_customDragID); view()->canvasWidget()->setShowConnectorTargets(true); - view()->canvasWidget()->repaint(); + view()->canvasWidget()->tqrepaint(); // Create a new painter object canvas->beginUnclippedSpawnerPainter(); @@ -377,7 +377,7 @@ bool SelectTool::startCustomDragging(const QPoint &pos, bool selectedOnly ) /** * Tests if we can start resizing a stencil */ -bool SelectTool::startResizing(const QPoint &pos) +bool SelectTool::startResizing(const TQPoint &pos) { KivioCanvas* canvas = view()->canvasWidget(); KoPoint pagePoint = canvas->mapFromScreen(pos); @@ -450,9 +450,9 @@ bool SelectTool::startResizing(const QPoint &pos) -void SelectTool::mouseMove(QMouseEvent* e) +void SelectTool::mouseMove(TQMouseEvent* e) { - QPoint pos = e->pos(); + TQPoint pos = e->pos(); bool ignoreGridGuides = e->state() & ShiftButton; switch( m_mode ) @@ -481,7 +481,7 @@ void SelectTool::mouseMove(QMouseEvent* e) m_lastPoint = view()->canvasWidget()->mapFromScreen(pos); } -void SelectTool::continueRubberBanding(const QPoint &pos) +void SelectTool::continueRubberBanding(const TQPoint &pos) { view()->canvasWidget()->continueRectDraw( pos, KivioCanvas::Rubber ); } @@ -491,10 +491,10 @@ void SelectTool::continueRubberBanding(const QPoint &pos) * Continues the dragging process of a stencil (moving) * * How does this work? Initially we create a list of all the original - * geometry of all the selected stencils. We use that to calculate delta + * tqgeometry of all the selected stencils. We use that to calculate delta * movements and snap them to the grid. */ -void SelectTool::continueDragging(const QPoint &pos, bool ignoreGridGuides) +void SelectTool::continueDragging(const TQPoint &pos, bool ignoreGridGuides) { KivioCanvas* canvas = view()->canvasWidget(); KoPoint pagePoint = canvas->mapFromScreen( pos ); @@ -512,7 +512,7 @@ void SelectTool::continueDragging(const QPoint &pos, bool ignoreGridGuides) canvas->drawSelectedStencilsXOR(); } else { canvas->activePage()->setPaintSelected(false); - canvas->repaint(); + canvas->tqrepaint(); m_firstTime = false; } @@ -598,7 +598,7 @@ void SelectTool::continueDragging(const QPoint &pos, bool ignoreGridGuides) view()->updateToolBars(); } -void SelectTool::continueCustomDragging(const QPoint &pos) +void SelectTool::continueCustomDragging(const TQPoint &pos) { KivioCanvas* canvas = view()->canvasWidget(); KoPoint pagePoint = canvas->mapFromScreen(pos); @@ -628,7 +628,7 @@ void SelectTool::continueCustomDragging(const QPoint &pos) canvas->drawStencilXOR(m_pCustomDraggingStencil); } else { m_pCustomDraggingStencil->setHidden(true); - canvas->repaint(); + canvas->tqrepaint(); m_firstTime = false; } } @@ -641,14 +641,14 @@ void SelectTool::continueCustomDragging(const QPoint &pos) if(m_pCustomDraggingStencil->type() != kstConnector){ canvas->drawStencilXOR(m_pCustomDraggingStencil); } else { - view()->canvasWidget()->repaint(); + view()->canvasWidget()->tqrepaint(); } view()->updateToolBars(); } -void SelectTool::continueResizing(const QPoint &pos, bool ignoreGridGuides) +void SelectTool::continueResizing(const TQPoint &pos, bool ignoreGridGuides) { KivioCanvas* canvas = view()->canvasWidget(); KoPoint pagePoint = canvas->mapFromScreen(pos); @@ -659,7 +659,7 @@ void SelectTool::continueResizing(const QPoint &pos, bool ignoreGridGuides) KivioSelectDragData *pData = m_lstOldGeometry.first(); -/* QWMatrix m; +/* TQWMatrix m; double w2 = m_pResizingStencil->w() / 2.0; double h2 = m_pResizingStencil->h() / 2.0; m.translate(m_pResizingStencil->x(), m_pResizingStencil->y()); @@ -674,7 +674,7 @@ void SelectTool::continueResizing(const QPoint &pos, bool ignoreGridGuides) if( !pData ) { - kdDebug(43000) << "SelectTool::continueResizing() - Original geometry not found" << endl; + kdDebug(43000) << "SelectTool::continueResizing() - Original tqgeometry not found" << endl; return; } @@ -687,7 +687,7 @@ void SelectTool::continueResizing(const QPoint &pos, bool ignoreGridGuides) canvas->drawStencilXOR( m_pResizingStencil ); } else { m_pResizingStencil->setHidden(true); - canvas->repaint(); + canvas->tqrepaint(); m_firstTime = false; } @@ -814,7 +814,7 @@ void SelectTool::continueResizing(const QPoint &pos, bool ignoreGridGuides) /** * Change the mouse cursor based on what it is over. */ -void SelectTool::changeMouseCursor(const QPoint &pos) +void SelectTool::changeMouseCursor(const TQPoint &pos) { KivioCanvas* canvas = view()->canvasWidget(); KoPoint pagePoint = canvas->mapFromScreen(pos); @@ -897,7 +897,7 @@ int SelectTool::isOverResizeHandle( KivioStencil *pStencil, const double x, cons int available; - QWMatrix m; + TQWMatrix m; double w = pStencil->w(); double h = pStencil->h(); double w2 = pStencil->w() / 2.0; @@ -969,7 +969,7 @@ int SelectTool::isOverResizeHandle( KivioStencil *pStencil, const double x, cons } -void SelectTool::mouseRelease(const QPoint &pos) +void SelectTool::mouseRelease(const TQPoint &pos) { m_releasePoint = pos; @@ -994,11 +994,11 @@ void SelectTool::mouseRelease(const QPoint &pos) m_mode = stmNone; - view()->canvasWidget()->guideLines().repaintAfterSnapping(); + view()->canvasWidget()->guideLines().tqrepaintAfterSnapping(); view()->doc()->updateView(view()->activePage()); } -void SelectTool::endRubberBanding(const QPoint &pos) +void SelectTool::endRubberBanding(const TQPoint &pos) { KivioCanvas* canvas = view()->canvasWidget(); // End the rubber-band drawing @@ -1015,7 +1015,7 @@ void SelectTool::endRubberBanding(const QPoint &pos) view()->updateToolBars(); } -void SelectTool::endDragging(const QPoint&) +void SelectTool::endDragging(const TQPoint&) { KivioCanvas* canvas = view()->canvasWidget(); canvas->activePage()->setPaintSelected(true); @@ -1050,11 +1050,11 @@ void SelectTool::endDragging(const QPoint&) canvas->drawSelectedStencilsXOR(); canvas->endUnclippedSpawnerPainter(); - // Clear the list of old geometry + // Clear the list of old tqgeometry m_lstOldGeometry.clear(); } -void SelectTool::endCustomDragging(const QPoint&) +void SelectTool::endCustomDragging(const TQPoint&) { KivioCanvas* canvas = view()->canvasWidget(); m_pCustomDraggingStencil->setHidden(false); @@ -1077,10 +1077,10 @@ void SelectTool::endCustomDragging(const QPoint&) canvas->endUnclippedSpawnerPainter(); canvas->setShowConnectorTargets(false); - canvas->repaint(); + canvas->tqrepaint(); } -void SelectTool::endResizing(const QPoint&) +void SelectTool::endResizing(const TQPoint&) { KivioCanvas* canvas = view()->canvasWidget(); m_pResizingStencil->setHidden(false); @@ -1105,7 +1105,7 @@ void SelectTool::endResizing(const QPoint&) /** * Shows the popupmenu at a given point. */ -void SelectTool::showPopupMenu( const QPoint &pos ) +void SelectTool::showPopupMenu( const TQPoint &pos ) { KPopupMenu* menu = 0; @@ -1138,7 +1138,7 @@ void SelectTool::showPopupMenu( const QPoint &pos ) * it launches the text tool on the selected stencils and switches back * to this tool when it's done. */ -void SelectTool::leftDoubleClick(const QPoint& pos) +void SelectTool::leftDoubleClick(const TQPoint& pos) { if( view()->activePage()->selectedStencils()->count() <= 0 ) return; @@ -1164,7 +1164,7 @@ void SelectTool::leftDoubleClick(const QPoint& pos) } } -void SelectTool::editText(QPtrList<KivioStencil>* stencils) +void SelectTool::editText(TQPtrList<KivioStencil>* stencils) { // Locate the text tool. If not found, bail with an error Kivio::Plugin *p = view()->pluginManager()->findPlugin("Text Mouse Tool"); @@ -1191,7 +1191,7 @@ void SelectTool::editStencilText() editText(view()->activePage()->selectedStencils()); } -void SelectTool::keyPress(QKeyEvent* e) +void SelectTool::keyPress(TQKeyEvent* e) { KivioCanvas* canvas = view()->canvasWidget(); @@ -1200,7 +1200,7 @@ void SelectTool::keyPress(QKeyEvent* e) // Create a new painter object canvas->beginUnclippedSpawnerPainter(); - // Build the list of old geometry + // Build the list of old tqgeometry KivioSelectDragData *pData; m_lstOldGeometry.clear(); KivioStencil* pStencil = canvas->activePage()->selectedStencils()->first(); @@ -1253,8 +1253,8 @@ void SelectTool::keyPress(QKeyEvent* e) break; } - endDragging(QPoint()); - canvas->guideLines().repaintAfterSnapping(); + endDragging(TQPoint()); + canvas->guideLines().tqrepaintAfterSnapping(); canvas->setFocus(); } diff --git a/kivio/plugins/kivioselecttool/tool_select.h b/kivio/plugins/kivioselecttool/tool_select.h index 6a6bd9b5..6e476b99 100644 --- a/kivio/plugins/kivioselecttool/tool_select.h +++ b/kivio/plugins/kivioselecttool/tool_select.h @@ -20,15 +20,15 @@ #ifndef TOOL_SELECT_H #define TOOL_SELECT_H -#include <qptrlist.h> +#include <tqptrlist.h> #include <KoPoint.h> #include <KoRect.h> #include "kivio_mousetool.h" class KivioView; class KivioPage; -class QMouseEvent; -class QKeyEvent; +class TQMouseEvent; +class TQKeyEvent; class KPopupMenu; class KRadioAction; class KAction; @@ -54,13 +54,14 @@ enum { class SelectTool : public Kivio::MouseTool { Q_OBJECT + TQ_OBJECT public: - SelectTool( KivioView* parent ); + SelectTool( KivioView* tqparent ); ~SelectTool(); - virtual bool processEvent(QEvent* e); + virtual bool processEvent(TQEvent* e); - void select(const QRect&); + void select(const TQRect&); public slots: void setActivated(bool a); @@ -69,39 +70,39 @@ class SelectTool : public Kivio::MouseTool void operationDone(); protected slots: - void editText(QPtrList<KivioStencil>* stencils); + void editText(TQPtrList<KivioStencil>* stencils); void showProperties(); void editStencilText(); protected: - void mousePress(const QPoint&); - void mouseMove(QMouseEvent*); - void mouseRelease(const QPoint&); - void leftDoubleClick(const QPoint&); + void mousePress(const TQPoint&); + void mouseMove(TQMouseEvent*); + void mouseRelease(const TQPoint&); + void leftDoubleClick(const TQPoint&); - bool startResizing(const QPoint&); - bool startDragging(const QPoint&, bool); - bool startCustomDragging(const QPoint&, bool); - bool startRubberBanding(const QPoint&); + bool startResizing(const TQPoint&); + bool startDragging(const TQPoint&, bool); + bool startCustomDragging(const TQPoint&, bool); + bool startRubberBanding(const TQPoint&); - void continueDragging(const QPoint&, bool ignoreGridGuides = false); - void continueCustomDragging(const QPoint&); - void continueResizing(const QPoint&, bool ignoreGridGuides = false); - void continueRubberBanding(const QPoint&); + void continueDragging(const TQPoint&, bool ignoreGridGuides = false); + void continueCustomDragging(const TQPoint&); + void continueResizing(const TQPoint&, bool ignoreGridGuides = false); + void continueRubberBanding(const TQPoint&); - void endResizing(const QPoint&); - void endDragging(const QPoint&); - void endCustomDragging(const QPoint&); - void endRubberBanding(const QPoint&); + void endResizing(const TQPoint&); + void endDragging(const TQPoint&); + void endCustomDragging(const TQPoint&); + void endRubberBanding(const TQPoint&); - void showPopupMenu(const QPoint&); + void showPopupMenu(const TQPoint&); - void changeMouseCursor(const QPoint&); + void changeMouseCursor(const TQPoint&); int isOverResizeHandle( KivioStencil *pStencil, const double x, const double y ); - void keyPress(QKeyEvent* e); + void keyPress(TQKeyEvent* e); - QPoint m_startPoint, m_releasePoint; + TQPoint m_startPoint, m_releasePoint; KoPoint m_lastPoint; KoPoint m_origPoint; @@ -121,7 +122,7 @@ class SelectTool : public Kivio::MouseTool int m_resizeHandle; bool m_controlKey; int m_customDragID; - QPtrList <KivioSelectDragData> m_lstOldGeometry; + TQPtrList <KivioSelectDragData> m_lstOldGeometry; KoRect m_selectedRect; KoPoint m_customDragOrigPoint; |