Source Code (Use browser search to find items of interest.)

Class Index

killustrator'PathTextTool (./koffice/killustrator/share/PathTextTool.h:35)

class PathTextTool : public Tool {
  Q_OBJECT
public:
  PathTextTool (CommandHistory* history);

  virtual void processEvent (QEvent* e, GDocument* doc, Canvas* canvas);
  virtual void activate (GDocument* doc, Canvas* canvas);
  virtual void deactivate (GDocument*, Canvas*);

private:
  QCursor cursor, oldCursor;
  GText *textObj;
};

killustrator'PathTextTool::PathTextTool() (./koffice/killustrator/share/PathTextTool.cc:60)

PathTextTool::PathTextTool (CommandHistory* history) : Tool (history) {
  QBitmap bm (bigarrow_width, bigarrow_height, bigarrow_bits, true);
  cursor = QCursor (bm, bm, bigarrow_x_hot, bigarrow_y_hot);
}


killustrator'PathTextTool::activate() (./koffice/killustrator/share/PathTextTool.cc:65)

void PathTextTool::activate (GDocument* doc, Canvas* canvas) {
  textObj = 0L;
  oldCursor = canvas->cursor ();

  if (doc->selectionCount () == 1) {
    GObject* obj = doc->getSelection ().front ();
    if (obj->isA ("GText"))
      textObj = (GText *) obj;
  }
  if (textObj)
    canvas->setCursor (cursor);
  else
    emit operationDone ();
}


killustrator'PathTextTool::deactivate() (./koffice/killustrator/share/PathTextTool.cc:80)

void PathTextTool::deactivate (GDocument*, Canvas* canvas) {
  canvas->setCursor (oldCursor);
}


killustrator'PathTextTool::processEvent() (./koffice/killustrator/share/PathTextTool.cc:84)

void PathTextTool::processEvent (QEvent* e, GDocument *doc, Canvas* /*canvas*/) {
  if (e->type () == 
#if QT_VERSION >= 199
      QEvent::KeyPress
#else
      Event_KeyPress
#endif
      ) {
    QKeyEvent *ke = (QKeyEvent *) e;
    if (ke->key () == QT_ESCAPE) {
      /*
       * Abort the last operation
       */
      textObj = 0L;
      emit operationDone ();
    }
  }
  else if (e->type () == 
#if QT_VERSION >= 199
	   QEvent::MouseButtonPress
#else
	   Event_MouseButtonPress
#endif
	   ) {
    QMouseEvent *me = (QMouseEvent *) e;
    if (me->button () == LeftButton) {
      int xpos = me->x (), ypos = me->y ();
      GObject *obj = 0L;

      if (textObj && 
	  (obj = doc->findContainingObject (xpos, ypos)) != 0L) {
	TextAlongPathCmd *cmd = new TextAlongPathCmd (doc, textObj, obj);
	history->addCommand (cmd, true);
      }
    }
    emit operationDone ();
  }
}