// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/22/2010 Added this text. :-)
+// JLH 08/19/2010 Fix rendering for new (correct) rendering path
//
#include "actiondrawlineparallel.h"
#include "rs_preview.h"
ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container,
- GraphicView & graphicView): ActionInterface("Draw Parallels",
- container, graphicView)
+ GraphicView & graphicView):
+ ActionInterface("Draw Parallels", container, graphicView),
+ parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL)
{
- parallel = NULL;
- entity = NULL;
- distance = 1.0;
- number = 1;
- coord = Vector(false);
+ graphicView.snapper.SetVisible(false);
}
ActionDrawLineParallel::~ActionDrawLineParallel()
void ActionDrawLineParallel::trigger()
{
ActionInterface::trigger();
-
RS_Creation creation(container, graphicView);
RS_Entity * e = creation.createParallel(coord, distance, number, entity);
if (!e)
RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+
+ graphicView->preview.clear();
+ graphicView->redraw();
}
void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e)
{
case SetEntity:
{
+#if 0
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
-// creation.createParallel(coord, distance, number, entity);
+ RS_Creation creation(preview, NULL, false);
+ creation.createParallel(coord, distance, number, entity);
drawPreview();
+#else
+ graphicView->preview.clear();
+ RS_Creation creation(&(graphicView->preview), NULL, false);
+ creation.createParallel(coord, distance, number, entity);
+ graphicView->redraw();
+#endif
}
- break;
+ break;
default:
break;
void ActionDrawLineParallel::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
switch (getStatus())
{
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, false);
}
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
{
finish();
graphicView->setCurrentAction(new ActionDrawLineParallelThrough(*container,
- *graphicView));
+ *graphicView));
}
else if (checkCommand("number", c))
{
- deleteSnapper();
- deletePreview();
- clearPreview();
+// deleteSnapper();
+// deletePreview();
+// clearPreview();
setStatus(SetNumber);
}
else
if (ok && d > 1.0e-10)
distance = d;
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
updateMouseButtonHints();
//setStatus(SetEntity);
}
+
break;
case SetNumber:
{
if (n > 0 && n < 100)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
-
}
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
-
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetEntity);
}
- break;
+ break;
default:
break;
void ActionDrawLineParallel::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
{
RS_DEBUG->print("toggle layer");
- if (graphic != NULL)
+ if (graphic)
{
RS_Layer * layer = graphic->getActiveLayer();
- if (layer != NULL)
+ if (layer)
{
graphic->toggleLayerLock(layer);
// deselect entities on locked layer:
if (layer->isLocked())
- for (RS_Entity * e = container->firstEntity(); e != NULL;
- e = container->nextEntity())
+ {
+ for(RS_Entity * e=container->firstEntity(); e!=NULL;
+ e=container->nextEntity())
+ {
if (e != NULL && e->isVisible() && e->getLayer() == layer)
{
- if (graphicView != NULL)
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(e);
+#endif
e->setSelected(false);
- if (graphicView != NULL)
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(e);
+#endif
}
+ }
+ }
}
}
{
if (parent->getId() == polyline->getId())
{
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
// deletes whole polyline on screen:
graphicView->deleteEntity((RS_Entity *)polyline);
+#endif
// splits up the polyline in the container:
RS_Polyline * pl1;
{
RS_DEBUG->print("ActionModifyDeleteQuick::trigger()");
- if (en != NULL)
+ if (en)
{
RS_DEBUG->print("Entity found");
RS_EntityContainer * parent = en->getParent();
- if (parent != NULL)
+ if (parent)
{
en->setSelected(false);
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
graphicView->deleteEntity(en);
+#endif
en->changeUndoState();
if (document)
// JLH 06/04/2010 Added this text. :-)
//
+/*
+Program received signal SIGSEGV, Segmentation fault.
+0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&) ()
+(gdb) bt
+#0 0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&)
+ ()
+#1 0x080cf523 in PaintInterface::drawHandle(Vector const&, RS_Color const&, int) ()
+#2 0x0822d7e0 in GraphicView::drawEntity(RS_Entity*, double, bool) ()
+#3 0x0822d9a0 in GraphicView::deleteEntity(RS_Entity*) ()
+#4 0x081334dc in ActionModifyEntity::trigger() ()
+#5 0x081336ef in ActionModifyEntity::mouseReleaseEvent(QMouseEvent*) ()
+#6 0x08089d2a in RS_EventHandler::mouseReleaseEvent(QMouseEvent*) ()
+#7 0x0822a482 in GraphicView::mouseReleaseEvent(QMouseEvent*) ()
+#8 0x081eb00a in QG_GraphicView::mouseReleaseEvent(QMouseEvent*) ()
+#9 0xb77063c1 in QWidget::event(QEvent*) () from /usr/lib/qt4/libQtGui.so.4
+#10 0xb76a6b0c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
+ from /usr/lib/qt4/libQtGui.so.4
+#11 0xb76ae24a in QApplication::notify(QObject*, QEvent*) ()
+ from /usr/lib/qt4/libQtGui.so.4
+#12 0xb7458882 in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
+ from /usr/lib/qt4/libQtCore.so.4
+#13 0xb76acfa8 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
+ from /usr/lib/qt4/libQtGui.so.4
+#14 0xb7739755 in ?? () from /usr/lib/qt4/libQtGui.so.4
+#15 0xb7738bac in QApplication::x11ProcessEvent(_XEvent*) ()
+ from /usr/lib/qt4/libQtGui.so.4
+#16 0xb7766064 in ?? () from /usr/lib/qt4/libQtGui.so.4
+#17 0xb720b654 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
+#18 0xb720f430 in ?? () from /usr/lib/libglib-2.0.so.0
+#19 0xb720f5d8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
+#20 0xb7484ed5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt4/libQtCore.so.4
+#21 0xb7765b85 in ?? () from /usr/lib/qt4/libQtGui.so.4
+#22 0xb7456de9 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt4/libQtCore.so.4
+#23 0xb745724a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
+ from /usr/lib/qt4/libQtCore.so.4
+#24 0xb745c56f in QCoreApplication::exec() () from /usr/lib/qt4/libQtCore.so.4
+#25 0xb76a6ba7 in QApplication::exec() () from /usr/lib/qt4/libQtGui.so.4
+#26 0x082325e7 in main ()
+*/
+
#include "actionmodifyentity.h"
#include "rs_debug.h"
ActionModifyEntity::ActionModifyEntity(RS_EntityContainer & container,
GraphicView & graphicView):
- ActionInterface("Modify Entity", container, graphicView)
+ ActionInterface("Modify Entity", container, graphicView), en(NULL)
{
- en = NULL;
+// en = NULL;
}
ActionModifyEntity::~ActionModifyEntity()
void ActionModifyEntity::trigger()
{
- if (en != NULL)
+ if (!en)
{
- RS_Entity * clone = en->clone();
-
- if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone))
- {
- container->addEntity(clone);
-
- graphicView->deleteEntity(en);
- en->setSelected(false);
-
- clone->setSelected(false);
- graphicView->drawEntity(clone);
-
- if (document != NULL)
- {
- document->startUndoCycle();
+ RS_DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n");
+ return;
+ }
- document->addUndoable(clone);
- en->setUndoState(true);
- document->addUndoable(en);
+ RS_Entity * clone = en->clone();
- document->endUndoCycle();
- }
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone))
+ {
+ container->addEntity(clone);
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
+ //(delete from screen...bleh)
+ graphicView->deleteEntity(en);
+#endif
+ en->setSelected(false);
+ clone->setSelected(false);
+ graphicView->drawEntity(clone);
+
+ if (document)
+ {
+ document->startUndoCycle();
+ document->addUndoable(clone);
+ en->setUndoState(true);
+ document->addUndoable(en);
+ document->endUndoCycle();
}
- else
- delete clone;
+ RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
else
- RS_DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n");
+ delete clone;
}
void ActionModifyEntity::mouseReleaseEvent(QMouseEvent * e)
{
graphicView->setMouseCursor(RS2::SelectCursor);
}
-
-
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/22/2010 Added this text. :-)
+// JLH 08/09/2010 Preparation for removal of GraphicView object from this
+// class
//
#include "actioninterface.h"
/**
* Constructor.
*
- * Sets the entity container on which the action class inherited
- * from this interface operates.
+ * Sets the entity container on which the action class inherited from this
+ * interface operates.
*
- * @param name Action name. This can be used internally for
- * debugging mainly.
+ * @param name Action name. This can be used internally for debugging mainly.
* @param container Entity container this action operates on.
- * @param graphicView Graphic view instance this action operates on.
- * Please note that an action belongs to this
- * view.
- * @param cursor Default mouse cursor for this action. If the action
- * is suspended and resumed again the cursor will always
- * be reset to the one given here.
+ * @param graphicView Graphic view instance this action operates on. Please
+ * note that an action belongs to this view.
*/
-ActionInterface::ActionInterface(const char * name, RS_EntityContainer & c,
- GraphicView & v): graphicView(&v), container(&c)
+ActionInterface::ActionInterface(const char * name, RS_EntityContainer & ec,
+ GraphicView & gv): graphicView(&gv), container(&ec)
{
RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name);
finished = false;
// Graphic provides a pointer to the graphic if the entity container is a
- //graphic (i.e. can also hold layers).
- graphic = c.getGraphic();
+ // graphic (i.e. can also hold layers).
+ graphic = ec.getGraphic();
// Document pointer will be used for undo / redo
- document = c.getDocument();
+ document = ec.getDocument();
// This is here until I can figure out a better way to contain all of this
// circular referential nonsense that exists in this codebase. It will be
// expunged, by Grabthar's Hammer!
graphicView->snapper.SetContainer(container);
graphicView->snapper.SetGraphicView(graphicView); // <-- THIS is what I mean! INSANE!
+ // Not all actions use these. Perhaps we need to pass params to the contructor
+ // in order to set these? Setting the default to true for both?
graphicView->snapper.SetVisible();
graphicView->preview.SetVisible();
/**
* Destructor.
*/
-ActionInterface::~ActionInterface()
+/*virtual*/ ActionInterface::~ActionInterface()
{
// would be pure virtual now:
// hideOptions();
{
graphicView->snapper.SetVisible(false);
graphicView->preview.SetVisible(false);
+ graphicView->preview.clear();
}
}
*/
void ActionInterface::suspend()
{
+ // Maybe this is where we need to save the state of the snapper
+ // & preview objects???
// graphicView->setMouseCursor(RS2::ArrowCursor);
// RS_Snapper::suspend();
}
return graphicView->snapper.catchEntity(v, level);
}
+#warning "!!! Dummy functions need to be deleted once all actions no longer use these !!!"
//dummy functions, will delete later...
void ActionInterface::drawSnapper(void)
{
RS_DEBUG->print("Drawing::save");
RS_DEBUG->print(" file: %s", filename.toLatin1().data());
RS_DEBUG->print(" format: %d", (int)formatType);
-
RS_DEBUG->print(" export...");
ret = RS_FILEIO->fileExport(*this, filename, formatType);
}
/**
- * Loads the given fils into this graphic.
+ * Loads the given file into this graphic.
*/
-bool Drawing::open(const QString &filename, RS2::FormatType type)
+bool Drawing::open(const QString & filename, RS2::FormatType type)
{
RS_DEBUG->print("Drawing::open(%s)", filename.toLatin1().data());
-
bool ret = false;
-
this->filename = filename;
-
// clean all:
newDoc();
-
// import file:
ret = RS_FILEIO->fileImport(*this, filename, type);
-
setModified(false);
layerList.setModified(false);
blockList.setModified(false);
//cout << *((Drawing*)graphic);
//calculateBorders();
-
RS_DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data());
return ret;
for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
- if (e->getLayer() != NULL && e->getLayer()->getName() == layer->getName())
+ if (e->getLayer() && e->getLayer()->getName() == layer->getName())
{
e->setUndoState(true);
e->setLayer("0");
{
RS_Block * blk = blockList.at(bi);
- if (blk != NULL)
+ if (blk)
{
for(RS_Entity * e=blk->firstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone))
{
setPen(QColor(r, g, b));
}
-void PaintInterface::disablePen()
+void PaintInterface::disablePen(void)
{
lpen = RS_Pen(RS2::FlagInvalid);
painter->setPen(Qt::NoPen);
painter->setBrush(color);
}
+void PaintInterface::disableBrush(void)
+{
+// lpen = RS_Pen(RS2::FlagInvalid);
+ painter->setBrush(Qt::NoBrush);
+}
+
void PaintInterface::drawPolygon(const QPolygon & a)
{
painter->drawPolygon(a);
}
-void PaintInterface::setXORMode()
+void PaintInterface::setXORMode(void)
{
painter->setCompositionMode(QPainter::CompositionMode_Xor);
}
-void PaintInterface::setNormalMode()
+void PaintInterface::setNormalMode(void)
{
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
}
void setPen(int r, int g, int b);
void disablePen();
void setBrush(const RS_Color & color);
+ void disableBrush();
void drawPolygon(const QPolygon & p);
void erase();
int getWidth();
//for (uint i=0; i<container->count(); ++i) {
//RS_Entity* e = container->entityAt(i);
- if (e != NULL && e->isSelected())
+ if (e && e->isSelected())
{
// delete / redraw entity in graphic view:
if (remove)
{
- if (graphicView != NULL)
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(e);
+#endif
e->setSelected(false);
}
else
{
- if (graphicView != NULL)
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(e);
-
+#endif
e->setSelected(false);
- if (graphicView != NULL)
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(e);
+#endif
}
// add entity to block:
//i=0;
e->changeUndoState();
- if (document != NULL)
+ if (document)
document->addUndoable(e);
}
}
}
*/
- if (filter != NULL)
+ if (filter)
return filter->fileImport(graphic, file, t);
else
{
RS_DEBUG->print("RS_FilterDXF::fileImport: reading file: OK");
//graphic->setAutoUpdateBorders(true);
- if (success == false)
+ if (!success)
{
RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open DXF file '%s'.",
(const char *)QFile::encodeName(file));
*/
RS_Block * RS_Insert::getBlockForInsert()
{
- if (block != NULL)
+ if (block)
return block;
RS_BlockList * blkList;
- if (data.blockSource == NULL)
+ if (!data.blockSource)
{
- if (getGraphic() != NULL)
- {
- blkList = getGraphic()->getBlockList();
- }
- else
- {
- blkList = NULL;
- }
+ blkList = (getGraphic() ? getGraphic()->getBlockList() : NULL);
}
else
{
RS_Block * blk = NULL;
- if (blkList != NULL)
- {
+ if (blkList)
blk = blkList->find(data.name);
- }
- if (blk != NULL)
+/*???
+ if (blk)
{
}
+*/
block = blk;
RS_DEBUG->print("RS_Insert::update: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
- if (updateEnabled == false)
+ if (!updateEnabled)
return;
clear();
-
RS_Block * blk = getBlockForInsert();
- if (blk == NULL)
+ if (!blk)
{
- //return NULL;
RS_DEBUG->print("RS_Insert::update: Block is NULL");
return;
}
RS_DEBUG->print("RS_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));
+ ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c, data.spacing.y / data.scaleFactor.y * r));
}
else
{
* @param ref Reference point. The entities will be moved by -ref.
* @param cut true: cut instead of copying, false: copy
*/
-void RS_Modification::copyEntity(RS_Entity* e, const Vector& ref,
- const bool cut) {
-
- if (e!=NULL && e->isSelected()) {
- // delete entity in graphic view:
- if (cut) {
- if (graphicView!=NULL) {
- graphicView->deleteEntity(e);
- }
- e->setSelected(false);
- } else {
- if (graphicView!=NULL) {
- graphicView->deleteEntity(e);
- }
- e->setSelected(false);
- if (graphicView!=NULL) {
- graphicView->drawEntity(e);
- }
- }
+void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool cut)
+{
+ if (e && e->isSelected())
+ {
+ // delete entity in graphic view:
+ if (cut)
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(e);
+#endif
- // add entity to clipboard:
- RS_Entity* c = e->clone();
- c->move(-ref);
- RS_CLIPBOARD->addEntity(c);
+ e->setSelected(false);
+ }
+ else
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(e);
+#endif
- copyLayers(e);
- copyBlocks(e);
+ e->setSelected(false);
- // set layer to the layer clone:
- RS_Layer* l = e->getLayer();
- if (l!=NULL) {
- c->setLayer(l->getName());
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->drawEntity(e);
+#endif
+ }
- // make sure all sub entities point to layers of the clipboard
- if (c->isContainer()) {
- RS_EntityContainer* ec = (RS_EntityContainer*)c;
+ // add entity to clipboard:
+ RS_Entity * c = e->clone();
+ c->move(-ref);
+ RS_CLIPBOARD->addEntity(c);
- for (RS_Entity* e2 = ec->firstEntity(RS2::ResolveAll); e2!=NULL;
- e2 = ec->nextEntity(RS2::ResolveAll)) {
+ copyLayers(e);
+ copyBlocks(e);
- //RS_Entity* e2 = ec->entityAt(i);
- RS_Layer* l2 = e2->getLayer();
+ // set layer to the layer clone:
+ RS_Layer * l = e->getLayer();
- if (l2!=NULL) {
- e2->setLayer(l2->getName());
- }
- }
- }
+ if (l)
+ c->setLayer(l->getName());
- if (cut) {
- e->changeUndoState();
- if (document!=NULL) {
- document->addUndoable(e);
- }
- }
- }
+ // make sure all sub entities point to layers of the clipboard
+ if (c->isContainer())
+ {
+ RS_EntityContainer * ec = (RS_EntityContainer *)c;
+
+ for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
+ e2=ec->nextEntity(RS2::ResolveAll))
+ {
+ //RS_Entity* e2 = ec->entityAt(i);
+ RS_Layer * l2 = e2->getLayer();
+ if (l2)
+ e2->setLayer(l2->getName());
+ }
+ }
+
+ if (cut)
+ {
+ e->changeUndoState();
+
+ if (document)
+ document->addUndoable(e);
+ }
+ }
}
}
}
- if (sol.hasValid()==false) {
- return false;
- }
+ if (!sol.hasValid())
+ return false;
- RS_AtomicEntity* trimmed1 = NULL;
- RS_AtomicEntity* trimmed2 = NULL;
+ RS_AtomicEntity * trimmed1 = NULL;
+ RS_AtomicEntity * trimmed2 = NULL;
- // remove trim entity from view:
- if (trimEntity->rtti()==RS2::EntityCircle) {
- // convert a circle into a trimmable arc
- RS_Circle* c = (RS_Circle*)trimEntity;
- double am = c->getCenter().angleTo(trimCoord);
- RS_ArcData d(c->getCenter(),
- c->getRadius(),
- RS_Math::correctAngle(am-M_PI/2),
- RS_Math::correctAngle(am+M_PI/2), false);
- trimmed1 = new RS_Arc(trimEntity->getParent(), d);
- } else {
- trimmed1 = (RS_AtomicEntity*)trimEntity->clone();
- trimmed1->setHighlighted(false);
- }
- if (graphicView!=NULL) {
- graphicView->deleteEntity(trimEntity);
- }
+ // remove trim entity from view:
+ if (trimEntity->rtti() == RS2::EntityCircle)
+ {
+ // convert a circle into a trimmable arc
+ RS_Circle * c = (RS_Circle *)trimEntity;
+ double am = c->getCenter().angleTo(trimCoord);
+ RS_ArcData d(c->getCenter(), c->getRadius(),
+ RS_Math::correctAngle(am - M_PI / 2),
+ RS_Math::correctAngle(am + M_PI / 2), false);
+ trimmed1 = new RS_Arc(trimEntity->getParent(), d);
+ }
+ else
+ {
+ trimmed1 = (RS_AtomicEntity *)trimEntity->clone();
+ trimmed1->setHighlighted(false);
+ }
- // remove limit entity from view:
- if (both) {
- trimmed2 = (RS_AtomicEntity*)limitEntity->clone();
- trimmed2->setHighlighted(false);
- if (graphicView!=NULL) {
- graphicView->deleteEntity(limitEntity);
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(trimEntity);
+#endif
+
+ // remove limit entity from view:
+ if (both)
+ {
+ trimmed2 = (RS_AtomicEntity *)limitEntity->clone();
+ trimmed2->setHighlighted(false);
+
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(limitEntity);
+#endif
+ }
// trim trim entity
int ind = 0;
* @param trimEntity Entity which will be trimmed.
* @param dist Amount to trim by.
*/
-bool RS_Modification::trimAmount(const Vector& trimCoord,
- RS_AtomicEntity* trimEntity,
- double dist) {
+bool RS_Modification::trimAmount(const Vector & trimCoord,
+ RS_AtomicEntity * trimEntity, double dist)
+{
+ if (!trimEntity)
+ {
+ RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Modification::trimAmount: Entity is NULL");
+ return false;
+ }
- if (trimEntity==NULL) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_Modification::trimAmount: Entity is NULL");
- return false;
- }
+ RS_AtomicEntity * trimmed = NULL;
- RS_AtomicEntity* trimmed = NULL;
+ // remove trim entity:
+ trimmed = (RS_AtomicEntity*)trimEntity->clone();
- // remove trim entity:
- trimmed = (RS_AtomicEntity*)trimEntity->clone();
- if (graphicView!=NULL) {
- graphicView->deleteEntity(trimEntity);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(trimEntity);
+#endif
- // trim trim entity
- Vector is = trimmed->getNearestDist(-dist, trimCoord);
- if (trimCoord.distanceTo(trimmed->getStartpoint()) <
- trimCoord.distanceTo(trimmed->getEndpoint())) {
- trimmed->trimStartpoint(is);
- } else {
- trimmed->trimEndpoint(is);
- }
+ // trim trim entity
+ Vector is = trimmed->getNearestDist(-dist, trimCoord);
+ if (trimCoord.distanceTo(trimmed->getStartpoint()) <
+ trimCoord.distanceTo(trimmed->getEndpoint()))
+ {
+ trimmed->trimStartpoint(is);
+ }
+ else
+ {
+ trimmed->trimEndpoint(is);
+ }
- // add new trimmed trim entity:
- container->addEntity(trimmed);
+ // add new trimmed trim entity:
+ container->addEntity(trimmed);
- if (graphicView!=NULL) {
- graphicView->drawEntity(trimmed);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->drawEntity(trimmed);
+#endif
- if (document!=NULL && handleUndo) {
- document->startUndoCycle();
- document->addUndoable(trimmed);
- trimEntity->setUndoState(true);
- document->addUndoable(trimEntity);
- document->endUndoCycle();
- }
+ if (document && handleUndo)
+ {
+ document->startUndoCycle();
+ document->addUndoable(trimmed);
+ trimEntity->setUndoState(true);
+ document->addUndoable(trimEntity);
+ document->endUndoCycle();
+ }
- return true;
+ return true;
}
return false;
}
- // delete cut entity on the screen:
- if (graphicView!=NULL) {
- graphicView->deleteEntity(cutEntity);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // delete cut entity on the screen:
+ if (graphicView)
+ graphicView->deleteEntity(cutEntity);
+#endif
- RS_AtomicEntity* cut1 = NULL;
- RS_AtomicEntity* cut2 = NULL;
+ RS_AtomicEntity * cut1 = NULL;
+ RS_AtomicEntity * cut2 = NULL;
// create new two halves:
- if (cutEntity->rtti()==RS2::EntityCircle) {
- RS_Circle* c = (RS_Circle*)cutEntity;
+ if (cutEntity->rtti() == RS2::EntityCircle)
+ {
+ RS_Circle * c = (RS_Circle *)cutEntity;
cut1 = new RS_Arc(cutEntity->getParent(),
RS_ArcData(c->getCenter(),
c->getRadius(),
cut1->trimEndpoint(cutCoord);
cut1->trimStartpoint(cutCoord);
- } else {
+ }
+ else
+ {
cut1 = (RS_AtomicEntity*)cutEntity->clone();
cut2 = (RS_AtomicEntity*)cutEntity->clone();
trimmed2 = (RS_AtomicEntity*)entity2->clone();
}
- // remove trim entity (on screen):
- if (data.trim==true || isPolyline) {
- if (graphicView!=NULL) {
- if (isPolyline) {
- graphicView->deleteEntity(baseContainer);
- } else {
- graphicView->deleteEntity(entity1);
- graphicView->deleteEntity(entity2);
- }
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // remove trim entity (on screen):
+ if (data.trim || isPolyline)
+ {
+ if (graphicView)
+ {
+ if (isPolyline)
+ {
+ graphicView->deleteEntity(baseContainer);
+ }
+ else
+ {
+ graphicView->deleteEntity(entity1);
+ graphicView->deleteEntity(entity2);
+ }
+ }
+ }
+#endif
// trim entities to intersection
RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 01");
trimmed2 = (RS_AtomicEntity*)entity2->clone();
}
- // remove trim entity:
- if (graphicView!=NULL) {
- if (isPolyline) {
- graphicView->deleteEntity(baseContainer);
- } else {
- graphicView->deleteEntity(entity1);
- graphicView->deleteEntity(entity2);
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // remove trim entity:
+ if (graphicView!=NULL)
+ {
+ if (isPolyline)
+ {
+ graphicView->deleteEntity(baseContainer);
+ }
+ else
+ {
+ graphicView->deleteEntity(entity1);
+ graphicView->deleteEntity(entity2);
+ }
+ }
+#endif
// trim entities to intersection
Vector is2 = sol2.getClosest(coord2);
//for (uint i=0; i<container->count(); ++i) {
//RS_Entity* e = container->entityAt(i);
- if (e!=NULL && e->isVisible()) {
-
+ if (e!=NULL && e->isVisible())
+ {
inters = false;
// select containers / groups:
- if (e->isContainer()) {
- RS_EntityContainer* ec = (RS_EntityContainer*)e;
-
- for (RS_Entity* e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
- e2=ec->nextEntity(RS2::ResolveAll)) {
+ if (e->isContainer())
+ {
+ RS_EntityContainer * ec = (RS_EntityContainer *)e;
- VectorSolutions sol =
- RS_Information::getIntersection(&line, e2, true);
+ for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
+ e2=ec->nextEntity(RS2::ResolveAll))
+ {
+ VectorSolutions sol = RS_Information::getIntersection(&line, e2, true);
- if (sol.hasValid()) {
+ if (sol.hasValid())
inters = true;
- }
}
- } else {
-
- VectorSolutions sol =
- RS_Information::getIntersection(&line, e, true);
+ }
+ else
+ {
+ VectorSolutions sol = RS_Information::getIntersection(&line, e, true);
- if (sol.hasValid()) {
+ if (sol.hasValid())
inters = true;
- }
}
- if (inters) {
- if (graphicView!=NULL) {
+ if (inters)
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(e);
- }
+#endif
e->setSelected(select);
- if (graphicView!=NULL) {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(e);
- }
+#endif
}
}
}
*/
void RS_Selection::selectContour(RS_Entity * e)
{
- if (e == NULL || !e->isAtomic())
+ if (!e || !e->isAtomic())
return;
bool select = !e->isSelected();
- RS_AtomicEntity* ae = (RS_AtomicEntity*)e;
+ RS_AtomicEntity * ae = (RS_AtomicEntity *)e;
Vector p1 = ae->getStartpoint();
Vector p2 = ae->getEndpoint();
bool found = false;
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
// (de)select 1st entity:
- if (graphicView!=NULL) {
+ if (graphicView)
graphicView->deleteEntity(e);
- }
+#endif
+
e->setSelected(select);
- if (graphicView!=NULL) {
+
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(e);
- }
+#endif
- do {
+ do
+ {
found = false;
- for (RS_Entity* en=container->firstEntity(); en!=NULL;
- en=container->nextEntity()) {
+ for(RS_Entity * en=container->firstEntity(); en!=NULL;
+ en=container->nextEntity())
+ {
//for (uint i=0; i<container->count(); ++i) {
//RS_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;
+ (en->getLayer()==NULL || en->getLayer()->isLocked()==false))
+ {
+ ae = (RS_AtomicEntity *)en;
bool doit = false;
// startpoint connects to 1st point
p2 = ae->getStartpoint();
}
- if (doit) {
- if (graphicView!=NULL) {
+ if (doit)
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(ae);
- }
+#endif
+
ae->setSelected(select);
- if (graphicView!=NULL) {
+
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(ae);
- }
+#endif
+
found = true;
}
}
if (l != NULL && l->getName() == layerName)
{
- if (graphicView != NULL)
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->deleteEntity(en);
+#endif
en->setSelected(select);
- if (graphicView != NULL)
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
graphicView->drawEntity(en);
+#endif
}
}
}
* container
* @return Pointer to the entity or NULL.
*/
-RS_Entity * RS_Snapper::catchEntity(const Vector& pos, RS2::ResolveLevel level)
+RS_Entity * RS_Snapper::catchEntity(const Vector & pos, RS2::ResolveLevel level)
{
RS_DEBUG->print("RS_Snapper::catchEntity");
return visible;
}
+/*
+We need to figure out how to kick the GraphicView out of this class. Perhaps we
+need to move the toGuiX/Y() functions into another class as static functions.
+Further inspection seems to rule this out as they are pretty well coupled to the
+GraphicView class... What to do?
+*/
void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
{
- if (finished || !snapSpot.valid)
+ if (finished || !snapSpot.valid || !snapCoord.valid)
return;
//hm, I don't like graphicView kicking around in here, especially since it now
//lives inside GraphicView... How to !!! FIX !!!?
//We'll pass it in for now...
- if (snapCoord.valid)
+// if (snapCoord.valid)
+// {
+ // Snap point (need to make sure the brush is NULL!)
+// painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
+ painter->setPen(RS_Pen(RS_Color(255, 127, 0), RS2::Width00, RS2::DashLine));
+ painter->drawCircle(view->toGui(snapCoord), 4);
+
+ // Crosshairs
+ if (showCrosshairs)
{
- // snap point
- painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
- painter->drawCircle(view->toGui(snapCoord), 4);
-
- // crosshairs
- if (showCrosshairs)
- {
- painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
- painter->drawLine(Vector(0, view->toGuiY(snapCoord.y)),
- Vector(view->getWidth(), view->toGuiY(snapCoord.y)));
- painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
- Vector(view->toGuiX(snapCoord.x), view->getHeight()));
- }
+ painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
+ painter->drawLine(Vector(0, view->toGuiY(snapCoord.y)),
+ Vector(view->getWidth(), view->toGuiY(snapCoord.y)));
+ painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
+ Vector(view->toGuiX(snapCoord.x), view->getHeight()));
}
+// }
- if (snapCoord.valid && snapCoord != snapSpot)
+ if (/*snapCoord.valid &&*/ snapCoord != snapSpot)
{
painter->drawLine(view->toGui(snapSpot) + Vector(-5, 0),
view->toGui(snapSpot) + Vector(-1, 4));
{
if (container)
{
- Drawing * g = container->getGraphic();
+ Drawing * d = container->getGraphic();
- if (g)
- return g->isGridOn();
+ if (d)
+ return d->isGridOn();
}
return true;
//RS_DEBUG->print("GraphicView::drawEntity() end");
}
-/**
- * Deletes an entity with the background color.
- * Might be recusively called e.g. for polylines.
- */
-void GraphicView::deleteEntity(RS_Entity * e)
-{
-#warning "!!! This is part of obsolete rendering !!!"
- setDeleteMode(true);
- drawEntity(e);
- setDeleteMode(false);
-}
-
/**
* Draws an entity.
* The painter must be initialized and all the attributes (pen) must be set.
*/
void GraphicView::simulateEntity(RS_Entity * e, const RS_Pen & pen)
{
- if (painter == NULL || e == NULL)
+ if (!painter || !e)
return;
if (e->isContainer())
{
RS_EntityContainer * ec = (RS_EntityContainer *)e;
- for(RS_Entity* en=ec->firstEntity(RS2::ResolveNone);
- en!=NULL; en = ec->nextEntity(RS2::ResolveNone))
+ for(RS_Entity * en=ec->firstEntity(RS2::ResolveNone);
+ en!=NULL; en=ec->nextEntity(RS2::ResolveNone))
{
if (en->isVisible() && en->isUndone() == false)
{
//Using Qt::red doesn't seem to work here...
RS_Pen p(RS_Color(255, 0, 0), RS2::Width00, RS2::SolidLine);
painter->setPen(p);
- painter->setXORMode();
+//This doesn't work--this is NOT a QPainter!
+// painter->setBrush(Qt::NoBrush);
+// painter->setBackgroundMode(Qt::TransparentMode); // will that do it???
+ painter->disableBrush();
+// painter->setXORMode();
int zr = 5;
painter->drawLine(Vector(toGuiX(relativeZero.x) - zr, toGuiY(relativeZero.y)),
Vector(toGuiX(relativeZero.x) + zr, toGuiY(relativeZero.y)));
-
painter->drawLine(Vector(toGuiX(relativeZero.x), toGuiY(relativeZero.y) - zr),
Vector(toGuiX(relativeZero.x), toGuiY(relativeZero.y) + zr));
-
painter->drawCircle(toGui(relativeZero), zr);
- painter->setNormalMode();
+// painter->setNormalMode();
}
/**
* @param visible Pointer to a boolean which will contain true
* after the call if the coordinate is within the visible range.
*/
-double GraphicView::toGuiX(double x, bool * visible)
+double GraphicView::toGuiX(double x, bool * visible/*= NULL*/)
{
if (visible != NULL)
{
virtual void drawWindow(Vector v1, Vector v2);
virtual void drawIt();
- virtual void deleteEntity(RS_Entity * e);
virtual void drawEntity(RS_Entity * e, double patternOffset = 0.0, bool db = false);
virtual void drawEntityPlain(RS_Entity * e, double patternOffset = 0.0);
virtual void setPenForEntity(RS_Entity * e);
RS2::SnapRestriction getSnapRestriction();
bool isGridOn();
+/*
+What to do about this shiatsu? This stuff is used in the snapper rendering
+code... Maybe move all the snapper rendering back into this class???
+Seems to make sense, though it kinda blows encapsulation. But it's already
+blown by the snapper class having to use these functions in the first place!
+
+How to fix???
+
+The snapper as a separate class makes sense, since it has several functions
+for finding various snapping points. But what about rendering???
+
+Having this class derive from that one *might* make sense... *Maybe*. Not sure.
+
+*/
Vector toGui(Vector v);
double toGuiX(double x, bool * visible = NULL);
double toGuiY(double y);
protected:
RS_EntityContainer * container;
RS_EventHandler * eventHandler;
-
- int mx; //!< Last known mouse cursor position
- int my; //!< Last known mouse cursor position
-
+ int mx; //!< Last known mouse cursor position
+ int my; //!< Last known mouse cursor position
PaintInterface * painter;
- /** background color (any color) */
- RS_Color background;
- /** foreground color (black or white) */
- RS_Color foreground;
- /** grid color */
- RS_Color gridColor;
- /** meta grid color */
- RS_Color metaGridColor;
- /** selected color */
- RS_Color selectedColor;
- /** highlighted color */
- RS_Color highlightedColor;
- /** Grid */
- RS_Grid * grid;
+ RS_Color background; //! background color (any color)
+ RS_Color foreground; //! foreground color (black or white)
+ RS_Color gridColor; //! grid color
+ RS_Color metaGridColor; //! meta grid color
+ RS_Color selectedColor; //! selected color
+ RS_Color highlightedColor; //! highlighted color
+ RS_Grid * grid; //! Grid
/**
- * Current default snap mode for this graphic view. Used for new
- * actions.
- */
+ * Current default snap mode for this graphic view. Used for new
+ * actions.
+ */
RS2::SnapMode defaultSnapMode;
/**
- * Current default snap restriction for this graphic view. Used for new
- * actions.
- */
+ * Current default snap restriction for this graphic view. Used for new
+ * actions.
+ */
RS2::SnapRestriction defaultSnapRes;
-
RS2::DrawingMode drawingMode;
/**
- * Delete mode. If true, all drawing actions will delete in background color
- * instead.
- */
+ * Delete mode. If true, all drawing actions will delete in background color
+ * instead.
+ */
bool deleteMode;
- //! If true, the simulation is currectly running
- bool simulationRunning;
+ bool simulationRunning; //! If true, the simulation is currectly running
private:
int updateEnabled;
bool zoomFrozen;
bool draftMode;
-
Vector factor;
int offsetX;
int offsetY;
-
Vector previousFactor;
int previousOffsetX;
int previousOffsetY;
-
int borderLeft;
int borderTop;
int borderRight;
int borderBottom;
-
Vector relativeZero;
bool relativeZeroLocked;
- //! Print preview flag
- bool printPreview;
- //! Active when printing only:
- bool printing;
-
- //! Simulation speed in percentage
- int simulationSpeed;
- //! If true, the entity is drawn slowly (pixel by pixel).
- bool simulationSmooth;
- //! If true, the way between entities is also shown.
- bool simulationRapid;
- //! Last position (for rapid move)
- Vector simulationLast;
+ bool printPreview; //! Print preview flag
+ bool printing; //! Active when printing only:
+ int simulationSpeed; //! Simulation speed in percentage
+ bool simulationSmooth; //! If true, the entity is drawn slowly (pixel by pixel).
+ bool simulationRapid; //! If true, the way between entities is also shown.
+ Vector simulationLast; //! Last position (for rapid move)
public://for now
// We use this here instead of deriving ActionInterface from it because
protected:
int lastWidth;
int lastHeight;
- //! Horizontal scrollbar.
- QScrollBar * hScrollBar;
- //! Vertical scrollbar.
- QScrollBar * vScrollBar;
- //! Label for grid spacing.
- QLabel * gridStatus;
- //! CAD mouse cursor
- QCursor * curCad;
- //! Delete mouse cursor
- QCursor * curDel;
- //! Select mouse cursor
- QCursor * curSelect;
- //! Magnifying glass mouse cursor
- QCursor * curMagnifier;
- //! Hand mouse cursor
- QCursor * curHand;
+ QScrollBar * hScrollBar; //! Horizontal scrollbar.
+ QScrollBar * vScrollBar; //! Vertical scrollbar.
+ QLabel * gridStatus; //! Label for grid spacing.
+ QCursor * curCad; //! CAD mouse cursor
+ QCursor * curDel; //! Delete mouse cursor
+ QCursor * curSelect; //! Select mouse cursor
+ QCursor * curMagnifier; //! Magnifying glass mouse cursor
+ QCursor * curHand; //! Hand mouse cursor
//QC was merged with QG
};
LayerWidget::~LayerWidget()
{
delete listBox;
- //delete pxmVisible;
- //delete pxmHidden;
}
/**
RS_Layer * activeLayer = NULL;
- if (layerList != NULL)
+ if (layerList)
activeLayer = layerList->getActive();
RS_DEBUG->print("LayerWidget::update() clearing listBox");
-
listBox->clear();
- if (layerList == NULL)
+ if (!layerList)
{
RS_DEBUG->print("LayerWidget::update() abort");
return;
RS_Layer * layer = layerList->at(i);
// hide layer "ByBlock"?
- if (showByBlock || layer->getName()!="ByBlock")
+ if (showByBlock || layer->getName() != "ByBlock")
{
QPixmap * pm = NULL;
if (!layer->isFrozen())
- {
- if (!layer->isLocked())
- {
- pm = &pxmLayerStatus10;
- }
- else
- {
- pm = &pxmLayerStatus11;
- }
- }
+ pm = (!layer->isLocked() ? &pxmLayerStatus10 : &pxmLayerStatus11);
else
- {
- if (!layer->isLocked())
- {
- pm = &pxmLayerStatus00;
- }
- else
- {
- pm = &pxmLayerStatus01;
- }
- }
-
- if (pm != NULL)
- {
-// listBox->insertItem(*pm, layer->getName());
- listBox->addItem(new QListWidgetItem(*pm, layer->getName()));
- }
+ pm = (!layer->isLocked() ? &pxmLayerStatus00 : &pxmLayerStatus01);
+
+// listBox->insertItem(*pm, layer->getName());
+ listBox->addItem(new QListWidgetItem(*pm, layer->getName()));
}
}
RS_DEBUG->print("LayerWidget::update() sorting");
-
// listBox->sort();
listBox->sortItems(Qt::AscendingOrder);
-
RS_DEBUG->print("LayerWidget::update() reactivating current layer");
RS_Layer * l = lastLayer;
lastLayer = l;
#warning "!!!"
// listBox->setContentsPos(0, yPos);
-
RS_DEBUG->print("LayerWidget::update() end");
}
{
RS_DEBUG->print("LayerWidget::highlightLayer() begin");
- if (layer == NULL || layerList == NULL)
+ if (!layer || !layerList)
{
RS_DEBUG->print("LayerWidget::highlightLayer() abort");
return;
QString name = layer->getName();
highlightLayer(name);
-
RS_DEBUG->print("LayerWidget::highlightLayer() end");
}
{
RS_DEBUG->print("LayerWidget::highlightLayer(name) begin");
- if (layerList == NULL)
+ if (!layerList)
{
RS_DEBUG->print("LayerWidget::highlightLayer(name) abort");
return;
RS_DEBUG->print("LayerWidget::highlightLayer(name) end");
}
-/*virtual*/ void LayerWidget::layerActivated(RS_Layer * layer)
+void LayerWidget::layerActivated(RS_Layer * layer)
{
highlightLayer(layer);
}
-/*virtual*/ void LayerWidget::layerAdded(RS_Layer * layer)
+void LayerWidget::layerAdded(RS_Layer * layer)
{
update();
highlightLayer(layer);
}
-/*virtual*/ void LayerWidget::layerEdited(RS_Layer *)
+void LayerWidget::layerEdited(RS_Layer *)
{
update();
}
-/*virtual*/ void LayerWidget::layerRemoved(RS_Layer *)
+void LayerWidget::layerRemoved(RS_Layer *)
{
update();
highlightLayer(layerList->at(0));
}
-/*virtual*/ void LayerWidget::layerToggled(RS_Layer *)
+void LayerWidget::layerToggled(RS_Layer *)
{
update();
}
QString layerName = listBox->currentItem()->text();
RS_DEBUG->print("LayerWidget::slotActivated(): %s", layerName.toLatin1().data());
- if (layerList == NULL)
+ if (!layerList)
return;
lastLayer = layerList->getActive();
// only change state / no activation
RS_Layer * l = lastLayer;
+#warning "!!! Bad implementation of lock/freeze functionality !!!"
if (p.x() < 23)
{
actionHandler->slotLayersToggleView();
}
else
{
- if (item != NULL && layerList != NULL)
+ if (item && layerList)
lastLayer = layerList->find(item->text());
}
}
break;
}
}
-
void highlightLayer(RS_Layer *);
void highlightLayer(const QString &);
- virtual void layerActivated(RS_Layer *);
- virtual void layerAdded(RS_Layer *);
- virtual void layerEdited(RS_Layer *);
- virtual void layerRemoved(RS_Layer *);
- virtual void layerToggled(RS_Layer *);
+ void layerActivated(RS_Layer *);
+ void layerAdded(RS_Layer *);
+ void layerEdited(RS_Layer *);
+ void layerRemoved(RS_Layer *);
+ void layerToggled(RS_Layer *);
signals:
void escape();