From 89e127aa3dbd74d3158e6dbe0ca1703420c04395 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 3 Jun 2010 13:16:49 +0000 Subject: [PATCH] Changed RS_Graphic to Drawing; this is less confusing as a drawing is what the class is and not a bitmap (which is what is implied). --- architektonas.pro | 5 +- src/actions/rs_actionblocksadd.cpp | 2 +- src/actions/rs_actionblocksattributes.cpp | 2 +- src/actions/rs_actionblocksedit.cpp | 2 +- src/actions/rs_actionblocksfreezeall.cpp | 2 +- src/actions/rs_actionblocksremove.cpp | 2 +- src/actions/rs_actionblockstoggleview.cpp | 2 +- src/actions/rs_actionfilenew.cpp | 2 +- src/actions/rs_actionfileopen.cpp | 2 +- src/actions/rs_actionfilesave.cpp | 2 +- src/actions/rs_actionfilesaveas.cpp | 2 +- src/actions/rs_actionlayersadd.cpp | 2 +- src/actions/rs_actionlayersedit.cpp | 2 +- src/actions/rs_actionlayersfreezeall.cpp | 2 +- src/actions/rs_actionlayersremove.cpp | 2 +- src/actions/rs_actionlayerstogglelock.cpp | 2 +- src/actions/rs_actionlayerstoggleview.cpp | 2 +- src/actions/rs_actionlibraryinsert.h | 2 +- src/base/{rs_graphic.cpp => drawing.cpp} | 177 +++---- src/base/{rs_graphic.h => drawing.h} | 8 +- src/base/rs_actioninterface.h | 4 +- src/base/rs_block.cpp | 12 +- src/base/rs_clipboard.h | 6 +- src/base/rs_commandevent.h | 38 +- src/base/rs_constructionline.cpp | 42 ++ src/base/rs_constructionline.h | 162 +++--- src/base/rs_creation.cpp | 6 +- src/base/rs_creation.h | 2 +- src/base/rs_dialogfactory.h | 1 - src/base/rs_dialogfactoryadapter.h | 4 +- src/base/rs_dialogfactoryinterface.h | 6 +- src/base/rs_dimaligned.cpp | 4 +- src/base/rs_dimangular.cpp | 2 +- src/base/rs_dimdiametric.cpp | 4 +- src/base/rs_dimension.cpp | 260 +++++----- src/base/rs_dimlinear.cpp | 9 +- src/base/rs_dimradial.cpp | 4 +- src/base/rs_ellipse.cpp | 2 +- src/base/rs_entity.cpp | 28 +- src/base/rs_entity.h | 4 +- src/base/rs_eventhandler.cpp | 154 +++--- src/base/rs_fileio.cpp | 6 +- src/base/rs_fileio.h | 6 +- src/base/rs_filtercxf.cpp | 4 +- src/base/rs_filtercxf.h | 4 +- src/base/rs_filterdxf.cpp | 12 +- src/base/rs_filterdxf.h | 6 +- src/base/rs_filterdxf1.cpp | 2 +- src/base/rs_filterdxf1.h | 6 +- src/base/rs_filterinterface.h | 8 +- src/base/rs_font.h | 2 +- src/base/rs_graphicview.cpp | 18 +- src/base/rs_graphicview.h | 2 +- src/base/rs_grid.cpp | 4 +- src/base/rs_hatch.cpp | 2 +- src/base/rs_infoarea.cpp | 38 +- src/base/rs_infoarea.h | 26 - src/base/rs_information.cpp | 71 ++- src/base/rs_information.h | 26 - src/base/rs_insert.cpp | 172 +++---- src/base/rs_insert.h | 28 +- src/base/rs_layer.cpp | 39 +- src/base/rs_layer.h | 26 - src/base/rs_layerlist.cpp | 38 +- src/base/rs_layerlist.h | 26 - src/base/rs_layerlistlistener.h | 26 - src/base/rs_leader.cpp | 38 +- src/base/rs_leader.h | 26 - src/base/rs_line.cpp | 15 +- src/base/rs_line.h | 26 - src/base/rs_linetypepattern.cpp | 56 ++- src/base/rs_linetypepattern.h | 60 +-- src/base/rs_mainwindowinterface.h | 26 - src/base/rs_math.cpp | 38 +- src/base/rs_math.h | 26 - src/base/rs_modification.cpp | 25 +- src/base/rs_modification.h | 32 +- src/base/rs_pattern.cpp | 42 +- src/base/rs_pattern.h | 26 - src/base/rs_patternlist.cpp | 38 +- src/base/rs_patternlist.h | 26 - src/base/rs_pen.h | 26 - src/base/rs_point.cpp | 38 +- src/base/rs_point.h | 26 - src/base/rs_polyline.cpp | 38 +- src/base/rs_polyline.h | 26 - src/base/rs_preview.cpp | 3 +- src/base/rs_previewactioninterface.cpp | 13 + src/base/rs_python.cpp | 40 +- src/base/rs_python.h | 34 +- src/base/rs_python_wrappers.cpp | 30 +- src/base/rs_script.cpp | 38 +- src/base/rs_script.h | 26 - src/base/rs_scriptlist.cpp | 38 +- src/base/rs_scriptlist.h | 26 - src/base/rs_selection.cpp | 37 +- src/base/rs_selection.h | 88 +--- src/base/rs_simplepython.cpp | 43 +- src/base/rs_simplepython.h | 68 +-- src/base/rs_snapper.cpp | 3 +- src/base/rs_solid.cpp | 262 +++++----- src/base/rs_solid.h | 26 - src/base/rs_spline.cpp | 40 +- src/base/rs_spline.h | 26 - src/base/rs_staticgraphicview.cpp | 34 +- src/base/rs_staticgraphicview.h | 20 - src/base/rs_text.cpp | 577 +++++++++++----------- src/base/rs_undo.cpp | 13 + src/base/rs_undo.h | 26 - src/base/rs_undoable.cpp | 38 +- src/base/rs_undocycle.cpp | 3 +- src/base/rs_units.cpp | 38 +- src/base/rs_units.h | 26 - src/base/rs_utility.cpp | 38 +- src/base/rs_utility.h | 28 -- src/base/rs_variable.cpp | 1 + src/base/rs_variable.h | 26 - src/base/vector.h | 2 - src/forms/coordinatewidget.cpp | 4 +- src/forms/coordinatewidget.h | 6 +- src/forms/dlgattributes.cpp | 2 +- src/forms/dlgoptionsdrawing.cpp | 4 +- src/forms/dlgoptionsdrawing.h | 6 +- src/forms/librarywidget.cpp | 4 +- src/mainapp/main.cpp | 2 +- src/mainapp/qc_applicationwindow.cpp | 28 +- src/mainapp/qc_mdiwindow.cpp | 4 +- src/mainapp/qc_mdiwindow.h | 2 +- src/widgets/qg_dialogfactory.cpp | 188 ++++++- src/widgets/qg_dialogfactory.h | 4 +- src/widgets/qg_filedialog.cpp | 4 +- src/widgets/qg_graphicview.cpp | 6 +- 132 files changed, 1700 insertions(+), 2505 deletions(-) rename src/base/{rs_graphic.cpp => drawing.cpp} (70%) rename src/base/{rs_graphic.h => drawing.h} (95%) diff --git a/architektonas.pro b/architektonas.pro index 66d591e..b147164 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -58,7 +58,7 @@ HEADERS = \ src/base/rs_font.h \ src/base/rs_fontchar.h \ src/base/rs_fontlist.h \ - src/base/rs_graphic.h \ + src/base/drawing.h \ src/base/rs_hatch.h \ src/base/rs_insert.h \ src/base/rs_image.h \ @@ -140,7 +140,7 @@ SOURCES = \ src/base/rs_entitycontainer.cpp \ src/base/rs_font.cpp \ src/base/rs_fontlist.cpp \ - src/base/rs_graphic.cpp \ + src/base/drawing.cpp \ src/base/rs_hatch.cpp \ src/base/rs_insert.cpp \ src/base/rs_image.cpp \ @@ -170,6 +170,7 @@ SOURCES = \ src/base/rs_filterdxf.cpp \ src/base/rs_filterdxf1.cpp \ src/base/rs_filterinterface.cpp \ + src/base/rs_commandevent.cpp \ src/base/rs_dialogfactory.cpp \ src/base/rs_eventhandler.cpp \ src/base/rs_graphicview.cpp \ diff --git a/src/actions/rs_actionblocksadd.cpp b/src/actions/rs_actionblocksadd.cpp index 5ef6ff1..d6705fe 100644 --- a/src/actions/rs_actionblocksadd.cpp +++ b/src/actions/rs_actionblocksadd.cpp @@ -26,7 +26,7 @@ #include "rs_actionblocksadd.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_dialogfactory.h" RS_ActionBlocksAdd::RS_ActionBlocksAdd(RS_EntityContainer& container, diff --git a/src/actions/rs_actionblocksattributes.cpp b/src/actions/rs_actionblocksattributes.cpp index 978039b..9c363e3 100644 --- a/src/actions/rs_actionblocksattributes.cpp +++ b/src/actions/rs_actionblocksattributes.cpp @@ -26,7 +26,7 @@ #include "rs_actionblocksattributes.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_dialogfactory.h" diff --git a/src/actions/rs_actionblocksedit.cpp b/src/actions/rs_actionblocksedit.cpp index 1a0208d..e63c7a2 100644 --- a/src/actions/rs_actionblocksedit.cpp +++ b/src/actions/rs_actionblocksedit.cpp @@ -26,7 +26,7 @@ #include "rs_actionblocksedit.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_dialogfactory.h" diff --git a/src/actions/rs_actionblocksfreezeall.cpp b/src/actions/rs_actionblocksfreezeall.cpp index 01cdea6..13305d3 100644 --- a/src/actions/rs_actionblocksfreezeall.cpp +++ b/src/actions/rs_actionblocksfreezeall.cpp @@ -14,7 +14,7 @@ #include "rs_actionblocksfreezeall.h" -#include "rs_graphic.h" +#include "drawing.h" RS_ActionBlocksFreezeAll::RS_ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container, RS_GraphicView& graphicView): RS_ActionInterface("Freeze all Blocks", diff --git a/src/actions/rs_actionblocksremove.cpp b/src/actions/rs_actionblocksremove.cpp index 219aa80..d51e5b0 100644 --- a/src/actions/rs_actionblocksremove.cpp +++ b/src/actions/rs_actionblocksremove.cpp @@ -27,7 +27,7 @@ #include "rs_actionblocksremove.h" #include "rs_block.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_insert.h" #include "rs_dialogfactory.h" diff --git a/src/actions/rs_actionblockstoggleview.cpp b/src/actions/rs_actionblockstoggleview.cpp index 1fc9617..66fd128 100644 --- a/src/actions/rs_actionblockstoggleview.cpp +++ b/src/actions/rs_actionblockstoggleview.cpp @@ -26,7 +26,7 @@ #include "rs_actionblockstoggleview.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionfilenew.cpp b/src/actions/rs_actionfilenew.cpp index 2dbee34..7c9c5ec 100644 --- a/src/actions/rs_actionfilenew.cpp +++ b/src/actions/rs_actionfilenew.cpp @@ -26,7 +26,7 @@ #include "rs_actionfilenew.h" -#include "rs_graphic.h" +#include "drawing.h" RS_ActionFileNew::RS_ActionFileNew(RS_EntityContainer & container, RS_GraphicView & graphicView): diff --git a/src/actions/rs_actionfileopen.cpp b/src/actions/rs_actionfileopen.cpp index 667228e..7093bbc 100644 --- a/src/actions/rs_actionfileopen.cpp +++ b/src/actions/rs_actionfileopen.cpp @@ -1,7 +1,7 @@ #include "rs_actionfileopen.h" -#include "rs_graphic.h" +#include "drawing.h" RS_ActionFileOpen::RS_ActionFileOpen(RS_EntityContainer & container, RS_GraphicView & graphicView): diff --git a/src/actions/rs_actionfilesave.cpp b/src/actions/rs_actionfilesave.cpp index 06906cb..4446afc 100644 --- a/src/actions/rs_actionfilesave.cpp +++ b/src/actions/rs_actionfilesave.cpp @@ -26,7 +26,7 @@ #include "rs_actionfilesave.h" -#include "rs_graphic.h" +#include "drawing.h" //Added by qt3to4: //#include diff --git a/src/actions/rs_actionfilesaveas.cpp b/src/actions/rs_actionfilesaveas.cpp index d85a4ac..8a5d23e 100644 --- a/src/actions/rs_actionfilesaveas.cpp +++ b/src/actions/rs_actionfilesaveas.cpp @@ -26,7 +26,7 @@ #include "rs_actionfilesaveas.h" -#include "rs_graphic.h" +#include "drawing.h" //Added by qt3to4: //#include diff --git a/src/actions/rs_actionlayersadd.cpp b/src/actions/rs_actionlayersadd.cpp index eea48b9..f200b94 100644 --- a/src/actions/rs_actionlayersadd.cpp +++ b/src/actions/rs_actionlayersadd.cpp @@ -26,7 +26,7 @@ #include "rs_actionlayersadd.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionlayersedit.cpp b/src/actions/rs_actionlayersedit.cpp index b6d7c54..879da01 100644 --- a/src/actions/rs_actionlayersedit.cpp +++ b/src/actions/rs_actionlayersedit.cpp @@ -26,7 +26,7 @@ #include "rs_actionlayersedit.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionlayersfreezeall.cpp b/src/actions/rs_actionlayersfreezeall.cpp index 6e79f83..7e7dc90 100644 --- a/src/actions/rs_actionlayersfreezeall.cpp +++ b/src/actions/rs_actionlayersfreezeall.cpp @@ -14,7 +14,7 @@ #include "rs_actionlayersfreezeall.h" -#include "rs_graphic.h" +#include "drawing.h" RS_ActionLayersFreezeAll::RS_ActionLayersFreezeAll(bool freeze, RS_EntityContainer& container, diff --git a/src/actions/rs_actionlayersremove.cpp b/src/actions/rs_actionlayersremove.cpp index f1eba16..937dda1 100644 --- a/src/actions/rs_actionlayersremove.cpp +++ b/src/actions/rs_actionlayersremove.cpp @@ -26,7 +26,7 @@ #include "rs_actionlayersremove.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionlayerstogglelock.cpp b/src/actions/rs_actionlayerstogglelock.cpp index 93cb56d..fe09a12 100644 --- a/src/actions/rs_actionlayerstogglelock.cpp +++ b/src/actions/rs_actionlayerstogglelock.cpp @@ -26,7 +26,7 @@ #include "rs_actionlayerstogglelock.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionlayerstoggleview.cpp b/src/actions/rs_actionlayerstoggleview.cpp index 09f0cc6..14e8990 100644 --- a/src/actions/rs_actionlayerstoggleview.cpp +++ b/src/actions/rs_actionlayerstoggleview.cpp @@ -26,7 +26,7 @@ #include "rs_actionlayerstoggleview.h" -#include "rs_graphic.h" +#include "drawing.h" diff --git a/src/actions/rs_actionlibraryinsert.h b/src/actions/rs_actionlibraryinsert.h index 12730d8..fa8ec4e 100644 --- a/src/actions/rs_actionlibraryinsert.h +++ b/src/actions/rs_actionlibraryinsert.h @@ -138,7 +138,7 @@ public: protected: //RS_Block* block; //RS_InsertData data; - RS_Graphic prev; + Drawing prev; RS_LibraryInsertData data; /** Last status before entering option. */ diff --git a/src/base/rs_graphic.cpp b/src/base/drawing.cpp similarity index 70% rename from src/base/rs_graphic.cpp rename to src/base/drawing.cpp index f2ed604..dbdc1e2 100644 --- a/src/base/rs_graphic.cpp +++ b/src/base/drawing.cpp @@ -1,4 +1,4 @@ -// rs_graphic.cpp +// drawing.cpp // // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun @@ -10,9 +10,12 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/21/2010 Added this text. :-) +// JLH 06/02/2010 Changed all references of this class from RS_Graphic to +// Drawing, as that makes it more clear that this is what it +// is (a CAD drawing, not a bitmap). // -#include "rs_graphic.h" +#include "drawing.h" #include "rs_debug.h" #include "rs_fileio.h" @@ -23,7 +26,7 @@ /** * Default constructor. */ -RS_Graphic::RS_Graphic(RS_EntityContainer * parent): RS_Document(parent), layerList(), +Drawing::Drawing(RS_EntityContainer * parent): RS_Document(parent), layerList(), blockList(true) #ifdef RS_CAM , camData() @@ -58,12 +61,12 @@ RS_Graphic::RS_Graphic(RS_EntityContainer * parent): RS_Document(parent), layerL /** * Destructor. */ -RS_Graphic::~RS_Graphic() +Drawing::~Drawing() { } /** @return RS2::EntityGraphic */ -/*virtual*/ RS2::EntityType RS_Graphic::rtti() const +/*virtual*/ RS2::EntityType Drawing::rtti() const { return RS2::EntityGraphic; } @@ -71,7 +74,7 @@ RS_Graphic::~RS_Graphic() /** * Counts the entities on the given layer. */ -unsigned long int RS_Graphic::countLayerEntities(RS_Layer * layer) +unsigned long int Drawing::countLayerEntities(RS_Layer * layer) { int c = 0; @@ -89,12 +92,12 @@ unsigned long int RS_Graphic::countLayerEntities(RS_Layer * layer) return c; } -/*virtual*/ RS_LayerList * RS_Graphic::getLayerList() +/*virtual*/ RS_LayerList * Drawing::getLayerList() { return &layerList; } -/*virtual*/ RS_BlockList * RS_Graphic::getBlockList() +/*virtual*/ RS_BlockList * Drawing::getBlockList() { return &blockList; } @@ -103,9 +106,9 @@ unsigned long int RS_Graphic::countLayerEntities(RS_Layer * layer) * Clears all layers, blocks and entities of this graphic. * A default layer (0) is created. */ -void RS_Graphic::newDoc() +void Drawing::newDoc() { - RS_DEBUG->print("RS_Graphic::newDoc"); + RS_DEBUG->print("Drawing::newDoc"); clear(); @@ -121,11 +124,11 @@ void RS_Graphic::newDoc() /** * Saves this graphic with the current filename and settings. */ -bool RS_Graphic::save() +bool Drawing::save() { bool ret = false; - RS_DEBUG->print("RS_Graphic::save"); + RS_DEBUG->print("Drawing::save"); RS_DEBUG->print(" file: %s", filename.toLatin1().data()); RS_DEBUG->print(" format: %d", (int)formatType); @@ -139,7 +142,7 @@ bool RS_Graphic::save() blockList.setModified(false); } - RS_DEBUG->print("RS_Graphic::save ok"); + RS_DEBUG->print("Drawing::save ok"); return ret; } @@ -147,9 +150,9 @@ bool RS_Graphic::save() /** * Saves this graphic with the given filename and current settings. */ -bool RS_Graphic::saveAs(const QString & filename, RS2::FormatType type) +bool Drawing::saveAs(const QString & filename, RS2::FormatType type) { - RS_DEBUG->print("RS_Graphic::saveAs"); + RS_DEBUG->print("Drawing::saveAs"); this->filename = filename; this->formatType = type; @@ -160,9 +163,9 @@ bool RS_Graphic::saveAs(const QString & filename, RS2::FormatType type) /** * Loads the given fils into this graphic. */ -bool RS_Graphic::open(const QString &filename, RS2::FormatType type) +bool Drawing::open(const QString &filename, RS2::FormatType type) { - RS_DEBUG->print("RS_Graphic::open(%s)", filename.toLatin1().data()); + RS_DEBUG->print("Drawing::open(%s)", filename.toLatin1().data()); bool ret = false; @@ -178,46 +181,46 @@ bool RS_Graphic::open(const QString &filename, RS2::FormatType type) layerList.setModified(false); blockList.setModified(false); - //cout << *((RS_Graphic*)graphic); + //cout << *((Drawing*)graphic); //calculateBorders(); - RS_DEBUG->print("RS_Graphic::open(%s): OK", filename.toLatin1().data()); + RS_DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data()); return ret; } // Wrappers for Layer functions: -void RS_Graphic::clearLayers() +void Drawing::clearLayers() { layerList.clear(); } -uint RS_Graphic::countLayers() const +uint Drawing::countLayers() const { return layerList.count(); } -RS_Layer * RS_Graphic::layerAt(uint i) +RS_Layer * Drawing::layerAt(uint i) { return layerList.at(i); } -void RS_Graphic::activateLayer(const QString & name) +void Drawing::activateLayer(const QString & name) { layerList.activate(name); } -void RS_Graphic::activateLayer(RS_Layer * layer) +void Drawing::activateLayer(RS_Layer * layer) { layerList.activate(layer); } -RS_Layer * RS_Graphic::getActiveLayer() +RS_Layer * Drawing::getActiveLayer() { return layerList.getActive(); } -/*virtual*/ void RS_Graphic::addLayer(RS_Layer * layer) +/*virtual*/ void Drawing::addLayer(RS_Layer * layer) { layerList.add(layer); } @@ -225,7 +228,7 @@ RS_Layer * RS_Graphic::getActiveLayer() /** * Removes the given layer and undoes all entities on it. */ -/*virtual*/ void RS_Graphic::removeLayer(RS_Layer * layer) +/*virtual*/ void Drawing::removeLayer(RS_Layer * layer) { if (layer != NULL && layer->getName() != "0") { @@ -267,186 +270,186 @@ RS_Layer * RS_Graphic::getActiveLayer() } } -/*virtual*/ void RS_Graphic::editLayer(RS_Layer * layer, const RS_Layer & source) +/*virtual*/ void Drawing::editLayer(RS_Layer * layer, const RS_Layer & source) { layerList.edit(layer, source); } -RS_Layer * RS_Graphic::findLayer(const QString & name) +RS_Layer * Drawing::findLayer(const QString & name) { return layerList.find(name); } -void RS_Graphic::toggleLayer(const QString & name) +void Drawing::toggleLayer(const QString & name) { layerList.toggle(name); } -void RS_Graphic::toggleLayer(RS_Layer * layer) +void Drawing::toggleLayer(RS_Layer * layer) { layerList.toggle(layer); } -void RS_Graphic::toggleLayerLock(RS_Layer * layer) +void Drawing::toggleLayerLock(RS_Layer * layer) { layerList.toggleLock(layer); } -void RS_Graphic::freezeAllLayers(bool freeze) +void Drawing::freezeAllLayers(bool freeze) { layerList.freezeAll(freeze); } -void RS_Graphic::addLayerListListener(RS_LayerListListener * listener) +void Drawing::addLayerListListener(RS_LayerListListener * listener) { layerList.addListener(listener); } -void RS_Graphic::removeLayerListListener(RS_LayerListListener * listener) +void Drawing::removeLayerListListener(RS_LayerListListener * listener) { layerList.removeListener(listener); } // Wrapper for block functions: -void RS_Graphic::clearBlocks() +void Drawing::clearBlocks() { blockList.clear(); } -uint RS_Graphic::countBlocks() +uint Drawing::countBlocks() { return blockList.count(); } -RS_Block * RS_Graphic::blockAt(uint i) +RS_Block * Drawing::blockAt(uint i) { return blockList.at(i); } -void RS_Graphic::activateBlock(const QString & name) +void Drawing::activateBlock(const QString & name) { blockList.activate(name); } -void RS_Graphic::activateBlock(RS_Block * block) +void Drawing::activateBlock(RS_Block * block) { blockList.activate(block); } -RS_Block * RS_Graphic::getActiveBlock() +RS_Block * Drawing::getActiveBlock() { return blockList.getActive(); } -/*virtual*/ bool RS_Graphic::addBlock(RS_Block * block, bool notify/*= true*/) +/*virtual*/ bool Drawing::addBlock(RS_Block * block, bool notify/*= true*/) { return blockList.add(block, notify); } -/*virtual*/ void RS_Graphic::addBlockNotification() +/*virtual*/ void Drawing::addBlockNotification() { blockList.addNotification(); } -/*virtual*/ void RS_Graphic::removeBlock(RS_Block * block) +/*virtual*/ void Drawing::removeBlock(RS_Block * block) { blockList.remove(block); } -RS_Block * RS_Graphic::findBlock(const QString & name) +RS_Block * Drawing::findBlock(const QString & name) { return blockList.find(name); } -QString RS_Graphic::newBlockName() +QString Drawing::newBlockName() { return blockList.newName(); } -void RS_Graphic::toggleBlock(const QString & name) +void Drawing::toggleBlock(const QString & name) { blockList.toggle(name); } -void RS_Graphic::toggleBlock(RS_Block * block) +void Drawing::toggleBlock(RS_Block * block) { blockList.toggle(block); } -void RS_Graphic::freezeAllBlocks(bool freeze) +void Drawing::freezeAllBlocks(bool freeze) { blockList.freezeAll(freeze); } -void RS_Graphic::addBlockListListener(RS_BlockListListener * listener) +void Drawing::addBlockListListener(RS_BlockListListener * listener) { blockList.addListener(listener); } -void RS_Graphic::removeBlockListListener(RS_BlockListListener * listener) +void Drawing::removeBlockListListener(RS_BlockListListener * listener) { blockList.removeListener(listener); } // Wrappers for variable functions: -void RS_Graphic::clearVariables() +void Drawing::clearVariables() { variableDict.clear(); } -int RS_Graphic::countVariables() +int Drawing::countVariables() { return variableDict.count(); } -void RS_Graphic::addVariable(const QString & key, const Vector & value, int code) +void Drawing::addVariable(const QString & key, const Vector & value, int code) { variableDict.add(key, value, code); } -void RS_Graphic::addVariable(const QString & key, const QString & value, int code) +void Drawing::addVariable(const QString & key, const QString & value, int code) { variableDict.add(key, value, code); } -void RS_Graphic::addVariable(const QString & key, int value, int code) +void Drawing::addVariable(const QString & key, int value, int code) { variableDict.add(key, value, code); } -void RS_Graphic::addVariable(const QString & key, double value, int code) +void Drawing::addVariable(const QString & key, double value, int code) { variableDict.add(key, value, code); } -Vector RS_Graphic::getVariableVector(const QString & key, const Vector & def) +Vector Drawing::getVariableVector(const QString & key, const Vector & def) { return variableDict.getVector(key, def); } -QString RS_Graphic::getVariableString(const QString & key, const QString & def) +QString Drawing::getVariableString(const QString & key, const QString & def) { return variableDict.getString(key, def); } -int RS_Graphic::getVariableInt(const QString & key, int def) +int Drawing::getVariableInt(const QString & key, int def) { return variableDict.getInt(key, def); } -double RS_Graphic::getVariableDouble(const QString & key, double def) +double Drawing::getVariableDouble(const QString & key, double def) { return variableDict.getDouble(key, def); } -void RS_Graphic::removeVariable(const QString & key) +void Drawing::removeVariable(const QString & key) { variableDict.remove(key); } //Q3Dict & getVariableDict() -QMultiHash & RS_Graphic::getVariableDict() +QMultiHash & Drawing::getVariableDict() { return variableDict.getVariableDict(); } @@ -454,7 +457,7 @@ QMultiHash & RS_Graphic::getVariableDict() /** * @return true if the grid is switched on (visible). */ -bool RS_Graphic::isGridOn() +bool Drawing::isGridOn() { int on = getVariableInt("$GRIDMODE", 1); return (on != 0); @@ -463,7 +466,7 @@ bool RS_Graphic::isGridOn() /** * Enables / disables the grid. */ -void RS_Graphic::setGridOn(bool on) +void Drawing::setGridOn(bool on) { addVariable("$GRIDMODE", (int)on, 70); } @@ -471,7 +474,7 @@ void RS_Graphic::setGridOn(bool on) /** * Sets the unit of this graphic to 'u' */ -void RS_Graphic::setUnit(RS2::Unit u) +void Drawing::setUnit(RS2::Unit u) { setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u)); @@ -483,7 +486,7 @@ void RS_Graphic::setUnit(RS2::Unit u) /** * Gets the unit of this graphic */ -RS2::Unit RS_Graphic::getUnit() +RS2::Unit Drawing::getUnit() { return (RS2::Unit)getVariableInt("$INSUNITS", 0); //return unit; @@ -493,7 +496,7 @@ RS2::Unit RS_Graphic::getUnit() * @return The linear format type for this document. * This is determined by the variable "$LUNITS". */ -RS2::LinearFormat RS_Graphic::getLinearFormat() +RS2::LinearFormat Drawing::getLinearFormat() { int lunits = getVariableInt("$LUNITS", 2); @@ -528,7 +531,7 @@ RS2::LinearFormat RS_Graphic::getLinearFormat() * @return The linear precision for this document. * This is determined by the variable "$LUPREC". */ -int RS_Graphic::getLinearPrecision() +int Drawing::getLinearPrecision() { return getVariableInt("$LUPREC", 4); } @@ -537,7 +540,7 @@ int RS_Graphic::getLinearPrecision() * @return The angle format type for this document. * This is determined by the variable "$AUNITS". */ -RS2::AngleFormat RS_Graphic::getAngleFormat() +RS2::AngleFormat Drawing::getAngleFormat() { int aunits = getVariableInt("$AUNITS", 0); @@ -572,7 +575,7 @@ RS2::AngleFormat RS_Graphic::getAngleFormat() * @return The linear precision for this document. * This is determined by the variable "$LUPREC". */ -int RS_Graphic::getAnglePrecision() +int Drawing::getAnglePrecision() { return getVariableInt("$AUPREC", 4); } @@ -582,7 +585,7 @@ int RS_Graphic::getAnglePrecision() * This is the distance from the lower left paper edge to the zero * point of the drawing. DXF: $PINSBASE. */ -Vector RS_Graphic::getPaperInsertionBase() +Vector Drawing::getPaperInsertionBase() { return getVariableVector("$PINSBASE", Vector(0.0,0.0)); } @@ -590,7 +593,7 @@ Vector RS_Graphic::getPaperInsertionBase() /** * Sets the PINSBASE variable. */ -void RS_Graphic::setPaperInsertionBase(const Vector & p) +void Drawing::setPaperInsertionBase(const Vector & p) { addVariable("$PINSBASE", p, 10); } @@ -598,7 +601,7 @@ void RS_Graphic::setPaperInsertionBase(const Vector & p) /** * @return Paper size in graphic units. */ -Vector RS_Graphic::getPaperSize() +Vector Drawing::getPaperSize() { Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit()); @@ -611,7 +614,7 @@ Vector RS_Graphic::getPaperSize() /** * Sets a new paper size. */ -void RS_Graphic::setPaperSize(const Vector & s) +void Drawing::setPaperSize(const Vector & s) { addVariable("$PLIMMIN", Vector(0.0, 0.0), 10); addVariable("$PLIMMAX", s, 10); @@ -623,7 +626,7 @@ void RS_Graphic::setPaperSize(const Vector & s) * * @param landscape will be set to true for landscape and false for portrait if not NULL. */ -RS2::PaperFormat RS_Graphic::getPaperFormat(bool * landscape) +RS2::PaperFormat Drawing::getPaperFormat(bool * landscape) { Vector size = RS_Units::convert(getPaperSize(), getUnit(), RS2::Millimeter); @@ -636,7 +639,7 @@ RS2::PaperFormat RS_Graphic::getPaperFormat(bool * landscape) /** * Sets the paper format to the given format. */ -void RS_Graphic::setPaperFormat(RS2::PaperFormat f, bool landscape) +void Drawing::setPaperFormat(RS2::PaperFormat f, bool landscape) { Vector size = RS_Units::paperFormatToSize(f); @@ -654,7 +657,7 @@ void RS_Graphic::setPaperFormat(RS2::PaperFormat f, bool landscape) /** * @return Paper space scaling (DXF: $PSVPSCALE). */ -double RS_Graphic::getPaperScale() +double Drawing::getPaperScale() { double ret; @@ -669,7 +672,7 @@ double RS_Graphic::getPaperScale() /** * Sets a new scale factor for the paper space. */ -void RS_Graphic::setPaperScale(double s) +void Drawing::setPaperScale(double s) { addVariable("$PSVPSCALE", s, 40); } @@ -677,7 +680,7 @@ void RS_Graphic::setPaperScale(double s) /** * Centers drawing on page. Affects DXF variable $PINSBASE. */ -void RS_Graphic::centerToPage() +void Drawing::centerToPage() { Vector size = getPaperSize(); double scale = getPaperScale(); @@ -688,7 +691,7 @@ void RS_Graphic::centerToPage() /** * Fits drawing on page. Affects DXF variable $PINSBASE. */ -void RS_Graphic::fitToPage() +void Drawing::fitToPage() { double border = RS_Units::convert(25.0, RS2::Millimeter, getUnit()); Vector ps = getPaperSize() - Vector(border, border); @@ -713,7 +716,7 @@ void RS_Graphic::fitToPage() * @retval true The document has been modified since it was last saved. * @retval false The document has not been modified since it was last saved. */ -/*virtual*/ bool RS_Graphic::isModified() const +/*virtual*/ bool Drawing::isModified() const { return modified || layerList.isModified() || blockList.isModified(); } @@ -721,7 +724,7 @@ void RS_Graphic::fitToPage() /** * Sets the documents modified status to 'm'. */ -/*virtual*/ void RS_Graphic::setModified(bool m) +/*virtual*/ void Drawing::setModified(bool m) { modified = m; layerList.setModified(m); @@ -729,12 +732,12 @@ void RS_Graphic::fitToPage() } #ifdef RS_CAM -RS_CamData & RS_Graphic::getCamData() +RS_CamData & Drawing::getCamData() { return camData; } -void RS_Graphic::setCamData(const RS_CamData & d) +void Drawing::setCamData(const RS_CamData & d) { camData = d; } @@ -743,9 +746,9 @@ void RS_Graphic::setCamData(const RS_CamData & d) /** * Dumps the entities to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_Graphic & g) +std::ostream & operator<<(std::ostream & os, Drawing & g) { - os << "--- Graphic: \n"; + os << "--- Drawing: \n"; os << "---" << *g.getLayerList() << "\n"; os << "---" << *g.getBlockList() << "\n"; os << "---" << (RS_Undo&)g << "\n"; diff --git a/src/base/rs_graphic.h b/src/base/drawing.h similarity index 95% rename from src/base/rs_graphic.h rename to src/base/drawing.h index 2b0cba1..22b2217 100644 --- a/src/base/rs_graphic.h +++ b/src/base/drawing.h @@ -16,11 +16,11 @@ * * @author Andrew Mustun */ -class RS_Graphic: public RS_Document +class Drawing: public RS_Document { public: - RS_Graphic(RS_EntityContainer * parent = NULL); - virtual ~RS_Graphic(); + Drawing(RS_EntityContainer * parent = NULL); + virtual ~Drawing(); virtual RS2::EntityType rtti() const; virtual unsigned long int countLayerEntities(RS_Layer * layer); @@ -118,7 +118,7 @@ public: void setCamData(const RS_CamData & d); #endif - friend std::ostream & operator<<(std::ostream & os, RS_Graphic & g); + friend std::ostream & operator<<(std::ostream & os, Drawing & g); private: RS_LayerList layerList; diff --git a/src/base/rs_actioninterface.h b/src/base/rs_actioninterface.h index 66a38b2..ed76836 100644 --- a/src/base/rs_actioninterface.h +++ b/src/base/rs_actioninterface.h @@ -6,7 +6,7 @@ #include "rs_entitycontainer.h" #include "rs_commandevent.h" //#include "rs_event.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_graphicview.h" #include "rs_snapper.h" #include "rs_preview.h" @@ -99,7 +99,7 @@ class RS_ActionInterface: public QObject, public RS_Snapper * Pointer to the graphic is this container is a graphic. * NULL otherwise */ - RS_Graphic * graphic; + Drawing * graphic; /** * Pointer to the document (graphic or block) or NULL. diff --git a/src/base/rs_block.cpp b/src/base/rs_block.cpp index 193f904..15db0de 100644 --- a/src/base/rs_block.cpp +++ b/src/base/rs_block.cpp @@ -15,7 +15,7 @@ #include "rs_block.h" #include -#include "rs_graphic.h" +#include "drawing.h" /** * @param parent The graphic this block belongs to. @@ -44,7 +44,7 @@ RS_Entity * RS_Block::clone() RS_LayerList * RS_Block::getLayerList() { - RS_Graphic * g = getGraphic(); + Drawing * g = getGraphic(); if (g != NULL) return g->getLayerList(); @@ -54,7 +54,7 @@ RS_LayerList * RS_Block::getLayerList() RS_BlockList * RS_Block::getBlockList() { - RS_Graphic * g = getGraphic(); + Drawing * g = getGraphic(); if (g != NULL) return g->getBlockList(); @@ -64,7 +64,7 @@ RS_BlockList * RS_Block::getBlockList() bool RS_Block::save() { - RS_Graphic * g = getGraphic(); + Drawing * g = getGraphic(); if (g != NULL) return g->save(); @@ -74,7 +74,7 @@ bool RS_Block::save() bool RS_Block::saveAs(const QString & filename, RS2::FormatType type) { - RS_Graphic * g = getGraphic(); + Drawing * g = getGraphic(); if (g != NULL) return g->saveAs(filename, type); @@ -87,7 +87,7 @@ bool RS_Block::saveAs(const QString & filename, RS2::FormatType type) */ void RS_Block::setModified(bool m) { - RS_Graphic * p = getGraphic(); + Drawing * p = getGraphic(); if (p) p->setModified(m); diff --git a/src/base/rs_clipboard.h b/src/base/rs_clipboard.h index 842fc69..5e8c270 100644 --- a/src/base/rs_clipboard.h +++ b/src/base/rs_clipboard.h @@ -2,7 +2,7 @@ #define RS_CLIPBOARD_H #include -#include "rs_graphic.h" +#include "drawing.h" #define RS_CLIPBOARD RS_Clipboard::instance() @@ -69,7 +69,7 @@ public: return graphic.nextEntity(); } - RS_Graphic* getGraphic() { + Drawing* getGraphic() { return &graphic; } @@ -78,7 +78,7 @@ public: protected: static RS_Clipboard* uniqueInstance; - RS_Graphic graphic; + Drawing graphic; }; #endif diff --git a/src/base/rs_commandevent.h b/src/base/rs_commandevent.h index 5a0dd5b..6d6ca7c 100644 --- a/src/base/rs_commandevent.h +++ b/src/base/rs_commandevent.h @@ -7,41 +7,11 @@ class RS_CommandEvent { public: - /** - * Creates a new command event that is not yet accepted. - * - * @param cmd the command that was triggered. - */ - RS_CommandEvent(const QString & cmd) - { - this->cmd = cmd; - accepted = false; - } + RS_CommandEvent(const QString & cmd); - /** - * @return the command that was triggered, usually by - * the user. - */ - QString getCommand() - { - return cmd; - } - - /** - * Sets the event state to accepted. - */ - void accept() - { - accepted = true; - } - - /** - * @return Whether the event was already accepted or not. - */ - bool isAccepted() - { - return accepted; - } + QString getCommand(); + void accept(); + bool isAccepted(); protected: QString cmd; diff --git a/src/base/rs_constructionline.cpp b/src/base/rs_constructionline.cpp index 6d85373..de54277 100644 --- a/src/base/rs_constructionline.cpp +++ b/src/base/rs_constructionline.cpp @@ -10,6 +10,7 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/28/2010 Added this text. :-) +// JLH 06/02/2010 Moved implementation from header to here WHERE IT BELONGS. // #include "rs_constructionline.h" @@ -39,6 +40,47 @@ RS_Entity * RS_ConstructionLine::clone() return c; } +/** @return RS2::EntityConstructionLine */ +/*virtual*/ RS2::EntityType RS_ConstructionLine::rtti() const +{ + return RS2::EntityConstructionLine; +} + +/** + * @todo + * @return Start point of the entity. + */ +/*virtual*/ Vector RS_ConstructionLine::getStartpoint() const +{ + return Vector(false); +} + +/** + * @todo + * @return End point of the entity. + */ +/*virtual*/ Vector RS_ConstructionLine::getEndpoint() const +{ + return Vector(false); +} + +/** @return Copy of data that defines the line. */ +RS_ConstructionLineData RS_ConstructionLine::getData() const +{ + return data; +} + +/** @return First definition point. */ +Vector RS_ConstructionLine::getPoint1() const +{ + return data.point1; +} +/** @return Second definition point. */ +Vector RS_ConstructionLine::getPoint2() const +{ + return data.point2; +} + void RS_ConstructionLine::calculateBorders() { minV = Vector::minimum(data.point1, data.point2); diff --git a/src/base/rs_constructionline.h b/src/base/rs_constructionline.h index 0a91f6c..321d0e4 100644 --- a/src/base/rs_constructionline.h +++ b/src/base/rs_constructionline.h @@ -10,116 +10,72 @@ */ class RS_ConstructionLineData { -public: - /** - * Default constructor. Leaves the data object uninitialized. - */ - RS_ConstructionLineData() {} - - RS_ConstructionLineData(const Vector& point1, - const Vector& point2) { - - this->point1 = point1; - this->point2 = point2; - } - - friend class RS_ConstructionLine; - - friend std::ostream& operator << (std::ostream& os, - const RS_ConstructionLineData& ld) { - - os << "(" << ld.point1 << - "/" << ld.point2 << - ")"; - return os; - } - -private: - Vector point1; - Vector point2; + public: + /** + * Default constructor. Leaves the data object uninitialized. + */ + RS_ConstructionLineData() {} + + RS_ConstructionLineData(const Vector & point1, const Vector & point2) + { + this->point1 = point1; + this->point2 = point2; + } + + friend class RS_ConstructionLine; + + friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLineData & ld) + { + os << "(" << ld.point1 << + "/" << ld.point2 << + ")"; + return os; + } + + private: + Vector point1; + Vector point2; }; - /** * Class for a construction line entity. * * @author Andrew Mustun */ -class RS_ConstructionLine : public RS_AtomicEntity { -public: - RS_ConstructionLine(RS_EntityContainer* parent, - const RS_ConstructionLineData& d); - - virtual RS_Entity* clone(); - - virtual ~RS_ConstructionLine(); - - /** @return RS2::EntityConstructionLine */ - virtual RS2::EntityType rtti() const { - return RS2::EntityConstructionLine; - } - - /** - * @todo - * @return Start point of the entity. - */ - virtual Vector getStartpoint() const { - return Vector(false); - } - /** - * @todo - * @return End point of the entity. - */ - virtual Vector getEndpoint() const { - return Vector(false); - } - - /** @return Copy of data that defines the line. */ - RS_ConstructionLineData getData() const { - return data; - } - - /** @return First definition point. */ - Vector getPoint1() const { - return data.point1; - } - /** @return Second definition point. */ - Vector getPoint2() const { - return data.point2; - } - - virtual Vector getNearestEndpoint(const Vector& coord, - double* dist = NULL); - virtual Vector getNearestPointOnEntity(const Vector& coord, - bool onEntity = true, double* dist = NULL, RS_Entity** entity=NULL); - virtual Vector getNearestCenter(const Vector& coord, - double* dist = NULL); - virtual Vector getNearestMiddle(const Vector& coord, - double* dist = NULL); - virtual Vector getNearestDist(double distance, - const Vector& coord, - double* dist = NULL); - virtual double getDistanceToPoint(const Vector& coord, - RS_Entity** entity=NULL, - RS2::ResolveLevel level=RS2::ResolveNone, - double solidDist = RS_MAXDOUBLE); - - virtual void move(Vector offset); - virtual void rotate(Vector center, double angle); - virtual void scale(Vector center, Vector factor); - virtual void mirror(Vector axisPoint1, Vector axisPoint2); - -// virtual void draw(RS_Painter* /*painter*/, RS_GraphicView* /*view*/, - virtual void draw(PaintInterface * /*painter*/, RS_GraphicView* /*view*/, - double /*patternOffset*/) {} - - friend std::ostream& operator << (std::ostream& os, - const RS_ConstructionLine& l); - - virtual void calculateBorders(); - -protected: - RS_ConstructionLineData data; +class RS_ConstructionLine: public RS_AtomicEntity +{ + public: + RS_ConstructionLine(RS_EntityContainer * parent, const RS_ConstructionLineData & d); + virtual ~RS_ConstructionLine(); + + virtual RS_Entity * clone(); + virtual RS2::EntityType rtti() const; + virtual Vector getStartpoint() const; + virtual Vector getEndpoint() const; + RS_ConstructionLineData getData() const; + Vector getPoint1() const; + Vector getPoint2() const; + virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL); + virtual Vector getNearestPointOnEntity(const Vector & coord, + bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL); + virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL); + virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL); + virtual Vector getNearestDist(double distance, const Vector & coord, + double * dist = NULL); + virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, + RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); + virtual void move(Vector offset); + virtual void rotate(Vector center, double angle); + virtual void scale(Vector center, Vector factor); + virtual void mirror(Vector axisPoint1, Vector axisPoint2); + virtual void draw(PaintInterface * /*painter*/, RS_GraphicView * /*view*/, + double /*patternOffset*/) {} + + friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l); + virtual void calculateBorders(); + + protected: + RS_ConstructionLineData data; }; #endif diff --git a/src/base/rs_creation.cpp b/src/base/rs_creation.cpp index 2fe863d..fb99b2f 100644 --- a/src/base/rs_creation.cpp +++ b/src/base/rs_creation.cpp @@ -16,7 +16,7 @@ #include #include "rs_constructionline.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_graphicview.h" #include "rs_information.h" #include "rs_modification.h" @@ -26,7 +26,7 @@ * Default constructor. * * @param container The container to which we will add - * entities. Usually that's an RS_Graphic entity but + * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ RS_Creation::RS_Creation(RS_EntityContainer * container, RS_GraphicView * graphicView, @@ -1200,7 +1200,7 @@ RS_Block * RS_Creation::createBlock(const RS_BlockData & data, RS_Insert * RS_Creation::createLibraryInsert(RS_LibraryInsertData & data) { RS_DEBUG->print("RS_Creation::createLibraryInsert"); - RS_Graphic g; + Drawing g; if (!g.open(data.file, RS2::FormatUnknown)) { diff --git a/src/base/rs_creation.h b/src/base/rs_creation.h index 1b814a8..e2a6c88 100644 --- a/src/base/rs_creation.h +++ b/src/base/rs_creation.h @@ -76,7 +76,7 @@ class RS_Creation protected: RS_EntityContainer * container; - RS_Graphic * graphic; + Drawing * graphic; RS_Document * document; RS_GraphicView * graphicView; bool handleUndo; diff --git a/src/base/rs_dialogfactory.h b/src/base/rs_dialogfactory.h index 733f7cc..19d64f4 100644 --- a/src/base/rs_dialogfactory.h +++ b/src/base/rs_dialogfactory.h @@ -22,7 +22,6 @@ class RS_DialogFactory void setFactoryObject(RS_DialogFactoryInterface * fo); RS_DialogFactoryInterface * getFactoryObject(); - void commandMessage(const QString & m); private: diff --git a/src/base/rs_dialogfactoryadapter.h b/src/base/rs_dialogfactoryadapter.h index 49d3cb6..cb376b4 100644 --- a/src/base/rs_dialogfactoryadapter.h +++ b/src/base/rs_dialogfactoryadapter.h @@ -46,9 +46,9 @@ class RS_DialogFactoryAdapter : public RS_DialogFactoryInterface virtual bool requestTextDialog(RS_Text *) { return false; } virtual bool requestHatchDialog(RS_Hatch *) { return false; } virtual void requestOptionsGeneralDialog() {} - virtual void requestOptionsDrawingDialog(RS_Graphic &) {} + virtual void requestOptionsDrawingDialog(Drawing &) {} #ifdef RS_CAM - virtual bool requestCamOptionsDialog(RS_Graphic& ) { printf("fake\n"); return false; } + virtual bool requestCamOptionsDialog(Drawing& ) { printf("fake\n"); return false; } #endif virtual void updateCoordinateWidget(const Vector &, const Vector &, bool = false) {} virtual void updateMouseWidget(const QString &, const QString &) {} diff --git a/src/base/rs_dialogfactoryinterface.h b/src/base/rs_dialogfactoryinterface.h index 7021506..14527f5 100644 --- a/src/base/rs_dialogfactoryinterface.h +++ b/src/base/rs_dialogfactoryinterface.h @@ -17,7 +17,7 @@ class RS_DimensionData; class RS_Document; class RS_Entity; class RS_EventHandler; -class RS_Graphic; +class Drawing; class RS_GraphicView; class RS_Grid; class RS_Hatch; @@ -324,10 +324,10 @@ public: * * @param graphic Graphic document. */ - virtual void requestOptionsDrawingDialog(RS_Graphic & graphic) = 0; + virtual void requestOptionsDrawingDialog(Drawing & graphic) = 0; #ifdef RS_CAM - virtual bool requestCamOptionsDialog(RS_Graphic & graphic) = 0; + virtual bool requestCamOptionsDialog(Drawing & graphic) = 0; #endif /** diff --git a/src/base/rs_dimaligned.cpp b/src/base/rs_dimaligned.cpp index 67acabb..4d89293 100644 --- a/src/base/rs_dimaligned.cpp +++ b/src/base/rs_dimaligned.cpp @@ -14,7 +14,7 @@ #include "rs_dimaligned.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_units.h" #include "rs_constructionline.h" @@ -83,7 +83,7 @@ VectorSolutions RS_DimAligned::getRefPoints() QString RS_DimAligned::getMeasuredLabel() { double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2); - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); QString ret; if (graphic != NULL) diff --git a/src/base/rs_dimangular.cpp b/src/base/rs_dimangular.cpp index 8f40942..8728ea9 100644 --- a/src/base/rs_dimangular.cpp +++ b/src/base/rs_dimangular.cpp @@ -16,7 +16,7 @@ #include "rs_constructionline.h" #include "rs_filterdxf.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_information.h" #include "rs_solid.h" #include "rs_text.h" diff --git a/src/base/rs_dimdiametric.cpp b/src/base/rs_dimdiametric.cpp index 7e60a26..81135da 100644 --- a/src/base/rs_dimdiametric.cpp +++ b/src/base/rs_dimdiametric.cpp @@ -16,7 +16,7 @@ #include "rs_text.h" #include "rs_solid.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_units.h" /** @@ -70,7 +70,7 @@ QString RS_DimDiametric::getMeasuredLabel() // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint); - RS_Graphic* graphic = getGraphic(); + Drawing* graphic = getGraphic(); QString ret; if (graphic!=NULL) { diff --git a/src/base/rs_dimension.cpp b/src/base/rs_dimension.cpp index e99f299..01097c6 100644 --- a/src/base/rs_dimension.cpp +++ b/src/base/rs_dimension.cpp @@ -38,12 +38,12 @@ RS_DimensionData RS_Dimension::getData() const Vector RS_Dimension::getNearestRef(const Vector & coord, double * dist) { - return RS_Entity::getNearestRef(coord, dist); + return RS_Entity::getNearestRef(coord, dist); } Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist) { - return RS_Entity::getNearestSelectedRef(coord, dist); + return RS_Entity::getNearestSelectedRef(coord, dist); } /** @@ -56,29 +56,25 @@ Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist) */ QString RS_Dimension::getLabel(bool resolve) { - if (!resolve) { + if (!resolve) return data.text; - } - - QString ret=""; - - // One space suppresses the text: - if (data.text==" ") { - ret = ""; - } - // No text prints actual measurement: - else if (data.text=="") { - ret = getMeasuredLabel(); - } + QString ret = ""; - // Others print the text (<> is replaced by the measurement) - else { - ret = data.text; - ret = ret.replace(QString("<>"), getMeasuredLabel()); - } + // One space suppresses the text: + if (data.text == " ") + ret = ""; + // No text prints actual measurement: + else if (data.text == "") + ret = getMeasuredLabel(); + // Others print the text (<> is replaced by the measurement) + else + { + ret = data.text; + ret = ret.replace(QString("<>"), getMeasuredLabel()); + } - return ret; + return ret; } /** @@ -94,123 +90,125 @@ void RS_Dimension::setLabel(const QString & l) * * @param forceAutoText Automatically reposition the text label. */ -void RS_Dimension::updateCreateDimensionLine(const Vector& p1, - const Vector& p2, bool arrow1, bool arrow2, bool forceAutoText) +void RS_Dimension::updateCreateDimensionLine(const Vector & p1, + const Vector & p2, bool arrow1, bool arrow2, bool forceAutoText) { - // text height (DIMTXT) - double dimtxt = getTextHeight(); - // text distance to line (DIMGAP) - double dimgap = getDimensionLineGap(); - - // length of dimension line: - double distance = p1.distanceTo(p2); - - // do we have to put the arrows outside of the line? - bool outsideArrows = (distancesetPen(RS_Pen(RS2::FlagInvalid)); - dimensionLine->setLayer(NULL); - addEntity(dimensionLine); - - if (outsideArrows==false) { - arrowAngle1 = dimensionLine->getAngle2(); - arrowAngle2 = dimensionLine->getAngle1(); - } else { - arrowAngle1 = dimensionLine->getAngle1(); - arrowAngle2 = dimensionLine->getAngle2(); - - // extend dimension line outside arrows - Vector dir; - dir.setPolar(getArrowSize()*2, arrowAngle2); - dimensionLine->setStartpoint(p1 + dir); - dimensionLine->setEndpoint(p2 - dir); - } - - // Arrows: - RS_SolidData sd; - RS_Solid* arrow; - - if (arrow1) { - // arrow 1 - arrow = new RS_Solid(this, sd); - arrow->shapeArrow(p1, - arrowAngle1, - getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); - arrow->setLayer(NULL); - addEntity(arrow); - } - - if (arrow2) { - // arrow 2: - arrow = new RS_Solid(this, sd); - arrow->shapeArrow(p2, - arrowAngle2, - getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); - arrow->setLayer(NULL); - addEntity(arrow); - } - - // Text label: - RS_TextData textData; - Vector textPos; + // text height (DIMTXT) + double dimtxt = getTextHeight(); + // text distance to line (DIMGAP) + double dimgap = getDimensionLineGap(); + + // length of dimension line: + double distance = p1.distanceTo(p2); + + // do we have to put the arrows outside of the line? + bool outsideArrows = (distancesetPen(RS_Pen(RS2::FlagInvalid)); + dimensionLine->setLayer(NULL); + addEntity(dimensionLine); + + if (outsideArrows == false) + { + arrowAngle1 = dimensionLine->getAngle2(); + arrowAngle2 = dimensionLine->getAngle1(); + } + else + { + arrowAngle1 = dimensionLine->getAngle1(); + arrowAngle2 = dimensionLine->getAngle2(); + + // extend dimension line outside arrows + Vector dir; + dir.setPolar(getArrowSize() * 2, arrowAngle2); + dimensionLine->setStartpoint(p1 + dir); + dimensionLine->setEndpoint(p2 - dir); + } + + // Arrows: + RS_SolidData sd; + RS_Solid * arrow; + + if (arrow1) + { + // arrow 1 + arrow = new RS_Solid(this, sd); + arrow->shapeArrow(p1, arrowAngle1, getArrowSize()); + arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setLayer(NULL); + addEntity(arrow); + } + + if (arrow2) + { + // arrow 2: + arrow = new RS_Solid(this, sd); + arrow->shapeArrow(p2, arrowAngle2, getArrowSize()); + arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setLayer(NULL); + addEntity(arrow); + } + + // Text label: + RS_TextData textData; + Vector textPos; double dimAngle1 = dimensionLine->getAngle1(); double textAngle; - bool corrected=false; + bool corrected = false; textAngle = RS_Math::makeAngleReadable(dimAngle1, true, &corrected); - if (data.middleOfText.valid && !forceAutoText) { - textPos = data.middleOfText; - } else { - textPos = dimensionLine->getMiddlepoint(); - - Vector distV; - - // rotate text so it's readable from the bottom or right (ISO) - // quadrant 1 & 4 - if (corrected) { - distV.setPolar(dimgap + dimtxt/2.0, dimAngle1-M_PI/2.0); - } else { - distV.setPolar(dimgap + dimtxt/2.0, dimAngle1+M_PI/2.0); - } - - // move text away from dimension line: - textPos+=distV; - //// the next update should still be able to adjust this - //// auto text position. leave it invalid + if (data.middleOfText.valid && !forceAutoText) + { + textPos = data.middleOfText; + } + else + { + textPos = dimensionLine->getMiddlepoint(); + + Vector distV; + + // rotate text so it's readable from the bottom or right (ISO) + // quadrant 1 & 4 + if (corrected) + { + distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 - M_PI / 2.0); + } + else + { + distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 + M_PI / 2.0); + } + + // move text away from dimension line: + textPos += distV; + //// the next update should still be able to adjust this + //// auto text position. leave it invalid data.middleOfText = textPos; - } - - textData = RS_TextData(textPos, - dimtxt, 30.0, - RS2::VAlignMiddle, - RS2::HAlignCenter, - RS2::LeftToRight, - RS2::Exact, - 1.0, - getLabel(), - "standard", - textAngle); - - RS_Text* text = new RS_Text(this, textData); - - // move text to the side: - Vector distH; - if (text->getUsedTextWidth()>distance) { - distH.setPolar(text->getUsedTextWidth()/2.0 - +distance/2.0+dimgap, textAngle); - text->move(distH); - } - text->setPen(RS_Pen(RS2::FlagInvalid)); - text->setLayer(NULL); - addEntity(text); + } + + textData = RS_TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter, + RS2::LeftToRight, RS2::Exact, 1.0, getLabel(), "standard", textAngle); + + RS_Text * text = new RS_Text(this, textData); + + // move text to the side: + Vector distH; + + if (text->getUsedTextWidth() > distance) + { + distH.setPolar(text->getUsedTextWidth() / 2.0 + + distance / 2.0 + dimgap, textAngle); + text->move(distH); + } + + text->setPen(RS_Pen(RS2::FlagInvalid)); + text->setLayer(NULL); + addEntity(text); } Vector RS_Dimension::getDefinitionPoint() diff --git a/src/base/rs_dimlinear.cpp b/src/base/rs_dimlinear.cpp index ad32e7d..9797e36 100644 --- a/src/base/rs_dimlinear.cpp +++ b/src/base/rs_dimlinear.cpp @@ -17,7 +17,7 @@ #include "rs_constructionline.h" #include "rs_text.h" #include "rs_solid.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_units.h" /** @@ -91,10 +91,11 @@ QString RS_DimLinear::getMeasuredLabel() // Definitive dimension line: double dist = dimP1.distanceTo(dimP2); - RS_Graphic* graphic = getGraphic(); + Drawing * graphic = getGraphic(); QString ret; - if (graphic!=NULL) + + if (graphic != NULL) { ret = RS_Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); @@ -103,6 +104,8 @@ QString RS_DimLinear::getMeasuredLabel() { ret = QString("%1").arg(dist); } +//It's properly creating the label... +//printf("RS_DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data()); return ret; } diff --git a/src/base/rs_dimradial.cpp b/src/base/rs_dimradial.cpp index 3ac579b..4f18083 100644 --- a/src/base/rs_dimradial.cpp +++ b/src/base/rs_dimradial.cpp @@ -14,7 +14,7 @@ #include "rs_dimradial.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_solid.h" #include "rs_text.h" #include "rs_units.h" @@ -69,7 +69,7 @@ QString RS_DimRadial::getMeasuredLabel() // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint); - RS_Graphic* graphic = getGraphic(); + Drawing* graphic = getGraphic(); QString ret; if (graphic!=NULL) { diff --git a/src/base/rs_ellipse.cpp b/src/base/rs_ellipse.cpp index 8300a18..c3a5cf1 100644 --- a/src/base/rs_ellipse.cpp +++ b/src/base/rs_ellipse.cpp @@ -14,7 +14,7 @@ #include "rs_ellipse.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_graphicview.h" #include "rs_information.h" #include "paintintf.h" diff --git a/src/base/rs_entity.cpp b/src/base/rs_entity.cpp index d633d22..fc7dbea 100644 --- a/src/base/rs_entity.cpp +++ b/src/base/rs_entity.cpp @@ -20,7 +20,7 @@ #include "rs_debug.h" #include "rs_document.h" #include "rs_ellipse.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_graphicview.h" #include "rs_insert.h" #include "rs_layer.h" @@ -426,10 +426,10 @@ void RS_Entity::setParent(RS_EntityContainer * p) * or the parent's parent graphic or NULL if none of the parents * are stored in a graphic. */ -RS_Graphic * RS_Entity::getGraphic() +Drawing * RS_Entity::getGraphic() { if (rtti() == RS2::EntityGraphic) - return (RS_Graphic *)this; + return (Drawing *)this; else if (parent == NULL) return NULL; else @@ -552,7 +552,7 @@ Vector RS_Entity::getSize() const */ void RS_Entity::addGraphicVariable(const QString & key, double val, int code) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL) graphic->addVariable(key, val, code); @@ -566,7 +566,7 @@ void RS_Entity::addGraphicVariable(const QString & key, double val, int code) */ void RS_Entity::addGraphicVariable(const QString & key, int val, int code) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL) graphic->addVariable(key, val, code); @@ -580,7 +580,7 @@ void RS_Entity::addGraphicVariable(const QString & key, int val, int code) */ void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int code) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL) graphic->addVariable(key, val, code); @@ -597,7 +597,7 @@ void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int */ double RS_Entity::getGraphicVariableDouble(const QString & key, double def) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); double ret = def; if (graphic != NULL) @@ -617,7 +617,7 @@ double RS_Entity::getGraphicVariableDouble(const QString & key, double def) */ int RS_Entity::getGraphicVariableInt(const QString & key, int def) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); int ret = def; if (graphic != NULL) @@ -637,7 +637,7 @@ int RS_Entity::getGraphicVariableInt(const QString & key, int def) */ QString RS_Entity::getGraphicVariableString(const QString & key, const QString & def) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); QString ret = def; if (graphic != NULL) @@ -652,7 +652,7 @@ QString RS_Entity::getGraphicVariableString(const QString & key, const QString & */ RS2::Unit RS_Entity::getGraphicUnit() { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); RS2::Unit ret = RS2::None; if (graphic != NULL) @@ -786,7 +786,7 @@ RS_Layer * RS_Entity::getLayer(bool resolve) const */ void RS_Entity::setLayer(const QString & name) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL) layer = graphic->findLayer(name); @@ -809,7 +809,7 @@ void RS_Entity::setLayer(RS_Layer * l) */ void RS_Entity::setLayerToActive() { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL) layer = graphic->getActiveLayer(); @@ -930,7 +930,7 @@ double RS_Entity::getStyleFactor(RS_GraphicView * view) //styleFactor = getStyleFactor(); // the factor caused by the unit: RS2::Unit unit = RS2::None; - RS_Graphic * g = getGraphic(); + Drawing * g = getGraphic(); if (g != NULL) { @@ -949,7 +949,7 @@ double RS_Entity::getStyleFactor(RS_GraphicView * view) if (view->isPrinting() || view->isPrintPreview() || view->isDraftMode() == false) { - RS_Graphic * graphic = getGraphic(); + Drawing * graphic = getGraphic(); if (graphic != NULL && graphic->getPaperScale() > 1.0e-6) styleFactor /= graphic->getPaperScale(); diff --git a/src/base/rs_entity.h b/src/base/rs_entity.h index 74105c6..7764832 100644 --- a/src/base/rs_entity.h +++ b/src/base/rs_entity.h @@ -15,7 +15,7 @@ class RS_Block; class RS_Circle; class RS_Document; class RS_EntityContainer; -class RS_Graphic; +class Drawing; class RS_GraphicView; class RS_Insert; class RS_Line; @@ -59,7 +59,7 @@ class RS_Entity: public RS_Undoable virtual double getLength(); RS_EntityContainer * getParent() const; void setParent(RS_EntityContainer * p); - RS_Graphic * getGraphic(); + Drawing * getGraphic(); RS_Block * getBlock(); RS_Insert * getInsert(); RS_Entity * getBlockOrInsert(); diff --git a/src/base/rs_eventhandler.cpp b/src/base/rs_eventhandler.cpp index 9f68a95..29e0318 100644 --- a/src/base/rs_eventhandler.cpp +++ b/src/base/rs_eventhandler.cpp @@ -220,18 +220,23 @@ void RS_EventHandler::keyPressEvent(QKeyEvent * e) */ void RS_EventHandler::keyReleaseEvent(QKeyEvent* e) { - if (actionIndex>=0 && currentActions[actionIndex]!=NULL && - !currentActions[actionIndex]->isFinished()) { - currentActions[actionIndex]->keyReleaseEvent(e); - } else { - if (defaultAction!=NULL) { - defaultAction->keyReleaseEvent(e); - } - else { + if (actionIndex >= 0 && currentActions[actionIndex] != NULL && + !currentActions[actionIndex]->isFinished()) + { + currentActions[actionIndex]->keyReleaseEvent(e); + } + else + { + if (defaultAction != NULL) + { + defaultAction->keyReleaseEvent(e); + } + else + { e->ignore(); } - //RS_DEBUG->print("currently no action defined"); - } + //RS_DEBUG->print("currently no action defined"); + } } /** @@ -252,7 +257,6 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) if (actionIndex >= 0 && currentActions[actionIndex] != NULL && !currentActions[actionIndex]->isFinished()) { -// int commaPos = cmd.find(','); int commaPos = cmd.indexOf(','); RS_DEBUG->print("RS_EventHandler::commandEvent: 001"); bool ok1, ok2; @@ -461,7 +465,7 @@ void RS_EventHandler::setCurrentAction(RS_ActionInterface * action) return; // Predecessor of the new action or NULL: - RS_ActionInterface* predecessor = NULL; + RS_ActionInterface * predecessor = NULL; // Suspend current action: if (actionIndex >= 0 && currentActions[actionIndex] != NULL @@ -494,14 +498,10 @@ void RS_EventHandler::setCurrentAction(RS_ActionInterface * action) // Move up actionstack (optimize): for(int i=0; iprint("RS_EventHandler::cleanUp"); - - int o=0; // old index - int n=0; // new index - int resume=0; // index of action to resume - bool doResume=false; // do we need to resume an action - actionIndex = -1; - - debugActions(); - do { - // search first used action (o) - while (currentActions[o]==NULL && oprint("RS_EventHandler::cleanUp"); - // delete action if it is finished - if (oisFinished()) { - delete currentActions[o]; - currentActions[o] = NULL; + int o = 0; // old index + int n = 0; // new index + int resume = 0; // index of action to resume + bool doResume = false; // do we need to resume an action + actionIndex = -1; - doResume = true; - } + debugActions(); - // move a running action up in the stack - if (oisFinished()) { - - currentActions[resume]->resume(); - currentActions[resume]->showOptions(); - } else { - if (defaultAction!=NULL) { - defaultAction->resume(); - defaultAction->showOptions(); - } - } - } - RS_DEBUG->print("RS_EventHandler::cleanUp: OK"); + do + { + // search first used action (o) + while (currentActions[o] == NULL && o < RS_MAXACTIONS) + o++; + + // delete action if it is finished + if (o < RS_MAXACTIONS && currentActions[o] != NULL + && currentActions[o]->isFinished()) + { + delete currentActions[o]; + currentActions[o] = NULL; + doResume = true; + } + + // move a running action up in the stack + if (o < RS_MAXACTIONS && currentActions[o] != NULL) + { + if (n != o) + { + currentActions[n] = currentActions[o]; + resume = n; + currentActions[o] = NULL; + } + else + { + if (o < RS_MAXACTIONS) + o++; + } + + actionIndex = n; + + if (n < RS_MAXACTIONS - 1) + n++; + } + } + while (o < RS_MAXACTIONS); + + debugActions(); + + // Resume last used action: + if (doResume) + { + if (currentActions[resume] != NULL && !currentActions[resume]->isFinished()) + { + currentActions[resume]->resume(); + currentActions[resume]->showOptions(); + } + else + { + if (defaultAction != NULL) + { + defaultAction->resume(); + defaultAction->showOptions(); + } + } + } + + RS_DEBUG->print("RS_EventHandler::cleanUp: OK"); } /** diff --git a/src/base/rs_fileio.cpp b/src/base/rs_fileio.cpp index e58d1fb..8d1e9ef 100644 --- a/src/base/rs_fileio.cpp +++ b/src/base/rs_fileio.cpp @@ -91,11 +91,11 @@ RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t) * of the given file. * * @param graphic The container to which we will add - * entities. Usually that's an RS_Graphic entity but + * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... * @param file Path and name of the file to import. */ -bool RS_FileIO::fileImport(RS_Graphic & graphic, const QString & file, RS2::FormatType type) +bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type) { RS_DEBUG->print("Trying to import file '%s'...", file.toLatin1().data()); @@ -145,7 +145,7 @@ bool RS_FileIO::fileImport(RS_Graphic & graphic, const QString & file, RS2::Form * * @param file Path and name of the file to import. */ -bool RS_FileIO::fileExport(RS_Graphic & graphic, const QString & file, RS2::FormatType type) +bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type) { RS_DEBUG->print("RS_FileIO::fileExport"); //RS_DEBUG->print("Trying to export file '%s'...", file.latin1()); diff --git a/src/base/rs_fileio.h b/src/base/rs_fileio.h index 4eeb2c9..320463a 100644 --- a/src/base/rs_fileio.h +++ b/src/base/rs_fileio.h @@ -6,7 +6,7 @@ #define RS_FILEIO RS_FileIO::instance() -class RS_Graphic; +class Drawing; /** * API Class for importing files. @@ -26,10 +26,10 @@ class RS_FileIO RS_FilterInterface * getImportFilter(RS2::FormatType t); RS_FilterInterface * getExportFilter(RS2::FormatType t); - bool fileImport(RS_Graphic & graphic, const QString & file, + bool fileImport(Drawing & graphic, const QString & file, RS2::FormatType type = RS2::FormatUnknown); - bool fileExport(RS_Graphic & graphic, const QString & file, + bool fileExport(Drawing & graphic, const QString & file, RS2::FormatType type = RS2::FormatUnknown); RS2::FormatType detectFormat(const QString & file); diff --git a/src/base/rs_filtercxf.cpp b/src/base/rs_filtercxf.cpp index 887bf5d..b3bbfe4 100644 --- a/src/base/rs_filtercxf.cpp +++ b/src/base/rs_filtercxf.cpp @@ -46,7 +46,7 @@ RS_FilterCXF::~RS_FilterCXF() * will be created or the graphics from which the entities are * taken to be stored in a file. */ -bool RS_FilterCXF::fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/) +bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { RS_DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data()); @@ -104,7 +104,7 @@ bool RS_FilterCXF::fileImport(RS_Graphic & g, const QString & file, RS2::FormatT * * @param file Full path to the CXF file that will be written. */ -bool RS_FilterCXF::fileExport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/) +bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toLatin1().data()); diff --git a/src/base/rs_filtercxf.h b/src/base/rs_filtercxf.h index 7e713d7..85e81dc 100644 --- a/src/base/rs_filtercxf.h +++ b/src/base/rs_filtercxf.h @@ -30,8 +30,8 @@ class RS_FilterCXF: public RS_FilterInterface return (t==RS2::FormatCXF); }*/ - virtual bool fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/); - virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/); + virtual bool fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/); + virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/); void stream(std::ofstream & fs, double value); }; diff --git a/src/base/rs_filterdxf.cpp b/src/base/rs_filterdxf.cpp index 1d2f45c..546d2ea 100644 --- a/src/base/rs_filterdxf.cpp +++ b/src/base/rs_filterdxf.cpp @@ -70,7 +70,7 @@ RS_FilterDXF::~RS_FilterDXF() * will be created or the graphics from which the entities are * taken to be stored in a file. */ -bool RS_FilterDXF::fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/) +bool RS_FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { RS_DEBUG->print("RS_FilterDXF::fileImport"); //RS_DEBUG->timestamp(); @@ -1073,7 +1073,7 @@ void RS_FilterDXF::setVariableVector(const char * key, double v1, double v2, dou // update document's variable list: if (currentContainer->rtti() == RS2::EntityGraphic) - ((RS_Graphic *)currentContainer)->addVariable(QString(key), Vector(v1, v2, v3), code); + ((Drawing *)currentContainer)->addVariable(QString(key), Vector(v1, v2, v3), code); } /** @@ -1088,7 +1088,7 @@ void RS_FilterDXF::setVariableString(const char * key, const char * value, int c // update document's variable list: if (currentContainer->rtti()==RS2::EntityGraphic) { - ((RS_Graphic*)currentContainer)->addVariable(QString(key), + ((Drawing*)currentContainer)->addVariable(QString(key), QString(value), code); } } @@ -1103,7 +1103,7 @@ void RS_FilterDXF::setVariableInt(const char* key, int value, int code) { // update document's variable list: if (currentContainer->rtti()==RS2::EntityGraphic) { - ((RS_Graphic*)currentContainer)->addVariable(QString(key), + ((Drawing*)currentContainer)->addVariable(QString(key), value, code); } } @@ -1119,7 +1119,7 @@ void RS_FilterDXF::setVariableDouble(const char* key, double value, int code) { // update document's variable list: if (currentContainer->rtti() == RS2::EntityGraphic) { - ((RS_Graphic *)currentContainer)->addVariable(QString(key), value, code); + ((Drawing *)currentContainer)->addVariable(QString(key), value, code); } } @@ -1129,7 +1129,7 @@ void RS_FilterDXF::setVariableDouble(const char* key, double value, int code) { * * @param file Full path to the DXF file that will be written. */ -bool RS_FilterDXF::fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type) +bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType type) { RS_DEBUG->print("RS_FilterDXF::fileExport: exporting file '%s'...", (const char *)QFile::encodeName(file)); diff --git a/src/base/rs_filterdxf.h b/src/base/rs_filterdxf.h index 5262b68..ce3d574 100644 --- a/src/base/rs_filterdxf.h +++ b/src/base/rs_filterdxf.h @@ -51,7 +51,7 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface }*/ // Import: - virtual bool fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/); + virtual bool fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/); // Methods from DL_CreationInterface: virtual void addLayer(const DL_LayerData & data); @@ -97,7 +97,7 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface virtual void setVariableDouble(const char * key, double value, int code); // Export: - virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type); + virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type); void writeVariables(DL_WriterA & dw); void writeLayer(DL_WriterA & dw, RS_Layer * l); @@ -156,7 +156,7 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface private: /** Pointer to the graphic we currently operate on. */ - RS_Graphic * graphic; + Drawing * graphic; /** File name. Used to find out the full path of images. */ QString file; /** string for concatinating text parts of MTEXT entities. */ diff --git a/src/base/rs_filterdxf1.cpp b/src/base/rs_filterdxf1.cpp index c046378..3d65ea5 100644 --- a/src/base/rs_filterdxf1.cpp +++ b/src/base/rs_filterdxf1.cpp @@ -44,7 +44,7 @@ RS_FilterDXF1::RS_FilterDXF1(): RS_FilterInterface() * will be created or the graphics from which the entities are * taken to be stored in a file. */ -bool RS_FilterDXF1::fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/) +bool RS_FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/) { RS_DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data()); diff --git a/src/base/rs_filterdxf1.h b/src/base/rs_filterdxf1.h index bb6de80..5f86af5 100644 --- a/src/base/rs_filterdxf1.h +++ b/src/base/rs_filterdxf1.h @@ -36,9 +36,9 @@ public: return false; }*/ - virtual bool fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/); + virtual bool fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/); - virtual bool fileExport(RS_Graphic& /*g*/, const QString& /*file*/, + virtual bool fileExport(Drawing& /*g*/, const QString& /*file*/, RS2::FormatType /*type*/) { RS_DEBUG->print(RS_Debug::D_WARNING, "Exporting of QCad 1.x file not implemented"); @@ -88,7 +88,7 @@ public: protected: /** Pointer to the graphic we currently operate on. */ - RS_Graphic* graphic; + Drawing* graphic; FILE* fPointer; // File pointer char* fBuf; // Filebuffer int fBufP; // Filebuffer-Pointer (walks through 'fBuf') diff --git a/src/base/rs_filterinterface.h b/src/base/rs_filterinterface.h index 3cec636..730203b 100644 --- a/src/base/rs_filterinterface.h +++ b/src/base/rs_filterinterface.h @@ -2,7 +2,7 @@ #define RS_FILTERINTERFACE_H #include -#include "rs_graphic.h" +#include "drawing.h" /** * This is the interface that must be implemented for all @@ -29,14 +29,14 @@ class RS_FilterInterface * class should read a file from disk and put the entities * into the current entity container. */ - virtual bool fileImport(RS_Graphic & g, const QString & file, RS2::FormatType type) = 0; + virtual bool fileImport(Drawing & g, const QString & file, RS2::FormatType type) = 0; /** * The implementation of this method in a inherited format * class should write the entities in the current entity container * to a file on the disk. */ - virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type) = 0; + virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type) = 0; protected: void addImportFormat(RS2::FormatType type); @@ -44,7 +44,7 @@ class RS_FilterInterface protected: //! Pointer to the graphic we currently operate on. - //RS_Graphic* graphic; + //Drawing* graphic; //! Vector of file extensions this filter can import. // Q3ValueList importFormats; diff --git a/src/base/rs_font.h b/src/base/rs_font.h index 515979a..3b6d21c 100644 --- a/src/base/rs_font.h +++ b/src/base/rs_font.h @@ -6,7 +6,7 @@ #include "rs_blocklist.h" /** - * Class for representing a font. This is implemented as a RS_Graphic + * Class for representing a font. This is implemented as a Drawing * with a name (the font name) and several blocks, one for each letter * in the font. * diff --git a/src/base/rs_graphicview.cpp b/src/base/rs_graphicview.cpp index 29ab3f4..28d86c9 100644 --- a/src/base/rs_graphicview.cpp +++ b/src/base/rs_graphicview.cpp @@ -19,7 +19,7 @@ #include "rs_application.h" #include "rs_block.h" #include "rs_eventhandler.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_grid.h" #include "rs_insert.h" #include "rs_layer.h" @@ -122,10 +122,10 @@ void RS_GraphicView::cleanUp() * connected to this view is a graphic and valid. * NULL otherwise. */ -RS_Graphic * RS_GraphicView::getGraphic() +Drawing * RS_GraphicView::getGraphic() { if (container != NULL && container->rtti() == RS2::EntityGraphic) - return (RS_Graphic*)container; + return (Drawing*)container; else return NULL; } @@ -395,7 +395,7 @@ bool RS_GraphicView::isGridOn() { if (container != NULL) { - RS_Graphic * g = container->getGraphic(); + Drawing * g = container->getGraphic(); if (g != NULL) return g->isGridOn(); @@ -592,10 +592,10 @@ void RS_GraphicView::mouseMoveEvent(QMouseEvent * e) { RS_DEBUG->print("RS_GraphicView::mouseMoveEvent begin"); - RS_Graphic * graphic = NULL; + Drawing * graphic = NULL; if (container->rtti() == RS2::EntityGraphic) - graphic = (RS_Graphic *)container; + graphic = (Drawing *)container; RS_DEBUG->print("RS_GraphicView::mouseMoveEvent 001"); @@ -1157,7 +1157,7 @@ void RS_GraphicView::zoomPage() if (simulationRunning) return; - RS_Graphic * graphic = container->getGraphic(); + Drawing * graphic = container->getGraphic(); if (graphic == NULL) return; @@ -1324,7 +1324,7 @@ void RS_GraphicView::setPenForEntity(RS_Entity * e) { double uf = 1.0; // unit factor double wf = 1.0; // width factor - RS_Graphic * graphic = container->getGraphic(); + Drawing * graphic = container->getGraphic(); if (graphic != NULL) { @@ -2096,7 +2096,7 @@ void RS_GraphicView::drawPaper() if (container == NULL) return; - RS_Graphic * graphic = container->getGraphic(); + Drawing * graphic = container->getGraphic(); if (graphic == NULL) return; diff --git a/src/base/rs_graphicview.h b/src/base/rs_graphicview.h index f783388..d4bcdf0 100644 --- a/src/base/rs_graphicview.h +++ b/src/base/rs_graphicview.h @@ -32,7 +32,7 @@ public: void cleanUp(); - RS_Graphic * getGraphic(); + Drawing * getGraphic(); void setDrawingMode(RS2::DrawingMode m); RS2::DrawingMode getDrawingMode(); void setDeleteMode(bool m); diff --git a/src/base/rs_grid.cpp b/src/base/rs_grid.cpp index 61368ed..3f2252a 100644 --- a/src/base/rs_grid.cpp +++ b/src/base/rs_grid.cpp @@ -15,7 +15,7 @@ #include "rs_grid.h" #include "rs_units.h" -#include "rs_graphic.h" +#include "drawing.h" #include "settings.h" /** @@ -51,7 +51,7 @@ void RS_Grid::update() if (!graphicView->isGridOn()) return; - RS_Graphic * graphic = graphicView->getGraphic(); + Drawing * graphic = graphicView->getGraphic(); // auto scale grid? settings.beginGroup("Appearance"); diff --git a/src/base/rs_hatch.cpp b/src/base/rs_hatch.cpp index 4532355..36237db 100644 --- a/src/base/rs_hatch.cpp +++ b/src/base/rs_hatch.cpp @@ -16,7 +16,7 @@ #include #include "rs_graphicview.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_information.h" #include "rs_pattern.h" #include "rs_patternlist.h" diff --git a/src/base/rs_infoarea.cpp b/src/base/rs_infoarea.cpp index bbd304d..a55d751 100644 --- a/src/base/rs_infoarea.cpp +++ b/src/base/rs_infoarea.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_infoarea.cpp 1892 2004-07-09 23:54:59Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_infoarea.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_infoarea.h" diff --git a/src/base/rs_infoarea.h b/src/base/rs_infoarea.h index 7ddafbb..31f3738 100644 --- a/src/base/rs_infoarea.h +++ b/src/base/rs_infoarea.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_infoarea.h 1892 2004-07-09 23:54:59Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_INFOAREA_H #define RS_INFOAREA_H diff --git a/src/base/rs_information.cpp b/src/base/rs_information.cpp index bcb6082..e9ec4d8 100644 --- a/src/base/rs_information.cpp +++ b/src/base/rs_information.cpp @@ -1,52 +1,39 @@ -/**************************************************************************** -** $Id: rs_information.cpp 2378 2005-05-16 17:05:15Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_information.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_information.h" #include "rs_constructionline.h" - /** * Default constructor. * * @param container The container to which we will add - * entities. Usually that's an RS_Graphic entity but + * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ -RS_Information::RS_Information(RS_EntityContainer& container) { - this->container = &container; +RS_Information::RS_Information(RS_EntityContainer& container) +{ + this->container = &container; } - - /** * @return true: if the entity is a dimensioning enity. * false: otherwise */ -bool RS_Information::isDimension(RS2::EntityType type) { +bool RS_Information::isDimension(RS2::EntityType type) +{ if (type==RS2::EntityDimAligned || type==RS2::EntityDimLinear || type==RS2::EntityDimRadial || @@ -137,7 +124,7 @@ bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) { * @param coord Coordinate (typically a mouse coordinate) * * @return the coordinate found or an invalid vector - * if there are no elements at all in this graphics + * if there are no elements at all in this graphics * container. */ Vector RS_Information::getNearestEndpoint(const Vector& coord, @@ -147,16 +134,16 @@ Vector RS_Information::getNearestEndpoint(const Vector& coord, /** - * Gets the nearest point to the given coordinate which is on an entity. + * Gets the nearest point to the given coordinate which is on an entity. * * @param coord Coordinate (typically a mouse coordinate) - * @param dist Pointer to a double which will contain the + * @param dist Pointer to a double which will contain the * measured distance after return or NULL * @param entity Pointer to a pointer which will point to the * entity on which the point is or NULL * * @return the coordinate found or an invalid vector - * if there are no elements at all in this graphics + * if there are no elements at all in this graphics * container. */ Vector RS_Information::getNearestPointOnEntity(const Vector& coord, @@ -172,11 +159,11 @@ Vector RS_Information::getNearestPointOnEntity(const Vector& coord, * Gets the nearest entity to the given coordinate. * * @param coord Coordinate (typically a mouse coordinate) - * @param dist Pointer to a double which will contain the + * @param dist Pointer to a double which will contain the * masured distance after return * @param level Level of resolving entities. * - * @return the entity found or NULL if there are no elements + * @return the entity found or NULL if there are no elements * at all in this graphics container. */ RS_Entity* RS_Information::getNearestEntity(const Vector& coord, @@ -229,8 +216,8 @@ VectorSolutions RS_Information::getIntersection(RS_Entity* e1, RS_Ellipse* ellipse = (RS_Ellipse*)e1; ret = getIntersectionLineEllipse((RS_Line*)e2, ellipse); tol = 1.0e-1; - } - + } + // ellipse / arc, ellipse / ellipse: not supported: else { return ret; @@ -606,7 +593,7 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line, RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1"); Vector ret1(false); Vector ret2(false); - //if ( 0 <= t_a && t_a <= 1 ) { + //if ( 0 <= t_a && t_a <= 1 ) { //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1"); ret1 = a1.lerp(a2, t_a); RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y); @@ -830,4 +817,4 @@ bool RS_Information::isPointInsideContour(const Vector& point, return ((counter%2)==1); } - + diff --git a/src/base/rs_information.h b/src/base/rs_information.h index 3a6fea6..21a9123 100644 --- a/src/base/rs_information.h +++ b/src/base/rs_information.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_information.h 1926 2004-11-20 00:42:21Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_INFORMATION_H #define RS_INFORMATION_H diff --git a/src/base/rs_insert.cpp b/src/base/rs_insert.cpp index 6c17ba4..ec12668 100644 --- a/src/base/rs_insert.cpp +++ b/src/base/rs_insert.cpp @@ -1,33 +1,21 @@ -/**************************************************************************** -** $Id: rs_insert.cpp 2371 2005-04-29 11:44:39Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_insert.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_insert.h" #include "rs_block.h" -#include "rs_graphic.h" +#include "drawing.h" /** * @param parent The graphic this block belongs to. @@ -141,22 +129,22 @@ void RS_Insert::update() if (updateEnabled == false) return; - clear(); + clear(); - RS_Block * blk = getBlockForInsert(); + RS_Block * blk = getBlockForInsert(); if (blk == NULL) { - //return NULL; + //return NULL; RS_DEBUG->print("RS_Insert::update: Block is NULL"); - return; - } + return; + } - if (isUndone()) + if (isUndone()) { RS_DEBUG->print("RS_Insert::update: Insert is in undo list"); - return; - } + return; + } if (fabs(data.scaleFactor.x) < 1.0e-6 || fabs(data.scaleFactor.y) < 1.0e-6) { @@ -164,86 +152,86 @@ void RS_Insert::update() return; } - RS_Pen tmpPen; + RS_Pen tmpPen; /*Q3PtrListIterator it = createIterator(); - RS_Entity* e; - while ( (e = it.current()) != NULL ) { - ++it;*/ + RS_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()); - for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) + for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) { - for(int c=0; cprint("RS_Insert::update: col %d", c); + RS_DEBUG->print("RS_Insert::update: col %d", c); for(int r=0; rprint("RS_Insert::update: row %d", r); + RS_DEBUG->print("RS_Insert::update: row %d", r); - if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate) + if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate) { RS_DEBUG->print("RS_Insert::update: updating sub-insert"); - ((RS_Insert *)e)->update(); - } + ((RS_Insert *)e)->update(); + } RS_DEBUG->print("RS_Insert::update: cloning entity"); - RS_Entity * ne = e->clone(); - ne->initId(); + RS_Entity * ne = e->clone(); + ne->initId(); ne->setUpdateEnabled(false); - ne->setParent(this); - ne->setVisible(getFlag(RS2::FlagVisible)); + ne->setParent(this); + ne->setVisible(getFlag(RS2::FlagVisible)); RS_DEBUG->print("RS_Insert::update: transforming entity"); - // Move: + // Move: 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, + ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c, data.spacing.y / data.scaleFactor.y * r)); } else { - ne->move(data.insertionPoint); + ne->move(data.insertionPoint); } // Move because of block base point: RS_DEBUG->print("RS_Insert::update: move 2"); - ne->move(blk->getBasePoint() * -1); - // Scale: + ne->move(blk->getBasePoint() * -1); + // Scale: RS_DEBUG->print("RS_Insert::update: scale"); - ne->scale(data.insertionPoint, data.scaleFactor); - // Rotate: + ne->scale(data.insertionPoint, data.scaleFactor); + // Rotate: RS_DEBUG->print("RS_Insert::update: rotate"); - ne->rotate(data.insertionPoint, data.angle); - // Select: - ne->setSelected(isSelected()); + ne->rotate(data.insertionPoint, data.angle); + // Select: + ne->setSelected(isSelected()); - // individual entities can be on indiv. layers - tmpPen = ne->getPen(false); + // individual entities can be on indiv. layers + tmpPen = ne->getPen(false); - // color from block (free floating): - if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock)) - tmpPen.setColor(getPen().getColor()); + // color from block (free floating): + if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock)) + tmpPen.setColor(getPen().getColor()); - // line width from block (free floating): - if (tmpPen.getWidth() == RS2::WidthByBlock) - tmpPen.setWidth(getPen().getWidth()); + // line width from block (free floating): + if (tmpPen.getWidth() == RS2::WidthByBlock) + tmpPen.setWidth(getPen().getWidth()); - // line type from block (free floating): - if (tmpPen.getLineType() == RS2::LineByBlock) - tmpPen.setLineType(getPen().getLineType()); + // line type from block (free floating): + if (tmpPen.getLineType() == RS2::LineByBlock) + tmpPen.setLineType(getPen().getLineType()); - // now that we've evaluated all flags, let's strip them: - // TODO: strip all flags (width, line type) - //tmpPen.setColor(tmpPen.getColor().stripFlags()); + // now that we've evaluated all flags, let's strip them: + // TODO: strip all flags (width, line type) + //tmpPen.setColor(tmpPen.getColor().stripFlags()); - ne->setPen(tmpPen); + ne->setPen(tmpPen); ne->setUpdateEnabled(true); @@ -254,10 +242,10 @@ void RS_Insert::update() } RS_DEBUG->print("RS_Insert::update: adding new entity"); - addEntity(ne); - } - } - } + addEntity(ne); + } + } + } calculateBorders(); @@ -383,23 +371,21 @@ void RS_Insert::move(Vector offset) update(); } - - -void RS_Insert::rotate(Vector center, double angle) { +void RS_Insert::rotate(Vector center, double angle) +{ RS_DEBUG->print("RS_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); + data.angle = RS_Math::correctAngle(data.angle + angle); RS_DEBUG->print("RS_Insert::rotate2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } - - -void RS_Insert::scale(Vector center, Vector factor) { +void RS_Insert::scale(Vector center, Vector factor) +{ RS_DEBUG->print("RS_Insert::scale1: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); data.insertionPoint.scale(center, factor); @@ -410,24 +396,22 @@ void RS_Insert::scale(Vector center, Vector factor) { update(); } - - -void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) { - data.insertionPoint.mirror(axisPoint1, axisPoint2); +void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) +{ + data.insertionPoint.mirror(axisPoint1, axisPoint2); Vector vec; vec.setPolar(1.0, data.angle); - vec.mirror(Vector(0.0,0.0), axisPoint2-axisPoint1); + vec.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1); data.angle = vec.angle(); - data.scaleFactor.y*=-1; + data.scaleFactor.y *= -1; update(); } - -std::ostream& operator << (std::ostream& os, const RS_Insert& i) { +std::ostream & operator<<(std::ostream & os, const RS_Insert & i) +{ os << " Insert: " << i.getData() << std::endl; return os; } - diff --git a/src/base/rs_insert.h b/src/base/rs_insert.h index 9b4fdf4..aafb2f4 100644 --- a/src/base/rs_insert.h +++ b/src/base/rs_insert.h @@ -1,35 +1,9 @@ -/**************************************************************************** -** $Id: rs_insert.h 2367 2005-04-04 16:57:36Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_INSERT_H #define RS_INSERT_H #include "rs_entitycontainer.h" #include "rs_block.h" -#include "rs_graphic.h" +#include "drawing.h" /** * Holds the data that defines an insert. diff --git a/src/base/rs_layer.cpp b/src/base/rs_layer.cpp index 725463b..b0f890e 100644 --- a/src/base/rs_layer.cpp +++ b/src/base/rs_layer.cpp @@ -1,32 +1,19 @@ -/**************************************************************************** -** $Id: rs_layer.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_layer.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_layer.h" -//#include #include "rs_color.h" #include "rs_math.h" diff --git a/src/base/rs_layer.h b/src/base/rs_layer.h index 1457382..2b56686 100644 --- a/src/base/rs_layer.h +++ b/src/base/rs_layer.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_layer.h 1822 2004-02-29 00:29:32Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_LAYER_H #define RS_LAYER_H diff --git a/src/base/rs_layerlist.cpp b/src/base/rs_layerlist.cpp index fc79dec..def554b 100644 --- a/src/base/rs_layerlist.cpp +++ b/src/base/rs_layerlist.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_layerlist.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_layerlist.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_layerlist.h" diff --git a/src/base/rs_layerlist.h b/src/base/rs_layerlist.h index 0e2b8fd..1a8a91e 100644 --- a/src/base/rs_layerlist.h +++ b/src/base/rs_layerlist.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_layerlist.h 1869 2004-04-09 19:56:42Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_LAYERLIST_H #define RS_LAYERLIST_H diff --git a/src/base/rs_layerlistlistener.h b/src/base/rs_layerlistlistener.h index 1b0864a..2164979 100644 --- a/src/base/rs_layerlistlistener.h +++ b/src/base/rs_layerlistlistener.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_layerlistlistener.h 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_LAYERLISTLISTENER_H #define RS_LAYERLISTLISTENER_H diff --git a/src/base/rs_leader.cpp b/src/base/rs_leader.cpp index 60f67c9..d2d9f8d 100644 --- a/src/base/rs_leader.cpp +++ b/src/base/rs_leader.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_leader.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_leader.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_leader.h" diff --git a/src/base/rs_leader.h b/src/base/rs_leader.h index 3c124ac..ca60740 100644 --- a/src/base/rs_leader.h +++ b/src/base/rs_leader.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_leader.h 2367 2005-04-04 16:57:36Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_LEADER_H #define RS_LEADER_H diff --git a/src/base/rs_line.cpp b/src/base/rs_line.cpp index 83f3742..8813b3e 100644 --- a/src/base/rs_line.cpp +++ b/src/base/rs_line.cpp @@ -1,9 +1,22 @@ +// rs_line.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_line.h" #include "rs_debug.h" #include "rs_graphicview.h" -#include "rs_graphic.h" +#include "drawing.h" #include "paintintf.h" /** diff --git a/src/base/rs_line.h b/src/base/rs_line.h index 4bcff0f..04a4c86 100644 --- a/src/base/rs_line.h +++ b/src/base/rs_line.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_line.h 1907 2004-09-04 19:56:42Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_LINE_H #define RS_LINE_H diff --git a/src/base/rs_linetypepattern.cpp b/src/base/rs_linetypepattern.cpp index 036e12e..aab37ac 100644 --- a/src/base/rs_linetypepattern.cpp +++ b/src/base/rs_linetypepattern.cpp @@ -1,31 +1,35 @@ -/**************************************************************************** -** $Id: rs_linetypepattern.cpp 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - +// rs_linetypepattern.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_linetypepattern.h" +RS_LineTypePattern::RS_LineTypePattern(int count ...) +{ + va_list ap; + int i = 0; + num = count; + + va_start(ap, count); + pattern = new double[num]; + + for(i=0; i +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_math.h" diff --git a/src/base/rs_math.h b/src/base/rs_math.h index d30912d..b225d69 100644 --- a/src/base/rs_math.h +++ b/src/base/rs_math.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_math.h 2392 2005-05-17 13:52:38Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_MATH_H #define RS_MATH_H diff --git a/src/base/rs_modification.cpp b/src/base/rs_modification.cpp index 1c1b19b..29179b9 100644 --- a/src/base/rs_modification.cpp +++ b/src/base/rs_modification.cpp @@ -1,10 +1,23 @@ +// rs_modification.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_modification.h" #include "rs_clipboard.h" #include "rs_creation.h" #include "rs_entity.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_information.h" #include "rs_insert.h" #include "rs_polyline.h" @@ -15,7 +28,7 @@ * Default constructor. * * @param container The container to which we will add - * entities. Usually that's an RS_Graphic entity but + * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... * @param graphicView Pointer to graphic view or NULL if you don't want the * any views to be updated. @@ -137,7 +150,7 @@ bool RS_Modification::changeAttributes(RS_AttributesData & data) /** * Copies all selected entities from the given container to the clipboard. * Layers and blocks that are needed are also copied if the container is - * or is part of an RS_Graphic. + * or is part of an Drawing. * * @param container The entity container. * @param ref Reference point. The entities will be moved by -ref. @@ -184,7 +197,7 @@ void RS_Modification::copy(const Vector& ref, const bool cut) { /** * Copies the given entity from the given container to the clipboard. * Layers and blocks that are needed are also copied if the container is - * or is part of an RS_Graphic. + * or is part of an Drawing. * * @param e The entity. * @param ref Reference point. The entities will be moved by -ref. @@ -322,13 +335,13 @@ void RS_Modification::copyBlocks(RS_Entity* e) { /** * Pastes all entities from the clipboard into the container. * Layers and blocks that are needed are also copied if the container is - * or is part of an RS_Graphic. + * or is part of an Drawing. * * @param data Paste data. * @param source The source from where to paste. NULL means the source * is the clipboard. */ -void RS_Modification::paste(const RS_PasteData& data, RS_Graphic* source) { +void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { if (graphic==NULL) { RS_DEBUG->print(RS_Debug::D_WARNING, diff --git a/src/base/rs_modification.h b/src/base/rs_modification.h index ba70775..28cdb84 100644 --- a/src/base/rs_modification.h +++ b/src/base/rs_modification.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_modification.h 1946 2004-12-24 19:27:43Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_MODIFICATION_H #define RS_MODIFICATION_H @@ -189,7 +163,7 @@ class RS_PasteData * There's no interaction handled in this class. * * All modifications can be undone / redone if the container - * is a RS_Graphic. + * is a Drawing. * * This class is connected to an entity container and * can be connected to a graphic view. @@ -211,7 +185,7 @@ class RS_Modification public: void copyLayers(RS_Entity * e); void copyBlocks(RS_Entity * e); - void paste(const RS_PasteData & data, RS_Graphic * source = NULL); + void paste(const RS_PasteData & data, Drawing * source = NULL); bool move(RS_MoveData & data); bool rotate(RS_RotateData & data); @@ -259,7 +233,7 @@ class RS_Modification protected: RS_EntityContainer * container; - RS_Graphic * graphic; + Drawing * graphic; RS_Document * document; RS_GraphicView * graphicView; bool handleUndo; diff --git a/src/base/rs_pattern.cpp b/src/base/rs_pattern.cpp index 5952dfa..79f4fac 100644 --- a/src/base/rs_pattern.cpp +++ b/src/base/rs_pattern.cpp @@ -1,35 +1,23 @@ -/**************************************************************************** -** $Id: rs_pattern.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_pattern.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_pattern.h" #include #include "rs_system.h" #include "rs_fileio.h" -#include "rs_graphic.h" +#include "drawing.h" /** * Constructor. @@ -108,7 +96,7 @@ bool RS_Pattern::loadPattern() return false; } - RS_Graphic * gr = new RS_Graphic(); + Drawing * gr = new Drawing(); // TODO: Find out why the new dxf filter doesn't work for patterns: RS_FILEIO->fileImport(*gr, path, RS2::FormatDXF1); diff --git a/src/base/rs_pattern.h b/src/base/rs_pattern.h index c4219e8..98344ec 100644 --- a/src/base/rs_pattern.h +++ b/src/base/rs_pattern.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_pattern.h 1819 2004-02-18 16:03:00Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_PATTERN_H #define RS_PATTERN_H diff --git a/src/base/rs_patternlist.cpp b/src/base/rs_patternlist.cpp index defd47a..8095a72 100644 --- a/src/base/rs_patternlist.cpp +++ b/src/base/rs_patternlist.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_patternlist.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_patternlist.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_patternlist.h" diff --git a/src/base/rs_patternlist.h b/src/base/rs_patternlist.h index 734d266..f5c1061 100644 --- a/src/base/rs_patternlist.h +++ b/src/base/rs_patternlist.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_patternlist.h 1915 2004-09-20 12:08:35Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_PATTERNLIST_H #define RS_PATTERNLIST_H diff --git a/src/base/rs_pen.h b/src/base/rs_pen.h index 4dcf7d9..21b3729 100644 --- a/src/base/rs_pen.h +++ b/src/base/rs_pen.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_pen.h 1760 2003-10-13 19:52:37Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_PEN_H #define RS_PEN_H diff --git a/src/base/rs_point.cpp b/src/base/rs_point.cpp index b9725ff..be98cc5 100644 --- a/src/base/rs_point.cpp +++ b/src/base/rs_point.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_point.cpp 1907 2004-09-04 19:56:42Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_point.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_point.h" diff --git a/src/base/rs_point.h b/src/base/rs_point.h index 20e36ee..be314e0 100644 --- a/src/base/rs_point.h +++ b/src/base/rs_point.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_point.h 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_POINT_H #define RS_POINT_H diff --git a/src/base/rs_polyline.cpp b/src/base/rs_polyline.cpp index 4c868e1..80a0232 100644 --- a/src/base/rs_polyline.cpp +++ b/src/base/rs_polyline.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_polyline.cpp 1959 2005-03-08 14:09:02Z js $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_polyline.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/01/2010 Added this text. :-) +// #include "rs_polyline.h" diff --git a/src/base/rs_polyline.h b/src/base/rs_polyline.h index daa303e..778700f 100644 --- a/src/base/rs_polyline.h +++ b/src/base/rs_polyline.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_polyline.h 2367 2005-04-04 16:57:36Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_POLYLINE_H #define RS_POLYLINE_H diff --git a/src/base/rs_preview.cpp b/src/base/rs_preview.cpp index b6f4268..f2d9bc0 100644 --- a/src/base/rs_preview.cpp +++ b/src/base/rs_preview.cpp @@ -1,5 +1,6 @@ -// preview.cpp +// rs_preview.cpp // +// 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 diff --git a/src/base/rs_previewactioninterface.cpp b/src/base/rs_previewactioninterface.cpp index e34da9e..eb6a5c2 100644 --- a/src/base/rs_previewactioninterface.cpp +++ b/src/base/rs_previewactioninterface.cpp @@ -1,3 +1,16 @@ +// rs_previewactioninterface.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_previewactioninterface.h" diff --git a/src/base/rs_python.cpp b/src/base/rs_python.cpp index 49b2cdd..aadbd9c 100644 --- a/src/base/rs_python.cpp +++ b/src/base/rs_python.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_python.cpp 1741 2003-09-30 22:50:17Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_python.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_python.h" @@ -101,7 +89,7 @@ int RS_Python::launch(const QString& script) { Py_XDECREF(mod); } else { printf("*** ERROR LOADING SCRIPT '%s' ***\n", script.latin1()); - PyErr_Print(); + PyErr_Print(); } Py_XDECREF(modname); //Py_Finalize(); diff --git a/src/base/rs_python.h b/src/base/rs_python.h index 4c0f2cc..cea41f9 100644 --- a/src/base/rs_python.h +++ b/src/base/rs_python.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_python.h 1960 2005-03-12 12:22:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_PYTHON_H #define RS_PYTHON_H @@ -31,7 +5,7 @@ #include "Python.h" -#include "rs_graphic.h" +#include "drawing.h" #define RS_PYTHON RS_Python::instance() @@ -49,11 +23,11 @@ private: public: static RS_Python* instance(); - void setGraphic(RS_Graphic* g) { + void setGraphic(Drawing* g) { graphic = g; } - RS_Graphic* getGraphic() { + Drawing* getGraphic() { return graphic; } @@ -61,7 +35,7 @@ public: private: static RS_Python* uniqueInstance; - RS_Graphic* graphic; + Drawing* graphic; }; #endif diff --git a/src/base/rs_python_wrappers.cpp b/src/base/rs_python_wrappers.cpp index b805b62..9af577a 100644 --- a/src/base/rs_python_wrappers.cpp +++ b/src/base/rs_python_wrappers.cpp @@ -40,7 +40,7 @@ using namespace boost::python; #include "rs_entitycontainer.h" #include "rs_entity.h" #include "rs_flags.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_image.h" #include "rs_insert.h" #include "rs_layer.h" @@ -52,7 +52,7 @@ using namespace boost::python; #include "rs_vector.h" /* Global root functions */ -RS_Graphic* currentGraphic() { return RS_PYTHON->getGraphic(); } +Drawing* currentGraphic() { return RS_PYTHON->getGraphic(); } /* more to be added later (access to global properties, all documents, creation of new documents, ... */ @@ -118,7 +118,7 @@ namespace QString_Python_Conversions { void fname(container& cont, std::auto_ptr obj) \ { cont.addfunc(obj.get()); obj.release(); } -TRANSFER_OWNERSHIP_FUNCTION(RS_Graphic_addLayer, RS_Graphic, addLayer, RS_Layer) +TRANSFER_OWNERSHIP_FUNCTION(Drawing_addLayer, Drawing, addLayer, RS_Layer) TRANSFER_OWNERSHIP_FUNCTION(RS_LayerList_add, RS_LayerList, add, RS_Layer) #define ADDVERTEX_FUNCTION(fname, entity) \ @@ -139,8 +139,8 @@ void (RS_LayerList::*RS_LayerList_activate_string)(const QString&) = &RS_LayerLi void (RS_LayerList::*RS_LayerList_activate_layer)(RS_Layer*) = &RS_LayerList::activate; void (RS_LayerList::*RS_LayerList_toggle_string)(const QString&) = &RS_LayerList::toggle; void (RS_LayerList::*RS_LayerList_toggle_layer)(const QString&) = &RS_LayerList::toggle; -void (RS_Graphic::*RS_Graphic_toggleLayer_string)(const QString&) = &RS_Graphic::toggleLayer; -void (RS_Graphic::*RS_Graphic_toggleLayer_layer)(RS_Layer*) = &RS_Graphic::toggleLayer; +void (Drawing::*Drawing_toggleLayer_string)(const QString&) = &Drawing::toggleLayer; +void (Drawing::*Drawing_toggleLayer_layer)(RS_Layer*) = &Drawing::toggleLayer; void (RS_Entity::*RS_Entity_setLayer_string)(const QString&) = &RS_Entity::setLayer; void (RS_Entity::*RS_Entity_setLayer_layer)(RS_Layer*) = &RS_Entity::setLayer; @@ -382,16 +382,16 @@ BOOST_PYTHON_MODULE(qcad) .add_property("filename", &RS_Document::getFilename) ; - class_ >("Graphic", init()) - .def("count", &RS_Graphic::count) - .def("findLayer", &RS_Graphic::findLayer, return_value_policy()) - .def("editLayer", &RS_Graphic::editLayer) - .def("addLayer", RS_Graphic_addLayer) - .def("removeLayer", &RS_Graphic::removeLayer) - .def("toggleLayer", RS_Graphic_toggleLayer_string) - .def("toggleLayer", RS_Graphic_toggleLayer_layer) - .def("clearLayers", &RS_Graphic::clearLayers) - .def("freezeAllLayers", &RS_Graphic::freezeAllLayers) + class_ >("Graphic", init()) + .def("count", &Drawing::count) + .def("findLayer", &Drawing::findLayer, return_value_policy()) + .def("editLayer", &Drawing::editLayer) + .def("addLayer", Drawing_addLayer) + .def("removeLayer", &Drawing::removeLayer) + .def("toggleLayer", Drawing_toggleLayer_string) + .def("toggleLayer", Drawing_toggleLayer_layer) + .def("clearLayers", &Drawing::clearLayers) + .def("freezeAllLayers", &Drawing::freezeAllLayers) ; /* Entity types */ diff --git a/src/base/rs_script.cpp b/src/base/rs_script.cpp index e2cb16f..e9de814 100644 --- a/src/base/rs_script.cpp +++ b/src/base/rs_script.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_script.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_script.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_script.h" diff --git a/src/base/rs_script.h b/src/base/rs_script.h index 807916c..9db7d02 100644 --- a/src/base/rs_script.h +++ b/src/base/rs_script.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_script.h 1960 2005-03-12 12:22:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SCRIPT_H #define RS_SCRIPT_H diff --git a/src/base/rs_scriptlist.cpp b/src/base/rs_scriptlist.cpp index 6c289b4..b1f4e86 100644 --- a/src/base/rs_scriptlist.cpp +++ b/src/base/rs_scriptlist.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_scriptlist.cpp 1960 2005-03-12 12:22:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_scriptlist.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_scriptlist.h" diff --git a/src/base/rs_scriptlist.h b/src/base/rs_scriptlist.h index b955767..c3de735 100644 --- a/src/base/rs_scriptlist.h +++ b/src/base/rs_scriptlist.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_scriptlist.h 1960 2005-03-12 12:22:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SCRIPTLIST_H #define RS_SCRIPTLIST_H diff --git a/src/base/rs_selection.cpp b/src/base/rs_selection.cpp index 14e8153..046775b 100644 --- a/src/base/rs_selection.cpp +++ b/src/base/rs_selection.cpp @@ -1,16 +1,29 @@ +// rs_selection.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_selection.h" #include "rs_information.h" #include "rs_polyline.h" #include "rs_entity.h" -#include "rs_graphic.h" +#include "drawing.h" /** * Default constructor. * * @param container The container to which we will add - * entities. Usually that's an RS_Graphic entity but + * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ RS_Selection::RS_Selection(RS_EntityContainer & container, RS_GraphicView * graphicView) @@ -67,6 +80,11 @@ void RS_Selection::selectAll(bool select) graphicView->redraw(); } +void RS_Selection::deselectAll() +{ + selectAll(false); +} + /** * Selects all entities on visible layers. */ @@ -111,6 +129,11 @@ void RS_Selection::selectWindow(const Vector & v1, const Vector & v2, bool selec graphicView->redraw(); } +void RS_Selection::deselectWindow(const Vector & v1, const Vector & v2) +{ + selectWindow(v1, v2, false); +} + /** * Selects all entities that are intersected by the given line. * @@ -171,6 +194,11 @@ void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool } } +void RS_Selection::deselectIntersected(const Vector & v1, const Vector & v2) +{ + selectIntersected(v1, v2, false); +} + /** * Selects all entities that are connected to the given entity. * @@ -294,3 +322,8 @@ void RS_Selection::selectLayer(const QString & layerName, bool select) } } } + +void RS_Selection::deselectLayer(QString & layerName) +{ + selectLayer(layerName, false); +} diff --git a/src/base/rs_selection.h b/src/base/rs_selection.h index c888e04..d1239e1 100644 --- a/src/base/rs_selection.h +++ b/src/base/rs_selection.h @@ -1,78 +1,42 @@ -/**************************************************************************** -** $Id: rs_selection.h 1868 2004-04-05 23:12:06Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SELECTION_H #define RS_SELECTION_H #include "rs_entitycontainer.h" #include "rs_graphicview.h" - - /** - * API Class for selecting entities. + * API Class for selecting entities. * There's no interaction handled in this class. * This class is connected to an entity container and * can be connected to a graphic view. * * @author Andrew Mustun */ -class RS_Selection { -public: - RS_Selection(RS_EntityContainer& entityContainer, - RS_GraphicView* graphicView=NULL); - - void selectSingle(RS_Entity* e); - void selectAll(bool select=true); - void deselectAll() { - selectAll(false); - } - void invertSelection(); - void selectWindow(const Vector& v1, const Vector& v2, - bool select=true, bool cross=false); - void deselectWindow(const Vector& v1, const Vector& v2) { - selectWindow(v1, v2, false); - } - void selectIntersected(const Vector& v1, const Vector& v2, - bool select=true); - void deselectIntersected(const Vector& v1, const Vector& v2) { - selectIntersected(v1, v2, false); - } - void selectContour(RS_Entity* e); - - void selectLayer(RS_Entity* e); - void selectLayer(const QString& layerName, bool select=true); - void deselectLayer(QString& layerName) { - selectLayer(layerName, false); - } - -protected: - RS_EntityContainer* container; - RS_Graphic* graphic; - RS_GraphicView* graphicView; +class RS_Selection +{ + public: + RS_Selection(RS_EntityContainer & entityContainer, + RS_GraphicView * graphicView = NULL); + + void selectSingle(RS_Entity * e); + void selectAll(bool select = true); + void deselectAll(); + void invertSelection(); + void selectWindow(const Vector & v1, const Vector & v2, + bool select = true, bool cross = false); + void deselectWindow(const Vector & v1, const Vector & v2); + void selectIntersected(const Vector & v1, const Vector & v2, + bool select = true); + void deselectIntersected(const Vector & v1, const Vector & v2); + void selectContour(RS_Entity * e); + void selectLayer(RS_Entity * e); + void selectLayer(const QString & layerName, bool select = true); + void deselectLayer(QString & layerName); + + protected: + RS_EntityContainer * container; + Drawing * graphic; + RS_GraphicView * graphicView; }; #endif diff --git a/src/base/rs_simplepython.cpp b/src/base/rs_simplepython.cpp index a25563d..99ad24b 100644 --- a/src/base/rs_simplepython.cpp +++ b/src/base/rs_simplepython.cpp @@ -1,29 +1,16 @@ -/**************************************************************************** -** $Id: rs_simplepython.cpp 1775 2003-11-02 12:20:46Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - +// rs_simplepython.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #ifdef RS_OPT_SIMPLEPYTHON #include "rs_simplepython.h" @@ -91,7 +78,7 @@ int RS_SimplePython::launch(const QString& script) { /** - * A test method exposed to Python + * A test method exposed to Python */ long inc(long i) { printf("c: inc called\n"); @@ -117,7 +104,7 @@ void rsPyAddLine(double x1, double y1, double x2, double y2) { //printf("c: addLine called\n"); //printf("c: parameter from python: %f\n", x1); - RS_Graphic* graphic = RS_SIMPLEPYTHON->getGraphic(); + Drawing* graphic = RS_SIMPLEPYTHON->getGraphic(); if (graphic!=NULL) { graphic->addEntity(new RS_Line(graphic, RS_LineData(RS_Vector(x1, y1), diff --git a/src/base/rs_simplepython.h b/src/base/rs_simplepython.h index ca03bb3..9466165 100644 --- a/src/base/rs_simplepython.h +++ b/src/base/rs_simplepython.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_simplepython.h 1960 2005-03-12 12:22:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SIMPLEPYTHON_H #define RS_SIMPLEPYTHON_H @@ -31,7 +5,7 @@ #include "Python.h" -#include "rs_graphic.h" +#include "drawing.h" #define RS_SIMPLEPYTHON RS_SimplePython::instance() @@ -42,33 +16,35 @@ * * @author Andrew Mustun */ -class RS_SimplePython { -private: - RS_SimplePython() { - graphic = NULL; - } +class RS_SimplePython +{ + private: + RS_SimplePython() + { + graphic = NULL; + } -public: - static RS_SimplePython* instance(); + public: + static RS_SimplePython * instance(); - void setGraphic(RS_Graphic* g) { - graphic = g; - } + void setGraphic(Drawing* g) + { + graphic = g; + } - RS_Graphic* getGraphic() { - return graphic; - } + Drawing * getGraphic() + { + return graphic; + } - int launch(const QString& script); + int launch(const QString& script); -private: - static RS_SimplePython* uniqueInstance; + private: + static RS_SimplePython * uniqueInstance; - RS_Graphic* graphic; + Drawing * graphic; }; - - /** * Global method needed by the python lib for initialisation. */ diff --git a/src/base/rs_snapper.cpp b/src/base/rs_snapper.cpp index e670a08..1ee3007 100644 --- a/src/base/rs_snapper.cpp +++ b/src/base/rs_snapper.cpp @@ -1,5 +1,6 @@ // rs_snapper.cpp // +// 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 @@ -15,7 +16,7 @@ #include "rs_dialogfactory.h" #include "rs_entitycontainer.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_graphicview.h" #include "rs_grid.h" #include "rs_information.h" diff --git a/src/base/rs_solid.cpp b/src/base/rs_solid.cpp index 0b447a7..2badd75 100644 --- a/src/base/rs_solid.cpp +++ b/src/base/rs_solid.cpp @@ -1,61 +1,47 @@ -/**************************************************************************** -** $Id: rs_solid.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_solid.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_solid.h" #include "rs_graphicview.h" -//#include "rs_painter.h" #include "paintintf.h" /** * Default constructor. */ -RS_Solid::RS_Solid(RS_EntityContainer* parent, - const RS_SolidData& d) - :RS_AtomicEntity(parent), data(d) { - calculateBorders(); +RS_Solid::RS_Solid(RS_EntityContainer * parent, const RS_SolidData& d): + RS_AtomicEntity(parent), data(d) +{ + calculateBorders(); } - - /** * @return Corner number 'num'. */ -Vector RS_Solid::getCorner(int num) { - if (num>=0 && num<4) { - return data.corner[num]; - } else { - RS_DEBUG->print("Illegal corner requested from Solid", - RS_Debug::D_WARNING); - return Vector(false); - } +Vector RS_Solid::getCorner(int num) +{ + if (num >= 0 && num < 4) + { + return data.corner[num]; + } + else + { + RS_DEBUG->print("Illegal corner requested from Solid", RS_Debug::D_WARNING); + return Vector(false); + } } - - /** * Shapes this Solid into a standard arrow (used in dimensions). * @@ -63,157 +49,139 @@ Vector RS_Solid::getCorner(int num) { * @param angle Direction of the arrow. * @param arrowSize Size of arrow (length). */ -void RS_Solid::shapeArrow(const Vector& point, - double angle, - double arrowSize) { - - double cosv1, sinv1, cosv2, sinv2; - double arrowSide = arrowSize/cos(0.165); +void RS_Solid::shapeArrow(const Vector & point, double angle, double arrowSize) +{ + double cosv1, sinv1, cosv2, sinv2; + double arrowSide = arrowSize/cos(0.165); - cosv1 = cos(angle+0.165)*arrowSide; - sinv1 = sin(angle+0.165)*arrowSide; - cosv2 = cos(angle-0.165)*arrowSide; - sinv2 = sin(angle-0.165)*arrowSide; + cosv1 = cos(angle+0.165)*arrowSide; + sinv1 = sin(angle+0.165)*arrowSide; + cosv2 = cos(angle-0.165)*arrowSide; + sinv2 = sin(angle-0.165)*arrowSide; - data.corner[0] = point; - data.corner[1] = Vector(point.x - cosv1, point.y - sinv1); - data.corner[2] = Vector(point.x - cosv2, point.y - sinv2); - data.corner[3] = Vector(false); + data.corner[0] = point; + data.corner[1] = Vector(point.x - cosv1, point.y - sinv1); + data.corner[2] = Vector(point.x - cosv2, point.y - sinv2); + data.corner[3] = Vector(false); - calculateBorders(); + calculateBorders(); } +void RS_Solid::calculateBorders() +{ + resetBorders(); - -void RS_Solid::calculateBorders() { - resetBorders(); - - for (int i=0; i<4; ++i) { - if (data.corner[i].valid) { - minV = Vector::minimum(minV, data.corner[i]); - maxV = Vector::maximum(maxV, data.corner[i]); - } - } + for(int i=0; i<4; ++i) + { + if (data.corner[i].valid) + { + minV = Vector::minimum(minV, data.corner[i]); + maxV = Vector::maximum(maxV, data.corner[i]); + } + } } +Vector RS_Solid::getNearestEndpoint(const Vector & coord, double * dist) +{ + double minDist = RS_MAXDOUBLE; + double curDist; + Vector ret; + for (int i=0; i<4; ++i) + { + if (data.corner[i].valid) + { + curDist = data.corner[i].distanceTo(coord); -Vector RS_Solid::getNearestEndpoint(const Vector& coord, double* dist) { - - double minDist = RS_MAXDOUBLE; - double curDist; - Vector ret; - - for (int i=0; i<4; ++i) { - if (data.corner[i].valid) { - curDist = data.corner[i].distanceTo(coord); - if (curDist +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_spline.h" #include "rs_debug.h" #include "rs_graphicview.h" -#include "rs_graphic.h" +#include "drawing.h" #include "paintintf.h" /** diff --git a/src/base/rs_spline.h b/src/base/rs_spline.h index eccb2be..5927ddf 100644 --- a/src/base/rs_spline.h +++ b/src/base/rs_spline.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_spline.h 1914 2004-09-19 11:05:34Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SPLINE_H #define RS_SPLINE_H diff --git a/src/base/rs_staticgraphicview.cpp b/src/base/rs_staticgraphicview.cpp index e5dac4d..1972704 100644 --- a/src/base/rs_staticgraphicview.cpp +++ b/src/base/rs_staticgraphicview.cpp @@ -1,26 +1,20 @@ -/***************************************************************************** -** $Id: rs_staticgraphicview.cpp 1686 2003-08-25 22:50:31Z andrew $ -** -** This is part of the QCad Qt GUI -** Copyright (C) 2001 Andrew Mustun -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -******************************************************************************/ +// rs_staticgraphicview.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_staticgraphicview.h" -#include "rs_graphic.h" +#include "drawing.h" /** * Constructor. diff --git a/src/base/rs_staticgraphicview.h b/src/base/rs_staticgraphicview.h index 1124c5d..180c213 100644 --- a/src/base/rs_staticgraphicview.h +++ b/src/base/rs_staticgraphicview.h @@ -1,23 +1,3 @@ -/***************************************************************************** -** $Id: rs_staticgraphicview.h 1686 2003-08-25 22:50:31Z andrew $ -** -** This is part of the QCad Qt GUI -** Copyright (C) 2001 Andrew Mustun -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -******************************************************************************/ - #ifndef RS_STATICGRAPHICVIEW_H #define RS_STATICGRAPHICVIEW_H diff --git a/src/base/rs_text.cpp b/src/base/rs_text.cpp index 3b44ae2..56a8cf7 100644 --- a/src/base/rs_text.cpp +++ b/src/base/rs_text.cpp @@ -23,9 +23,9 @@ */ RS_Text::RS_Text(RS_EntityContainer * parent, const RS_TextData & d): RS_EntityContainer(parent), data(d) { - usedTextHeight = 0.0; - usedTextWidth = 0.0; - setText(data.text); + usedTextHeight = 0.0; + usedTextWidth = 0.0; + setText(data.text); } /*virtual*/ RS_Text::~RS_Text() @@ -59,15 +59,17 @@ RS_TextData RS_Text::getData() const */ int RS_Text::getNumberOfLines() { - int c=1; + int c = 1; - for (int i=0; i<(int)data.text.length(); ++i) { - if (data.text.at(i).unicode()==0x0A) { - c++; - } - } + for(int i=0; i<(int)data.text.length(); ++i) + { + if (data.text.at(i).unicode() == 0x0A) + { + c++; + } + } - return c; + return c; } /** @@ -77,186 +79,181 @@ int RS_Text::getNumberOfLines() */ void RS_Text::update() { - RS_DEBUG->print("RS_Text::update"); - - clear(); - - if (isUndone()) { - return; - } - - usedTextWidth = 0.0; - usedTextHeight = 0.0; - - RS_Font* font = RS_FONTLIST->requestFont(data.style); - - if (font==NULL) { - return; - } - - Vector letterPos = Vector(0.0, -9.0); - Vector letterSpace = Vector(font->getLetterSpacing(), 0.0); - Vector space = Vector(font->getWordSpacing(), 0.0); - int lineCounter = 0; - - // Every single text line gets stored in this entity container - // so we can move the whole line around easely: - RS_EntityContainer* oneLine = new RS_EntityContainer(this); - - // First every text line is created with - // alignement: top left - // angle: 0 - // height: 9.0 - // Rotation, scaling and centering is done later - - // For every letter: - for (int i=0; i<(int)data.text.length(); ++i) { - switch (data.text.at(i).unicode()) { - case 0x0A: - // line feed: - updateAddLine(oneLine, lineCounter++); - oneLine = new RS_EntityContainer(this); - letterPos = Vector(0.0, -9.0); - break; - - case 0x20: - // Space: - letterPos+=space; - break; - - case 0x5C: { - // code (e.g. \S, \P, ..) - i++; - int ch = data.text.at(i).unicode(); - switch (ch) { - case 'P': - updateAddLine(oneLine, lineCounter++); - oneLine = new RS_EntityContainer(this); - letterPos = Vector(0.0, -9.0); - break; - - case 'S': { - QString up; - QString dw; - //letterPos += letterSpace; - - // get upper string: - i++; - while (data.text.at(i).unicode()!='^' && - //data.text.at(i).unicode()!='/' && - data.text.at(i).unicode()!='\\' && - //data.text.at(i).unicode()!='#' && - i<(int)data.text.length()) { - up += data.text.at(i); - i++; - } - - i++; - - if (data.text.at(i-1).unicode()=='^' && - data.text.at(i).unicode()==' ') { - i++; - } - - // get lower string: - while (data.text.at(i).unicode()!=';' && - i<(int)data.text.length()) { - dw += data.text.at(i); - i++; - } - - // add texts: - RS_Text* upper = - new RS_Text( - oneLine, - RS_TextData(letterPos + Vector(0.0,9.0), - 4.0, 100.0, RS2::VAlignTop, - RS2::HAlignLeft, - RS2::LeftToRight, RS2::Exact, - 1.0, up, data.style, - 0.0, RS2::Update)); - upper->setLayer(NULL); - upper->setPen(RS_Pen(RS2::FlagInvalid)); - oneLine->addEntity(upper); - - RS_Text* lower = - new RS_Text( - oneLine, - RS_TextData(letterPos+Vector(0.0,4.0), - 4.0, 100.0, RS2::VAlignTop, - RS2::HAlignLeft, - RS2::LeftToRight, RS2::Exact, - 1.0, dw, data.style, - 0.0, RS2::Update)); - lower->setLayer(NULL); - lower->setPen(RS_Pen(RS2::FlagInvalid)); - oneLine->addEntity(lower); - - // move cursor: - upper->calculateBorders(); - lower->calculateBorders(); - - double w1 = upper->getSize().x; - double w2 = lower->getSize().x; - - if (w1>w2) { - letterPos += Vector(w1, 0.0); - } else { - letterPos += Vector(w2, 0.0); - } - letterPos += letterSpace; - } - break; - - default: - break; - } - } - break; - - default: { - // One Letter: - if (font->findLetter(QString(data.text.at(i))) != NULL) { - - RS_DEBUG->print("RS_Text::update: insert a " - "letter at pos: %f/%f", letterPos.x, letterPos.y); - - RS_InsertData d(QString(data.text.at(i)), - letterPos, - Vector(1.0, 1.0), - 0.0, - 1,1, Vector(0.0,0.0), - font->getLetterList(), RS2::NoUpdate); - - RS_Insert* letter = new RS_Insert(this, d); - Vector letterWidth; - letter->setPen(RS_Pen(RS2::FlagInvalid)); - letter->setLayer(NULL); - letter->update(); - letter->forcedCalculateBorders(); - - // until 2.0.4.5: - //letterWidth = Vector(letter->getSize().x, 0.0); - // from 2.0.4.6: - letterWidth = Vector(letter->getMax().x-letterPos.x, 0.0); - - oneLine->addEntity(letter); - - // next letter position: - letterPos += letterWidth; - letterPos += letterSpace; - } - } - break; - } - } - - updateAddLine(oneLine, lineCounter); - usedTextHeight -= data.height*data.lineSpacingFactor*1.6 - - data.height; - forcedCalculateBorders(); - - RS_DEBUG->print("RS_Text::update: OK"); + RS_DEBUG->print("RS_Text::update"); + + clear(); + + if (isUndone()) + return; + + usedTextWidth = 0.0; + usedTextHeight = 0.0; + + RS_Font * font = RS_FONTLIST->requestFont(data.style); + + if (font == NULL) + return; + + Vector letterPos = Vector(0.0, -9.0); + Vector letterSpace = Vector(font->getLetterSpacing(), 0.0); + Vector space = Vector(font->getWordSpacing(), 0.0); + int lineCounter = 0; + + // Every single text line gets stored in this entity container + // so we can move the whole line around easely: + RS_EntityContainer * oneLine = new RS_EntityContainer(this); + + // First every text line is created with + // alignement: top left + // angle: 0 + // height: 9.0 + // Rotation, scaling and centering is done later + + // For every letter: + for(int i=0; i<(int)data.text.length(); ++i) + { + switch (data.text.at(i).unicode()) + { + case 0x0A: + // line feed: + updateAddLine(oneLine, lineCounter++); + oneLine = new RS_EntityContainer(this); + letterPos = Vector(0.0, -9.0); + break; + + case 0x20: + // Space: + letterPos += space; + break; + + case 0x5C: + { + // code (e.g. \S, \P, ..) + i++; + int ch = data.text.at(i).unicode(); + + switch (ch) + { + case 'P': + updateAddLine(oneLine, lineCounter++); + oneLine = new RS_EntityContainer(this); + letterPos = Vector(0.0, -9.0); + break; + + case 'S': + { + QString up; + QString dw; + //letterPos += letterSpace; + + // get upper string: + i++; + while (data.text.at(i).unicode() != '^' + && data.text.at(i).unicode() != '\\' + && i < (int)data.text.length()) + { + up += data.text.at(i); + i++; + } + + i++; + + if (data.text.at(i - 1).unicode() == '^' + && data.text.at(i).unicode() == ' ') + { + i++; + } + + // get lower string: + while (data.text.at(i).unicode() != ';' && i < (int)data.text.length()) + { + dw += data.text.at(i); + i++; + } + + // add texts: + RS_Text * upper = new RS_Text(oneLine, + RS_TextData(letterPos + Vector(0.0, 9.0), + 4.0, 100.0, RS2::VAlignTop, + RS2::HAlignLeft, + RS2::LeftToRight, RS2::Exact, + 1.0, up, data.style, + 0.0, RS2::Update)); + upper->setLayer(NULL); + upper->setPen(RS_Pen(RS2::FlagInvalid)); + oneLine->addEntity(upper); + + RS_Text * lower = new RS_Text(oneLine, + RS_TextData(letterPos+Vector(0.0, 4.0), + 4.0, 100.0, RS2::VAlignTop, + RS2::HAlignLeft, + RS2::LeftToRight, RS2::Exact, + 1.0, dw, data.style, + 0.0, RS2::Update)); + lower->setLayer(NULL); + lower->setPen(RS_Pen(RS2::FlagInvalid)); + oneLine->addEntity(lower); + + // move cursor: + upper->calculateBorders(); + lower->calculateBorders(); + + double w1 = upper->getSize().x; + double w2 = lower->getSize().x; + + if (w1 > w2) + letterPos += Vector(w1, 0.0); + else + letterPos += Vector(w2, 0.0); + + letterPos += letterSpace; + } + break; + + default: + break; + } + } + break; + + default: + { + // One Letter: + if (font->findLetter(QString(data.text.at(i))) != NULL) + { + RS_DEBUG->print("RS_Text::update: insert a " + "letter at pos: %f/%f", letterPos.x, letterPos.y); + + RS_InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0), + 0.0, 1,1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate); + + RS_Insert * letter = new RS_Insert(this, d); + letter->setPen(RS_Pen(RS2::FlagInvalid)); + letter->setLayer(NULL); + letter->update(); + letter->forcedCalculateBorders(); + + // until 2.0.4.5: + //letterWidth = Vector(letter->getSize().x, 0.0); + // from 2.0.4.6: + Vector letterWidth = Vector(letter->getMax().x - letterPos.x, 0.0); + + oneLine->addEntity(letter); + + // next letter position: + letterPos += letterWidth; + letterPos += letterSpace; + } + } + break; + } + } + + updateAddLine(oneLine, lineCounter); + usedTextHeight -= data.height * data.lineSpacingFactor * 1.6 - data.height; + forcedCalculateBorders(); + + RS_DEBUG->print("RS_Text::update: OK"); } /** @@ -268,75 +265,73 @@ void RS_Text::update() */ void RS_Text::updateAddLine(RS_EntityContainer* textLine, int lineCounter) { - RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x); + RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x); //textLine->forcedCalculateBorders(); - //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x); + //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x); - // Move to correct line position: - textLine->move(Vector(0.0, -9.0 * lineCounter - * data.lineSpacingFactor * 1.6)); + // Move to correct line position: + textLine->move(Vector(0.0, -9.0 * lineCounter * data.lineSpacingFactor * 1.6)); textLine->forcedCalculateBorders(); Vector textSize = textLine->getSize(); RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textSize.x); - // Horizontal Align: - switch (data.halign) { - case RS2::HAlignCenter: - RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x/2.0); - textLine->move(Vector(-textSize.x/2.0, 0.0)); - break; + // Horizontal Align: + switch (data.halign) + { + case RS2::HAlignCenter: + RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x / 2.0); + textLine->move(Vector(-textSize.x / 2.0, 0.0)); + break; - case RS2::HAlignRight: - textLine->move(Vector(-textSize.x, 0.0)); - break; + case RS2::HAlignRight: + textLine->move(Vector(-textSize.x, 0.0)); + break; - default: - break; - } + default: + break; + } - // Vertical Align: - double vSize = getNumberOfLines()*9.0*data.lineSpacingFactor*1.6 - - (9.0*data.lineSpacingFactor*1.6 - 9.0); + // Vertical Align: + double vSize = getNumberOfLines() * 9.0 * data.lineSpacingFactor * 1.6 - (9.0 * data.lineSpacingFactor * 1.6 - 9.0); - switch (data.valign) { - case RS2::VAlignMiddle: - textLine->move(Vector(0.0, vSize/2.0)); - break; + switch (data.valign) + { + case RS2::VAlignMiddle: + textLine->move(Vector(0.0, vSize / 2.0)); + break; - case RS2::VAlignBottom: - textLine->move(Vector(0.0, vSize)); - break; + case RS2::VAlignBottom: + textLine->move(Vector(0.0, vSize)); + break; - default: - break; - } + default: + break; + } - // Scale: - textLine->scale(Vector(0.0,0.0), - Vector(data.height/9.0, data.height/9.0)); + // Scale: + textLine->scale(Vector(0.0, 0.0), Vector(data.height / 9.0, data.height / 9.0)); - textLine->forcedCalculateBorders(); + textLine->forcedCalculateBorders(); - // Update actual text size (before rotating, after scaling!): - if (textLine->getSize().x>usedTextWidth) { - usedTextWidth = textLine->getSize().x; - } + // Update actual text size (before rotating, after scaling!): + if (textLine->getSize().x > usedTextWidth) + usedTextWidth = textLine->getSize().x; - usedTextHeight += data.height*data.lineSpacingFactor*1.6; + usedTextHeight += data.height * data.lineSpacingFactor * 1.6; - // Rotate: - textLine->rotate(Vector(0.0,0.0), data.angle); + // Rotate: + textLine->rotate(Vector(0.0, 0.0), data.angle); - // Move: - textLine->move(data.insertionPoint); - textLine->setPen(RS_Pen(RS2::FlagInvalid)); - textLine->setLayer(NULL); - textLine->forcedCalculateBorders(); + // Move: + textLine->move(data.insertionPoint); + textLine->setPen(RS_Pen(RS2::FlagInvalid)); + textLine->setLayer(NULL); + textLine->forcedCalculateBorders(); - addEntity(textLine); + addEntity(textLine); } Vector RS_Text::getInsertionPoint() @@ -577,84 +572,86 @@ Vector RS_Text::getNearestRef(const Vector & coord, double * dist) void RS_Text::move(Vector offset) { - data.insertionPoint.move(offset); - update(); + data.insertionPoint.move(offset); + update(); } void RS_Text::rotate(Vector center, double angle) { - data.insertionPoint.rotate(center, angle); - data.angle = RS_Math::correctAngle(data.angle+angle); - update(); + data.insertionPoint.rotate(center, angle); + data.angle = RS_Math::correctAngle(data.angle + angle); + update(); } void RS_Text::scale(Vector center, Vector factor) { - data.insertionPoint.scale(center, factor); - data.width*=factor.x; - data.height*=factor.x; - update(); + data.insertionPoint.scale(center, factor); + data.width *= factor.x; + data.height *= factor.x; + update(); } void RS_Text::mirror(Vector axisPoint1, Vector axisPoint2) { - data.insertionPoint.mirror(axisPoint1, axisPoint2); - //double ang = axisPoint1.angleTo(axisPoint2); - bool readable = RS_Math::isAngleReadable(data.angle); - - Vector vec; - vec.setPolar(1.0, data.angle); - vec.mirror(Vector(0.0,0.0), axisPoint2-axisPoint1); - data.angle = vec.angle(); - - bool corr; - data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr); - - if (corr) { - if (data.halign==RS2::HAlignLeft) { - data.halign=RS2::HAlignRight; - } else if (data.halign==RS2::HAlignRight) { - data.halign=RS2::HAlignLeft; - } - } else { - if (data.valign==RS2::VAlignTop) { - data.valign=RS2::VAlignBottom; - } else if (data.valign==RS2::VAlignBottom) { - data.valign=RS2::VAlignTop; - } - } - update(); + data.insertionPoint.mirror(axisPoint1, axisPoint2); + //double ang = axisPoint1.angleTo(axisPoint2); + bool readable = RS_Math::isAngleReadable(data.angle); + + Vector vec; + vec.setPolar(1.0, data.angle); + vec.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1); + data.angle = vec.angle(); + + bool corr; + data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr); + + if (corr) + { + if (data.halign == RS2::HAlignLeft) + { + data.halign = RS2::HAlignRight; + } + else if (data.halign == RS2::HAlignRight) + { + data.halign = RS2::HAlignLeft; + } + } + else + { + if (data.valign == RS2::VAlignTop) + { + data.valign = RS2::VAlignBottom; + } + else if (data.valign == RS2::VAlignBottom) + { + data.valign = RS2::VAlignTop; + } + } + + update(); } bool RS_Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/) { - return false; + return false; } - - /** * Implementations must stretch the given range of the entity * by the given offset. */ -void RS_Text::stretch(Vector firstCorner, - Vector secondCorner, - Vector offset) { - - if (getMin().isInWindow(firstCorner, secondCorner) && - getMax().isInWindow(firstCorner, secondCorner)) { - - move(offset); - } +void RS_Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +{ + if (getMin().isInWindow(firstCorner, secondCorner) + && getMax().isInWindow(firstCorner, secondCorner)) + move(offset); } - - /** * Dumps the point's data to stdout. */ -std::ostream& operator << (std::ostream& os, const RS_Text& p) { - os << " Text: " << p.getData() << "\n"; - return os; +std::ostream & operator<<(std::ostream & os, const RS_Text & p) +{ + os << " Text: " << p.getData() << "\n"; + return os; } - diff --git a/src/base/rs_undo.cpp b/src/base/rs_undo.cpp index 7ccad08..d653713 100644 --- a/src/base/rs_undo.cpp +++ b/src/base/rs_undo.cpp @@ -1,3 +1,16 @@ +// rs_undo.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_undo.h" diff --git a/src/base/rs_undo.h b/src/base/rs_undo.h index b643aee..701f06f 100644 --- a/src/base/rs_undo.h +++ b/src/base/rs_undo.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_undo.h 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_UNDO_H #define RS_UNDO_H diff --git a/src/base/rs_undoable.cpp b/src/base/rs_undoable.cpp index 84f10b5..a371e60 100644 --- a/src/base/rs_undoable.cpp +++ b/src/base/rs_undoable.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_undoable.cpp 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_undoable.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 06/02/2010 Added this text. :-) +// #include "rs_undoable.h" diff --git a/src/base/rs_undocycle.cpp b/src/base/rs_undocycle.cpp index fe63ea1..65c8798 100644 --- a/src/base/rs_undocycle.cpp +++ b/src/base/rs_undocycle.cpp @@ -1,5 +1,6 @@ -// undocycle.h +// rs_undocycle.cpp // +// 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 diff --git a/src/base/rs_units.cpp b/src/base/rs_units.cpp index 7b7bcd6..ddeae90 100644 --- a/src/base/rs_units.cpp +++ b/src/base/rs_units.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_units.cpp 1938 2004-12-09 23:09:53Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_units.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 05/05/2010 Moved implementation from header to this file. :-) +// #include "rs_units.h" diff --git a/src/base/rs_units.h b/src/base/rs_units.h index c8f0eaf..a10c54f 100644 --- a/src/base/rs_units.h +++ b/src/base/rs_units.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_units.h 1877 2004-05-15 09:09:21Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_UNITS_H #define RS_UNITS_H diff --git a/src/base/rs_utility.cpp b/src/base/rs_utility.cpp index 6d3d6c9..51790c9 100644 --- a/src/base/rs_utility.cpp +++ b/src/base/rs_utility.cpp @@ -1,28 +1,16 @@ -/**************************************************************************** -** $Id: rs_utility.cpp 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +// rs_utility.cpp +// +// 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 +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JLH 05/05/2010 Moved implementation from header to this file. :-) +// #include "rs_utility.h" diff --git a/src/base/rs_utility.h b/src/base/rs_utility.h index 1a970be..7ca446d 100644 --- a/src/base/rs_utility.h +++ b/src/base/rs_utility.h @@ -1,34 +1,6 @@ -/**************************************************************************** -** $Id: rs_utility.h 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - - #ifndef RS_UTILITY_H #define RS_UTILITY_H -//#include "rs_string.h" #include /** diff --git a/src/base/rs_variable.cpp b/src/base/rs_variable.cpp index e6670be..06648d9 100644 --- a/src/base/rs_variable.cpp +++ b/src/base/rs_variable.cpp @@ -1,5 +1,6 @@ // rs_variable.cpp // +// 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 diff --git a/src/base/rs_variable.h b/src/base/rs_variable.h index 657f240..74b180d 100644 --- a/src/base/rs_variable.h +++ b/src/base/rs_variable.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_variable.h 1648 2003-06-11 06:56:01Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_VARIABLE_H #define RS_VARIABLE_H diff --git a/src/base/vector.h b/src/base/vector.h index 9bd429a..b57d259 100644 --- a/src/base/vector.h +++ b/src/base/vector.h @@ -3,8 +3,6 @@ #include // Needed for 'friend ostream' below -//#include "rs.h" - /** * Represents a 3d vector (x/y/z) * diff --git a/src/forms/coordinatewidget.cpp b/src/forms/coordinatewidget.cpp index fd13656..bce0b02 100644 --- a/src/forms/coordinatewidget.cpp +++ b/src/forms/coordinatewidget.cpp @@ -14,7 +14,7 @@ #include "coordinatewidget.h" -#include "rs_graphic.h" +#include "drawing.h" #include "settings.h" #include "rs_units.h" @@ -55,7 +55,7 @@ CoordinateWidget::~CoordinateWidget() { } -void CoordinateWidget::setGraphic(RS_Graphic * graphic) +void CoordinateWidget::setGraphic(Drawing * graphic) { this->graphic = graphic; setCoordinates(Vector(0.0, 0.0), Vector(0.0, 0.0), true); diff --git a/src/forms/coordinatewidget.h b/src/forms/coordinatewidget.h index ee228a5..1dfee98 100644 --- a/src/forms/coordinatewidget.h +++ b/src/forms/coordinatewidget.h @@ -4,7 +4,7 @@ #include "ui_coordinatewidget.h" #include "rs.h" -class RS_Graphic; +class Drawing; class Vector; class CoordinateWidget: public QWidget @@ -16,12 +16,12 @@ class CoordinateWidget: public QWidget ~CoordinateWidget(); public slots: - void setGraphic(RS_Graphic * graphic); + void setGraphic(Drawing * graphic); void setCoordinates(const Vector & abs, const Vector & rel, bool updateFormat); void setCoordinates(double x, double y, double rx, double ry, bool updateFormat); private: - RS_Graphic * graphic; + Drawing * graphic; int prec; RS2::LinearFormat format; int aprec; diff --git a/src/forms/dlgattributes.cpp b/src/forms/dlgattributes.cpp index a36bc19..83c3a18 100644 --- a/src/forms/dlgattributes.cpp +++ b/src/forms/dlgattributes.cpp @@ -35,7 +35,7 @@ void DlgAttributes::setData(RS_AttributesData * data, RS_LayerList & layerList) //pen = line->getPen(); ui.wPen->setPen(data->pen, true, true, "Pen"); - //RS_Graphic* graphic = line->getGraphic(); + //Drawing* graphic = line->getGraphic(); //if (graphic!=NULL) { ui.cbLayer->init(layerList, false, true); //} diff --git a/src/forms/dlgoptionsdrawing.cpp b/src/forms/dlgoptionsdrawing.cpp index b498ad5..320777a 100644 --- a/src/forms/dlgoptionsdrawing.cpp +++ b/src/forms/dlgoptionsdrawing.cpp @@ -16,7 +16,7 @@ #include "rs.h" #include "rs_debug.h" #include "rs_filterdxf.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_math.h" #include "rs_units.h" #include "vector.h" @@ -126,7 +126,7 @@ DlgOptionsDrawing::~DlgOptionsDrawing() /** * Sets the graphic and updates the GUI to match the drawing. */ -void DlgOptionsDrawing::setGraphic(RS_Graphic * g) +void DlgOptionsDrawing::setGraphic(Drawing * g) { graphic = g; diff --git a/src/forms/dlgoptionsdrawing.h b/src/forms/dlgoptionsdrawing.h index 92d76bc..c0c7103 100644 --- a/src/forms/dlgoptionsdrawing.h +++ b/src/forms/dlgoptionsdrawing.h @@ -3,7 +3,7 @@ #include "ui_dlgoptionsdrawing.h" -class RS_Graphic; +class Drawing; class DlgOptionsDrawing: public QDialog { @@ -14,7 +14,7 @@ class DlgOptionsDrawing: public QDialog ~DlgOptionsDrawing(); public slots: - void setGraphic(RS_Graphic * g); + void setGraphic(Drawing * g); void validate(); void updateLengthPrecision(); void updateAnglePrecision(); @@ -24,7 +24,7 @@ class DlgOptionsDrawing: public QDialog private: QStringList listPrec1; - RS_Graphic * graphic; + Drawing * graphic; private: Ui::DlgOptionsDrawing ui; diff --git a/src/forms/librarywidget.cpp b/src/forms/librarywidget.cpp index 193914e..77f2b78 100644 --- a/src/forms/librarywidget.cpp +++ b/src/forms/librarywidget.cpp @@ -14,7 +14,7 @@ #include "librarywidget.h" -#include "rs_graphic.h" +#include "drawing.h" #include "rs_staticgraphicview.h" #include "rs_system.h" #include "paintintf.h" @@ -385,7 +385,7 @@ QString LibraryWidget::getPathToPixmap(const QString & dir, const QString & dxfF qpntr.eraseRect(0, 0, 128, 128); RS_StaticGraphicView gv(128, 128, painter); - RS_Graphic graphic; + Drawing graphic; if (graphic.open(dxfPath, RS2::FormatUnknown)) { diff --git a/src/mainapp/main.cpp b/src/mainapp/main.cpp index 3c0a154..5bbc2eb 100644 --- a/src/mainapp/main.cpp +++ b/src/mainapp/main.cpp @@ -366,7 +366,7 @@ QStringList handleArgs(int argc, char * argv[]) if (machine.isEmpty() == false && input.isEmpty() == false && output.isEmpty() == false) { RS_FilterCAM fc; - RS_Graphic gr; + Drawing gr; RS_FILEIO->fileImport(gr, input, RS2::FormatUnknown); RS_CamDialog dlg(gr, NULL); dlg.activateMachineGenerator(machine); diff --git a/src/mainapp/qc_applicationwindow.cpp b/src/mainapp/qc_applicationwindow.cpp index 6aea084..1c76255 100644 --- a/src/mainapp/qc_applicationwindow.cpp +++ b/src/mainapp/qc_applicationwindow.cpp @@ -1872,7 +1872,7 @@ void QC_ApplicationWindow::slotCamExportAuto() { RS_Document* d = getDocument(); if (d!=NULL) { - RS_Graphic* graphic = (RS_Graphic*)d; + Drawing* graphic = (Drawing*)d; RS_CamDialog dlg(graphic, this); dlg.exec(); @@ -1931,7 +1931,7 @@ QC_MDIWindow * QC_ApplicationWindow::slotFileNew(RS_Document * doc) // only graphics offer block lists, blocks don't RS_DEBUG->print(" adding listeners"); - RS_Graphic * graphic = w->getDocument()->getGraphic(); + Drawing * graphic = w->getDocument()->getGraphic(); if (graphic != NULL) { @@ -2358,7 +2358,7 @@ bool QC_ApplicationWindow::slotFileExport(const QString & name, const QString & return false; } - RS_Graphic * graphic = w->getDocument()->getGraphic(); + Drawing * graphic = w->getDocument()->getGraphic(); if (graphic == NULL) { @@ -2490,7 +2490,7 @@ void QC_ApplicationWindow::slotFilePrint() return; } - RS_Graphic * graphic = w->getDocument()->getGraphic(); + Drawing * graphic = w->getDocument()->getGraphic(); if (graphic == NULL) { @@ -2632,7 +2632,7 @@ void QC_ApplicationWindow::slotFilePrintPreview(bool on) // only graphics offer block lists, blocks don't RS_DEBUG->print(" adding listeners"); - RS_Graphic * graphic = w->getDocument()->getGraphic(); + Drawing * graphic = w->getDocument()->getGraphic(); if (graphic != NULL) { @@ -2711,7 +2711,7 @@ void QC_ApplicationWindow::slotViewGrid(bool toggle) if (m != NULL) { - RS_Graphic * g = m->getGraphic(); + Drawing * g = m->getGraphic(); if (g != NULL) g->setGridOn(toggle); @@ -2734,7 +2734,7 @@ void QC_ApplicationWindow::slotViewDraft(bool toggle) /*QC_MDIWindow* m = getMDIWindow(); if (m!=NULL) { - RS_Graphic* g = m->getGraphic(); + Drawing* g = m->getGraphic(); if (g!=NULL) { g->setDraftOn(toggle); } @@ -3384,7 +3384,7 @@ void QC_ApplicationWindow::slotTestDrawFreehand() { RS_DEBUG->print("QC_ApplicationWindow::slotTestDrawFreehand()"); - //RS_Graphic* g = document->getMarking(); + //Drawing* g = document->getMarking(); /* RS_ActionDrawLineFree* action = @@ -3445,7 +3445,7 @@ void QC_ApplicationWindow::slotTestInsertBlock() if (d != NULL && d->rtti() == RS2::EntityGraphic) { - RS_Graphic * graphic = (RS_Graphic *)d; + Drawing * graphic = (Drawing *)d; if (graphic == NULL) return; @@ -3546,7 +3546,7 @@ void QC_ApplicationWindow::slotTestInsertEllipse() if (d != NULL) { - RS_Graphic * graphic = (RS_Graphic *)d; + Drawing * graphic = (Drawing *)d; if (graphic == NULL) return; @@ -3688,7 +3688,7 @@ void QC_ApplicationWindow::slotTestInsertText() if (d != NULL) { - RS_Graphic * graphic = (RS_Graphic *)d; + Drawing * graphic = (Drawing *)d; if (graphic == NULL) return; @@ -3791,7 +3791,7 @@ void QC_ApplicationWindow::slotTestInsertImage() if (d != NULL) { - RS_Graphic * graphic = (RS_Graphic *)d; + Drawing * graphic = (Drawing *)d; if (graphic == NULL) return; @@ -3818,7 +3818,7 @@ void QC_ApplicationWindow::slotTestUnicode() slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF); RS_Document* d = getDocument(); if (d!=NULL) { - RS_Graphic* graphic = (RS_Graphic*)d; + Drawing* graphic = (Drawing*)d; if (graphic==NULL) { return; } @@ -3876,7 +3876,7 @@ void QC_ApplicationWindow::slotTestMath01() RS_Document* d = getDocument(); if (d!=NULL) { - RS_Graphic* graphic = (RS_Graphic*)d; + Drawing* graphic = (Drawing*)d; if (graphic==NULL) { return; } diff --git a/src/mainapp/qc_mdiwindow.cpp b/src/mainapp/qc_mdiwindow.cpp index 90ae5ee..f1173f8 100644 --- a/src/mainapp/qc_mdiwindow.cpp +++ b/src/mainapp/qc_mdiwindow.cpp @@ -224,7 +224,7 @@ void QC_MDIWindow::initDoc(RS_Document * doc) if (doc == NULL) { - document = new RS_Graphic(); + document = new Drawing(); document->newDoc(); owner = true; } @@ -487,7 +487,7 @@ RS_Document * QC_MDIWindow::getDocument() } /** @return Pointer to graphic or NULL */ -RS_Graphic * QC_MDIWindow::getGraphic() +Drawing * QC_MDIWindow::getGraphic() { return document->getGraphic(); } diff --git a/src/mainapp/qc_mdiwindow.h b/src/mainapp/qc_mdiwindow.h index e0dd414..e07ed7f 100644 --- a/src/mainapp/qc_mdiwindow.h +++ b/src/mainapp/qc_mdiwindow.h @@ -39,7 +39,7 @@ class QC_MDIWindow: public QMdiSubWindow public: QC_GraphicView * getGraphicView(); RS_Document * getDocument(); - RS_Graphic * getGraphic(); + Drawing * getGraphic(); RS_EventHandler * getEventHandler(); void addChildWindow(QC_MDIWindow * w); diff --git a/src/widgets/qg_dialogfactory.cpp b/src/widgets/qg_dialogfactory.cpp index e267e6a..f698cdb 100644 --- a/src/widgets/qg_dialogfactory.cpp +++ b/src/widgets/qg_dialogfactory.cpp @@ -14,12 +14,15 @@ #include "qg_dialogfactory.h" +#include "qg_layerwidget.h" +#include "qg_mainwindowinterface.h" +#include "rs_actiondimlinear.h" +#include "rs_actioninterface.h" +#include "rs_document.h" #include "rs_patternlist.h" #include "settings.h" #include "rs_system.h" -#include "rs_actioninterface.h" -#include "rs_document.h" -#include "rs_actiondimlinear.h" +#include "rs_text.h" #if 0 #include "ui/qg_arcoptions.h" @@ -98,9 +101,6 @@ #include "rs_camdialog.h" #endif -#include "qg_layerwidget.h" -#include "qg_mainwindowinterface.h" - //QG_DialogFactory* QG_DialogFactory::uniqueInstance = NULL; /** @@ -1877,9 +1877,179 @@ bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data) return false; } +/** + * Shows a dialog to edit the given entity. + */ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity) { - return false; + if (entity == NULL) + return false; + + bool ret = false; + + switch (entity->rtti()) + { +//NOTE: These #if 0's are put here until these missing dialogs can be ported to Qt4. +#if 0 + case RS2::EntityPoint: + { + QG_DlgPoint dlg(parent); + dlg.setPoint(*((RS_Point *)entity)); + + if (dlg.exec()) + { + dlg.updatePoint(); + ret = true; + } + } + break; + + case RS2::EntityLine: + { + QG_DlgLine dlg(parent); + dlg.setLine(*((RS_Line *)entity)); + + if (dlg.exec()) + { + dlg.updateLine(); + ret = true; + } + } + break; + + case RS2::EntityArc: + { + QG_DlgArc dlg(parent); + dlg.setArc(*((RS_Arc *)entity)); + + if (dlg.exec()) + { + dlg.updateArc(); + ret = true; + } + } + break; + + case RS2::EntityCircle: + { + QG_DlgCircle dlg(parent); + dlg.setCircle(*((RS_Circle *)entity)); + + if (dlg.exec()) + { + dlg.updateCircle(); + ret = true; + } + } + break; + + case RS2::EntityEllipse: + { + QG_DlgEllipse dlg(parent); + dlg.setEllipse(*((RS_Ellipse *)entity)); + + if (dlg.exec()) + { + dlg.updateEllipse(); + ret = true; + } + } + break; + + case RS2::EntitySpline: + { + QG_DlgSpline dlg(parent); + dlg.setSpline(*((RS_Spline *)entity)); + + if (dlg.exec()) + { + dlg.updateSpline(); + ret = true; + } + } + break; + + case RS2::EntityInsert: + { + QG_DlgInsert dlg(parent); + dlg.setInsert(*((RS_Insert *)entity)); + + if (dlg.exec()) + { + dlg.updateInsert(); + ret = true; + entity->update(); + } + } + break; + + case RS2::EntityDimAligned: + case RS2::EntityDimAngular: + case RS2::EntityDimDiametric: + case RS2::EntityDimRadial: + { + QG_DlgDimension dlg(parent); + dlg.setDim(*((RS_Dimension *)entity)); + + if (dlg.exec()) + { + dlg.updateDim(); + ret = true; + ((RS_Dimension *)entity)->update(true); + } + } + break; + + case RS2::EntityDimLinear: + { + QG_DlgDimLinear dlg(parent); + dlg.setDim(*((RS_DimLinear *)entity)); + + if (dlg.exec()) + { + dlg.updateDim(); + ret = true; + ((RS_DimLinear *)entity)->update(true); + } + } + break; +#endif + + case RS2::EntityText: + { + DlgText dlg(parent); + dlg.setText(*((RS_Text *)entity), false); + + if (dlg.exec()) + { + dlg.updateText(); + ret = true; + ((RS_Text *)entity)->update(); + } + } + break; + +#if 0 + case RS2::EntityHatch: + { + QG_DlgHatch dlg(parent); + dlg.setHatch(*((RS_Hatch *)entity), false); + + if (dlg.exec()) + { + dlg.updateHatch(); + ret = true; + ((RS_Hatch *)entity)->update(); + } + } + break; +#endif + + default: + break; + } + + return ret; } /* @@ -1918,7 +2088,7 @@ bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch) /** * Shows a dialog for CAM options. */ -bool QG_DialogFactory::requestCamOptionsDialog(RS_Graphic& graphic) +bool QG_DialogFactory::requestCamOptionsDialog(Drawing& graphic) { RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog"); RS_CamDialog dlg(graphic, parent); @@ -1947,7 +2117,7 @@ void QG_DialogFactory::requestOptionsGeneralDialog() /** * Shows dialog for drawing options. */ -void QG_DialogFactory::requestOptionsDrawingDialog(RS_Graphic & graphic) +void QG_DialogFactory::requestOptionsDrawingDialog(Drawing & graphic) { DlgOptionsDrawing dlg(parent); dlg.setGraphic(&graphic); diff --git a/src/widgets/qg_dialogfactory.h b/src/widgets/qg_dialogfactory.h index 5fff2cf..aee54b5 100644 --- a/src/widgets/qg_dialogfactory.h +++ b/src/widgets/qg_dialogfactory.h @@ -106,11 +106,11 @@ class QG_DialogFactory: public RS_DialogFactoryInterface virtual bool requestHatchDialog(RS_Hatch * hatch); #ifdef RS_CAM - virtual bool requestCamOptionsDialog(RS_Graphic & graphic); + virtual bool requestCamOptionsDialog(Drawing & graphic); #endif virtual void requestOptionsGeneralDialog(); - virtual void requestOptionsDrawingDialog(RS_Graphic & graphic); + virtual void requestOptionsDrawingDialog(Drawing & graphic); virtual void requestPreviousMenu(); diff --git a/src/widgets/qg_filedialog.cpp b/src/widgets/qg_filedialog.cpp index dabf93f..26e1b69 100644 --- a/src/widgets/qg_filedialog.cpp +++ b/src/widgets/qg_filedialog.cpp @@ -17,7 +17,7 @@ #include "qg_graphicview.h" #include "settings.h" #include "rs_system.h" -#include "rs_graphic.h" +#include "drawing.h" /** * Shows a dialog for choosing a file name. Saving the file is up to @@ -200,7 +200,7 @@ QString QG_FileDialog::getOpenFileName(QWidget * parent, RS2::FormatType * type) fileDlg->selectNameFilter(defFilter); // preview: - RS_Graphic * gr = new RS_Graphic; + Drawing * gr = new Drawing; QG_GraphicView * prev = new QG_GraphicView(parent); prev->setContainer(gr); prev->setBorders(1, 1, 1, 1); diff --git a/src/widgets/qg_graphicview.cpp b/src/widgets/qg_graphicview.cpp index b7d010c..c26d8af 100644 --- a/src/widgets/qg_graphicview.cpp +++ b/src/widgets/qg_graphicview.cpp @@ -19,7 +19,7 @@ #include "rs_actionzoomscroll.h" #include "rs_actionmodifydelete.h" #include "rs_actionselectsingle.h" -#include "rs_graphic.h" +#include "drawing.h" #include "settings.h" #include "rs_system.h" #include "rs_patternlist.h" @@ -1010,13 +1010,13 @@ of VectorWorks & etc. as well... */ void QG_GraphicView::previewUrl(const Q3Url & u) { - //static RS_Graphic* gr = new RS_Graphic(); + //static Drawing* gr = new Drawing(); RS_DEBUG->print("QG_GraphicView::previewUrl"); if (container != NULL && container->rtti() == RS2::EntityGraphic) { - ((RS_Graphic *)container)->open(u.path(), RS2::FormatUnknown); + ((Drawing *)container)->open(u.path(), RS2::FormatUnknown); zoomAuto(); } //setContainer(gr); -- 2.37.2