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=d8d8f2b7addb572252841a57393cabb92cff5a10;hb=92c8661cef41f1109908bf645c0a171e34680183;hp=a8b64179e4207ff8a8a504d10759cdcb1a6de70f;hpb=806890f384b382a02675cadc33c15fdbcec7d432;p=architektonas diff --git a/src/base/eventhandler.cpp b/src/base/eventhandler.cpp index a8b6417..d8d8f2b 100644 --- a/src/base/eventhandler.cpp +++ b/src/base/eventhandler.cpp @@ -45,7 +45,7 @@ EventHandler::~EventHandler() { DEBUG->print("EventHandler::~EventHandler"); - if (defaultAction != NULL) + if (defaultAction) { defaultAction->finish(); delete defaultAction; @@ -164,11 +164,22 @@ void EventHandler::mouseMoveEvent(QMouseEvent * e) } } +#if 0 +Small problem with this approach: Resumes can happen before suspend actions! +This can wreak havoc with things like snapper/preview states and the like... + +Actually, this stuff seems to be pretty useless. Not sure what is accomplished +by this crap. The only thing I can think of is that it would cause a preview +to be removed if the mouse goes out of the drawing window, could be a legit +purpose but this seems too retarded for that. Why wouldn't you just code that +into GraphicView itself and be done with it? +#endif /** * Called by GraphicView */ void EventHandler::mouseLeaveEvent() { +#if 0 if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) { @@ -180,6 +191,7 @@ void EventHandler::mouseLeaveEvent() defaultAction->suspend(); //DEBUG->print("currently no action defined"); } +#endif } /** @@ -187,6 +199,7 @@ void EventHandler::mouseLeaveEvent() */ void EventHandler::mouseEnterEvent() { +#if 0 if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) { @@ -197,6 +210,7 @@ void EventHandler::mouseEnterEvent() if (defaultAction) defaultAction->resume(); } +#endif } /** @@ -584,8 +598,8 @@ void EventHandler::cleanUp() { DEBUG->print("EventHandler::cleanUp"); - int o = 0; // old index - int n = 0; // new index + int oldIndex = 0; // old index + int newIndex = 0; // new index int resume = 0; // index of action to resume bool doResume = false; // do we need to resume an action actionIndex = -1; @@ -594,41 +608,41 @@ void EventHandler::cleanUp() do { - // search first used action (o) - while (currentActions[o] == NULL && o < RS_MAXACTIONS) - o++; + // Search first used action (oldIndex) + while (currentActions[oldIndex] == NULL && oldIndex < RS_MAXACTIONS) + oldIndex++; - // delete action if it is finished - if (o < RS_MAXACTIONS && currentActions[o] != NULL - && currentActions[o]->isFinished()) + // Delete action if it is finished + if (oldIndex < RS_MAXACTIONS && currentActions[oldIndex] != NULL + && currentActions[oldIndex]->isFinished()) { - delete currentActions[o]; - currentActions[o] = NULL; + delete currentActions[oldIndex]; + currentActions[oldIndex] = NULL; doResume = true; } - // move a running action up in the stack - if (o < RS_MAXACTIONS && currentActions[o] != NULL) + // Move a running action up in the stack + if (oldIndex < RS_MAXACTIONS && currentActions[oldIndex] != NULL) { - if (n != o) + if (newIndex != oldIndex) { - currentActions[n] = currentActions[o]; - resume = n; - currentActions[o] = NULL; + currentActions[newIndex] = currentActions[oldIndex]; + resume = newIndex; + currentActions[oldIndex] = NULL; } else { - if (o < RS_MAXACTIONS) - o++; + if (oldIndex < RS_MAXACTIONS) + oldIndex++; } - actionIndex = n; + actionIndex = newIndex; - if (n < RS_MAXACTIONS - 1) - n++; + if (newIndex < RS_MAXACTIONS - 1) + newIndex++; } } - while (o < RS_MAXACTIONS); + while (oldIndex < RS_MAXACTIONS); debugActions();