X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fdrawing.cpp;h=283586a076e4820f2557efef5f85b4541650c716;hb=bd2b29c8735d83ab48df13c3efee53f63570473e;hp=dbdc1e2f8716e4c7abb3e2382f0087fd462b3172;hpb=89e127aa3dbd74d3158e6dbe0ca1703420c04395;p=architektonas diff --git a/src/base/drawing.cpp b/src/base/drawing.cpp index dbdc1e2..283586a 100644 --- a/src/base/drawing.cpp +++ b/src/base/drawing.cpp @@ -3,7 +3,9 @@ // 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 // @@ -131,7 +133,6 @@ bool Drawing::save() 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); @@ -161,29 +162,23 @@ bool Drawing::saveAs(const QString & filename, RS2::FormatType type) } /** - * 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; @@ -237,7 +232,7 @@ RS_Layer * Drawing::getActiveLayer() 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"); @@ -252,7 +247,7 @@ RS_Layer * Drawing::getActiveLayer() { 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)) { @@ -300,6 +295,7 @@ void Drawing::freezeAllLayers(bool freeze) layerList.freezeAll(freeze); } +#if 0 void Drawing::addLayerListListener(RS_LayerListListener * listener) { layerList.addListener(listener); @@ -309,6 +305,7 @@ void Drawing::removeLayerListListener(RS_LayerListListener * listener) { layerList.removeListener(listener); } +#endif // Wrapper for block functions: @@ -382,6 +379,7 @@ void Drawing::freezeAllBlocks(bool freeze) blockList.freezeAll(freeze); } +#if 0 void Drawing::addBlockListListener(RS_BlockListListener * listener) { blockList.addListener(listener); @@ -391,6 +389,7 @@ void Drawing::removeBlockListListener(RS_BlockListListener * listener) { blockList.removeListener(listener); } +#endif // Wrappers for variable functions: void Drawing::clearVariables() @@ -460,6 +459,7 @@ QMultiHash & Drawing::getVariableDict() bool Drawing::isGridOn() { int on = getVariableInt("$GRIDMODE", 1); + return (on != 0); } @@ -477,9 +477,7 @@ void Drawing::setGridOn(bool on) void Drawing::setUnit(RS2::Unit u) { setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u)); - addVariable("$INSUNITS", (int)u, 70); - //unit = u; } @@ -604,7 +602,6 @@ void Drawing::setPaperInsertionBase(const Vector & p) Vector Drawing::getPaperSize() { Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit()); - Vector v1 = getVariableVector("$PLIMMIN", Vector(0.0, 0.0)); Vector v2 = getVariableVector("$PLIMMAX", def); @@ -751,8 +748,8 @@ std::ostream & operator<<(std::ostream & os, Drawing & g) os << "--- Drawing: \n"; os << "---" << *g.getLayerList() << "\n"; os << "---" << *g.getBlockList() << "\n"; - os << "---" << (RS_Undo&)g << "\n"; - os << "---" << (RS_EntityContainer&)g << "\n"; + os << "---" << (RS_Undo &)g << "\n"; + os << "---" << (RS_EntityContainer &)g << "\n"; return os; }