X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Finsert.cpp;h=c6b9ea170d5d45a25ff35451a86827d40b1e6ec6;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=5365b008d0e11bc00b40fc4a089607bdb3830d00;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/insert.cpp b/src/base/insert.cpp index 5365b00..c6b9ea1 100644 --- a/src/base/insert.cpp +++ b/src/base/insert.cpp @@ -22,8 +22,8 @@ /** * @param parent The graphic this block belongs to. */ -RS_Insert::RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d): - RS_EntityContainer(parent), data(d) +Insert::Insert(EntityContainer * parent, const InsertData & d): + EntityContainer(parent), data(d) { block = NULL; @@ -37,13 +37,13 @@ RS_Insert::RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d): /** * Destructor. */ -RS_Insert::~RS_Insert() +Insert::~Insert() { } -/*virtual*/ RS_Entity * RS_Insert::clone() +/*virtual*/ Entity * Insert::clone() { - RS_Insert * i = new RS_Insert(*this); + Insert * i = new Insert(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // i->entities.setAutoDelete(entities.autoDelete()); i->initId(); @@ -52,13 +52,13 @@ RS_Insert::~RS_Insert() } /** @return RS2::EntityInsert */ -/*virtual*/ RS2::EntityType RS_Insert::rtti() const +/*virtual*/ RS2::EntityType Insert::rtti() const { return RS2::EntityInsert; } /** @return Copy of data that defines the insert. **/ -RS_InsertData RS_Insert::getData() const +InsertData Insert::getData() const { return data; } @@ -66,9 +66,9 @@ RS_InsertData RS_Insert::getData() const /** * Reimplementation of reparent. Invalidates block cache pointer. */ -/*virtual*/ void RS_Insert::reparent(RS_EntityContainer * parent) +/*virtual*/ void Insert::reparent(EntityContainer * parent) { - RS_Entity::reparent(parent); + Entity::reparent(parent); block = NULL; } @@ -78,12 +78,12 @@ RS_InsertData RS_Insert::getData() const * from the blockSource if one was supplied and otherwise from * the closest parent graphic. */ -RS_Block * RS_Insert::getBlockForInsert() +Block * Insert::getBlockForInsert() { if (block) return block; - RS_BlockList * blkList; + BlockList * blkList; if (!data.blockSource) { @@ -94,7 +94,7 @@ RS_Block * RS_Insert::getBlockForInsert() blkList = data.blockSource; } - RS_Block * blk = NULL; + Block * blk = NULL; if (blkList) blk = blkList->find(data.name); @@ -114,75 +114,75 @@ RS_Block * RS_Insert::getBlockForInsert() * Updates the entity buffer of this insert entity. This method * needs to be called whenever the block this insert is based on changes. */ -void RS_Insert::update() +void Insert::update() { - RS_DEBUG->print("RS_Insert::update"); - RS_DEBUG->print("RS_Insert::update: name: %s", data.name.toLatin1().data()); - RS_DEBUG->print("RS_Insert::update: insertionPoint: %f/%f", + DEBUG->print("Insert::update"); + DEBUG->print("Insert::update: name: %s", data.name.toLatin1().data()); + DEBUG->print("Insert::update: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); if (!updateEnabled) return; clear(); - RS_Block * blk = getBlockForInsert(); + Block * blk = getBlockForInsert(); if (!blk) { - RS_DEBUG->print("RS_Insert::update: Block is NULL"); + DEBUG->print("Insert::update: Block is NULL"); return; } if (isUndone()) { - RS_DEBUG->print("RS_Insert::update: Insert is in undo list"); + DEBUG->print("Insert::update: Insert is in undo list"); return; } if (fabs(data.scaleFactor.x) < 1.0e-6 || fabs(data.scaleFactor.y) < 1.0e-6) { - RS_DEBUG->print("RS_Insert::update: scale factor is 0"); + DEBUG->print("Insert::update: scale factor is 0"); return; } - RS_Pen tmpPen; + Pen tmpPen; - /*Q3PtrListIterator it = createIterator(); - RS_Entity* e; + /*Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it;*/ - RS_DEBUG->print("RS_Insert::update: cols: %d, rows: %d", data.cols, data.rows); - RS_DEBUG->print("RS_Insert::update: block has %d entities", blk->count()); + DEBUG->print("Insert::update: cols: %d, rows: %d", data.cols, data.rows); + DEBUG->print("Insert::update: block has %d entities", blk->count()); - for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) + for(Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) { for(int c=0; cprint("RS_Insert::update: col %d", c); + DEBUG->print("Insert::update: col %d", c); for(int r=0; rprint("RS_Insert::update: row %d", r); + DEBUG->print("Insert::update: row %d", r); if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate) { - RS_DEBUG->print("RS_Insert::update: updating sub-insert"); - ((RS_Insert *)e)->update(); + DEBUG->print("Insert::update: updating sub-insert"); + ((Insert *)e)->update(); } - RS_DEBUG->print("RS_Insert::update: cloning entity"); + DEBUG->print("Insert::update: cloning entity"); - RS_Entity * ne = e->clone(); + Entity * ne = e->clone(); ne->initId(); ne->setUpdateEnabled(false); ne->setParent(this); ne->setVisible(getFlag(RS2::FlagVisible)); - RS_DEBUG->print("RS_Insert::update: transforming entity"); + DEBUG->print("Insert::update: transforming entity"); // Move: - RS_DEBUG->print("RS_Insert::update: move 1"); + DEBUG->print("Insert::update: move 1"); if (fabs(data.scaleFactor.x) > 1.0e-6 && fabs(data.scaleFactor.y) > 1.0e-6) { ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c, data.spacing.y / data.scaleFactor.y * r)); @@ -193,13 +193,13 @@ void RS_Insert::update() } // Move because of block base point: - RS_DEBUG->print("RS_Insert::update: move 2"); + DEBUG->print("Insert::update: move 2"); ne->move(blk->getBasePoint() * -1); // Scale: - RS_DEBUG->print("RS_Insert::update: scale"); + DEBUG->print("Insert::update: scale"); ne->scale(data.insertionPoint, data.scaleFactor); // Rotate: - RS_DEBUG->print("RS_Insert::update: rotate"); + DEBUG->print("Insert::update: rotate"); ne->rotate(data.insertionPoint, data.angle); // Select: ne->setSelected(isSelected()); @@ -208,7 +208,7 @@ void RS_Insert::update() tmpPen = ne->getPen(false); // color from block (free floating): - if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock)) + if (tmpPen.getColor() == Color(RS2::FlagByBlock)) tmpPen.setColor(getPen().getColor()); // line width from block (free floating): @@ -229,11 +229,11 @@ void RS_Insert::update() if (data.updateMode != RS2::PreviewUpdate) { - RS_DEBUG->print("RS_Insert::update: updating new entity"); + DEBUG->print("Insert::update: updating new entity"); ne->update(); } - RS_DEBUG->print("RS_Insert::update: adding new entity"); + DEBUG->print("Insert::update: adding new entity"); addEntity(ne); } } @@ -241,82 +241,82 @@ void RS_Insert::update() calculateBorders(); - RS_DEBUG->print("RS_Insert::update: OK"); + DEBUG->print("Insert::update: OK"); } -QString RS_Insert::getName() const +QString Insert::getName() const { return data.name; } -void RS_Insert::setName(const QString & newName) +void Insert::setName(const QString & newName) { data.name = newName; update(); } -Vector RS_Insert::getInsertionPoint() const +Vector Insert::getInsertionPoint() const { return data.insertionPoint; } -void RS_Insert::setInsertionPoint(const Vector & i) +void Insert::setInsertionPoint(const Vector & i) { data.insertionPoint = i; } -Vector RS_Insert::getScale() const +Vector Insert::getScale() const { return data.scaleFactor; } -void RS_Insert::setScale(const Vector & s) +void Insert::setScale(const Vector & s) { data.scaleFactor = s; } -double RS_Insert::getAngle() const +double Insert::getAngle() const { return data.angle; } -void RS_Insert::setAngle(double a) +void Insert::setAngle(double a) { data.angle = a; } -int RS_Insert::getCols() const +int Insert::getCols() const { return data.cols; } -void RS_Insert::setCols(int c) +void Insert::setCols(int c) { data.cols = c; } -int RS_Insert::getRows() const +int Insert::getRows() const { return data.rows; } -void RS_Insert::setRows(int r) +void Insert::setRows(int r) { data.rows = r; } -Vector RS_Insert::getSpacing() const +Vector Insert::getSpacing() const { return data.spacing; } -void RS_Insert::setSpacing(const Vector & s) +void Insert::setSpacing(const Vector & s) { data.spacing = s; } /** - * Is this insert visible? (re-implementation from RS_Entity) + * Is this insert visible? (re-implementation from Entity) * * @return true Only if the entity and the block and the layer it is on * are visible. @@ -325,9 +325,9 @@ void RS_Insert::setSpacing(const Vector & s) * The Block might also be NULL. In that case the block visiblity * is ignored. */ -bool RS_Insert::isVisible() +bool Insert::isVisible() { - RS_Block * blk = getBlockForInsert(); + Block * blk = getBlockForInsert(); if (blk != NULL) { @@ -337,58 +337,58 @@ bool RS_Insert::isVisible() } } - return RS_Entity::isVisible(); + return Entity::isVisible(); } -VectorSolutions RS_Insert::getRefPoints() +VectorSolutions Insert::getRefPoints() { VectorSolutions ret(data.insertionPoint); return ret; } -Vector RS_Insert::getNearestRef(const Vector & coord, double * dist) +Vector Insert::getNearestRef(const Vector & coord, double * dist) { return getRefPoints().getClosest(coord, dist); } -void RS_Insert::move(Vector offset) +void Insert::move(Vector offset) { - RS_DEBUG->print("RS_Insert::move: offset: %f/%f", + DEBUG->print("Insert::move: offset: %f/%f", offset.x, offset.y); - RS_DEBUG->print("RS_Insert::move1: insertionPoint: %f/%f", + DEBUG->print("Insert::move1: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); data.insertionPoint.move(offset); - RS_DEBUG->print("RS_Insert::move2: insertionPoint: %f/%f", + DEBUG->print("Insert::move2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::rotate(Vector center, double angle) +void Insert::rotate(Vector center, double angle) { - RS_DEBUG->print("RS_Insert::rotate1: insertionPoint: %f/%f " + DEBUG->print("Insert::rotate1: insertionPoint: %f/%f " "/ center: %f/%f", data.insertionPoint.x, data.insertionPoint.y, center.x, center.y); data.insertionPoint.rotate(center, angle); - data.angle = RS_Math::correctAngle(data.angle + angle); - RS_DEBUG->print("RS_Insert::rotate2: insertionPoint: %f/%f", + data.angle = Math::correctAngle(data.angle + angle); + DEBUG->print("Insert::rotate2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::scale(Vector center, Vector factor) +void Insert::scale(Vector center, Vector factor) { - RS_DEBUG->print("RS_Insert::scale1: insertionPoint: %f/%f", + DEBUG->print("Insert::scale1: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); data.insertionPoint.scale(center, factor); data.scaleFactor.scale(Vector(0.0, 0.0), factor); data.spacing.scale(Vector(0.0, 0.0), factor); - RS_DEBUG->print("RS_Insert::scale2: insertionPoint: %f/%f", + DEBUG->print("Insert::scale2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) +void Insert::mirror(Vector axisPoint1, Vector axisPoint2) { data.insertionPoint.mirror(axisPoint1, axisPoint2); @@ -402,7 +402,7 @@ void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) update(); } -std::ostream & operator<<(std::ostream & os, const RS_Insert & i) +std::ostream & operator<<(std::ostream & os, const Insert & i) { os << " Insert: " << i.getData() << std::endl; return os;