X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Feventhandler.cpp;fp=src%2Fbase%2Feventhandler.cpp;h=a8b64179e4207ff8a8a504d10759cdcb1a6de70f;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=58334af9958ac11b3b2afef28d4d4aadf9be4be6;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/eventhandler.cpp b/src/base/eventhandler.cpp index 58334af..a8b6417 100644 --- a/src/base/eventhandler.cpp +++ b/src/base/eventhandler.cpp @@ -26,7 +26,7 @@ /** * Constructor. */ -RS_EventHandler::RS_EventHandler(GraphicView * graphicView) +EventHandler::EventHandler(GraphicView * graphicView) { this->graphicView = graphicView; actionIndex = -1; @@ -41,9 +41,9 @@ RS_EventHandler::RS_EventHandler(GraphicView * graphicView) /** * Destructor. */ -RS_EventHandler::~RS_EventHandler() +EventHandler::~EventHandler() { - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler"); + DEBUG->print("EventHandler::~EventHandler"); if (defaultAction != NULL) { @@ -54,7 +54,7 @@ RS_EventHandler::~RS_EventHandler() killAllActions(); - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: Deleting all actions.."); + DEBUG->print("EventHandler::~EventHandler: Deleting all actions.."); for(int i=0; iprint("RS_EventHandler::~RS_EventHandler: Deleting all actions..: OK"); - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: OK"); + DEBUG->print("EventHandler::~EventHandler: Deleting all actions..: OK"); + DEBUG->print("EventHandler::~EventHandler: OK"); } /** * Go back in current action. */ -void RS_EventHandler::back() +void EventHandler::back() { QMouseEvent e(QEvent::MouseButtonRelease, QPoint(0, 0), Qt::RightButton, Qt::RightButton, Qt::NoModifier); @@ -84,7 +84,7 @@ void RS_EventHandler::back() /** * Go enter pressed event for current action. */ -void RS_EventHandler::enter() +void EventHandler::enter() { // QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, '\n', 0); QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier, "\n", false, 0); @@ -94,7 +94,7 @@ void RS_EventHandler::enter() /** * Called by GraphicView */ -void RS_EventHandler::mousePressEvent(QMouseEvent * e) +void EventHandler::mousePressEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] != NULL) { @@ -110,7 +110,7 @@ void RS_EventHandler::mousePressEvent(QMouseEvent * e) } else { - RS_DEBUG->print("currently no action defined"); + DEBUG->print("currently no action defined"); e->ignore(); } } @@ -119,12 +119,12 @@ void RS_EventHandler::mousePressEvent(QMouseEvent * e) /** * Called by GraphicView */ -void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e) +void EventHandler::mouseReleaseEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] != NULL && !currentActions[actionIndex]->isFinished()) { - RS_DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data()); + DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data()); currentActions[actionIndex]->mouseReleaseEvent(e); // Clean up actions - one might be finished now @@ -143,7 +143,7 @@ void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e) /** * Called by GraphicView */ -void RS_EventHandler::mouseMoveEvent(QMouseEvent * e) +void EventHandler::mouseMoveEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -160,14 +160,14 @@ void RS_EventHandler::mouseMoveEvent(QMouseEvent * e) } else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::mouseLeaveEvent() +void EventHandler::mouseLeaveEvent() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -178,14 +178,14 @@ void RS_EventHandler::mouseLeaveEvent() { if (defaultAction) defaultAction->suspend(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::mouseEnterEvent() +void EventHandler::mouseEnterEvent() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -202,7 +202,7 @@ void RS_EventHandler::mouseEnterEvent() /** * Called by GraphicView */ -void RS_EventHandler::keyPressEvent(QKeyEvent * e) +void EventHandler::keyPressEvent(QKeyEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -216,14 +216,14 @@ void RS_EventHandler::keyPressEvent(QKeyEvent * e) else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::keyReleaseEvent(QKeyEvent * e) +void EventHandler::keyReleaseEvent(QKeyEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -237,16 +237,16 @@ void RS_EventHandler::keyReleaseEvent(QKeyEvent * e) else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Handles command line events. */ -void RS_EventHandler::commandEvent(RS_CommandEvent * e) +void EventHandler::commandEvent(CommandEvent * e) { - RS_DEBUG->print("RS_EventHandler::commandEvent"); + DEBUG->print("EventHandler::commandEvent"); QString cmd = e->getCommand(); if (coordinateInputEnabled) @@ -260,27 +260,27 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) && !currentActions[actionIndex]->isFinished()) { int commaPos = cmd.indexOf(','); - RS_DEBUG->print("RS_EventHandler::commandEvent: 001"); + DEBUG->print("EventHandler::commandEvent: 001"); bool ok1, ok2; - RS_DEBUG->print("RS_EventHandler::commandEvent: 002"); - double x = RS_Math::eval(cmd.left(commaPos), &ok1); - RS_DEBUG->print("RS_EventHandler::commandEvent: 003a"); - double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); - RS_DEBUG->print("RS_EventHandler::commandEvent: 004"); + DEBUG->print("EventHandler::commandEvent: 002"); + double x = Math::eval(cmd.left(commaPos), &ok1); + DEBUG->print("EventHandler::commandEvent: 003a"); + double y = Math::eval(cmd.mid(commaPos + 1), &ok2); + DEBUG->print("EventHandler::commandEvent: 004"); if (ok1 && ok2) { -// RS_DEBUG->print("RS_EventHandler::commandEvent: 005"); -// RS_CoordinateEvent ce(Vector(x, y)); - RS_DEBUG->print("RS_EventHandler::commandEvent: 006"); +// DEBUG->print("EventHandler::commandEvent: 005"); +// CoordinateEvent ce(Vector(x, y)); + DEBUG->print("EventHandler::commandEvent: 006"); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(x, y); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -298,20 +298,20 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) { int commaPos = cmd.indexOf(','); bool ok1, ok2; - double x = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1); - double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double x = Math::eval(cmd.mid(1, commaPos - 1), &ok1); + double y = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { -// RS_CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero()); +// CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero()); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(Vector(x,y) + graphicView->getRelativeZero()); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -329,21 +329,21 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) { int commaPos = cmd.indexOf('<'); bool ok1, ok2; - double r = RS_Math::eval(cmd.left(commaPos), &ok1); - double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double r = Math::eval(cmd.left(commaPos), &ok1); + double a = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { Vector pos; - pos.setPolar(r,RS_Math::deg2rad(a)); -// RS_CoordinateEvent ce(pos); + pos.setPolar(r,Math::deg2rad(a)); +// CoordinateEvent ce(pos); // currentActions[actionIndex]->coordinateEvent(&ce); currentActions[actionIndex]->coordinateEvent(&pos); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -362,22 +362,22 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) // int commaPos = cmd.find('<'); int commaPos = cmd.indexOf('<'); bool ok1, ok2; - double r = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1); - double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double r = Math::eval(cmd.mid(1, commaPos - 1), &ok1); + double a = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { Vector pos; - pos.setPolar(r,RS_Math::deg2rad(a)); -// RS_CoordinateEvent ce(pos + graphicView->getRelativeZero()); + pos.setPolar(r,Math::deg2rad(a)); +// CoordinateEvent ce(pos + graphicView->getRelativeZero()); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(pos + graphicView->getRelativeZero()); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -402,13 +402,13 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) } } - RS_DEBUG->print("RS_EventHandler::commandEvent: OK"); + DEBUG->print("EventHandler::commandEvent: OK"); } /** * Enables coordinate input in the command line. */ -void RS_EventHandler::enableCoordinateInput() +void EventHandler::enableCoordinateInput() { coordinateInputEnabled = true; } @@ -416,7 +416,7 @@ void RS_EventHandler::enableCoordinateInput() /** * Enables coordinate input in the command line. */ -void RS_EventHandler::disableCoordinateInput() +void EventHandler::disableCoordinateInput() { coordinateInputEnabled = false; } @@ -424,7 +424,7 @@ void RS_EventHandler::disableCoordinateInput() /** * @return Current action. */ -ActionInterface * RS_EventHandler::getCurrentAction() +ActionInterface * EventHandler::getCurrentAction() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -436,7 +436,7 @@ ActionInterface * RS_EventHandler::getCurrentAction() /** * @return The current default action. */ -ActionInterface * RS_EventHandler::getDefaultAction() +ActionInterface * EventHandler::getDefaultAction() { return defaultAction; } @@ -444,7 +444,7 @@ ActionInterface * RS_EventHandler::getDefaultAction() /** * Sets the default action. */ -void RS_EventHandler::setDefaultAction(ActionInterface * action) +void EventHandler::setDefaultAction(ActionInterface * action) { if (defaultAction) { @@ -459,9 +459,9 @@ void RS_EventHandler::setDefaultAction(ActionInterface * action) /** * Sets the current action. */ -void RS_EventHandler::setCurrentAction(ActionInterface * action) +void EventHandler::setCurrentAction(ActionInterface * action) { - RS_DEBUG->print("RS_EventHandler::setCurrentAction"); + DEBUG->print("EventHandler::setCurrentAction"); if (!action) return; @@ -507,35 +507,35 @@ void RS_EventHandler::setCurrentAction(ActionInterface * action) // Set current action: currentActions[actionIndex] = action; - RS_DEBUG->print("RS_EventHandler::setCurrentAction: current action is: %s", + DEBUG->print("EventHandler::setCurrentAction: current action is: %s", currentActions[actionIndex]->getName().toLatin1().data()); // Initialisation of our new action: - RS_DEBUG->print("RS_EventHandler::setCurrentAction: init current action"); + DEBUG->print("EventHandler::setCurrentAction: init current action"); action->init(); // ## new: if (action->isFinished() == false) { - RS_DEBUG->print("RS_EventHandler::setCurrentAction: show options"); + DEBUG->print("EventHandler::setCurrentAction: show options"); currentActions[actionIndex]->showOptions(); - RS_DEBUG->print("RS_EventHandler::setCurrentAction: set predecessor"); + DEBUG->print("EventHandler::setCurrentAction: set predecessor"); action->setPredecessor(predecessor); } - RS_DEBUG->print("RS_EventHandler::setCurrentAction: cleaning up.."); + DEBUG->print("EventHandler::setCurrentAction: cleaning up.."); cleanUp(); - RS_DEBUG->print("RS_EventHandler::setCurrentAction: debugging actions"); + DEBUG->print("EventHandler::setCurrentAction: debugging actions"); debugActions(); - RS_DEBUG->print("GraphicView::setCurrentAction: OK"); + DEBUG->print("GraphicView::setCurrentAction: OK"); } /** * Kills all running selection actions. Called when a selection action * is launched to reduce confusion. */ -void RS_EventHandler::killSelectActions() +void EventHandler::killSelectActions() { for(int c=0; cprint("RS_EventHandler::cleanUp"); + DEBUG->print("EventHandler::cleanUp"); int o = 0; // old index int n = 0; // new index @@ -650,13 +650,13 @@ void RS_EventHandler::cleanUp() } } - RS_DEBUG->print("RS_EventHandler::cleanUp: OK"); + DEBUG->print("EventHandler::cleanUp: OK"); } /** * Sets the snap mode for all currently active actions. */ -void RS_EventHandler::setSnapMode(RS2::SnapMode sm) +void EventHandler::setSnapMode(RS2::SnapMode sm) { #if 0 for(int c=0; cprint("---"); + DEBUG->print("---"); for(int c=0; cprint("Current"); + DEBUG->print("Current"); if (currentActions[c]) - RS_DEBUG->print("Action %03d: %s [%s]", + DEBUG->print("Action %03d: %s [%s]", c, currentActions[c]->getName().toLatin1().data(), currentActions[c]->isFinished() ? "finished" : "active"); else - RS_DEBUG->print("Action %03d: NULL", c); + DEBUG->print("Action %03d: NULL", c); } }