X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factionmodifytrim.cpp;h=f11d064a47604486009563d263f90a08baf25456;hb=92c8661cef41f1109908bf645c0a171e34680183;hp=4cb23892963efafe4f12e88b478c13228bead8e4;hpb=d774c2655ba2c3657a565f325411144452392277;p=architektonas diff --git a/src/actions/actionmodifytrim.cpp b/src/actions/actionmodifytrim.cpp index 4cb2389..f11d064 100644 --- a/src/actions/actionmodifytrim.cpp +++ b/src/actions/actionmodifytrim.cpp @@ -3,32 +3,38 @@ // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun // Extensively rewritten and refactored by James L. Hammons -// (C) 2010 Underground Software +// Portions copyright (C) 2001-2003 RibbonSoft +// Copyright (C) 2010 Underground Software +// See the README and GPLv2 files for licensing and warranty information // // JLH = James L. Hammons // // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/22/2010 Added this text. :-) +// JLH 09/17/2010 Fixed preview/snapper rendering somewhat. Some bugs remain. // #include "actionmodifytrim.h" -#include "rs_dialogfactory.h" -#include "rs_modification.h" +#include "debug.h" +#include "dialogfactory.h" +#include "modification.h" /** * @param both Trim both entities. */ -ActionModifyTrim::ActionModifyTrim(RS_EntityContainer & container, - GraphicView & graphicView, bool both): ActionInterface("Trim Entity", - container, graphicView) +ActionModifyTrim::ActionModifyTrim(EntityContainer & container, + GraphicView & graphicView, bool b): + ActionInterface("Trim Entity", container, graphicView), + limitEntity(NULL), limitCoord(false), trimEntity(NULL), trimCoord(false), + both(b) { - trimEntity = NULL; - trimCoord = Vector(false); - limitEntity = NULL; - limitCoord = Vector(false); - this->both = both; +// trimEntity = NULL; +// trimCoord = Vector(false); +// limitEntity = NULL; +// limitCoord = Vector(false); +// this->both = both; } ActionModifyTrim::~ActionModifyTrim() @@ -45,35 +51,36 @@ void ActionModifyTrim::init(int status) void ActionModifyTrim::trigger() { - RS_DEBUG->print("ActionModifyTrim::trigger()"); + DEBUG->print("ActionModifyTrim::trigger()"); if (trimEntity && trimEntity->isAtomic() && limitEntity) { - RS_Modification m(*container, graphicView); - m.trim(trimCoord, (RS_AtomicEntity *)trimEntity, - limitCoord, limitEntity, both); + Modification m(*container, graphicView); + m.trim(trimCoord, (AtomicEntity *)trimEntity, limitCoord, limitEntity, + both); trimEntity = NULL; if (both) { limitEntity->setHighlighted(false); - graphicView->drawEntity(limitEntity); +// graphicView->drawEntity(limitEntity); setStatus(ChooseLimitEntity); + graphicView->redraw(); //hm. } else setStatus(ChooseTrimEntity); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyTrim::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent begin"); + DEBUG->print("ActionModifyTrim::mouseMoveEvent begin"); Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); switch (getStatus()) { @@ -91,7 +98,7 @@ void ActionModifyTrim::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); + DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); } void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) @@ -99,7 +106,7 @@ void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) if (e->button() == Qt::LeftButton) { Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); switch (getStatus()) { @@ -110,8 +117,9 @@ void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) if (limitEntity) { limitEntity->setHighlighted(true); - graphicView->drawEntity(limitEntity); +// graphicView->drawEntity(limitEntity); setStatus(ChooseTrimEntity); + graphicView->redraw(); //hm. } break; @@ -119,7 +127,7 @@ void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) trimCoord = mouse; trimEntity = se; - if (trimEntity != NULL && trimEntity->isAtomic()) + if (trimEntity && trimEntity->isAtomic()) trigger(); break; @@ -129,15 +137,17 @@ void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) } else if (e->button() == Qt::RightButton) { - deletePreview(); - deleteSnapper(); +// deletePreview(); +// deleteSnapper(); - if (limitEntity != NULL) + if (limitEntity) { limitEntity->setHighlighted(false); - graphicView->drawEntity(limitEntity); +// graphicView->drawEntity(limitEntity); } + init(getStatus() - 1); + graphicView->redraw(); //hm. } } @@ -148,25 +158,25 @@ void ActionModifyTrim::updateMouseButtonHints() case ChooseLimitEntity: if (both) - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"), tr("Cancel")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"), tr("Back")); break; case ChooseTrimEntity: if (both) - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"), tr("Cancel")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"), + DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -178,6 +188,5 @@ void ActionModifyTrim::updateMouseCursor() void ActionModifyTrim::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } -