X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fselection.cpp;h=ce50e01c0f8a73e5e365b560218e361b29a556f9;hb=5adb444f3e523d3fd028617ced72d1ea6661db21;hp=1261f7098325549366d71d4d9443e0ed9cab1978;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/selection.cpp b/src/base/selection.cpp index 1261f70..ce50e01 100644 --- a/src/base/selection.cpp +++ b/src/base/selection.cpp @@ -29,7 +29,7 @@ * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ -RS_Selection::RS_Selection(RS_EntityContainer & container, GraphicView * graphicView) +Selection::Selection(EntityContainer & container, GraphicView * graphicView) { this->container = &container; this->graphicView = graphicView; @@ -39,7 +39,7 @@ RS_Selection::RS_Selection(RS_EntityContainer & container, GraphicView * graphic /** * Selects or deselects the given entitiy. */ -void RS_Selection::selectSingle(RS_Entity * e) +void Selection::selectSingle(Entity * e) { if (e && (e->getLayer() == NULL || e->getLayer()->isLocked() == false)) { @@ -52,7 +52,7 @@ void RS_Selection::selectSingle(RS_Entity * e) //Most likely because while the painter is valid, the QPainter is not... //[WAS]#warning "!!! This is causing a segfault in the draw code !!!" - if (graphicView != NULL) + if (graphicView) // graphicView->drawEntity(e); graphicView->redraw(); } @@ -61,29 +61,28 @@ void RS_Selection::selectSingle(RS_Entity * e) /** * Selects all entities on visible layers. */ -void RS_Selection::selectAll(bool select) +void Selection::selectAll(bool select) { - if (graphicView != NULL) + if (graphicView) { //graphicView->deleteEntity(container); } //container->setSelected(select); - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isVisible()) e->setSelected(select); } - if (graphicView!=NULL) - //graphicView->drawEntity(container); + if (graphicView) graphicView->redraw(); } -void RS_Selection::deselectAll() +void Selection::deselectAll() { selectAll(false); } @@ -91,17 +90,17 @@ void RS_Selection::deselectAll() /** * Selects all entities on visible layers. */ -void RS_Selection::invertSelection() +void Selection::invertSelection() { if (graphicView != NULL) { //graphicView->deleteEntity(container); } - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isVisible()) e->toggleSelected(); @@ -119,7 +118,7 @@ void RS_Selection::invertSelection() * @param v2 Second corner of the window to select. * @param select true: select, false: deselect */ -void RS_Selection::selectWindow(const Vector & v1, const Vector & v2, bool select, bool cross) +void Selection::selectWindow(const Vector & v1, const Vector & v2, bool select, bool cross) { //if (graphicView!=NULL) { // graphicView->drawWindow(v1, v2, true); @@ -132,7 +131,7 @@ void RS_Selection::selectWindow(const Vector & v1, const Vector & v2, bool selec graphicView->redraw(); } -void RS_Selection::deselectWindow(const Vector & v1, const Vector & v2) +void Selection::deselectWindow(const Vector & v1, const Vector & v2) { selectWindow(v1, v2, false); } @@ -144,15 +143,15 @@ void RS_Selection::deselectWindow(const Vector & v1, const Vector & v2) * @param v2 Endpoint of line. * @param select true: select, false: deselect */ -void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool select) +void Selection::selectIntersected(const Vector & v1, const Vector & v2, bool select) { - RS_Line line(NULL, RS_LineData(v1, v2)); + Line line(NULL, LineData(v1, v2)); bool inters; - for (RS_Entity* e=container->firstEntity(); e!=NULL; + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isVisible()) { @@ -161,12 +160,12 @@ void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool // select containers / groups: if (e->isContainer()) { - RS_EntityContainer * ec = (RS_EntityContainer *)e; + EntityContainer * ec = (EntityContainer *)e; - for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; + for(Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; e2=ec->nextEntity(RS2::ResolveAll)) { - VectorSolutions sol = RS_Information::getIntersection(&line, e2, true); + VectorSolutions sol = Information::getIntersection(&line, e2, true); if (sol.hasValid()) inters = true; @@ -174,7 +173,7 @@ void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool } else { - VectorSolutions sol = RS_Information::getIntersection(&line, e, true); + VectorSolutions sol = Information::getIntersection(&line, e, true); if (sol.hasValid()) inters = true; @@ -200,7 +199,7 @@ void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool } } -void RS_Selection::deselectIntersected(const Vector & v1, const Vector & v2) +void Selection::deselectIntersected(const Vector & v1, const Vector & v2) { selectIntersected(v1, v2, false); } @@ -210,13 +209,13 @@ void RS_Selection::deselectIntersected(const Vector & v1, const Vector & v2) * * @param e The entity where the algorithm starts. Must be an atomic entity. */ -void RS_Selection::selectContour(RS_Entity * e) +void Selection::selectContour(Entity * e) { if (!e || !e->isAtomic()) return; bool select = !e->isSelected(); - RS_AtomicEntity * ae = (RS_AtomicEntity *)e; + AtomicEntity * ae = (AtomicEntity *)e; Vector p1 = ae->getStartpoint(); Vector p2 = ae->getEndpoint(); bool found = false; @@ -240,17 +239,17 @@ void RS_Selection::selectContour(RS_Entity * e) { found = false; - for(RS_Entity * en=container->firstEntity(); en!=NULL; + for(Entity * en=container->firstEntity(); en!=NULL; en=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* en = container->entityAt(i); + //Entity* en = container->entityAt(i); if (en!=NULL && en->isVisible() && en->isAtomic() && en->isSelected()!=select && (en->getLayer()==NULL || en->getLayer()->isLocked()==false)) { - ae = (RS_AtomicEntity *)en; + ae = (AtomicEntity *)en; bool doit = false; // startpoint connects to 1st point @@ -303,14 +302,14 @@ void RS_Selection::selectContour(RS_Entity * e) /** * Selects all entities on the given layer. */ -void RS_Selection::selectLayer(RS_Entity * e) +void Selection::selectLayer(Entity * e) { if (e == NULL) return; bool select = !e->isSelected(); - RS_Layer * layer = e->getLayer(true); + Layer * layer = e->getLayer(true); if (layer == NULL) return; @@ -322,14 +321,14 @@ void RS_Selection::selectLayer(RS_Entity * e) /** * Selects all entities on the given layer. */ -void RS_Selection::selectLayer(const QString & layerName, bool select) +void Selection::selectLayer(const QString & layerName, bool select) { - for(RS_Entity * en=container->firstEntity(); en!=NULL; en=container->nextEntity()) + for(Entity * en=container->firstEntity(); en!=NULL; en=container->nextEntity()) { if (en != NULL && en->isVisible() && en->isSelected() != select && (en->getLayer() == NULL || en->getLayer()->isLocked() == false)) { - RS_Layer * l = en->getLayer(true); + Layer * l = en->getLayer(true); if (l != NULL && l->getName() == layerName) { @@ -351,7 +350,7 @@ void RS_Selection::selectLayer(const QString & layerName, bool select) } } -void RS_Selection::deselectLayer(QString & layerName) +void Selection::deselectLayer(QString & layerName) { selectLayer(layerName, false); }