From 16354e0421b316a62c6b9f7b0b4f3b8cf6f06284 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Fri, 10 Sep 2010 06:02:12 +0000 Subject: [PATCH] Removed unnecessary RS_ prefix from classes and whatnot. --- architektonas.pro | 9 +- src/actions/actionblocksadd.cpp | 10 +- src/actions/actionblocksadd.h | 2 +- src/actions/actionblocksattributes.cpp | 12 +- src/actions/actionblocksattributes.h | 2 +- src/actions/actionblockscreate.cpp | 26 +- src/actions/actionblockscreate.h | 2 +- src/actions/actionblocksedit.cpp | 10 +- src/actions/actionblocksedit.h | 2 +- src/actions/actionblocksexplode.cpp | 4 +- src/actions/actionblocksexplode.h | 2 +- src/actions/actionblocksfreezeall.cpp | 4 +- src/actions/actionblocksfreezeall.h | 2 +- src/actions/actionblocksinsert.cpp | 82 +- src/actions/actionblocksinsert.h | 8 +- src/actions/actionblocksremove.cpp | 22 +- src/actions/actionblocksremove.h | 2 +- src/actions/actionblockstoggleview.cpp | 6 +- src/actions/actionblockstoggleview.h | 2 +- src/actions/actiondefault.cpp | 80 +- src/actions/actiondefault.h | 4 +- src/actions/actiondimaligned.cpp | 52 +- src/actions/actiondimaligned.h | 6 +- src/actions/actiondimangular.cpp | 48 +- src/actions/actiondimangular.h | 12 +- src/actions/actiondimdiametric.cpp | 60 +- src/actions/actiondimdiametric.h | 10 +- src/actions/actiondimension.cpp | 18 +- src/actions/actiondimension.h | 4 +- src/actions/actiondimleader.cpp | 36 +- src/actions/actiondimleader.h | 6 +- src/actions/actiondimlinear.cpp | 74 +- src/actions/actiondimlinear.h | 6 +- src/actions/actiondimradial.cpp | 56 +- src/actions/actiondimradial.h | 10 +- src/actions/actiondrawarc.cpp | 118 +-- src/actions/actiondrawarc.h | 6 +- src/actions/actiondrawarc3p.cpp | 30 +- src/actions/actiondrawarc3p.h | 6 +- src/actions/actiondrawarctangential.cpp | 40 +- src/actions/actiondrawarctangential.h | 10 +- src/actions/actiondrawcircle.cpp | 46 +- src/actions/actiondrawcircle.h | 6 +- src/actions/actiondrawcircle2p.cpp | 32 +- src/actions/actiondrawcircle2p.h | 6 +- src/actions/actiondrawcircle3p.cpp | 26 +- src/actions/actiondrawcircle3p.h | 6 +- src/actions/actiondrawcirclecr.cpp | 38 +- src/actions/actiondrawcirclecr.h | 6 +- src/actions/actiondrawellipseaxis.cpp | 84 +- src/actions/actiondrawellipseaxis.h | 4 +- src/actions/actiondrawhatch.cpp | 38 +- src/actions/actiondrawhatch.h | 6 +- src/actions/actiondrawimage.cpp | 58 +- src/actions/actiondrawimage.h | 6 +- src/actions/actiondrawline.cpp | 80 +- src/actions/actiondrawline.h | 6 +- src/actions/actiondrawlineangle.cpp | 50 +- src/actions/actiondrawlineangle.h | 6 +- src/actions/actiondrawlinebisector.cpp | 50 +- src/actions/actiondrawlinebisector.h | 14 +- src/actions/actiondrawlinefree.cpp | 18 +- src/actions/actiondrawlinefree.h | 6 +- src/actions/actiondrawlinehorvert.cpp | 30 +- src/actions/actiondrawlinehorvert.h | 4 +- src/actions/actiondrawlineparallel.cpp | 66 +- src/actions/actiondrawlineparallel.h | 12 +- src/actions/actiondrawlineparallelthrough.cpp | 40 +- src/actions/actiondrawlineparallelthrough.h | 12 +- src/actions/actiondrawlinepolygon.cpp | 52 +- src/actions/actiondrawlinepolygon.h | 4 +- src/actions/actiondrawlinepolygon2.cpp | 52 +- src/actions/actiondrawlinepolygon2.h | 4 +- src/actions/actiondrawlinerectangle.cpp | 46 +- src/actions/actiondrawlinerectangle.h | 6 +- src/actions/actiondrawlinerelangle.cpp | 62 +- src/actions/actiondrawlinerelangle.h | 10 +- src/actions/actiondrawlinetangent1.cpp | 34 +- src/actions/actiondrawlinetangent1.h | 12 +- src/actions/actiondrawlinetangent2.cpp | 34 +- src/actions/actiondrawlinetangent2.h | 12 +- src/actions/actiondrawpoint.cpp | 22 +- src/actions/actiondrawpoint.h | 4 +- src/actions/actiondrawspline.cpp | 42 +- src/actions/actiondrawspline.h | 8 +- src/actions/actiondrawtext.cpp | 54 +- src/actions/actiondrawtext.h | 6 +- src/actions/actioneditcopy.cpp | 14 +- src/actions/actioneditcopy.h | 2 +- src/actions/actioneditpaste.cpp | 20 +- src/actions/actioneditpaste.h | 2 +- src/actions/actioneditundo.cpp | 4 +- src/actions/actioneditundo.h | 2 +- src/actions/actionfilenew.cpp | 6 +- src/actions/actionfilenew.h | 2 +- src/actions/actionfileopen.cpp | 6 +- src/actions/actionfileopen.h | 2 +- src/actions/actionfilesave.cpp | 4 +- src/actions/actionfilesave.h | 2 +- src/actions/actionfilesaveas.cpp | 6 +- src/actions/actionfilesaveas.h | 2 +- src/actions/actioninfoangle.cpp | 26 +- src/actions/actioninfoangle.h | 8 +- src/actions/actioninfoarea.cpp | 34 +- src/actions/actioninfoarea.h | 10 +- src/actions/actioninfodist.cpp | 22 +- src/actions/actioninfodist.h | 2 +- src/actions/actioninfodist2.cpp | 20 +- src/actions/actioninfodist2.h | 6 +- src/actions/actioninfoinside.cpp | 20 +- src/actions/actioninfoinside.h | 4 +- src/actions/actioninfototallength.cpp | 16 +- src/actions/actioninfototallength.h | 2 +- src/actions/actionlayersadd.cpp | 8 +- src/actions/actionlayersadd.h | 2 +- src/actions/actionlayersedit.cpp | 12 +- src/actions/actionlayersedit.h | 2 +- src/actions/actionlayersfreezeall.cpp | 4 +- src/actions/actionlayersfreezeall.h | 2 +- src/actions/actionlayersremove.cpp | 10 +- src/actions/actionlayersremove.h | 2 +- src/actions/actionlayerstogglelock.cpp | 8 +- src/actions/actionlayerstogglelock.h | 2 +- src/actions/actionlayerstoggleview.cpp | 6 +- src/actions/actionlayerstoggleview.h | 2 +- src/actions/actionlibraryinsert.cpp | 44 +- src/actions/actionlibraryinsert.h | 6 +- src/actions/actionlockrelativezero.cpp | 2 +- src/actions/actionlockrelativezero.h | 2 +- src/actions/actionmodifyattributes.cpp | 22 +- src/actions/actionmodifyattributes.h | 2 +- src/actions/actionmodifybevel.cpp | 60 +- src/actions/actionmodifybevel.h | 10 +- src/actions/actionmodifycut.cpp | 34 +- src/actions/actionmodifycut.h | 6 +- src/actions/actionmodifydelete.cpp | 22 +- src/actions/actionmodifydelete.h | 2 +- src/actions/actionmodifydeletefree.cpp | 44 +- src/actions/actionmodifydeletefree.h | 12 +- src/actions/actionmodifydeletequick.cpp | 16 +- src/actions/actionmodifydeletequick.h | 6 +- src/actions/actionmodifyentity.cpp | 22 +- src/actions/actionmodifyentity.h | 6 +- src/actions/actionmodifyexplodetext.cpp | 4 +- src/actions/actionmodifyexplodetext.h | 2 +- src/actions/actionmodifymirror.cpp | 36 +- src/actions/actionmodifymirror.h | 4 +- src/actions/actionmodifymove.cpp | 28 +- src/actions/actionmodifymove.h | 4 +- src/actions/actionmodifymoverotate.cpp | 42 +- src/actions/actionmodifymoverotate.h | 6 +- src/actions/actionmodifyrotate.cpp | 22 +- src/actions/actionmodifyrotate.h | 4 +- src/actions/actionmodifyrotate2.cpp | 26 +- src/actions/actionmodifyrotate2.h | 6 +- src/actions/actionmodifyround.cpp | 86 +- src/actions/actionmodifyround.h | 12 +- src/actions/actionmodifyscale.cpp | 22 +- src/actions/actionmodifyscale.h | 4 +- src/actions/actionmodifystretch.cpp | 34 +- src/actions/actionmodifystretch.h | 2 +- src/actions/actionmodifytrim.cpp | 30 +- src/actions/actionmodifytrim.h | 8 +- src/actions/actionmodifytrimamount.cpp | 36 +- src/actions/actionmodifytrimamount.h | 8 +- src/actions/actionoptionsdrawing.cpp | 6 +- src/actions/actionoptionsdrawing.h | 2 +- src/actions/actionprintpreview.cpp | 10 +- src/actions/actionprintpreview.h | 6 +- src/actions/actionselect.cpp | 8 +- src/actions/actionselect.h | 2 +- src/actions/actionselectall.cpp | 6 +- src/actions/actionselectall.h | 2 +- src/actions/actionselectbase.cpp | 2 +- src/actions/actionselectbase.h | 2 +- src/actions/actionselectcontour.cpp | 14 +- src/actions/actionselectcontour.h | 6 +- src/actions/actionselectintersected.cpp | 28 +- src/actions/actionselectintersected.h | 2 +- src/actions/actionselectinvert.cpp | 6 +- src/actions/actionselectinvert.h | 2 +- src/actions/actionselectlayer.cpp | 10 +- src/actions/actionselectlayer.h | 6 +- src/actions/actionselectsingle.cpp | 8 +- src/actions/actionselectsingle.h | 6 +- src/actions/actionselectwindow.cpp | 36 +- src/actions/actionselectwindow.h | 2 +- src/actions/actionsetrelativezero.cpp | 10 +- src/actions/actionsetrelativezero.h | 2 +- src/actions/actionsetsnapmode.cpp | 2 +- src/actions/actionsetsnapmode.h | 4 +- src/actions/actionsetsnaprestriction.cpp | 2 +- src/actions/actionsetsnaprestriction.h | 4 +- src/actions/actionsnapintersectionmanual.cpp | 28 +- src/actions/actionsnapintersectionmanual.h | 8 +- src/actions/actionzoomauto.cpp | 2 +- src/actions/actionzoomauto.h | 2 +- src/actions/actionzoomautoy.cpp | 2 +- src/actions/actionzoomautoy.h | 2 +- src/actions/actionzoomin.cpp | 2 +- src/actions/actionzoomin.h | 4 +- src/actions/actionzoompan.cpp | 2 +- src/actions/actionzoompan.h | 2 +- src/actions/actionzoomprevious.cpp | 2 +- src/actions/actionzoomprevious.h | 2 +- src/actions/actionzoomredraw.cpp | 2 +- src/actions/actionzoomredraw.h | 2 +- src/actions/actionzoomscroll.cpp | 2 +- src/actions/actionzoomscroll.h | 2 +- src/actions/actionzoomwindow.cpp | 34 +- src/actions/actionzoomwindow.h | 2 +- src/base/actioninterface.cpp | 40 +- src/base/actioninterface.h | 22 +- src/base/arc.cpp | 154 ++-- src/base/arc.h | 28 +- src/base/atomicentity.cpp | 42 +- src/base/atomicentity.h | 6 +- src/base/block.cpp | 56 +- src/base/block.h | 26 +- src/base/blocklist.cpp | 80 +- src/base/blocklist.h | 38 +- src/base/circle.cpp | 97 +- src/base/circle.h | 28 +- src/base/clipboard.cpp | 109 ++- src/base/clipboard.h | 105 +-- src/base/color.cpp | 28 +- src/base/color.h | 20 +- src/base/commandevent.cpp | 8 +- src/base/commandevent.h | 4 +- src/base/constructionline.cpp | 62 +- src/base/constructionline.h | 28 +- src/base/creation.cpp | 266 +++--- src/base/creation.h | 78 +- src/base/debug.cpp | 50 +- src/base/debug.h | 32 +- src/base/dialogfactory.cpp | 36 +- src/base/dialogfactory.h | 22 +- src/base/dialogfactoryadapter.h | 48 +- src/base/dialogfactoryinterface.h | 99 +- src/base/dimaligned.cpp | 80 +- src/base/dimaligned.h | 24 +- src/base/dimangular.cpp | 114 +-- src/base/dimangular.h | 22 +- src/base/dimdiametric.cpp | 48 +- src/base/dimdiametric.h | 24 +- src/base/dimension.cpp | 94 +- src/base/dimension.h | 24 +- src/base/dimlinear.cpp | 90 +- src/base/dimlinear.h | 24 +- src/base/dimradial.cpp | 68 +- src/base/dimradial.h | 24 +- src/base/document.cpp | 38 +- src/base/document.h | 22 +- src/base/drawing.cpp | 118 +-- src/base/drawing.h | 60 +- src/base/ellipse.cpp | 128 +-- src/base/ellipse.h | 26 +- src/base/entity.cpp | 186 ++-- src/base/entity.h | 64 +- src/base/entitycontainer.cpp | 502 +++++----- src/base/entitycontainer.h | 54 +- src/base/{rs.h => enums.h} | 387 +------- src/base/eventhandler.cpp | 158 ++-- src/base/eventhandler.h | 12 +- src/base/fileio.cpp | 44 +- src/base/fileio.h | 24 +- src/base/filtercxf.cpp | 94 +- src/base/filtercxf.h | 6 +- src/base/filterdxf.cpp | 686 +++++++------- src/base/filterdxf.h | 74 +- src/base/filterdxf1.cpp | 198 ++-- src/base/filterdxf1.h | 8 +- src/base/filterinterface.cpp | 18 +- src/base/filterinterface.h | 8 +- src/base/flags.cpp | 20 +- src/base/flags.h | 8 +- src/base/font.cpp | 60 +- src/base/font.h | 16 +- src/base/fontchar.h | 12 +- src/base/fontlist.cpp | 56 +- src/base/fontlist.h | 30 +- src/base/grid.cpp | 91 +- src/base/grid.h | 8 +- src/base/hatch.cpp | 236 ++--- src/base/hatch.h | 26 +- src/base/image.cpp | 116 +-- src/base/image.h | 26 +- src/base/infoarea.cpp | 30 +- src/base/infoarea.h | 6 +- src/base/information.cpp | 146 +-- src/base/information.h | 26 +- src/base/insert.cpp | 148 +-- src/base/insert.h | 36 +- src/base/layer.cpp | 34 +- src/base/layer.h | 28 +- src/base/layerlist.cpp | 106 +-- src/base/layerlist.h | 42 +- src/base/leader.cpp | 74 +- src/base/leader.h | 28 +- src/base/line.cpp | 146 +-- src/base/line.h | 37 +- src/base/linetypepattern.cpp | 4 +- src/base/linetypepattern.h | 48 +- src/base/mainwindowinterface.h | 12 +- src/base/mathextra.cpp | 78 +- src/base/mathextra.h | 40 +- src/base/modification.cpp | 858 +++++++++--------- src/base/modification.h | 102 +-- src/base/paintinterface.cpp | 40 +- src/base/paintinterface.h | 16 +- src/base/pattern.cpp | 32 +- src/base/pattern.h | 12 +- src/base/patternlist.cpp | 62 +- src/base/patternlist.h | 28 +- src/base/pen.cpp | 38 +- src/base/pen.h | 24 +- src/base/point.cpp | 52 +- src/base/point.h | 22 +- src/base/polyline.cpp | 150 +-- src/base/polyline.h | 38 +- src/base/preview.cpp | 62 +- src/base/preview.h | 22 +- src/base/python.cpp | 101 --- src/base/python.h | 43 - src/base/python_wrappers.cpp | 602 ------------ src/base/python_wrappers.h | 10 - src/base/script.cpp | 6 +- src/base/script.h | 7 +- src/base/scriptlist.cpp | 64 +- src/base/scriptlist.h | 26 +- src/base/selection.cpp | 69 +- src/base/selection.h | 12 +- src/base/simplepython.cpp | 154 ---- src/base/simplepython.h | 65 -- src/base/snapper.cpp | 120 +-- src/base/snapper.h | 26 +- src/base/solid.cpp | 54 +- src/base/solid.h | 28 +- src/base/spline.cpp | 112 +-- src/base/spline.h | 22 +- src/base/staticgraphicview.cpp | 28 +- src/base/staticgraphicview.h | 6 +- src/base/system.cpp | 78 +- src/base/system.h | 10 +- src/base/text.cpp | 138 +-- src/base/text.h | 26 +- src/base/undo.cpp | 94 +- src/base/undo.h | 34 +- src/base/undoable.cpp | 16 +- src/base/undoable.h | 18 +- src/base/undocycle.cpp | 16 +- src/base/undocycle.h | 30 +- src/base/units.cpp | 128 +-- src/base/units.h | 4 +- src/base/utility.cpp | 2 +- src/base/utility.h | 2 +- src/base/variable.cpp | 32 +- src/base/variable.h | 22 +- src/base/variabledict.cpp | 102 +-- src/base/variabledict.h | 18 +- src/base/vector.cpp | 26 +- src/base/vectorsolutions.cpp | 2 +- src/forms/arcoptions.cpp | 2 +- src/forms/arctangentialoptions.cpp | 6 +- src/forms/beveloptions.cpp | 8 +- src/forms/blockdialog.cpp | 14 +- src/forms/blockdialog.h | 8 +- src/forms/cadtoolbar.cpp | 2 +- src/forms/circleoptions.cpp | 6 +- src/forms/commandwidget.cpp | 2 +- src/forms/coordinatewidget.cpp | 22 +- src/forms/coordinatewidget.h | 2 +- src/forms/dimlinearoptions.cpp | 6 +- src/forms/dimoptions.cpp | 2 +- src/forms/dlgarc.cpp | 18 +- src/forms/dlgarc.h | 6 +- src/forms/dlgattributes.cpp | 4 +- src/forms/dlgattributes.h | 10 +- src/forms/dlgcircle.cpp | 10 +- src/forms/dlgcircle.h | 6 +- src/forms/dlgdimension.cpp | 4 +- src/forms/dlgdimension.h | 6 +- src/forms/dlgdimlinear.cpp | 8 +- src/forms/dlgdimlinear.h | 6 +- src/forms/dlgellipse.cpp | 26 +- src/forms/dlgellipse.h | 6 +- src/forms/dlghatch.cpp | 32 +- src/forms/dlghatch.h | 16 +- src/forms/dlgimageoptions.cpp | 10 +- src/forms/dlginitial.cpp | 14 +- src/forms/dlginsert.cpp | 24 +- src/forms/dlginsert.h | 6 +- src/forms/dlgline.cpp | 12 +- src/forms/dlgline.h | 6 +- src/forms/dlgmirror.cpp | 2 +- src/forms/dlgmirror.h | 6 +- src/forms/dlgmove.cpp | 2 +- src/forms/dlgmove.h | 6 +- src/forms/dlgmoverotate.cpp | 6 +- src/forms/dlgmoverotate.h | 6 +- src/forms/dlgoptionsdrawing.cpp | 60 +- src/forms/dlgoptionsgeneral.cpp | 30 +- src/forms/dlgpoint.cpp | 8 +- src/forms/dlgpoint.h | 8 +- src/forms/dlgrotate.cpp | 4 +- src/forms/dlgrotate.h | 6 +- src/forms/dlgrotate2.cpp | 10 +- src/forms/dlgrotate2.h | 6 +- src/forms/dlgscale.cpp | 4 +- src/forms/dlgscale.h | 6 +- src/forms/dlgspline.cpp | 6 +- src/forms/dlgspline.h | 6 +- src/forms/dlgtext.cpp | 16 +- src/forms/dlgtext.h | 10 +- src/forms/imageoptions.cpp | 10 +- src/forms/insertoptions.cpp | 12 +- src/forms/layerdialog.cpp | 10 +- src/forms/layerdialog.h | 12 +- src/forms/libraryinsertoptions.cpp | 8 +- src/forms/librarywidget.cpp | 40 +- src/forms/lineangleoptions.cpp | 10 +- src/forms/linebisectoroptions.cpp | 4 +- src/forms/lineoptions.cpp | 4 +- src/forms/lineparalleloptions.cpp | 4 +- src/forms/lineparallelthroughoptions.cpp | 2 +- src/forms/linepolygon2options.cpp | 2 +- src/forms/linepolygonoptions.cpp | 2 +- src/forms/linerelangleoptions.cpp | 12 +- src/forms/moverotateoptions.cpp | 8 +- src/forms/printpreviewoptions.cpp | 12 +- src/forms/roundoptions.cpp | 4 +- src/forms/snapdistoptions.cpp | 2 +- src/forms/splineoptions.cpp | 2 +- src/forms/textoptions.cpp | 6 +- src/forms/trimamountoptions.cpp | 4 +- src/forms/widgetpen.cpp | 6 +- src/forms/widgetpen.h | 4 +- src/mainapp/applicationwindow.cpp | 622 ++++++------- src/mainapp/applicationwindow.h | 16 +- src/mainapp/commands.cpp | 18 +- src/mainapp/commands.h | 4 +- src/mainapp/graphicview.cpp | 224 ++--- src/mainapp/graphicview.h | 78 +- src/mainapp/main.cpp | 96 +- src/mainapp/mdiwindow.cpp | 64 +- src/mainapp/mdiwindow.h | 14 +- src/mainapp/qc_dialogfactory.cpp | 20 +- src/mainapp/qc_dialogfactory.h | 4 +- src/widgets/actionhandler.cpp | 40 +- src/widgets/actionhandler.h | 2 +- src/widgets/blockwidget.cpp | 36 +- src/widgets/blockwidget.h | 22 +- src/widgets/colorbox.cpp | 34 +- src/widgets/colorbox.h | 10 +- src/widgets/filedialog.cpp | 20 +- src/widgets/filedialog.h | 2 +- src/widgets/fontbox.cpp | 12 +- src/widgets/fontbox.h | 8 +- src/widgets/layerbox.cpp | 8 +- src/widgets/layerbox.h | 16 +- src/widgets/layerwidget.cpp | 52 +- src/widgets/layerwidget.h | 22 +- src/widgets/linetypebox.cpp | 10 +- src/widgets/linetypebox.h | 2 +- src/widgets/patternbox.cpp | 12 +- src/widgets/patternbox.h | 8 +- src/widgets/pentoolbar.cpp | 12 +- src/widgets/pentoolbar.h | 18 +- src/widgets/qg_dialogfactory.cpp | 160 ++-- src/widgets/qg_dialogfactory.h | 46 +- src/widgets/qg_graphicview.cpp | 62 +- src/widgets/qg_graphicview.h | 16 +- src/widgets/qg_mainwindowinterface.h | 2 +- src/widgets/recentfiles.cpp | 4 +- src/widgets/widthbox.cpp | 10 +- src/widgets/widthbox.h | 2 +- 476 files changed, 7739 insertions(+), 9082 deletions(-) rename src/base/{rs.h => enums.h} (75%) delete mode 100644 src/base/python.cpp delete mode 100644 src/base/python.h delete mode 100644 src/base/python_wrappers.cpp delete mode 100644 src/base/python_wrappers.h delete mode 100644 src/base/simplepython.cpp delete mode 100644 src/base/simplepython.h diff --git a/architektonas.pro b/architektonas.pro index 3824c03..7bb1245 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -28,7 +28,6 @@ INCLUDEPATH += \ src/forms HEADERS = \ - src/base/rs.h \ src/base/actioninterface.h \ src/base/arc.h \ src/base/atomicentity.h \ @@ -55,6 +54,7 @@ HEADERS = \ src/base/ellipse.h \ src/base/entity.h \ src/base/entitycontainer.h \ + src/base/enums.h \ src/base/eventhandler.h \ src/base/fileio.h \ src/base/filtercxf.h \ @@ -86,12 +86,9 @@ HEADERS = \ src/base/point.h \ src/base/polyline.h \ src/base/preview.h \ - src/base/python.h \ - src/base/python_wrappers.h \ src/base/script.h \ src/base/scriptlist.h \ src/base/selection.h \ - src/base/simplepython.h \ src/base/snapper.h \ src/base/solid.h \ src/base/spline.h \ @@ -133,6 +130,7 @@ SOURCES = \ src/base/ellipse.cpp \ src/base/entity.cpp \ src/base/entitycontainer.cpp \ + src/base/enums.cpp \ src/base/eventhandler.cpp \ src/base/fileio.cpp \ src/base/filtercxf.cpp \ @@ -162,12 +160,9 @@ SOURCES = \ src/base/point.cpp \ src/base/polyline.cpp \ src/base/preview.cpp \ - src/base/python.cpp \ - src/base/python_wrappers.cpp \ src/base/script.cpp \ src/base/scriptlist.cpp \ src/base/selection.cpp \ - src/base/simplepython.cpp \ src/base/snapper.cpp \ src/base/solid.cpp \ src/base/spline.cpp \ diff --git a/src/actions/actionblocksadd.cpp b/src/actions/actionblocksadd.cpp index 8817139..f2f9e8f 100644 --- a/src/actions/actionblocksadd.cpp +++ b/src/actions/actionblocksadd.cpp @@ -19,7 +19,7 @@ #include "drawing.h" #include "dialogfactory.h" -ActionBlocksAdd::ActionBlocksAdd(RS_EntityContainer & container, GraphicView & graphicView): +ActionBlocksAdd::ActionBlocksAdd(EntityContainer & container, GraphicView & graphicView): ActionInterface("Add Block", container, graphicView) { } @@ -30,18 +30,18 @@ ActionBlocksAdd::~ActionBlocksAdd() void ActionBlocksAdd::trigger() { - RS_DEBUG->print("adding block"); + DEBUG->print("adding block"); if (graphic) { - RS_BlockList * blockList = graphic->getBlockList(); + BlockList * blockList = graphic->getBlockList(); if (blockList) { - RS_BlockData d = RS_DIALOGFACTORY->requestNewBlockDialog(blockList); + BlockData d = DIALOGFACTORY->requestNewBlockDialog(blockList); if (d.isValid()) - graphic->addBlock(new RS_Block(container, d)); + graphic->addBlock(new Block(container, d)); } } diff --git a/src/actions/actionblocksadd.h b/src/actions/actionblocksadd.h index 491f469..c1e49bf 100644 --- a/src/actions/actionblocksadd.h +++ b/src/actions/actionblocksadd.h @@ -12,7 +12,7 @@ class ActionBlocksAdd: public ActionInterface { public: - ActionBlocksAdd(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksAdd(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksAdd(); virtual void init(int status = 0); diff --git a/src/actions/actionblocksattributes.cpp b/src/actions/actionblocksattributes.cpp index b8f5082..31a2601 100644 --- a/src/actions/actionblocksattributes.cpp +++ b/src/actions/actionblocksattributes.cpp @@ -20,7 +20,7 @@ #include "dialogfactory.h" ActionBlocksAttributes::ActionBlocksAttributes( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Block Attributes", container, graphicView) { } @@ -31,17 +31,17 @@ ActionBlocksAttributes::~ActionBlocksAttributes() void ActionBlocksAttributes::trigger() { - RS_DEBUG->print("editing block attributes"); + DEBUG->print("editing block attributes"); - if (graphic && RS_DIALOGFACTORY) + if (graphic && DIALOGFACTORY) { - RS_Block * block = graphic->getActiveBlock(); - RS_BlockList * blockList = graphic->getBlockList(); + Block * block = graphic->getActiveBlock(); + BlockList * blockList = graphic->getBlockList(); if (blockList && block) { QString oldName = block->getName(); - RS_BlockData d = RS_DIALOGFACTORY->requestBlockAttributesDialog(blockList); + BlockData d = DIALOGFACTORY->requestBlockAttributesDialog(blockList); if (d.isValid()) { diff --git a/src/actions/actionblocksattributes.h b/src/actions/actionblocksattributes.h index c825ad1..2b8be39 100644 --- a/src/actions/actionblocksattributes.h +++ b/src/actions/actionblocksattributes.h @@ -12,7 +12,7 @@ class ActionBlocksAttributes: public ActionInterface { public: - ActionBlocksAttributes(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksAttributes(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksAttributes(); virtual void init(int status = 0); diff --git a/src/actions/actionblockscreate.cpp b/src/actions/actionblockscreate.cpp index 172c071..723b95c 100644 --- a/src/actions/actionblockscreate.cpp +++ b/src/actions/actionblockscreate.cpp @@ -12,7 +12,7 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 06/03/2010 Added this text. :-) -// JLH 06/03/2010 Scrubbed out all occurances of RS_CoordinateEvent +// JLH 06/03/2010 Scrubbed out all occurances of CoordinateEvent // #include "actionblockscreate.h" @@ -26,7 +26,7 @@ /** * Constructor. */ -ActionBlocksCreate::ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Create", container, graphicView) +ActionBlocksCreate::ActionBlocksCreate(EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Create", container, graphicView) { referencePoint = Vector(false); } @@ -65,24 +65,24 @@ void ActionBlocksCreate::trigger() //deletePreview(); //clearPreview(); - //RS_Modification m(*container, graphicView); + //Modification m(*container, graphicView); //m.paste(data.insertionPoint); - //std::cout << *RS_Clipboard::instance(); + //std::cout << *Clipboard::instance(); if (graphic != NULL) { - RS_BlockList * blockList = graphic->getBlockList(); + BlockList * blockList = graphic->getBlockList(); if (blockList != NULL) { - RS_BlockData d = RS_DIALOGFACTORY->requestNewBlockDialog(blockList); + BlockData d = DIALOGFACTORY->requestNewBlockDialog(blockList); if (!d.name.isEmpty()) { - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); creation.createBlock(d, referencePoint, true); - RS_InsertData id(d.name, referencePoint, Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0)); + InsertData id(d.name, referencePoint, Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0)); creation.createInsert(id); } } @@ -108,7 +108,7 @@ void ActionBlocksCreate::mouseMoveEvent(QMouseEvent * e) clearPreview(); //preview->addAllFrom(*block); //preview->move(data.insertionPoint); - RS_Creation creation(preview, NULL, false); + Creation creation(preview, NULL, false); creation.createInsert(data); drawPreview(); }*/ @@ -156,11 +156,11 @@ void ActionBlocksCreate::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -173,8 +173,8 @@ void ActionBlocksCreate::updateMouseCursor() void ActionBlocksCreate::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } diff --git a/src/actions/actionblockscreate.h b/src/actions/actionblockscreate.h index 27a462a..722a1e2 100644 --- a/src/actions/actionblockscreate.h +++ b/src/actions/actionblockscreate.h @@ -23,7 +23,7 @@ class ActionBlocksCreate: public ActionInterface }; public: - ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksCreate(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksCreate(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionblocksedit.cpp b/src/actions/actionblocksedit.cpp index 46f549a..6776e02 100644 --- a/src/actions/actionblocksedit.cpp +++ b/src/actions/actionblocksedit.cpp @@ -19,7 +19,7 @@ #include "drawing.h" #include "dialogfactory.h" -ActionBlocksEdit::ActionBlocksEdit(RS_EntityContainer & container, GraphicView & graphicView): +ActionBlocksEdit::ActionBlocksEdit(EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Block", container, graphicView) { } @@ -30,12 +30,12 @@ ActionBlocksEdit::~ActionBlocksEdit() void ActionBlocksEdit::trigger() { - RS_DEBUG->print("edit block"); + DEBUG->print("edit block"); - if (graphic && RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestEditBlockWindow(graphic->getBlockList()); + if (graphic && DIALOGFACTORY) + DIALOGFACTORY->requestEditBlockWindow(graphic->getBlockList()); else - RS_DEBUG->print(RS_Debug::D_WARNING, "ActionBlocksEdit::trigger(): graphic is NULL"); + DEBUG->print(Debug::D_WARNING, "ActionBlocksEdit::trigger(): graphic is NULL"); finish(); } diff --git a/src/actions/actionblocksedit.h b/src/actions/actionblocksedit.h index eab3610..ce0499c 100644 --- a/src/actions/actionblocksedit.h +++ b/src/actions/actionblocksedit.h @@ -12,7 +12,7 @@ class ActionBlocksEdit: public ActionInterface { public: - ActionBlocksEdit(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksEdit(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksEdit(); virtual void init(int status = 0); diff --git a/src/actions/actionblocksexplode.cpp b/src/actions/actionblocksexplode.cpp index 3e29a70..f000b18 100644 --- a/src/actions/actionblocksexplode.cpp +++ b/src/actions/actionblocksexplode.cpp @@ -21,7 +21,7 @@ /** * Constructor. */ -ActionBlocksExplode::ActionBlocksExplode(RS_EntityContainer & container, GraphicView & graphicView): +ActionBlocksExplode::ActionBlocksExplode(EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Explode", container, graphicView) { } @@ -45,6 +45,6 @@ void ActionBlocksExplode::init(int status) void ActionBlocksExplode::trigger() { - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.explode(); } diff --git a/src/actions/actionblocksexplode.h b/src/actions/actionblocksexplode.h index 8ab8aa5..f9a1bb5 100644 --- a/src/actions/actionblocksexplode.h +++ b/src/actions/actionblocksexplode.h @@ -14,7 +14,7 @@ class ActionBlocksExplode: public ActionInterface { public: - ActionBlocksExplode(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksExplode(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksExplode(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionblocksfreezeall.cpp b/src/actions/actionblocksfreezeall.cpp index 99d4db0..6a152f1 100644 --- a/src/actions/actionblocksfreezeall.cpp +++ b/src/actions/actionblocksfreezeall.cpp @@ -19,7 +19,7 @@ #include "drawing.h" #include "graphicview.h" -ActionBlocksFreezeAll::ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container, +ActionBlocksFreezeAll::ActionBlocksFreezeAll(bool freeze, EntityContainer & container, GraphicView & graphicView): ActionInterface("Freeze all Blocks", container, graphicView) { this->freeze = freeze; @@ -31,7 +31,7 @@ ActionBlocksFreezeAll::~ActionBlocksFreezeAll() void ActionBlocksFreezeAll::trigger() { - RS_DEBUG->print("ActionBlocksFreezeAll::trigger"); + DEBUG->print("ActionBlocksFreezeAll::trigger"); if (graphic) graphic->freezeAllBlocks(freeze); diff --git a/src/actions/actionblocksfreezeall.h b/src/actions/actionblocksfreezeall.h index 31c359a..274b70b 100644 --- a/src/actions/actionblocksfreezeall.h +++ b/src/actions/actionblocksfreezeall.h @@ -12,7 +12,7 @@ class ActionBlocksFreezeAll: public ActionInterface { public: - ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksFreezeAll(bool freeze, EntityContainer & container, GraphicView & graphicView); ~ActionBlocksFreezeAll(); virtual void init(int status = 0); diff --git a/src/actions/actionblocksinsert.cpp b/src/actions/actionblocksinsert.cpp index 09eae0f..48d6ff9 100644 --- a/src/actions/actionblocksinsert.cpp +++ b/src/actions/actionblocksinsert.cpp @@ -12,7 +12,7 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 06/03/2010 Added this text. :-) -// JLH 06/03/2010 Scrubbed out all occurances of RS_CoordinateEvent +// JLH 06/03/2010 Scrubbed out all occurances of CoordinateEvent // #include "actionblocksinsert.h" @@ -27,7 +27,7 @@ /** * Constructor. */ -ActionBlocksInsert::ActionBlocksInsert(RS_EntityContainer & container, GraphicView & graphicView): +ActionBlocksInsert::ActionBlocksInsert(EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Insert", container, graphicView) { } @@ -59,7 +59,7 @@ void ActionBlocksInsert::init(int status /*= 0*/) void ActionBlocksInsert::reset() { - data = RS_InsertData("", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1, + data = InsertData("", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1, Vector(1.0, 1.0), NULL, RS2::Update); } @@ -69,13 +69,13 @@ void ActionBlocksInsert::trigger() // deletePreview(); // clearPreview(); - //RS_Modification m(*container, graphicView); + //Modification m(*container, graphicView); //m.paste(data.insertionPoint); - //std::cout << *RS_Clipboard::instance(); + //std::cout << *Clipboard::instance(); if (block) { - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); data.updateMode = RS2::Update; creation.createInsert(data); } @@ -97,8 +97,8 @@ void ActionBlocksInsert::mouseMoveEvent(QMouseEvent * e) // clearPreview(); //preview->addAllFrom(*block); //preview->move(data.insertionPoint); -// RS_Creation creation(preview, NULL, false); - RS_Creation creation(&(graphicView->preview), NULL, false); +// Creation creation(preview, NULL, false); + Creation creation(&(graphicView->preview), NULL, false); // Create insert as preview only data.updateMode = RS2::PreviewUpdate; creation.createInsert(data); @@ -135,13 +135,13 @@ void ActionBlocksInsert::coordinateEvent(Vector * e) trigger(); } -void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) +void ActionBlocksInsert::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -203,14 +203,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - data.angle = RS_Math::deg2rad(a); + data.angle = Math::deg2rad(a); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -218,14 +218,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetFactor: { bool ok; - double f = RS_Math::eval(c, &ok); + double f = Math::eval(c, &ok); if (ok) setFactor(f); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -233,14 +233,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetColumns: { bool ok; - int cols = (int)RS_Math::eval(c, &ok); + int cols = (int)Math::eval(c, &ok); if (ok) data.cols = cols; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -248,14 +248,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetRows: { bool ok; - int rows = (int)RS_Math::eval(c, &ok); + int rows = (int)Math::eval(c, &ok); if (ok) data.rows = rows; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -263,14 +263,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetColumnSpacing: { bool ok; - double cs = (int)RS_Math::eval(c, &ok); + double cs = (int)Math::eval(c, &ok); if (ok) data.spacing.x = cs; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -278,14 +278,14 @@ void ActionBlocksInsert::commandEvent(RS_CommandEvent * e) case SetRowSpacing: { bool ok; - int rs = (int)RS_Math::eval(c, &ok); + int rs = (int)Math::eval(c, &ok); if (ok) data.spacing.y = rs; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -320,13 +320,13 @@ QStringList ActionBlocksInsert::getAvailableCommands() void ActionBlocksInsert::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionBlocksInsert::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionBlocksInsert::updateMouseButtonHints() @@ -334,35 +334,35 @@ void ActionBlocksInsert::updateMouseButtonHints() switch (getStatus()) { case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); break; case SetFactor: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); break; case SetColumns: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter columns:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter columns:"), ""); break; case SetRows: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter rows:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter rows:"), ""); break; case SetColumnSpacing: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter column spacing:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter column spacing:"), ""); break; case SetRowSpacing: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter row spacing:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter row spacing:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -375,9 +375,9 @@ void ActionBlocksInsert::updateMouseCursor() void ActionBlocksInsert::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } double ActionBlocksInsert::getAngle() diff --git a/src/actions/actionblocksinsert.h b/src/actions/actionblocksinsert.h index 7030302..2685a4d 100644 --- a/src/actions/actionblocksinsert.h +++ b/src/actions/actionblocksinsert.h @@ -28,7 +28,7 @@ class ActionBlocksInsert: public ActionInterface }; public: - ActionBlocksInsert(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksInsert(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksInsert(); virtual RS2::ActionType rtti(); @@ -38,7 +38,7 @@ class ActionBlocksInsert: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -60,8 +60,8 @@ class ActionBlocksInsert: public ActionInterface void setRowSpacing(double rs); protected: - RS_Block * block; - RS_InsertData data; + Block * block; + InsertData data; /** Last status before entering option. */ Status lastStatus; diff --git a/src/actions/actionblocksremove.cpp b/src/actions/actionblocksremove.cpp index 1eaf12b..180b8ef 100644 --- a/src/actions/actionblocksremove.cpp +++ b/src/actions/actionblocksremove.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "insert.h" -ActionBlocksRemove::ActionBlocksRemove(RS_EntityContainer & container, GraphicView & graphicView): +ActionBlocksRemove::ActionBlocksRemove(EntityContainer & container, GraphicView & graphicView): ActionInterface("Remove Block", container, graphicView) { } @@ -33,16 +33,16 @@ ActionBlocksRemove::~ActionBlocksRemove() void ActionBlocksRemove::trigger() { - RS_DEBUG->print("ActionBlocksRemove::trigger"); + DEBUG->print("ActionBlocksRemove::trigger"); if (graphic) { - RS_Block * block = RS_DIALOGFACTORY->requestBlockRemovalDialog(graphic->getBlockList()); + Block * block = DIALOGFACTORY->requestBlockRemovalDialog(graphic->getBlockList()); // list of containers that might refer to the block via inserts: - QList containerList; + QList containerList; containerList.append(graphic); - RS_BlockList * blkLst = graphic->getBlockList(); + BlockList * blkLst = graphic->getBlockList(); for(uint bi=0; bicount(); bi++) containerList.append(blkLst->at(bi)); @@ -51,7 +51,7 @@ void ActionBlocksRemove::trigger() { for(int i=0; ifirstEntity(RS2::ResolveNone); e!=NULL; + for(Entity * e=cont->firstEntity(RS2::ResolveNone); e!=NULL; e=cont->nextEntity(RS2::ResolveNone)) { if (e->rtti() == RS2::EntityInsert) { - RS_Insert * ins = (RS_Insert *)e; + Insert * ins = (Insert *)e; if (ins->getName() == block->getName()) { @@ -79,8 +79,8 @@ void ActionBlocksRemove::trigger() } // close all windows that are editing this block: - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->closeEditBlockWindow(block); + if (DIALOGFACTORY) + DIALOGFACTORY->closeEditBlockWindow(block); // Now remove the block from the block list: graphic->removeBlock(block); @@ -90,7 +90,7 @@ void ActionBlocksRemove::trigger() } finish(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionBlocksRemove::init(int status) diff --git a/src/actions/actionblocksremove.h b/src/actions/actionblocksremove.h index 85c9267..1d323a1 100644 --- a/src/actions/actionblocksremove.h +++ b/src/actions/actionblocksremove.h @@ -12,7 +12,7 @@ class ActionBlocksRemove: public ActionInterface { public: - ActionBlocksRemove(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksRemove(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksRemove(); virtual void init(int status = 0); diff --git a/src/actions/actionblockstoggleview.cpp b/src/actions/actionblockstoggleview.cpp index 176f363..89bbcd8 100644 --- a/src/actions/actionblockstoggleview.cpp +++ b/src/actions/actionblockstoggleview.cpp @@ -19,7 +19,7 @@ #include "drawing.h" #include "graphicview.h" -ActionBlocksToggleView::ActionBlocksToggleView(RS_EntityContainer & container, +ActionBlocksToggleView::ActionBlocksToggleView(EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Block Visibility", container, graphicView) { @@ -31,11 +31,11 @@ ActionBlocksToggleView::~ActionBlocksToggleView() void ActionBlocksToggleView::trigger() { - RS_DEBUG->print("toggle block"); + DEBUG->print("toggle block"); if (graphic) { - RS_Block * block = graphic->getActiveBlock(); + Block * block = graphic->getActiveBlock(); graphic->toggleBlock(block); } diff --git a/src/actions/actionblockstoggleview.h b/src/actions/actionblockstoggleview.h index b890342..0bafb48 100644 --- a/src/actions/actionblockstoggleview.h +++ b/src/actions/actionblockstoggleview.h @@ -12,7 +12,7 @@ class ActionBlocksToggleView: public ActionInterface { public: - ActionBlocksToggleView(RS_EntityContainer & container, GraphicView & graphicView); + ActionBlocksToggleView(EntityContainer & container, GraphicView & graphicView); ~ActionBlocksToggleView(); virtual void init(int status = 0); diff --git a/src/actions/actiondefault.cpp b/src/actions/actiondefault.cpp index bfbd45f..801a051 100644 --- a/src/actions/actiondefault.cpp +++ b/src/actions/actiondefault.cpp @@ -16,7 +16,7 @@ #include "actiondefault.h" -#include "rs.h" +#include "enums.h" #include "commandevent.h" #include "debug.h" #include "dialogfactory.h" @@ -29,15 +29,15 @@ /** * Constructor. */ -ActionDefault::ActionDefault(RS_EntityContainer & container, +ActionDefault::ActionDefault(EntityContainer & container, GraphicView & graphicView): ActionInterface("Default", container, graphicView) { - RS_DEBUG->print("ActionDefault::ActionDefault"); + DEBUG->print("ActionDefault::ActionDefault"); //hm. // graphicView.snapper.SetVisible(); // graphicView.preview.SetVisible(); - RS_DEBUG->print("ActionDefault::ActionDefault: OK"); + DEBUG->print("ActionDefault::ActionDefault: OK"); } ActionDefault::~ActionDefault() @@ -51,16 +51,16 @@ ActionDefault::~ActionDefault() void ActionDefault::init(int status /*= 0*/) { - RS_DEBUG->print("ActionDefault::init"); + DEBUG->print("ActionDefault::init"); ActionInterface::init(status); v1 = v2 = Vector(false); graphicView->snapper.setSnapMode(RS2::SnapFree); graphicView->snapper.setSnapRestriction(RS2::RestrictNothing); restrBak = RS2::RestrictNothing; - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); - RS_DEBUG->print("ActionDefault::init: OK"); + DEBUG->print("ActionDefault::init: OK"); } void ActionDefault::trigger() @@ -88,7 +88,7 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e) Vector mouse = graphicView->toGraph(Vector(e->x(), e->y())); Vector relMouse = mouse - graphicView->getRelativeZero(); - RS_DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse); + DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse); switch (getStatus()) { @@ -103,7 +103,7 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e) if (ref.valid && graphicView->toGuiDX(dist) < 8) { - RS_DEBUG->print("ActionDefault::mouseMoveEvent: moving reference point"); + DEBUG->print("ActionDefault::mouseMoveEvent: moving reference point"); setStatus(MovingRef); v1 = ref; graphicView->moveRelativeZero(v1); @@ -111,11 +111,11 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e) else { // test for an entity to drag: - RS_Entity * en = graphicView->snapper.catchEntity(v1); + Entity * en = graphicView->snapper.catchEntity(v1); if (en && en->isSelected()) { - RS_DEBUG->print("ActionDefault::mouseMoveEvent: moving entity"); + DEBUG->print("ActionDefault::mouseMoveEvent: moving entity"); setStatus(Moving); v1 = en->getNearestRef(v1); graphicView->moveRelativeZero(v1); @@ -165,14 +165,14 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e) graphicView->preview.clear(); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), - RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), - RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), - RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), - RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y)))); + graphicView->preview.addEntity(new Line(&(graphicView->preview), + LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); + graphicView->preview.addEntity(new Line(&(graphicView->preview), + LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); + graphicView->preview.addEntity(new Line(&(graphicView->preview), + LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); + graphicView->preview.addEntity(new Line(&(graphicView->preview), + LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y)))); graphicView->preview.SetVisible(); graphicView->redraw(); @@ -200,16 +200,16 @@ void ActionDefault::mousePressEvent(QMouseEvent * e) // deleteSnapper(); // deletePreview(); // clearPreview(); - RS_Modification m(*container, graphicView); - RS_MoveData data; + Modification m(*container, graphicView); + MoveData data; data.number = 0; data.useCurrentLayer = false; data.useCurrentAttributes = false; data.offset = v2 - v1; m.move(data); setStatus(Neutral); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } break; @@ -219,14 +219,14 @@ void ActionDefault::mousePressEvent(QMouseEvent * e) // deleteSnapper(); // deletePreview(); // clearPreview(); - RS_Modification m(*container, graphicView); - RS_MoveRefData data; + Modification m(*container, graphicView); + MoveRefData data; data.ref = v1; data.offset = v2 - v1; m.moveRef(data); setStatus(Neutral); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } break; @@ -238,7 +238,7 @@ void ActionDefault::mousePressEvent(QMouseEvent * e) void ActionDefault::mouseReleaseEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDefault::mouseReleaseEvent()"); + DEBUG->print("ActionDefault::mouseReleaseEvent()"); if (e->button() == Qt::LeftButton) { @@ -249,7 +249,7 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e) case Dragging: { // select single entity: - RS_Entity * en = graphicView->snapper.catchEntity(e); + Entity * en = graphicView->snapper.catchEntity(e); if (en) { @@ -257,10 +257,10 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e) // deletePreview(); // clearPreview(); - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectSingle(en); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); e->accept(); setStatus(Neutral); @@ -281,10 +281,10 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e) graphicView->preview.SetVisible(false); bool cross = (v2.y > v1.y); - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectWindow(v1, v2, true, cross); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); setStatus(Neutral); e->accept(); @@ -310,21 +310,21 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e) // clearPreview(); // deleteSnapper(); setStatus(Neutral); - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); e->accept(); break; default: graphicView->snapper.SetVisible(false); graphicView->preview.SetVisible(false); - RS_DIALOGFACTORY->requestPreviousMenu(); + DIALOGFACTORY->requestPreviousMenu(); e->accept(); break; } } } -void ActionDefault::commandEvent(RS_CommandEvent * e) +void ActionDefault::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); } @@ -341,15 +341,15 @@ void ActionDefault::updateMouseButtonHints() switch (getStatus()) { case Neutral: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; case SetCorner2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Drag to second point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Drag to second point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -381,7 +381,7 @@ void ActionDefault::updateToolBar() case Moving: case MovingRef: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: diff --git a/src/actions/actiondefault.h b/src/actions/actiondefault.h index 354e172..6d126ca 100644 --- a/src/actions/actiondefault.h +++ b/src/actions/actiondefault.h @@ -27,7 +27,7 @@ class ActionDefault: public ActionInterface }; public: - ActionDefault(RS_EntityContainer & container, GraphicView & graphicView); + ActionDefault(EntityContainer & container, GraphicView & graphicView); virtual ~ActionDefault(); virtual RS2::ActionType rtti(); @@ -38,7 +38,7 @@ class ActionDefault: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mousePressEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); diff --git a/src/actions/actiondimaligned.cpp b/src/actions/actiondimaligned.cpp index 5370670..cd30076 100644 --- a/src/actions/actiondimaligned.cpp +++ b/src/actions/actiondimaligned.cpp @@ -24,7 +24,7 @@ #include "preview.h" #include "snapper.h" -ActionDimAligned::ActionDimAligned(RS_EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions", +ActionDimAligned::ActionDimAligned(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions", container, graphicView) { reset(); @@ -42,11 +42,11 @@ ActionDimAligned::~ActionDimAligned() void ActionDimAligned::reset() { ActionDimension::reset(); - edata = RS_DimAlignedData(Vector(false), Vector(false)); + edata = DimAlignedData(Vector(false), Vector(false)); lastStatus = SetExtPoint1; - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimAligned::trigger() @@ -56,7 +56,7 @@ void ActionDimAligned::trigger() graphicView->moveRelativeZero(data.definitionPoint); //data.text = getText(); - RS_DimAligned * dim = new RS_DimAligned(container, data, edata); + DimAligned * dim = new DimAligned(container, data, edata); dim->setLayerToActive(); dim->setPenToActive(); dim->update(); @@ -77,21 +77,21 @@ void ActionDimAligned::trigger() graphicView->moveRelativeZero(rz); drawSnapper(); - RS_DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId()); + DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId()); } void ActionDimAligned::preparePreview() { Vector dirV; dirV.setPolar(100.0, edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2.0); - RS_ConstructionLine cl(NULL, RS_ConstructionLineData(edata.extensionPoint2, + ConstructionLine cl(NULL, ConstructionLineData(edata.extensionPoint2, edata.extensionPoint2 + dirV)); data.definitionPoint = cl.getNearestPointOnEntity(data.definitionPoint); } void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimAligned::mouseMoveEvent begin"); + DEBUG->print("ActionDimAligned::mouseMoveEvent begin"); Vector mouse = snapPoint(e); switch (getStatus()) @@ -105,7 +105,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) { deletePreview(); clearPreview(); -// preview->addEntity(new RS_Line(preview, RS_LineData(edata.extensionPoint1, mouse))); +// preview->addEntity(new Line(preview, LineData(edata.extensionPoint1, mouse))); drawPreview(); } break; @@ -121,7 +121,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) preparePreview(); //data.text = getText(); -// RS_DimAligned * dim = new RS_DimAligned(preview, data, edata); +// DimAligned * dim = new DimAligned(preview, data, edata); // dim->update(); // preview->addEntity(dim); drawPreview(); @@ -132,7 +132,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimAligned::mouseMoveEvent end"); + DEBUG->print("ActionDimAligned::mouseMoveEvent end"); } void ActionDimAligned::mouseReleaseEvent(QMouseEvent * e) @@ -185,14 +185,14 @@ void ActionDimAligned::coordinateEvent(Vector * e) } } -void ActionDimAligned::commandEvent(RS_CommandEvent * e) +void ActionDimAligned::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -203,8 +203,8 @@ void ActionDimAligned::commandEvent(RS_CommandEvent * e) case SetText: setText(c); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); graphicView->enableCoordinateInput(); @@ -243,28 +243,28 @@ QStringList ActionDimAligned::getAvailableCommands() void ActionDimAligned::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetExtPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel")); break; case SetExtPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back")); break; case SetDefPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -272,8 +272,8 @@ void ActionDimAligned::updateMouseButtonHints() void ActionDimAligned::hideOptions() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); ActionDimension::hideOptions(); } @@ -282,7 +282,7 @@ void ActionDimAligned::showOptions() { ActionDimension::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); } diff --git a/src/actions/actiondimaligned.h b/src/actions/actiondimaligned.h index ba4900f..89044ba 100644 --- a/src/actions/actiondimaligned.h +++ b/src/actions/actiondimaligned.h @@ -25,7 +25,7 @@ class ActionDimAligned: public ActionDimension }; public: - ActionDimAligned(RS_EntityContainer & container, GraphicView & graphicView); + ActionDimAligned(EntityContainer & container, GraphicView & graphicView); ~ActionDimAligned(); virtual RS2::ActionType rtti(); @@ -35,7 +35,7 @@ class ActionDimAligned: public ActionDimension virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -45,7 +45,7 @@ class ActionDimAligned: public ActionDimension /** * Aligned dimension data. */ - RS_DimAlignedData edata; + DimAlignedData edata; /** Last status before entering text. */ Status lastStatus; diff --git a/src/actions/actiondimangular.cpp b/src/actions/actiondimangular.cpp index d2da018..b672222 100644 --- a/src/actions/actiondimangular.cpp +++ b/src/actions/actiondimangular.cpp @@ -23,7 +23,7 @@ #include "information.h" #include "preview.h" -ActionDimAngular::ActionDimAngular(RS_EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Angular Dimensions", +ActionDimAngular::ActionDimAngular(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Angular Dimensions", container, graphicView) { reset(); @@ -41,11 +41,11 @@ ActionDimAngular::~ActionDimAngular() void ActionDimAngular::reset() { ActionDimension::reset(); - edata = RS_DimAngularData(Vector(false), Vector(false), Vector(false), Vector(false)); + edata = DimAngularData(Vector(false), Vector(false), Vector(false), Vector(false)); line1 = NULL; line2 = NULL; center = Vector(false); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimAngular::trigger() @@ -54,9 +54,9 @@ void ActionDimAngular::trigger() if (line1 != NULL && line2 != NULL) { - RS_DimAngular * newEntity = NULL; + DimAngular * newEntity = NULL; - newEntity = new RS_DimAngular(container, + newEntity = new DimAngular(container, data, edata); @@ -79,13 +79,13 @@ void ActionDimAngular::trigger() graphicView->moveRelativeZero(rz); } else - RS_DEBUG->print("ActionDimAngular::trigger:" + DEBUG->print("ActionDimAngular::trigger:" " Entity is NULL\n"); } void ActionDimAngular::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimAngular::mouseMoveEvent begin"); + DEBUG->print("ActionDimAngular::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); @@ -104,7 +104,7 @@ void ActionDimAngular::mouseMoveEvent(QMouseEvent * e) Vector mouse = snapPoint(e); edata.definitionPoint4 = mouse; -// RS_DimAngular * d = new RS_DimAngular(preview, data, edata); +// DimAngular * d = new DimAngular(preview, data, edata); // d->update(); // // deletePreview(); @@ -118,7 +118,7 @@ void ActionDimAngular::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimAngular::mouseMoveEvent end"); + DEBUG->print("ActionDimAngular::mouseMoveEvent end"); } void ActionDimAngular::mouseReleaseEvent(QMouseEvent * e) @@ -129,12 +129,12 @@ void ActionDimAngular::mouseReleaseEvent(QMouseEvent * e) { case SetLine1: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL && en->rtti() == RS2::EntityLine) { - line1 = (RS_Line *)en; + line1 = (Line *)en; setStatus(SetLine2); } } @@ -142,15 +142,15 @@ void ActionDimAngular::mouseReleaseEvent(QMouseEvent * e) case SetLine2: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL && en->rtti() == RS2::EntityLine) { - line2 = (RS_Line *)en; + line2 = (Line *)en; VectorSolutions sol = - RS_Information::getIntersectionLineLine(line1, line2); + Information::getIntersectionLineLine(line1, line2); if (sol.get(0).valid) { @@ -222,13 +222,13 @@ void ActionDimAngular::coordinateEvent(Vector * e) } } -void ActionDimAngular::commandEvent(RS_CommandEvent * e) +void ActionDimAngular::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -237,7 +237,7 @@ void ActionDimAngular::commandEvent(RS_CommandEvent * e) if (getStatus() == SetText) { setText(c); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); return; @@ -275,14 +275,14 @@ void ActionDimAngular::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDimAngular::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDimAngular::updateMouseButtonHints() @@ -290,26 +290,26 @@ void ActionDimAngular::updateMouseButtonHints() switch (getStatus()) { case SetLine1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first line"), + DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel")); break; case SetLine2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second line"), + DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Cancel")); break; case SetPos: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify dimension arc line location"), tr("Cancel")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } diff --git a/src/actions/actiondimangular.h b/src/actions/actiondimangular.h index 26e6b0e..c790bb4 100644 --- a/src/actions/actiondimangular.h +++ b/src/actions/actiondimangular.h @@ -5,7 +5,7 @@ #include "dimangular.h" #include "vector.h" -class RS_Line; +class Line; /** * This action class can handle user events to draw angular dimensions. @@ -23,7 +23,7 @@ class ActionDimAngular: public ActionDimension }; public: - ActionDimAngular(RS_EntityContainer & container, GraphicView & graphicView); + ActionDimAngular(EntityContainer & container, GraphicView & graphicView); ~ActionDimAngular(); virtual RS2::ActionType rtti(); @@ -32,7 +32,7 @@ class ActionDimAngular: public ActionDimension virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -40,13 +40,13 @@ class ActionDimAngular: public ActionDimension private: /** 1st chosen line */ - RS_Line * line1; + Line * line1; /** 2nd chosen line */ - RS_Line * line2; + Line * line2; /** Center of arc */ Vector center; /** Data of new dimension */ - RS_DimAngularData edata; + DimAngularData edata; /** Last status before entering text. */ Status lastStatus; }; diff --git a/src/actions/actiondimdiametric.cpp b/src/actions/actiondimdiametric.cpp index fad94bf..8b51350 100644 --- a/src/actions/actiondimdiametric.cpp +++ b/src/actions/actiondimdiametric.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDimDiametric::ActionDimDiametric(RS_EntityContainer & container, +ActionDimDiametric::ActionDimDiametric(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Diametric Dimensions", container, graphicView) { @@ -41,10 +41,10 @@ ActionDimDiametric::~ActionDimDiametric() void ActionDimDiametric::reset() { ActionDimension::reset(); - edata = RS_DimDiametricData(Vector(false), 0.0); + edata = DimDiametricData(Vector(false), 0.0); entity = NULL; pos = Vector(false); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimDiametric::trigger() @@ -54,9 +54,9 @@ void ActionDimDiametric::trigger() if (entity) { - RS_DimDiametric * newEntity = NULL; + DimDiametric * newEntity = NULL; - newEntity = new RS_DimDiametric(container, + newEntity = new DimDiametric(container, data, edata); @@ -80,7 +80,7 @@ void ActionDimDiametric::trigger() graphicView->moveRelativeZero(rz); } else - RS_DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n"); + DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n"); } void ActionDimDiametric::preparePreview() @@ -92,13 +92,13 @@ void ActionDimDiametric::preparePreview() if (entity->rtti() == RS2::EntityArc) { - radius = ((RS_Arc *)entity)->getRadius(); - center = ((RS_Arc *)entity)->getCenter(); + radius = ((Arc *)entity)->getRadius(); + center = ((Arc *)entity)->getCenter(); } else if (entity->rtti() == RS2::EntityCircle) { - radius = ((RS_Circle *)entity)->getRadius(); - center = ((RS_Circle *)entity)->getCenter(); + radius = ((Circle *)entity)->getRadius(); + center = ((Circle *)entity)->getCenter(); } double angle = center.angleTo(pos); @@ -112,7 +112,7 @@ void ActionDimDiametric::preparePreview() void ActionDimDiametric::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent begin"); + DEBUG->print("ActionDimDiametric::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); @@ -129,7 +129,7 @@ void ActionDimDiametric::mouseMoveEvent(QMouseEvent * e) pos = snapPoint(e); preparePreview(); -// RS_DimDiametric * d = new RS_DimDiametric(preview, data, edata); +// DimDiametric * d = new DimDiametric(preview, data, edata); // d->update(); // // deletePreview(); @@ -143,7 +143,7 @@ void ActionDimDiametric::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent end"); + DEBUG->print("ActionDimDiametric::mouseMoveEvent end"); } void ActionDimDiametric::mouseReleaseEvent(QMouseEvent * e) @@ -153,7 +153,7 @@ void ActionDimDiametric::mouseReleaseEvent(QMouseEvent * e) switch (getStatus()) { case SetEntity: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL) { @@ -165,15 +165,15 @@ void ActionDimDiametric::mouseReleaseEvent(QMouseEvent * e) if (entity->rtti() == RS2::EntityArc) center = - ((RS_Arc *)entity)->getCenter(); + ((Arc *)entity)->getCenter(); else if (entity->rtti() == RS2::EntityCircle) center = - ((RS_Circle *)entity)->getCenter(); + ((Circle *)entity)->getCenter(); graphicView->moveRelativeZero(center); setStatus(SetPos); } else - RS_DIALOGFACTORY->commandMessage(tr("Not a circle " + DIALOGFACTORY->commandMessage(tr("Not a circle " "or arc entity")); } } @@ -217,13 +217,13 @@ void ActionDimDiametric::coordinateEvent(Vector * e) } } -void ActionDimDiametric::commandEvent(RS_CommandEvent * e) +void ActionDimDiametric::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -232,7 +232,7 @@ void ActionDimDiametric::commandEvent(RS_CommandEvent * e) if (getStatus() == SetText) { setText(c); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); return; @@ -250,18 +250,18 @@ void ActionDimDiametric::commandEvent(RS_CommandEvent * e) if (getStatus() == SetPos) { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - pos.setPolar(1.0, RS_Math::deg2rad(a)); + pos.setPolar(1.0, Math::deg2rad(a)); pos += data.definitionPoint; trigger(); reset(); setStatus(SetEntity); } else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); return; } } @@ -289,21 +289,21 @@ void ActionDimDiametric::updateMouseButtonHints() switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"), tr("Cancel")); break; case SetPos: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify dimension line location"), tr("Cancel")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -312,13 +312,13 @@ void ActionDimDiametric::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDimDiametric::hideOptions() { ActionInterface::hideOptions(); - //RS_DIALOGFACTORY->requestDimDiametricOptions(edata, false); - RS_DIALOGFACTORY->requestOptions(this, false); + //DIALOGFACTORY->requestDimDiametricOptions(edata, false); + DIALOGFACTORY->requestOptions(this, false); } diff --git a/src/actions/actiondimdiametric.h b/src/actions/actiondimdiametric.h index 86c1182..676509f 100644 --- a/src/actions/actiondimdiametric.h +++ b/src/actions/actiondimdiametric.h @@ -5,7 +5,7 @@ #include "dimdiametric.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw diametric dimensions. @@ -23,7 +23,7 @@ class ActionDimDiametric: public ActionDimension }; public: - ActionDimDiametric(RS_EntityContainer & container, GraphicView & graphicView); + ActionDimDiametric(EntityContainer & container, GraphicView & graphicView); ~ActionDimDiametric(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDimDiametric: public ActionDimension virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -41,11 +41,11 @@ class ActionDimDiametric: public ActionDimension private: /** Chosen entity (arc / circle) */ - RS_Entity * entity; + Entity * entity; /** Chosen position */ Vector pos; /** Data of new dimension */ - RS_DimDiametricData edata; + DimDiametricData edata; /** Last status before entering text. */ Status lastStatus; }; diff --git a/src/actions/actiondimension.cpp b/src/actions/actiondimension.cpp index 2de2085..86bae2c 100644 --- a/src/actions/actiondimension.cpp +++ b/src/actions/actiondimension.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "graphicview.h" -ActionDimension::ActionDimension(const char * name, RS_EntityContainer & container, GraphicView & graphicView): +ActionDimension::ActionDimension(const char * name, EntityContainer & container, GraphicView & graphicView): ActionInterface(name, container, graphicView) { reset(); @@ -31,7 +31,7 @@ ActionDimension::~ActionDimension() void ActionDimension::reset() { - data = RS_DimensionData(Vector(false), Vector(false), RS2::VAlignMiddle, + data = DimensionData(Vector(false), Vector(false), RS2::VAlignMiddle, RS2::HAlignCenter, RS2::Exact, 1.0, "", "Standard", 0.0); diameter = false; } @@ -45,16 +45,16 @@ void ActionDimension::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } void ActionDimension::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimension::updateMouseCursor() @@ -64,13 +64,13 @@ void ActionDimension::updateMouseCursor() void ActionDimension::updateToolBar() { - if (!RS_DIALOGFACTORY) + if (!DIALOGFACTORY) return; if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarDim); + DIALOGFACTORY->requestToolBar(RS2::ToolBarDim); } QString ActionDimension::getText() diff --git a/src/actions/actiondimension.h b/src/actions/actiondimension.h index 23840ab..935fe68 100644 --- a/src/actions/actiondimension.h +++ b/src/actions/actiondimension.h @@ -14,7 +14,7 @@ class ActionDimension: public ActionInterface { public: - ActionDimension(const char * name, RS_EntityContainer & container, GraphicView & graphicView); + ActionDimension(const char * name, EntityContainer & container, GraphicView & graphicView); ~ActionDimension(); virtual void reset(); @@ -39,7 +39,7 @@ class ActionDimension: public ActionInterface /** * Generic dimension data. */ - RS_DimensionData data; + DimensionData data; QString label; QString tol1; diff --git a/src/actions/actiondimleader.cpp b/src/actions/actiondimleader.cpp index c0ef6f9..f65ff31 100644 --- a/src/actions/actiondimleader.cpp +++ b/src/actions/actiondimleader.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDimLeader::ActionDimLeader(RS_EntityContainer & container, GraphicView & graphicView): +ActionDimLeader::ActionDimLeader(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw leaders", container, graphicView) { reset(); @@ -39,7 +39,7 @@ ActionDimLeader::~ActionDimLeader() void ActionDimLeader::reset() { - //data = RS_LineData(Vector(false), Vector(false)); + //data = LineData(Vector(false), Vector(false)); //start = Vector(false); //history.clear(); points.clear(); @@ -58,7 +58,7 @@ void ActionDimLeader::trigger() if (points.count() > 0) { - RS_Leader * leader = new RS_Leader(container, RS_LeaderData(true)); + Leader * leader = new Leader(container, LeaderData(true)); leader->setLayerToActive(); leader->setPenToActive(); @@ -86,13 +86,13 @@ void ActionDimLeader::trigger() graphicView->moveRelativeZero(rz); //drawSnapper(); - RS_DEBUG->print("ActionDimLeader::trigger(): leader added: %d", leader->getId()); + DEBUG->print("ActionDimLeader::trigger(): leader added: %d", leader->getId()); } } void ActionDimLeader::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimLeader::mouseMoveEvent begin"); + DEBUG->print("ActionDimLeader::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -109,17 +109,17 @@ void ActionDimLeader::mouseMoveEvent(QMouseEvent * e) Vector * v = points[i]; // if (last.valid) -// preview->addEntity(new RS_Line(preview, RS_LineData(last, *v))); +// preview->addEntity(new Line(preview, LineData(last, *v))); last = *v; } Vector p = *points.last(); -// preview->addEntity(new RS_Line(preview, RS_LineData(p, mouse))); +// preview->addEntity(new Line(preview, LineData(p, mouse))); drawPreview(); } - RS_DEBUG->print("ActionDimLeader::mouseMoveEvent end"); + DEBUG->print("ActionDimLeader::mouseMoveEvent end"); } void ActionDimLeader::mouseReleaseEvent(QMouseEvent * e) @@ -187,14 +187,14 @@ void ActionDimLeader::coordinateEvent(Vector * e) } } -void ActionDimLeader::commandEvent(RS_CommandEvent * e) +void ActionDimLeader::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -219,20 +219,20 @@ QStringList ActionDimLeader::getAvailableCommands() void ActionDimLeader::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetStartpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Cancel")); break; case SetEndpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Finish")); + DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Finish")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -255,11 +255,11 @@ void ActionDimLeader::updateMouseCursor() void ActionDimLeader::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarDim); + DIALOGFACTORY->requestToolBar(RS2::ToolBarDim); } } diff --git a/src/actions/actiondimleader.h b/src/actions/actiondimleader.h index 3db3b0a..eff2500 100644 --- a/src/actions/actiondimleader.h +++ b/src/actions/actiondimleader.h @@ -25,7 +25,7 @@ class ActionDimLeader: public ActionInterface }; public: - ActionDimLeader(RS_EntityContainer & container, GraphicView & graphicView); + ActionDimLeader(EntityContainer & container, GraphicView & graphicView); ~ActionDimLeader(); virtual RS2::ActionType rtti(); @@ -36,7 +36,7 @@ class ActionDimLeader: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); virtual void keyPressEvent(QKeyEvent *); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -48,7 +48,7 @@ class ActionDimLeader: public ActionInterface /** * Leader entity. */ - RS_Leader * leader; + Leader * leader; /** * Points set so far. */ diff --git a/src/actions/actiondimlinear.cpp b/src/actions/actiondimlinear.cpp index cc22e46..3191f1c 100644 --- a/src/actions/actiondimlinear.cpp +++ b/src/actions/actiondimlinear.cpp @@ -30,7 +30,7 @@ * @param fixedAngle true: The user can't change the angle. * false: The user can change the angle in a option widget. */ -ActionDimLinear::ActionDimLinear(RS_EntityContainer & container, +ActionDimLinear::ActionDimLinear(EntityContainer & container, GraphicView & graphicView, double angle, bool fixedAngle): ActionDimension("Draw linear dimensions", container, graphicView) { @@ -54,17 +54,17 @@ ActionDimLinear::~ActionDimLinear() void ActionDimLinear::reset() { ActionDimension::reset(); - edata = RS_DimLinearData(Vector(false), Vector(false), (fixedAngle ? edata.angle : 0.0), 0.0); + edata = DimLinearData(Vector(false), Vector(false), (fixedAngle ? edata.angle : 0.0), 0.0); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimLinear::trigger() { ActionDimension::trigger(); preparePreview(); - RS_DimLinear * dim = new RS_DimLinear(container, data, edata); + DimLinear * dim = new DimLinear(container, data, edata); dim->setLayerToActive(); dim->setPenToActive(); dim->update(); @@ -87,7 +87,7 @@ void ActionDimLinear::trigger() graphicView->snapper.SetVisible(false); graphicView->redraw(); - RS_DEBUG->print("ActionDimLinear::trigger(): dim added: %d", dim->getId()); + DEBUG->print("ActionDimLinear::trigger(): dim added: %d", dim->getId()); } void ActionDimLinear::preparePreview() @@ -95,7 +95,7 @@ void ActionDimLinear::preparePreview() Vector dirV; dirV.setPolar(100.0, edata.angle + M_PI / 2.0); - RS_ConstructionLine cl(NULL, RS_ConstructionLineData(edata.extensionPoint2, + ConstructionLine cl(NULL, ConstructionLineData(edata.extensionPoint2, edata.extensionPoint2 + dirV)); data.definitionPoint = cl.getNearestPointOnEntity(data.definitionPoint); @@ -103,7 +103,7 @@ void ActionDimLinear::preparePreview() void ActionDimLinear::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimLinear::mouseMoveEvent begin"); + DEBUG->print("ActionDimLinear::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -120,12 +120,12 @@ void ActionDimLinear::mouseMoveEvent(QMouseEvent * e) { // deletePreview(); // clearPreview(); -// preview->addEntity(new RS_Line(preview, -// RS_LineData(edata.extensionPoint1, mouse))); +// preview->addEntity(new Line(preview, +// LineData(edata.extensionPoint1, mouse))); // drawPreview(); graphicView->preview.clear(); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), - RS_LineData(edata.extensionPoint1, mouse))); + graphicView->preview.addEntity(new Line(&(graphicView->preview), + LineData(edata.extensionPoint1, mouse))); graphicView->preview.SetVisible(); graphicView->redraw(); } @@ -140,13 +140,13 @@ void ActionDimLinear::mouseMoveEvent(QMouseEvent * e) // clearPreview(); data.definitionPoint = mouse; // preparePreview(); -// RS_DimLinear * dim = new RS_DimLinear(preview, data, edata); +// DimLinear * dim = new DimLinear(preview, data, edata); // dim->update(); // preview->addEntity(dim); // drawPreview(); graphicView->preview.clear(); preparePreview(); - RS_DimLinear * dim = new RS_DimLinear(&(graphicView->preview), data, edata); + DimLinear * dim = new DimLinear(&(graphicView->preview), data, edata); dim->update(); graphicView->preview.addEntity(dim); graphicView->preview.SetVisible(); @@ -156,7 +156,7 @@ void ActionDimLinear::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimLinear::mouseMoveEvent end"); + DEBUG->print("ActionDimLinear::mouseMoveEvent end"); } void ActionDimLinear::mouseReleaseEvent(QMouseEvent * e) @@ -214,14 +214,14 @@ void ActionDimLinear::coordinateEvent(Vector * e) } } -void ActionDimLinear::commandEvent(RS_CommandEvent * e) +void ActionDimLinear::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -231,8 +231,8 @@ void ActionDimLinear::commandEvent(RS_CommandEvent * e) case SetText: setText(c); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); @@ -241,15 +241,15 @@ void ActionDimLinear::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - setAngle(RS_Math::deg2rad(a)); - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + setAngle(Math::deg2rad(a)); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } @@ -299,35 +299,35 @@ QStringList ActionDimLinear::getAvailableCommands() void ActionDimLinear::updateMouseButtonHints() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { switch (getStatus()) { case SetExtPoint1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first extension line origin"), tr("Cancel")); break; case SetExtPoint2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify second extension line origin"), tr("Back")); break; case SetDefPoint: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify dimension line location"), tr("Back")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension line angle:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension line angle:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -337,16 +337,16 @@ void ActionDimLinear::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimLinear::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } double ActionDimLinear::getAngle() diff --git a/src/actions/actiondimlinear.h b/src/actions/actiondimlinear.h index 8b41e94..755b0e6 100644 --- a/src/actions/actiondimlinear.h +++ b/src/actions/actiondimlinear.h @@ -34,7 +34,7 @@ class ActionDimLinear: public ActionDimension }; public: - ActionDimLinear(RS_EntityContainer & container, GraphicView & graphicView, + ActionDimLinear(EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false); ~ActionDimLinear(); @@ -45,7 +45,7 @@ class ActionDimLinear: public ActionDimension virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -58,7 +58,7 @@ class ActionDimLinear: public ActionDimension /** * Aligned dimension data. */ - RS_DimLinearData edata; + DimLinearData edata; /** * Is the angle fixed? */ diff --git a/src/actions/actiondimradial.cpp b/src/actions/actiondimradial.cpp index 4fd12fe..4feb389 100644 --- a/src/actions/actiondimradial.cpp +++ b/src/actions/actiondimradial.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDimRadial::ActionDimRadial(RS_EntityContainer & container, GraphicView & graphicView): +ActionDimRadial::ActionDimRadial(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Radial Dimensions", container, graphicView) { reset(); @@ -41,10 +41,10 @@ void ActionDimRadial::reset() { ActionDimension::reset(); - edata = RS_DimRadialData(Vector(false), 0.0); + edata = DimRadialData(Vector(false), 0.0); entity = NULL; pos = Vector(false); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimRadial::trigger() @@ -55,7 +55,7 @@ void ActionDimRadial::trigger() if (entity) { - RS_DimRadial * newEntity = new RS_DimRadial(container, data, edata); + DimRadial * newEntity = new DimRadial(container, data, edata); newEntity->setLayerToActive(); newEntity->setPenToActive(); newEntity->update(); @@ -77,7 +77,7 @@ void ActionDimRadial::trigger() //drawSnapper(); } else - RS_DEBUG->print("ActionDimRadial::trigger: Entity is NULL\n"); + DEBUG->print("ActionDimRadial::trigger: Entity is NULL\n"); } void ActionDimRadial::preparePreview() @@ -88,9 +88,9 @@ void ActionDimRadial::preparePreview() double radius = 0.0; if (entity->rtti() == RS2::EntityArc) - radius = ((RS_Arc *)entity)->getRadius(); + radius = ((Arc *)entity)->getRadius(); else if (entity->rtti() == RS2::EntityCircle) - radius = ((RS_Circle *)entity)->getRadius(); + radius = ((Circle *)entity)->getRadius(); edata.definitionPoint.setPolar(radius, angle); edata.definitionPoint += data.definitionPoint; @@ -99,7 +99,7 @@ void ActionDimRadial::preparePreview() void ActionDimRadial::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimRadial::mouseMoveEvent begin"); + DEBUG->print("ActionDimRadial::mouseMoveEvent begin"); switch (getStatus()) { @@ -115,7 +115,7 @@ void ActionDimRadial::mouseMoveEvent(QMouseEvent * e) preparePreview(); -// RS_DimRadial * d = new RS_DimRadial(preview, data, edata); +// DimRadial * d = new DimRadial(preview, data, edata); // d->update(); // // deletePreview(); @@ -129,7 +129,7 @@ void ActionDimRadial::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimRadial::mouseMoveEvent end"); + DEBUG->print("ActionDimRadial::mouseMoveEvent end"); } void ActionDimRadial::mouseReleaseEvent(QMouseEvent * e) @@ -139,7 +139,7 @@ void ActionDimRadial::mouseReleaseEvent(QMouseEvent * e) switch (getStatus()) { case SetEntity: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL) { @@ -150,15 +150,15 @@ void ActionDimRadial::mouseReleaseEvent(QMouseEvent * e) if (entity->rtti() == RS2::EntityArc) data.definitionPoint = - ((RS_Arc *)entity)->getCenter(); + ((Arc *)entity)->getCenter(); else if (entity->rtti() == RS2::EntityCircle) data.definitionPoint = - ((RS_Circle *)entity)->getCenter(); + ((Circle *)entity)->getCenter(); graphicView->moveRelativeZero(data.definitionPoint); setStatus(SetPos); } else - RS_DIALOGFACTORY->commandMessage(tr("Not a circle " + DIALOGFACTORY->commandMessage(tr("Not a circle " "or arc entity")); } } @@ -202,13 +202,13 @@ void ActionDimRadial::coordinateEvent(Vector * e) } } -void ActionDimRadial::commandEvent(RS_CommandEvent * e) +void ActionDimRadial::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -217,7 +217,7 @@ void ActionDimRadial::commandEvent(RS_CommandEvent * e) if (getStatus() == SetText) { setText(c); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); return; @@ -235,18 +235,18 @@ void ActionDimRadial::commandEvent(RS_CommandEvent * e) if (getStatus() == SetPos) { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - pos.setPolar(1.0, RS_Math::deg2rad(a)); + pos.setPolar(1.0, Math::deg2rad(a)); pos += data.definitionPoint; trigger(); reset(); setStatus(SetEntity); } else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); return; } @@ -275,22 +275,22 @@ void ActionDimRadial::updateMouseButtonHints() switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"), tr("Cancel")); break; case SetPos: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify dimension line position or enter angle:"), tr("Cancel")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -299,16 +299,16 @@ void ActionDimRadial::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); - //RS_DIALOGFACTORY->requestDimRadialOptions(edata, true); + DIALOGFACTORY->requestOptions(this, true); + //DIALOGFACTORY->requestDimRadialOptions(edata, true); } void ActionDimRadial::hideOptions() { ActionInterface::hideOptions(); - //RS_DIALOGFACTORY->requestDimRadialOptions(edata, false); - RS_DIALOGFACTORY->requestOptions(this, false); + //DIALOGFACTORY->requestDimRadialOptions(edata, false); + DIALOGFACTORY->requestOptions(this, false); } diff --git a/src/actions/actiondimradial.h b/src/actions/actiondimradial.h index d07772f..1399703 100644 --- a/src/actions/actiondimradial.h +++ b/src/actions/actiondimradial.h @@ -5,7 +5,7 @@ #include "dimradial.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw radial dimensions. @@ -23,7 +23,7 @@ class ActionDimRadial: public ActionDimension }; public: - ActionDimRadial(RS_EntityContainer & container, GraphicView & graphicView); + ActionDimRadial(EntityContainer & container, GraphicView & graphicView); ~ActionDimRadial(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDimRadial: public ActionDimension virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -41,11 +41,11 @@ class ActionDimRadial: public ActionDimension private: /** Chosen entity (arc / circle) */ - RS_Entity * entity; + Entity * entity; /** Chosen position */ Vector pos; /** Data of new dimension */ - RS_DimRadialData edata; + DimRadialData edata; /** Last status before entering text. */ Status lastStatus; }; diff --git a/src/actions/actiondrawarc.cpp b/src/actions/actiondrawarc.cpp index be608fe..a833e58 100644 --- a/src/actions/actiondrawarc.cpp +++ b/src/actions/actiondrawarc.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawArc::ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawArc::ActionDrawArc(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs", container, graphicView) { reset(); @@ -41,9 +41,9 @@ RS2::ActionType ActionDrawArc::rtti() void ActionDrawArc::reset() { if (data.reversed) - data = RS_ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true); + data = ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true); else - data = RS_ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false); + data = ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false); } void ActionDrawArc::init(int status) @@ -56,7 +56,7 @@ void ActionDrawArc::trigger() { ActionInterface::trigger(); - RS_Arc * arc = new RS_Arc(container, data); + Arc * arc = new Arc(container, data); arc->setLayerToActive(); arc->setPenToActive(); container->addEntity(arc); @@ -78,12 +78,12 @@ void ActionDrawArc::trigger() setStatus(SetCenter); reset(); - RS_DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId()); + DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId()); } void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawArc::mouseMoveEvent begin"); + DEBUG->print("ActionDrawArc::mouseMoveEvent begin"); Vector mouse = snapPoint(e); switch (getStatus()) @@ -99,7 +99,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.radius = data.center.distanceTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Circle(preview, RS_CircleData(data.center, data.radius))); +// preview->addEntity(new Circle(preview, CircleData(data.center, data.radius))); drawPreview(); } break; @@ -108,13 +108,13 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle1 = data.center.angleTo(mouse); if (data.reversed) - data.angle2 = RS_Math::correctAngle(data.angle1 - M_PI / 3); + data.angle2 = Math::correctAngle(data.angle1 - M_PI / 3); else - data.angle2 = RS_Math::correctAngle(data.angle1 + M_PI / 3); + data.angle2 = Math::correctAngle(data.angle1 + M_PI / 3); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -122,7 +122,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.center.angleTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -130,7 +130,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.angle1 + data.center.angleTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -143,7 +143,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.angle1 + asin(x / (2 * data.radius)) * 2; deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); } } @@ -153,7 +153,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawArc::mouseMoveEvent end"); + DEBUG->print("ActionDrawArc::mouseMoveEvent end"); } void ActionDrawArc::mouseReleaseEvent(QMouseEvent * e) @@ -227,25 +227,25 @@ void ActionDrawArc::coordinateEvent(Vector * e) } } -void ActionDrawArc::commandEvent(RS_CommandEvent * e) +void ActionDrawArc::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); - if (RS_COMMANDS->checkCommand("help", c)) + if (COMMANDS->checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } - if (RS_COMMANDS->checkCommand("reversed", c)) + if (COMMANDS->checkCommand("reversed", c)) { e->accept(); setReversed(!isReversed()); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); return; } @@ -253,74 +253,74 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) { case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok == true) { data.radius = r; setStatus(SetAngle1); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle1: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle1 = RS_Math::deg2rad(a); + data.angle1 = Math::deg2rad(a); setStatus(SetAngle2); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle2: - if (RS_COMMANDS->checkCommand("angle", c)) + if (COMMANDS->checkCommand("angle", c)) setStatus(SetIncAngle); - else if (RS_COMMANDS->checkCommand("chord length", c)) + else if (COMMANDS->checkCommand("chord length", c)) setStatus(SetChordLength); else { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle2 = RS_Math::deg2rad(a); + data.angle2 = Math::deg2rad(a); trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetIncAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle2 = data.angle1 + RS_Math::deg2rad(a); + data.angle2 = data.angle1 + Math::deg2rad(a); trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetChordLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok == true) { @@ -329,13 +329,13 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) data.angle2 = data.angle1 + asin(l / (2 * data.radius)) * 2; trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage( + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage( tr("Not a valid chord length")); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; @@ -348,47 +348,47 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) QStringList ActionDrawArc::getAvailableCommands() { QStringList cmd; - cmd += RS_COMMANDS->command("reversed"); + cmd += COMMANDS->command("reversed"); return cmd; } void ActionDrawArc::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCenter: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); break; case SetRadius: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); break; case SetAngle1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify start angle:"), tr("Back")); break; case SetAngle2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify end angle or [Angle/chord Length]"), tr("Back")); break; case SetIncAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"), + DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"), tr("Back")); break; case SetChordLength: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"), + DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -398,16 +398,16 @@ void ActionDrawArc::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawArc::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawArc::updateMouseCursor() @@ -417,13 +417,13 @@ void ActionDrawArc::updateMouseCursor() void ActionDrawArc::updateToolBar() { - if (!RS_DIALOGFACTORY) + if (!DIALOGFACTORY) return; if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); + DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); } bool ActionDrawArc::isReversed() diff --git a/src/actions/actiondrawarc.h b/src/actions/actiondrawarc.h index adf4f09..5d8f74f 100644 --- a/src/actions/actiondrawarc.h +++ b/src/actions/actiondrawarc.h @@ -27,7 +27,7 @@ class ActionDrawArc: public ActionInterface }; public: - ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawArc(EntityContainer & container, GraphicView & graphicView); ~ActionDrawArc(); virtual RS2::ActionType rtti(); @@ -37,7 +37,7 @@ class ActionDrawArc: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -51,7 +51,7 @@ class ActionDrawArc: public ActionInterface /** * Arc data defined so far. */ - RS_ArcData data; + ArcData data; }; #endif // __ACTIONDRAWARC_H__ diff --git a/src/actions/actiondrawarc3p.cpp b/src/actions/actiondrawarc3p.cpp index ce3d658..77ed90f 100644 --- a/src/actions/actiondrawarc3p.cpp +++ b/src/actions/actiondrawarc3p.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawArc3P::ActionDrawArc3P(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawArc3P::ActionDrawArc3P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs 3P", container, graphicView) { reset(); @@ -55,7 +55,7 @@ void ActionDrawArc3P::trigger() if (data.isValid()) { - RS_Arc * arc = new RS_Arc(container, data); + Arc * arc = new Arc(container, data); arc->setLayerToActive(); arc->setPenToActive(); container->addEntity(arc); @@ -78,7 +78,7 @@ void ActionDrawArc3P::trigger() reset(); } else - RS_DIALOGFACTORY->commandMessage(tr("Invalid arc data.")); + DIALOGFACTORY->commandMessage(tr("Invalid arc data.")); } void ActionDrawArc3P::preparePreview() @@ -87,7 +87,7 @@ void ActionDrawArc3P::preparePreview() if (point1.valid && point2.valid && point3.valid) { - RS_Arc arc(NULL, data); + Arc arc(NULL, data); bool suc = arc.createFrom3P(point1, point2, point3); if (suc) @@ -110,7 +110,7 @@ void ActionDrawArc3P::mouseMoveEvent(QMouseEvent * e) if (point1.valid) { -// RS_Line * line = new RS_Line(preview, RS_LineData(point1, point2)); +// Line * line = new Line(preview, LineData(point1, point2)); // // deletePreview(); // clearPreview(); @@ -125,7 +125,7 @@ void ActionDrawArc3P::mouseMoveEvent(QMouseEvent * e) if (data.isValid()) { -// RS_Arc * arc = new RS_Arc(preview, data); +// Arc * arc = new Arc(preview, data); // // deletePreview(); // clearPreview(); @@ -185,18 +185,18 @@ void ActionDrawArc3P::coordinateEvent(Vector * e) } } -void ActionDrawArc3P::commandEvent(RS_CommandEvent * e) +void ActionDrawArc3P::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } - if (RS_COMMANDS->checkCommand("center", c, rtti())) + if (COMMANDS->checkCommand("center", c, rtti())) { finish(); graphicView->setCurrentAction(new ActionDrawArc(*container, *graphicView)); @@ -214,19 +214,19 @@ void ActionDrawArc3P::updateMouseButtonHints() switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify startpoint or [Center]"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify startpoint or [Center]"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); break; case SetPoint3: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -239,8 +239,8 @@ void ActionDrawArc3P::updateMouseCursor() void ActionDrawArc3P::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); + DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); } diff --git a/src/actions/actiondrawarc3p.h b/src/actions/actiondrawarc3p.h index 64f627b..614cbe1 100644 --- a/src/actions/actiondrawarc3p.h +++ b/src/actions/actiondrawarc3p.h @@ -25,7 +25,7 @@ class ActionDrawArc3P: public ActionInterface }; public: - ActionDrawArc3P(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawArc3P(EntityContainer & container, GraphicView & graphicView); ~ActionDrawArc3P(); void reset(); @@ -35,7 +35,7 @@ class ActionDrawArc3P: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); @@ -45,7 +45,7 @@ class ActionDrawArc3P: public ActionInterface /** * Arc data defined so far. */ - RS_ArcData data; + ArcData data; /** * 1st point. */ diff --git a/src/actions/actiondrawarctangential.cpp b/src/actions/actiondrawarctangential.cpp index 7ad86a7..f1691fc 100644 --- a/src/actions/actiondrawarctangential.cpp +++ b/src/actions/actiondrawarctangential.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawArcTangential::ActionDrawArcTangential(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs tangential", +ActionDrawArcTangential::ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs tangential", container, graphicView) { reset(); @@ -56,13 +56,13 @@ void ActionDrawArcTangential::trigger() if (point.valid == false || baseEntity == NULL) { - RS_DEBUG->print("ActionDrawArcTangential::trigger: " + DEBUG->print("ActionDrawArcTangential::trigger: " "conditions not met"); return; } preparePreview(); - RS_Arc * arc = new RS_Arc(container, data); + Arc * arc = new Arc(container, data); arc->setLayerToActive(); arc->setPenToActive(); container->addEntity(arc); @@ -95,15 +95,15 @@ void ActionDrawArcTangential::preparePreview() if (isStartPoint) { startPoint = baseEntity->getStartpoint(); - direction = RS_Math::correctAngle(baseEntity->getDirection1() + M_PI); + direction = Math::correctAngle(baseEntity->getDirection1() + M_PI); } else { startPoint = baseEntity->getEndpoint(); - direction = RS_Math::correctAngle(baseEntity->getDirection2() + M_PI); + direction = Math::correctAngle(baseEntity->getDirection2() + M_PI); } - RS_Arc arc(NULL, RS_ArcData()); + Arc arc(NULL, ArcData()); bool suc = arc.createFrom2PDirectionRadius(startPoint, point, direction, data.radius); if (suc) @@ -124,7 +124,7 @@ void ActionDrawArcTangential::mouseMoveEvent(QMouseEvent * e) if (data.isValid()) { -// RS_Arc * arc = new RS_Arc(preview, data); +// Arc * arc = new Arc(preview, data); // deletePreview(); // clearPreview(); // preview->addEntity(arc); @@ -147,13 +147,13 @@ void ActionDrawArcTangential::mouseReleaseEvent(QMouseEvent * e) case SetBaseEntity: { Vector coord = graphicView->toGraph(e->x(), e->y()); - RS_Entity * entity = catchEntity(coord, RS2::ResolveAll); + Entity * entity = catchEntity(coord, RS2::ResolveAll); if (entity != NULL) { if (entity->isAtomic()) { - baseEntity = (RS_AtomicEntity *)entity; + baseEntity = (AtomicEntity *)entity; if (baseEntity->getStartpoint().distanceTo(coord) < baseEntity->getEndpoint().distanceTo(coord)) @@ -212,13 +212,13 @@ void ActionDrawArcTangential::coordinateEvent(Vector * e) } } -void ActionDrawArcTangential::commandEvent(RS_CommandEvent * e) +void ActionDrawArcTangential::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -234,8 +234,8 @@ void ActionDrawArcTangential::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); updateMouseButtonHints(); } @@ -243,8 +243,8 @@ void ActionDrawArcTangential::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawArcTangential::updateMouseButtonHints() @@ -252,18 +252,18 @@ void ActionDrawArcTangential::updateMouseButtonHints() switch (getStatus()) { case SetBaseEntity: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify base entity"), tr("Cancel")); break; case SetEndAngle: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify end angle"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -276,9 +276,9 @@ void ActionDrawArcTangential::updateMouseCursor() void ActionDrawArcTangential::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); + DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); } void ActionDrawArcTangential::setRadius(double r) diff --git a/src/actions/actiondrawarctangential.h b/src/actions/actiondrawarctangential.h index 4e9ace4..71a6b26 100644 --- a/src/actions/actiondrawarctangential.h +++ b/src/actions/actiondrawarctangential.h @@ -5,7 +5,7 @@ #include "arc.h" #include "vector.h" -class RS_AtomicEntity; +class AtomicEntity; /** * This action class can handle user events to draw @@ -26,7 +26,7 @@ class ActionDrawArcTangential: public ActionInterface }; public: - ActionDrawArcTangential(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView); ~ActionDrawArcTangential(); virtual RS2::ActionType rtti(); @@ -37,7 +37,7 @@ class ActionDrawArcTangential: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -51,7 +51,7 @@ class ActionDrawArcTangential: public ActionInterface /** * Base entity. */ - RS_AtomicEntity * baseEntity; + AtomicEntity * baseEntity; /** * Start point of base entity clicked? */ @@ -63,7 +63,7 @@ class ActionDrawArcTangential: public ActionInterface /** * Arc data calculated. */ - RS_ArcData data; + ArcData data; }; #endif // __ACTIONDRAWARCTANGENTIAL_H__ diff --git a/src/actions/actiondrawcircle.cpp b/src/actions/actiondrawcircle.cpp index 84e0640..7c19be0 100644 --- a/src/actions/actiondrawcircle.cpp +++ b/src/actions/actiondrawcircle.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawCircle::ActionDrawCircle(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawCircle::ActionDrawCircle(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles", container, graphicView) { reset(); @@ -39,7 +39,7 @@ ActionDrawCircle::~ActionDrawCircle() void ActionDrawCircle::reset() { - data = RS_CircleData(Vector(false), 0.0); + data = CircleData(Vector(false), 0.0); } void ActionDrawCircle::init(int status) @@ -53,7 +53,7 @@ void ActionDrawCircle::trigger() { ActionInterface::trigger(); - RS_Circle * circle = new RS_Circle(container, data); + Circle * circle = new Circle(container, data); circle->setLayerToActive(); circle->setPenToActive(); container->addEntity(circle); @@ -76,12 +76,12 @@ void ActionDrawCircle::trigger() setStatus(SetCenter); reset(); - RS_DEBUG->print("ActionDrawCircle::trigger(): circle added: %d", circle->getId()); + DEBUG->print("ActionDrawCircle::trigger(): circle added: %d", circle->getId()); } void ActionDrawCircle::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawCircle::mouseMoveEvent begin"); + DEBUG->print("ActionDrawCircle::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -98,13 +98,13 @@ void ActionDrawCircle::mouseMoveEvent(QMouseEvent * e) data.radius = data.center.distanceTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Circle(preview, data)); +// preview->addEntity(new Circle(preview, data)); drawPreview(); } break; } - RS_DEBUG->print("ActionDrawCircle::mouseMoveEvent end"); + DEBUG->print("ActionDrawCircle::mouseMoveEvent end"); } void ActionDrawCircle::mouseReleaseEvent(QMouseEvent * e) @@ -153,14 +153,14 @@ void ActionDrawCircle::coordinateEvent(Vector * e) } } -void ActionDrawCircle::commandEvent(RS_CommandEvent * e) +void ActionDrawCircle::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -170,12 +170,12 @@ void ActionDrawCircle::commandEvent(RS_CommandEvent * e) case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok) data.radius = r; - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); trigger(); //setStatus(SetCenter); @@ -198,18 +198,18 @@ void ActionDrawCircle::updateMouseButtonHints() switch (getStatus()) { case SetCenter: - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); + if (DIALOGFACTORY) + DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); break; case SetRadius: - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); + if (DIALOGFACTORY) + DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); break; default: - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateMouseWidget("", ""); + if (DIALOGFACTORY) + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -233,10 +233,10 @@ void ActionDrawCircle::updateToolBar() { if (!isFinished()) { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + if (DIALOGFACTORY) + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); } - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); + else if (DIALOGFACTORY) + DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); } diff --git a/src/actions/actiondrawcircle.h b/src/actions/actiondrawcircle.h index 7357c21..3d02f3d 100644 --- a/src/actions/actiondrawcircle.h +++ b/src/actions/actiondrawcircle.h @@ -23,7 +23,7 @@ class ActionDrawCircle: public ActionInterface }; public: - ActionDrawCircle(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawCircle(EntityContainer & container, GraphicView & graphicView); ~ActionDrawCircle(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawCircle: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -45,7 +45,7 @@ class ActionDrawCircle: public ActionInterface /** * Circle data defined so far. */ - RS_CircleData data; + CircleData data; }; #endif // __ACTIONDRAWCIRCLE_H__ diff --git a/src/actions/actiondrawcircle2p.cpp b/src/actions/actiondrawcircle2p.cpp index 33d5534..d580bb3 100644 --- a/src/actions/actiondrawcircle2p.cpp +++ b/src/actions/actiondrawcircle2p.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawCircle2P::ActionDrawCircle2P(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles", +ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles", container, graphicView) { reset(); @@ -53,7 +53,7 @@ void ActionDrawCircle2P::trigger() if (data.isValid()) { - RS_Circle * circle = new RS_Circle(container, data); + Circle * circle = new Circle(container, data); circle->setLayerToActive(); circle->setPenToActive(); container->addEntity(circle); @@ -76,8 +76,8 @@ void ActionDrawCircle2P::trigger() setStatus(SetPoint1); reset(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data.")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data.")); } void ActionDrawCircle2P::preparePreview() @@ -86,7 +86,7 @@ void ActionDrawCircle2P::preparePreview() if (point1.valid && point2.valid) { - RS_Circle circle(NULL, data); + Circle circle(NULL, data); bool suc = circle.createFrom2P(point1, point2); if (suc) @@ -110,7 +110,7 @@ void ActionDrawCircle2P::mouseMoveEvent(QMouseEvent * e) if (data.isValid()) { -// RS_Circle * circle = new RS_Circle(preview, data); +// Circle * circle = new Circle(preview, data); // deletePreview(); // clearPreview(); // preview->addEntity(circle); @@ -164,14 +164,14 @@ void ActionDrawCircle2P::coordinateEvent(Vector * e) } } -void ActionDrawCircle2P::commandEvent(RS_CommandEvent * e) +void ActionDrawCircle2P::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -185,22 +185,22 @@ QStringList ActionDrawCircle2P::getAvailableCommands() void ActionDrawCircle2P::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first point"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify second point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -213,11 +213,11 @@ void ActionDrawCircle2P::updateMouseCursor() void ActionDrawCircle2P::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); + DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); } } diff --git a/src/actions/actiondrawcircle2p.h b/src/actions/actiondrawcircle2p.h index 86d343a..887400a 100644 --- a/src/actions/actiondrawcircle2p.h +++ b/src/actions/actiondrawcircle2p.h @@ -24,7 +24,7 @@ class ActionDrawCircle2P: public ActionInterface }; public: - ActionDrawCircle2P(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView); ~ActionDrawCircle2P(); void reset(); @@ -34,7 +34,7 @@ class ActionDrawCircle2P: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); @@ -44,7 +44,7 @@ class ActionDrawCircle2P: public ActionInterface /** * Circle data defined so far. */ - RS_CircleData data; + CircleData data; /** * 1st point. */ diff --git a/src/actions/actiondrawcircle3p.cpp b/src/actions/actiondrawcircle3p.cpp index c836878..eacd6d8 100644 --- a/src/actions/actiondrawcircle3p.cpp +++ b/src/actions/actiondrawcircle3p.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawCircle3P::ActionDrawCircle3P(RS_EntityContainer & container, +ActionDrawCircle3P::ActionDrawCircle3P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles", container, graphicView) { @@ -55,7 +55,7 @@ void ActionDrawCircle3P::trigger() if (data.isValid()) { - RS_Circle * circle = new RS_Circle(container, data); + Circle * circle = new Circle(container, data); circle->setLayerToActive(); circle->setPenToActive(); container->addEntity(circle); @@ -79,7 +79,7 @@ void ActionDrawCircle3P::trigger() reset(); } else - RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data.")); + DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data.")); } void ActionDrawCircle3P::preparePreview() @@ -88,7 +88,7 @@ void ActionDrawCircle3P::preparePreview() if (point1.valid && point2.valid && point3.valid) { - RS_Circle circle(NULL, data); + Circle circle(NULL, data); bool success = circle.createFrom3P(point1, point2, point3); if (success) @@ -116,7 +116,7 @@ void ActionDrawCircle3P::mouseMoveEvent(QMouseEvent * e) if (data.isValid()) { -// RS_Circle * circle = new RS_Circle(preview, data); +// Circle * circle = new Circle(preview, data); // // deletePreview(); // clearPreview(); @@ -173,13 +173,13 @@ void ActionDrawCircle3P::coordinateEvent(Vector * e) } } -void ActionDrawCircle3P::commandEvent(RS_CommandEvent * e) +void ActionDrawCircle3P::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -196,19 +196,19 @@ void ActionDrawCircle3P::updateMouseButtonHints() switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); break; case SetPoint3: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -221,7 +221,7 @@ void ActionDrawCircle3P::updateMouseCursor() void ActionDrawCircle3P::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); + DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); } diff --git a/src/actions/actiondrawcircle3p.h b/src/actions/actiondrawcircle3p.h index a528813..54a8777 100644 --- a/src/actions/actiondrawcircle3p.h +++ b/src/actions/actiondrawcircle3p.h @@ -25,7 +25,7 @@ class ActionDrawCircle3P: public ActionInterface }; public: - ActionDrawCircle3P(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawCircle3P(EntityContainer & container, GraphicView & graphicView); ~ActionDrawCircle3P(); void reset(); @@ -35,7 +35,7 @@ class ActionDrawCircle3P: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); @@ -45,7 +45,7 @@ class ActionDrawCircle3P: public ActionInterface /** * Circle data defined so far. */ - RS_CircleData data; + CircleData data; /** * 1st point. */ diff --git a/src/actions/actiondrawcirclecr.cpp b/src/actions/actiondrawcirclecr.cpp index 4f41d81..dfd1150 100644 --- a/src/actions/actiondrawcirclecr.cpp +++ b/src/actions/actiondrawcirclecr.cpp @@ -25,7 +25,7 @@ /** * Constructor. */ -ActionDrawCircleCR::ActionDrawCircleCR(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles CR", +ActionDrawCircleCR::ActionDrawCircleCR(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles CR", container, graphicView) { reset(); @@ -42,7 +42,7 @@ ActionDrawCircleCR::~ActionDrawCircleCR() void ActionDrawCircleCR::reset() { - data = RS_CircleData(Vector(false), 0.0); + data = CircleData(Vector(false), 0.0); } void ActionDrawCircleCR::init(int status) @@ -54,7 +54,7 @@ void ActionDrawCircleCR::trigger() { ActionInterface::trigger(); - RS_Circle * circle = new RS_Circle(container, data); + Circle * circle = new Circle(container, data); circle->setLayerToActive(); circle->setPenToActive(); container->addEntity(circle); @@ -76,12 +76,12 @@ void ActionDrawCircleCR::trigger() setStatus(SetCenter); - RS_DEBUG->print("ActionDrawCircleCR::trigger(): circle added: %d", circle->getId()); + DEBUG->print("ActionDrawCircleCR::trigger(): circle added: %d", circle->getId()); } void ActionDrawCircleCR::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawCircleCR::mouseMoveEvent begin"); + DEBUG->print("ActionDrawCircleCR::mouseMoveEvent begin"); Vector mouse = snapPoint(e); switch (getStatus()) @@ -90,12 +90,12 @@ void ActionDrawCircleCR::mouseMoveEvent(QMouseEvent * e) data.center = mouse; deletePreview(); clearPreview(); -// preview->addEntity(new RS_Circle(preview, data)); +// preview->addEntity(new Circle(preview, data)); drawPreview(); break; } - RS_DEBUG->print("ActionDrawCircleCR::mouseMoveEvent end"); + DEBUG->print("ActionDrawCircleCR::mouseMoveEvent end"); } void ActionDrawCircleCR::mouseReleaseEvent(QMouseEvent * e) @@ -132,13 +132,13 @@ void ActionDrawCircleCR::coordinateEvent(Vector * e) } } -void ActionDrawCircleCR::commandEvent(RS_CommandEvent * e) +void ActionDrawCircleCR::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -159,14 +159,14 @@ void ActionDrawCircleCR::commandEvent(RS_CommandEvent * e) case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok == true) data.radius = r; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetCenter); } break; @@ -198,15 +198,15 @@ void ActionDrawCircleCR::updateMouseButtonHints() switch (getStatus()) { case SetCenter: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify circle center"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify circle center"), tr("Cancel")); break; case SetRadius: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify circle radius"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify circle radius"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -215,14 +215,14 @@ void ActionDrawCircleCR::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawCircleCR::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawCircleCR::updateMouseCursor() @@ -233,9 +233,9 @@ void ActionDrawCircleCR::updateMouseCursor() void ActionDrawCircleCR::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); + DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); } double ActionDrawCircleCR::getRadius() diff --git a/src/actions/actiondrawcirclecr.h b/src/actions/actiondrawcirclecr.h index e3406f0..969d666 100644 --- a/src/actions/actiondrawcirclecr.h +++ b/src/actions/actiondrawcirclecr.h @@ -23,7 +23,7 @@ class ActionDrawCircleCR: public ActionInterface }; public: - ActionDrawCircleCR(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawCircleCR(EntityContainer & container, GraphicView & graphicView); ~ActionDrawCircleCR(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawCircleCR: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -47,7 +47,7 @@ class ActionDrawCircleCR: public ActionInterface /** * Circle data defined so far. */ - RS_CircleData data; + CircleData data; }; #endif // __ACTIONDRAWCIRCLECR_H__ diff --git a/src/actions/actiondrawellipseaxis.cpp b/src/actions/actiondrawellipseaxis.cpp index e219649..932aa15 100644 --- a/src/actions/actiondrawellipseaxis.cpp +++ b/src/actions/actiondrawellipseaxis.cpp @@ -28,7 +28,7 @@ * @param isArc true if this action will produce an ellipse arc. * false if it will produce a full ellipse. */ -ActionDrawEllipseAxis::ActionDrawEllipseAxis(RS_EntityContainer & container, GraphicView & graphicView, bool isArc): ActionInterface("Draw ellipse with axis", +ActionDrawEllipseAxis::ActionDrawEllipseAxis(EntityContainer & container, GraphicView & graphicView, bool isArc): ActionInterface("Draw ellipse with axis", container, graphicView) { this->isArc = isArc; @@ -67,8 +67,8 @@ void ActionDrawEllipseAxis::trigger() { ActionInterface::trigger(); - RS_EllipseData ellipseData(center, major, ratio, angle1, angle2, false); - RS_Ellipse * ellipse = new RS_Ellipse(container, ellipseData); + EllipseData ellipseData(center, major, ratio, angle1, angle2, false); + Ellipse * ellipse = new Ellipse(container, ellipseData); ellipse->setLayerToActive(); ellipse->setPenToActive(); @@ -91,13 +91,13 @@ void ActionDrawEllipseAxis::trigger() setStatus(SetCenter); - RS_DEBUG->print("ActionDrawEllipseAxis::trigger():" + DEBUG->print("ActionDrawEllipseAxis::trigger():" " entity added: %d", ellipse->getId()); } void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent begin"); + DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -112,8 +112,8 @@ void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) { deletePreview(); clearPreview(); - RS_EllipseData ed(center, mouse - center, 0.5, 0.0, 2 * M_PI, false); -// preview->addEntity(new RS_Ellipse(preview, ed)); + EllipseData ed(center, mouse - center, 0.5, 0.0, 2 * M_PI, false); +// preview->addEntity(new Ellipse(preview, ed)); drawPreview(); } break; @@ -124,11 +124,11 @@ void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) { deletePreview(); clearPreview(); - RS_Line line(NULL, RS_LineData(center - major, center + major)); + Line line(NULL, LineData(center - major, center + major)); double d = line.getDistanceToPoint(mouse); ratio = d / (line.getLength() / 2); - RS_EllipseData ed(center, major, ratio, 0.0, 2 * M_PI, false); -// preview->addEntity(new RS_Ellipse(preview, ed)); + EllipseData ed(center, major, ratio, 0.0, 2 * M_PI, false); +// preview->addEntity(new Ellipse(preview, ed)); drawPreview(); } break; @@ -148,10 +148,10 @@ void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) v.scale(Vector(1.0, 1.0 / ratio)); angle1 = v.angle(); // + major.angle(); -// preview->addEntity(new RS_Line(preview, RS_LineData(center, mouse))); +// preview->addEntity(new Line(preview, LineData(center, mouse))); - RS_EllipseData ed(center, major, ratio, angle1, angle1 + 1.0, false); -// preview->addEntity(new RS_Ellipse(preview, ed)); + EllipseData ed(center, major, ratio, angle1, angle1 + 1.0, false); +// preview->addEntity(new Ellipse(preview, ed)); drawPreview(); } break; @@ -170,10 +170,10 @@ void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) v.scale(Vector(1.0, 1.0 / ratio)); angle2 = v.angle(); // + major.angle(); -// preview->addEntity(new RS_Line(preview, RS_LineData(center, mouse))); +// preview->addEntity(new Line(preview, LineData(center, mouse))); - RS_EllipseData ed(center, major, ratio, angle1, angle2, false); -// preview->addEntity(new RS_Ellipse(preview, ed)); + EllipseData ed(center, major, ratio, angle1, angle2, false); +// preview->addEntity(new Ellipse(preview, ed)); drawPreview(); } @@ -181,7 +181,7 @@ void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent end"); + DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent end"); } void ActionDrawEllipseAxis::mouseReleaseEvent(QMouseEvent * e) @@ -223,7 +223,7 @@ void ActionDrawEllipseAxis::coordinateEvent(Vector * e) case SetMinor: { - RS_Line line(NULL, RS_LineData(center - major, center + major)); + Line line(NULL, LineData(center - major, center + major)); double d = line.getDistanceToPoint(mouse); ratio = d / (line.getLength() / 2); @@ -266,14 +266,14 @@ void ActionDrawEllipseAxis::coordinateEvent(Vector * e) } } -void ActionDrawEllipseAxis::commandEvent(RS_CommandEvent * e) +void ActionDrawEllipseAxis::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -282,7 +282,7 @@ void ActionDrawEllipseAxis::commandEvent(RS_CommandEvent * e) { case SetMinor: { bool ok; - double m = RS_Math::eval(c, &ok); + double m = Math::eval(c, &ok); if (ok == true) { @@ -293,38 +293,38 @@ void ActionDrawEllipseAxis::commandEvent(RS_CommandEvent * e) else setStatus(SetAngle1); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle1: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - angle1 = RS_Math::deg2rad(a); + angle1 = Math::deg2rad(a); setStatus(SetAngle2); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle2: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - angle2 = RS_Math::deg2rad(a); + angle2 = Math::deg2rad(a); trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; @@ -342,38 +342,38 @@ QStringList ActionDrawEllipseAxis::getAvailableCommands() void ActionDrawEllipseAxis::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCenter: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify ellipse center"), + DIALOGFACTORY->updateMouseWidget(tr("Specify ellipse center"), tr("Cancel")); break; case SetMajor: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint of major axis"), + DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint of major axis"), tr("Back")); break; case SetMinor: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify endpoint or length of minor axis:"), tr("Back")); break; case SetAngle1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify start angle"), + DIALOGFACTORY->updateMouseWidget(tr("Specify start angle"), tr("Back")); break; case SetAngle2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify end angle"), + DIALOGFACTORY->updateMouseWidget(tr("Specify end angle"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -386,11 +386,11 @@ void ActionDrawEllipseAxis::updateMouseCursor() void ActionDrawEllipseAxis::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarEllipses); + DIALOGFACTORY->requestToolBar(RS2::ToolBarEllipses); } } diff --git a/src/actions/actiondrawellipseaxis.h b/src/actions/actiondrawellipseaxis.h index 073b431..957fd6d 100644 --- a/src/actions/actiondrawellipseaxis.h +++ b/src/actions/actiondrawellipseaxis.h @@ -26,7 +26,7 @@ class ActionDrawEllipseAxis: public ActionInterface }; public: - ActionDrawEllipseAxis(RS_EntityContainer & container, GraphicView & graphicView, bool isArc); + ActionDrawEllipseAxis(EntityContainer & container, GraphicView & graphicView, bool isArc); ~ActionDrawEllipseAxis(); virtual void init(int status = 0); @@ -34,7 +34,7 @@ class ActionDrawEllipseAxis: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); diff --git a/src/actions/actiondrawhatch.cpp b/src/actions/actiondrawhatch.cpp index aa4e3e8..a85a58a 100644 --- a/src/actions/actiondrawhatch.cpp +++ b/src/actions/actiondrawhatch.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "information.h" -ActionDrawHatch::ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawHatch::ActionDrawHatch(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Hatch", container, graphicView) { hatch = NULL; @@ -36,11 +36,11 @@ void ActionDrawHatch::init(int status) ActionInterface::init(status); clearPreview(); - RS_Hatch tmp(container, data); + Hatch tmp(container, data); tmp.setLayerToActive(); tmp.setPenToActive(); - if (RS_DIALOGFACTORY->requestHatchDialog(&tmp)) + if (DIALOGFACTORY->requestHatchDialog(&tmp)) { data = tmp.getData(); trigger(); @@ -53,10 +53,10 @@ void ActionDrawHatch::init(int status) void ActionDrawHatch::trigger() { - RS_DEBUG->print("ActionDrawHatch::trigger()"); + DEBUG->print("ActionDrawHatch::trigger()"); deleteSnapper(); - RS_Entity * e; + Entity * e; // deselect unhatchable entities: for(e=container->firstEntity(RS2::ResolveNone); e!=NULL; @@ -66,7 +66,7 @@ void ActionDrawHatch::trigger() && (e->rtti() == RS2::EntityHatch || e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint || e->rtti() == RS2::EntityText - || RS_Information::isDimension(e->rtti()))) + || Information::isDimension(e->rtti()))) e->setSelected(false); } @@ -77,7 +77,7 @@ void ActionDrawHatch::trigger() && (e->rtti() == RS2::EntityHatch || e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint || e->rtti() == RS2::EntityText - || RS_Information::isDimension(e->rtti()))) + || Information::isDimension(e->rtti()))) e->setSelected(false); } @@ -95,14 +95,14 @@ void ActionDrawHatch::trigger() return; } - hatch = new RS_Hatch(container, data); + hatch = new Hatch(container, data); hatch->setLayerToActive(); hatch->setPenToActive(); - RS_EntityContainer * loop = new RS_EntityContainer(hatch); - loop->setPen(RS_Pen(RS2::FlagInvalid)); + EntityContainer * loop = new EntityContainer(hatch); + loop->setPen(Pen(RS2::FlagInvalid)); // add selected contour: - for(RS_Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL; + for(Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL; e=container->nextEntity(RS2::ResolveAll)) { if (e->isSelected()) @@ -115,8 +115,8 @@ void ActionDrawHatch::trigger() || e->getParent()->rtti() == RS2::EntityPolyline)) e->getParent()->setSelected(false); - RS_Entity * cp = e->clone(); - cp->setPen(RS_Pen(RS2::FlagInvalid)); + Entity * cp = e->clone(); + cp->setPen(Pen(RS2::FlagInvalid)); cp->reparent(loop); loop->addEntity(cp); } @@ -137,20 +137,20 @@ void ActionDrawHatch::trigger() hatch->update(); graphicView->drawEntity(hatch); - RS_DIALOGFACTORY->commandMessage(tr("Hatch created successfully.")); + DIALOGFACTORY->commandMessage(tr("Hatch created successfully.")); } else { delete hatch; hatch = NULL; - RS_DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that " + DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that " "the entities chosen form one or more closed contours.")); } } void ActionDrawHatch::mouseMoveEvent(QMouseEvent *) { - RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent begin"); + DEBUG->print("ActionDrawHatch::mouseMoveEvent begin"); /*if (getStatus()==SetPos) { Vector mouse = snapPoint(e); @@ -166,7 +166,7 @@ void ActionDrawHatch::mouseMoveEvent(QMouseEvent *) drawPreview(); }*/ - RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent end"); + DEBUG->print("ActionDrawHatch::mouseMoveEvent end"); } void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e) @@ -194,7 +194,7 @@ void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e) void ActionDrawHatch::updateMouseButtonHints() { - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); } void ActionDrawHatch::updateMouseCursor() @@ -204,5 +204,5 @@ void ActionDrawHatch::updateMouseCursor() void ActionDrawHatch::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } diff --git a/src/actions/actiondrawhatch.h b/src/actions/actiondrawhatch.h index b04c79c..67229a6 100644 --- a/src/actions/actiondrawhatch.h +++ b/src/actions/actiondrawhatch.h @@ -21,7 +21,7 @@ class ActionDrawHatch: public ActionInterface }; public: - ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawHatch(EntityContainer & container, GraphicView & graphicView); ~ActionDrawHatch(); virtual void init(int status = 0); @@ -33,8 +33,8 @@ class ActionDrawHatch: public ActionInterface virtual void updateToolBar(); private: - RS_HatchData data; - RS_Hatch * hatch; + HatchData data; + Hatch * hatch; }; #endif // __ACTIONDRAWHATCH_H__ diff --git a/src/actions/actiondrawimage.cpp b/src/actions/actiondrawimage.cpp index 524663c..fb7e3e7 100644 --- a/src/actions/actiondrawimage.cpp +++ b/src/actions/actiondrawimage.cpp @@ -25,7 +25,7 @@ /** * Constructor. */ -ActionDrawImage::ActionDrawImage(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawImage::ActionDrawImage(EntityContainer & container, GraphicView & graphicView): ActionInterface("Image", container, graphicView) { } @@ -45,7 +45,7 @@ void ActionDrawImage::init(int status) reset(); - data.file = RS_DIALOGFACTORY->requestImageOpenDialog(); + data.file = DIALOGFACTORY->requestImageOpenDialog(); graphicView->redraw(); if (!data.file.isEmpty()) @@ -59,13 +59,13 @@ void ActionDrawImage::init(int status) { finish(); updateToolBar(); - //RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + //DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } } void ActionDrawImage::reset() { - data = RS_ImageData(0, + data = ImageData(0, Vector(0.0, 0.0), Vector(1.0, 0.0), Vector(0.0, 1.0), @@ -82,7 +82,7 @@ void ActionDrawImage::trigger() if (!data.file.isEmpty()) { - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); creation.createImage(data); } @@ -100,16 +100,16 @@ void ActionDrawImage::mouseMoveEvent(QMouseEvent * e) // deletePreview(); // clearPreview(); -// RS_Line * line; -// line = new RS_Line(preview, RS_LineData(Vector(0, 0), Vector(img.width(), 0))); +// Line * line; +// line = new Line(preview, LineData(Vector(0, 0), Vector(img.width(), 0))); // preview->addEntity(line); -// line = new RS_Line(preview, -// RS_LineData(Vector(img.width(), 0), Vector(img.width(), img.height()))); +// line = new Line(preview, +// LineData(Vector(img.width(), 0), Vector(img.width(), img.height()))); // preview->addEntity(line); -// line = new RS_Line(preview, -// RS_LineData(Vector(img.width(), img.height()), Vector(0, img.height()))); +// line = new Line(preview, +// LineData(Vector(img.width(), img.height()), Vector(0, img.height()))); // preview->addEntity(line); -// line = new RS_Line(preview, RS_LineData(Vector(0, img.height()), Vector(0, 0))); +// line = new Line(preview, LineData(Vector(0, img.height()), Vector(0, 0))); // preview->addEntity(line); // preview->scale(Vector(0, 0), Vector(data.uVector.magnitude(), data.uVector.magnitude())); // preview->rotate(Vector(0, 0), data.uVector.angle()); @@ -146,13 +146,13 @@ void ActionDrawImage::coordinateEvent(Vector * e) trigger(); } -void ActionDrawImage::commandEvent(RS_CommandEvent * e) +void ActionDrawImage::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -182,14 +182,14 @@ void ActionDrawImage::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - setAngle(RS_Math::deg2rad(a)); + setAngle(Math::deg2rad(a)); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -197,14 +197,14 @@ void ActionDrawImage::commandEvent(RS_CommandEvent * e) case SetFactor: { bool ok; - double f = RS_Math::eval(c, &ok); + double f = Math::eval(c, &ok); if (ok) setFactor(f); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -236,14 +236,14 @@ void ActionDrawImage::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawImage::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawImage::updateMouseButtonHints() @@ -251,19 +251,19 @@ void ActionDrawImage::updateMouseButtonHints() switch (getStatus()) { case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); break; case SetFactor: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -276,9 +276,9 @@ void ActionDrawImage::updateMouseCursor() void ActionDrawImage::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } double ActionDrawImage::getAngle() diff --git a/src/actions/actiondrawimage.h b/src/actions/actiondrawimage.h index af2aacf..41b43b7 100644 --- a/src/actions/actiondrawimage.h +++ b/src/actions/actiondrawimage.h @@ -30,7 +30,7 @@ class ActionDrawImage: public ActionInterface }; public: - ActionDrawImage(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawImage(EntityContainer & container, GraphicView & graphicView); ~ActionDrawImage(); virtual RS2::ActionType rtti(); @@ -40,7 +40,7 @@ class ActionDrawImage: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -53,7 +53,7 @@ class ActionDrawImage: public ActionInterface void setFactor(double f); protected: - RS_ImageData data; + ImageData data; QImage img; /** Last status before entering option. */ diff --git a/src/actions/actiondrawline.cpp b/src/actions/actiondrawline.cpp index 50fb990..a0be6db 100644 --- a/src/actions/actiondrawline.cpp +++ b/src/actions/actiondrawline.cpp @@ -24,17 +24,17 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLine::ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawLine::ActionDrawLine(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw lines", container, graphicView) { - RS_DEBUG->print("ActionDrawLine::ActionDrawLine"); + DEBUG->print("ActionDrawLine::ActionDrawLine"); reset(); //hm. // graphicView.snapper.SetContainer(&container); // graphicView.snapper.SetGraphicView(&graphicView); // graphicView.snapper.SetVisible(); // graphicView.preview.SetVisible(); - RS_DEBUG->print("ActionDrawLine::ActionDrawLine: OK"); + DEBUG->print("ActionDrawLine::ActionDrawLine: OK"); } ActionDrawLine::~ActionDrawLine() @@ -49,33 +49,33 @@ ActionDrawLine::~ActionDrawLine() void ActionDrawLine::reset() { - RS_DEBUG->print("ActionDrawLine::reset"); - data = RS_LineData(Vector(false), Vector(false)); + DEBUG->print("ActionDrawLine::reset"); + data = LineData(Vector(false), Vector(false)); start = Vector(false); ClearHistory(); - RS_DEBUG->print("ActionDrawLine::reset: OK"); + DEBUG->print("ActionDrawLine::reset: OK"); } void ActionDrawLine::init(int status) { - RS_DEBUG->print("ActionDrawLine::init"); + DEBUG->print("ActionDrawLine::init"); ActionInterface::init(status); reset(); - RS_DEBUG->print("ActionDrawLine::init: OK"); + DEBUG->print("ActionDrawLine::init: OK"); } void ActionDrawLine::trigger() { graphicView->preview.clear(); - RS_Line * line = new RS_Line(container, data); + Line * line = new Line(container, data); line->setLayerToActive(); line->setPenToActive(); container->addEntity(line); //std::cout << container; //printf("ActionDrawLine::trigger(): new line is %f,%f to %f,%f\n", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); //This makes it come back as "Unknown Entity" -//std::cout << *((RS_Entity *)container); +//std::cout << *((Entity *)container); //std::cout << *container; // Update undo list: @@ -89,29 +89,29 @@ void ActionDrawLine::trigger() graphicView->moveRelativeZero(line->getEndpoint()); //hm. [OK, it just moves the relative zero tho. Overkill. And remove preview, so OK.] graphicView->redraw(); - RS_DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId()); + DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId()); } void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLine::mouseMoveEvent begin"); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point"); Vector mouse = graphicView->snapper.snapPoint(e); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK"); if (getStatus() == SetEndpoint && data.startpoint.valid) { - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview"); // This is lame. Creating a new Line every time the endpoint moves. // Surely we can alter the line entity inside the preview, no? #if 0 graphicView->preview.clear(); // Remove entities from the container - RS_Line * line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse)); + Line * line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse)); graphicView->preview.addEntity(line); #else // We can assume there's only one line in there, can't we? - RS_Line * line = (RS_Line *)graphicView->preview.firstEntity(RS2::ResolveNone); + Line * line = (Line *)graphicView->preview.firstEntity(RS2::ResolveNone); if (line) { @@ -119,7 +119,7 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) } else { - line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse)); + line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse)); graphicView->preview.addEntity(line); } #endif @@ -127,7 +127,7 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) //hm. [ok, this works. :-D] graphicView->redraw(); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent end"); + DEBUG->print("ActionDrawLine::mouseMoveEvent end"); } void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e) @@ -155,11 +155,11 @@ void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLine::coordinateEvent(Vector * e) { - RS_DEBUG->print("ActionDrawLine::coordinateEvent"); + DEBUG->print("ActionDrawLine::coordinateEvent"); if (!e) { - RS_DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL"); + DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL"); return; } @@ -189,12 +189,12 @@ void ActionDrawLine::coordinateEvent(Vector * e) break; } - RS_DEBUG->print("ActionDrawLine::coordinateEvent: OK"); + DEBUG->print("ActionDrawLine::coordinateEvent: OK"); } -void ActionDrawLine::commandEvent(RS_CommandEvent * e) +void ActionDrawLine::commandEvent(CommandEvent * e) { - RS_DEBUG->print("ActionDrawLine::commandEvent"); + DEBUG->print("ActionDrawLine::commandEvent"); QString c = e->getCommand().toLower(); switch (getStatus()) @@ -203,7 +203,7 @@ void ActionDrawLine::commandEvent(RS_CommandEvent * e) if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -230,7 +230,7 @@ void ActionDrawLine::commandEvent(RS_CommandEvent * e) break; } - RS_DEBUG->print("ActionDrawLine::commandEvent: OK"); + DEBUG->print("ActionDrawLine::commandEvent: OK"); } QStringList ActionDrawLine::getAvailableCommands() @@ -264,7 +264,7 @@ void ActionDrawLine::updateMouseButtonHints() switch (getStatus()) { case SetStartpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); break; case SetEndpoint: @@ -273,38 +273,38 @@ void ActionDrawLine::updateMouseButtonHints() if (history.count() >= 3) { - msg += RS_COMMANDS->command("close"); + msg += COMMANDS->command("close"); msg += "/"; } if (history.count() >= 2) - msg += RS_COMMANDS->command("undo"); + msg += COMMANDS->command("undo"); if (history.count() >= 2) - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back")); } break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } void ActionDrawLine::showOptions() { - RS_DEBUG->print("ActionDrawLine::showOptions"); + DEBUG->print("ActionDrawLine::showOptions"); ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); - RS_DEBUG->print("ActionDrawLine::showOptions: OK"); + DIALOGFACTORY->requestOptions(this, true); + DEBUG->print("ActionDrawLine::showOptions: OK"); } void ActionDrawLine::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLine::updateMouseCursor() @@ -315,9 +315,9 @@ void ActionDrawLine::updateMouseCursor() void ActionDrawLine::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } void ActionDrawLine::close() @@ -332,7 +332,7 @@ void ActionDrawLine::close() graphicView->moveRelativeZero(start); } else - RS_DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet.")); + DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet.")); } void ActionDrawLine::undo() @@ -348,7 +348,7 @@ void ActionDrawLine::undo() graphicView->redraw(); } else - RS_DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet.")); + DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet.")); } void ActionDrawLine::ClearHistory(void) diff --git a/src/actions/actiondrawline.h b/src/actions/actiondrawline.h index 672405b..ce3582a 100644 --- a/src/actions/actiondrawline.h +++ b/src/actions/actiondrawline.h @@ -25,7 +25,7 @@ class ActionDrawLine: public ActionInterface }; public: - ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLine(EntityContainer & container, GraphicView & graphicView); virtual ~ActionDrawLine(); virtual RS2::ActionType rtti(); @@ -35,7 +35,7 @@ class ActionDrawLine: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -52,7 +52,7 @@ class ActionDrawLine: public ActionInterface /** * Line data defined so far. */ - RS_LineData data; + LineData data; /** * Start point of the series of lines. Used for close function. */ diff --git a/src/actions/actiondrawlineangle.cpp b/src/actions/actiondrawlineangle.cpp index 36441b7..aeff68a 100644 --- a/src/actions/actiondrawlineangle.cpp +++ b/src/actions/actiondrawlineangle.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineAngle::ActionDrawLineAngle(RS_EntityContainer & container, +ActionDrawLineAngle::ActionDrawLineAngle(EntityContainer & container, GraphicView & graphicView, double a, bool fa): ActionInterface("Draw lines with given angle", container, graphicView), pos(Vector(false)), angle(a), length(1.0), fixedAngle(fa), snpPoint(0) @@ -47,7 +47,7 @@ ActionDrawLineAngle::~ActionDrawLineAngle() void ActionDrawLineAngle::reset() { - data = RS_LineData(Vector(false), Vector(false)); + data = LineData(Vector(false), Vector(false)); } void ActionDrawLineAngle::init(int status) @@ -60,7 +60,7 @@ void ActionDrawLineAngle::trigger() { ActionInterface::trigger(); preparePreview(); - RS_Line * line = new RS_Line(container, data); + Line * line = new Line(container, data); line->setLayerToActive(); line->setPenToActive(); container->addEntity(line); @@ -78,12 +78,12 @@ void ActionDrawLineAngle::trigger() graphicView->drawEntity(line); graphicView->moveRelativeZero(data.startpoint); graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId()); + DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId()); } void ActionDrawLineAngle::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin"); if (getStatus() == SetPos) { @@ -91,15 +91,15 @@ void ActionDrawLineAngle::mouseMoveEvent(QMouseEvent * e) // deletePreview(); // clearPreview(); // preparePreview(); -// preview->addEntity(new RS_Line(preview, data)); +// preview->addEntity(new Line(preview, data)); // drawPreview(); preparePreview(); graphicView->preview.clear(); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data)); + graphicView->preview.addEntity(new Line(&(graphicView->preview), data)); } graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end"); } void ActionDrawLineAngle::mouseReleaseEvent(QMouseEvent * e) @@ -141,7 +141,7 @@ void ActionDrawLineAngle::preparePreview() p1 = pos; p2 += p1; - data = RS_LineData(p1, p2); + data = LineData(p1, p2); } void ActionDrawLineAngle::coordinateEvent(Vector * e) @@ -161,13 +161,13 @@ void ActionDrawLineAngle::coordinateEvent(Vector * e) } } -void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) +void ActionDrawLineAngle::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -194,14 +194,14 @@ void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - angle = RS_Math::deg2rad(a); + angle = Math::deg2rad(a); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; @@ -209,14 +209,14 @@ void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) case SetLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok) length = l; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; @@ -251,15 +251,15 @@ void ActionDrawLineAngle::updateMouseButtonHints() switch (getStatus()) { case SetPos: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back")); break; case SetLength: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back")); break; default: @@ -270,13 +270,13 @@ void ActionDrawLineAngle::updateMouseButtonHints() void ActionDrawLineAngle::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLineAngle::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLineAngle::updateMouseCursor() @@ -287,9 +287,9 @@ void ActionDrawLineAngle::updateMouseCursor() void ActionDrawLineAngle::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } void ActionDrawLineAngle::setSnapPoint(int sp) diff --git a/src/actions/actiondrawlineangle.h b/src/actions/actiondrawlineangle.h index 2bc5a22..3b87567 100644 --- a/src/actions/actiondrawlineangle.h +++ b/src/actions/actiondrawlineangle.h @@ -24,7 +24,7 @@ class ActionDrawLineAngle: public ActionInterface SetLength /**< Setting length in the command line. */ }; - ActionDrawLineAngle(RS_EntityContainer & container, GraphicView & graphicView, + ActionDrawLineAngle(EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false); ~ActionDrawLineAngle(); @@ -36,7 +36,7 @@ class ActionDrawLineAngle: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); void preparePreview(); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -53,7 +53,7 @@ class ActionDrawLineAngle: public ActionInterface protected: /** Line data defined so far. */ - RS_LineData data; + LineData data; /** Position. */ Vector pos; /** Line angle. */ diff --git a/src/actions/actiondrawlinebisector.cpp b/src/actions/actiondrawlinebisector.cpp index e4c8bdd..eb71727 100644 --- a/src/actions/actiondrawlinebisector.cpp +++ b/src/actions/actiondrawlinebisector.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineBisector::ActionDrawLineBisector(RS_EntityContainer & container, +ActionDrawLineBisector::ActionDrawLineBisector(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Bisectors", container, graphicView), bisector(NULL), line1(NULL), line2(NULL), length(10.0), number(1), @@ -44,14 +44,14 @@ ActionDrawLineBisector::~ActionDrawLineBisector() void ActionDrawLineBisector::trigger() { ActionInterface::trigger(); - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); creation.createBisector(coord1, coord2, length, number, line1, line2); graphicView->redraw(); } void ActionDrawLineBisector::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin"); Vector mouse = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); @@ -64,13 +64,13 @@ void ActionDrawLineBisector::mouseMoveEvent(QMouseEvent * e) case SetLine2: { coord2 = mouse; - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en && en->rtti() == RS2::EntityLine) { - line2 = (RS_Line *)en; + line2 = (Line *)en; graphicView->preview.clear(); - RS_Creation creation(&(graphicView->preview), NULL, false); + Creation creation(&(graphicView->preview), NULL, false); creation.createBisector(coord1, coord2, length, number, line1, line2); } } @@ -81,7 +81,7 @@ void ActionDrawLineBisector::mouseMoveEvent(QMouseEvent * e) } graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end"); } void ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent * e) @@ -102,11 +102,11 @@ void ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent * e) case SetLine1: { coord1 = mouse; - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en && en->rtti() == RS2::EntityLine) { - line1 = (RS_Line *)en; + line1 = (Line *)en; setStatus(SetLine2); } } @@ -121,13 +121,13 @@ void ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent * e) } } -void ActionDrawLineBisector::commandEvent(RS_CommandEvent * e) +void ActionDrawLineBisector::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -158,14 +158,14 @@ void ActionDrawLineBisector::commandEvent(RS_CommandEvent * e) case SetLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok) length = l; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -173,14 +173,14 @@ void ActionDrawLineBisector::commandEvent(RS_CommandEvent * e) case SetNumber: { bool ok; - int n = (int)RS_Math::eval(c, &ok); + int n = (int)Math::eval(c, &ok); if (ok) number = n; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -214,23 +214,23 @@ void ActionDrawLineBisector::updateMouseButtonHints() switch (getStatus()) { case SetLine1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel")); break; case SetLine2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back")); break; case SetLength: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back")); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -238,13 +238,13 @@ void ActionDrawLineBisector::updateMouseButtonHints() void ActionDrawLineBisector::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLineBisector::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLineBisector::updateMouseCursor() @@ -254,7 +254,7 @@ void ActionDrawLineBisector::updateMouseCursor() void ActionDrawLineBisector::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } void ActionDrawLineBisector::setLength(double l) diff --git a/src/actions/actiondrawlinebisector.h b/src/actions/actiondrawlinebisector.h index 992ae03..e1fc776 100644 --- a/src/actions/actiondrawlinebisector.h +++ b/src/actions/actiondrawlinebisector.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Line; +class Line; /** * This action class can handle user events to draw bisectors. @@ -24,14 +24,14 @@ class ActionDrawLineBisector: public ActionInterface }; public: - ActionDrawLineBisector(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineBisector(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineBisector(); virtual RS2::ActionType rtti(); virtual void trigger(); virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -45,13 +45,13 @@ class ActionDrawLineBisector: public ActionInterface private: /** Closest bisector. */ - RS_Line * bisector; + Line * bisector; /** First chosen entity */ - RS_Line * line1; + Line * line1; /** Second chosen entity */ - RS_Line * line2; + Line * line2; /** Data of new bisector */ - RS_LineData data; + LineData data; /** Length of the bisector. */ double length; /** Number of bisectors to create. */ diff --git a/src/actions/actiondrawlinefree.cpp b/src/actions/actiondrawlinefree.cpp index 9537cbe..1323080 100644 --- a/src/actions/actiondrawlinefree.cpp +++ b/src/actions/actiondrawlinefree.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "polyline.h" -ActionDrawLineFree::ActionDrawLineFree(RS_EntityContainer & container, +ActionDrawLineFree::ActionDrawLineFree(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw freehand lines", container, graphicView) { @@ -49,7 +49,7 @@ void ActionDrawLineFree::trigger() document->endUndoCycle(); } - RS_DEBUG->print("ActionDrawLineFree::trigger():" + DEBUG->print("ActionDrawLineFree::trigger():" " polyline added: %d", polyline->getId()); polyline = NULL; } @@ -60,7 +60,7 @@ void ActionDrawLineFree::mouseMoveEvent(QMouseEvent * e) if (vertex.valid && polyline) { Vector v = snapPoint(e); - RS_Entity * ent = polyline->addVertex(v); + Entity * ent = polyline->addVertex(v); ent->setLayerToActive(); ent->setPenToActive(); @@ -70,7 +70,7 @@ void ActionDrawLineFree::mouseMoveEvent(QMouseEvent * e) vertex = v; - RS_DEBUG->print("ActionDrawLineFree::mouseMoveEvent():" + DEBUG->print("ActionDrawLineFree::mouseMoveEvent():" " line added: %d", ent->getId()); } } @@ -80,7 +80,7 @@ void ActionDrawLineFree::mousePressEvent(QMouseEvent * e) if (e->button() == Qt::LeftButton) { vertex = snapPoint(e); - polyline = new RS_Polyline(container, RS_PolylineData(vertex, vertex, 0)); + polyline = new Polyline(container, PolylineData(vertex, vertex, 0)); polyline->setLayerToActive(); polyline->setPenToActive(); } @@ -111,11 +111,11 @@ void ActionDrawLineFree::updateMouseButtonHints() switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Click and drag to draw a line"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Click and drag to draw a line"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -128,7 +128,7 @@ void ActionDrawLineFree::updateMouseCursor() void ActionDrawLineFree::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } diff --git a/src/actions/actiondrawlinefree.h b/src/actions/actiondrawlinefree.h index 2aabde6..e77c3a2 100644 --- a/src/actions/actiondrawlinefree.h +++ b/src/actions/actiondrawlinefree.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Polyline; +class Polyline; /** * This action class can handle user events to draw freehand lines. @@ -15,7 +15,7 @@ class RS_Polyline; class ActionDrawLineFree: public ActionInterface { public: - ActionDrawLineFree(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineFree(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineFree(); virtual void trigger(); @@ -28,7 +28,7 @@ class ActionDrawLineFree: public ActionInterface protected: Vector vertex; - RS_Polyline * polyline; + Polyline * polyline; }; #endif // __ACTIONDRAWLINEFREE_H__ diff --git a/src/actions/actiondrawlinehorvert.cpp b/src/actions/actiondrawlinehorvert.cpp index e8707a2..3d3f24b 100644 --- a/src/actions/actiondrawlinehorvert.cpp +++ b/src/actions/actiondrawlinehorvert.cpp @@ -21,11 +21,11 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineHorVert::ActionDrawLineHorVert(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw horizontal/vertical lines", +ActionDrawLineHorVert::ActionDrawLineHorVert(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw horizontal/vertical lines", container, graphicView) { reset(); - RS_DEBUG->print("ActionDrawLineHorVert::constructor"); + DEBUG->print("ActionDrawLineHorVert::constructor"); } ActionDrawLineHorVert::~ActionDrawLineHorVert() @@ -34,21 +34,21 @@ ActionDrawLineHorVert::~ActionDrawLineHorVert() void ActionDrawLineHorVert::reset() { - data = RS_LineData(Vector(false), Vector(false)); + data = LineData(Vector(false), Vector(false)); } void ActionDrawLineHorVert::init(int status) { ActionInterface::init(status); reset(); - RS_DEBUG->print("ActionDrawLineHorVert::init"); + DEBUG->print("ActionDrawLineHorVert::init"); } void ActionDrawLineHorVert::trigger() { ActionInterface::trigger(); - RS_Line * line = new RS_Line(container, data); + Line * line = new Line(container, data); line->setLayerToActive(); line->setPenToActive(); container->addEntity(line); @@ -65,13 +65,13 @@ void ActionDrawLineHorVert::trigger() graphicView->moveRelativeZero(Vector(0.0, 0.0)); graphicView->drawEntity(line); graphicView->moveRelativeZero(line->getMiddlepoint()); - RS_DEBUG->print("ActionDrawLineHorVert::trigger():" + DEBUG->print("ActionDrawLineHorVert::trigger():" " line added: %d", line->getId()); } void ActionDrawLineHorVert::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -87,12 +87,12 @@ void ActionDrawLineHorVert::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); - data = RS_LineData(p1, p2); -// preview->addEntity(new RS_Line(preview, data)); + data = LineData(p1, p2); +// preview->addEntity(new Line(preview, data)); drawPreview(); } - RS_DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent end"); } void ActionDrawLineHorVert::mouseReleaseEvent(QMouseEvent * e) @@ -131,15 +131,15 @@ void ActionDrawLineHorVert::updateMouseButtonHints() switch (getStatus()) { case SetStartpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); break; case SetEndpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -152,7 +152,7 @@ void ActionDrawLineHorVert::updateMouseCursor() void ActionDrawLineHorVert::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } diff --git a/src/actions/actiondrawlinehorvert.h b/src/actions/actiondrawlinehorvert.h index 41ae4b5..ca479fa 100644 --- a/src/actions/actiondrawlinehorvert.h +++ b/src/actions/actiondrawlinehorvert.h @@ -25,7 +25,7 @@ class ActionDrawLineHorVert: public ActionInterface }; public: - ActionDrawLineHorVert(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineHorVert(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineHorVert(); void reset(); @@ -41,7 +41,7 @@ class ActionDrawLineHorVert: public ActionInterface /** * Line data. */ - RS_LineData data; + LineData data; /** * 2 points */ diff --git a/src/actions/actiondrawlineparallel.cpp b/src/actions/actiondrawlineparallel.cpp index 2ca3285..f8a473a 100644 --- a/src/actions/actiondrawlineparallel.cpp +++ b/src/actions/actiondrawlineparallel.cpp @@ -26,7 +26,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container, +ActionDrawLineParallel::ActionDrawLineParallel(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Parallels", container, graphicView), parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL) @@ -46,11 +46,11 @@ ActionDrawLineParallel::~ActionDrawLineParallel() void ActionDrawLineParallel::trigger() { ActionInterface::trigger(); - RS_Creation creation(container, graphicView); - RS_Entity * e = creation.createParallel(coord, distance, number, entity); + Creation creation(container, graphicView); + Entity * e = creation.createParallel(coord, distance, number, entity); if (!e) - RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n"); + DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n"); graphicView->preview.clear(); graphicView->redraw(); @@ -58,7 +58,7 @@ void ActionDrawLineParallel::trigger() void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin"); coord = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); entity = catchEntity(e, RS2::ResolveAll); @@ -69,12 +69,12 @@ void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e) #if 0 deletePreview(); clearPreview(); - RS_Creation creation(preview, NULL, false); + Creation creation(preview, NULL, false); creation.createParallel(coord, distance, number, entity); drawPreview(); #else graphicView->preview.clear(); - RS_Creation creation(&(graphicView->preview), NULL, false); + Creation creation(&(graphicView->preview), NULL, false); creation.createParallel(coord, distance, number, entity); graphicView->redraw(); #endif @@ -85,7 +85,7 @@ void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end"); } void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e) @@ -98,23 +98,23 @@ void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLineParallel::updateMouseButtonHints() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify Distance <%1> or select entity or [%2]") - .arg(distance).arg(RS_COMMANDS->command("through")), + .arg(distance).arg(COMMANDS->command("through")), tr("Cancel")); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -124,8 +124,8 @@ void ActionDrawLineParallel::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true); updateMouseButtonHints(); } @@ -134,18 +134,18 @@ void ActionDrawLineParallel::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } -void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) +void ActionDrawLineParallel::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -170,16 +170,16 @@ void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) else { bool ok; - double d = RS_Math::eval(c, &ok); + double d = Math::eval(c, &ok); if (ok && d > 1.0e-10) distance = d; - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); updateMouseButtonHints(); //setStatus(SetEntity); @@ -196,14 +196,14 @@ void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) { if (n > 0 && n < 100) number = n; - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99")); } - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetEntity); } @@ -239,8 +239,8 @@ void ActionDrawLineParallel::updateMouseCursor() void ActionDrawLineParallel::updateToolBar() { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + if (DIALOGFACTORY) + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } double ActionDrawLineParallel::getDistance() diff --git a/src/actions/actiondrawlineparallel.h b/src/actions/actiondrawlineparallel.h index a3252c3..fe63d89 100644 --- a/src/actions/actiondrawlineparallel.h +++ b/src/actions/actiondrawlineparallel.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw parallel lines, arcs and @@ -25,7 +25,7 @@ class ActionDrawLineParallel: public ActionInterface }; public: - ActionDrawLineParallel(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineParallel(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineParallel(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawLineParallel: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void updateMouseButtonHints(); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -46,9 +46,9 @@ class ActionDrawLineParallel: public ActionInterface private: /** Closest parallel. */ - RS_Entity * parallel; + Entity * parallel; /** Data of new line */ - RS_LineData data; + LineData data; /** Distance of the parallel. */ double distance; /** Number of parallels. */ @@ -56,7 +56,7 @@ class ActionDrawLineParallel: public ActionInterface /** Coordinate of the mouse. */ Vector coord; /** Original entity. */ - RS_Entity * entity; + Entity * entity; }; #endif // __ACTIONDRAWLINEPARALLEL_H__ diff --git a/src/actions/actiondrawlineparallelthrough.cpp b/src/actions/actiondrawlineparallelthrough.cpp index 21cc7eb..f34f376 100644 --- a/src/actions/actiondrawlineparallelthrough.cpp +++ b/src/actions/actiondrawlineparallelthrough.cpp @@ -24,7 +24,7 @@ #include "preview.h" ActionDrawLineParallelThrough::ActionDrawLineParallelThrough( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Parallels", container, graphicView) { parallel = NULL; @@ -50,18 +50,18 @@ void ActionDrawLineParallelThrough::trigger() if (entity) { - RS_Creation creation(container, graphicView); - RS_Entity * e = creation.createParallelThrough(coord, number, entity); + Creation creation(container, graphicView); + Entity * e = creation.createParallelThrough(coord, number, entity); if (!e) - RS_DEBUG->print("ActionDrawLineParallelThrough::trigger:" + DEBUG->print("ActionDrawLineParallelThrough::trigger:" " No parallels added\n"); } } void ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent begin"); switch (getStatus()) { @@ -75,7 +75,7 @@ void ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// RS_Creation creation(preview, NULL, false); +// Creation creation(preview, NULL, false); // creation.createParallelThrough(coord, number, entity); drawPreview(); @@ -86,7 +86,7 @@ void ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent end"); } void ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e) @@ -158,19 +158,19 @@ void ActionDrawLineParallelThrough::updateMouseButtonHints() switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select entity"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Select entity"), tr("Cancel")); break; case SetPos: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify through point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify through point"), tr("Back")); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -178,23 +178,23 @@ void ActionDrawLineParallelThrough::updateMouseButtonHints() void ActionDrawLineParallelThrough::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); updateMouseButtonHints(); } void ActionDrawLineParallelThrough::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } -void ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e) +void ActionDrawLineParallelThrough::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -224,12 +224,12 @@ void ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e) if (n > 0 && n < 100) number = n; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " + DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..99")); } else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -264,9 +264,9 @@ void ActionDrawLineParallelThrough::updateMouseCursor() void ActionDrawLineParallelThrough::updateToolBar() { if (getStatus() == SetPos && !isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } int ActionDrawLineParallelThrough::getNumber() diff --git a/src/actions/actiondrawlineparallelthrough.h b/src/actions/actiondrawlineparallelthrough.h index a3205d7..80ac09c 100644 --- a/src/actions/actiondrawlineparallelthrough.h +++ b/src/actions/actiondrawlineparallelthrough.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw parallel lines, arcs and @@ -24,7 +24,7 @@ class ActionDrawLineParallelThrough: public ActionInterface }; public: - ActionDrawLineParallelThrough(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineParallelThrough(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineParallelThrough(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawLineParallelThrough: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); virtual void updateMouseButtonHints(); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -44,15 +44,15 @@ class ActionDrawLineParallelThrough: public ActionInterface private: /** Closest parallel. */ - RS_Entity * parallel; + Entity * parallel; /** Data of new line */ - RS_LineData data; + LineData data; /** Number of parallels. */ int number; /** Coordinate of the mouse. */ Vector coord; /** Original entity. */ - RS_Entity * entity; + Entity * entity; /** Last status before entering length or number. */ Status lastStatus; }; diff --git a/src/actions/actiondrawlinepolygon.cpp b/src/actions/actiondrawlinepolygon.cpp index ea57975..a260e44 100644 --- a/src/actions/actiondrawlinepolygon.cpp +++ b/src/actions/actiondrawlinepolygon.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLinePolygon::ActionDrawLinePolygon(RS_EntityContainer & container, +ActionDrawLinePolygon::ActionDrawLinePolygon(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons", container, graphicView) { @@ -50,16 +50,16 @@ void ActionDrawLinePolygon::trigger() // deletePreview(); // clearPreview(); - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); bool ok = creation.createPolygon(center, corner, number); if (!ok) - RS_DEBUG->print("ActionDrawLinePolygon::trigger: No polygon added\n"); + DEBUG->print("ActionDrawLinePolygon::trigger: No polygon added\n"); } void ActionDrawLinePolygon::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLinePolygon::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLinePolygon::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -76,7 +76,7 @@ void ActionDrawLinePolygon::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// RS_Creation creation(preview, NULL, false); +// Creation creation(preview, NULL, false); // creation.createPolygon(center, corner, number); drawPreview(); @@ -131,25 +131,25 @@ void ActionDrawLinePolygon::coordinateEvent(Vector * e) void ActionDrawLinePolygon::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCenter: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), + DIALOGFACTORY->updateMouseWidget(tr("Specify center"), ""); break; case SetCorner: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify a corner"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Specify a corner"), ""); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -159,26 +159,26 @@ void ActionDrawLinePolygon::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLinePolygon::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); } -void ActionDrawLinePolygon::commandEvent(RS_CommandEvent * e) +void ActionDrawLinePolygon::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -206,16 +206,16 @@ void ActionDrawLinePolygon::commandEvent(RS_CommandEvent * e) { if (n > 0 && n < 10000) number = n; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..9999")); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -250,12 +250,12 @@ void ActionDrawLinePolygon::updateMouseCursor() void ActionDrawLinePolygon::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } diff --git a/src/actions/actiondrawlinepolygon.h b/src/actions/actiondrawlinepolygon.h index 60150f4..f46ef98 100644 --- a/src/actions/actiondrawlinepolygon.h +++ b/src/actions/actiondrawlinepolygon.h @@ -20,7 +20,7 @@ class ActionDrawLinePolygon: public ActionInterface }; public: - ActionDrawLinePolygon(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLinePolygon(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLinePolygon(); virtual RS2::ActionType rtti(); @@ -29,7 +29,7 @@ class ActionDrawLinePolygon: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); virtual void updateMouseButtonHints(); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); diff --git a/src/actions/actiondrawlinepolygon2.cpp b/src/actions/actiondrawlinepolygon2.cpp index 3fb68be..f4e1fa1 100644 --- a/src/actions/actiondrawlinepolygon2.cpp +++ b/src/actions/actiondrawlinepolygon2.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLinePolygon2::ActionDrawLinePolygon2(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons", +ActionDrawLinePolygon2::ActionDrawLinePolygon2(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons", container, graphicView) { corner1 = Vector(false); @@ -49,16 +49,16 @@ void ActionDrawLinePolygon2::trigger() deletePreview(); clearPreview(); - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); bool ok = creation.createPolygon2(corner1, corner2, number); if (!ok) - RS_DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n"); + DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n"); } void ActionDrawLinePolygon2::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -75,7 +75,7 @@ void ActionDrawLinePolygon2::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// RS_Creation creation(preview, NULL, false); +// Creation creation(preview, NULL, false); // creation.createPolygon2(corner1, corner2, number); drawPreview(); @@ -130,26 +130,26 @@ void ActionDrawLinePolygon2::coordinateEvent(Vector * e) void ActionDrawLinePolygon2::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCorner1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), + DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel")); break; case SetCorner2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), + DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back")); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -159,26 +159,26 @@ void ActionDrawLinePolygon2::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLinePolygon2::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); } -void ActionDrawLinePolygon2::commandEvent(RS_CommandEvent * e) +void ActionDrawLinePolygon2::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -206,16 +206,16 @@ void ActionDrawLinePolygon2::commandEvent(RS_CommandEvent * e) { if (n > 0 && n < 10000) number = n; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..9999")); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression.")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression.")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -250,12 +250,12 @@ void ActionDrawLinePolygon2::updateMouseCursor() void ActionDrawLinePolygon2::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } diff --git a/src/actions/actiondrawlinepolygon2.h b/src/actions/actiondrawlinepolygon2.h index 8355f1b..4dcdb89 100644 --- a/src/actions/actiondrawlinepolygon2.h +++ b/src/actions/actiondrawlinepolygon2.h @@ -20,7 +20,7 @@ class ActionDrawLinePolygon2: public ActionInterface }; public: - ActionDrawLinePolygon2(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLinePolygon2(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLinePolygon2(); virtual RS2::ActionType rtti(); @@ -29,7 +29,7 @@ class ActionDrawLinePolygon2: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); virtual void updateMouseButtonHints(); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); diff --git a/src/actions/actiondrawlinerectangle.cpp b/src/actions/actiondrawlinerectangle.cpp index 134a788..7b3d6a1 100644 --- a/src/actions/actiondrawlinerectangle.cpp +++ b/src/actions/actiondrawlinerectangle.cpp @@ -23,7 +23,7 @@ #include "preview.h" ActionDrawLineRectangle::ActionDrawLineRectangle( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw rectangles", container, graphicView) { reset(); @@ -36,7 +36,7 @@ ActionDrawLineRectangle::~ActionDrawLineRectangle() void ActionDrawLineRectangle::reset() { for(int i=0; i<4; i++) - data[i] = RS_LineData(Vector(false), Vector(false)); + data[i] = LineData(Vector(false), Vector(false)); } void ActionDrawLineRectangle::init(int status) @@ -49,13 +49,13 @@ void ActionDrawLineRectangle::trigger() { ActionInterface::trigger(); - RS_Line * line[4]; + Line * line[4]; preparePreview(); // create and add rectangle: for(int i=0; i<4; i++) { - line[i] = new RS_Line(container, data[i]); + line[i] = new Line(container, data[i]); line[i]->setLayerToActive(); line[i]->setPenToActive(); container->addEntity(line[i]); @@ -79,7 +79,7 @@ void ActionDrawLineRectangle::trigger() for(int i=0; i<4; i++) { graphicView->drawEntity(line[i]); - RS_DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d", line[i]->getId()); + DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d", line[i]->getId()); } graphicView->moveRelativeZero(corner2); @@ -88,7 +88,7 @@ void ActionDrawLineRectangle::trigger() void ActionDrawLineRectangle::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -100,18 +100,18 @@ void ActionDrawLineRectangle::mouseMoveEvent(QMouseEvent * e) // preparePreview(); // for(int i=0; i<4; i++) -// preview->addEntity(new RS_Line(preview, data[i])); +// preview->addEntity(new Line(preview, data[i])); // drawPreview(); preparePreview(); graphicView->preview.clear(); for(int i=0; i<4; i++) - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data[i])); + graphicView->preview.addEntity(new Line(&(graphicView->preview), data[i])); } graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent end"); } void ActionDrawLineRectangle::mouseReleaseEvent(QMouseEvent * e) @@ -135,10 +135,10 @@ void ActionDrawLineRectangle::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLineRectangle::preparePreview() { - data[0] = RS_LineData(corner1, Vector(corner2.x, corner1.y)); - data[1] = RS_LineData(Vector(corner2.x, corner1.y), corner2); - data[2] = RS_LineData(corner2, Vector(corner1.x, corner2.y)); - data[3] = RS_LineData(Vector(corner1.x, corner2.y), corner1); + data[0] = LineData(corner1, Vector(corner2.x, corner1.y)); + data[1] = LineData(Vector(corner2.x, corner1.y), corner2); + data[2] = LineData(corner2, Vector(corner1.x, corner2.y)); + data[3] = LineData(Vector(corner1.x, corner2.y), corner1); } void ActionDrawLineRectangle::coordinateEvent(Vector * e) @@ -167,14 +167,14 @@ void ActionDrawLineRectangle::coordinateEvent(Vector * e) } } -void ActionDrawLineRectangle::commandEvent(RS_CommandEvent * e) +void ActionDrawLineRectangle::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -188,20 +188,20 @@ QStringList ActionDrawLineRectangle::getAvailableCommands() void ActionDrawLineRectangle::updateMouseButtonHints() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { switch (getStatus()) { case SetCorner1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel")); break; case SetCorner2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -214,11 +214,11 @@ void ActionDrawLineRectangle::updateMouseCursor() void ActionDrawLineRectangle::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } diff --git a/src/actions/actiondrawlinerectangle.h b/src/actions/actiondrawlinerectangle.h index 93eebd1..ad687cc 100644 --- a/src/actions/actiondrawlinerectangle.h +++ b/src/actions/actiondrawlinerectangle.h @@ -24,7 +24,7 @@ class ActionDrawLineRectangle: public ActionInterface }; public: - ActionDrawLineRectangle(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineRectangle(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineRectangle(); void reset(); @@ -34,7 +34,7 @@ class ActionDrawLineRectangle: public ActionInterface virtual void mouseReleaseEvent(QMouseEvent * e); void preparePreview(); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); @@ -42,7 +42,7 @@ class ActionDrawLineRectangle: public ActionInterface protected: /** Line data for the 4 lines. */ - RS_LineData data[4]; + LineData data[4]; /** 1st corner. */ Vector corner1; /** 2nd corner. */ diff --git a/src/actions/actiondrawlinerelangle.cpp b/src/actions/actiondrawlinerelangle.cpp index 6d3c2f6..260adc3 100644 --- a/src/actions/actiondrawlinerelangle.cpp +++ b/src/actions/actiondrawlinerelangle.cpp @@ -23,7 +23,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineRelAngle::ActionDrawLineRelAngle(RS_EntityContainer & container, +ActionDrawLineRelAngle::ActionDrawLineRelAngle(EntityContainer & container, GraphicView & graphicView, double angle, bool fixedAngle): ActionInterface("Draw Lines with relative angles", container, graphicView) { @@ -51,13 +51,13 @@ void ActionDrawLineRelAngle::trigger() deletePreview(); clearPreview(); - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); creation.createLineRelAngle(pos, entity, angle, length); } void ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); switch (getStatus()) @@ -73,7 +73,7 @@ void ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// RS_Creation creation(preview, NULL, false); +// Creation creation(preview, NULL, false); // creation.createLineRelAngle(pos, entity, angle, length); drawPreview(); @@ -84,7 +84,7 @@ void ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end"); } void ActionDrawLineRelAngle::mouseReleaseEvent(QMouseEvent * e) @@ -95,7 +95,7 @@ void ActionDrawLineRelAngle::mouseReleaseEvent(QMouseEvent * e) { case SetEntity: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL && (en->rtti() == RS2::EntityLine @@ -156,14 +156,14 @@ void ActionDrawLineRelAngle::coordinateEvent(Vector * e) } } -void ActionDrawLineRelAngle::commandEvent(RS_CommandEvent * e) +void ActionDrawLineRelAngle::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -191,15 +191,15 @@ void ActionDrawLineRelAngle::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - angle = RS_Math::deg2rad(a); - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + angle = Math::deg2rad(a); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } @@ -208,15 +208,15 @@ void ActionDrawLineRelAngle::commandEvent(RS_CommandEvent * e) case SetLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok) length = l; - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } @@ -249,22 +249,22 @@ QStringList ActionDrawLineRelAngle::getAvailableCommands() void ActionDrawLineRelAngle::updateMouseButtonHints() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select base entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select base entity"), tr("Cancel")); break; case SetPos: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"), + DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -274,16 +274,16 @@ void ActionDrawLineRelAngle::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLineRelAngle::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLineRelAngle::updateMouseCursor() @@ -293,12 +293,12 @@ void ActionDrawLineRelAngle::updateMouseCursor() void ActionDrawLineRelAngle::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } diff --git a/src/actions/actiondrawlinerelangle.h b/src/actions/actiondrawlinerelangle.h index 8f8f27a..3aed2bc 100644 --- a/src/actions/actiondrawlinerelangle.h +++ b/src/actions/actiondrawlinerelangle.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw lines with a given angle @@ -25,7 +25,7 @@ class ActionDrawLineRelAngle: public ActionInterface }; public: - ActionDrawLineRelAngle(RS_EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false); + ActionDrawLineRelAngle(EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false); ~ActionDrawLineRelAngle(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawLineRelAngle: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -48,11 +48,11 @@ class ActionDrawLineRelAngle: public ActionInterface private: /** Chosen entity */ - RS_Entity * entity; + Entity * entity; /** Chosen position */ Vector pos; /** Data of new line */ - RS_LineData data; + LineData data; /** * Line angle. */ diff --git a/src/actions/actiondrawlinetangent1.cpp b/src/actions/actiondrawlinetangent1.cpp index 28c1ea1..045ae6d 100644 --- a/src/actions/actiondrawlinetangent1.cpp +++ b/src/actions/actiondrawlinetangent1.cpp @@ -22,7 +22,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLineTangent1::ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1", +ActionDrawLineTangent1::ActionDrawLineTangent1(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1", container, graphicView) { tangent = NULL; @@ -40,8 +40,8 @@ void ActionDrawLineTangent1::trigger() if (tangent) { - RS_Entity * newEntity = NULL; - newEntity = new RS_Line(container, tangent->getData()); + Entity * newEntity = NULL; + newEntity = new Line(container, tangent->getData()); if (newEntity) { @@ -67,13 +67,13 @@ void ActionDrawLineTangent1::trigger() tangent = NULL; } else - RS_DEBUG->print("ActionDrawLineTangent1::trigger:" + DEBUG->print("ActionDrawLineTangent1::trigger:" " Entity is NULL\n"); } void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); switch (getStatus()) @@ -84,22 +84,22 @@ void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) case SetCircle: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en && (en->rtti() == RS2::EntityCircle || en->rtti() == RS2::EntityArc || en->rtti() == RS2::EntityEllipse)) { circle = en; - RS_Creation creation(NULL, NULL); - RS_Line * t = creation.createTangent1(mouse, point, circle); + Creation creation(NULL, NULL); + Line * t = creation.createTangent1(mouse, point, circle); if (t) { if (tangent) delete tangent; - tangent = (RS_Line *)t->clone(); + tangent = (Line *)t->clone(); deletePreview(); clearPreview(); @@ -114,7 +114,7 @@ void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end"); } void ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e) @@ -165,21 +165,21 @@ void ActionDrawLineTangent1::coordinateEvent(Vector * e) void ActionDrawLineTangent1::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel")); break; case SetCircle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select circle, arc or ellipse"), + DIALOGFACTORY->updateMouseWidget(tr("Select circle, arc or ellipse"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -192,11 +192,11 @@ void ActionDrawLineTangent1::updateMouseCursor() void ActionDrawLineTangent1::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } diff --git a/src/actions/actiondrawlinetangent1.h b/src/actions/actiondrawlinetangent1.h index 744291f..85f097d 100644 --- a/src/actions/actiondrawlinetangent1.h +++ b/src/actions/actiondrawlinetangent1.h @@ -5,8 +5,8 @@ #include "actioninterface.h" #include "vector.h" -class RS_Line; -class RS_Entity; +class Line; +class Entity; /** * This action class can handle user events to draw tangents from points @@ -24,7 +24,7 @@ class ActionDrawLineTangent1: public ActionInterface }; public: - ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineTangent1(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineTangent1(); virtual void trigger(); @@ -37,13 +37,13 @@ class ActionDrawLineTangent1: public ActionInterface private: /** Closest tangent. */ - RS_Line * tangent; + Line * tangent; /** Chosen startpoint */ Vector point; /** Chosen entity */ - RS_Entity * circle; + Entity * circle; /** Data of new tangent */ - RS_LineData data; + LineData data; }; #endif // __ACTIONDRAWLINETANGENT1_H__ diff --git a/src/actions/actiondrawlinetangent2.cpp b/src/actions/actiondrawlinetangent2.cpp index 7cf8586..4397560 100644 --- a/src/actions/actiondrawlinetangent2.cpp +++ b/src/actions/actiondrawlinetangent2.cpp @@ -23,7 +23,7 @@ #include "preview.h" ActionDrawLineTangent2::ActionDrawLineTangent2( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 2", container, graphicView) { tangent = NULL; @@ -41,8 +41,8 @@ void ActionDrawLineTangent2::trigger() if (tangent != NULL) { - RS_Entity * newEntity = NULL; - newEntity = new RS_Line(container, tangent->getData()); + Entity * newEntity = NULL; + newEntity = new Line(container, tangent->getData()); if (newEntity != NULL) { @@ -65,20 +65,20 @@ void ActionDrawLineTangent2::trigger() tangent = NULL; } else - RS_DEBUG->print("ActionDrawLineTangent2::trigger:" + DEBUG->print("ActionDrawLineTangent2::trigger:" " Entity is NULL\n"); } void ActionDrawLineTangent2::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); switch (getStatus()) { case SetCircle1: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en != NULL && (en->rtti() == RS2::EntityCircle || en->rtti() == RS2::EntityArc)) @@ -88,21 +88,21 @@ void ActionDrawLineTangent2::mouseMoveEvent(QMouseEvent * e) case SetCircle2: { - RS_Entity * en = catchEntity(e, RS2::ResolveAll); + Entity * en = catchEntity(e, RS2::ResolveAll); if (en && (en->rtti() == RS2::EntityCircle || en->rtti() == RS2::EntityArc)) { circle2 = en; - RS_Creation creation(NULL, NULL); - RS_Line * t = creation.createTangent2(mouse, circle1, circle2); + Creation creation(NULL, NULL); + Line * t = creation.createTangent2(mouse, circle1, circle2); if (t) { if (tangent) delete tangent; - tangent = (RS_Line *)t->clone(); + tangent = (Line *)t->clone(); deletePreview(); clearPreview(); @@ -117,7 +117,7 @@ void ActionDrawLineTangent2::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent end"); } void ActionDrawLineTangent2::mouseReleaseEvent(QMouseEvent * e) @@ -145,22 +145,22 @@ void ActionDrawLineTangent2::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLineTangent2::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCircle1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first circle or arc"), + DIALOGFACTORY->updateMouseWidget(tr("Select first circle or arc"), tr("Cancel")); break; case SetCircle2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second circle or arc"), + DIALOGFACTORY->updateMouseWidget(tr("Select second circle or arc"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -173,6 +173,6 @@ void ActionDrawLineTangent2::updateMouseCursor() void ActionDrawLineTangent2::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } diff --git a/src/actions/actiondrawlinetangent2.h b/src/actions/actiondrawlinetangent2.h index 7e04891..4346d69 100644 --- a/src/actions/actiondrawlinetangent2.h +++ b/src/actions/actiondrawlinetangent2.h @@ -4,7 +4,7 @@ #include "line.h" #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to draw tangents from circle to * circle. @@ -21,7 +21,7 @@ class ActionDrawLineTangent2: public ActionInterface }; public: - ActionDrawLineTangent2(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawLineTangent2(EntityContainer & container, GraphicView & graphicView); ~ActionDrawLineTangent2(); virtual void trigger(); @@ -35,13 +35,13 @@ class ActionDrawLineTangent2: public ActionInterface private: /** Closest tangent. */ - RS_Line * tangent; + Line * tangent; /** 1st chosen entity */ - RS_Entity * circle1; + Entity * circle1; /** 2nd chosen entity */ - RS_Entity * circle2; + Entity * circle2; /** Data of new tangent */ - RS_LineData data; + LineData data; }; #endif // __ACTIONDRAWLINETANGENT2_H__ diff --git a/src/actions/actiondrawpoint.cpp b/src/actions/actiondrawpoint.cpp index f1ac978..891990d 100644 --- a/src/actions/actiondrawpoint.cpp +++ b/src/actions/actiondrawpoint.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawPoint::ActionDrawPoint(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawPoint::ActionDrawPoint(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Points", container, graphicView) { } @@ -34,7 +34,7 @@ void ActionDrawPoint::trigger() { if (pt.valid) { - RS_Point * point = new RS_Point(container, RS_PointData(pt)); + Point * point = new Point(container, PointData(pt)); container->addEntity(point); if (document) @@ -82,14 +82,14 @@ void ActionDrawPoint::coordinateEvent(Vector * e) trigger(); } -void ActionDrawPoint::commandEvent(RS_CommandEvent * e) +void ActionDrawPoint::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -104,16 +104,16 @@ QStringList ActionDrawPoint::getAvailableCommands() void ActionDrawPoint::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify location"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify location"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -126,11 +126,11 @@ void ActionDrawPoint::updateMouseCursor() void ActionDrawPoint::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarPoints); + DIALOGFACTORY->requestToolBar(RS2::ToolBarPoints); } } diff --git a/src/actions/actiondrawpoint.h b/src/actions/actiondrawpoint.h index 7e2aa59..45637c0 100644 --- a/src/actions/actiondrawpoint.h +++ b/src/actions/actiondrawpoint.h @@ -13,14 +13,14 @@ class ActionDrawPoint: public ActionInterface { public: - ActionDrawPoint(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawPoint(EntityContainer & container, GraphicView & graphicView); ~ActionDrawPoint(); virtual void trigger(); virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); diff --git a/src/actions/actiondrawspline.cpp b/src/actions/actiondrawspline.cpp index 3ef5a18..befd888 100644 --- a/src/actions/actiondrawspline.cpp +++ b/src/actions/actiondrawspline.cpp @@ -23,13 +23,13 @@ #include "graphicview.h" #include "preview.h" -ActionDrawSpline::ActionDrawSpline(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawSpline::ActionDrawSpline(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw splines", container, graphicView) { reset(); #warning "!!! Need to port setAutoDelete() behaviour from Qt3 to Qt4 !!!" // history.setAutoDelete(true); - data = RS_SplineData(3, false); + data = SplineData(3, false); //bHistory.setAutoDelete(true); } @@ -85,7 +85,7 @@ void ActionDrawSpline::trigger() graphicView->drawEntity(spline); graphicView->moveRelativeZero(r); drawSnapper(); - RS_DEBUG->print("ActionDrawSpline::trigger(): spline added: %d", spline->getId()); + DEBUG->print("ActionDrawSpline::trigger(): spline added: %d", spline->getId()); spline = NULL; //history.clear(); @@ -93,7 +93,7 @@ void ActionDrawSpline::trigger() void ActionDrawSpline::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawSpline::mouseMoveEvent begin"); + DEBUG->print("ActionDrawSpline::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -102,7 +102,7 @@ void ActionDrawSpline::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); - RS_Spline * tmpSpline = (RS_Spline *)spline->clone(); + Spline * tmpSpline = (Spline *)spline->clone(); tmpSpline->addControlPoint(mouse); tmpSpline->update(); // preview->addEntity(tmpSpline); @@ -111,12 +111,12 @@ void ActionDrawSpline::mouseMoveEvent(QMouseEvent * e) QList::iterator it; // for(it=cpts.begin(); it!=cpts.end(); it+) -// preview->addEntity(new RS_Point(preview, RS_PointData(*it))); +// preview->addEntity(new Point(preview, PointData(*it))); drawPreview(); } - RS_DEBUG->print("ActionDrawSpline::mouseMoveEvent end"); + DEBUG->print("ActionDrawSpline::mouseMoveEvent end"); } void ActionDrawSpline::mouseReleaseEvent(QMouseEvent * e) @@ -153,7 +153,7 @@ void ActionDrawSpline::coordinateEvent(Vector * e) if (!spline) { - spline = new RS_Spline(container, data); + spline = new Spline(container, data); spline->addControlPoint(mouse); } @@ -183,7 +183,7 @@ void ActionDrawSpline::coordinateEvent(Vector * e) } } -void ActionDrawSpline::commandEvent(RS_CommandEvent * e) +void ActionDrawSpline::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); @@ -192,7 +192,7 @@ void ActionDrawSpline::commandEvent(RS_CommandEvent * e) case SetStartpoint: if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -244,7 +244,7 @@ void ActionDrawSpline::updateMouseButtonHints() switch (getStatus()) { case SetStartpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first control point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify first control point"), tr("Cancel")); break; @@ -254,26 +254,26 @@ void ActionDrawSpline::updateMouseButtonHints() if (history.count() >= 3) { - msg += RS_COMMANDS->command("close"); + msg += COMMANDS->command("close"); msg += "/"; } if (history.count() >= 2) - msg += RS_COMMANDS->command("undo"); + msg += COMMANDS->command("undo"); if (history.count() >= 2) - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify next control point or [%1]").arg(msg), tr("Back")); else - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify next control point"), tr("Back")); } break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -281,13 +281,13 @@ void ActionDrawSpline::updateMouseButtonHints() void ActionDrawSpline::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawSpline::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawSpline::updateMouseCursor() @@ -298,9 +298,9 @@ void ActionDrawSpline::updateMouseCursor() void ActionDrawSpline::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } void ActionDrawSpline::undo() @@ -328,7 +328,7 @@ void ActionDrawSpline::undo() } } else - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Cannot undo: Not enough entities defined yet.")); } diff --git a/src/actions/actiondrawspline.h b/src/actions/actiondrawspline.h index 30b7943..a014089 100644 --- a/src/actions/actiondrawspline.h +++ b/src/actions/actiondrawspline.h @@ -23,7 +23,7 @@ class ActionDrawSpline: public ActionInterface }; public: - ActionDrawSpline(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawSpline(EntityContainer & container, GraphicView & graphicView); virtual ~ActionDrawSpline(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionDrawSpline: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -51,12 +51,12 @@ class ActionDrawSpline: public ActionInterface /** * Spline data defined so far. */ - RS_SplineData data; + SplineData data; /** * Polyline entity we're working on. */ - RS_Spline * spline; + Spline * spline; /** * Point history (for undo) diff --git a/src/actions/actiondrawtext.cpp b/src/actions/actiondrawtext.cpp index 7e3d233..e3b370b 100644 --- a/src/actions/actiondrawtext.cpp +++ b/src/actions/actiondrawtext.cpp @@ -24,7 +24,7 @@ #include "graphicview.h" #include "preview.h" -ActionDrawText::ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView) +ActionDrawText::ActionDrawText(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView) { pos = Vector(false); textChanged = true; @@ -43,7 +43,7 @@ void ActionDrawText::init(int status) { ActionInterface::init(status); - if (RS_DIALOGFACTORY == NULL) + if (DIALOGFACTORY == NULL) return; switch (status) @@ -53,9 +53,9 @@ void ActionDrawText::init(int status) clearPreview(); reset(); - RS_Text tmp(NULL, data); + Text tmp(NULL, data); - if (RS_DIALOGFACTORY->requestTextDialog(&tmp)) + if (DIALOGFACTORY->requestTextDialog(&tmp)) { data = tmp.getData(); preparePreview(); @@ -75,7 +75,7 @@ void ActionDrawText::init(int status) break; case SetPos: - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); break; default: @@ -85,14 +85,14 @@ void ActionDrawText::init(int status) void ActionDrawText::reset() { - data = RS_TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop, + data = TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, data.text, "standard", 0.0, RS2::Update); } void ActionDrawText::trigger() { - RS_DEBUG->print("ActionDrawText::trigger()"); + DEBUG->print("ActionDrawText::trigger()"); if (pos.valid) { @@ -101,7 +101,7 @@ void ActionDrawText::trigger() clearPreview(); deleteSnapper(); - RS_Text * text = new RS_Text(container, data); + Text * text = new Text(container, data); text->update(); container->addEntity(text); @@ -124,7 +124,7 @@ void ActionDrawText::preparePreview() { /* clearPreview(); data.insertionPoint = Vector(0.0, 0.0); - RS_Text * text = new RS_Text(preview, data); + Text * text = new Text(preview, data); text->update(); preview->addEntity(text); textChanged = false;*/ @@ -132,7 +132,7 @@ void ActionDrawText::preparePreview() void ActionDrawText::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawText::mouseMoveEvent begin"); + DEBUG->print("ActionDrawText::mouseMoveEvent begin"); if (getStatus() == SetPos) { @@ -154,7 +154,7 @@ void ActionDrawText::mouseMoveEvent(QMouseEvent * e) drawPreview(); } - RS_DEBUG->print("ActionDrawText::mouseMoveEvent end"); + DEBUG->print("ActionDrawText::mouseMoveEvent end"); } void ActionDrawText::mouseReleaseEvent(QMouseEvent * e) @@ -201,14 +201,14 @@ void ActionDrawText::coordinateEvent(Vector * e) } } -void ActionDrawText::commandEvent(RS_CommandEvent * e) +void ActionDrawText::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -231,8 +231,8 @@ void ActionDrawText::commandEvent(RS_CommandEvent * e) case SetText: setText(e->getCommand()); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(SetPos); @@ -257,35 +257,35 @@ void ActionDrawText::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDrawText::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawText::updateMouseButtonHints() { - if (!RS_DIALOGFACTORY) + if (!DIALOGFACTORY) return; switch (getStatus()) { case SetPos: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -297,17 +297,17 @@ void ActionDrawText::updateMouseCursor() void ActionDrawText::updateToolBar() { - if (!RS_DIALOGFACTORY) + if (!DIALOGFACTORY) return; switch (getStatus()) { case SetPos: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); break; } } diff --git a/src/actions/actiondrawtext.h b/src/actions/actiondrawtext.h index eaad7c0..cae4c38 100644 --- a/src/actions/actiondrawtext.h +++ b/src/actions/actiondrawtext.h @@ -23,7 +23,7 @@ class ActionDrawText: public ActionInterface }; public: - ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView); + ActionDrawText(EntityContainer & container, GraphicView & graphicView); ~ActionDrawText(); virtual RS2::ActionType rtti(); @@ -34,7 +34,7 @@ class ActionDrawText: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -47,7 +47,7 @@ class ActionDrawText: public ActionInterface double getAngle(); private: - RS_TextData data; + TextData data; Vector pos; bool textChanged; }; diff --git a/src/actions/actioneditcopy.cpp b/src/actions/actioneditcopy.cpp index 4710354..93d6d8b 100644 --- a/src/actions/actioneditcopy.cpp +++ b/src/actions/actioneditcopy.cpp @@ -24,7 +24,7 @@ * * @param undo true for undo and false for redo. */ -ActionEditCopy::ActionEditCopy(bool copy, RS_EntityContainer & container, GraphicView & graphicView): +ActionEditCopy::ActionEditCopy(bool copy, EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Copy", container, graphicView) { this->copy = copy; @@ -43,12 +43,12 @@ void ActionEditCopy::trigger() { deleteSnapper(); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.copy(referencePoint, !copy); finish(); graphicView->killSelectActions(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionEditCopy::mouseMoveEvent(QMouseEvent * e) @@ -84,12 +84,12 @@ void ActionEditCopy::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -102,7 +102,7 @@ void ActionEditCopy::updateMouseCursor() void ActionEditCopy::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } diff --git a/src/actions/actioneditcopy.h b/src/actions/actioneditcopy.h index 265077c..882a260 100644 --- a/src/actions/actioneditcopy.h +++ b/src/actions/actioneditcopy.h @@ -22,7 +22,7 @@ class ActionEditCopy: public ActionInterface }; public: - ActionEditCopy(bool copy, RS_EntityContainer & container, GraphicView & graphicView); + ActionEditCopy(bool copy, EntityContainer & container, GraphicView & graphicView); ~ActionEditCopy(); virtual void init(int status = 0); diff --git a/src/actions/actioneditpaste.cpp b/src/actions/actioneditpaste.cpp index 5bc21fb..28b80a5 100644 --- a/src/actions/actioneditpaste.cpp +++ b/src/actions/actioneditpaste.cpp @@ -27,7 +27,7 @@ * * @param undo true for undo and false for redo. */ -ActionEditPaste::ActionEditPaste(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Paste", +ActionEditPaste::ActionEditPaste(EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Paste", container, graphicView) { } @@ -48,8 +48,8 @@ void ActionEditPaste::trigger() deletePreview(); clearPreview(); - RS_Modification m(*container, graphicView); - m.paste(RS_PasteData(targetPoint, 1.0, 0.0, false, "")); + Modification m(*container, graphicView); + m.paste(PasteData(targetPoint, 1.0, 0.0, false, "")); graphicView->redraw(); finish(); @@ -64,14 +64,14 @@ void ActionEditPaste::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// preview->addAllFrom(*RS_CLIPBOARD->getGraphic()); +// preview->addAllFrom(*CLIPBOARD->getGraphic()); // preview->move(targetPoint); if (graphic) { - RS2::Unit sourceUnit = RS_CLIPBOARD->getGraphic()->getUnit(); + RS2::Unit sourceUnit = CLIPBOARD->getGraphic()->getUnit(); RS2::Unit targetUnit = graphic->getUnit(); - double f = RS_Units::convert(1.0, sourceUnit, targetUnit); + double f = Units::convert(1.0, sourceUnit, targetUnit); // preview->scale(targetPoint, Vector(f, f)); } @@ -111,12 +111,12 @@ void ActionEditPaste::updateMouseButtonHints() switch (getStatus()) { case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Set reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Set reference point"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -129,7 +129,7 @@ void ActionEditPaste::updateMouseCursor() void ActionEditPaste::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } diff --git a/src/actions/actioneditpaste.h b/src/actions/actioneditpaste.h index dd7f3e9..ec8208f 100644 --- a/src/actions/actioneditpaste.h +++ b/src/actions/actioneditpaste.h @@ -22,7 +22,7 @@ class ActionEditPaste: public ActionInterface }; public: - ActionEditPaste(RS_EntityContainer & container, GraphicView & graphicView); + ActionEditPaste(EntityContainer & container, GraphicView & graphicView); ~ActionEditPaste(); virtual void init(int status = 0); diff --git a/src/actions/actioneditundo.cpp b/src/actions/actioneditundo.cpp index 98e7a21..11ed2fc 100644 --- a/src/actions/actioneditundo.cpp +++ b/src/actions/actioneditundo.cpp @@ -24,7 +24,7 @@ * * @param undo true for undo and false for redo. */ -ActionEditUndo::ActionEditUndo(bool undo, RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Undo", container, graphicView) +ActionEditUndo::ActionEditUndo(bool undo, EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Undo", container, graphicView) { this->undo = undo; } @@ -51,5 +51,5 @@ void ActionEditUndo::trigger() graphicView->redraw(); finish(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } diff --git a/src/actions/actioneditundo.h b/src/actions/actioneditundo.h index 69633ec..e8d3847 100644 --- a/src/actions/actioneditundo.h +++ b/src/actions/actioneditundo.h @@ -12,7 +12,7 @@ class ActionEditUndo: public ActionInterface { public: - ActionEditUndo(bool undo, RS_EntityContainer & container, GraphicView & graphicView); + ActionEditUndo(bool undo, EntityContainer & container, GraphicView & graphicView); ~ActionEditUndo(); virtual void init(int status = 0); diff --git a/src/actions/actionfilenew.cpp b/src/actions/actionfilenew.cpp index a7fd4ab..e582eb5 100644 --- a/src/actions/actionfilenew.cpp +++ b/src/actions/actionfilenew.cpp @@ -18,7 +18,7 @@ //#include "drawing.h" -ActionFileNew::ActionFileNew(RS_EntityContainer & container, GraphicView & graphicView): +ActionFileNew::ActionFileNew(EntityContainer & container, GraphicView & graphicView): ActionInterface("File New", container, graphicView) { } @@ -31,9 +31,9 @@ void ActionFileNew::trigger() { /* // Not supported currently - RS_DEBUG->print("ActionFileNew::trigger"); + DEBUG->print("ActionFileNew::trigger"); - QString fileName; //= RS_DIALOGFACTORY->requestFileNewDialog(); + QString fileName; //= DIALOGFACTORY->requestFileNewDialog(); if (graphic!=NULL && !fileName.isEmpty()) { graphic->open(fileName, ); } diff --git a/src/actions/actionfilenew.h b/src/actions/actionfilenew.h index a77e0c5..f3f5eb6 100644 --- a/src/actions/actionfilenew.h +++ b/src/actions/actionfilenew.h @@ -12,7 +12,7 @@ class ActionFileNew: public ActionInterface { public: - ActionFileNew(RS_EntityContainer & container, GraphicView & graphicView); + ActionFileNew(EntityContainer & container, GraphicView & graphicView); ~ActionFileNew(); virtual void init(int status = 0); diff --git a/src/actions/actionfileopen.cpp b/src/actions/actionfileopen.cpp index 2d956b2..caed4a5 100644 --- a/src/actions/actionfileopen.cpp +++ b/src/actions/actionfileopen.cpp @@ -18,7 +18,7 @@ //#include "drawing.h" -ActionFileOpen::ActionFileOpen(RS_EntityContainer & container, GraphicView & graphicView): +ActionFileOpen::ActionFileOpen(EntityContainer & container, GraphicView & graphicView): ActionInterface("File Open", container, graphicView) { } @@ -31,9 +31,9 @@ void ActionFileOpen::trigger() { /* // Not supported currently - RS_DEBUG->print("ActionFileOpen::trigger"); + DEBUG->print("ActionFileOpen::trigger"); - QString fileName; //= RS_DIALOGFACTORY->requestFileOpenDialog(); + QString fileName; //= DIALOGFACTORY->requestFileOpenDialog(); if (graphic!=NULL && !fileName.isEmpty()) { graphic->open(fileName, ); } diff --git a/src/actions/actionfileopen.h b/src/actions/actionfileopen.h index 8fb26e1..b5a241c 100644 --- a/src/actions/actionfileopen.h +++ b/src/actions/actionfileopen.h @@ -12,7 +12,7 @@ class ActionFileOpen: public ActionInterface { public: - ActionFileOpen(RS_EntityContainer & container, GraphicView & graphicView); + ActionFileOpen(EntityContainer & container, GraphicView & graphicView); ~ActionFileOpen(); virtual void init(int status = 0); diff --git a/src/actions/actionfilesave.cpp b/src/actions/actionfilesave.cpp index fe53948..6324e23 100644 --- a/src/actions/actionfilesave.cpp +++ b/src/actions/actionfilesave.cpp @@ -18,7 +18,7 @@ #include "drawing.h" -ActionFileSave::ActionFileSave(RS_EntityContainer & container, GraphicView & graphicView): +ActionFileSave::ActionFileSave(EntityContainer & container, GraphicView & graphicView): ActionInterface("File Save", container, graphicView) { } @@ -29,7 +29,7 @@ ActionFileSave::~ActionFileSave() void ActionFileSave::trigger() { - RS_DEBUG->print("ActionFileSave::trigger"); + DEBUG->print("ActionFileSave::trigger"); if (graphic != NULL) graphic->save(); diff --git a/src/actions/actionfilesave.h b/src/actions/actionfilesave.h index 5587486..a60ebf2 100644 --- a/src/actions/actionfilesave.h +++ b/src/actions/actionfilesave.h @@ -12,7 +12,7 @@ class ActionFileSave: public ActionInterface { public: - ActionFileSave(RS_EntityContainer & container, GraphicView & graphicView); + ActionFileSave(EntityContainer & container, GraphicView & graphicView); ~ActionFileSave(); virtual void init(int status = 0); diff --git a/src/actions/actionfilesaveas.cpp b/src/actions/actionfilesaveas.cpp index 7864cb3..f1e8a3b 100644 --- a/src/actions/actionfilesaveas.cpp +++ b/src/actions/actionfilesaveas.cpp @@ -18,7 +18,7 @@ #include "drawing.h" -ActionFileSaveAs::ActionFileSaveAs(RS_EntityContainer & container, GraphicView & graphicView): +ActionFileSaveAs::ActionFileSaveAs(EntityContainer & container, GraphicView & graphicView): ActionInterface("Add Layer", container, graphicView) { } @@ -29,8 +29,8 @@ ActionFileSaveAs::~ActionFileSaveAs() void ActionFileSaveAs::trigger() { - RS_DEBUG->print("ActionFileSaveAs::trigger"); - QString fileName; // = RS_DIALOGFACTORY->requestFileSaveAsDialog(); + DEBUG->print("ActionFileSaveAs::trigger"); + QString fileName; // = DIALOGFACTORY->requestFileSaveAsDialog(); if (graphic != NULL && !fileName.isEmpty()) graphic->saveAs(fileName, RS2::FormatUnknown); diff --git a/src/actions/actionfilesaveas.h b/src/actions/actionfilesaveas.h index 3915cbb..426c2db 100644 --- a/src/actions/actionfilesaveas.h +++ b/src/actions/actionfilesaveas.h @@ -12,7 +12,7 @@ class ActionFileSaveAs: public ActionInterface { public: - ActionFileSaveAs(RS_EntityContainer & container, GraphicView & graphicView); + ActionFileSaveAs(EntityContainer & container, GraphicView & graphicView); ~ActionFileSaveAs(); virtual void init(int status = 0); diff --git a/src/actions/actioninfoangle.cpp b/src/actions/actioninfoangle.cpp index 34ad19a..d7b69a0 100644 --- a/src/actions/actioninfoangle.cpp +++ b/src/actions/actioninfoangle.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "information.h" -ActionInfoAngle::ActionInfoAngle(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Angle", +ActionInfoAngle::ActionInfoAngle(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Angle", container, graphicView) { } @@ -37,12 +37,12 @@ void ActionInfoAngle::init(int status) void ActionInfoAngle::trigger() { - RS_DEBUG->print("ActionInfoAngle::trigger()"); + DEBUG->print("ActionInfoAngle::trigger()"); deleteSnapper(); if (entity1 != NULL && entity2 != NULL) { - VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false); + VectorSolutions sol = Information::getIntersection(entity1, entity2, false); if (sol.hasValid()) { @@ -55,18 +55,18 @@ void ActionInfoAngle::trigger() double angle = fabs(angle2 - angle1); QString str; - str.sprintf("%.6f", RS_Math::rad2deg(angle)); - RS_DIALOGFACTORY->commandMessage(tr("Angle: %1%2").arg(str).arg(QChar(0xB0))); + str.sprintf("%.6f", Math::rad2deg(angle)); + DIALOGFACTORY->commandMessage(tr("Angle: %1%2").arg(str).arg(QChar(0xB0))); } } else - RS_DIALOGFACTORY->commandMessage(tr("Lines are parallel")); + DIALOGFACTORY->commandMessage(tr("Lines are parallel")); } } void ActionInfoAngle::mouseMoveEvent(QMouseEvent * /*e*/) { - RS_DEBUG->print("ActionInfoAngle::mouseMoveEvent begin"); + DEBUG->print("ActionInfoAngle::mouseMoveEvent begin"); switch (getStatus()) { @@ -80,7 +80,7 @@ void ActionInfoAngle::mouseMoveEvent(QMouseEvent * /*e*/) break; } - RS_DEBUG->print("ActionInfoAngle::mouseMoveEvent end"); + DEBUG->print("ActionInfoAngle::mouseMoveEvent end"); } void ActionInfoAngle::mouseReleaseEvent(QMouseEvent * e) @@ -131,17 +131,17 @@ void ActionInfoAngle::updateMouseButtonHints() switch (getStatus()) { case SetEntity1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first line"), tr("Cancel")); break; case SetEntity2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify second line"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -157,11 +157,11 @@ void ActionInfoAngle::updateToolBar() { case SetEntity1: case SetEntity2: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); break; } } diff --git a/src/actions/actioninfoangle.h b/src/actions/actioninfoangle.h index 8c878c7..fc7f230 100644 --- a/src/actions/actioninfoangle.h +++ b/src/actions/actioninfoangle.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to measure angles. @@ -24,7 +24,7 @@ class ActionInfoAngle: public ActionInterface }; public: - ActionInfoAngle(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoAngle(EntityContainer & container, GraphicView & graphicView); ~ActionInfoAngle(); virtual void init(int status = 0); @@ -36,10 +36,10 @@ class ActionInfoAngle: public ActionInterface virtual void updateToolBar(); private: - RS_Entity * entity1; + Entity * entity1; Vector point1; - RS_Entity * entity2; + Entity * entity2; Vector point2; Vector intersection; diff --git a/src/actions/actioninfoarea.cpp b/src/actions/actioninfoarea.cpp index ba3b6f3..7c9ca32 100644 --- a/src/actions/actioninfoarea.cpp +++ b/src/actions/actioninfoarea.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionInfoArea::ActionInfoArea(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Area", +ActionInfoArea::ActionInfoArea(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Area", container, graphicView) { } @@ -42,7 +42,7 @@ void ActionInfoArea::init(int status) void ActionInfoArea::trigger() { - RS_DEBUG->print("ActionInfoArea::trigger()"); + DEBUG->print("ActionInfoArea::trigger()"); if (ia.isValid()) { @@ -51,9 +51,9 @@ void ActionInfoArea::trigger() double area = ia.getArea(); double circ = ia.getCircumference(); - RS_DEBUG->print("ActionInfoArea::trigger: area: %f", area); - RS_DIALOGFACTORY->commandMessage(tr("Area: %1").arg(area)); - RS_DIALOGFACTORY->commandMessage(tr("Circumference: %1").arg(circ)); + DEBUG->print("ActionInfoArea::trigger: area: %f", area); + DIALOGFACTORY->commandMessage(tr("Area: %1").arg(area)); + DIALOGFACTORY->commandMessage(tr("Circumference: %1").arg(circ)); } ia.reset(); @@ -63,14 +63,14 @@ void ActionInfoArea::trigger() double dist = point1.distanceTo(point2); QString str; str.sprintf("%.6f", dist); - RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); + DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); } */ } void ActionInfoArea::mouseMoveEvent(QMouseEvent * e) { - //RS_DEBUG->print("ActionInfoArea::mouseMoveEvent begin"); + //DEBUG->print("ActionInfoArea::mouseMoveEvent begin"); if (getStatus() == SetFirstPoint || getStatus() == SetNextPoint) @@ -100,12 +100,12 @@ void ActionInfoArea::mouseMoveEvent(QMouseEvent * e) closingLine = NULL; } -// currentLine = new RS_Line(preview, RS_LineData(prev, mouse)); +// currentLine = new Line(preview, LineData(prev, mouse)); // preview->addEntity(currentLine); // if (preview->count() > 1) // { -// closingLine = new RS_Line(preview, RS_LineData(mouse, point1)); +// closingLine = new Line(preview, LineData(mouse, point1)); // preview->addEntity(closingLine); // } @@ -145,7 +145,7 @@ void ActionInfoArea::mouseReleaseEvent(QMouseEvent * e) closingLine = NULL; } -// currentLine = new RS_Line(preview, RS_LineData(prev, point1)); +// currentLine = new Line(preview, LineData(prev, point1)); // preview->addEntity(currentLine); drawPreview(); } @@ -172,7 +172,7 @@ void ActionInfoArea::coordinateEvent(Vector * e) clearPreview(); ia.addPoint(mouse); - RS_DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y)); + DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y)); graphicView->moveRelativeZero(point1); prev = mouse; @@ -185,7 +185,7 @@ void ActionInfoArea::coordinateEvent(Vector * e) if (point1.valid) { ia.addPoint(mouse); - RS_DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y)); + DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y)); currentLine = NULL; @@ -211,19 +211,19 @@ void ActionInfoArea::updateMouseButtonHints() switch (getStatus()) { case SetFirstPoint: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first point of polygon"), tr("Cancel")); break; case SetNextPoint: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify next point of polygon"), tr("Terminate")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -239,11 +239,11 @@ void ActionInfoArea::updateToolBar() { case SetFirstPoint: case SetNextPoint: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); break; } } diff --git a/src/actions/actioninfoarea.h b/src/actions/actioninfoarea.h index 9ba718d..e9674e5 100644 --- a/src/actions/actioninfoarea.h +++ b/src/actions/actioninfoarea.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to measure distances between @@ -26,7 +26,7 @@ class ActionInfoArea: public ActionInterface }; public: - ActionInfoArea(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoArea(EntityContainer & container, GraphicView & graphicView); ~ActionInfoArea(); virtual void init(int status = 0); @@ -41,9 +41,9 @@ class ActionInfoArea: public ActionInterface private: Vector point1; Vector prev; - RS_Entity * currentLine; - RS_Entity * closingLine; - RS_InfoArea ia; + Entity * currentLine; + Entity * closingLine; + InfoArea ia; }; #endif // __ACTIONINFOAREA_H__ diff --git a/src/actions/actioninfodist.cpp b/src/actions/actioninfodist.cpp index 9cc40fa..0206791 100644 --- a/src/actions/actioninfodist.cpp +++ b/src/actions/actioninfodist.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionInfoDist::ActionInfoDist(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Dist", +ActionInfoDist::ActionInfoDist(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Dist", container, graphicView) { } @@ -37,20 +37,20 @@ void ActionInfoDist::init(int status) void ActionInfoDist::trigger() { - RS_DEBUG->print("ActionInfoDist::trigger()"); + DEBUG->print("ActionInfoDist::trigger()"); if (point1.valid && point2.valid) { double dist = point1.distanceTo(point2); QString str; str.sprintf("%.6f", dist); - RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); + DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); } } void ActionInfoDist::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionInfoDist::mouseMoveEvent begin"); + DEBUG->print("ActionInfoDist::mouseMoveEvent begin"); if (getStatus() == SetPoint1 || getStatus() == SetPoint2) @@ -70,7 +70,7 @@ void ActionInfoDist::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); -// preview->addEntity(new RS_Line(preview, RS_LineData(point1, point2))); +// preview->addEntity(new Line(preview, LineData(point1, point2))); drawPreview(); } break; @@ -80,7 +80,7 @@ void ActionInfoDist::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionInfoDist::mouseMoveEvent end"); + DEBUG->print("ActionInfoDist::mouseMoveEvent end"); } void ActionInfoDist::mouseReleaseEvent(QMouseEvent * e) @@ -136,19 +136,19 @@ void ActionInfoDist::updateMouseButtonHints() switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first point of distance"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify second point of distance"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -164,11 +164,11 @@ void ActionInfoDist::updateToolBar() { case SetPoint1: case SetPoint2: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); break; } } diff --git a/src/actions/actioninfodist.h b/src/actions/actioninfodist.h index 1d3d01e..fffa8af 100644 --- a/src/actions/actioninfodist.h +++ b/src/actions/actioninfodist.h @@ -23,7 +23,7 @@ class ActionInfoDist: public ActionInterface }; public: - ActionInfoDist(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoDist(EntityContainer & container, GraphicView & graphicView); ~ActionInfoDist(); virtual void init(int status = 0); diff --git a/src/actions/actioninfodist2.cpp b/src/actions/actioninfodist2.cpp index c215e31..a3402f2 100644 --- a/src/actions/actioninfodist2.cpp +++ b/src/actions/actioninfodist2.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "preview.h" -ActionInfoDist2::ActionInfoDist2(RS_EntityContainer & container, GraphicView & graphicView): +ActionInfoDist2::ActionInfoDist2(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Dist2", container, graphicView) { } @@ -37,7 +37,7 @@ void ActionInfoDist2::init(int status) void ActionInfoDist2::trigger() { - RS_DEBUG->print("ActionInfoDist2::trigger()"); + DEBUG->print("ActionInfoDist2::trigger()"); deleteSnapper(); if (point.valid && entity != NULL) @@ -45,13 +45,13 @@ void ActionInfoDist2::trigger() double dist = entity->getDistanceToPoint(point); QString str; str.sprintf("%.6f", dist); - RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); + DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str)); } } void ActionInfoDist2::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionInfoDist2::mouseMoveEvent begin"); + DEBUG->print("ActionInfoDist2::mouseMoveEvent begin"); switch (getStatus()) { @@ -69,7 +69,7 @@ void ActionInfoDist2::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionInfoDist2::mouseMoveEvent end"); + DEBUG->print("ActionInfoDist2::mouseMoveEvent end"); } void ActionInfoDist2::mouseReleaseEvent(QMouseEvent * e) @@ -123,15 +123,15 @@ void ActionInfoDist2::updateMouseButtonHints() switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify entity"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify entity"), tr("Cancel")); break; case SetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -147,11 +147,11 @@ void ActionInfoDist2::updateToolBar() { case SetPoint: case SetEntity: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); break; } } diff --git a/src/actions/actioninfodist2.h b/src/actions/actioninfodist2.h index 4af31e4..f4bbbec 100644 --- a/src/actions/actioninfodist2.h +++ b/src/actions/actioninfodist2.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to measure distances between @@ -25,7 +25,7 @@ class ActionInfoDist2: public ActionInterface }; public: - ActionInfoDist2(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoDist2(EntityContainer & container, GraphicView & graphicView); ~ActionInfoDist2(); virtual void init(int status = 0); @@ -38,7 +38,7 @@ class ActionInfoDist2: public ActionInterface virtual void updateToolBar(); private: - RS_Entity * entity; + Entity * entity; Vector point; }; diff --git a/src/actions/actioninfoinside.cpp b/src/actions/actioninfoinside.cpp index b31958d..7d7c734 100644 --- a/src/actions/actioninfoinside.cpp +++ b/src/actions/actioninfoinside.cpp @@ -20,12 +20,12 @@ #include "graphicview.h" #include "information.h" -ActionInfoInside::ActionInfoInside(RS_EntityContainer & container, GraphicView & graphicView): +ActionInfoInside::ActionInfoInside(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Inside", container, graphicView) { - contour = new RS_EntityContainer(NULL, false); + contour = new EntityContainer(NULL, false); - for (RS_Entity * e = container.firstEntity(); e != NULL; e = container.nextEntity()) + for (Entity * e = container.firstEntity(); e != NULL; e = container.nextEntity()) if (e->isSelected()) contour->addEntity(e); } @@ -40,10 +40,10 @@ void ActionInfoInside::trigger() deleteSnapper(); bool onContour = false; - if (RS_Information::isPointInsideContour(pt, contour, &onContour)) - RS_DIALOGFACTORY->commandMessage(tr("Point is inside selected contour.")); + if (Information::isPointInsideContour(pt, contour, &onContour)) + DIALOGFACTORY->commandMessage(tr("Point is inside selected contour.")); else - RS_DIALOGFACTORY->commandMessage(tr("Point is outside selected contour.")); + DIALOGFACTORY->commandMessage(tr("Point is outside selected contour.")); finish(); } @@ -71,11 +71,11 @@ void ActionInfoInside::updateMouseButtonHints() switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -88,7 +88,7 @@ void ActionInfoInside::updateMouseCursor() void ActionInfoInside::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); } diff --git a/src/actions/actioninfoinside.h b/src/actions/actioninfoinside.h index e660683..3a4de23 100644 --- a/src/actions/actioninfoinside.h +++ b/src/actions/actioninfoinside.h @@ -14,7 +14,7 @@ class ActionInfoInside: public ActionInterface { public: - ActionInfoInside(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoInside(EntityContainer & container, GraphicView & graphicView); ~ActionInfoInside(); virtual void trigger(); @@ -26,7 +26,7 @@ class ActionInfoInside: public ActionInterface private: Vector pt; - RS_EntityContainer * contour; + EntityContainer * contour; }; #endif // __ACTIONINFOINSIDE_H__ diff --git a/src/actions/actioninfototallength.cpp b/src/actions/actioninfototallength.cpp index 5abe644..05a03c7 100644 --- a/src/actions/actioninfototallength.cpp +++ b/src/actions/actioninfototallength.cpp @@ -19,7 +19,7 @@ #include "debug.h" #include "dialogfactory.h" -ActionInfoTotalLength::ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length", +ActionInfoTotalLength::ActionInfoTotalLength(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length", container, graphicView) { } @@ -36,11 +36,11 @@ void ActionInfoTotalLength::init(int status) void ActionInfoTotalLength::trigger() { - RS_DEBUG->print("ActionInfoTotalLength::trigger()"); + DEBUG->print("ActionInfoTotalLength::trigger()"); double len = 0.0; - for(RS_Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL; + for(Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL; e=container->nextEntity(RS2::ResolveNone)) { if (e->isVisible() && e->isSelected()) @@ -58,10 +58,10 @@ void ActionInfoTotalLength::trigger() } if (len > 0.0) - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Total Length of selected entities: %1").arg(len)); else - RS_DIALOGFACTORY->commandMessage(tr("At least one of the selected " + DIALOGFACTORY->commandMessage(tr("At least one of the selected " "entities cannot be measured.")); finish(); @@ -69,11 +69,11 @@ void ActionInfoTotalLength::trigger() void ActionInfoTotalLength::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); + DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } } diff --git a/src/actions/actioninfototallength.h b/src/actions/actioninfototallength.h index c6ed621..86f6fbc 100644 --- a/src/actions/actioninfototallength.h +++ b/src/actions/actioninfototallength.h @@ -20,7 +20,7 @@ class ActionInfoTotalLength: public ActionInterface }; public: - ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView); + ActionInfoTotalLength(EntityContainer & container, GraphicView & graphicView); ~ActionInfoTotalLength(); virtual void init(int status = 0); diff --git a/src/actions/actionlayersadd.cpp b/src/actions/actionlayersadd.cpp index 199b844..ba156ae 100644 --- a/src/actions/actionlayersadd.cpp +++ b/src/actions/actionlayersadd.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "drawing.h" -ActionLayersAdd::ActionLayersAdd(RS_EntityContainer & container, GraphicView & graphicView): +ActionLayersAdd::ActionLayersAdd(EntityContainer & container, GraphicView & graphicView): ActionInterface("Add Layer", container, graphicView) { } @@ -30,11 +30,11 @@ ActionLayersAdd::~ActionLayersAdd() void ActionLayersAdd::trigger() { - RS_DEBUG->print("add layer"); + DEBUG->print("add layer"); - if (RS_DIALOGFACTORY && graphic) + if (DIALOGFACTORY && graphic) { - RS_Layer * layer = RS_DIALOGFACTORY->requestNewLayerDialog(graphic->getLayerList()); + Layer * layer = DIALOGFACTORY->requestNewLayerDialog(graphic->getLayerList()); if (layer) graphic->addLayer(layer); diff --git a/src/actions/actionlayersadd.h b/src/actions/actionlayersadd.h index b5791c6..badc18e 100644 --- a/src/actions/actionlayersadd.h +++ b/src/actions/actionlayersadd.h @@ -12,7 +12,7 @@ class ActionLayersAdd: public ActionInterface { public: - ActionLayersAdd(RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersAdd(EntityContainer & container, GraphicView & graphicView); ~ActionLayersAdd(); virtual void init(int status = 0); diff --git a/src/actions/actionlayersedit.cpp b/src/actions/actionlayersedit.cpp index c4a46b9..21bffbe 100644 --- a/src/actions/actionlayersedit.cpp +++ b/src/actions/actionlayersedit.cpp @@ -20,7 +20,7 @@ #include "graphicview.h" #include "drawing.h" -ActionLayersEdit::ActionLayersEdit(RS_EntityContainer & container, GraphicView & graphicView): +ActionLayersEdit::ActionLayersEdit(EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Layer", container, graphicView) { } @@ -31,22 +31,22 @@ ActionLayersEdit::~ActionLayersEdit() void ActionLayersEdit::trigger() { - RS_DEBUG->print("ActionLayersEdit::trigger"); - RS_Layer * layer = NULL; + DEBUG->print("ActionLayersEdit::trigger"); + Layer * layer = NULL; if (graphic) { - layer = RS_DIALOGFACTORY->requestEditLayerDialog(graphic->getLayerList()); + layer = DIALOGFACTORY->requestEditLayerDialog(graphic->getLayerList()); if (layer) { graphic->editLayer(graphic->getActiveLayer(), *layer); // Update updatable entities on the layer that has changed - for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); + for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; e=graphic->nextEntity(RS2::ResolveNone)) { - RS_Layer * l = e->getLayer(); + Layer * l = e->getLayer(); if (l && l->getName() == layer->getName()) e->update(); diff --git a/src/actions/actionlayersedit.h b/src/actions/actionlayersedit.h index ccf6c24..afa03ed 100644 --- a/src/actions/actionlayersedit.h +++ b/src/actions/actionlayersedit.h @@ -12,7 +12,7 @@ class ActionLayersEdit: public ActionInterface { public: - ActionLayersEdit(RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersEdit(EntityContainer & container, GraphicView & graphicView); ~ActionLayersEdit(); virtual void init(int status = 0); diff --git a/src/actions/actionlayersfreezeall.cpp b/src/actions/actionlayersfreezeall.cpp index a53ef91..15b067d 100644 --- a/src/actions/actionlayersfreezeall.cpp +++ b/src/actions/actionlayersfreezeall.cpp @@ -19,7 +19,7 @@ #include "drawing.h" ActionLayersFreezeAll::ActionLayersFreezeAll(bool freeze, - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Freeze all Layers", container, graphicView) { this->freeze = freeze; @@ -31,7 +31,7 @@ ActionLayersFreezeAll::~ActionLayersFreezeAll() void ActionLayersFreezeAll::trigger() { - RS_DEBUG->print("ActionLayersFreezeAll::trigger"); + DEBUG->print("ActionLayersFreezeAll::trigger"); if (graphic) graphic->freezeAllLayers(freeze); diff --git a/src/actions/actionlayersfreezeall.h b/src/actions/actionlayersfreezeall.h index cad0b41..8d4e3e7 100644 --- a/src/actions/actionlayersfreezeall.h +++ b/src/actions/actionlayersfreezeall.h @@ -12,7 +12,7 @@ class ActionLayersFreezeAll: public ActionInterface { public: - ActionLayersFreezeAll(bool freeze, RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersFreezeAll(bool freeze, EntityContainer & container, GraphicView & graphicView); ~ActionLayersFreezeAll(); virtual void init(int status = 0); diff --git a/src/actions/actionlayersremove.cpp b/src/actions/actionlayersremove.cpp index ef2c870..47b7387 100644 --- a/src/actions/actionlayersremove.cpp +++ b/src/actions/actionlayersremove.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "drawing.h" -ActionLayersRemove::ActionLayersRemove(RS_EntityContainer & container, +ActionLayersRemove::ActionLayersRemove(EntityContainer & container, GraphicView & graphicView): ActionInterface("Remove Layer", container, graphicView) { @@ -31,19 +31,19 @@ ActionLayersRemove::~ActionLayersRemove() void ActionLayersRemove::trigger() { - RS_DEBUG->print("ActionLayersRemove::trigger"); + DEBUG->print("ActionLayersRemove::trigger"); if (graphic) { - RS_Layer * layer = - RS_DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList()); + Layer * layer = + DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList()); // Now remove the layer from the layer list: graphic->removeLayer(layer); } finish(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionLayersRemove::init(int status) diff --git a/src/actions/actionlayersremove.h b/src/actions/actionlayersremove.h index b48779a..ffad4f4 100644 --- a/src/actions/actionlayersremove.h +++ b/src/actions/actionlayersremove.h @@ -12,7 +12,7 @@ class ActionLayersRemove: public ActionInterface { public: - ActionLayersRemove(RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersRemove(EntityContainer & container, GraphicView & graphicView); ~ActionLayersRemove(); virtual void init(int status = 0); diff --git a/src/actions/actionlayerstogglelock.cpp b/src/actions/actionlayerstogglelock.cpp index 84aa552..6ea9e20 100644 --- a/src/actions/actionlayerstogglelock.cpp +++ b/src/actions/actionlayerstogglelock.cpp @@ -19,7 +19,7 @@ #include "graphicview.h" #include "drawing.h" -ActionLayersToggleLock::ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility", +ActionLayersToggleLock::ActionLayersToggleLock(EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility", container, graphicView) { } @@ -30,11 +30,11 @@ ActionLayersToggleLock::~ActionLayersToggleLock() void ActionLayersToggleLock::trigger() { - RS_DEBUG->print("toggle layer"); + DEBUG->print("toggle layer"); if (graphic) { - RS_Layer * layer = graphic->getActiveLayer(); + Layer * layer = graphic->getActiveLayer(); if (layer) { @@ -43,7 +43,7 @@ void ActionLayersToggleLock::trigger() // deselect entities on locked layer: if (layer->isLocked()) { - for(RS_Entity * e=container->firstEntity(); e!=NULL; + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e != NULL && e->isVisible() && e->getLayer() == layer) diff --git a/src/actions/actionlayerstogglelock.h b/src/actions/actionlayerstogglelock.h index a0cfafa..fb3511f 100644 --- a/src/actions/actionlayerstogglelock.h +++ b/src/actions/actionlayerstogglelock.h @@ -12,7 +12,7 @@ class ActionLayersToggleLock: public ActionInterface { public: - ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersToggleLock(EntityContainer & container, GraphicView & graphicView); ~ActionLayersToggleLock(); virtual void init(int status = 0); diff --git a/src/actions/actionlayerstoggleview.cpp b/src/actions/actionlayerstoggleview.cpp index 6f3bd20..e75647f 100644 --- a/src/actions/actionlayerstoggleview.cpp +++ b/src/actions/actionlayerstoggleview.cpp @@ -18,7 +18,7 @@ #include "drawing.h" -ActionLayersToggleView::ActionLayersToggleView(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility", +ActionLayersToggleView::ActionLayersToggleView(EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility", container, graphicView) { } @@ -29,11 +29,11 @@ ActionLayersToggleView::~ActionLayersToggleView() void ActionLayersToggleView::trigger() { - RS_DEBUG->print("toggle layer"); + DEBUG->print("toggle layer"); if (graphic != NULL) { - RS_Layer * layer = graphic->getActiveLayer(); + Layer * layer = graphic->getActiveLayer(); graphic->toggleLayer(layer); } diff --git a/src/actions/actionlayerstoggleview.h b/src/actions/actionlayerstoggleview.h index b283018..c3459e3 100644 --- a/src/actions/actionlayerstoggleview.h +++ b/src/actions/actionlayerstoggleview.h @@ -12,7 +12,7 @@ class ActionLayersToggleView: public ActionInterface { public: - ActionLayersToggleView(RS_EntityContainer & container, GraphicView & graphicView); + ActionLayersToggleView(EntityContainer & container, GraphicView & graphicView); ~ActionLayersToggleView(); virtual void init(int status = 0); diff --git a/src/actions/actionlibraryinsert.cpp b/src/actions/actionlibraryinsert.cpp index eee135b..3a433df 100644 --- a/src/actions/actionlibraryinsert.cpp +++ b/src/actions/actionlibraryinsert.cpp @@ -25,7 +25,7 @@ /** * Constructor. */ -ActionLibraryInsert::ActionLibraryInsert(RS_EntityContainer & container, GraphicView & graphicView): +ActionLibraryInsert::ActionLibraryInsert(EntityContainer & container, GraphicView & graphicView): ActionInterface("Library Insert", container, graphicView) { } @@ -59,12 +59,12 @@ void ActionLibraryInsert::setFile(const QString & file) data.file = file; if (!prev.open(file, RS2::FormatUnknown)) - RS_DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file)); + DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file)); } void ActionLibraryInsert::reset() { - /*data = RS_InsertData("", + /*data = InsertData("", Vector(0.0,0.0), Vector(1.0,1.0), 0.0, @@ -84,7 +84,7 @@ void ActionLibraryInsert::trigger() deletePreview(); clearPreview(); - RS_Creation creation(container, graphicView); + Creation creation(container, graphicView); creation.createLibraryInsert(data); graphicView->redraw(); @@ -106,7 +106,7 @@ void ActionLibraryInsert::mouseMoveEvent(QMouseEvent * e) // unit conversion: if (graphic) { - double uf = RS_Units::convert(1.0, prev.getUnit(), graphic->getUnit()); + double uf = Units::convert(1.0, prev.getUnit(), graphic->getUnit()); // preview->scale(data.insertionPoint, Vector(uf, uf)); } @@ -142,13 +142,13 @@ void ActionLibraryInsert::coordinateEvent(Vector * e) trigger(); } -void ActionLibraryInsert::commandEvent(RS_CommandEvent * e) +void ActionLibraryInsert::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -177,14 +177,14 @@ void ActionLibraryInsert::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) - data.angle = RS_Math::deg2rad(a); + data.angle = Math::deg2rad(a); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -192,14 +192,14 @@ void ActionLibraryInsert::commandEvent(RS_CommandEvent * e) case SetFactor: { bool ok; - double f = RS_Math::eval(c, &ok); + double f = Math::eval(c, &ok); if (ok == true) setFactor(f); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -231,14 +231,14 @@ void ActionLibraryInsert::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionLibraryInsert::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionLibraryInsert::updateMouseButtonHints() @@ -246,19 +246,19 @@ void ActionLibraryInsert::updateMouseButtonHints() switch (getStatus()) { case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), ""); break; case SetFactor: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -271,9 +271,9 @@ void ActionLibraryInsert::updateMouseCursor() void ActionLibraryInsert::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } double ActionLibraryInsert::getAngle() diff --git a/src/actions/actionlibraryinsert.h b/src/actions/actionlibraryinsert.h index 1b0b72f..34f4286 100644 --- a/src/actions/actionlibraryinsert.h +++ b/src/actions/actionlibraryinsert.h @@ -29,7 +29,7 @@ class ActionLibraryInsert: public ActionInterface }; public: - ActionLibraryInsert(RS_EntityContainer & container, GraphicView & graphicView); + ActionLibraryInsert(EntityContainer & container, GraphicView & graphicView); virtual ~ActionLibraryInsert(); virtual RS2::ActionType rtti(); @@ -39,7 +39,7 @@ class ActionLibraryInsert: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); @@ -54,7 +54,7 @@ class ActionLibraryInsert: public ActionInterface protected: Drawing prev; - RS_LibraryInsertData data; + LibraryInsertData data; /** Last status before entering option. */ Status lastStatus; diff --git a/src/actions/actionlockrelativezero.cpp b/src/actions/actionlockrelativezero.cpp index 46f915e..e804909 100644 --- a/src/actions/actionlockrelativezero.cpp +++ b/src/actions/actionlockrelativezero.cpp @@ -19,7 +19,7 @@ #include "graphicview.h" ActionLockRelativeZero::ActionLockRelativeZero( - RS_EntityContainer & container, GraphicView & graphicView, bool on): + EntityContainer & container, GraphicView & graphicView, bool on): ActionInterface("(Un-)lock the relative Zero", container, graphicView) { this->on = on; diff --git a/src/actions/actionlockrelativezero.h b/src/actions/actionlockrelativezero.h index 59e1d08..cbea0d5 100644 --- a/src/actions/actionlockrelativezero.h +++ b/src/actions/actionlockrelativezero.h @@ -14,7 +14,7 @@ class ActionLockRelativeZero: public ActionInterface { public: - ActionLockRelativeZero(RS_EntityContainer & container, GraphicView & graphicView, bool on); + ActionLockRelativeZero(EntityContainer & container, GraphicView & graphicView, bool on); ~ActionLockRelativeZero(); virtual void init(int status = 0); diff --git a/src/actions/actionmodifyattributes.cpp b/src/actions/actionmodifyattributes.cpp index dbc6451..fcbe0f5 100644 --- a/src/actions/actionmodifyattributes.cpp +++ b/src/actions/actionmodifyattributes.cpp @@ -22,7 +22,7 @@ #include "modification.h" ActionModifyAttributes::ActionModifyAttributes( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Change Attributes", container, graphicView) { } @@ -39,10 +39,10 @@ void ActionModifyAttributes::init(int status) void ActionModifyAttributes::trigger() { - RS_DEBUG->print("ActionModifyAttributes::trigger()"); + DEBUG->print("ActionModifyAttributes::trigger()"); - RS_AttributesData data; - data.pen = RS_Pen(); + AttributesData data; + data.pen = Pen(); data.layer = "0"; data.changeColor = false; data.changeLineType = false; @@ -51,10 +51,10 @@ void ActionModifyAttributes::trigger() if (graphic) { - if (RS_DIALOGFACTORY->requestAttributesDialog(data, + if (DIALOGFACTORY->requestAttributesDialog(data, *graphic->getLayerList())) { - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.changeAttributes(data); } } @@ -62,7 +62,7 @@ void ActionModifyAttributes::trigger() finish(); graphicView->killSelectActions(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyAttributes::updateMouseButtonHints() @@ -70,10 +70,10 @@ void ActionModifyAttributes::updateMouseButtonHints() switch (getStatus()) { //case Acknowledge: - //RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel")); + //DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel")); //break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -86,7 +86,7 @@ void ActionModifyAttributes::updateMouseCursor() void ActionModifyAttributes::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } diff --git a/src/actions/actionmodifyattributes.h b/src/actions/actionmodifyattributes.h index 58423fd..2e4a74b 100644 --- a/src/actions/actionmodifyattributes.h +++ b/src/actions/actionmodifyattributes.h @@ -21,7 +21,7 @@ class ActionModifyAttributes: public ActionInterface }; public: - ActionModifyAttributes(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyAttributes(EntityContainer & container, GraphicView & graphicView); ~ActionModifyAttributes(); virtual void init(int status = 0); diff --git a/src/actions/actionmodifybevel.cpp b/src/actions/actionmodifybevel.cpp index 9204272..5615cf1 100644 --- a/src/actions/actionmodifybevel.cpp +++ b/src/actions/actionmodifybevel.cpp @@ -21,7 +21,7 @@ #include "dialogfactory.h" #include "information.h" -ActionModifyBevel::ActionModifyBevel(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Bevel Entities", +ActionModifyBevel::ActionModifyBevel(EntityContainer & container, GraphicView & graphicView): ActionInterface("Bevel Entities", container, graphicView) { entity1 = NULL; @@ -49,28 +49,28 @@ void ActionModifyBevel::init(int status) void ActionModifyBevel::trigger() { - RS_DEBUG->print("ActionModifyBevel::trigger()"); + DEBUG->print("ActionModifyBevel::trigger()"); if (entity1 && entity1->isAtomic() && entity2 && entity2->isAtomic()) { - RS_Modification m(*container, graphicView); - m.bevel(coord1, (RS_AtomicEntity *)entity1, coord2, (RS_AtomicEntity *)entity2, data); + Modification m(*container, graphicView); + m.bevel(coord1, (AtomicEntity *)entity1, coord2, (AtomicEntity *)entity2, data); entity1 = NULL; entity2 = NULL; setStatus(SetEntity1); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyBevel::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyBevel::mouseMoveEvent begin"); + DEBUG->print("ActionModifyBevel::mouseMoveEvent begin"); Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e, RS2::ResolveAll); + Entity * se = catchEntity(e, RS2::ResolveAll); switch (getStatus()) { @@ -81,7 +81,7 @@ void ActionModifyBevel::mouseMoveEvent(QMouseEvent * e) case SetEntity2: - if (entity1 != NULL && RS_Information::isTrimmable(entity1)) + if (entity1 != NULL && Information::isTrimmable(entity1)) { coord2 = mouse; entity2 = se; @@ -92,7 +92,7 @@ void ActionModifyBevel::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyBevel::mouseMoveEvent end"); + DEBUG->print("ActionModifyBevel::mouseMoveEvent end"); } void ActionModifyBevel::mouseReleaseEvent(QMouseEvent * e) @@ -110,7 +110,7 @@ void ActionModifyBevel::mouseReleaseEvent(QMouseEvent * e) case SetEntity2: if (entity2 != NULL && entity2->isAtomic() - && RS_Information::isTrimmable(entity1, entity2)) + && Information::isTrimmable(entity1, entity2)) trigger(); break; @@ -126,13 +126,13 @@ void ActionModifyBevel::mouseReleaseEvent(QMouseEvent * e) } } -void ActionModifyBevel::commandEvent(RS_CommandEvent * e) +void ActionModifyBevel::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -166,32 +166,32 @@ void ActionModifyBevel::commandEvent(RS_CommandEvent * e) //lastStatus = (Status)getStatus(); //setStatus(SetTrim); data.trim = !data.trim; - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); } break; case SetLength1: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok == true) data.length1 = l; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetLength2: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok == true) data.length2 = l; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -202,10 +202,10 @@ void ActionModifyBevel::commandEvent(RS_CommandEvent * e) } else if (c==cmdNo.toLower() || c==cmdNo2) { data.trim = false; } else { - RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " + DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " "or 'No'")); } - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break;*/ @@ -238,14 +238,14 @@ void ActionModifyBevel::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionModifyBevel::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionModifyBevel::updateMouseButtonHints() @@ -253,31 +253,31 @@ void ActionModifyBevel::updateMouseButtonHints() switch (getStatus()) { case SetEntity1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select first entity"), tr("Cancel")); break; case SetEntity2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select second entity"), tr("Back")); break; case SetLength1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length 1:"), + DIALOGFACTORY->updateMouseWidget(tr("Enter length 1:"), tr("Back")); break; case SetLength2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length 2:"), + DIALOGFACTORY->updateMouseWidget(tr("Enter length 2:"), tr("Back")); break; /*case SetTrim: - RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), + DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), ""); break;*/ default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -289,7 +289,7 @@ void ActionModifyBevel::updateMouseCursor() void ActionModifyBevel::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } void ActionModifyBevel::setLength1(double l1) diff --git a/src/actions/actionmodifybevel.h b/src/actions/actionmodifybevel.h index d30a33e..02f68d8 100644 --- a/src/actions/actionmodifybevel.h +++ b/src/actions/actionmodifybevel.h @@ -25,7 +25,7 @@ class ActionModifyBevel: public ActionInterface }; public: - ActionModifyBevel(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyBevel(EntityContainer & container, GraphicView & graphicView); ~ActionModifyBevel(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionModifyBevel: public ActionInterface virtual void trigger(); virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -48,11 +48,11 @@ class ActionModifyBevel: public ActionInterface bool isTrimOn(); private: - RS_Entity * entity1; + Entity * entity1; Vector coord1; - RS_Entity * entity2; + Entity * entity2; Vector coord2; - RS_BevelData data; + BevelData data; /** Last status before entering angle. */ Status lastStatus; }; diff --git a/src/actions/actionmodifycut.cpp b/src/actions/actionmodifycut.cpp index b5ff8ce..228c3c7 100644 --- a/src/actions/actionmodifycut.cpp +++ b/src/actions/actionmodifycut.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "modification.h" -ActionModifyCut::ActionModifyCut(RS_EntityContainer & container, +ActionModifyCut::ActionModifyCut(EntityContainer & container, GraphicView & graphicView): ActionInterface("Cut Entity", container, graphicView) { @@ -40,7 +40,7 @@ void ActionModifyCut::init(int status) void ActionModifyCut::trigger() { - RS_DEBUG->print("ActionModifyCut::trigger()"); + DEBUG->print("ActionModifyCut::trigger()"); if (cutEntity != NULL && cutEntity->isAtomic() && cutCoord.valid && cutEntity->isPointOnEntity(cutCoord)) @@ -48,20 +48,20 @@ void ActionModifyCut::trigger() cutEntity->setHighlighted(false); graphicView->drawEntity(cutEntity); - RS_Modification m(*container, graphicView); - m.cut(cutCoord, (RS_AtomicEntity *)cutEntity); + Modification m(*container, graphicView); + m.cut(cutCoord, (AtomicEntity *)cutEntity); cutEntity = NULL; cutCoord = Vector(false); setStatus(ChooseCutEntity); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyCut::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyCut::mouseMoveEvent begin"); + DEBUG->print("ActionModifyCut::mouseMoveEvent begin"); switch (getStatus()) { @@ -76,7 +76,7 @@ void ActionModifyCut::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); + DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); } void ActionModifyCut::mouseReleaseEvent(QMouseEvent * e) @@ -89,13 +89,13 @@ void ActionModifyCut::mouseReleaseEvent(QMouseEvent * e) cutEntity = catchEntity(e); if (cutEntity == NULL) - RS_DIALOGFACTORY->commandMessage(tr("No Entity found.")); + DIALOGFACTORY->commandMessage(tr("No Entity found.")); else if (cutEntity->rtti() != RS2::EntityLine && cutEntity->rtti() != RS2::EntityArc && cutEntity->rtti() != RS2::EntityCircle && cutEntity->rtti() != RS2::EntityEllipse) - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Entity must be a line, arc, circle or ellipse.")); else { @@ -109,11 +109,11 @@ void ActionModifyCut::mouseReleaseEvent(QMouseEvent * e) cutCoord = snapPoint(e); if (cutEntity == NULL) - RS_DIALOGFACTORY->commandMessage(tr("No Entity found.")); + DIALOGFACTORY->commandMessage(tr("No Entity found.")); else if (!cutCoord.valid) - RS_DIALOGFACTORY->commandMessage(tr("Cutting point is invalid.")); + DIALOGFACTORY->commandMessage(tr("Cutting point is invalid.")); else if (!cutEntity->isPointOnEntity(cutCoord)) - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Cutting point is not on entity.")); else { @@ -144,17 +144,17 @@ void ActionModifyCut::updateMouseButtonHints() switch (getStatus()) { case ChooseCutEntity: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify entity to cut"), + DIALOGFACTORY->updateMouseWidget(tr("Specify entity to cut"), tr("Cancel")); break; case SetCutCoord: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify cutting point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify cutting point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -169,12 +169,12 @@ void ActionModifyCut::updateToolBar() switch (getStatus()) { case SetCutCoord: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; case ChooseCutEntity: default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifycut.h b/src/actions/actionmodifycut.h index e38ada2..156675a 100644 --- a/src/actions/actionmodifycut.h +++ b/src/actions/actionmodifycut.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to divide entities. @@ -24,7 +24,7 @@ class ActionModifyCut: public ActionInterface }; public: - ActionModifyCut(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyCut(EntityContainer & container, GraphicView & graphicView); ~ActionModifyCut(); virtual void init(int status = 0); @@ -36,7 +36,7 @@ class ActionModifyCut: public ActionInterface virtual void updateToolBar(); private: - RS_Entity * cutEntity; + Entity * cutEntity; Vector cutCoord; }; diff --git a/src/actions/actionmodifydelete.cpp b/src/actions/actionmodifydelete.cpp index 94ea10b..9e9ee6d 100644 --- a/src/actions/actionmodifydelete.cpp +++ b/src/actions/actionmodifydelete.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "modification.h" -ActionModifyDelete::ActionModifyDelete(RS_EntityContainer & container, +ActionModifyDelete::ActionModifyDelete(EntityContainer & container, GraphicView & graphicView): ActionInterface("Delete Entities", container, graphicView) { @@ -39,27 +39,27 @@ void ActionModifyDelete::init(int status) void ActionModifyDelete::trigger() { - RS_DEBUG->print("ActionModifyDelete::trigger()"); - RS_Modification m(*container, graphicView); + DEBUG->print("ActionModifyDelete::trigger()"); + Modification m(*container, graphicView); m.remove(); finish(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyDelete::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { //case Acknowledge: - // RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), + // DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), // tr("Cancel")); // break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -72,11 +72,11 @@ void ActionModifyDelete::updateMouseCursor() void ActionModifyDelete::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } } diff --git a/src/actions/actionmodifydelete.h b/src/actions/actionmodifydelete.h index 9c51dd1..6b873fc 100644 --- a/src/actions/actionmodifydelete.h +++ b/src/actions/actionmodifydelete.h @@ -20,7 +20,7 @@ class ActionModifyDelete: public ActionInterface }; public: - ActionModifyDelete(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyDelete(EntityContainer & container, GraphicView & graphicView); ~ActionModifyDelete(); virtual void init(int status = 0); diff --git a/src/actions/actionmodifydeletefree.cpp b/src/actions/actionmodifydeletefree.cpp index c372078..8a8c196 100644 --- a/src/actions/actionmodifydeletefree.cpp +++ b/src/actions/actionmodifydeletefree.cpp @@ -22,7 +22,7 @@ #include "polyline.h" #include "undo.h" -ActionModifyDeleteFree::ActionModifyDeleteFree(RS_EntityContainer & container, +ActionModifyDeleteFree::ActionModifyDeleteFree(EntityContainer & container, GraphicView & graphicView): ActionInterface("Delete Entities Freehand", container, graphicView) { @@ -45,7 +45,7 @@ void ActionModifyDeleteFree::trigger() { if (e1 && e2) { - RS_EntityContainer * parent = e2->getParent(); + EntityContainer * parent = e2->getParent(); if (parent) { @@ -56,13 +56,13 @@ void ActionModifyDeleteFree::trigger() #warning "!!! Old rendering path need upgrade !!!" #if 0 // deletes whole polyline on screen: - graphicView->deleteEntity((RS_Entity *)polyline); + graphicView->deleteEntity((Entity *)polyline); #endif // splits up the polyline in the container: - RS_Polyline * pl1; - RS_Polyline * pl2; - RS_Modification m(*container); + Polyline * pl1; + Polyline * pl2; + Modification m(*container); m.splitPolyline(*polyline, *e1, v1, *e2, v2, &pl1, &pl2); if (document) @@ -75,25 +75,25 @@ void ActionModifyDeleteFree::trigger() } // draws the new polylines on the screen: - graphicView->drawEntity((RS_Entity *)pl1); - graphicView->drawEntity((RS_Entity *)pl2); + graphicView->drawEntity((Entity *)pl1); + graphicView->drawEntity((Entity *)pl2); init(); - RS_DIALOGFACTORY->updateSelectionWidget( + DIALOGFACTORY->updateSelectionWidget( container->countSelected()); } else - RS_DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline.")); + DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline.")); } else - RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline")); + DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline")); } else - RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL")); + DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL")); } else - RS_DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL")); + DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL")); } void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e) @@ -111,25 +111,25 @@ void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e) if (e1) { - RS_EntityContainer * parent = e1->getParent(); + EntityContainer * parent = e1->getParent(); if (parent) { if (parent->rtti() == RS2::EntityPolyline) { - polyline = (RS_Polyline *)parent; + polyline = (Polyline *)parent; setStatus(1); } else - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Parent of first entity is not a polyline")); } else - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("Parent of first entity is NULL")); } else - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("First entity is NULL")); break; @@ -142,7 +142,7 @@ void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e) if (e2) trigger(); else - RS_DIALOGFACTORY->commandMessage(tr("Second entity is NULL")); + DIALOGFACTORY->commandMessage(tr("Second entity is NULL")); break; } @@ -154,17 +154,17 @@ void ActionModifyDeleteFree::updateMouseButtonHints() switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first break point " + DIALOGFACTORY->updateMouseWidget(tr("Specify first break point " "on a polyline"), tr("Cancel")); break; case 1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second break point " + DIALOGFACTORY->updateMouseWidget(tr("Specify second break point " "on the same polyline"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } diff --git a/src/actions/actionmodifydeletefree.h b/src/actions/actionmodifydeletefree.h index 694639d..94630c3 100644 --- a/src/actions/actionmodifydeletefree.h +++ b/src/actions/actionmodifydeletefree.h @@ -4,8 +4,8 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; -class RS_Polyline; +class Entity; +class Polyline; /** * This action class can handle user events to delete entities. @@ -16,7 +16,7 @@ class RS_Polyline; class ActionModifyDeleteFree: public ActionInterface { public: - ActionModifyDeleteFree(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyDeleteFree(EntityContainer & container, GraphicView & graphicView); ~ActionModifyDeleteFree(); virtual void init(int status = 0); @@ -25,10 +25,10 @@ class ActionModifyDeleteFree: public ActionInterface virtual void updateMouseButtonHints(); private: - RS_Polyline * polyline; - RS_Entity * e1; + Polyline * polyline; + Entity * e1; Vector v1; - RS_Entity * e2; + Entity * e2; Vector v2; }; diff --git a/src/actions/actionmodifydeletequick.cpp b/src/actions/actionmodifydeletequick.cpp index 5aa67c3..2be4009 100644 --- a/src/actions/actionmodifydeletequick.cpp +++ b/src/actions/actionmodifydeletequick.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" ActionModifyDeleteQuick::ActionModifyDeleteQuick( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Quick Delete Entities", container, graphicView) { en = NULL; @@ -36,12 +36,12 @@ ActionModifyDeleteQuick::~ActionModifyDeleteQuick() */ void ActionModifyDeleteQuick::trigger() { - RS_DEBUG->print("ActionModifyDeleteQuick::trigger()"); + DEBUG->print("ActionModifyDeleteQuick::trigger()"); if (en) { - RS_DEBUG->print("Entity found"); - RS_EntityContainer * parent = en->getParent(); + DEBUG->print("Entity found"); + EntityContainer * parent = en->getParent(); if (parent) { @@ -60,10 +60,10 @@ void ActionModifyDeleteQuick::trigger() } } - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } else - RS_DEBUG->print("ActionModifyDeleteQuick::mousePressEvent:" + DEBUG->print("ActionModifyDeleteQuick::mousePressEvent:" " Entity is NULL\n"); } @@ -83,12 +83,12 @@ void ActionModifyDeleteQuick::updateMouseButtonHints() switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entity to delete"), + DIALOGFACTORY->updateMouseWidget(tr("Pick entity to delete"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } diff --git a/src/actions/actionmodifydeletequick.h b/src/actions/actionmodifydeletequick.h index 981b54a..b70d33a 100644 --- a/src/actions/actionmodifydeletequick.h +++ b/src/actions/actionmodifydeletequick.h @@ -3,7 +3,7 @@ #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to delete entities @@ -15,7 +15,7 @@ class RS_Entity; class ActionModifyDeleteQuick: public ActionInterface { public: - ActionModifyDeleteQuick(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyDeleteQuick(EntityContainer & container, GraphicView & graphicView); ~ActionModifyDeleteQuick(); virtual void trigger(); @@ -24,7 +24,7 @@ class ActionModifyDeleteQuick: public ActionInterface virtual void updateMouseCursor(); private: - RS_Entity * en; + Entity * en; }; #endif // __ACTIONMODIFYDELETEQUICK_H__ diff --git a/src/actions/actionmodifyentity.cpp b/src/actions/actionmodifyentity.cpp index e4ca1bc..167cb6a 100644 --- a/src/actions/actionmodifyentity.cpp +++ b/src/actions/actionmodifyentity.cpp @@ -16,16 +16,16 @@ /* Program received signal SIGSEGV, Segmentation fault. -0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&) () +0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, Color const&) () (gdb) bt -#0 0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&) +#0 0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, Color const&) () -#1 0x080cf523 in PaintInterface::drawHandle(Vector const&, RS_Color const&, int) () -#2 0x0822d7e0 in GraphicView::drawEntity(RS_Entity*, double, bool) () -#3 0x0822d9a0 in GraphicView::deleteEntity(RS_Entity*) () +#1 0x080cf523 in PaintInterface::drawHandle(Vector const&, Color const&, int) () +#2 0x0822d7e0 in GraphicView::drawEntity(Entity*, double, bool) () +#3 0x0822d9a0 in GraphicView::deleteEntity(Entity*) () #4 0x081334dc in ActionModifyEntity::trigger() () #5 0x081336ef in ActionModifyEntity::mouseReleaseEvent(QMouseEvent*) () -#6 0x08089d2a in RS_EventHandler::mouseReleaseEvent(QMouseEvent*) () +#6 0x08089d2a in EventHandler::mouseReleaseEvent(QMouseEvent*) () #7 0x0822a482 in GraphicView::mouseReleaseEvent(QMouseEvent*) () #8 0x081eb00a in QG_GraphicView::mouseReleaseEvent(QMouseEvent*) () #9 0xb77063c1 in QWidget::event(QEvent*) () from /usr/lib/qt4/libQtGui.so.4 @@ -60,7 +60,7 @@ Program received signal SIGSEGV, Segmentation fault. #include "dialogfactory.h" #include "graphicview.h" -ActionModifyEntity::ActionModifyEntity(RS_EntityContainer & container, +ActionModifyEntity::ActionModifyEntity(EntityContainer & container, GraphicView & graphicView): ActionInterface("Modify Entity", container, graphicView), en(NULL) { @@ -75,13 +75,13 @@ void ActionModifyEntity::trigger() { if (!en) { - RS_DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n"); + DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n"); return; } - RS_Entity * clone = en->clone(); + Entity * clone = en->clone(); - if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone)) + if (DIALOGFACTORY->requestModifyEntityDialog(clone)) { container->addEntity(clone); #warning "!!! Old rendering path need upgrade !!!" @@ -102,7 +102,7 @@ void ActionModifyEntity::trigger() document->endUndoCycle(); } - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } else delete clone; diff --git a/src/actions/actionmodifyentity.h b/src/actions/actionmodifyentity.h index 991730c..1431123 100644 --- a/src/actions/actionmodifyentity.h +++ b/src/actions/actionmodifyentity.h @@ -3,7 +3,7 @@ #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to select entities. @@ -14,7 +14,7 @@ class RS_Entity; class ActionModifyEntity: public ActionInterface { public: - ActionModifyEntity(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyEntity(EntityContainer & container, GraphicView & graphicView); ~ActionModifyEntity(); virtual void trigger(); @@ -22,7 +22,7 @@ class ActionModifyEntity: public ActionInterface virtual void updateMouseCursor(); private: - RS_Entity * en; + Entity * en; }; #endif // __ACTIONMODIFYENTITY_H__ diff --git a/src/actions/actionmodifyexplodetext.cpp b/src/actions/actionmodifyexplodetext.cpp index bddf018..85bc2a4 100644 --- a/src/actions/actionmodifyexplodetext.cpp +++ b/src/actions/actionmodifyexplodetext.cpp @@ -21,7 +21,7 @@ /** * Constructor. */ -ActionModifyExplodeText::ActionModifyExplodeText(RS_EntityContainer & container, +ActionModifyExplodeText::ActionModifyExplodeText(EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Explode", container, graphicView) { @@ -46,6 +46,6 @@ void ActionModifyExplodeText::init(int status) void ActionModifyExplodeText::trigger() { - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.explodeTextIntoLetters(); } diff --git a/src/actions/actionmodifyexplodetext.h b/src/actions/actionmodifyexplodetext.h index ee496ed..bf4531d 100644 --- a/src/actions/actionmodifyexplodetext.h +++ b/src/actions/actionmodifyexplodetext.h @@ -13,7 +13,7 @@ class ActionModifyExplodeText: public ActionInterface { public: - ActionModifyExplodeText(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyExplodeText(EntityContainer & container, GraphicView & graphicView); ~ActionModifyExplodeText(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionmodifymirror.cpp b/src/actions/actionmodifymirror.cpp index 7c07178..786aeeb 100644 --- a/src/actions/actionmodifymirror.cpp +++ b/src/actions/actionmodifymirror.cpp @@ -20,7 +20,7 @@ #include "dialogfactory.h" #include "preview.h" -ActionModifyMirror::ActionModifyMirror(RS_EntityContainer & container, GraphicView & graphicView): +ActionModifyMirror::ActionModifyMirror(EntityContainer & container, GraphicView & graphicView): ActionInterface("Mirror Entities", container, graphicView) { } @@ -36,18 +36,18 @@ void ActionModifyMirror::init(int status) void ActionModifyMirror::trigger() { - RS_DEBUG->print("ActionModifyMirror::trigger()"); + DEBUG->print("ActionModifyMirror::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.mirror(data); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyMirror::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent begin"); + DEBUG->print("ActionModifyMirror::mouseMoveEvent begin"); if (getStatus() == SetAxisPoint1 || getStatus() == SetAxisPoint2) { @@ -69,7 +69,7 @@ void ActionModifyMirror::mouseMoveEvent(QMouseEvent * e) clearPreview(); /* preview->addSelectionFrom(*container); preview->mirror(axisPoint1, axisPoint2); - preview->addEntity(new RS_Line(preview,RS_LineData(axisPoint1, axisPoint2)));*/ + preview->addEntity(new Line(preview,LineData(axisPoint1, axisPoint2)));*/ drawPreview(); } break; @@ -79,7 +79,7 @@ void ActionModifyMirror::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent end"); + DEBUG->print("ActionModifyMirror::mouseMoveEvent end"); } void ActionModifyMirror::mouseReleaseEvent(QMouseEvent * e) @@ -117,9 +117,9 @@ void ActionModifyMirror::coordinateEvent(Vector * e) setStatus(ShowDialog); graphicView->moveRelativeZero(mouse); - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { - if (RS_DIALOGFACTORY->requestMirrorDialog(data)) + if (DIALOGFACTORY->requestMirrorDialog(data)) { data.axisPoint1 = axisPoint1; data.axisPoint2 = axisPoint2; @@ -138,28 +138,28 @@ void ActionModifyMirror::coordinateEvent(Vector * e) void ActionModifyMirror::updateMouseButtonHints() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { switch (getStatus()) { /*case Select: - RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"), + DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"), tr("Cancel")); break;*/ case SetAxisPoint1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify first point of mirror line"), tr("Cancel")); break; case SetAxisPoint2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify second point of mirror line"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -172,17 +172,17 @@ void ActionModifyMirror::updateMouseCursor() void ActionModifyMirror::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetAxisPoint1: case SetAxisPoint2: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifymirror.h b/src/actions/actionmodifymirror.h index 12c11b4..d5441df 100644 --- a/src/actions/actionmodifymirror.h +++ b/src/actions/actionmodifymirror.h @@ -24,7 +24,7 @@ class ActionModifyMirror: public ActionInterface }; public: - ActionModifyMirror(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyMirror(EntityContainer & container, GraphicView & graphicView); ~ActionModifyMirror(); virtual void init(int status = 0); @@ -37,7 +37,7 @@ class ActionModifyMirror: public ActionInterface virtual void updateToolBar(); private: - RS_MirrorData data; + MirrorData data; Vector axisPoint1; Vector axisPoint2; }; diff --git a/src/actions/actionmodifymove.cpp b/src/actions/actionmodifymove.cpp index 9943bcf..9801c79 100644 --- a/src/actions/actionmodifymove.cpp +++ b/src/actions/actionmodifymove.cpp @@ -20,7 +20,7 @@ #include "dialogfactory.h" #include "preview.h" -ActionModifyMove::ActionModifyMove(RS_EntityContainer & container, +ActionModifyMove::ActionModifyMove(EntityContainer & container, GraphicView & graphicView): ActionInterface("Move Entities", container, graphicView) { @@ -37,17 +37,17 @@ void ActionModifyMove::init(int status) void ActionModifyMove::trigger() { - RS_DEBUG->print("ActionModifyMove::trigger()"); + DEBUG->print("ActionModifyMove::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.move(data); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyMove::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyMove::mouseMoveEvent begin"); + DEBUG->print("ActionModifyMove::mouseMoveEvent begin"); if (getStatus() == SetReferencePoint || getStatus() == SetTargetPoint) @@ -79,7 +79,7 @@ void ActionModifyMove::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyMove::mouseMoveEvent end"); + DEBUG->print("ActionModifyMove::mouseMoveEvent end"); } void ActionModifyMove::mouseReleaseEvent(QMouseEvent * e) @@ -117,7 +117,7 @@ void ActionModifyMove::coordinateEvent(Vector * e) graphicView->moveRelativeZero(targetPoint); setStatus(ShowDialog); - if (RS_DIALOGFACTORY->requestMoveDialog(data)) + if (DIALOGFACTORY->requestMoveDialog(data)) { data.offset = targetPoint - referencePoint; trigger(); @@ -135,21 +135,21 @@ void ActionModifyMove::updateMouseButtonHints() switch (getStatus()) { /*case Select: - RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"), + DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"), tr("Cancel")); break;*/ case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -164,15 +164,15 @@ void ActionModifyMove::updateToolBar() switch (getStatus()) { /*case Select: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); break;*/ case SetReferencePoint: case SetTargetPoint: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifymove.h b/src/actions/actionmodifymove.h index 87396bf..eb1dbc3 100644 --- a/src/actions/actionmodifymove.h +++ b/src/actions/actionmodifymove.h @@ -24,7 +24,7 @@ class ActionModifyMove: public ActionInterface }; public: - ActionModifyMove(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyMove(EntityContainer & container, GraphicView & graphicView); ~ActionModifyMove(); virtual void init(int status = 0); @@ -37,7 +37,7 @@ class ActionModifyMove: public ActionInterface virtual void updateToolBar(); private: - RS_MoveData data; + MoveData data; Vector referencePoint; Vector targetPoint; }; diff --git a/src/actions/actionmodifymoverotate.cpp b/src/actions/actionmodifymoverotate.cpp index b8dce06..9185d6c 100644 --- a/src/actions/actionmodifymoverotate.cpp +++ b/src/actions/actionmodifymoverotate.cpp @@ -22,7 +22,7 @@ #include "preview.h" ActionModifyMoveRotate::ActionModifyMoveRotate( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Move and Rotate Entities", container, graphicView) { } @@ -43,19 +43,19 @@ void ActionModifyMoveRotate::init(int status) void ActionModifyMoveRotate::trigger() { - RS_DEBUG->print("ActionModifyMoveRotate::trigger()"); + DEBUG->print("ActionModifyMoveRotate::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.moveRotate(data); finish(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyMoveRotate::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent begin"); + DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent begin"); if (getStatus() == SetReferencePoint || getStatus() == SetTargetPoint) { @@ -88,7 +88,7 @@ void ActionModifyMoveRotate::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent end"); + DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent end"); } void ActionModifyMoveRotate::mouseReleaseEvent(QMouseEvent * e) @@ -126,7 +126,7 @@ void ActionModifyMoveRotate::coordinateEvent(Vector * e) setStatus(ShowDialog); data.offset = targetPoint - data.referencePoint; - if (RS_DIALOGFACTORY->requestMoveRotateDialog(data)) + if (DIALOGFACTORY->requestMoveRotateDialog(data)) trigger(); //finish(); break; @@ -136,13 +136,13 @@ void ActionModifyMoveRotate::coordinateEvent(Vector * e) } } -void ActionModifyMoveRotate::commandEvent(RS_CommandEvent * e) +void ActionModifyMoveRotate::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -166,14 +166,14 @@ void ActionModifyMoveRotate::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - data.angle = RS_Math::deg2rad(a); + data.angle = Math::deg2rad(a); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -204,7 +204,7 @@ void ActionModifyMoveRotate::showOptions() ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionModifyMoveRotate::hideOptions() @@ -213,7 +213,7 @@ void ActionModifyMoveRotate::hideOptions() ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionModifyMoveRotate::updateMouseButtonHints() @@ -221,19 +221,19 @@ void ActionModifyMoveRotate::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter rotation angle:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter rotation angle:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -249,11 +249,11 @@ void ActionModifyMoveRotate::updateToolBar() { case SetReferencePoint: case SetTargetPoint: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifymoverotate.h b/src/actions/actionmodifymoverotate.h index 2fc2c9d..7d24bbb 100644 --- a/src/actions/actionmodifymoverotate.h +++ b/src/actions/actionmodifymoverotate.h @@ -26,7 +26,7 @@ class ActionModifyMoveRotate: public ActionInterface }; public: - ActionModifyMoveRotate(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyMoveRotate(EntityContainer & container, GraphicView & graphicView); ~ActionModifyMoveRotate(); virtual RS2::ActionType rtti(); @@ -35,7 +35,7 @@ class ActionModifyMoveRotate: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -46,7 +46,7 @@ class ActionModifyMoveRotate: public ActionInterface double getAngle(); private: - RS_MoveRotateData data; + MoveRotateData data; Vector targetPoint; /** Last status before entering angle. */ diff --git a/src/actions/actionmodifyrotate.cpp b/src/actions/actionmodifyrotate.cpp index d784c2b..5f616f5 100644 --- a/src/actions/actionmodifyrotate.cpp +++ b/src/actions/actionmodifyrotate.cpp @@ -19,7 +19,7 @@ #include "debug.h" #include "dialogfactory.h" -ActionModifyRotate::ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView): +ActionModifyRotate::ActionModifyRotate(EntityContainer & container, GraphicView & graphicView): ActionInterface("Rotate Entities", container, graphicView) { @@ -36,17 +36,17 @@ void ActionModifyRotate::init(int status) void ActionModifyRotate::trigger() { - RS_DEBUG->print("ActionModifyRotate::trigger()"); + DEBUG->print("ActionModifyRotate::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.rotate(data); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent begin"); + DEBUG->print("ActionModifyRotate::mouseMoveEvent begin"); if (getStatus() == SetReferencePoint) { @@ -63,7 +63,7 @@ void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent end"); + DEBUG->print("ActionModifyRotate::mouseMoveEvent end"); } void ActionModifyRotate::mouseReleaseEvent(QMouseEvent * e) @@ -94,7 +94,7 @@ void ActionModifyRotate::coordinateEvent(Vector * e) referencePoint = pos; setStatus(ShowDialog); - if (RS_DIALOGFACTORY->requestRotateDialog(data)) + if (DIALOGFACTORY->requestRotateDialog(data)) { data.center = referencePoint; trigger(); @@ -112,12 +112,12 @@ void ActionModifyRotate::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -132,11 +132,11 @@ void ActionModifyRotate::updateToolBar() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifyrotate.h b/src/actions/actionmodifyrotate.h index a3e2a21..e713b0d 100644 --- a/src/actions/actionmodifyrotate.h +++ b/src/actions/actionmodifyrotate.h @@ -23,7 +23,7 @@ class ActionModifyRotate: public ActionInterface }; public: - ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyRotate(EntityContainer & container, GraphicView & graphicView); ~ActionModifyRotate(); virtual void init(int status = 0); @@ -36,7 +36,7 @@ class ActionModifyRotate: public ActionInterface virtual void updateToolBar(); private: - RS_RotateData data; + RotateData data; Vector referencePoint; Vector targetPoint; }; diff --git a/src/actions/actionmodifyrotate2.cpp b/src/actions/actionmodifyrotate2.cpp index 892aa23..d12293c 100644 --- a/src/actions/actionmodifyrotate2.cpp +++ b/src/actions/actionmodifyrotate2.cpp @@ -20,7 +20,7 @@ #include "dialogfactory.h" ActionModifyRotate2::ActionModifyRotate2( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Rotate Entities around two centers", container, graphicView) { } @@ -36,19 +36,19 @@ void ActionModifyRotate2::init(int status) void ActionModifyRotate2::trigger() { - RS_DEBUG->print("ActionModifyRotate2::trigger()"); + DEBUG->print("ActionModifyRotate2::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.rotate2(data); finish(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin"); + DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin"); if (getStatus() == SetReferencePoint1 || getStatus() == SetReferencePoint2) { @@ -72,7 +72,7 @@ void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent end"); + DEBUG->print("ActionModifyRotate2::mouseMoveEvent end"); } void ActionModifyRotate2::mouseReleaseEvent(QMouseEvent * e) @@ -108,7 +108,7 @@ void ActionModifyRotate2::coordinateEvent(Vector * e) data.center2 = pos; setStatus(ShowDialog); - if (RS_DIALOGFACTORY->requestRotate2Dialog(data)) + if (DIALOGFACTORY->requestRotate2Dialog(data)) trigger(); //finish(); break; @@ -118,7 +118,7 @@ void ActionModifyRotate2::coordinateEvent(Vector * e) } } -void ActionModifyRotate2::commandEvent(RS_CommandEvent * /*e*/) +void ActionModifyRotate2::commandEvent(CommandEvent * /*e*/) { } @@ -133,17 +133,17 @@ void ActionModifyRotate2::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"), tr("Cancel")); break; case SetReferencePoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -159,11 +159,11 @@ void ActionModifyRotate2::updateToolBar() { case SetReferencePoint1: case SetReferencePoint2: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifyrotate2.h b/src/actions/actionmodifyrotate2.h index 94306af..dfaa824 100644 --- a/src/actions/actionmodifyrotate2.h +++ b/src/actions/actionmodifyrotate2.h @@ -24,7 +24,7 @@ class ActionModifyRotate2: public ActionInterface }; public: - ActionModifyRotate2(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyRotate2(EntityContainer & container, GraphicView & graphicView); ~ActionModifyRotate2(); virtual void init(int status = 0); @@ -32,14 +32,14 @@ class ActionModifyRotate2: public ActionInterface virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void updateMouseButtonHints(); virtual void updateMouseCursor(); virtual void updateToolBar(); private: - RS_Rotate2Data data; + Rotate2Data data; }; #endif // __ACTIONMODIFYROTATE2_H__ diff --git a/src/actions/actionmodifyround.cpp b/src/actions/actionmodifyround.cpp index 1ed1a79..38fd7c0 100644 --- a/src/actions/actionmodifyround.cpp +++ b/src/actions/actionmodifyround.cpp @@ -22,7 +22,7 @@ #include "information.h" #include "preview.h" -ActionModifyRound::ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView): +ActionModifyRound::ActionModifyRound(EntityContainer & container, GraphicView & graphicView): ActionInterface("Round Entities", container, graphicView) { entity1 = NULL; @@ -50,16 +50,16 @@ void ActionModifyRound::init(int status) void ActionModifyRound::trigger() { - RS_DEBUG->print("ActionModifyRound::trigger()"); + DEBUG->print("ActionModifyRound::trigger()"); if (entity1 != NULL && entity1->isAtomic() && entity2 != NULL && entity2->isAtomic()) { deletePreview(); - RS_Modification m(*container, graphicView); - m.round(coord2, coord1, (RS_AtomicEntity *)entity1, coord2, - (RS_AtomicEntity *)entity2, data); + Modification m(*container, graphicView); + m.round(coord2, coord1, (AtomicEntity *)entity1, coord2, + (AtomicEntity *)entity2, data); coord1 = Vector(false); entity1 = NULL; @@ -69,17 +69,17 @@ void ActionModifyRound::trigger() clearPreview(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyRound::mouseMoveEvent begin"); + DEBUG->print("ActionModifyRound::mouseMoveEvent begin"); Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e, RS2::ResolveAll); + Entity * se = catchEntity(e, RS2::ResolveAll); switch (getStatus()) { @@ -93,12 +93,12 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) coord2 = mouse; if (entity1 != NULL && entity2 != NULL && entity2->isAtomic() - && RS_Information::isTrimmable(entity1, entity2)) + && Information::isTrimmable(entity1, entity2)) { deletePreview(); clearPreview(); -/* RS_Entity * tmp1 = entity1->clone(); - RS_Entity * tmp2 = entity2->clone();*/ +/* Entity * tmp1 = entity1->clone(); + Entity * tmp2 = entity2->clone();*/ // tmp1->reparent(preview); // tmp2->reparent(preview); // preview->addEntity(tmp1); @@ -106,9 +106,9 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) /* bool trim = data.trim; data.trim = false; - RS_Modification m(*preview, NULL, false); - m.round(coord2, coord1, (RS_AtomicEntity *)tmp1, coord2, - (RS_AtomicEntity *)tmp2, data); + Modification m(*preview, NULL, false); + m.round(coord2, coord1, (AtomicEntity *)tmp1, coord2, + (AtomicEntity *)tmp2, data); data.trim = trim; preview->removeEntity(tmp1); @@ -121,13 +121,13 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyRound::mouseMoveEvent end"); + DEBUG->print("ActionModifyRound::mouseMoveEvent end"); } void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) { Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e, RS2::ResolveAll); + Entity * se = catchEntity(e, RS2::ResolveAll); if (e->button() == Qt::LeftButton) { @@ -138,7 +138,7 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) coord1 = mouse; if (entity1 != NULL && entity1->isAtomic() - && RS_Information::isTrimmable(entity1)) + && Information::isTrimmable(entity1)) setStatus(SetEntity2); break; @@ -147,7 +147,7 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) coord2 = mouse; if (entity2 != NULL && entity2->isAtomic() - && RS_Information::isTrimmable(entity1, entity2)) + && Information::isTrimmable(entity1, entity2)) //setStatus(ChooseRounding); trigger(); break; @@ -164,14 +164,14 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) } } -void ActionModifyRound::commandEvent(RS_CommandEvent * e) +void ActionModifyRound::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -199,22 +199,22 @@ void ActionModifyRound::commandEvent(RS_CommandEvent * e) */ data.trim = !data.trim; - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); } break; case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok == true) data.radius = r; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -225,10 +225,10 @@ void ActionModifyRound::commandEvent(RS_CommandEvent * e) } else if (c==cmdNo.toLower() || c==cmdNo2) { data.trim = false; } else { - RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " + DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " "or 'No'")); } - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break;*/ @@ -260,45 +260,45 @@ void ActionModifyRound::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); } void ActionModifyRound::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); } void ActionModifyRound::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetEntity1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"), + DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"), tr("Back")); break; case SetEntity2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"), + DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"), tr("Back")); break; case SetRadius: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"), + DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"), tr("Cancel")); break; /*case SetTrim: - RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), + DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), ""); break;*/ default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -311,8 +311,8 @@ void ActionModifyRound::updateMouseCursor() void ActionModifyRound::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } void ActionModifyRound::setRadius(double r) diff --git a/src/actions/actionmodifyround.h b/src/actions/actionmodifyround.h index 1c95482..b7603ab 100644 --- a/src/actions/actionmodifyround.h +++ b/src/actions/actionmodifyround.h @@ -5,7 +5,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to round corners. @@ -27,7 +27,7 @@ class ActionModifyRound: public ActionInterface }; public: - ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyRound(EntityContainer & container, GraphicView & graphicView); ~ActionModifyRound(); virtual RS2::ActionType rtti(); @@ -35,7 +35,7 @@ class ActionModifyRound: public ActionInterface virtual void trigger(); virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -49,10 +49,10 @@ class ActionModifyRound: public ActionInterface private: Vector coord1; - RS_Entity * entity1; + Entity * entity1; Vector coord2; - RS_Entity * entity2; - RS_RoundData data; + Entity * entity2; + RoundData data; /** Last status before entering angle. */ Status lastStatus; }; diff --git a/src/actions/actionmodifyscale.cpp b/src/actions/actionmodifyscale.cpp index 8f04c5a..d1aadc9 100644 --- a/src/actions/actionmodifyscale.cpp +++ b/src/actions/actionmodifyscale.cpp @@ -19,7 +19,7 @@ #include "debug.h" #include "dialogfactory.h" -ActionModifyScale::ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView): +ActionModifyScale::ActionModifyScale(EntityContainer & container, GraphicView & graphicView): ActionInterface("Scale Entities", container, graphicView) { } @@ -35,17 +35,17 @@ void ActionModifyScale::init(int status) void ActionModifyScale::trigger() { - RS_DEBUG->print("ActionModifyScale::trigger()"); + DEBUG->print("ActionModifyScale::trigger()"); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.scale(data); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyScale::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyScale::mouseMoveEvent begin"); + DEBUG->print("ActionModifyScale::mouseMoveEvent begin"); if (getStatus() == SetReferencePoint) { @@ -62,7 +62,7 @@ void ActionModifyScale::mouseMoveEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionModifyScale::mouseMoveEvent end"); + DEBUG->print("ActionModifyScale::mouseMoveEvent end"); } void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e) @@ -76,7 +76,7 @@ void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e) case SetReferencePoint: setStatus(ShowDialog); - if (RS_DIALOGFACTORY->requestScaleDialog(data)) + if (DIALOGFACTORY->requestScaleDialog(data)) { data.referencePoint = referencePoint; trigger(); @@ -101,11 +101,11 @@ void ActionModifyScale::updateMouseButtonHints() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -120,11 +120,11 @@ void ActionModifyScale::updateToolBar() switch (getStatus()) { case SetReferencePoint: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); break; default: - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); break; } } diff --git a/src/actions/actionmodifyscale.h b/src/actions/actionmodifyscale.h index 0241abf..fcac54a 100644 --- a/src/actions/actionmodifyscale.h +++ b/src/actions/actionmodifyscale.h @@ -23,7 +23,7 @@ class ActionModifyScale: public ActionInterface }; public: - ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyScale(EntityContainer & container, GraphicView & graphicView); ~ActionModifyScale(); virtual void init(int status = 0); @@ -35,7 +35,7 @@ class ActionModifyScale: public ActionInterface virtual void updateToolBar(); private: - RS_ScaleData data; + ScaleData data; Vector referencePoint; Vector targetPoint; }; diff --git a/src/actions/actionmodifystretch.cpp b/src/actions/actionmodifystretch.cpp index 3dff16a..e1465a7 100644 --- a/src/actions/actionmodifystretch.cpp +++ b/src/actions/actionmodifystretch.cpp @@ -21,7 +21,7 @@ #include "modification.h" #include "preview.h" -ActionModifyStretch::ActionModifyStretch(RS_EntityContainer & container, +ActionModifyStretch::ActionModifyStretch(EntityContainer & container, GraphicView & graphicView): ActionInterface("Stretch Entities", container, graphicView) { @@ -42,26 +42,26 @@ void ActionModifyStretch::init(int status) void ActionModifyStretch::trigger() { - RS_DEBUG->print("ActionModifyStretch::trigger()"); + DEBUG->print("ActionModifyStretch::trigger()"); deletePreview(); clearPreview(); deleteSnapper(); - RS_Modification m(*container, graphicView); + Modification m(*container, graphicView); m.stretch(firstCorner, secondCorner, targetPoint - referencePoint); drawSnapper(); setStatus(SetFirstCorner); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } void ActionModifyStretch::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyStretch::mouseMoveEvent begin"); + DEBUG->print("ActionModifyStretch::mouseMoveEvent begin"); Vector mouse = snapPoint(e); @@ -77,16 +77,16 @@ void ActionModifyStretch::mouseMoveEvent(QMouseEvent * e) deletePreview(); clearPreview(); /* preview->addEntity( - new RS_Line(preview, RS_LineData(Vector(firstCorner.x, firstCorner.y), + new Line(preview, LineData(Vector(firstCorner.x, firstCorner.y), Vector(secondCorner.x, firstCorner.y)))); preview->addEntity( - new RS_Line(preview, RS_LineData(Vector(secondCorner.x, firstCorner.y), + new Line(preview, LineData(Vector(secondCorner.x, firstCorner.y), Vector(secondCorner.x, secondCorner.y)))); preview->addEntity( - new RS_Line(preview, RS_LineData(Vector(secondCorner.x, secondCorner.y), + new Line(preview, LineData(Vector(secondCorner.x, secondCorner.y), Vector(firstCorner.x, secondCorner.y)))); preview->addEntity( - new RS_Line(preview, RS_LineData(Vector(firstCorner.x, secondCorner.y), + new Line(preview, LineData(Vector(firstCorner.x, secondCorner.y), Vector(firstCorner.x, firstCorner.y))));*/ drawPreview(); } @@ -114,7 +114,7 @@ void ActionModifyStretch::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyStretch::mouseMoveEvent end"); + DEBUG->print("ActionModifyStretch::mouseMoveEvent end"); } void ActionModifyStretch::mouseReleaseEvent(QMouseEvent * e) @@ -176,27 +176,27 @@ void ActionModifyStretch::updateMouseButtonHints() switch (getStatus()) { case SetFirstCorner: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), + DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel")); break; case SetSecondCorner: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), + DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back")); break; case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Back")); break; case SetTargetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), + DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -209,9 +209,9 @@ void ActionModifyStretch::updateMouseCursor() void ActionModifyStretch::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } diff --git a/src/actions/actionmodifystretch.h b/src/actions/actionmodifystretch.h index 6b96d28..f5d953b 100644 --- a/src/actions/actionmodifystretch.h +++ b/src/actions/actionmodifystretch.h @@ -24,7 +24,7 @@ class ActionModifyStretch: public ActionInterface }; public: - ActionModifyStretch(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyStretch(EntityContainer & container, GraphicView & graphicView); ~ActionModifyStretch(); virtual void init(int status = 0); diff --git a/src/actions/actionmodifytrim.cpp b/src/actions/actionmodifytrim.cpp index 0e66a71..efbc6a0 100644 --- a/src/actions/actionmodifytrim.cpp +++ b/src/actions/actionmodifytrim.cpp @@ -23,7 +23,7 @@ /** * @param both Trim both entities. */ -ActionModifyTrim::ActionModifyTrim(RS_EntityContainer & container, +ActionModifyTrim::ActionModifyTrim(EntityContainer & container, GraphicView & graphicView, bool both): ActionInterface("Trim Entity", container, graphicView) { @@ -48,12 +48,12 @@ void ActionModifyTrim::init(int status) void ActionModifyTrim::trigger() { - RS_DEBUG->print("ActionModifyTrim::trigger()"); + DEBUG->print("ActionModifyTrim::trigger()"); if (trimEntity && trimEntity->isAtomic() && limitEntity) { - RS_Modification m(*container, graphicView); - m.trim(trimCoord, (RS_AtomicEntity *)trimEntity, + Modification m(*container, graphicView); + m.trim(trimCoord, (AtomicEntity *)trimEntity, limitCoord, limitEntity, both); trimEntity = NULL; @@ -67,16 +67,16 @@ void ActionModifyTrim::trigger() else setStatus(ChooseTrimEntity); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyTrim::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent begin"); + DEBUG->print("ActionModifyTrim::mouseMoveEvent begin"); Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); switch (getStatus()) { @@ -94,7 +94,7 @@ void ActionModifyTrim::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); + DEBUG->print("ActionModifyTrim::mouseMoveEvent end"); } void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) @@ -102,7 +102,7 @@ void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e) if (e->button() == Qt::LeftButton) { Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); switch (getStatus()) { @@ -151,25 +151,25 @@ void ActionModifyTrim::updateMouseButtonHints() case ChooseLimitEntity: if (both) - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"), tr("Cancel")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"), tr("Back")); break; case ChooseTrimEntity: if (both) - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"), tr("Cancel")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"), + DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -181,6 +181,6 @@ void ActionModifyTrim::updateMouseCursor() void ActionModifyTrim::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } diff --git a/src/actions/actionmodifytrim.h b/src/actions/actionmodifytrim.h index e91af17..292d339 100644 --- a/src/actions/actionmodifytrim.h +++ b/src/actions/actionmodifytrim.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to trim entities. @@ -24,7 +24,7 @@ class ActionModifyTrim: public ActionInterface }; public: - ActionModifyTrim(RS_EntityContainer & container, GraphicView & graphicView, bool both = false); + ActionModifyTrim(EntityContainer & container, GraphicView & graphicView, bool both = false); ~ActionModifyTrim(); virtual void init(int status = 0); @@ -36,9 +36,9 @@ class ActionModifyTrim: public ActionInterface virtual void updateToolBar(); private: - RS_Entity * limitEntity; + Entity * limitEntity; Vector limitCoord; - RS_Entity * trimEntity; + Entity * trimEntity; Vector trimCoord; bool both; }; diff --git a/src/actions/actionmodifytrimamount.cpp b/src/actions/actionmodifytrimamount.cpp index a343678..83fbbe0 100644 --- a/src/actions/actionmodifytrimamount.cpp +++ b/src/actions/actionmodifytrimamount.cpp @@ -22,7 +22,7 @@ #include "modification.h" ActionModifyTrimAmount::ActionModifyTrimAmount( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Trim Entity by a given amount", container, graphicView) { @@ -50,17 +50,17 @@ void ActionModifyTrimAmount::init(int status) void ActionModifyTrimAmount::trigger() { - RS_DEBUG->print("ActionModifyTrimAmount::trigger()"); + DEBUG->print("ActionModifyTrimAmount::trigger()"); if (trimEntity != NULL && trimEntity->isAtomic()) { - RS_Modification m(*container, graphicView); - m.trimAmount(trimCoord, (RS_AtomicEntity *)trimEntity, distance); + Modification m(*container, graphicView); + m.trimAmount(trimCoord, (AtomicEntity *)trimEntity, distance); trimEntity = NULL; setStatus(ChooseTrimEntity); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } @@ -80,14 +80,14 @@ void ActionModifyTrimAmount::mouseReleaseEvent(QMouseEvent * e) else { if (trimEntity == NULL) - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("No entity found. ")); else if (trimEntity->rtti() == RS2::EntityInsert) - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("The chosen Entity is in a block. " "Please edit the block.")); else - RS_DIALOGFACTORY->commandMessage( + DIALOGFACTORY->commandMessage( tr("The chosen Entity is not an atomic entity " "or cannot be trimmed.")); } @@ -104,13 +104,13 @@ void ActionModifyTrimAmount::mouseReleaseEvent(QMouseEvent * e) } } -void ActionModifyTrimAmount::commandEvent(RS_CommandEvent * e) +void ActionModifyTrimAmount::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -119,13 +119,13 @@ void ActionModifyTrimAmount::commandEvent(RS_CommandEvent * e) { case ChooseTrimEntity: { bool ok; - double d = RS_Math::eval(c, &ok); + double d = Math::eval(c, &ok); if (ok == true) distance = d; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(ChooseTrimEntity); } break; @@ -155,14 +155,14 @@ void ActionModifyTrimAmount::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionModifyTrimAmount::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionModifyTrimAmount::updateMouseButtonHints() @@ -170,12 +170,12 @@ void ActionModifyTrimAmount::updateMouseButtonHints() switch (getStatus()) { case ChooseTrimEntity: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Select entity to trim or enter distance:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -187,7 +187,7 @@ void ActionModifyTrimAmount::updateMouseCursor() void ActionModifyTrimAmount::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } double ActionModifyTrimAmount::getDistance() diff --git a/src/actions/actionmodifytrimamount.h b/src/actions/actionmodifytrimamount.h index 0f3db59..93c45a7 100644 --- a/src/actions/actionmodifytrimamount.h +++ b/src/actions/actionmodifytrimamount.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to trim entities by a given @@ -24,7 +24,7 @@ class ActionModifyTrimAmount: public ActionInterface }; public: - ActionModifyTrimAmount(RS_EntityContainer & container, GraphicView & graphicView); + ActionModifyTrimAmount(EntityContainer & container, GraphicView & graphicView); ~ActionModifyTrimAmount(); virtual RS2::ActionType rtti(); @@ -32,7 +32,7 @@ class ActionModifyTrimAmount: public ActionInterface virtual void trigger(); //virtual void mouseMoveEvent(QMouseEvent* e); virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void hideOptions(); virtual void showOptions(); @@ -43,7 +43,7 @@ class ActionModifyTrimAmount: public ActionInterface void setDistance(double d); private: - RS_Entity * trimEntity; + Entity * trimEntity; Vector trimCoord; double distance; }; diff --git a/src/actions/actionoptionsdrawing.cpp b/src/actions/actionoptionsdrawing.cpp index ec39d03..da298ba 100644 --- a/src/actions/actionoptionsdrawing.cpp +++ b/src/actions/actionoptionsdrawing.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "graphicview.h" -ActionOptionsDrawing::ActionOptionsDrawing(RS_EntityContainer & container, GraphicView & graphicView): +ActionOptionsDrawing::ActionOptionsDrawing(EntityContainer & container, GraphicView & graphicView): ActionInterface("Drawing Options", container, graphicView) { } @@ -43,8 +43,8 @@ void ActionOptionsDrawing::trigger() { if (graphic) { - RS_DIALOGFACTORY->requestOptionsDrawingDialog(*graphic); - RS_DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true); + DIALOGFACTORY->requestOptionsDrawingDialog(*graphic); + DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true); graphicView->updateGrid(); graphicView->redraw(); } diff --git a/src/actions/actionoptionsdrawing.h b/src/actions/actionoptionsdrawing.h index f068db3..6860204 100644 --- a/src/actions/actionoptionsdrawing.h +++ b/src/actions/actionoptionsdrawing.h @@ -13,7 +13,7 @@ class ActionOptionsDrawing: public ActionInterface { public: - ActionOptionsDrawing(RS_EntityContainer & container, GraphicView & graphicView); + ActionOptionsDrawing(EntityContainer & container, GraphicView & graphicView); ~ActionOptionsDrawing(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionprintpreview.cpp b/src/actions/actionprintpreview.cpp index d43e891..ada1c13 100644 --- a/src/actions/actionprintpreview.cpp +++ b/src/actions/actionprintpreview.cpp @@ -23,7 +23,7 @@ /** * Constructor. */ -ActionPrintPreview::ActionPrintPreview(RS_EntityContainer & container, GraphicView & graphicView): +ActionPrintPreview::ActionPrintPreview(EntityContainer & container, GraphicView & graphicView): ActionInterface("Print Preview", container, graphicView) { showOptions(); @@ -97,7 +97,7 @@ void ActionPrintPreview::mouseReleaseEvent(QMouseEvent * e) break; default: - RS_DIALOGFACTORY->requestPreviousMenu(); + DIALOGFACTORY->requestPreviousMenu(); e->accept(); break; } @@ -107,7 +107,7 @@ void ActionPrintPreview::coordinateEvent(Vector *) { } -void ActionPrintPreview::commandEvent(RS_CommandEvent *) +void ActionPrintPreview::commandEvent(CommandEvent *) { } @@ -121,14 +121,14 @@ void ActionPrintPreview::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionPrintPreview::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionPrintPreview::updateMouseButtonHints() diff --git a/src/actions/actionprintpreview.h b/src/actions/actionprintpreview.h index 435e849..e6171d1 100644 --- a/src/actions/actionprintpreview.h +++ b/src/actions/actionprintpreview.h @@ -1,7 +1,7 @@ #ifndef __ACTIONPRINTPREVIEW_H__ #define __ACTIONPRINTPREVIEW_H__ -#include "rs.h" +#include "enums.h" #include "actioninterface.h" #include "vector.h" @@ -23,7 +23,7 @@ class ActionPrintPreview: public ActionInterface }; public: - ActionPrintPreview(RS_EntityContainer & container, GraphicView & graphicView); + ActionPrintPreview(EntityContainer & container, GraphicView & graphicView); ~ActionPrintPreview(); virtual RS2::ActionType rtti(); @@ -33,7 +33,7 @@ class ActionPrintPreview: public ActionInterface virtual void mousePressEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e); virtual void coordinateEvent(Vector * e); - virtual void commandEvent(RS_CommandEvent * e); + virtual void commandEvent(CommandEvent * e); virtual QStringList getAvailableCommands(); virtual void showOptions(); virtual void hideOptions(); diff --git a/src/actions/actionselect.cpp b/src/actions/actionselect.cpp index bd96b43..e09cf28 100644 --- a/src/actions/actionselect.cpp +++ b/src/actions/actionselect.cpp @@ -20,7 +20,7 @@ #include "dialogfactory.h" #include "graphicview.h" -ActionSelect::ActionSelect(RS_EntityContainer & container, GraphicView & graphicView, +ActionSelect::ActionSelect(EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction): ActionInterface("Select Entities", container, graphicView) { @@ -45,11 +45,11 @@ void ActionSelect::mouseReleaseEvent(QMouseEvent * e) void ActionSelect::updateToolBar() { - if (RS_DIALOGFACTORY) + if (DIALOGFACTORY) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBarSelect(this, nextAction); + DIALOGFACTORY->requestToolBarSelect(this, nextAction); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); + DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } } diff --git a/src/actions/actionselect.h b/src/actions/actionselect.h index f90b261..5da758a 100644 --- a/src/actions/actionselect.h +++ b/src/actions/actionselect.h @@ -12,7 +12,7 @@ class ActionSelect: public ActionInterface { public: - ActionSelect(RS_EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction); + ActionSelect(EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction); ~ActionSelect(); void init(int status); diff --git a/src/actions/actionselectall.cpp b/src/actions/actionselectall.cpp index a54df0b..6cf2768 100644 --- a/src/actions/actionselectall.cpp +++ b/src/actions/actionselectall.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "selection.h" -ActionSelectAll::ActionSelectAll(RS_EntityContainer & container, +ActionSelectAll::ActionSelectAll(EntityContainer & container, GraphicView & graphicView, bool select): ActionInterface("Select All Entities", container, graphicView) { @@ -44,8 +44,8 @@ void ActionSelectAll::init(int status) void ActionSelectAll::trigger() { - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectAll(select); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } diff --git a/src/actions/actionselectall.h b/src/actions/actionselectall.h index 8cce0c3..a67a1bb 100644 --- a/src/actions/actionselectall.h +++ b/src/actions/actionselectall.h @@ -12,7 +12,7 @@ class ActionSelectAll: public ActionInterface { public: - ActionSelectAll(RS_EntityContainer & container, GraphicView & graphicView, bool select); + ActionSelectAll(EntityContainer & container, GraphicView & graphicView, bool select); ~ActionSelectAll(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionselectbase.cpp b/src/actions/actionselectbase.cpp index f3aba42..d27b0ed 100644 --- a/src/actions/actionselectbase.cpp +++ b/src/actions/actionselectbase.cpp @@ -19,7 +19,7 @@ #include "graphicview.h" ActionSelectBase::ActionSelectBase(const char * name, - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface(name, container, graphicView) { } diff --git a/src/actions/actionselectbase.h b/src/actions/actionselectbase.h index 374ec71..385af9e 100644 --- a/src/actions/actionselectbase.h +++ b/src/actions/actionselectbase.h @@ -12,7 +12,7 @@ class ActionSelectBase: public ActionInterface { public: - ActionSelectBase(const char * name, RS_EntityContainer & container, GraphicView & graphicView); + ActionSelectBase(const char * name, EntityContainer & container, GraphicView & graphicView); ~ActionSelectBase(); virtual void keyReleaseEvent(QKeyEvent * e); diff --git a/src/actions/actionselectcontour.cpp b/src/actions/actionselectcontour.cpp index 648a1f2..66d6a7c 100644 --- a/src/actions/actionselectcontour.cpp +++ b/src/actions/actionselectcontour.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "selection.h" -ActionSelectContour::ActionSelectContour(RS_EntityContainer & container, +ActionSelectContour::ActionSelectContour(EntityContainer & container, GraphicView & graphicView): ActionInterface("Select Contours", container, graphicView) { @@ -43,17 +43,17 @@ void ActionSelectContour::trigger() { if (en->isAtomic()) { - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectContour(en); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } - else if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage(tr("Entity must be an Atomic Entity.")); + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Entity must be an Atomic Entity.")); } else - RS_DEBUG->print("ActionSelectContour::trigger: Entity is NULL\n"); + DEBUG->print("ActionSelectContour::trigger: Entity is NULL\n"); } void ActionSelectContour::mouseReleaseEvent(QMouseEvent * e) diff --git a/src/actions/actionselectcontour.h b/src/actions/actionselectcontour.h index 309b81b..3fc47dd 100644 --- a/src/actions/actionselectcontour.h +++ b/src/actions/actionselectcontour.h @@ -3,7 +3,7 @@ #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to select contours. @@ -14,7 +14,7 @@ class RS_Entity; class ActionSelectContour: public ActionInterface { public: - ActionSelectContour(RS_EntityContainer & container, GraphicView & graphicView); + ActionSelectContour(EntityContainer & container, GraphicView & graphicView); ~ActionSelectContour(); virtual RS2::ActionType rtti(); @@ -23,7 +23,7 @@ class ActionSelectContour: public ActionInterface virtual void updateMouseCursor(); private: - RS_Entity * en; + Entity * en; }; #endif // __ACTIONSELECTCONTOURS_H__ diff --git a/src/actions/actionselectintersected.cpp b/src/actions/actionselectintersected.cpp index 122f1f0..fd18464 100644 --- a/src/actions/actionselectintersected.cpp +++ b/src/actions/actionselectintersected.cpp @@ -28,7 +28,7 @@ * @param select true: select window. false: deselect window */ ActionSelectIntersected::ActionSelectIntersected( - RS_EntityContainer & container, GraphicView & graphicView, bool select): + EntityContainer & container, GraphicView & graphicView, bool select): ActionInterface("Select Intersected", container, graphicView) { this->select = select; @@ -60,11 +60,11 @@ void ActionSelectIntersected::trigger() if (graphicView->toGuiDX(v1.distanceTo(v2)) > 10) { deleteSnapper(); - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectIntersected(v1, v2, select); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); init(); } @@ -78,7 +78,7 @@ void ActionSelectIntersected::mouseMoveEvent(QMouseEvent * e) v2 = snapPoint(e); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Line(preview, RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v2.y)))); +// preview->addEntity(new Line(preview, LineData(Vector(v1.x, v1.y), Vector(v2.x, v2.y)))); drawPreview(); } } @@ -99,13 +99,13 @@ void ActionSelectIntersected::mousePressEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionSelectIntersected::mousePressEvent(): %f %f", + DEBUG->print("ActionSelectIntersected::mousePressEvent(): %f %f", v1.x, v1.y); } void ActionSelectIntersected::mouseReleaseEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionSelectIntersected::mouseReleaseEvent()"); + DEBUG->print("ActionSelectIntersected::mouseReleaseEvent()"); if (e->button() == Qt::RightButton) { @@ -127,20 +127,20 @@ void ActionSelectIntersected::mouseReleaseEvent(QMouseEvent * e) void ActionSelectIntersected::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Choose first point of intersection line"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Choose first point of intersection line"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Choose second point of intersection line"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Choose second point of intersection line"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -153,12 +153,12 @@ void ActionSelectIntersected::updateMouseCursor() void ActionSelectIntersected::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); } } diff --git a/src/actions/actionselectintersected.h b/src/actions/actionselectintersected.h index 2487afc..decdd3a 100644 --- a/src/actions/actionselectintersected.h +++ b/src/actions/actionselectintersected.h @@ -22,7 +22,7 @@ class ActionSelectIntersected: public ActionInterface }; public: - ActionSelectIntersected(RS_EntityContainer & container, GraphicView & graphicView, bool select); + ActionSelectIntersected(EntityContainer & container, GraphicView & graphicView, bool select); ~ActionSelectIntersected(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionselectinvert.cpp b/src/actions/actionselectinvert.cpp index eac8098..ecd20f9 100644 --- a/src/actions/actionselectinvert.cpp +++ b/src/actions/actionselectinvert.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "selection.h" -ActionSelectInvert::ActionSelectInvert(RS_EntityContainer & container, +ActionSelectInvert::ActionSelectInvert(EntityContainer & container, GraphicView & graphicView): ActionInterface("Invert Selection", container, graphicView) { @@ -43,8 +43,8 @@ void ActionSelectInvert::init(int status) void ActionSelectInvert::trigger() { - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.invertSelection(); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } diff --git a/src/actions/actionselectinvert.h b/src/actions/actionselectinvert.h index 2726975..8ebd1f9 100644 --- a/src/actions/actionselectinvert.h +++ b/src/actions/actionselectinvert.h @@ -12,7 +12,7 @@ class ActionSelectInvert: public ActionInterface { public: - ActionSelectInvert(RS_EntityContainer & container, GraphicView & graphicView); + ActionSelectInvert(EntityContainer & container, GraphicView & graphicView); ~ActionSelectInvert(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionselectlayer.cpp b/src/actions/actionselectlayer.cpp index e89f0bd..2f6baf3 100644 --- a/src/actions/actionselectlayer.cpp +++ b/src/actions/actionselectlayer.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "selection.h" -ActionSelectLayer::ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView): +ActionSelectLayer::ActionSelectLayer(EntityContainer & container, GraphicView & graphicView): ActionInterface("Select Layers", container, graphicView) { en = NULL; @@ -40,14 +40,14 @@ void ActionSelectLayer::trigger() { if (en) { - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectLayer(en); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } else - RS_DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n"); + DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n"); } void ActionSelectLayer::mouseReleaseEvent(QMouseEvent * e) diff --git a/src/actions/actionselectlayer.h b/src/actions/actionselectlayer.h index f3bccc6..9ac3493 100644 --- a/src/actions/actionselectlayer.h +++ b/src/actions/actionselectlayer.h @@ -3,7 +3,7 @@ #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to select contours. @@ -14,7 +14,7 @@ class RS_Entity; class ActionSelectLayer: public ActionInterface { public: - ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView); + ActionSelectLayer(EntityContainer & container, GraphicView & graphicView); ~ActionSelectLayer(); virtual RS2::ActionType rtti(); @@ -23,7 +23,7 @@ class ActionSelectLayer: public ActionInterface virtual void updateMouseCursor(); private: - RS_Entity * en; + Entity * en; }; #endif // __ACTIONSELECTLAYER_H__ diff --git a/src/actions/actionselectsingle.cpp b/src/actions/actionselectsingle.cpp index f994d5d..468e721 100644 --- a/src/actions/actionselectsingle.cpp +++ b/src/actions/actionselectsingle.cpp @@ -21,7 +21,7 @@ #include "graphicview.h" #include "selection.h" -ActionSelectSingle::ActionSelectSingle(RS_EntityContainer & container, GraphicView & graphicView): +ActionSelectSingle::ActionSelectSingle(EntityContainer & container, GraphicView & graphicView): ActionInterface("Select Entities", container, graphicView) { en = NULL; @@ -40,13 +40,13 @@ void ActionSelectSingle::trigger() { if (en != NULL) { - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectSingle(en); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } else - RS_DEBUG->print("ActionSelectSingle::trigger: Entity is NULL\n"); + DEBUG->print("ActionSelectSingle::trigger: Entity is NULL\n"); } void ActionSelectSingle::keyPressEvent(QKeyEvent * e) diff --git a/src/actions/actionselectsingle.h b/src/actions/actionselectsingle.h index 20d0c95..015817a 100644 --- a/src/actions/actionselectsingle.h +++ b/src/actions/actionselectsingle.h @@ -3,7 +3,7 @@ #include "actioninterface.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to select entities. @@ -14,7 +14,7 @@ class RS_Entity; class ActionSelectSingle: public ActionInterface { public: - ActionSelectSingle(RS_EntityContainer & container, GraphicView & graphicView); + ActionSelectSingle(EntityContainer & container, GraphicView & graphicView); ~ActionSelectSingle(); virtual RS2::ActionType rtti(); @@ -24,7 +24,7 @@ class ActionSelectSingle: public ActionInterface virtual void updateMouseCursor(); private: - RS_Entity * en; + Entity * en; }; #endif // __ACTIONSELECTSINGLE_H__ diff --git a/src/actions/actionselectwindow.cpp b/src/actions/actionselectwindow.cpp index 5133693..e47cd94 100644 --- a/src/actions/actionselectwindow.cpp +++ b/src/actions/actionselectwindow.cpp @@ -27,7 +27,7 @@ * * @param select true: select window. false: deselect window */ -ActionSelectWindow::ActionSelectWindow(RS_EntityContainer & container, +ActionSelectWindow::ActionSelectWindow(EntityContainer & container, GraphicView & graphicView, bool select): ActionInterface("Select Window", container, graphicView) { @@ -61,9 +61,9 @@ void ActionSelectWindow::trigger() { deleteSnapper(); bool cross = (v2.y > v1.y); - RS_Selection s(*container, graphicView); + Selection s(*container, graphicView); s.selectWindow(v1, v2, select, cross); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); init(); } } @@ -76,14 +76,14 @@ void ActionSelectWindow::mouseMoveEvent(QMouseEvent * e) v2 = snapPoint(e); deletePreview(); clearPreview(); -/* preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/ +/* preview->addEntity(new Line(preview, + LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/ drawPreview(); } } @@ -104,13 +104,13 @@ void ActionSelectWindow::mousePressEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionSelectWindow::mousePressEvent(): %f %f", + DEBUG->print("ActionSelectWindow::mousePressEvent(): %f %f", v1.x, v1.y); } void ActionSelectWindow::mouseReleaseEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionSelectWindow::mouseReleaseEvent()"); + DEBUG->print("ActionSelectWindow::mouseReleaseEvent()"); if (e->button() == Qt::LeftButton) { @@ -135,15 +135,15 @@ void ActionSelectWindow::updateMouseButtonHints() switch (getStatus()) { case SetCorner1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Choose first edge"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Choose first edge"), tr("Cancel")); break; case SetCorner2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Choose second edge"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Choose second edge"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -156,7 +156,7 @@ void ActionSelectWindow::updateMouseCursor() void ActionSelectWindow::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect); } diff --git a/src/actions/actionselectwindow.h b/src/actions/actionselectwindow.h index f96bbff..eb7647e 100644 --- a/src/actions/actionselectwindow.h +++ b/src/actions/actionselectwindow.h @@ -22,7 +22,7 @@ class ActionSelectWindow: public ActionInterface }; public: - ActionSelectWindow(RS_EntityContainer & container, GraphicView & graphicView, bool select); + ActionSelectWindow(EntityContainer & container, GraphicView & graphicView, bool select); ~ActionSelectWindow(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionsetrelativezero.cpp b/src/actions/actionsetrelativezero.cpp index 5e1fc09..98297a1 100644 --- a/src/actions/actionsetrelativezero.cpp +++ b/src/actions/actionsetrelativezero.cpp @@ -19,7 +19,7 @@ #include "dialogfactory.h" #include "graphicview.h" -ActionSetRelativeZero::ActionSetRelativeZero(RS_EntityContainer & container, +ActionSetRelativeZero::ActionSetRelativeZero(EntityContainer & container, GraphicView & graphicView): ActionInterface("Set the relative Zero", container, graphicView) { @@ -80,11 +80,11 @@ void ActionSetRelativeZero::updateMouseButtonHints() switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -97,9 +97,9 @@ void ActionSetRelativeZero::updateMouseCursor() void ActionSetRelativeZero::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); } diff --git a/src/actions/actionsetrelativezero.h b/src/actions/actionsetrelativezero.h index a199f2c..7ec811c 100644 --- a/src/actions/actionsetrelativezero.h +++ b/src/actions/actionsetrelativezero.h @@ -14,7 +14,7 @@ class ActionSetRelativeZero: public ActionInterface { public: - ActionSetRelativeZero(RS_EntityContainer & container, GraphicView & graphicView); + ActionSetRelativeZero(EntityContainer & container, GraphicView & graphicView); ~ActionSetRelativeZero(); virtual RS2::ActionType rtti(); diff --git a/src/actions/actionsetsnapmode.cpp b/src/actions/actionsetsnapmode.cpp index 18b6a8d..0e8d3c7 100644 --- a/src/actions/actionsetsnapmode.cpp +++ b/src/actions/actionsetsnapmode.cpp @@ -23,7 +23,7 @@ * * @param snapMode The new snap mode used from now on. */ -ActionSetSnapMode::ActionSetSnapMode(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode): +ActionSetSnapMode::ActionSetSnapMode(EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode): ActionInterface("Set Snap Mode", container, graphicView) { this->snapMode = snapMode; diff --git a/src/actions/actionsetsnapmode.h b/src/actions/actionsetsnapmode.h index 713d4f6..d353c11 100644 --- a/src/actions/actionsetsnapmode.h +++ b/src/actions/actionsetsnapmode.h @@ -1,7 +1,7 @@ #ifndef __ACTIONSETSNAPMODE_H__ #define __ACTIONSETSNAPMODE_H__ -#include "rs.h" +#include "enums.h" #include "actioninterface.h" /** @@ -13,7 +13,7 @@ class ActionSetSnapMode: public ActionInterface { public: - ActionSetSnapMode(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode); + ActionSetSnapMode(EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode); ~ActionSetSnapMode(); virtual void init(int status = 0); diff --git a/src/actions/actionsetsnaprestriction.cpp b/src/actions/actionsetsnaprestriction.cpp index b235172..10d92ef 100644 --- a/src/actions/actionsetsnaprestriction.cpp +++ b/src/actions/actionsetsnaprestriction.cpp @@ -25,7 +25,7 @@ * @param set true: set additional snap mode / false: unset */ ActionSetSnapRestriction::ActionSetSnapRestriction( - RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes): + EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes): ActionInterface("Set Additional Snap Mode", container, graphicView) { this->snapRes = snapRes; diff --git a/src/actions/actionsetsnaprestriction.h b/src/actions/actionsetsnaprestriction.h index 8bbca94..d386e55 100644 --- a/src/actions/actionsetsnaprestriction.h +++ b/src/actions/actionsetsnaprestriction.h @@ -1,7 +1,7 @@ #ifndef __ACTIONSETSNAPRESTRICTION_H__ #define __ACTIONSETSNAPRESTRICTION_H__ -#include "rs.h" +#include "enums.h" #include "actioninterface.h" /** @@ -13,7 +13,7 @@ class ActionSetSnapRestriction: public ActionInterface { public: - ActionSetSnapRestriction(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes); + ActionSetSnapRestriction(EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes); ~ActionSetSnapRestriction(); virtual void init(int status = 0); diff --git a/src/actions/actionsnapintersectionmanual.cpp b/src/actions/actionsnapintersectionmanual.cpp index 72b65f4..fca53c4 100644 --- a/src/actions/actionsnapintersectionmanual.cpp +++ b/src/actions/actionsnapintersectionmanual.cpp @@ -26,7 +26,7 @@ * @param both Trim both entities. */ ActionSnapIntersectionManual::ActionSnapIntersectionManual( - RS_EntityContainer & container, GraphicView & graphicView): + EntityContainer & container, GraphicView & graphicView): ActionInterface("Trim Entity", container, graphicView) { entity2 = NULL; @@ -48,12 +48,12 @@ void ActionSnapIntersectionManual::init(int status) void ActionSnapIntersectionManual::trigger() { - RS_DEBUG->print("ActionSnapIntersectionManual::trigger()"); + DEBUG->print("ActionSnapIntersectionManual::trigger()"); if (entity2 != NULL && entity2->isAtomic() && entity1 != NULL && entity1->isAtomic()) { - VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false); + VectorSolutions sol = Information::getIntersection(entity1, entity2, false); entity2 = NULL; entity1 = NULL; @@ -74,9 +74,9 @@ void ActionSnapIntersectionManual::trigger() void ActionSnapIntersectionManual::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent begin"); + DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent begin"); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); Vector mouse = graphicView->toGraph(e->x(), e->y()); switch (getStatus()) @@ -90,17 +90,17 @@ void ActionSnapIntersectionManual::mouseMoveEvent(QMouseEvent * e) entity2 = se; coord = mouse; - VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false); + VectorSolutions sol = Information::getIntersection(entity1, entity2, false); Vector ip = sol.getClosest(coord); if (ip.valid) { deletePreview(); clearPreview(); -// preview->addEntity(new RS_Circle(preview, RS_CircleData(ip, graphicView->toGraphDX(4)))); +// preview->addEntity(new Circle(preview, CircleData(ip, graphicView->toGraphDX(4)))); drawPreview(); - RS_DIALOGFACTORY->updateCoordinateWidget(ip, ip - graphicView->getRelativeZero()); + DIALOGFACTORY->updateCoordinateWidget(ip, ip - graphicView->getRelativeZero()); } } break; @@ -109,7 +109,7 @@ void ActionSnapIntersectionManual::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent end"); + DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent end"); } void ActionSnapIntersectionManual::mouseReleaseEvent(QMouseEvent * e) @@ -117,7 +117,7 @@ void ActionSnapIntersectionManual::mouseReleaseEvent(QMouseEvent * e) if (e->button() == Qt::LeftButton) { Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e); + Entity * se = catchEntity(e); switch (getStatus()) { @@ -154,17 +154,17 @@ void ActionSnapIntersectionManual::updateMouseButtonHints() switch (getStatus()) { case ChooseEntity1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select first entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select first entity"), tr("Back")); break; case ChooseEntity2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Select second entity"), + DIALOGFACTORY->updateMouseWidget(tr("Select second entity"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -176,7 +176,7 @@ void ActionSnapIntersectionManual::updateMouseCursor() void ActionSnapIntersectionManual::updateToolBar() { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); } diff --git a/src/actions/actionsnapintersectionmanual.h b/src/actions/actionsnapintersectionmanual.h index b119c50..e804b4a 100644 --- a/src/actions/actionsnapintersectionmanual.h +++ b/src/actions/actionsnapintersectionmanual.h @@ -4,7 +4,7 @@ #include "actioninterface.h" #include "vector.h" -class RS_Entity; +class Entity; /** * This action class can handle user events to trim entities. @@ -24,7 +24,7 @@ class ActionSnapIntersectionManual: public ActionInterface }; public: - ActionSnapIntersectionManual(RS_EntityContainer & container, GraphicView & graphicView); + ActionSnapIntersectionManual(EntityContainer & container, GraphicView & graphicView); ~ActionSnapIntersectionManual(); virtual void init(int status = 0); @@ -36,8 +36,8 @@ class ActionSnapIntersectionManual: public ActionInterface virtual void updateToolBar(); private: - RS_Entity * entity1; - RS_Entity * entity2; + Entity * entity1; + Entity * entity2; Vector coord; }; diff --git a/src/actions/actionzoomauto.cpp b/src/actions/actionzoomauto.cpp index 17214c4..1726ed4 100644 --- a/src/actions/actionzoomauto.cpp +++ b/src/actions/actionzoomauto.cpp @@ -24,7 +24,7 @@ * @param keepAspectRatio true: keep same zoom value for x/y. * false: adjust both x and y individually */ -ActionZoomAuto::ActionZoomAuto(RS_EntityContainer & container, +ActionZoomAuto::ActionZoomAuto(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio): ActionInterface("Auto zoom", container, graphicView) { diff --git a/src/actions/actionzoomauto.h b/src/actions/actionzoomauto.h index d9c7cba..22f6c9d 100644 --- a/src/actions/actionzoomauto.h +++ b/src/actions/actionzoomauto.h @@ -12,7 +12,7 @@ class ActionZoomAuto: public ActionInterface { public: - ActionZoomAuto(RS_EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true); + ActionZoomAuto(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true); ~ActionZoomAuto(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomautoy.cpp b/src/actions/actionzoomautoy.cpp index 894bc47..52d2f49 100644 --- a/src/actions/actionzoomautoy.cpp +++ b/src/actions/actionzoomautoy.cpp @@ -18,7 +18,7 @@ #include "graphicview.h" -ActionZoomAutoY::ActionZoomAutoY(RS_EntityContainer & container, GraphicView & graphicView): +ActionZoomAutoY::ActionZoomAutoY(EntityContainer & container, GraphicView & graphicView): ActionInterface("Auto zoom Y", container, graphicView) { } diff --git a/src/actions/actionzoomautoy.h b/src/actions/actionzoomautoy.h index 2857670..691ae9e 100644 --- a/src/actions/actionzoomautoy.h +++ b/src/actions/actionzoomautoy.h @@ -12,7 +12,7 @@ class ActionZoomAutoY: public ActionInterface { public: - ActionZoomAutoY(RS_EntityContainer & container, GraphicView & graphicView); + ActionZoomAutoY(EntityContainer & container, GraphicView & graphicView); ~ActionZoomAutoY(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomin.cpp b/src/actions/actionzoomin.cpp index d51879d..fe5d776 100644 --- a/src/actions/actionzoomin.cpp +++ b/src/actions/actionzoomin.cpp @@ -24,7 +24,7 @@ * @param direction In for zooming in, Out for zooming out. * @param axis Axis that are affected by the zoom (OnlyX, OnlyY or Both) */ -ActionZoomIn::ActionZoomIn(RS_EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center): +ActionZoomIn::ActionZoomIn(EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center): ActionInterface("Zoom in", container, graphicView) { this->direction = direction; diff --git a/src/actions/actionzoomin.h b/src/actions/actionzoomin.h index 23de8d7..1837fa8 100644 --- a/src/actions/actionzoomin.h +++ b/src/actions/actionzoomin.h @@ -1,7 +1,7 @@ #ifndef __ACTIONZOOMIN_H__ #define __ACTIONZOOMIN_H__ -#include "rs.h" +#include "enums.h" #include "actioninterface.h" #include "vector.h" @@ -14,7 +14,7 @@ class ActionZoomIn: public ActionInterface { public: - ActionZoomIn(RS_EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction = RS2::In, RS2::Axis axis = RS2::Both, const Vector & center = Vector(false)); + ActionZoomIn(EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction = RS2::In, RS2::Axis axis = RS2::Both, const Vector & center = Vector(false)); ~ActionZoomIn(); virtual void init(int status = 0); diff --git a/src/actions/actionzoompan.cpp b/src/actions/actionzoompan.cpp index 7aa3a42..74b3d82 100644 --- a/src/actions/actionzoompan.cpp +++ b/src/actions/actionzoompan.cpp @@ -18,7 +18,7 @@ #include "graphicview.h" -ActionZoomPan::ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView): +ActionZoomPan::ActionZoomPan(EntityContainer & container, GraphicView & graphicView): ActionInterface("Zoom Pan", container, graphicView) { graphicView.snapper.SetVisible(false); diff --git a/src/actions/actionzoompan.h b/src/actions/actionzoompan.h index 526ab56..62452b3 100644 --- a/src/actions/actionzoompan.h +++ b/src/actions/actionzoompan.h @@ -12,7 +12,7 @@ class ActionZoomPan: public ActionInterface { public: - ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView); + ActionZoomPan(EntityContainer & container, GraphicView & graphicView); ~ActionZoomPan(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomprevious.cpp b/src/actions/actionzoomprevious.cpp index 616bbb6..8b57d8b 100644 --- a/src/actions/actionzoomprevious.cpp +++ b/src/actions/actionzoomprevious.cpp @@ -21,7 +21,7 @@ /** * Constructor. */ -ActionZoomPrevious::ActionZoomPrevious(RS_EntityContainer & container, GraphicView & graphicView): +ActionZoomPrevious::ActionZoomPrevious(EntityContainer & container, GraphicView & graphicView): ActionInterface("Previous zoom", container, graphicView) { } diff --git a/src/actions/actionzoomprevious.h b/src/actions/actionzoomprevious.h index 9604664..cfd38c5 100644 --- a/src/actions/actionzoomprevious.h +++ b/src/actions/actionzoomprevious.h @@ -12,7 +12,7 @@ class ActionZoomPrevious: public ActionInterface { public: - ActionZoomPrevious(RS_EntityContainer & container, GraphicView & graphicView); + ActionZoomPrevious(EntityContainer & container, GraphicView & graphicView); ~ActionZoomPrevious(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomredraw.cpp b/src/actions/actionzoomredraw.cpp index f086d9d..0b57424 100644 --- a/src/actions/actionzoomredraw.cpp +++ b/src/actions/actionzoomredraw.cpp @@ -24,7 +24,7 @@ * @param keepAspectRatio true: keep same zoom value for x/y. * false: adjust both x and y individually */ -ActionZoomRedraw::ActionZoomRedraw(RS_EntityContainer & container, GraphicView & graphicView): +ActionZoomRedraw::ActionZoomRedraw(EntityContainer & container, GraphicView & graphicView): ActionInterface("Redraw", container, graphicView) { } diff --git a/src/actions/actionzoomredraw.h b/src/actions/actionzoomredraw.h index 4cdf6e5..328ca5c 100644 --- a/src/actions/actionzoomredraw.h +++ b/src/actions/actionzoomredraw.h @@ -12,7 +12,7 @@ class ActionZoomRedraw: public ActionInterface { public: - ActionZoomRedraw(RS_EntityContainer & container, GraphicView & graphicView); + ActionZoomRedraw(EntityContainer & container, GraphicView & graphicView); ~ActionZoomRedraw(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomscroll.cpp b/src/actions/actionzoomscroll.cpp index 2a7613a..88f0985 100644 --- a/src/actions/actionzoomscroll.cpp +++ b/src/actions/actionzoomscroll.cpp @@ -18,7 +18,7 @@ #include "graphicview.h" -ActionZoomScroll::ActionZoomScroll(RS2::Direction direction, RS_EntityContainer & container, GraphicView & graphicView): +ActionZoomScroll::ActionZoomScroll(RS2::Direction direction, EntityContainer & container, GraphicView & graphicView): ActionInterface("Zoom scroll", container, graphicView) { this->direction = direction; diff --git a/src/actions/actionzoomscroll.h b/src/actions/actionzoomscroll.h index cbe683a..50323d5 100644 --- a/src/actions/actionzoomscroll.h +++ b/src/actions/actionzoomscroll.h @@ -12,7 +12,7 @@ class ActionZoomScroll: public ActionInterface { public: - ActionZoomScroll(RS2::Direction direction, RS_EntityContainer & container, GraphicView & graphicView); + ActionZoomScroll(RS2::Direction direction, EntityContainer & container, GraphicView & graphicView); ~ActionZoomScroll(); virtual void init(int status = 0); diff --git a/src/actions/actionzoomwindow.cpp b/src/actions/actionzoomwindow.cpp index 4913c31..fab8e1b 100644 --- a/src/actions/actionzoomwindow.cpp +++ b/src/actions/actionzoomwindow.cpp @@ -28,7 +28,7 @@ * in x and y will stay the same. false Exactly the chosen * area will be fit to the viewport. */ -ActionZoomWindow::ActionZoomWindow(RS_EntityContainer & container, +ActionZoomWindow::ActionZoomWindow(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio): ActionInterface("Zoom Window", container, graphicView) { @@ -41,7 +41,7 @@ ActionZoomWindow::~ActionZoomWindow() void ActionZoomWindow::init(int status) { - RS_DEBUG->print("ActionZoomWindow::init()"); + DEBUG->print("ActionZoomWindow::init()"); ActionInterface::init(status); v1 = v2 = Vector(false); /* snapMode = RS2::SnapFree; @@ -50,7 +50,7 @@ void ActionZoomWindow::init(int status) void ActionZoomWindow::trigger() { - RS_DEBUG->print("ActionZoomWindow::trigger()"); + DEBUG->print("ActionZoomWindow::trigger()"); ActionInterface::trigger(); @@ -74,14 +74,14 @@ void ActionZoomWindow::mouseMoveEvent(QMouseEvent * e) v2 = snapPoint(e); deletePreview(); clearPreview(); -/* preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); - preview->addEntity(new RS_Line(preview, - RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/ +/* preview->addEntity(new Line(preview, + LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y)))); + preview->addEntity(new Line(preview, + LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/ drawPreview(); } } @@ -102,12 +102,12 @@ void ActionZoomWindow::mousePressEvent(QMouseEvent * e) } } - RS_DEBUG->print("ActionZoomWindow::mousePressEvent(): %f %f", v1.x, v1.y); + DEBUG->print("ActionZoomWindow::mousePressEvent(): %f %f", v1.x, v1.y); } void ActionZoomWindow::mouseReleaseEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionZoomWindow::mouseReleaseEvent()"); + DEBUG->print("ActionZoomWindow::mouseReleaseEvent()"); if (e->button() == Qt::RightButton) { @@ -126,20 +126,20 @@ void ActionZoomWindow::mouseReleaseEvent(QMouseEvent * e) void ActionZoomWindow::updateMouseButtonHints() { - RS_DEBUG->print("ActionZoomWindow::updateMouseButtonHints()"); + DEBUG->print("ActionZoomWindow::updateMouseButtonHints()"); switch (getStatus()) { case 0: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first edge"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first edge"), tr("Cancel")); break; case 1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second edge"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second edge"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } diff --git a/src/actions/actionzoomwindow.h b/src/actions/actionzoomwindow.h index 628da6f..b0568e2 100644 --- a/src/actions/actionzoomwindow.h +++ b/src/actions/actionzoomwindow.h @@ -13,7 +13,7 @@ class ActionZoomWindow: public ActionInterface { public: - ActionZoomWindow(RS_EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true); + ActionZoomWindow(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true); ~ActionZoomWindow(); virtual void init(int status = 0); diff --git a/src/base/actioninterface.cpp b/src/base/actioninterface.cpp index f4265e7..92b7745 100644 --- a/src/base/actioninterface.cpp +++ b/src/base/actioninterface.cpp @@ -34,10 +34,10 @@ * @param graphicView Graphic view instance this action operates on. Please * note that an action belongs to this view. */ -ActionInterface::ActionInterface(const char * name, RS_EntityContainer & ec, +ActionInterface::ActionInterface(const char * name, EntityContainer & ec, GraphicView & gv): graphicView(&gv), container(&ec) { - RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name); + DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name); this->name = name; status = 0; @@ -60,7 +60,7 @@ ActionInterface::ActionInterface(const char * name, RS_EntityContainer & ec, graphicView->snapper.SetVisible(); graphicView->preview.SetVisible(); - RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\": OK", name); + DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\": OK", name); } /** @@ -100,7 +100,7 @@ QString ActionInterface::getName() */ void ActionInterface::init(int status/*= 0*/) { -// RS_Snapper::init(); +// Snapper::init(); setStatus(status); if (status >= 0) @@ -182,7 +182,7 @@ void ActionInterface::coordinateEvent(Vector *) * This function can be overwritten by the implementing action. * The default implementation does nothing. */ -void ActionInterface::commandEvent(RS_CommandEvent *) +void ActionInterface::commandEvent(CommandEvent *) { } @@ -283,7 +283,7 @@ void ActionInterface::setFinished() */ void ActionInterface::finish() { - RS_DEBUG->print("ActionInterface::finish"); + DEBUG->print("ActionInterface::finish"); status = -1; // graphicView->setMouseCursor(RS2::ArrowCursor); //graphicView->requestToolBar(RS2::ToolBarMain); @@ -292,10 +292,10 @@ void ActionInterface::finish() //jlh: deleteSnapper(); hideOptions(); finished = true; -// RS_Snapper::finish(); // Sets RS_Snapper::finished = true +// Snapper::finish(); // Sets Snapper::finished = true // I think this is where we want to update the screen... // graphicView->redraw(); - RS_DEBUG->print("ActionInterface::finish: OK"); + DEBUG->print("ActionInterface::finish: OK"); } /** @@ -315,7 +315,7 @@ void ActionInterface::suspend() // Maybe this is where we need to save the state of the snapper // & preview objects??? // graphicView->setMouseCursor(RS2::ArrowCursor); -// RS_Snapper::suspend(); +// Snapper::suspend(); } /** @@ -325,7 +325,7 @@ void ActionInterface::resume() { updateMouseCursor(); updateToolBar(); -// RS_Snapper::resume(); +// Snapper::resume(); } /** @@ -333,7 +333,7 @@ void ActionInterface::resume() */ void ActionInterface::hideOptions() { -// RS_Snapper::hideOptions(); +// Snapper::hideOptions(); } /** @@ -341,32 +341,32 @@ void ActionInterface::hideOptions() */ void ActionInterface::showOptions() { -// RS_Snapper::showOptions(); +// Snapper::showOptions(); } /** - * Calls checkCommand() from the RS_COMMANDS module. + * Calls checkCommand() from the COMMANDS module. */ bool ActionInterface::checkCommand(const QString & cmd, const QString & str, RS2::ActionType action) { - return RS_COMMANDS->checkCommand(cmd, str, action); + return COMMANDS->checkCommand(cmd, str, action); } /** - * Calls command() from the RS_COMMANDS module. + * Calls command() from the COMMANDS module. */ QString ActionInterface::command(const QString & cmd) { - return RS_COMMANDS->command(cmd); + return COMMANDS->command(cmd); } /** - * Calls msgAvailableCommands() from the RS_COMMANDS module. + * Calls msgAvailableCommands() from the COMMANDS module. */ QString ActionInterface::msgAvailableCommands() { - return RS_COMMANDS->msgAvailableCommands(); + return COMMANDS->msgAvailableCommands(); } // This is here to save some typing in all the action* classes derived from @@ -376,12 +376,12 @@ Vector ActionInterface::snapPoint(QMouseEvent * e) return graphicView->snapper.snapPoint(e); } -RS_Entity * ActionInterface::catchEntity(QMouseEvent * e, RS2::ResolveLevel level/*= RS2::ResolveNone*/) +Entity * ActionInterface::catchEntity(QMouseEvent * e, RS2::ResolveLevel level/*= RS2::ResolveNone*/) { return graphicView->snapper.catchEntity(e, level); } -RS_Entity * ActionInterface::catchEntity(Vector v, RS2::ResolveLevel level/*= RS2::ResolveNone*/) +Entity * ActionInterface::catchEntity(Vector v, RS2::ResolveLevel level/*= RS2::ResolveNone*/) { return graphicView->snapper.catchEntity(v, level); } diff --git a/src/base/actioninterface.h b/src/base/actioninterface.h index 7647b20..a88ee89 100644 --- a/src/base/actioninterface.h +++ b/src/base/actioninterface.h @@ -2,13 +2,13 @@ #define __ACTIONINTERFACE_H__ #include -#include "rs.h" +#include "enums.h" -class RS_CommandEvent; -class RS_Document; +class CommandEvent; +class Document; class Drawing; -class RS_Entity; -class RS_EntityContainer; +class Entity; +class EntityContainer; class GraphicView; class Vector; @@ -28,7 +28,7 @@ class ActionInterface: public QObject //mebbe... Well, that's what he says above. Though it would be just as easy to //prefix a QObject::tr in front of translated strings... public: - ActionInterface(const char * name, RS_EntityContainer &, + ActionInterface(const char * name, EntityContainer &, GraphicView &); virtual ~ActionInterface(); @@ -41,7 +41,7 @@ class ActionInterface: public QObject virtual void keyPressEvent(QKeyEvent * e); virtual void keyReleaseEvent(QKeyEvent * e); virtual void coordinateEvent(Vector *); - virtual void commandEvent(RS_CommandEvent *); + virtual void commandEvent(CommandEvent *); virtual QStringList getAvailableCommands(); virtual void setStatus(int status); virtual int getStatus(); @@ -63,8 +63,8 @@ class ActionInterface: public QObject QString msgAvailableCommands(); //built-in for now, we'll see how it goes... Vector snapPoint(QMouseEvent *); - RS_Entity * catchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone); - RS_Entity * catchEntity(Vector, RS2::ResolveLevel level = RS2::ResolveNone); + Entity * catchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone); + Entity * catchEntity(Vector, RS2::ResolveLevel level = RS2::ResolveNone); #warning "!!! The following functions are DEPRECATED and only in place to help with porting.. !!!" void drawSnapper(void); void deleteSnapper(void); @@ -99,7 +99,7 @@ class ActionInterface: public QObject /** * Pointer to the document (graphic or block) or NULL. */ - RS_Document * document; + Document * document; /** * Predecessor of this action or NULL. @@ -107,7 +107,7 @@ class ActionInterface: public QObject ActionInterface * predecessor; GraphicView * graphicView; - RS_EntityContainer * container; + EntityContainer * container; }; #endif // __ACTIONINTERFACE_H__ diff --git a/src/base/arc.cpp b/src/base/arc.cpp index e21a998..1a62eba 100644 --- a/src/base/arc.cpp +++ b/src/base/arc.cpp @@ -28,98 +28,98 @@ /** * Default constructor. */ -RS_Arc::RS_Arc(RS_EntityContainer * parent, const RS_ArcData & d): - RS_AtomicEntity(parent), data(d) +Arc::Arc(EntityContainer * parent, const ArcData & d): + AtomicEntity(parent), data(d) { calculateEndpoints(); calculateBorders(); } -/*virtual*/ RS_Arc::~RS_Arc() +/*virtual*/ Arc::~Arc() { } -/*virtual*/ RS_Entity * RS_Arc::clone() +/*virtual*/ Entity * Arc::clone() { - RS_Arc * a = new RS_Arc(*this); + Arc * a = new Arc(*this); a->initId(); return a; } /** @return RS2::EntityArc */ -/*virtual*/ RS2::EntityType RS_Arc::rtti() const +/*virtual*/ RS2::EntityType Arc::rtti() const { return RS2::EntityArc; } /** @return true */ -/*virtual*/ bool RS_Arc::isEdge() const +/*virtual*/ bool Arc::isEdge() const { return true; } /** @return Copy of data that defines the arc. **/ -RS_ArcData RS_Arc::getData() const +ArcData Arc::getData() const { return data; } -/*virtual*/ VectorSolutions RS_Arc::getRefPoints() +/*virtual*/ VectorSolutions Arc::getRefPoints() { VectorSolutions ret(startpoint, endpoint, data.center); return ret; } /** Sets new arc parameters. **/ -void RS_Arc::setData(RS_ArcData d) +void Arc::setData(ArcData d) { data = d; } /** @return The center point (x) of this arc */ -Vector RS_Arc::getCenter() const +Vector Arc::getCenter() const { return data.center; } /** Sets new center. */ -void RS_Arc::setCenter(const Vector & c) +void Arc::setCenter(const Vector & c) { data.center = c; } /** @return The radius of this arc */ -double RS_Arc::getRadius() const +double Arc::getRadius() const { return data.radius; } /** Sets new radius. */ -void RS_Arc::setRadius(double r) +void Arc::setRadius(double r) { data.radius = r; } /** @return The start angle of this arc */ -double RS_Arc::getAngle1() const +double Arc::getAngle1() const { return data.angle1; } /** Sets new start angle. */ -void RS_Arc::setAngle1(double a1) +void Arc::setAngle1(double a1) { data.angle1 = a1; } /** @return The end angle of this arc */ -double RS_Arc::getAngle2() const +double Arc::getAngle2() const { return data.angle2; } /** Sets new end angle. */ -void RS_Arc::setAngle2(double a2) +void Arc::setAngle2(double a2) { data.angle2 = a2; } @@ -128,49 +128,49 @@ void RS_Arc::setAngle2(double a2) * @return Direction 1. The angle at which the arc starts at * the startpoint. */ -double RS_Arc::getDirection1() const +double Arc::getDirection1() const { if (!data.reversed) - return RS_Math::correctAngle(data.angle1 + M_PI / 2.0); + return Math::correctAngle(data.angle1 + M_PI / 2.0); - return RS_Math::correctAngle(data.angle1 - M_PI / 2.0); + return Math::correctAngle(data.angle1 - M_PI / 2.0); } /** * @return Direction 2. The angle at which the arc starts at * the endpoint. */ -double RS_Arc::getDirection2() const +double Arc::getDirection2() const { if (!data.reversed) - return RS_Math::correctAngle(data.angle2 - M_PI / 2.0); + return Math::correctAngle(data.angle2 - M_PI / 2.0); - return RS_Math::correctAngle(data.angle2 + M_PI / 2.0); + return Math::correctAngle(data.angle2 + M_PI / 2.0); } /** * @retval true if the arc is reversed (clockwise), * @retval false otherwise */ -bool RS_Arc::isReversed() const +bool Arc::isReversed() const { return data.reversed; } /** sets the reversed status. */ -void RS_Arc::setReversed(bool r) +void Arc::setReversed(bool r) { data.reversed = r; } /** @return Start point of the entity. */ -/*virtual*/ Vector RS_Arc::getStartpoint() const +/*virtual*/ Vector Arc::getStartpoint() const { return startpoint; } /** @return End point of the entity. */ -/*virtual*/ Vector RS_Arc::getEndpoint() const +/*virtual*/ Vector Arc::getEndpoint() const { return endpoint; } @@ -182,7 +182,7 @@ void RS_Arc::setReversed(bool r) * @param p2 2nd point. * @param p3 3rd point. */ -bool RS_Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) +bool Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) { if (p1.distanceTo(p2) > RS_TOLERANCE && p2.distanceTo(p3) > RS_TOLERANCE @@ -201,19 +201,19 @@ bool RS_Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p a2 = p2.angleTo(p3) + M_PI / 2.0; dir2.setPolar(100.0, a2); - RS_ConstructionLineData d1(mp1, mp1 + dir1); - RS_ConstructionLineData d2(mp2, mp2 + dir2); - RS_ConstructionLine midLine1(NULL, d1); - RS_ConstructionLine midLine2(NULL, d2); + ConstructionLineData d1(mp1, mp1 + dir1); + ConstructionLineData d2(mp2, mp2 + dir2); + ConstructionLine midLine1(NULL, d1); + ConstructionLine midLine2(NULL, d2); VectorSolutions sol = - RS_Information::getIntersection(&midLine1, &midLine2); + Information::getIntersection(&midLine1, &midLine2); data.center = sol.get(0); data.radius = data.center.distanceTo(p3); data.angle1 = data.center.angleTo(p1); data.angle2 = data.center.angleTo(p3); - data.reversed = RS_Math::isAngleBetween(data.center.angleTo(p2), + data.reversed = Math::isAngleBetween(data.center.angleTo(p2), data.angle1, data.angle2, true); if (sol.get(0).valid && data.radius < 1.0e14 @@ -225,14 +225,14 @@ bool RS_Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p } else { - RS_DEBUG->print("RS_Arc::createFrom3P(): " + DEBUG->print("Arc::createFrom3P(): " "Cannot create an arc with inf radius."); return false; } } else { - RS_DEBUG->print("RS_Arc::createFrom3P(): " + DEBUG->print("Arc::createFrom3P(): " "Cannot create an arc with radius 0.0."); return false; } @@ -245,7 +245,7 @@ bool RS_Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p * @retval true Successfully created arc * @retval false Cannot creats arc (radius to small or endpoint to far away) */ -bool RS_Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector & endPoint, double direction1, double radius) +bool Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector & endPoint, double direction1, double radius) { Vector ortho; ortho.setPolar(radius, direction1 + M_PI / 2.0); @@ -262,7 +262,7 @@ bool RS_Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector data.angle2 = data.center.angleTo(endPoint); data.reversed = false; - double diff = RS_Math::correctAngle(getDirection1() - direction1); + double diff = Math::correctAngle(getDirection1() - direction1); if (fabs(diff - M_PI) < 1.0e-1) data.reversed = true; @@ -276,7 +276,7 @@ bool RS_Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector /** * Creates an arc from its startpoint, endpoint and bulge. */ -bool RS_Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge) +bool Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge) { data.reversed = (bulge < 0.0); double alpha = atan(bulge) * 4.0; @@ -287,7 +287,7 @@ bool RS_Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoin // alpha can't be 0.0 at this point data.radius = fabs(dist / sin(alpha / 2.0)); - double wu = fabs(RS_Math::pow(data.radius, 2.0) - RS_Math::pow(dist, 2.0)); + double wu = fabs(Math::pow(data.radius, 2.0) - Math::pow(dist, 2.0)); double h = sqrt(wu); double angle = startPoint.angleTo(endPoint); @@ -313,7 +313,7 @@ bool RS_Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoin /** * Recalculates the endpoints using the angles and the radius. */ -void RS_Arc::calculateEndpoints() +void Arc::calculateEndpoints() { startpoint.set(data.center.x + cos(data.angle1) * data.radius, data.center.y + sin(data.angle1) * data.radius); @@ -321,7 +321,7 @@ void RS_Arc::calculateEndpoints() data.center.y + sin(data.angle2) * data.radius); } -void RS_Arc::calculateBorders() +void Arc::calculateBorders() { double minX = std::min(startpoint.x, endpoint.x); double minY = std::min(startpoint.y, endpoint.y); @@ -360,7 +360,7 @@ void RS_Arc::calculateBorders() maxV.set(maxX, maxY); } -Vector RS_Arc::getNearestEndpoint(const Vector & coord, double * dist) +Vector Arc::getNearestEndpoint(const Vector & coord, double * dist) { double dist1, dist2; Vector * nearerPoint; @@ -384,7 +384,7 @@ Vector RS_Arc::getNearestEndpoint(const Vector & coord, double * dist) return *nearerPoint; } -Vector RS_Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity) +Vector Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity) { Vector vec(false); @@ -393,7 +393,7 @@ Vector RS_Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, doub double angle = (coord - data.center).angle(); - if (onEntity == false || RS_Math::isAngleBetween(angle, + if (onEntity == false || Math::isAngleBetween(angle, data.angle1, data.angle2, isReversed())) { vec.setPolar(data.radius, angle); @@ -406,14 +406,14 @@ Vector RS_Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, doub return vec; } -Vector RS_Arc::getNearestCenter(const Vector & coord, double * dist) +Vector Arc::getNearestCenter(const Vector & coord, double * dist) { if (dist != NULL) *dist = coord.distanceTo(data.center); return data.center; } -Vector RS_Arc::getNearestMiddle(const Vector & coord, double * dist) +Vector Arc::getNearestMiddle(const Vector & coord, double * dist) { Vector ret = getMiddlepoint(); @@ -422,7 +422,7 @@ Vector RS_Arc::getNearestMiddle(const Vector & coord, double * dist) return ret; } -Vector RS_Arc::getNearestDist(double distance, const Vector & coord, double * dist) +Vector Arc::getNearestDist(double distance, const Vector & coord, double * dist) { if (data.radius < 1.0e-6) { @@ -473,7 +473,7 @@ Vector RS_Arc::getNearestDist(double distance, const Vector & coord, double * di return *nearerPoint; } -Vector RS_Arc::getNearestDist(double distance, bool startp) +Vector Arc::getNearestDist(double distance, bool startp) { if (data.radius < 1.0e-6) return Vector(false); @@ -503,7 +503,7 @@ Vector RS_Arc::getNearestDist(double distance, bool startp) return p; } -double RS_Arc::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double) +double Arc::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double) { if (entity != NULL) *entity = this; @@ -518,7 +518,7 @@ double RS_Arc::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS if (dist < 1.0e-4) return dist; - if (RS_Math::isAngleBetween(data.center.angleTo(coord), + if (Math::isAngleBetween(data.center.angleTo(coord), data.angle1, data.angle2, isReversed())) @@ -527,7 +527,7 @@ double RS_Arc::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS return RS_MAXDOUBLE; } -void RS_Arc::moveStartpoint(const Vector & pos) +void Arc::moveStartpoint(const Vector & pos) { // polyline arcs: move point not angle: //if (parent!=NULL && parent->rtti()==RS2::EntityPolyline) { @@ -543,7 +543,7 @@ void RS_Arc::moveStartpoint(const Vector & pos) }*/ } -void RS_Arc::moveEndpoint(const Vector & pos) +void Arc::moveEndpoint(const Vector & pos) { // polyline arcs: move point not angle: //if (parent!=NULL && parent->rtti()==RS2::EntityPolyline) { @@ -559,26 +559,26 @@ void RS_Arc::moveEndpoint(const Vector & pos) }*/ } -void RS_Arc::trimStartpoint(const Vector & pos) +void Arc::trimStartpoint(const Vector & pos) { data.angle1 = data.center.angleTo(pos); calculateEndpoints(); calculateBorders(); } -void RS_Arc::trimEndpoint(const Vector & pos) +void Arc::trimEndpoint(const Vector & pos) { data.angle2 = data.center.angleTo(pos); calculateEndpoints(); calculateBorders(); } -RS2::Ending RS_Arc::getTrimPoint(const Vector & coord, const Vector & trimPoint) +RS2::Ending Arc::getTrimPoint(const Vector & coord, const Vector & trimPoint) { double angEl = data.center.angleTo(trimPoint); double angM = data.center.angleTo(coord); - if (RS_Math::getAngleDifference(angM, angEl) > M_PI) + if (Math::getAngleDifference(angM, angEl) > M_PI) { if (data.reversed) return RS2::EndingEnd; @@ -594,7 +594,7 @@ RS2::Ending RS_Arc::getTrimPoint(const Vector & coord, const Vector & trimPoint) } } -void RS_Arc::reverse() +void Arc::reverse() { double a = data.angle1; data.angle1 = data.angle2; @@ -604,25 +604,25 @@ void RS_Arc::reverse() calculateBorders(); } -void RS_Arc::move(Vector offset) +void Arc::move(Vector offset) { data.center.move(offset); calculateEndpoints(); calculateBorders(); } -void RS_Arc::rotate(Vector center, double angle) +void Arc::rotate(Vector center, double angle) { - RS_DEBUG->print("RS_Arc::rotate"); + DEBUG->print("Arc::rotate"); data.center.rotate(center, angle); - data.angle1 = RS_Math::correctAngle(data.angle1 + angle); - data.angle2 = RS_Math::correctAngle(data.angle2 + angle); + data.angle1 = Math::correctAngle(data.angle1 + angle); + data.angle2 = Math::correctAngle(data.angle2 + angle); calculateEndpoints(); calculateBorders(); - RS_DEBUG->print("RS_Arc::rotate: OK"); + DEBUG->print("Arc::rotate: OK"); } -void RS_Arc::scale(Vector center, Vector factor) +void Arc::scale(Vector center, Vector factor) { // negative scaling: mirroring if (factor.x < 0.0) @@ -643,7 +643,7 @@ void RS_Arc::scale(Vector center, Vector factor) calculateBorders(); } -void RS_Arc::mirror(Vector axisPoint1, Vector axisPoint2) +void Arc::mirror(Vector axisPoint1, Vector axisPoint2) { data.center.mirror(axisPoint1, axisPoint2); data.reversed = (!data.reversed); @@ -668,7 +668,7 @@ void RS_Arc::mirror(Vector axisPoint1, Vector axisPoint2) calculateBorders(); } -void RS_Arc::moveRef(const Vector & ref, const Vector & offset) +void Arc::moveRef(const Vector & ref, const Vector & offset) { if (ref.distanceTo(startpoint) < 1.0e-4) moveStartpoint(startpoint + offset); @@ -678,7 +678,7 @@ void RS_Arc::moveRef(const Vector & ref, const Vector & offset) moveEndpoint(endpoint + offset); } -void RS_Arc::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Arc::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { if (getMin().isInWindow(firstCorner, secondCorner) && getMax().isInWindow(firstCorner, secondCorner)) @@ -697,7 +697,7 @@ void RS_Arc::stretch(Vector firstCorner, Vector secondCorner, Vector offset) } } -void RS_Arc::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Arc::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (painter == NULL || view == NULL) return; @@ -727,7 +727,7 @@ void RS_Arc::draw(PaintInterface * painter, GraphicView * view, double /*pattern } // Pattern: - RS_LineTypePattern * pat; + LineTypePattern * pat; if (isSelected()) pat = &patternSelected; @@ -741,7 +741,7 @@ void RS_Arc::draw(PaintInterface * painter, GraphicView * view, double /*pattern return; // Pen to draw pattern is always solid: - RS_Pen pen = painter->getPen(); + Pen pen = painter->getPen(); pen.setLineType(RS2::SolidLine); painter->setPen(pen); @@ -812,7 +812,7 @@ void RS_Arc::draw(PaintInterface * painter, GraphicView * view, double /*pattern /** * @return Middle point of the entity. */ -Vector RS_Arc::getMiddlepoint() const +Vector Arc::getMiddlepoint() const { double a; Vector ret; @@ -830,7 +830,7 @@ Vector RS_Arc::getMiddlepoint() const /** * @return Angle length in rad. */ -double RS_Arc::getAngleLength() const +double Arc::getAngleLength() const { double ret = 0.0; @@ -859,7 +859,7 @@ double RS_Arc::getAngleLength() const /** * @return Length of the arc. */ -double RS_Arc::getLength() +double Arc::getLength() { return getAngleLength() * data.radius; } @@ -867,7 +867,7 @@ double RS_Arc::getLength() /** * Gets the arc's bulge (tangens of angle length divided by 4). */ -double RS_Arc::getBulge() const +double Arc::getBulge() const { double bulge = tan(fabs(getAngleLength()) / 4.0); @@ -879,7 +879,7 @@ double RS_Arc::getBulge() const /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Arc & a) +std::ostream & operator<<(std::ostream & os, const Arc & a) { os << " Arc: " << a.data << "\n"; return os; diff --git a/src/base/arc.h b/src/base/arc.h index 1db003a..2c785c6 100644 --- a/src/base/arc.h +++ b/src/base/arc.h @@ -9,14 +9,14 @@ class GraphicView; /** * Holds the data that defines an arc. */ -class RS_ArcData +class ArcData { public: - RS_ArcData() + ArcData() { } - RS_ArcData(const Vector & center, double radius, double angle1, double angle2, bool reversed) + ArcData(const Vector & center, double radius, double angle1, double angle2, bool reversed) { this->center = center; this->radius = radius; @@ -40,7 +40,7 @@ class RS_ArcData && fabs(angle1 - angle2) > RS_TOLERANCE_ANGLE); } - friend std::ostream & operator<<(std::ostream & os, const RS_ArcData & ad) + friend std::ostream & operator<<(std::ostream & os, const ArcData & ad) { os << "(" << ad.center << "/" << ad.radius @@ -63,18 +63,18 @@ class RS_ArcData * * @author Andrew Mustun */ -class RS_Arc: public RS_AtomicEntity +class Arc: public AtomicEntity { public: - RS_Arc(RS_EntityContainer * parent, const RS_ArcData & d); - virtual ~RS_Arc(); + Arc(EntityContainer * parent, const ArcData & d); + virtual ~Arc(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual bool isEdge() const; - RS_ArcData getData() const; + ArcData getData() const; virtual VectorSolutions getRefPoints(); - void setData(RS_ArcData d); + void setData(ArcData d); Vector getCenter() const; void setCenter(const Vector & c); double getRadius() const; @@ -105,13 +105,13 @@ class RS_Arc: public RS_AtomicEntity bool createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge); 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 getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, 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 Vector getNearestDist(double distance, bool startp); - virtual double getDistanceToPoint(const Vector & coord, RS_Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); + virtual double getDistanceToPoint(const Vector & coord, 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); @@ -121,13 +121,13 @@ class RS_Arc: public RS_AtomicEntity virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Arc & a); + friend std::ostream & operator<<(std::ostream & os, const Arc & a); virtual void calculateEndpoints(); virtual void calculateBorders(); protected: - RS_ArcData data; + ArcData data; /** * Startpoint. This is redundant but stored for performance diff --git a/src/base/atomicentity.cpp b/src/base/atomicentity.cpp index 7e215d2..ee164c0 100644 --- a/src/base/atomicentity.cpp +++ b/src/base/atomicentity.cpp @@ -19,14 +19,14 @@ /** * Construtor. */ -RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Entity(parent) +AtomicEntity::AtomicEntity(EntityContainer * parent/*= NULL*/): Entity(parent) { } /** * Destrutor. */ -/*virtual*/ RS_AtomicEntity::~RS_AtomicEntity() +/*virtual*/ AtomicEntity::~AtomicEntity() { } @@ -34,7 +34,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti * @return false because entities made from subclasses are * atomic entities. */ -/*virtual*/ bool RS_AtomicEntity::isContainer() const +/*virtual*/ bool AtomicEntity::isContainer() const { return false; } @@ -43,7 +43,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti * @return true because entities made from subclasses are * atomic entities. */ -/*virtual*/ bool RS_AtomicEntity::isAtomic() const +/*virtual*/ bool AtomicEntity::isAtomic() const { return true; } @@ -51,7 +51,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * @return Always 1 for atomic entities. */ -/*virtual*/ unsigned long int RS_AtomicEntity::count() +/*virtual*/ unsigned long int AtomicEntity::count() { return 1; } @@ -59,7 +59,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * @return Always 1 for atomic entities. */ -/*virtual*/ unsigned long int RS_AtomicEntity::countDeep() +/*virtual*/ unsigned long int AtomicEntity::countDeep() { return 1; } @@ -68,7 +68,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti * Implementation must return the endpoint of the entity or * an invalid vector if the entity has no endpoint. */ -/*virtual*/ Vector RS_AtomicEntity::getEndpoint() const +/*virtual*/ Vector AtomicEntity::getEndpoint() const { return Vector(false); } @@ -77,7 +77,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti * Implementation must return the startpoint of the entity or * an invalid vector if the entity has no startpoint. */ -/*virtual*/ Vector RS_AtomicEntity::getStartpoint() const +/*virtual*/ Vector AtomicEntity::getStartpoint() const { return Vector(false); } @@ -85,7 +85,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * Implementation must return the angle in which direction the entity starts. */ -/*virtual*/ double RS_AtomicEntity::getDirection1() const +/*virtual*/ double AtomicEntity::getDirection1() const { return 0.0; } @@ -93,7 +93,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * Implementation must return the angle in which direction the entity starts the opposite way. */ -/*virtual*/ double RS_AtomicEntity::getDirection2() const +/*virtual*/ double AtomicEntity::getDirection2() const { return 0.0; } @@ -101,7 +101,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * (De-)selects startpoint. */ -/*virtual*/ void RS_AtomicEntity::setStartpointSelected(bool select) +/*virtual*/ void AtomicEntity::setStartpointSelected(bool select) { if (select) setFlag(RS2::FlagSelected1); @@ -112,7 +112,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * (De-)selects endpoint. */ -/*virtual*/ void RS_AtomicEntity::setEndpointSelected(bool select) +/*virtual*/ void AtomicEntity::setEndpointSelected(bool select) { if (select) setFlag(RS2::FlagSelected2); @@ -123,7 +123,7 @@ RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Enti /** * @return True if the entities startpoint is selected. */ -bool RS_AtomicEntity::isStartpointSelected() const +bool AtomicEntity::isStartpointSelected() const { return getFlag(RS2::FlagSelected1); } @@ -131,7 +131,7 @@ bool RS_AtomicEntity::isStartpointSelected() const /** * @return True if the entities endpoint is selected. */ -bool RS_AtomicEntity::isEndpointSelected() const +bool AtomicEntity::isEndpointSelected() const { return getFlag(RS2::FlagSelected2); } @@ -140,7 +140,7 @@ bool RS_AtomicEntity::isEndpointSelected() const * Implementation must move the startpoint of the entity to * the given position. */ -/*virtual*/ void RS_AtomicEntity::moveStartpoint(const Vector & /*pos*/) +/*virtual*/ void AtomicEntity::moveStartpoint(const Vector & /*pos*/) { } @@ -148,7 +148,7 @@ bool RS_AtomicEntity::isEndpointSelected() const * Implementation must move the endpoint of the entity to * the given position. */ -/*virtual*/ void RS_AtomicEntity::moveEndpoint(const Vector & /*pos*/) +/*virtual*/ void AtomicEntity::moveEndpoint(const Vector & /*pos*/) { } @@ -156,7 +156,7 @@ bool RS_AtomicEntity::isEndpointSelected() const * Implementation must trim the startpoint of the entity to * the given position. */ -/*virtual*/ void RS_AtomicEntity::trimStartpoint(const Vector & pos) +/*virtual*/ void AtomicEntity::trimStartpoint(const Vector & pos) { moveStartpoint(pos); } @@ -165,7 +165,7 @@ bool RS_AtomicEntity::isEndpointSelected() const * Implementation must trim the endpoint of the entity to * the given position. */ -/*virtual*/ void RS_AtomicEntity::trimEndpoint(const Vector & pos) +/*virtual*/ void AtomicEntity::trimEndpoint(const Vector & pos) { moveEndpoint(pos); } @@ -176,16 +176,16 @@ bool RS_AtomicEntity::isEndpointSelected() const * trim entity and 'trimPoint' is the point to which the entity will * be trimmed. */ -/*virtual*/ RS2::Ending RS_AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/) +/*virtual*/ RS2::Ending AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/) { return RS2::EndingNone; } -/*virtual*/ void RS_AtomicEntity::reverse() +/*virtual*/ void AtomicEntity::reverse() { } -/*virtual*/ void RS_AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset) +/*virtual*/ void AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset) { if (isSelected()) moveRef(ref, offset); diff --git a/src/base/atomicentity.h b/src/base/atomicentity.h index fb5000a..368987a 100644 --- a/src/base/atomicentity.h +++ b/src/base/atomicentity.h @@ -9,11 +9,11 @@ * * @author Andrew Mustun */ -class RS_AtomicEntity: public RS_Entity +class AtomicEntity: public Entity { public: - RS_AtomicEntity(RS_EntityContainer * parent = NULL); - virtual ~RS_AtomicEntity(); + AtomicEntity(EntityContainer * parent = NULL); + virtual ~AtomicEntity(); virtual bool isContainer() const; virtual bool isAtomic() const; virtual unsigned long int count(); diff --git a/src/base/block.cpp b/src/base/block.cpp index 9d520fb..967e7e5 100644 --- a/src/base/block.cpp +++ b/src/base/block.cpp @@ -24,19 +24,19 @@ * @param name The name of the block used as an identifier. * @param basePoint Base point (offset) of the block. */ -RS_Block::RS_Block(RS_EntityContainer * parent, const RS_BlockData & d): - RS_Document(parent), data(d) +Block::Block(EntityContainer * parent, const BlockData & d): + Document(parent), data(d) { - pen = RS_Pen(RS_Color(128, 128, 128), RS2::Width01, RS2::SolidLine); + pen = Pen(Color(128, 128, 128), RS2::Width01, RS2::SolidLine); } -RS_Block::~RS_Block() +Block::~Block() { } -RS_Entity * RS_Block::clone() +Entity * Block::clone() { - RS_Block * blk = new RS_Block(*this); + Block * blk = new Block(*this); #warning "!!! Need to port setAutoDelete() behaviour from Qt3 to Qt4 !!!" // blk->entities.setAutoDelete(entities.autoDelete()); blk->detach(); @@ -44,41 +44,41 @@ RS_Entity * RS_Block::clone() return blk; } -RS_LayerList * RS_Block::getLayerList() +LayerList * Block::getLayerList() { Drawing * g = getGraphic(); - if (g != NULL) + if (g) return g->getLayerList(); return NULL; } -RS_BlockList * RS_Block::getBlockList() +BlockList * Block::getBlockList() { Drawing * g = getGraphic(); - if (g != NULL) + if (g) return g->getBlockList(); return NULL; } -bool RS_Block::save() +bool Block::save() { Drawing * g = getGraphic(); - if (g != NULL) + if (g) return g->save(); return false; } -bool RS_Block::saveAs(const QString & filename, RS2::FormatType type) +bool Block::saveAs(const QString & filename, RS2::FormatType type) { Drawing * g = getGraphic(); - if (g != NULL) + if (g) return g->saveAs(filename, type); return false; @@ -87,7 +87,7 @@ bool RS_Block::saveAs(const QString & filename, RS2::FormatType type) /** * Sets the parent documents modified status to 'm'. */ -void RS_Block::setModified(bool m) +void Block::setModified(bool m) { Drawing * p = getGraphic(); @@ -98,7 +98,7 @@ void RS_Block::setModified(bool m) } /** @return RS2::EntityBlock */ -/*virtual*/ RS2::EntityType RS_Block::rtti() const +/*virtual*/ RS2::EntityType Block::rtti() const { return RS2::EntityBlock; } @@ -106,7 +106,7 @@ void RS_Block::setModified(bool m) /** * @return Name of this block (the name is an Id for this block). */ -QString RS_Block::getName() const +QString Block::getName() const { return data.name; } @@ -114,32 +114,32 @@ QString RS_Block::getName() const /** * @return base point of this block. */ -Vector RS_Block::getBasePoint() const +Vector Block::getBasePoint() const { return data.basePoint; } /** - * Reimplementation from RS_Document. Does nothing. + * Reimplementation from Document. Does nothing. */ -/*virtual*/ void RS_Block::newDoc() +/*virtual*/ void Block::newDoc() { // do nothing } /** - * Reimplementation from RS_Document. Does nothing. + * Reimplementation from Document. Does nothing. */ -/*virtual*/ bool RS_Block::open(const QString &, RS2::FormatType) +/*virtual*/ bool Block::open(const QString &, RS2::FormatType) { // do nothing return false; } -/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Block & b) +/*friend*/ std::ostream & operator<<(std::ostream & os, const Block & b) { os << " name: " << b.getName().toLatin1().data() << std::endl; - os << " entities: " << (RS_EntityContainer &)b << std::endl; + os << " entities: " << (EntityContainer &)b << std::endl; return os; } @@ -147,7 +147,7 @@ Vector RS_Block::getBasePoint() const * sets a new name for the block. Only called by blocklist to * assure that block names stay unique. */ -void RS_Block::setName(const QString & n) +void Block::setName(const QString & n) { data.name = n; } @@ -156,7 +156,7 @@ void RS_Block::setName(const QString & n) * @retval true if this block is frozen (invisible) * @retval false if this block isn't frozen (visible) */ -bool RS_Block::isFrozen() const +bool Block::isFrozen() const { return data.frozen; } @@ -165,7 +165,7 @@ bool RS_Block::isFrozen() const * Toggles the visibility of this block. * Freezes the block if it's not frozen, thaws the block otherwise */ -void RS_Block::toggle() +void Block::toggle() { data.frozen = !data.frozen; } @@ -175,7 +175,7 @@ void RS_Block::toggle() * * @param freeze true: freeze, false: defreeze */ -void RS_Block::freeze(bool freeze) +void Block::freeze(bool freeze) { data.frozen = freeze; } diff --git a/src/base/block.h b/src/base/block.h index ceed443..c016d0e 100644 --- a/src/base/block.h +++ b/src/base/block.h @@ -7,12 +7,12 @@ /** * Holds the data that defines a block. */ -class RS_BlockData +class BlockData { public: - RS_BlockData() {} + BlockData() {} - RS_BlockData(const QString & name1, const Vector & basePoint1, bool frozen1): + BlockData(const QString & name1, const Vector & basePoint1, bool frozen1): name(name1), basePoint(basePoint1), frozen(frozen1) {} bool isValid() @@ -40,32 +40,32 @@ class RS_BlockData * block. Note that although technically possible, a block should * never be part of the entity tree of a graphic. Blocks are * stored in a seperate list inside the graphic document (a block list). - * The graphic can contain RS_Insert entities that refer to such + * The graphic can contain Insert entities that refer to such * blocks. * * blocks are documents and can therefore be handled by graphic views. * * @author Andrew Mustun */ -class RS_Block: public RS_Document +class Block: public Document { - friend class RS_BlockList; + friend class BlockList; public: - RS_Block(RS_EntityContainer * parent, const RS_BlockData & d); - virtual ~RS_Block(); + Block(EntityContainer * parent, const BlockData & d); + virtual ~Block(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; QString getName() const; Vector getBasePoint() const; - virtual RS_LayerList * getLayerList(); - virtual RS_BlockList * getBlockList(); + virtual LayerList * getLayerList(); + virtual BlockList * getBlockList(); virtual void newDoc(); virtual bool save(); virtual bool saveAs(const QString & filename, RS2::FormatType type); virtual bool open(const QString &, RS2::FormatType); - friend std::ostream & operator<<(std::ostream & os, const RS_Block & b); + friend std::ostream & operator<<(std::ostream & os, const Block & b); void setName(const QString & n); bool isFrozen() const; void toggle(); @@ -83,7 +83,7 @@ class RS_Block: public RS_Document */ //QString name; //! Block data - RS_BlockData data; + BlockData data; }; #endif diff --git a/src/base/blocklist.cpp b/src/base/blocklist.cpp index 9804547..31d8601 100644 --- a/src/base/blocklist.cpp +++ b/src/base/blocklist.cpp @@ -25,7 +25,7 @@ * If so, the blocks will be deleted when the block * list is deleted. */ -RS_BlockList::RS_BlockList(bool owner) +BlockList::BlockList(bool owner) { this->owner = owner; //blocks.setAutoDelete(owner); @@ -36,14 +36,14 @@ RS_BlockList::RS_BlockList(bool owner) setModified(false); } -/*virtual*/ RS_BlockList::~RS_BlockList() +/*virtual*/ BlockList::~BlockList() { } /** * Removes all blocks in the blocklist. */ -void RS_BlockList::clear() +void BlockList::clear() { blocks.clear(); setModified(true); @@ -52,7 +52,7 @@ void RS_BlockList::clear() /** * @return Number of blocks available. */ -uint RS_BlockList::count() +uint BlockList::count() { return blocks.count(); } @@ -60,7 +60,7 @@ uint RS_BlockList::count() /** * @return Block at given position or NULL if i is out of range. */ -RS_Block * RS_BlockList::at(uint i) +Block * BlockList::at(uint i) { return blocks.at(i); } @@ -69,9 +69,9 @@ RS_Block * RS_BlockList::at(uint i) * Activates the given block. * Listeners are notified. */ -void RS_BlockList::activate(const QString & name) +void BlockList::activate(const QString & name) { - RS_DEBUG->print("RS_BlockList::activateBlock"); + DEBUG->print("BlockList::activateBlock"); activate(find(name)); } @@ -80,14 +80,14 @@ void RS_BlockList::activate(const QString & name) * Activates the given block. * Listeners are notified. */ -void RS_BlockList::activate(RS_Block * block) +void BlockList::activate(Block * block) { - RS_DEBUG->print("RS_BlockList::activateBlock"); + DEBUG->print("BlockList::activateBlock"); activeBlock = block; /* for (uint i=0; iblockActivated(activeBlock); } @@ -96,7 +96,7 @@ void RS_BlockList::activate(RS_Block * block) } //! @return The active block of NULL if no block is activated. -RS_Block * RS_BlockList::getActive() +Block * BlockList::getActive() { return activeBlock; } @@ -110,15 +110,15 @@ RS_Block * RS_BlockList::getActive() * * @return false: block already existed and was deleted. */ -bool RS_BlockList::add(RS_Block * block, bool notify) +bool BlockList::add(Block * block, bool notify) { - RS_DEBUG->print("RS_BlockList::add()"); + DEBUG->print("BlockList::add()"); if (block == NULL) return false; // check if block already exists: - RS_Block * b = find(block->getName()); + Block * b = find(block->getName()); if (b == NULL) { @@ -148,12 +148,12 @@ bool RS_BlockList::add(RS_Block * block, bool notify) * used after adding a lot of blocks without auto-update or simply * to force an update of GUI blocklists. */ -void RS_BlockList::addNotification() +void BlockList::addNotification() { #if 0 for(int i=0; iblockAdded(NULL); } #endif @@ -164,9 +164,9 @@ void RS_BlockList::addNotification() * Listeners are notified after the block was removed from * the list but before it gets deleted. */ -void RS_BlockList::remove(RS_Block * block) +void BlockList::remove(Block * block) { - RS_DEBUG->print("RS_BlockList::removeBlock()"); + DEBUG->print("BlockList::removeBlock()"); // here the block is removed from the list but not deleted // blocks.remove(block); @@ -175,7 +175,7 @@ void RS_BlockList::remove(RS_Block * block) #if 0 for(int i=0; iblockRemoved(block); } #endif @@ -203,7 +203,7 @@ void RS_BlockList::remove(RS_Block * block) * @retval true block was successfully renamed. * @retval false block couldn't be renamed. */ -bool RS_BlockList::rename(RS_Block * block, const QString & name) +bool BlockList::rename(Block * block, const QString & name) { if (block != NULL) { @@ -224,11 +224,11 @@ bool RS_BlockList::rename(RS_Block * block, const QString & name) * Listeners are notified. */ /* -void RS_BlockList::editBlock(RS_Block* block, const RS_Block& source) { +void BlockList::editBlock(Block* block, const Block& source) { *block = source; for (uint i=0; iblockEdited(block); } @@ -239,13 +239,13 @@ void RS_BlockList::editBlock(RS_Block* block, const RS_Block& source) { * @return Pointer to the block with the given name or * \p NULL if no such block was found. */ -RS_Block * RS_BlockList::find(const QString & name) +Block * BlockList::find(const QString & name) { - //RS_DEBUG->print("RS_BlockList::find"); + //DEBUG->print("BlockList::find"); for(uint i=0; igetName() == name) return b; @@ -259,7 +259,7 @@ RS_Block * RS_BlockList::find(const QString & name) * * @param suggestion Suggested name the new name will be based on. */ -QString RS_BlockList::newName(const QString & suggestion) +QString BlockList::newName(const QString & suggestion) { QString name; @@ -278,7 +278,7 @@ QString RS_BlockList::newName(const QString & suggestion) * Switches on / off the given block. * Listeners are notified. */ -void RS_BlockList::toggle(const QString & name) +void BlockList::toggle(const QString & name) { toggle(find(name)); } @@ -287,7 +287,7 @@ void RS_BlockList::toggle(const QString & name) * Switches on / off the given block. * Listeners are notified. */ -void RS_BlockList::toggle(RS_Block * block) +void BlockList::toggle(Block * block) { if (block == NULL) return; @@ -298,7 +298,7 @@ void RS_BlockList::toggle(RS_Block * block) // Notify listeners: for(int i=0; iblockToggled(block); } @@ -310,7 +310,7 @@ void RS_BlockList::toggle(RS_Block * block) * * @param freeze true: freeze, false: defreeze */ -void RS_BlockList::freezeAll(bool freeze) +void BlockList::freezeAll(bool freeze) { for(uint l=0; lfreeze(freeze); @@ -318,7 +318,7 @@ void RS_BlockList::freezeAll(bool freeze) #if 0 for(int i=0; iblockToggled(NULL); } #endif @@ -329,13 +329,13 @@ void RS_BlockList::freezeAll(bool freeze) * Listeners are notified. */ /* -void RS_BlockList::toggleBlock(const QString& name) { - RS_Block* block = findBlock(name); +void BlockList::toggleBlock(const QString& name) { + Block* block = findBlock(name); block->toggle(); // Notify listeners: for (uint i=0; iblockToggled(block); } @@ -347,7 +347,7 @@ void RS_BlockList::toggleBlock(const QString& name) { * are notified when the block list changes. */ #if 0 -void RS_BlockList::addListener(RS_BlockListListener * listener) +void BlockList::addListener(BlockListListener * listener) { blockListListeners.append(listener); } @@ -355,7 +355,7 @@ void RS_BlockList::addListener(RS_BlockListListener * listener) /** * removes a BlockListListener from the list of listeners. */ -void RS_BlockList::removeListener(RS_BlockListListener * listener) +void BlockList::removeListener(BlockListListener * listener) { blockListListeners.removeAll(listener); } @@ -364,7 +364,7 @@ void RS_BlockList::removeListener(RS_BlockListListener * listener) /** * Sets the layer lists modified status to 'm'. */ -void RS_BlockList::setModified(bool m) +void BlockList::setModified(bool m) { modified = m; } @@ -373,7 +373,7 @@ void RS_BlockList::setModified(bool m) * @retval true The layer list has been modified. * @retval false The layer list has not been modified. */ -/*virtual*/ bool RS_BlockList::isModified() const +/*virtual*/ bool BlockList::isModified() const { return modified; } @@ -381,13 +381,13 @@ void RS_BlockList::setModified(bool m) /** * Dumps the blocks to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_BlockList & b) +std::ostream & operator<<(std::ostream & os, BlockList & b) { os << "Blocklist: \n"; for(uint i=0; i blocks; + QList blocks; //! List of registered BlockListListeners -// QList blockListListeners; +// QList blockListListeners; //! Currently active block - RS_Block * activeBlock; + Block * activeBlock; /** Flag set if the layer list was modified and not yet saved. */ bool modified; }; diff --git a/src/base/circle.cpp b/src/base/circle.cpp index dc66e34..9162a5a 100644 --- a/src/base/circle.cpp +++ b/src/base/circle.cpp @@ -26,42 +26,42 @@ /** * Default constructor. */ -RS_Circle::RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d): - RS_AtomicEntity(parent), data(d) +Circle::Circle(EntityContainer * parent, const CircleData & d): + AtomicEntity(parent), data(d) { calculateBorders(); } -/*virtual*/ RS_Circle::~RS_Circle() +/*virtual*/ Circle::~Circle() { } -/*virtual*/ RS_Entity * RS_Circle::clone() +/*virtual*/ Entity * Circle::clone() { - RS_Circle * c = new RS_Circle(*this); + Circle * c = new Circle(*this); c->initId(); return c; } /** @return RS2::EntityCircle */ -/*virtual*/ RS2::EntityType RS_Circle::rtti() const +/*virtual*/ RS2::EntityType Circle::rtti() const { return RS2::EntityCircle; } /** @return true */ -/*virtual*/ bool RS_Circle::isEdge() const +/*virtual*/ bool Circle::isEdge() const { return true; } /** @return Copy of data that defines the circle. **/ -RS_CircleData RS_Circle::getData() +CircleData Circle::getData() { return data; } -VectorSolutions RS_Circle::getRefPoints() +VectorSolutions Circle::getRefPoints() { Vector v1(data.radius, 0.0); Vector v2(0.0, data.radius); @@ -70,12 +70,12 @@ VectorSolutions RS_Circle::getRefPoints() return ret; } -/*virtual*/ Vector RS_Circle::getStartpoint() const +/*virtual*/ Vector Circle::getStartpoint() const { return data.center + Vector(data.radius, 0.0); } -/*virtual*/ Vector RS_Circle::getEndpoint() const +/*virtual*/ Vector Circle::getEndpoint() const { return data.center + Vector(data.radius, 0.0); } @@ -84,7 +84,7 @@ VectorSolutions RS_Circle::getRefPoints() * @return Direction 1. The angle at which the arc starts at * the startpoint. */ -double RS_Circle::getDirection1() const +double Circle::getDirection1() const { return M_PI / 2.0; } @@ -93,36 +93,36 @@ double RS_Circle::getDirection1() const * @return Direction 2. The angle at which the arc starts at * the endpoint. */ -double RS_Circle::getDirection2() const +double Circle::getDirection2() const { return M_PI / 2.0 * 3.0; } /** @return The center point (x) of this arc */ -Vector RS_Circle::getCenter() +Vector Circle::getCenter() { return data.center; } /** Sets new center. */ -void RS_Circle::setCenter(const Vector & c) +void Circle::setCenter(const Vector & c) { data.center = c; } /** @return The radius of this arc */ -double RS_Circle::getRadius() +double Circle::getRadius() { return data.radius; } /** Sets new radius. */ -void RS_Circle::setRadius(double r) +void Circle::setRadius(double r) { data.radius = r; } -void RS_Circle::calculateBorders() +void Circle::calculateBorders() { Vector r(data.radius, data.radius, 0.0); minV = data.center - r; @@ -132,7 +132,7 @@ void RS_Circle::calculateBorders() /** * @return Angle length in rad. */ -double RS_Circle::getAngleLength() const +double Circle::getAngleLength() const { return 2 * M_PI; } @@ -140,7 +140,7 @@ double RS_Circle::getAngleLength() const /** * @return Length of the circle which is the circumference. */ -double RS_Circle::getLength() +double Circle::getLength() { return 2 * M_PI * data.radius; } @@ -151,7 +151,7 @@ double RS_Circle::getLength() * @param c Center. * @param r Radius */ -bool RS_Circle::createFromCR(const Vector & c, double r) +bool Circle::createFromCR(const Vector & c, double r) { if (fabs(r) > RS_TOLERANCE) { @@ -161,7 +161,7 @@ bool RS_Circle::createFromCR(const Vector & c, double r) } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFromCR(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFromCR(): " "Cannot create a circle with radius 0.0."); return false; } @@ -173,7 +173,7 @@ bool RS_Circle::createFromCR(const Vector & c, double r) * @param p1 1st point. * @param p2 2nd point. */ -bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) +bool Circle::createFrom2P(const Vector & p1, const Vector & p2) { if (p1.distanceTo(p2) > RS_TOLERANCE) { @@ -183,7 +183,7 @@ bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom2P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom2P(): " "Cannot create a circle with radius 0.0."); return false; } @@ -196,7 +196,7 @@ bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) * @param p2 2nd point. * @param p3 3rd point. */ -bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) +bool Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) { if (p1.distanceTo(p2) > RS_TOLERANCE && p2.distanceTo(p3) > RS_TOLERANCE @@ -215,13 +215,13 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector a2 = p2.angleTo(p3) + M_PI / 2.0; dir2.setPolar(100.0, a2); - RS_ConstructionLineData d1(mp1, mp1 + dir1); - RS_ConstructionLineData d2(mp2, mp2 + dir2); - RS_ConstructionLine midLine1(NULL, d1); - RS_ConstructionLine midLine2(NULL, d2); + ConstructionLineData d1(mp1, mp1 + dir1); + ConstructionLineData d2(mp2, mp2 + dir2); + ConstructionLine midLine1(NULL, d1); + ConstructionLine midLine2(NULL, d2); VectorSolutions sol = - RS_Information::getIntersection(&midLine1, &midLine2); + Information::getIntersection(&midLine1, &midLine2); data.center = sol.get(0); data.radius = data.center.distanceTo(p3); @@ -230,14 +230,14 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector return true; else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): " "Cannot create a circle with inf radius."); return false; } } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): " "Cannot create a circle with radius 0.0."); return false; } @@ -246,14 +246,14 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector /** * @return Always an invalid vector. */ -Vector RS_Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist) +Vector Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, RS_Entity ** entity) +Vector Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, Entity ** entity) { Vector vec(false); @@ -270,33 +270,33 @@ Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity* return vec; } -Vector RS_Circle::getNearestCenter(const Vector & coord, double * dist) +Vector Circle::getNearestCenter(const Vector & coord, double * dist) { if (dist != NULL) *dist = coord.distanceTo(data.center); return data.center; } -Vector RS_Circle::getNearestMiddle(const Vector & /*coord*/, double * dist) +Vector Circle::getNearestMiddle(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) +Vector Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestDist(double /*distance*/, bool /*startp*/) +Vector Circle::getNearestDist(double /*distance*/, bool /*startp*/) { return Vector(false); } -double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double) +double Circle::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double) { if (entity != NULL) *entity = this; @@ -304,32 +304,32 @@ double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, return fabs((coord - data.center).magnitude() - data.radius); } -void RS_Circle::move(Vector offset) +void Circle::move(Vector offset) { data.center.move(offset); calculateBorders(); } -void RS_Circle::rotate(Vector center, double angle) +void Circle::rotate(Vector center, double angle) { data.center.rotate(center, angle); calculateBorders(); } -void RS_Circle::scale(Vector center, Vector factor) +void Circle::scale(Vector center, Vector factor) { data.center.scale(center, factor); data.radius *= factor.x; calculateBorders(); } -void RS_Circle::mirror(Vector axisPoint1, Vector axisPoint2) +void Circle::mirror(Vector axisPoint1, Vector axisPoint2) { data.center.mirror(axisPoint1, axisPoint2); calculateBorders(); } -void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (painter == NULL || view == NULL) return; @@ -357,7 +357,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt } // Pattern: - RS_LineTypePattern * pat; + LineTypePattern * pat; if (isSelected()) pat = &patternSelected; @@ -371,7 +371,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt return; // Pen to draw pattern is always solid: - RS_Pen pen = painter->getPen(); + Pen pen = painter->getPen(); pen.setLineType(RS2::SolidLine); painter->setPen(pen); @@ -425,7 +425,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt } } -void RS_Circle::moveRef(const Vector & ref, const Vector & offset) +void Circle::moveRef(const Vector & ref, const Vector & offset) { Vector v1(data.radius, 0.0); Vector v2(0.0, data.radius); @@ -443,9 +443,8 @@ void RS_Circle::moveRef(const Vector & ref, const Vector & offset) /** * Dumps the circle's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Circle & a) +std::ostream & operator<<(std::ostream & os, const Circle & a) { os << " Circle: " << a.data << "\n"; return os; } - diff --git a/src/base/circle.h b/src/base/circle.h index 8edd3ea..99cedd6 100644 --- a/src/base/circle.h +++ b/src/base/circle.h @@ -6,14 +6,14 @@ /** * Holds the data that defines a circle. */ -class RS_CircleData +class CircleData { public: - RS_CircleData() + CircleData() { } - RS_CircleData(const Vector & center, double radius) + CircleData(const Vector & center, double radius) { this->center = center; this->radius = radius; @@ -30,9 +30,9 @@ class RS_CircleData return (center.valid && radius > RS_TOLERANCE); } - friend class RS_Circle; + friend class Circle; - friend std::ostream & operator<<(std::ostream & os, const RS_CircleData & ad) + friend std::ostream & operator<<(std::ostream & os, const CircleData & ad) { os << "(" << ad.center << "/" << ad.radius << ")"; return os; @@ -48,16 +48,16 @@ class RS_CircleData * * @author Andrew Mustun */ -class RS_Circle: public RS_AtomicEntity +class Circle: public AtomicEntity { public: - RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d); - virtual ~RS_Circle(); + Circle(EntityContainer * parent, const CircleData & d); + virtual ~Circle(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual bool isEdge() const; - RS_CircleData getData(); + CircleData getData(); virtual VectorSolutions getRefPoints(); virtual Vector getStartpoint() const; virtual Vector getEndpoint() const; @@ -75,12 +75,12 @@ class RS_Circle: public RS_AtomicEntity bool createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3); 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); + double * dist = NULL, 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 Vector getNearestDist(double distance, bool startp); - virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); + virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual void move(Vector offset); virtual void rotate(Vector center, double angle); @@ -89,12 +89,12 @@ class RS_Circle: public RS_AtomicEntity virtual void moveRef(const Vector & ref, const Vector & offset); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Circle & a); + friend std::ostream & operator<<(std::ostream & os, const Circle & a); virtual void calculateBorders(); protected: - RS_CircleData data; + CircleData data; }; #endif diff --git a/src/base/clipboard.cpp b/src/base/clipboard.cpp index 783951e..943781a 100644 --- a/src/base/clipboard.cpp +++ b/src/base/clipboard.cpp @@ -12,69 +12,122 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/28/2010 Added this text. :-) +// JLH 09/09/2010 Removed implementation from header (where it DOESN'T +// belong) and moved it here (where it DOES) // #include "clipboard.h" + #include "block.h" #include "layer.h" #include "entity.h" -RS_Clipboard* RS_Clipboard::uniqueInstance = NULL; - - +Clipboard * Clipboard::uniqueInstance = NULL; -void RS_Clipboard::clear() { +void Clipboard::clear() +{ graphic.clear(); graphic.clearBlocks(); graphic.clearLayers(); graphic.clearVariables(); } +void Clipboard::addBlock(Block * b) +{ + if (b) + graphic.addBlock(b, false); +} +bool Clipboard::hasBlock(const QString & name) +{ + return (graphic.findBlock(name) != NULL); +} +void Clipboard::addLayer(Layer * l) +{ + if (l) + graphic.addLayer(l); +} +bool Clipboard::hasLayer(const QString & name) +{ + return (graphic.findLayer(name) != NULL); +} -void RS_Clipboard::addBlock(RS_Block* b) { - if (b!=NULL) { - graphic.addBlock(b, false); +void Clipboard::addEntity(Entity * e) +{ + if (e) + { + graphic.addEntity(e); + e->reparent(&graphic); } } +/** + * Dumps the clipboard contents to stdout. + */ +std::ostream & operator<<(std::ostream & os, Clipboard & cb) +{ + os << "Clipboard: " << cb.graphic << "\n"; + return os; +} -bool RS_Clipboard::hasBlock(const QString& name) { - return (graphic.findBlock(name)!=NULL); +Clipboard::Clipboard() +{ } +/** + * @return Instance to the unique clipboard object. + */ +/*static*/ Clipboard * Clipboard::instance() +{ + if (uniqueInstance == NULL) + uniqueInstance = new Clipboard(); -void RS_Clipboard::addLayer(RS_Layer* l) { - if (l!=NULL) { - //graphic.addLayer(l->clone()); - graphic.addLayer(l); - } + return uniqueInstance; } +int Clipboard::countBlocks() +{ + return graphic.countBlocks(); +} +Block * Clipboard::blockAt(int i) +{ + return graphic.blockAt(i); +} -bool RS_Clipboard::hasLayer(const QString& name) { - return (graphic.findLayer(name)!=NULL); +int Clipboard::countLayers() +{ + return graphic.countLayers(); } +Layer * Clipboard::layerAt(int i) +{ + return graphic.layerAt(i); +} +uint Clipboard::count() +{ + return graphic.count(); +} -void RS_Clipboard::addEntity(RS_Entity* e) { - if (e!=NULL) { - //graphic.addEntity(e->clone()); - graphic.addEntity(e); - e->reparent(&graphic); - } +Entity * Clipboard::entityAt(uint i) +{ + return graphic.entityAt(i); } -/** - * Dumps the clipboard contents to stdout. - */ -std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) { - os << "Clipboard: " << cb.graphic << "\n"; +Entity * Clipboard::firstEntity() +{ + return graphic.firstEntity(); +} - return os; +Entity * Clipboard::nextEntity() +{ + return graphic.nextEntity(); } +Drawing * Clipboard::getGraphic() +{ + return &graphic; +} diff --git a/src/base/clipboard.h b/src/base/clipboard.h index 247d07b..22d0027 100644 --- a/src/base/clipboard.h +++ b/src/base/clipboard.h @@ -4,82 +4,49 @@ #include #include "drawing.h" -#define RS_CLIPBOARD RS_Clipboard::instance() +#define CLIPBOARD Clipboard::instance() -class RS_Block; -class RS_Layer; -class RS_Entity; +class Block; +class Layer; +class Entity; /** * QCad internal clipboard. We don't use the system clipboard for - * better portaility. - * Implemented as singleton. + * better portability. Implemented as singleton. * + * @author James Hammons * @author Andrew Mustun */ -class RS_Clipboard { -protected: - RS_Clipboard() { - } - -public: - /** - * @return Instance to the unique clipboard object. - */ - static RS_Clipboard* instance() { - if (uniqueInstance==NULL) { - uniqueInstance = new RS_Clipboard(); - } - return uniqueInstance; - } - - void clear(); - - void addBlock(RS_Block* b); - bool hasBlock(const QString& name); - int countBlocks() { - return graphic.countBlocks(); - } - RS_Block* blockAt(int i) { - return graphic.blockAt(i); - } - - void addLayer(RS_Layer* l); - bool hasLayer(const QString& name); - int countLayers() { - return graphic.countLayers(); - } - RS_Layer* layerAt(int i) { - return graphic.layerAt(i); - } - - void addEntity(RS_Entity* e); - - uint count() { - return graphic.count(); - } - RS_Entity* entityAt(uint i) { - return graphic.entityAt(i); - } - RS_Entity* firstEntity() { - return graphic.firstEntity(); - } - - RS_Entity* nextEntity() { - return graphic.nextEntity(); - } - - Drawing* getGraphic() { - return &graphic; - } - - friend std::ostream& operator << (std::ostream& os, RS_Clipboard& cb); - -protected: - static RS_Clipboard* uniqueInstance; - - Drawing graphic; +class Clipboard +{ + protected: + Clipboard(); + + public: + static Clipboard * instance(); + + void clear(); + void addBlock(Block * b); + bool hasBlock(const QString & name); + int countBlocks(); + Block * blockAt(int i); + void addLayer(Layer* l); + bool hasLayer(const QString & name); + int countLayers(); + Layer * layerAt(int i); + void addEntity(Entity * e); + uint count(); + Entity * entityAt(uint i); + Entity * firstEntity(); + Entity * nextEntity(); + Drawing * getGraphic(); + + friend std::ostream & operator<<(std::ostream & os, Clipboard & cb); + + protected: + static Clipboard * uniqueInstance; + + Drawing graphic; }; #endif - diff --git a/src/base/color.cpp b/src/base/color.cpp index 82d8a1f..7e049ca 100644 --- a/src/base/color.cpp +++ b/src/base/color.cpp @@ -16,48 +16,48 @@ #include "color.h" -#include "rs.h" +#include "enums.h" -RS_Color::RS_Color(): QColor(), RS_Flags() +Color::Color(): QColor(), Flags() { } -RS_Color::RS_Color(int r, int g, int b): QColor(r, g, b), RS_Flags() +Color::Color(int r, int g, int b): QColor(r, g, b), Flags() { } -RS_Color::RS_Color(const QColor & c): QColor(c), RS_Flags() +Color::Color(const QColor & c): QColor(c), Flags() { } -RS_Color::RS_Color(const RS_Color & c): QColor(c), RS_Flags() +Color::Color(const Color & c): QColor(c), Flags() { setFlags(c.getFlags()); } -RS_Color::RS_Color(unsigned int f): QColor(), RS_Flags(f) +Color::Color(unsigned int f): QColor(), Flags(f) { } /** @return A copy of this color without flags. */ -RS_Color RS_Color::stripFlags() const +Color Color::stripFlags() const { - return RS_Color(red(), green(), blue()); + return Color(red(), green(), blue()); } /** @return true if the color is defined by layer. */ -bool RS_Color::isByLayer() const +bool Color::isByLayer() const { return getFlag(RS2::FlagByLayer); } /** @return true if the color is defined by block. */ -bool RS_Color::isByBlock() const +bool Color::isByBlock() const { return getFlag(RS2::FlagByBlock); } -RS_Color & RS_Color::operator=(const RS_Color & c) +Color & Color::operator=(const Color & c) { setRgb(c.red(), c.green(), c.blue()); setFlags(c.getFlags()); @@ -65,20 +65,20 @@ RS_Color & RS_Color::operator=(const RS_Color & c) return *this; } -bool RS_Color::operator==(const RS_Color & c) const +bool Color::operator==(const Color & c) const { return (red() == c.red() && green() == c.green() && blue() == c.blue() && getFlags() == c.getFlags()); } #if 0 -bool RS_Color::operator==(const QColor & c) const +bool Color::operator==(const QColor & c) const { return (red() == c.red() && green() == c.green() && blue() == c.blue()); } #endif -/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Color & c) +/*friend*/ std::ostream & operator<<(std::ostream & os, const Color & c) { os << " color: " << c.name().toLatin1().data() << " flags: " << (c.getFlag(RS2::FlagByLayer) ? "RS2::FlagByLayer " : "") diff --git a/src/base/color.h b/src/base/color.h index d07f48d..9a5f7b3 100644 --- a/src/base/color.h +++ b/src/base/color.h @@ -14,22 +14,22 @@ * * @author Andrew Mustun */ -class RS_Color: public QColor, public RS_Flags +class Color: public QColor, public Flags { public: - RS_Color(); - RS_Color(int r, int g, int b); - RS_Color(const QColor & c); - RS_Color(const RS_Color & c); - RS_Color(unsigned int f); + Color(); + Color(int r, int g, int b); + Color(const QColor & c); + Color(const Color & c); + Color(unsigned int f); - RS_Color stripFlags() const; + Color stripFlags() const; bool isByLayer() const; bool isByBlock() const; - RS_Color & operator=(const RS_Color & c); - bool operator==(const RS_Color & c) const; + Color & operator=(const Color & c); + bool operator==(const Color & c) const; //no,can't bool operator==(const QColor & c) const; - friend std::ostream & operator<<(std::ostream & os, const RS_Color & c); + friend std::ostream & operator<<(std::ostream & os, const Color & c); }; #endif diff --git a/src/base/commandevent.cpp b/src/base/commandevent.cpp index c1b33b3..f88aeb1 100644 --- a/src/base/commandevent.cpp +++ b/src/base/commandevent.cpp @@ -22,7 +22,7 @@ * * @param cmd the command that was triggered. */ -RS_CommandEvent::RS_CommandEvent(const QString & cmd) +CommandEvent::CommandEvent(const QString & cmd) { this->cmd = cmd; accepted = false; @@ -32,7 +32,7 @@ RS_CommandEvent::RS_CommandEvent(const QString & cmd) * @return the command that was triggered, usually by * the user. */ -QString RS_CommandEvent::getCommand() +QString CommandEvent::getCommand() { return cmd; } @@ -40,7 +40,7 @@ QString RS_CommandEvent::getCommand() /** * Sets the event state to accepted. */ -void RS_CommandEvent::accept() +void CommandEvent::accept() { accepted = true; } @@ -48,7 +48,7 @@ void RS_CommandEvent::accept() /** * @return Whether the event was already accepted or not. */ -bool RS_CommandEvent::isAccepted() +bool CommandEvent::isAccepted() { return accepted; } diff --git a/src/base/commandevent.h b/src/base/commandevent.h index 0eaefd5..dced82a 100644 --- a/src/base/commandevent.h +++ b/src/base/commandevent.h @@ -6,10 +6,10 @@ /** * Command Events. */ -class RS_CommandEvent +class CommandEvent { public: - RS_CommandEvent(const QString & cmd); + CommandEvent(const QString & cmd); QString getCommand(); void accept(); diff --git a/src/base/constructionline.cpp b/src/base/constructionline.cpp index 877a64d..923fca2 100644 --- a/src/base/constructionline.cpp +++ b/src/base/constructionline.cpp @@ -22,8 +22,8 @@ /** * Constructor. */ -RS_ConstructionLine::RS_ConstructionLine(RS_EntityContainer * parent, - const RS_ConstructionLineData & d): RS_AtomicEntity(parent), data(d) +ConstructionLine::ConstructionLine(EntityContainer * parent, + const ConstructionLineData & d): AtomicEntity(parent), data(d) { calculateBorders(); } @@ -31,19 +31,19 @@ RS_ConstructionLine::RS_ConstructionLine(RS_EntityContainer * parent, /** * Destructor. */ -RS_ConstructionLine::~RS_ConstructionLine() +ConstructionLine::~ConstructionLine() { } -RS_Entity * RS_ConstructionLine::clone() +Entity * ConstructionLine::clone() { - RS_ConstructionLine * c = new RS_ConstructionLine(*this); + ConstructionLine * c = new ConstructionLine(*this); c->initId(); return c; } /** @return RS2::EntityConstructionLine */ -/*virtual*/ RS2::EntityType RS_ConstructionLine::rtti() const +/*virtual*/ RS2::EntityType ConstructionLine::rtti() const { return RS2::EntityConstructionLine; } @@ -52,7 +52,7 @@ RS_Entity * RS_ConstructionLine::clone() * @todo * @return Start point of the entity. */ -/*virtual*/ Vector RS_ConstructionLine::getStartpoint() const +/*virtual*/ Vector ConstructionLine::getStartpoint() const { return Vector(false); } @@ -61,35 +61,35 @@ RS_Entity * RS_ConstructionLine::clone() * @todo * @return End point of the entity. */ -/*virtual*/ Vector RS_ConstructionLine::getEndpoint() const +/*virtual*/ Vector ConstructionLine::getEndpoint() const { return Vector(false); } /** @return Copy of data that defines the line. */ -RS_ConstructionLineData RS_ConstructionLine::getData() const +ConstructionLineData ConstructionLine::getData() const { return data; } /** @return First definition point. */ -Vector RS_ConstructionLine::getPoint1() const +Vector ConstructionLine::getPoint1() const { return data.point1; } /** @return Second definition point. */ -Vector RS_ConstructionLine::getPoint2() const +Vector ConstructionLine::getPoint2() const { return data.point2; } -void RS_ConstructionLine::calculateBorders() +void ConstructionLine::calculateBorders() { minV = Vector::minimum(data.point1, data.point2); maxV = Vector::maximum(data.point1, data.point2); } -Vector RS_ConstructionLine::getNearestEndpoint(const Vector & coord, double * dist) +Vector ConstructionLine::getNearestEndpoint(const Vector & coord, double * dist) { double dist1, dist2; Vector * nearerPoint; @@ -115,8 +115,8 @@ Vector RS_ConstructionLine::getNearestEndpoint(const Vector & coord, double * di return *nearerPoint; } -Vector RS_ConstructionLine::getNearestPointOnEntity(const Vector & coord, - bool /*onEntity*/, double * /*dist*/, RS_Entity ** entity) +Vector ConstructionLine::getNearestPointOnEntity(const Vector & coord, + bool /*onEntity*/, double * /*dist*/, Entity ** entity) { if (entity != NULL) *entity = this; @@ -136,7 +136,7 @@ Vector RS_ConstructionLine::getNearestPointOnEntity(const Vector & coord, return data.point1 + ba; } -Vector RS_ConstructionLine::getNearestCenter(const Vector & /*coord*/, double * dist) +Vector ConstructionLine::getNearestCenter(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; @@ -144,7 +144,7 @@ Vector RS_ConstructionLine::getNearestCenter(const Vector & /*coord*/, double * return Vector(false); } -Vector RS_ConstructionLine::getNearestMiddle(const Vector & /*coord*/, double * dist) +Vector ConstructionLine::getNearestMiddle(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; @@ -152,7 +152,7 @@ Vector RS_ConstructionLine::getNearestMiddle(const Vector & /*coord*/, double * return Vector(false); } -Vector RS_ConstructionLine::getNearestDist(double /*distance*/, const Vector & /*coord*/, +Vector ConstructionLine::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) { if (dist != NULL) @@ -161,11 +161,11 @@ Vector RS_ConstructionLine::getNearestDist(double /*distance*/, const Vector & / return Vector(false); } -double RS_ConstructionLine::getDistanceToPoint(const Vector& coord, - RS_Entity** entity, +double ConstructionLine::getDistanceToPoint(const Vector& coord, + Entity** entity, RS2::ResolveLevel /*level*/, double /*solidDist*/) { - RS_DEBUG->print("RS_ConstructionLine::getDistanceToPoint"); + DEBUG->print("ConstructionLine::getDistanceToPoint"); if (entity != NULL) *entity = this; @@ -180,11 +180,11 @@ double RS_ConstructionLine::getDistanceToPoint(const Vector& coord, return dist; // Orthogonal projection from both sides: - Vector ba = ae * Vector::dotP(ae, ap) / RS_Math::pow(ae.magnitude(), 2); - Vector be = ea * Vector::dotP(ea, ep) / RS_Math::pow(ea.magnitude(), 2); + Vector ba = ae * Vector::dotP(ae, ap) / Math::pow(ae.magnitude(), 2); + Vector be = ea * Vector::dotP(ea, ep) / Math::pow(ea.magnitude(), 2); - RS_DEBUG->print("ba: %f", ba.magnitude()); - RS_DEBUG->print("ae: %f", ae.magnitude()); + DEBUG->print("ba: %f", ba.magnitude()); + DEBUG->print("ae: %f", ae.magnitude()); Vector cp = Vector::crossP(ap, ae); dist = cp.magnitude() / ae.magnitude(); @@ -192,41 +192,41 @@ double RS_ConstructionLine::getDistanceToPoint(const Vector& coord, return dist; } -void RS_ConstructionLine::move(Vector offset) +void ConstructionLine::move(Vector offset) { data.point1.move(offset); data.point2.move(offset); //calculateBorders(); } -void RS_ConstructionLine::rotate(Vector center, double angle) +void ConstructionLine::rotate(Vector center, double angle) { data.point1.rotate(center, angle); data.point2.rotate(center, angle); //calculateBorders(); } -void RS_ConstructionLine::scale(Vector center, Vector factor) +void ConstructionLine::scale(Vector center, Vector factor) { data.point1.scale(center, factor); data.point2.scale(center, factor); //calculateBorders(); } -void RS_ConstructionLine::mirror(Vector axisPoint1, Vector axisPoint2) +void ConstructionLine::mirror(Vector axisPoint1, Vector axisPoint2) { data.point1.mirror(axisPoint1, axisPoint2); data.point2.mirror(axisPoint1, axisPoint2); } -/*virtual*/ void RS_ConstructionLine::draw(PaintInterface *, GraphicView *, double) +/*virtual*/ void ConstructionLine::draw(PaintInterface *, GraphicView *, double) { } /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l) +std::ostream & operator<<(std::ostream & os, const ConstructionLine & l) { os << " ConstructionLine: " << l.getData() << "\n"; return os; diff --git a/src/base/constructionline.h b/src/base/constructionline.h index e51a693..e470c23 100644 --- a/src/base/constructionline.h +++ b/src/base/constructionline.h @@ -8,23 +8,23 @@ * Holds the data that defines a construction line (a line * which is not limited to both directions). */ -class RS_ConstructionLineData +class ConstructionLineData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_ConstructionLineData() {} + ConstructionLineData() {} - RS_ConstructionLineData(const Vector & point1, const Vector & point2) + ConstructionLineData(const Vector & point1, const Vector & point2) { this->point1 = point1; this->point2 = point2; } - friend class RS_ConstructionLine; + friend class ConstructionLine; - friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLineData & ld) + friend std::ostream & operator<<(std::ostream & os, const ConstructionLineData & ld) { os << "(" << ld.point1 << "/" << ld.point2 << @@ -42,27 +42,27 @@ class RS_ConstructionLineData * * @author Andrew Mustun */ -class RS_ConstructionLine: public RS_AtomicEntity +class ConstructionLine: public AtomicEntity { public: - RS_ConstructionLine(RS_EntityContainer * parent, const RS_ConstructionLineData & d); - virtual ~RS_ConstructionLine(); + ConstructionLine(EntityContainer * parent, const ConstructionLineData & d); + virtual ~ConstructionLine(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual Vector getStartpoint() const; virtual Vector getEndpoint() const; - RS_ConstructionLineData getData() const; + 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); + bool onEntity = true, double * dist = NULL, 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, + virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual void move(Vector offset); virtual void rotate(Vector center, double angle); @@ -71,11 +71,11 @@ class RS_ConstructionLine: public RS_AtomicEntity virtual void draw(PaintInterface * /*painter*/, GraphicView * /*view*/, double /*patternOffset*/); - friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l); + friend std::ostream & operator<<(std::ostream & os, const ConstructionLine & l); virtual void calculateBorders(); protected: - RS_ConstructionLineData data; + ConstructionLineData data; }; #endif diff --git a/src/base/creation.cpp b/src/base/creation.cpp index b6f9d79..55051b4 100644 --- a/src/base/creation.cpp +++ b/src/base/creation.cpp @@ -32,7 +32,7 @@ * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ -RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicView, +Creation::Creation(EntityContainer * container, GraphicView * graphicView, bool handleUndo) { this->container = container; @@ -61,8 +61,8 @@ RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicVi * * @param p position */ -/*void RS_Creation::createPoint(const Vector& p) { - entityContainer->addEntity(new RS_Point(entityContainer, p)); +/*void Creation::createPoint(const Vector& p) { + entityContainer->addEntity(new Point(entityContainer, p)); }*/ /** @@ -76,9 +76,9 @@ RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicVi * @param p1 start point * @param p2 end point */ -/*void RS_Creation::createLine2P(const Vector& p1, const Vector& p2) { - entityContainer->addEntity(new RS_Line(entityContainer, - RS_LineData(p1, p2))); +/*void Creation::createLine2P(const Vector& p1, const Vector& p2) { + entityContainer->addEntity(new Line(entityContainer, + LineData(p1, p2))); }*/ /** @@ -92,17 +92,17 @@ RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicVi * @param p1 edge one * @param p2 edge two */ -/*void RS_Creation::createRectangle(const Vector& e1, const Vector& e2) { +/*void Creation::createRectangle(const Vector& e1, const Vector& e2) { Vector e21(e2.x, e1.y); Vector e12(e1.x, e2.y); - entityContainer->addEntity(new RS_Line(entityContainer, - RS_LineData(e1, e12))); - entityContainer->addEntity(new RS_Line(entityContainer, - RS_LineData(e12, e2))); - entityContainer->addEntity(new RS_Line(entityContainer, - RS_LineData(e2, e21))); - entityContainer->addEntity(new RS_Line(entityContainer, - RS_LineData(e21, e1))); + entityContainer->addEntity(new Line(entityContainer, + LineData(e1, e12))); + entityContainer->addEntity(new Line(entityContainer, + LineData(e12, e2))); + entityContainer->addEntity(new Line(entityContainer, + LineData(e2, e21))); + entityContainer->addEntity(new Line(entityContainer, + LineData(e21, e1))); }*/ /** @@ -112,16 +112,16 @@ RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicVi * * E.g.:
* - * RS_Polyline *pl = creation.createPolyline(Vector(25.0, 55.0));
+ * Polyline *pl = creation.createPolyline(Vector(25.0, 55.0));
* pl->addVertex(Vector(50.0, 75.0));
*
* * @param entities array of entities * @param startPoint Start point of the polyline */ -/*RS_Polyline* RS_Creation::createPolyline(const Vector& startPoint) { - RS_Polyline* pl = new RS_Polyline(entityContainer, - RS_PolylineData(startPoint, Vector(0.0,0.0), 0)); +/*Polyline* Creation::createPolyline(const Vector& startPoint) { + Polyline* pl = new Polyline(entityContainer, + PolylineData(startPoint, Vector(0.0,0.0), 0)); entityContainer->addEntity(pl); return pl; }*/ @@ -138,7 +138,7 @@ RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicVi * @return Pointer to the first created parallel or NULL if no * parallel has been created. */ -RS_Entity * RS_Creation::createParallelThrough(const Vector & coord, int number, RS_Entity * e) +Entity * Creation::createParallelThrough(const Vector & coord, int number, Entity * e) { if (e == NULL) return NULL; @@ -147,8 +147,8 @@ RS_Entity * RS_Creation::createParallelThrough(const Vector & coord, int number, if (e->rtti() == RS2::EntityLine) { - RS_Line * l = (RS_Line *)e; - RS_ConstructionLine cl(NULL, RS_ConstructionLineData(l->getStartpoint(), + Line * l = (Line *)e; + ConstructionLine cl(NULL, ConstructionLineData(l->getStartpoint(), l->getEndpoint())); dist = cl.getDistanceToPoint(coord); } @@ -178,24 +178,24 @@ RS_Entity * RS_Creation::createParallelThrough(const Vector & coord, int number, * @return Pointer to the first created parallel or NULL if no * parallel has been created. */ -RS_Entity* RS_Creation::createParallel(const Vector& coord, +Entity* Creation::createParallel(const Vector& coord, double distance, int number, - RS_Entity* e) { + Entity* e) { if (e==NULL) { return NULL; } switch (e->rtti()) { case RS2::EntityLine: - return createParallelLine(coord, distance, number, (RS_Line*)e); + return createParallelLine(coord, distance, number, (Line*)e); break; case RS2::EntityArc: - return createParallelArc(coord, distance, number, (RS_Arc*)e); + return createParallelArc(coord, distance, number, (Arc*)e); break; case RS2::EntityCircle: - return createParallelCircle(coord, distance, number, (RS_Circle*)e); + return createParallelCircle(coord, distance, number, (Circle*)e); break; default: @@ -221,9 +221,9 @@ RS_Entity* RS_Creation::createParallel(const Vector& coord, * @return Pointer to the first created parallel or NULL if no * parallel has been created. */ -RS_Line* RS_Creation::createParallelLine(const Vector& coord, +Line* Creation::createParallelLine(const Vector& coord, double distance, int number, - RS_Line* e) { + Line* e) { if (e==NULL) { return NULL; @@ -231,8 +231,8 @@ RS_Line* RS_Creation::createParallelLine(const Vector& coord, double ang = e->getAngle1() + M_PI/2.0; Vector p1, p2; - RS_LineData parallelData; - RS_Line* ret = NULL; + LineData parallelData; + Line* ret = NULL; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -245,14 +245,14 @@ RS_Line* RS_Creation::createParallelLine(const Vector& coord, p1 += e->getStartpoint(); p2.setPolar(distance*num, ang); p2 += e->getEndpoint(); - RS_Line parallel1(NULL, RS_LineData(p1, p2)); + Line parallel1(NULL, LineData(p1, p2)); // calculate 2nd parallel: p1.setPolar(distance*num, ang+M_PI); p1 += e->getStartpoint(); p2.setPolar(distance*num, ang+M_PI); p2 += e->getEndpoint(); - RS_Line parallel2(NULL, RS_LineData(p1, p2)); + Line parallel2(NULL, LineData(p1, p2)); double dist1 = parallel1.getDistanceToPoint(coord); double dist2 = parallel2.getDistanceToPoint(coord); @@ -266,7 +266,7 @@ RS_Line* RS_Creation::createParallelLine(const Vector& coord, } - RS_Line* newLine = new RS_Line(container, parallelData); + Line* newLine = new Line(container, parallelData); newLine->setLayerToActive(); newLine->setPenToActive(); if (ret==NULL) { @@ -308,16 +308,16 @@ RS_Line* RS_Creation::createParallelLine(const Vector& coord, * @return Pointer to the first created parallel or NULL if no * parallel has been created. */ -RS_Arc* RS_Creation::createParallelArc(const Vector& coord, +Arc* Creation::createParallelArc(const Vector& coord, double distance, int number, - RS_Arc* e) { + Arc* e) { if (e==NULL) { return NULL; } - RS_ArcData parallelData; - RS_Arc* ret = NULL; + ArcData parallelData; + Arc* ret = NULL; bool inside = (e->getCenter().distanceTo(coord) < e->getRadius()); @@ -329,7 +329,7 @@ RS_Arc* RS_Creation::createParallelArc(const Vector& coord, // calculate parallel: bool ok = true; - RS_Arc parallel1(NULL, e->getData()); + Arc parallel1(NULL, e->getData()); parallel1.setRadius(e->getRadius() + distance*num); if (parallel1.getRadius()<0.0) { parallel1.setRadius(RS_MAXDOUBLE); @@ -337,7 +337,7 @@ RS_Arc* RS_Creation::createParallelArc(const Vector& coord, } // calculate 2nd parallel: - //RS_Arc parallel2(NULL, e->getData()); + //Arc parallel2(NULL, e->getData()); //parallel2.setRadius(e->getRadius()+distance*num); //double dist1 = parallel1.getDistanceToPoint(coord); @@ -356,7 +356,7 @@ RS_Arc* RS_Creation::createParallelArc(const Vector& coord, document->startUndoCycle(); } - RS_Arc* newArc = new RS_Arc(container, parallelData); + Arc* newArc = new Arc(container, parallelData); newArc->setLayerToActive(); newArc->setPenToActive(); if (ret==NULL) { @@ -394,16 +394,16 @@ RS_Arc* RS_Creation::createParallelArc(const Vector& coord, * @return Pointer to the first created parallel or NULL if no * parallel has been created. */ -RS_Circle* RS_Creation::createParallelCircle(const Vector& coord, +Circle* Creation::createParallelCircle(const Vector& coord, double distance, int number, - RS_Circle* e) { + Circle* e) { if (e==NULL) { return NULL; } - RS_CircleData parallelData; - RS_Circle* ret = NULL; + CircleData parallelData; + Circle* ret = NULL; bool inside = (e->getCenter().distanceTo(coord) < e->getRadius()); @@ -415,7 +415,7 @@ RS_Circle* RS_Creation::createParallelCircle(const Vector& coord, // calculate parallel: bool ok = true; - RS_Circle parallel1(NULL, e->getData()); + Circle parallel1(NULL, e->getData()); parallel1.setRadius(e->getRadius() + distance*num); if (parallel1.getRadius()<0.0) { parallel1.setRadius(RS_MAXDOUBLE); @@ -423,7 +423,7 @@ RS_Circle* RS_Creation::createParallelCircle(const Vector& coord, } // calculate 2nd parallel: - //RS_Circle parallel2(NULL, e->getData()); + //Circle parallel2(NULL, e->getData()); //parallel2.setRadius(e->getRadius()+distance*num); //double dist1 = parallel1.getDistanceToPoint(coord); @@ -442,7 +442,7 @@ RS_Circle* RS_Creation::createParallelCircle(const Vector& coord, document->startUndoCycle(); } - RS_Circle* newCircle = new RS_Circle(container, parallelData); + Circle* newCircle = new Circle(container, parallelData); newCircle->setLayerToActive(); newCircle->setPenToActive(); if (ret==NULL) { @@ -480,15 +480,15 @@ RS_Circle* RS_Creation::createParallelCircle(const Vector& coord, * @return Pointer to the first bisector created or NULL if no bisectors * were created. */ -RS_Line * RS_Creation::createBisector(const Vector & coord1, const Vector & coord2, - double length, int num, RS_Line * l1, RS_Line * l2) +Line * Creation::createBisector(const Vector & coord1, const Vector & coord2, + double length, int num, Line * l1, Line * l2) { // check given entities: if (!l1 || !l2 || l1->rtti() != RS2::EntityLine || l2->rtti() != RS2::EntityLine) return NULL; // intersection between entities: - VectorSolutions sol = RS_Information::getIntersection(l1, l2, false); + VectorSolutions sol = Information::getIntersection(l1, l2, false); Vector inters = sol.get(0); if (!inters.valid) @@ -496,12 +496,12 @@ RS_Line * RS_Creation::createBisector(const Vector & coord1, const Vector & coor double angle1 = inters.angleTo(l1->getNearestPointOnEntity(coord1)); double angle2 = inters.angleTo(l2->getNearestPointOnEntity(coord2)); - double angleDiff = RS_Math::getAngleDifference(angle1, angle2); + double angleDiff = Math::getAngleDifference(angle1, angle2); if (angleDiff > M_PI) angleDiff = angleDiff - 2 * M_PI; - RS_Line * ret = NULL; + Line * ret = NULL; if (document && handleUndo) document->startUndoCycle(); @@ -511,8 +511,8 @@ RS_Line * RS_Creation::createBisector(const Vector & coord1, const Vector & coor double angle = angle1 + (angleDiff / (num + 1) * n); Vector v; v.setPolar(length, angle); - RS_LineData d = RS_LineData(inters, inters + v); - RS_Line * newLine = new RS_Line(container, d); + LineData d = LineData(inters, inters + v); + Line * newLine = new Line(container, d); if (container) { @@ -549,10 +549,10 @@ RS_Line * RS_Creation::createBisector(const Vector & coord1, const Vector & coor * @param point Point. * @param circle Circle, arc or ellipse entity. */ -RS_Line* RS_Creation::createTangent1(const Vector& coord, +Line* Creation::createTangent1(const Vector& coord, const Vector& point, - RS_Entity* circle) { - RS_Line* ret = NULL; + Entity* circle) { + Line* ret = NULL; Vector circleCenter; // check given entities: @@ -564,11 +564,11 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, } if (circle->rtti()==RS2::EntityCircle) { - circleCenter = ((RS_Circle*)circle)->getCenter(); + circleCenter = ((Circle*)circle)->getCenter(); } else if (circle->rtti()==RS2::EntityArc) { - circleCenter = ((RS_Arc*)circle)->getCenter(); + circleCenter = ((Arc*)circle)->getCenter(); } else if (circle->rtti()==RS2::EntityEllipse) { - circleCenter = ((RS_Ellipse*)circle)->getCenter(); + circleCenter = ((Ellipse*)circle)->getCenter(); } // the two tangent points: @@ -580,15 +580,15 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, Vector tCenter = (point + circleCenter)/2.0; double tRadius = point.distanceTo(tCenter); - RS_Circle tmp(NULL, RS_CircleData(tCenter, tRadius)); + Circle tmp(NULL, CircleData(tCenter, tRadius)); // get the two intersection points which are the tangent points: - sol = RS_Information::getIntersection(&tmp, circle, false); + sol = Information::getIntersection(&tmp, circle, false); } // calculate tangent points for ellipses: else { - RS_Ellipse* el = (RS_Ellipse*)circle; + Ellipse* el = (Ellipse*)circle; sol.alloc(2); //sol.set(0, circleCenter); //sol.set(1, circleCenter); @@ -643,14 +643,14 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, } // create all possible tangents: - RS_Line* poss[2]; + Line* poss[2]; - RS_LineData d; + LineData d; - d = RS_LineData(sol.get(0), point); - poss[0] = new RS_Line(NULL, d); - d = RS_LineData(sol.get(1), point); - poss[1] = new RS_Line(NULL, d); + d = LineData(sol.get(0), point); + poss[0] = new Line(NULL, d); + d = LineData(sol.get(1), point); + poss[1] = new Line(NULL, d); // find closest tangent: double minDist = RS_MAXDOUBLE; @@ -666,7 +666,7 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, // create the closest tangent: if (idx!=-1) { - RS_LineData d = poss[idx]->getData(); + LineData d = poss[idx]->getData(); for (int i=0; i<2; ++i) { delete poss[i]; @@ -676,7 +676,7 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, document->startUndoCycle(); } - ret = new RS_Line(container, d); + ret = new Line(container, d); ret->setLayerToActive(); ret->setPenToActive(); if (container!=NULL) { @@ -708,10 +708,10 @@ RS_Line* RS_Creation::createTangent1(const Vector& coord, * @param circle1 1st circle or arc entity. * @param circle2 2nd circle or arc entity. */ -RS_Line* RS_Creation::createTangent2(const Vector& coord, - RS_Entity* circle1, - RS_Entity* circle2) { - RS_Line* ret = NULL; +Line* Creation::createTangent2(const Vector& coord, + Entity* circle1, + Entity* circle2) { + Line* ret = NULL; Vector circleCenter1; Vector circleCenter2; double circleRadius1 = 0.0; @@ -728,28 +728,28 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, } if (circle1->rtti()==RS2::EntityCircle) { - circleCenter1 = ((RS_Circle*)circle1)->getCenter(); - circleRadius1 = ((RS_Circle*)circle1)->getRadius(); + circleCenter1 = ((Circle*)circle1)->getCenter(); + circleRadius1 = ((Circle*)circle1)->getRadius(); } else if (circle1->rtti()==RS2::EntityArc) { - circleCenter1 = ((RS_Arc*)circle1)->getCenter(); - circleRadius1 = ((RS_Arc*)circle1)->getRadius(); + circleCenter1 = ((Arc*)circle1)->getCenter(); + circleRadius1 = ((Arc*)circle1)->getRadius(); } if (circle2->rtti()==RS2::EntityCircle) { - circleCenter2 = ((RS_Circle*)circle2)->getCenter(); - circleRadius2 = ((RS_Circle*)circle2)->getRadius(); + circleCenter2 = ((Circle*)circle2)->getCenter(); + circleRadius2 = ((Circle*)circle2)->getRadius(); } else if (circle2->rtti()==RS2::EntityArc) { - circleCenter2 = ((RS_Arc*)circle2)->getCenter(); - circleRadius2 = ((RS_Arc*)circle2)->getRadius(); + circleCenter2 = ((Arc*)circle2)->getCenter(); + circleRadius2 = ((Arc*)circle2)->getRadius(); } // create all possible tangents: - RS_Line* poss[4]; + Line* poss[4]; for (int i=0; i<4; ++i) { poss[i] = NULL; } - RS_LineData d; + LineData d; double angle1 = circleCenter1.angleTo(circleCenter2); double dist1 = circleCenter1.distanceTo(circleCenter2); @@ -767,17 +767,17 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, offs1.setPolar(circleRadius1, angt1); offs2.setPolar(circleRadius2, angt1); - d = RS_LineData(circleCenter1 + offs1, + d = LineData(circleCenter1 + offs1, circleCenter2 + offs2); - poss[0] = new RS_Line(NULL, d); + poss[0] = new Line(NULL, d); offs1.setPolar(circleRadius1, angt2); offs2.setPolar(circleRadius2, angt2); - d = RS_LineData(circleCenter1 + offs1, + d = LineData(circleCenter1 + offs1, circleCenter2 + offs2); - poss[1] = new RS_Line(NULL, d); + poss[1] = new Line(NULL, d); } // inner tangents: @@ -792,17 +792,17 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, offs1.setPolar(circleRadius1, angt3); offs2.setPolar(circleRadius2, angt3); - d = RS_LineData(circleCenter1 - offs1, + d = LineData(circleCenter1 - offs1, circleCenter2 + offs2); - poss[2] = new RS_Line(NULL, d); + poss[2] = new Line(NULL, d); offs1.setPolar(circleRadius1, angt4); offs2.setPolar(circleRadius2, angt4); - d = RS_LineData(circleCenter1 - offs1, + d = LineData(circleCenter1 - offs1, circleCenter2 + offs2); - poss[3] = new RS_Line(NULL, d); + poss[3] = new Line(NULL, d); } } @@ -822,7 +822,7 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, } if (idx!=-1) { - RS_LineData d = poss[idx]->getData(); + LineData d = poss[idx]->getData(); for (int i=0; i<4; ++i) { if (poss[i]!=NULL) { delete poss[i]; @@ -833,7 +833,7 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, document->startUndoCycle(); } - ret = new RS_Line(container, d); + ret = new Line(container, d); ret->setLayerToActive(); ret->setPenToActive(); if (container!=NULL) { @@ -864,8 +864,8 @@ RS_Line* RS_Creation::createTangent2(const Vector& coord, * @param angle Angle of the line relative to the angle of the basis entity. * @param length Length of the line we're creating. */ -RS_Line* RS_Creation::createLineRelAngle(const Vector& coord, - RS_Entity* entity, +Line* Creation::createLineRelAngle(const Vector& coord, + Entity* entity, double angle, double length) { @@ -881,13 +881,13 @@ RS_Line* RS_Creation::createLineRelAngle(const Vector& coord, switch (entity->rtti()) { case RS2::EntityLine: - a1 = ((RS_Line*)entity)->getAngle1(); + a1 = ((Line*)entity)->getAngle1(); break; case RS2::EntityArc: - a1 = ((RS_Arc*)entity)->getCenter().angleTo(coord) + M_PI/2.0; + a1 = ((Arc*)entity)->getCenter().angleTo(coord) + M_PI/2.0; break; case RS2::EntityCircle: - a1 = ((RS_Circle*)entity)->getCenter().angleTo(coord); + a1 = ((Circle*)entity)->getCenter().angleTo(coord); break; default: // never reached @@ -898,15 +898,15 @@ RS_Line* RS_Creation::createLineRelAngle(const Vector& coord, Vector v1; v1.setPolar(length, a1); - //RS_ConstructionLineData(coord-v1, coord+v1); - RS_LineData d(coord-v1, coord+v1); - RS_Line* ret; + //ConstructionLineData(coord-v1, coord+v1); + LineData d(coord-v1, coord+v1); + Line* ret; if (document!=NULL && handleUndo) { document->startUndoCycle(); } - ret = new RS_Line(container, d); + ret = new Line(container, d); ret->setLayerToActive(); ret->setPenToActive(); if (container!=NULL) { @@ -931,7 +931,7 @@ RS_Line* RS_Creation::createLineRelAngle(const Vector& coord, * @param corner The first corner of the polygon * @param number Number of edges / corners. */ -RS_Line* RS_Creation::createPolygon(const Vector& center, +Line* Creation::createPolygon(const Vector& center, const Vector& corner, int number) { @@ -940,7 +940,7 @@ RS_Line* RS_Creation::createPolygon(const Vector& center, return NULL; } - RS_Line* ret = NULL; + Line* ret = NULL; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -948,13 +948,13 @@ RS_Line* RS_Creation::createPolygon(const Vector& center, Vector c1(false); Vector c2 = corner; - RS_Line* line; + Line* line; for (int n=1; n<=number; ++n) { c1 = c2; c2 = c2.rotate(center, (M_PI*2)/number); - line = new RS_Line(container, RS_LineData(c1, c2)); + line = new Line(container, LineData(c1, c2)); line->setLayerToActive(); line->setPenToActive(); @@ -989,7 +989,7 @@ RS_Line* RS_Creation::createPolygon(const Vector& center, * @param corner2 The second corner of the polygon. * @param number Number of edges / corners. */ -RS_Line* RS_Creation::createPolygon2(const Vector& corner1, +Line* Creation::createPolygon2(const Vector& corner1, const Vector& corner2, int number) { @@ -998,7 +998,7 @@ RS_Line* RS_Creation::createPolygon2(const Vector& corner1, return NULL; } - RS_Line* ret = NULL; + Line* ret = NULL; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1011,14 +1011,14 @@ RS_Line* RS_Creation::createPolygon2(const Vector& corner1, Vector c1(false); Vector c2 = corner1; Vector edge; - RS_Line* line; + Line* line; for (int n=1; n<=number; ++n) { c1 = c2; edge.setPolar(len, ang); c2 = c1 + edge; - line = new RS_Line(container, RS_LineData(c1, c2)); + line = new Line(container, LineData(c1, c2)); line->setLayerToActive(); line->setPenToActive(); @@ -1052,14 +1052,14 @@ RS_Line* RS_Creation::createPolygon2(const Vector& corner1, * * @param data Insert data (position, block name, ..) */ -RS_Insert* RS_Creation::createInsert(RS_InsertData & data) +Insert* Creation::createInsert(InsertData & data) { - RS_DEBUG->print("RS_Creation::createInsert"); + DEBUG->print("Creation::createInsert"); if (document != NULL && handleUndo) document->startUndoCycle(); - RS_Insert * ins = new RS_Insert(container, data); + Insert * ins = new Insert(container, data); // inserts are also on layers ins->setLayerToActive(); ins->setPenToActive(); @@ -1076,7 +1076,7 @@ RS_Insert* RS_Creation::createInsert(RS_InsertData & data) if (graphicView != NULL) graphicView->drawEntity(ins); - RS_DEBUG->print("RS_Creation::createInsert: OK"); + DEBUG->print("Creation::createInsert: OK"); return ins; } @@ -1084,13 +1084,13 @@ RS_Insert* RS_Creation::createInsert(RS_InsertData & data) /** * Creates an image with the given data. */ -RS_Image* RS_Creation::createImage(RS_ImageData& data) { +Image* Creation::createImage(ImageData& data) { if (document!=NULL && handleUndo) { document->startUndoCycle(); } - RS_Image* img = new RS_Image(container, data); + Image* img = new Image(container, data); img->setLayerToActive(); img->setPenToActive(); img->update(); @@ -1116,7 +1116,7 @@ RS_Image* RS_Creation::createImage(RS_ImageData& data) { * @param name Block name * @param remove true: remove existing entities, false: don't touch entities */ -RS_Block * RS_Creation::createBlock(const RS_BlockData & data, +Block * Creation::createBlock(const BlockData & data, const Vector & referencePoint, const bool remove) { // start undo cycle for the container if we're deleting the existing entities @@ -1124,15 +1124,15 @@ RS_Block * RS_Creation::createBlock(const RS_BlockData & data, document->startUndoCycle(); } - RS_Block* block = - new RS_Block(container, - RS_BlockData(data.name, data.basePoint, data.frozen)); + Block* block = + new Block(container, + BlockData(data.name, data.basePoint, data.frozen)); // copy entities into a block - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e && e->isSelected()) { @@ -1164,7 +1164,7 @@ RS_Block * RS_Creation::createBlock(const RS_BlockData & data, } // add entity to block: - RS_Entity * c = e->clone(); + Entity * c = e->clone(); c->move(-referencePoint); block->addEntity(c); @@ -1192,21 +1192,21 @@ RS_Block * RS_Creation::createBlock(const RS_BlockData & data, /** * Inserts a library item from the given path into the drawing. */ -RS_Insert * RS_Creation::createLibraryInsert(RS_LibraryInsertData & data) +Insert * Creation::createLibraryInsert(LibraryInsertData & data) { - RS_DEBUG->print("RS_Creation::createLibraryInsert"); + DEBUG->print("Creation::createLibraryInsert"); Drawing g; if (!g.open(data.file, RS2::FormatUnknown)) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Creation::createLibraryInsert: Cannot open file: %s"); + DEBUG->print(Debug::D_WARNING, "Creation::createLibraryInsert: Cannot open file: %s"); return NULL; } // unit conversion: if (graphic != NULL) { - double uf = RS_Units::convert(1.0, g.getUnit(), graphic->getUnit()); + double uf = Units::convert(1.0, g.getUnit(), graphic->getUnit()); g.scale(Vector(0.0, 0.0), Vector(uf, uf)); } @@ -1216,10 +1216,10 @@ RS_Insert * RS_Creation::createLibraryInsert(RS_LibraryInsertData & data) // QString s = QFileInfo(data.file).baseName(true); QString s = QFileInfo(data.file).completeBaseName(); - RS_Modification m(*container, graphicView); - m.paste(RS_PasteData(data.insertionPoint, data.factor, data.angle, true, s), &g); + Modification m(*container, graphicView); + m.paste(PasteData(data.insertionPoint, data.factor, data.angle, true, s), &g); - RS_DEBUG->print("RS_Creation::createLibraryInsert: OK"); + DEBUG->print("Creation::createLibraryInsert: OK"); return NULL; } diff --git a/src/base/creation.h b/src/base/creation.h index 35c8d30..3492f48 100644 --- a/src/base/creation.h +++ b/src/base/creation.h @@ -4,25 +4,25 @@ #include #include "vector.h" -class RS_Arc; -class RS_Block; -class RS_BlockData; -class RS_Circle; -class RS_Document; +class Arc; +class Block; +class BlockData; +class Circle; +class Document; class Drawing; -class RS_Entity; -class RS_EntityContainer; +class Entity; +class EntityContainer; class GraphicView; -class RS_Image; -class RS_ImageData; -class RS_Insert; -class RS_InsertData; -class RS_Line; +class Image; +class ImageData; +class Insert; +class InsertData; +class Line; /** * Data needed to insert library items. */ -struct RS_LibraryInsertData +struct LibraryInsertData { QString file; Vector insertionPoint; @@ -37,59 +37,59 @@ struct RS_LibraryInsertData * * @author Andrew Mustun */ -class RS_Creation +class Creation { public: - RS_Creation(RS_EntityContainer * container, GraphicView * graphicView = NULL, + Creation(EntityContainer * container, GraphicView * graphicView = NULL, bool handleUndo = true); - RS_Entity * createParallelThrough(const Vector & coord, int number, - RS_Entity * e); + Entity * createParallelThrough(const Vector & coord, int number, + Entity * e); - RS_Entity * createParallel(const Vector & coord, double distance, - int number, RS_Entity * e); + Entity * createParallel(const Vector & coord, double distance, + int number, Entity * e); - RS_Line * createParallelLine(const Vector & coord, double distance, int number, - RS_Line * e); + Line * createParallelLine(const Vector & coord, double distance, int number, + Line * e); - RS_Arc * createParallelArc(const Vector & coord, double distance, int number, - RS_Arc * e); + Arc * createParallelArc(const Vector & coord, double distance, int number, + Arc * e); - RS_Circle * createParallelCircle(const Vector & coord, double distance, int number, - RS_Circle * e); + Circle * createParallelCircle(const Vector & coord, double distance, int number, + Circle * e); - RS_Line * createBisector(const Vector & coord1, const Vector & coord2, double length, - int num, RS_Line * l1, RS_Line * l2); + Line * createBisector(const Vector & coord1, const Vector & coord2, double length, + int num, Line * l1, Line * l2); - RS_Line * createTangent1(const Vector & coord, const Vector & point, RS_Entity * circle); + Line * createTangent1(const Vector & coord, const Vector & point, Entity * circle); - RS_Line * createTangent2(const Vector & coord, RS_Entity * circle1, RS_Entity * circle2); + Line * createTangent2(const Vector & coord, Entity * circle1, Entity * circle2); - RS_Line * createLineRelAngle(const Vector & coord, RS_Entity * entity, + Line * createLineRelAngle(const Vector & coord, Entity * entity, double angle, double length); - RS_Line * createPolygon(const Vector & center, const Vector & corner, int number); + Line * createPolygon(const Vector & center, const Vector & corner, int number); - RS_Line * createPolygon2(const Vector & corner1, const Vector & corner2, int number); + Line * createPolygon2(const Vector & corner1, const Vector & corner2, int number); - RS_Insert * createInsert(RS_InsertData & data); + Insert * createInsert(InsertData & data); - RS_Image * createImage(RS_ImageData & data); + Image * createImage(ImageData & data); - RS_Block * createBlock(const RS_BlockData & data, const Vector & referencePoint, + Block * createBlock(const BlockData & data, const Vector & referencePoint, const bool remove); - RS_Insert * createLibraryInsert(RS_LibraryInsertData & data); + Insert * createLibraryInsert(LibraryInsertData & data); //void createPoint(const Vector& p); //void createLine2P(const Vector& p1, const Vector& p2); //void createRectangle(const Vector& e1, const Vector& e2); - //RS_Polyline* createPolyline(const Vector& p); + //Polyline* createPolyline(const Vector& p); protected: - RS_EntityContainer * container; + EntityContainer * container; Drawing * graphic; - RS_Document * document; + Document * document; GraphicView * graphicView; bool handleUndo; }; diff --git a/src/base/debug.cpp b/src/base/debug.cpp index acfafac..36cb5ef 100644 --- a/src/base/debug.cpp +++ b/src/base/debug.cpp @@ -19,16 +19,14 @@ #include #include "system.h" -RS_Debug * RS_Debug::uniqueInstance = NULL; +Debug * Debug::uniqueInstance = NULL; /** - * Gets the one and only RS_Debug instance - * (creates a new one on first call only) + * Gets the one and only Debug instance (creates a new one on first call only) * - * @return Pointer to the single instance of this - * singleton class + * @return Pointer to the single instance of this singleton class */ -RS_Debug * RS_Debug::instance() +Debug * Debug::instance() { if (uniqueInstance == NULL) { @@ -37,8 +35,8 @@ RS_Debug * RS_Debug::instance() nowStr = now.toString("yyyyMMdd_hhmmss"); QString fName = QString("debug_%1.log").arg(nowStr); - uniqueInstance = new RS_Debug; - //uniqueInstance->stream = fopen(fName.latin1(), "wt"); + uniqueInstance = new Debug; +// uniqueInstance->stream = fopen(fName.toAscii().data(), "wt"); // uniqueInstance->stream = stderr; uniqueInstance->stream = stdout; } @@ -47,11 +45,11 @@ RS_Debug * RS_Debug::instance() } /** - * Deletes the one and only RS_Debug instance. + * Deletes the one and only Debug instance. */ -void RS_Debug::deleteInstance() +void Debug::deleteInstance() { - if (uniqueInstance != NULL) + if (uniqueInstance) { fclose(uniqueInstance->stream); delete uniqueInstance; @@ -61,7 +59,7 @@ void RS_Debug::deleteInstance() /** * Constructor for a point with default coordinates. */ -RS_Debug::RS_Debug() +Debug::Debug() { debugLevel = D_DEBUGGING; } @@ -69,20 +67,20 @@ RS_Debug::RS_Debug() /** * Sets the debugging level. */ -void RS_Debug::setLevel(RS_DebugLevel level) +void Debug::setLevel(DebugLevel level) { debugLevel = level; - print("RS_DEBUG: Warnings", D_WARNING); - print("RS_DEBUG: Errors", D_ERROR); - print("RS_DEBUG: Notice", D_NOTICE); - print("RS_DEBUG: Informational", D_INFORMATIONAL); - print("RS_DEBUG: Debugging", D_DEBUGGING); + print("DEBUG: Warnings", D_WARNING); + print("DEBUG: Errors", D_ERROR); + print("DEBUG: Notice", D_NOTICE); + print("DEBUG: Informational", D_INFORMATIONAL); + print("DEBUG: Debugging", D_DEBUGGING); } /** * Gets the current debugging level. */ -RS_Debug::RS_DebugLevel RS_Debug::getLevel() +Debug::DebugLevel Debug::getLevel() { return debugLevel; } @@ -90,7 +88,7 @@ RS_Debug::RS_DebugLevel RS_Debug::getLevel() /** * Prints the given message to stdout. */ -void RS_Debug::print(const char * format ...) +void Debug::print(const char * format ...) { if (debugLevel == D_DEBUGGING) { @@ -109,7 +107,7 @@ void RS_Debug::print(const char * format ...) * * @param level Debug level. */ -void RS_Debug::print(RS_DebugLevel level, const char * format ...) +void Debug::print(DebugLevel level, const char * format ...) { if (debugLevel >= level) { @@ -125,11 +123,11 @@ void RS_Debug::print(RS_DebugLevel level, const char * format ...) /** * Prints a time stamp in the format yyyyMMdd_hhmmss. */ -void RS_Debug::timestamp() +void Debug::timestamp() { QDateTime now = QDateTime::currentDateTime(); QString nowStr = now.toString("yyyyMMdd_hh:mm:ss:zzz "); - fprintf(stream, "%s", nowStr.toLatin1().data()); + fprintf(stream, "%s", nowStr.toAscii().data()); fprintf(stream, "\n"); fflush(stream); } @@ -137,13 +135,13 @@ void RS_Debug::timestamp() /** * Prints the unicode for every character in the given string. */ -void RS_Debug::printUnicode(const QString & text) +void Debug::printUnicode(const QString & text) { for(int i=0; i<(int)text.length(); i++) - print("[%X] %c", text.at(i).unicode(), text.at(i).toLatin1()); + print("[%X] %c", text.at(i).unicode(), text.at(i).toAscii()); } -void RS_Debug::setStream(FILE * s) +void Debug::setStream(FILE * s) { stream = s; } diff --git a/src/base/debug.h b/src/base/debug.h index 771719b..dc53e73 100644 --- a/src/base/debug.h +++ b/src/base/debug.h @@ -9,7 +9,7 @@ #include #include -#define RS_DEBUG RS_Debug::instance() +#define DEBUG Debug::instance() /** * Debugging facilities. @@ -17,7 +17,7 @@ * @author James Hammons * @author Andrew Mustun */ -class RS_Debug +class Debug { public: /** @@ -33,33 +33,33 @@ class RS_Debug *
  • D_DEBUGGING: very verbose * */ - enum RS_DebugLevel { D_NOTHING, - D_CRITICAL, - D_ERROR, - D_WARNING, - D_NOTICE, - D_INFORMATIONAL, - D_DEBUGGING }; + enum DebugLevel { D_NOTHING, + D_CRITICAL, + D_ERROR, + D_WARNING, + D_NOTICE, + D_INFORMATIONAL, + D_DEBUGGING }; private: - RS_Debug(); + Debug(); public: - static RS_Debug * instance(); + static Debug * instance(); static void deleteInstance(); - void setLevel(RS_DebugLevel level); - RS_DebugLevel getLevel(); - void print(RS_DebugLevel level, const char * format ...); + void setLevel(DebugLevel level); + DebugLevel getLevel(); + void print(DebugLevel level, const char * format ...); void print(const char * format ...); void printUnicode(const QString & text); void timestamp(); void setStream(FILE * s); private: - static RS_Debug * uniqueInstance; + static Debug * uniqueInstance; - RS_DebugLevel debugLevel; + DebugLevel debugLevel; FILE * stream; }; diff --git a/src/base/dialogfactory.cpp b/src/base/dialogfactory.cpp index 5fca3cb..47f814d 100644 --- a/src/base/dialogfactory.cpp +++ b/src/base/dialogfactory.cpp @@ -18,33 +18,33 @@ #include "debug.h" -RS_DialogFactory * RS_DialogFactory::uniqueInstance = NULL; +DialogFactory * DialogFactory::uniqueInstance = NULL; /** * Private constructor. */ -RS_DialogFactory::RS_DialogFactory() +DialogFactory::DialogFactory() { - RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory"); + DEBUG->print("DialogFacgory::DialogFactory"); factoryObject = NULL; - RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory: OK"); + DEBUG->print("DialogFacgory::DialogFactory: OK"); } -/*virtual*/ RS_DialogFactory::~RS_DialogFactory() +/*virtual*/ DialogFactory::~DialogFactory() { } /** * @return Instance to the unique font list. */ -RS_DialogFactory * RS_DialogFactory::instance() +DialogFactory * DialogFactory::instance() { - RS_DEBUG->print("RS_DialogFactory::instance()"); + DEBUG->print("DialogFactory::instance()"); if (uniqueInstance == NULL) - uniqueInstance = new RS_DialogFactory(); + uniqueInstance = new DialogFactory(); - RS_DEBUG->print("RS_DialogFactory::instance(): OK"); + DEBUG->print("DialogFactory::instance(): OK"); return uniqueInstance; } @@ -52,36 +52,36 @@ RS_DialogFactory * RS_DialogFactory::instance() /** * Sets the real factory object that can create and show dialogs. */ -void RS_DialogFactory::setFactoryObject(RS_DialogFactoryInterface * fo) +void DialogFactory::setFactoryObject(DialogFactoryInterface * fo) { - RS_DEBUG->print("RS_DialogFactory::setFactoryObject"); + DEBUG->print("DialogFactory::setFactoryObject"); factoryObject = fo; - RS_DEBUG->print("RS_DialogFactory::setFactoryObject: OK"); + DEBUG->print("DialogFactory::setFactoryObject: OK"); } /** * @return Factory object. This is never NULL. If no factory * object was set, the default adapter will be returned. */ -RS_DialogFactoryInterface * RS_DialogFactory::getFactoryObject() +DialogFactoryInterface * DialogFactory::getFactoryObject() { - RS_DEBUG->print("RS_DialogFactory::getFactoryObject"); + DEBUG->print("DialogFactory::getFactoryObject"); if (factoryObject != NULL) { - RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning factory object"); + DEBUG->print("DialogFactory::getFactoryObject: returning factory object"); return factoryObject; } else { - RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning adapter"); + DEBUG->print("DialogFactory::getFactoryObject: returning adapter"); return &factoryAdapter; } } -void RS_DialogFactory::commandMessage(const QString & m) +void DialogFactory::commandMessage(const QString & m) { - RS_DEBUG->print("RS_DialogFactory::commandMessage"); + DEBUG->print("DialogFactory::commandMessage"); if (factoryObject != NULL) factoryObject->commandMessage(m); diff --git a/src/base/dialogfactory.h b/src/base/dialogfactory.h index b0f580a..956a126 100644 --- a/src/base/dialogfactory.h +++ b/src/base/dialogfactory.h @@ -3,31 +3,31 @@ #include "dialogfactoryadapter.h" -#define RS_DIALOGFACTORY RS_DialogFactory::instance()->getFactoryObject() +#define DIALOGFACTORY DialogFactory::instance()->getFactoryObject() -class RS_DialogFactoryInterface; +class DialogFactoryInterface; /** * Interface for objects that can create and show dialogs. */ -class RS_DialogFactory +class DialogFactory { private: - RS_DialogFactory(); + DialogFactory(); public: - virtual ~RS_DialogFactory(); + virtual ~DialogFactory(); - static RS_DialogFactory * instance(); + static DialogFactory * instance(); - void setFactoryObject(RS_DialogFactoryInterface * fo); - RS_DialogFactoryInterface * getFactoryObject(); + void setFactoryObject(DialogFactoryInterface * fo); + DialogFactoryInterface * getFactoryObject(); void commandMessage(const QString & m); private: - RS_DialogFactoryInterface * factoryObject; - RS_DialogFactoryAdapter factoryAdapter; - static RS_DialogFactory * uniqueInstance; + DialogFactoryInterface * factoryObject; + DialogFactoryAdapter factoryAdapter; + static DialogFactory * uniqueInstance; }; #endif // __DIALOGFACTORY_H__ diff --git a/src/base/dialogfactoryadapter.h b/src/base/dialogfactoryadapter.h index d36e450..de34601 100644 --- a/src/base/dialogfactoryadapter.h +++ b/src/base/dialogfactoryadapter.h @@ -5,46 +5,46 @@ #include "block.h" #include "layer.h" -class RS_BlockList; -class RS_LayerList; +class BlockList; +class LayerList; /** * Adapter for dialog factory interface. * Used when no factory object was set. */ -class RS_DialogFactoryAdapter: public RS_DialogFactoryInterface +class DialogFactoryAdapter: public DialogFactoryInterface { public: - RS_DialogFactoryAdapter() {} - virtual ~RS_DialogFactoryAdapter() {} + DialogFactoryAdapter() {} + virtual ~DialogFactoryAdapter() {} virtual void requestPreviousMenu() {} virtual void requestWarningDialog(const QString &) {} virtual GraphicView * requestNewDocument(const QString & = QString::null, - RS_Document * = NULL) { return NULL; } + Document * = NULL) { return NULL; } virtual void requestSimulationControls() {} - virtual RS_Layer * requestNewLayerDialog(RS_LayerList * = NULL) { return NULL; } - virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * = NULL) { return NULL; } - virtual RS_Layer * requestEditLayerDialog(RS_LayerList * = NULL) { return NULL; } - virtual RS_BlockData requestNewBlockDialog(RS_BlockList *) { return RS_BlockData(); } - virtual RS_Block * requestBlockRemovalDialog(RS_BlockList *) { return NULL; } - virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList *) { return RS_BlockData(); } - virtual void requestEditBlockWindow(RS_BlockList *) {} - virtual void closeEditBlockWindow(RS_Block *) {} + virtual Layer * requestNewLayerDialog(LayerList * = NULL) { return NULL; } + virtual Layer * requestLayerRemovalDialog(LayerList * = NULL) { return NULL; } + virtual Layer * requestEditLayerDialog(LayerList * = NULL) { return NULL; } + virtual BlockData requestNewBlockDialog(BlockList *) { return BlockData(); } + virtual Block * requestBlockRemovalDialog(BlockList *) { return NULL; } + virtual BlockData requestBlockAttributesDialog(BlockList *) { return BlockData(); } + virtual void requestEditBlockWindow(BlockList *) {} + virtual void closeEditBlockWindow(Block *) {} virtual QString requestImageOpenDialog() { return ""; } virtual void requestOptions(ActionInterface *, bool, bool = false) {} virtual void requestSnapDistOptions(double &, bool) {} - virtual bool requestAttributesDialog(RS_AttributesData &, RS_LayerList &) { return false; } - virtual bool requestMoveDialog(RS_MoveData &) { return false; } - virtual bool requestRotateDialog(RS_RotateData &) { return false; } - virtual bool requestScaleDialog(RS_ScaleData &) { return false; } - virtual bool requestMirrorDialog(RS_MirrorData &) { return false; } - virtual bool requestMoveRotateDialog(RS_MoveRotateData &) { return false; } - virtual bool requestRotate2Dialog(RS_Rotate2Data &) { return false; } + virtual bool requestAttributesDialog(AttributesData &, LayerList &) { return false; } + virtual bool requestMoveDialog(MoveData &) { return false; } + virtual bool requestRotateDialog(RotateData &) { return false; } + virtual bool requestScaleDialog(ScaleData &) { return false; } + virtual bool requestMirrorDialog(MirrorData &) { return false; } + virtual bool requestMoveRotateDialog(MoveRotateData &) { return false; } + virtual bool requestRotate2Dialog(Rotate2Data &) { return false; } virtual void requestToolBar(RS2::ToolBarId) {} virtual void requestToolBarSelect(ActionInterface *, RS2::ActionType) {} - virtual bool requestModifyEntityDialog(RS_Entity *) { return false; } - virtual bool requestTextDialog(RS_Text *) { return false; } - virtual bool requestHatchDialog(RS_Hatch *) { return false; } + virtual bool requestModifyEntityDialog(Entity *) { return false; } + virtual bool requestTextDialog(Text *) { return false; } + virtual bool requestHatchDialog(Hatch *) { return false; } virtual void requestOptionsGeneralDialog() {} virtual void requestOptionsDrawingDialog(Drawing &) {} #ifdef RS_CAM diff --git a/src/base/dialogfactoryinterface.h b/src/base/dialogfactoryinterface.h index c12ee70..4e413a0 100644 --- a/src/base/dialogfactoryinterface.h +++ b/src/base/dialogfactoryinterface.h @@ -2,49 +2,48 @@ #define __DIALOGFACTORYINTERFACE_H__ #include -#include "rs.h" +#include "enums.h" class ActionInterface; -class RS_ArcData; -class RS_AttributesData; -class RS_BevelData; -class RS_Block; -class RS_BlockData; -class RS_BlockList; -class RS_CircleData; -class RS_DimLinearData; -class RS_DimensionData; -class RS_Document; +class ArcData; +class AttributesData; +class BevelData; +class Block; +class BlockData; +class BlockList; +class CircleData; +class DimLinearData; +class DimensionData; +class Document; class Drawing; -class RS_Entity; -class RS_EventHandler; +class Entity; +class EventHandler; class GraphicView; -class RS_Grid; -class RS_Hatch; -class RS_Insert; -class RS_Layer; -class RS_LayerList; -class RS_MirrorData; -class RS_MoveData; -class RS_MoveRotateData; -class RS_Painter; -class RS_Rotate2Data; -class RS_RotateData; -class RS_RoundData; -class RS_ScaleData; -class RS_Solid; -class RS_Text; +class Grid; +class Hatch; +class Insert; +class Layer; +class LayerList; +class MirrorData; +class MoveData; +class MoveRotateData; +class Rotate2Data; +class RotateData; +class RoundData; +class ScaleData; +class Solid; +class Text; class Vector; /** * Interface for objects that can create and show dialogs. */ -class RS_DialogFactoryInterface +class DialogFactoryInterface { public: - RS_DialogFactoryInterface() {} - virtual ~RS_DialogFactoryInterface() {} + DialogFactoryInterface() {} + virtual ~DialogFactoryInterface() {} /** * This virtual method must be overwritten and must show the previously @@ -64,7 +63,7 @@ public: * is given. */ virtual GraphicView * requestNewDocument(const QString & fileName = QString::null, - RS_Document * doc = NULL) = 0; + Document * doc = NULL) = 0; /** * This virtual method must be overwritten and must create or show @@ -82,7 +81,7 @@ public: * to the newly created layer or NULL if the user * cancels the dialog. */ - virtual RS_Layer * requestNewLayerDialog(RS_LayerList * layerList = NULL) = 0; + virtual Layer * requestNewLayerDialog(LayerList * layerList = NULL) = 0; /** * This virtual method must be overwritten and must provide @@ -94,7 +93,7 @@ public: * to the layer which can ne removed or NULL if the user * cancels the dialog. */ - virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * layerList = NULL) = 0; + virtual Layer * requestLayerRemovalDialog(LayerList * layerList = NULL) = 0; /** * This virtual method must be overwritten and must provide @@ -105,7 +104,7 @@ public: * to the modified layer or NULL if the user * cancels the dialog. */ - virtual RS_Layer * requestEditLayerDialog(RS_LayerList * layerList = NULL) = 0; + virtual Layer * requestEditLayerDialog(LayerList * layerList = NULL) = 0; /** * This virtual method must be overwritten and must provide @@ -120,7 +119,7 @@ public: * to the newly created block or NULL if the user * cancels the dialog. */ - virtual RS_BlockData requestNewBlockDialog(RS_BlockList * blockList) = 0; + virtual BlockData requestNewBlockDialog(BlockList * blockList) = 0; /** * This virtual method must be overwritten and must provide @@ -132,7 +131,7 @@ public: * to the block which can be removed or NULL if the user * cancels the dialog. */ - virtual RS_Block * requestBlockRemovalDialog(RS_BlockList * blockList) = 0; + virtual Block * requestBlockRemovalDialog(BlockList * blockList) = 0; /** * This virtual method must be overwritten and must provide @@ -143,15 +142,15 @@ public: * to the block which was changed or NULL if the user * cancels the dialog. */ - virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList * blockList) = 0; + virtual BlockData requestBlockAttributesDialog(BlockList * blockList) = 0; /** * This virtual method must be overwritten and should provide * a way to edit a block. */ - virtual void requestEditBlockWindow(RS_BlockList * blockList) = 0; + virtual void requestEditBlockWindow(BlockList * blockList) = 0; - virtual void closeEditBlockWindow(RS_Block * block) = 0; + virtual void closeEditBlockWindow(Block * block) = 0; /** * This virtual method must be overwritten and must provide @@ -214,7 +213,7 @@ public: * @param data Attribute data which can be directly changed * by the presented widget. */ - virtual bool requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList) = 0; + virtual bool requestAttributesDialog(AttributesData & data, LayerList & layerList) = 0; /** * This virtual method must be overwritten and must present @@ -223,7 +222,7 @@ public: * @param data Move data which can be directly changed * by the presented widget. */ - virtual bool requestMoveDialog(RS_MoveData & data) = 0; + virtual bool requestMoveDialog(MoveData & data) = 0; /** * This virtual method must be overwritten and must present @@ -232,7 +231,7 @@ public: * @param data Rotation data which can be directly changed * by the presented widget. */ - virtual bool requestRotateDialog(RS_RotateData & data) = 0; + virtual bool requestRotateDialog(RotateData & data) = 0; /** * This virtual method must be overwritten and must present @@ -241,7 +240,7 @@ public: * @param data Scaling data which can be directly changed * by the presented widget. */ - virtual bool requestScaleDialog(RS_ScaleData & data) = 0; + virtual bool requestScaleDialog(ScaleData & data) = 0; /** * This virtual method must be overwritten and must present @@ -250,7 +249,7 @@ public: * @param data Mirror data which can be directly changed * by the presented widget. */ - virtual bool requestMirrorDialog(RS_MirrorData & data) = 0; + virtual bool requestMirrorDialog(MirrorData & data) = 0; /** * This virtual method must be overwritten and must present @@ -259,7 +258,7 @@ public: * @param data Move/rotate data which can be directly changed * by the presented widget. */ - virtual bool requestMoveRotateDialog(RS_MoveRotateData & data) = 0; + virtual bool requestMoveRotateDialog(MoveRotateData & data) = 0; /** * This virtual method must be overwritten and must present @@ -269,7 +268,7 @@ public: * @param data Rotate data which can be directly changed * by the presented widget. */ - virtual bool requestRotate2Dialog(RS_Rotate2Data & data) = 0; + virtual bool requestRotate2Dialog(Rotate2Data & data) = 0; /** * This virtual method must be overwritten and must show @@ -294,7 +293,7 @@ public: * * @param entity Pointer to the entity. */ - virtual bool requestModifyEntityDialog(RS_Entity * entity) = 0; + virtual bool requestModifyEntityDialog(Entity * entity) = 0; /** * This virtual method must be overwritten and must present @@ -302,7 +301,7 @@ public: * * @param entity Pointer to the text entity. */ - virtual bool requestTextDialog(RS_Text * text) = 0; + virtual bool requestTextDialog(Text * text) = 0; /** * This virtual method must be overwritten and must present @@ -310,7 +309,7 @@ public: * * @param entity Pointer to the hatch entity. */ - virtual bool requestHatchDialog(RS_Hatch * hatch) = 0; + virtual bool requestHatchDialog(Hatch * hatch) = 0; /** * This virtual method must be overwritten and must present diff --git a/src/base/dimaligned.cpp b/src/base/dimaligned.cpp index cc9fc23..c25ea9f 100644 --- a/src/base/dimaligned.cpp +++ b/src/base/dimaligned.cpp @@ -27,19 +27,19 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for aligned dimension. */ -RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimAlignedData & ed): RS_Dimension(parent, d), edata(ed) +DimAligned::DimAligned(EntityContainer * parent, const DimensionData & d, + const DimAlignedData & ed): Dimension(parent, d), edata(ed) { calculateBorders(); } -/*virtual*/ RS_DimAligned::~RS_DimAligned() +/*virtual*/ DimAligned::~DimAligned() { } -/*virtual*/ RS_Entity * RS_DimAligned::clone() +/*virtual*/ Entity * DimAligned::clone() { - RS_DimAligned * d = new RS_DimAligned(*this); + DimAligned * d = new DimAligned(*this); #warning "!!! Need to port setAutoDelete in QList/QMultiHash from Qt3 to Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -48,7 +48,7 @@ RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData } /** @return RS2::EntityDimAligned */ -/*virtual*/ RS2::EntityType RS_DimAligned::rtti() const +/*virtual*/ RS2::EntityType DimAligned::rtti() const { return RS2::EntityDimAligned; } @@ -57,7 +57,7 @@ RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData * @return Copy of data that defines the aligned dimension. * @see getData() */ -RS_DimAlignedData RS_DimAligned::getEData() const +DimAlignedData DimAligned::getEData() const { return edata; } @@ -66,12 +66,12 @@ RS_DimAlignedData RS_DimAligned::getEData() const * Sets a new text. The entities representing the * text are updated. */ -//void RS_DimAligned::setText(const QString& t) { +//void DimAligned::setText(const QString& t) { // data.text = t; // update(); //} -VectorSolutions RS_DimAligned::getRefPoints() +VectorSolutions DimAligned::getRefPoints() { VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2, data.definitionPoint, data.middleOfText); @@ -82,7 +82,7 @@ VectorSolutions RS_DimAligned::getRefPoints() * @return Automatically creted label for the default * measurement of this dimension. */ -QString RS_DimAligned::getMeasuredLabel() +QString DimAligned::getMeasuredLabel() { double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2); Drawing * graphic = getGraphic(); @@ -90,7 +90,7 @@ QString RS_DimAligned::getMeasuredLabel() if (graphic != NULL) { - ret = RS_Units::formatLinear(dist, graphic->getUnit(), + ret = Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); } else @@ -107,9 +107,9 @@ QString RS_DimAligned::getMeasuredLabel() * * @param autoText Automatically reposition the text label */ -void RS_DimAligned::update(bool autoText) +void DimAligned::update(bool autoText) { - RS_DEBUG->print("RS_DimAligned::update"); + DEBUG->print("DimAligned::update"); clear(); @@ -131,28 +131,28 @@ void RS_DimAligned::update(bool autoText) double extLength = edata.extensionPoint2.distanceTo(data.definitionPoint); Vector v1, v2, e1; - RS_LineData ld; - RS_Line * line; + LineData ld; + Line * line; v1.setPolar(dimexo, extAngle); v2.setPolar(dimexe, extAngle); e1.setPolar(1.0, extAngle); // Extension line 1: - ld = RS_LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2); - line = new RS_Line(this, ld); + ld = LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2); + line = new Line(this, ld); //line->setLayerToActive(); //line->setPenToActive(); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); // Extension line 2: - ld = RS_LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2); - line = new RS_Line(this, ld); + ld = LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2); + line = new Line(this, ld); //line->setLayerToActive(); //line->setPenToActive(); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); @@ -163,59 +163,59 @@ void RS_DimAligned::update(bool autoText) calculateBorders(); } -Vector RS_DimAligned::getExtensionPoint1() +Vector DimAligned::getExtensionPoint1() { return edata.extensionPoint1; } -Vector RS_DimAligned::getExtensionPoint2() +Vector DimAligned::getExtensionPoint2() { return edata.extensionPoint2; } -bool RS_DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2) { return (edata.extensionPoint1.isInWindow(v1, v2) || edata.extensionPoint2.isInWindow(v1, v2)); } -void RS_DimAligned::move(Vector offset) +void DimAligned::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.extensionPoint1.move(offset); edata.extensionPoint2.move(offset); update(); } -void RS_DimAligned::rotate(Vector center, double angle) +void DimAligned::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); + Dimension::rotate(center, angle); edata.extensionPoint1.rotate(center, angle); edata.extensionPoint2.rotate(center, angle); update(); } -void RS_DimAligned::scale(Vector center, Vector factor) +void DimAligned::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); + Dimension::scale(center, factor); edata.extensionPoint1.scale(center, factor); edata.extensionPoint2.scale(center, factor); update(); } -void RS_DimAligned::mirror(Vector axisPoint1, Vector axisPoint2) +void DimAligned::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); + Dimension::mirror(axisPoint1, axisPoint2); edata.extensionPoint1.mirror(axisPoint1, axisPoint2); edata.extensionPoint2.mirror(axisPoint1, axisPoint2); update(); } -void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { //e->calculateBorders(); if (getMin().isInWindow(firstCorner, secondCorner) && getMax().isInWindow(firstCorner, secondCorner)) @@ -240,7 +240,7 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs double ang2 = edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2; - double diff = RS_Math::getAngleDifference(ang1, ang2); + double diff = Math::getAngleDifference(ang1, ang2); if (diff > M_PI) { @@ -249,7 +249,7 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs if (fabs(diff) > M_PI / 2) { - ang2 = RS_Math::correctAngle(ang2 + M_PI); + ang2 = Math::correctAngle(ang2 + M_PI); } Vector v; @@ -260,20 +260,20 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs update(true); } -void RS_DimAligned::moveRef(const Vector & ref, const Vector & offset) +void DimAligned::moveRef(const Vector & ref, const Vector & offset) { if (ref.distanceTo(data.definitionPoint) < 1.0e-4) { - RS_ConstructionLine l(NULL, RS_ConstructionLineData(edata.extensionPoint1, + ConstructionLine l(NULL, ConstructionLineData(edata.extensionPoint1, edata.extensionPoint2)); double d = l.getDistanceToPoint(data.definitionPoint + offset); double a = edata.extensionPoint2.angleTo(data.definitionPoint); - double ad = RS_Math::getAngleDifference(a, + double ad = Math::getAngleDifference(a, edata.extensionPoint2.angleTo(data.definitionPoint + offset)); if (fabs(ad) > M_PI / 2.0 && fabs(ad) < 3.0 / 2.0 * M_PI) { - a = RS_Math::correctAngle(a + M_PI); + a = Math::correctAngle(a + M_PI); } Vector v; @@ -321,7 +321,7 @@ void RS_DimAligned::moveRef(const Vector & ref, const Vector & offset) /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d) +std::ostream & operator<<(std::ostream & os, const DimAligned & d) { os << " DimAligned: " << d.getData() << "\n" << d.getEData() << "\n"; return os; diff --git a/src/base/dimaligned.h b/src/base/dimaligned.h index a8a7e4f..d4ed817 100644 --- a/src/base/dimaligned.h +++ b/src/base/dimaligned.h @@ -6,13 +6,13 @@ /** * Holds the data that defines an aligned dimension entity. */ -class RS_DimAlignedData +class DimAlignedData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimAlignedData() {} + DimAlignedData() {} /** * Constructor with initialisation. @@ -22,16 +22,16 @@ class RS_DimAlignedData * @para extensionPoint2 Definition point. Startpoint of the * second extension line. */ - RS_DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2) + DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2) { this->extensionPoint1 = extensionPoint1; this->extensionPoint2 = extensionPoint2; } - friend class RS_DimAligned; + friend class DimAligned; friend class ActionDimAligned; - friend std::ostream & operator<<(std::ostream & os, const RS_DimAlignedData & dd) + friend std::ostream & operator<<(std::ostream & os, const DimAlignedData & dd) { os << "(" << dd.extensionPoint1 << "/" << dd.extensionPoint1 << ")"; return os; @@ -49,15 +49,15 @@ class RS_DimAlignedData * * @author Andrew Mustun */ -class RS_DimAligned: public RS_Dimension +class DimAligned: public Dimension { public: - RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAlignedData & ed); - virtual ~RS_DimAligned(); + DimAligned(EntityContainer * parent, const DimensionData & d, const DimAlignedData & ed); + virtual ~DimAligned(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_DimAlignedData getEData() const; + DimAlignedData getEData() const; virtual VectorSolutions getRefPoints(); virtual QString getMeasuredLabel(); virtual void update(bool autoText = false); @@ -73,11 +73,11 @@ class RS_DimAligned: public RS_Dimension virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); virtual void moveRef(const Vector & ref, const Vector & offset); - friend std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d); + friend std::ostream & operator<<(std::ostream & os, const DimAligned & d); protected: /** Extended data. */ - RS_DimAlignedData edata; + DimAlignedData edata; }; #endif diff --git a/src/base/dimangular.cpp b/src/base/dimangular.cpp index 511a570..b1dfb4c 100644 --- a/src/base/dimangular.cpp +++ b/src/base/dimangular.cpp @@ -31,19 +31,19 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for angular dimension. */ -RS_DimAngular::RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimAngularData & ed): RS_Dimension(parent, d), edata(ed) +DimAngular::DimAngular(EntityContainer * parent, const DimensionData & d, + const DimAngularData & ed): Dimension(parent, d), edata(ed) { calculateBorders(); } -/*virtual*/ RS_DimAngular::~RS_DimAngular() +/*virtual*/ DimAngular::~DimAngular() { } -/*virtual*/ RS_Entity * RS_DimAngular::clone() +/*virtual*/ Entity * DimAngular::clone() { - RS_DimAngular * d = new RS_DimAngular(*this); + DimAngular * d = new DimAngular(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -52,7 +52,7 @@ RS_DimAngular::RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData } /** @return RS2::EntityDimAngular */ -/*virtual*/ RS2::EntityType RS_DimAngular::rtti() const +/*virtual*/ RS2::EntityType DimAngular::rtti() const { return RS2::EntityDimAngular; } @@ -61,7 +61,7 @@ RS_DimAngular::RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData * @return Copy of data that defines the angular dimension. * @see getData() */ -RS_DimAngularData RS_DimAngular::getEData() const +DimAngularData DimAngular::getEData() const { return edata; } @@ -70,20 +70,20 @@ RS_DimAngularData RS_DimAngular::getEData() const * @return Automatically created label for the default * measurement of this dimension. */ -QString RS_DimAngular::getMeasuredLabel() +QString DimAngular::getMeasuredLabel() { QString ret; int dimaunit = getGraphicVariableInt("$DIMAUNIT", 0); int dimadec = getGraphicVariableInt("$DIMADEC", 0); - ret = RS_Units::formatAngle(getAngle(), - RS_FilterDXF::numberToAngleFormat(dimaunit), + ret = Units::formatAngle(getAngle(), + FilterDXF::numberToAngleFormat(dimaunit), dimadec); /* ret = QString("%1%2") - .arg(RS_Math::rad2deg(getAngle())) + .arg(Math::rad2deg(getAngle())) .arg(RS_Char(0xB0)); */ return ret; @@ -94,7 +94,7 @@ QString RS_DimAngular::getMeasuredLabel() /** * @return Angle of the measured dimension. */ -double RS_DimAngular::getAngle() { +double DimAngular::getAngle() { double ang1 = 0.0; double ang2 = 0.0; bool reversed = false; @@ -121,12 +121,12 @@ double RS_DimAngular::getAngle() { /** * @return Center of the measured dimension. */ -Vector RS_DimAngular::getCenter() { - RS_ConstructionLine l1(NULL, RS_ConstructionLineData(edata.definitionPoint1, +Vector DimAngular::getCenter() { + ConstructionLine l1(NULL, ConstructionLineData(edata.definitionPoint1, edata.definitionPoint2)); - RS_ConstructionLine l2(NULL, RS_ConstructionLineData(edata.definitionPoint3, + ConstructionLine l2(NULL, ConstructionLineData(edata.definitionPoint3, data.definitionPoint)); - VectorSolutions vs = RS_Information::getIntersection(&l1, &l2, false); + VectorSolutions vs = Information::getIntersection(&l1, &l2, false); return vs.get(0); } @@ -142,7 +142,7 @@ Vector RS_DimAngular::getCenter() { * * @return true: on success */ -bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, +bool DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, Vector& p1, Vector& p2) { Vector center = getCenter(); @@ -151,7 +151,7 @@ bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, // find out the angles this dimension refers to: for (int f1=0; f1<=1 && !done; ++f1) { - ang1 = RS_Math::correctAngle( + ang1 = Math::correctAngle( edata.definitionPoint1.angleTo(edata.definitionPoint2) + f1*M_PI); if (f1==0) { p1 = edata.definitionPoint2; @@ -159,7 +159,7 @@ bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, p1 = edata.definitionPoint1; } for (int f2=0; f2<=1 && !done; ++f2) { - ang2 = RS_Math::correctAngle( + ang2 = Math::correctAngle( edata.definitionPoint3.angleTo(data.definitionPoint) + f2*M_PI); if (f2==0) { p2 = data.definitionPoint; @@ -183,10 +183,10 @@ bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, angDiff = ang1-ang2; } - ang1 = RS_Math::correctAngle(ang1); - ang2 = RS_Math::correctAngle(ang2); + ang1 = Math::correctAngle(ang1); + ang2 = Math::correctAngle(ang2); - if (RS_Math::isAngleBetween(ang, ang1, ang2, reversed) && + if (Math::isAngleBetween(ang, ang1, ang2, reversed) && angDiff<=M_PI) { done = true; break; @@ -206,9 +206,9 @@ bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed, * * @param autoText Automatically reposition the text label */ -void RS_DimAngular::update(bool /*autoText*/) { +void DimAngular::update(bool /*autoText*/) { - RS_DEBUG->print("RS_DimAngular::update"); + DEBUG->print("DimAngular::update"); clear(); @@ -242,7 +242,7 @@ void RS_DimAngular::update(bool /*autoText*/) { double rad = edata.definitionPoint4.distanceTo(center); - RS_Line* line; + Line* line; Vector dir; double len; double dist; @@ -251,10 +251,10 @@ void RS_DimAngular::update(bool /*autoText*/) { dist = center.distanceTo(p1); len = rad - dist + dimexe; dir.setPolar(1.0, ang1); - line = new RS_Line(this, - RS_LineData(center + dir*dist + dir*dimexo, + line = new Line(this, + LineData(center + dir*dist + dir*dimexo, center + dir*dist + dir*len)); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); @@ -262,18 +262,18 @@ void RS_DimAngular::update(bool /*autoText*/) { dist = center.distanceTo(p2); len = rad - dist + dimexe; dir.setPolar(1.0, ang2); - line = new RS_Line(this, - RS_LineData(center + dir*dist + dir*dimexo, + line = new Line(this, + LineData(center + dir*dist + dir*dimexo, center + dir*dist + dir*len)); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); // Create dimension line (arc): - RS_Arc* arc = new RS_Arc(this, - RS_ArcData(center, + Arc* arc = new Arc(this, + ArcData(center, rad, ang1, ang2, reversed)); - arc->setPen(RS_Pen(RS2::FlagInvalid)); + arc->setPen(Pen(RS2::FlagInvalid)); arc->setLayer(NULL); addEntity(arc); @@ -316,30 +316,30 @@ void RS_DimAngular::update(bool /*autoText*/) { } // Arrows: - RS_SolidData sd; - RS_Solid* arrow; + SolidData sd; + Solid* arrow; // arrow 1 - arrow = new RS_Solid(this, sd); + arrow = new Solid(this, sd); arrow->shapeArrow(arc->getStartpoint(), arrowAngle1, getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setPen(Pen(RS2::FlagInvalid)); arrow->setLayer(NULL); addEntity(arrow); // arrow 2: - arrow = new RS_Solid(this, sd); + arrow = new Solid(this, sd); arrow->shapeArrow(arc->getEndpoint(), arrowAngle2, getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setPen(Pen(RS2::FlagInvalid)); arrow->setLayer(NULL); addEntity(arrow); // text label: - RS_TextData textData; + TextData textData; Vector textPos = arc->getMiddlepoint(); Vector distV; @@ -363,7 +363,7 @@ void RS_DimAngular::update(bool /*autoText*/) { // move text away from dimension line: textPos+=distV; - textData = RS_TextData(textPos, + textData = TextData(textPos, dimtxt, 30.0, RS2::VAlignBottom, RS2::HAlignCenter, @@ -374,39 +374,39 @@ void RS_DimAngular::update(bool /*autoText*/) { "standard", textAngle); - RS_Text* text = new RS_Text(this, textData); + Text* text = new Text(this, textData); // move text to the side: - text->setPen(RS_Pen(RS2::FlagInvalid)); + text->setPen(Pen(RS2::FlagInvalid)); text->setLayer(NULL); addEntity(text); calculateBorders(); } -Vector RS_DimAngular::getDefinitionPoint1() +Vector DimAngular::getDefinitionPoint1() { return edata.definitionPoint1; } -Vector RS_DimAngular::getDefinitionPoint2() +Vector DimAngular::getDefinitionPoint2() { return edata.definitionPoint2; } -Vector RS_DimAngular::getDefinitionPoint3() +Vector DimAngular::getDefinitionPoint3() { return edata.definitionPoint3; } -Vector RS_DimAngular::getDefinitionPoint4() +Vector DimAngular::getDefinitionPoint4() { return edata.definitionPoint4; } -void RS_DimAngular::move(Vector offset) +void DimAngular::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.definitionPoint1.move(offset); edata.definitionPoint2.move(offset); @@ -417,8 +417,8 @@ void RS_DimAngular::move(Vector offset) -void RS_DimAngular::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); +void DimAngular::rotate(Vector center, double angle) { + Dimension::rotate(center, angle); edata.definitionPoint1.rotate(center, angle); edata.definitionPoint2.rotate(center, angle); @@ -429,8 +429,8 @@ void RS_DimAngular::rotate(Vector center, double angle) { -void RS_DimAngular::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); +void DimAngular::scale(Vector center, Vector factor) { + Dimension::scale(center, factor); edata.definitionPoint1.scale(center, factor); edata.definitionPoint2.scale(center, factor); @@ -441,8 +441,8 @@ void RS_DimAngular::scale(Vector center, Vector factor) { -void RS_DimAngular::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); +void DimAngular::mirror(Vector axisPoint1, Vector axisPoint2) { + Dimension::mirror(axisPoint1, axisPoint2); edata.definitionPoint1.mirror(axisPoint1, axisPoint2); edata.definitionPoint2.mirror(axisPoint1, axisPoint2); @@ -454,7 +454,7 @@ void RS_DimAngular::mirror(Vector axisPoint1, Vector axisPoint2) { /** * Dumps the point's data to stdout. */ -std::ostream& operator << (std::ostream& os, const RS_DimAngular& d) { +std::ostream& operator << (std::ostream& os, const DimAngular& d) { os << " DimAngular: " << d.getData() << "\n" << d.getEData() << "\n"; return os; } diff --git a/src/base/dimangular.h b/src/base/dimangular.h index 4c3f71e..654e7c6 100644 --- a/src/base/dimangular.h +++ b/src/base/dimangular.h @@ -6,13 +6,13 @@ /** * Holds the data that defines a angular dimension entity. */ -class RS_DimAngularData +class DimAngularData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimAngularData() {} + DimAngularData() {} /** * Constructor with initialisation. @@ -20,7 +20,7 @@ class RS_DimAngularData * @param definitionPoint Definition point of the angular dimension. * @param leader Leader length. */ - RS_DimAngularData(const Vector& definitionPoint1, const Vector& definitionPoint2, + DimAngularData(const Vector& definitionPoint1, const Vector& definitionPoint2, const Vector& definitionPoint3, const Vector& definitionPoint4) { this->definitionPoint1 = definitionPoint1; @@ -29,7 +29,7 @@ class RS_DimAngularData this->definitionPoint4 = definitionPoint4; } - friend std::ostream & operator<<(std::ostream& os, const RS_DimAngularData & dd) + friend std::ostream & operator<<(std::ostream& os, const DimAngularData & dd) { os << "(" << dd.definitionPoint1 << "/" << dd.definitionPoint2 << "/" << dd.definitionPoint3 << "/" << dd.definitionPoint3 << ")"; @@ -52,15 +52,15 @@ class RS_DimAngularData * * @author Andrew Mustun */ -class RS_DimAngular: public RS_Dimension +class DimAngular: public Dimension { public: - RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAngularData & ed); - virtual ~RS_DimAngular(); + DimAngular(EntityContainer * parent, const DimensionData & d, const DimAngularData & ed); + virtual ~DimAngular(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_DimAngularData getEData() const; + DimAngularData getEData() const; virtual QString getMeasuredLabel(); double getAngle(); Vector getCenter(); @@ -78,11 +78,11 @@ class RS_DimAngular: public RS_Dimension virtual void scale(Vector center, Vector factor); virtual void mirror(Vector axisPoint1, Vector axisPoint2); - friend std::ostream & operator<<(std::ostream & os, const RS_DimAngular & d); + friend std::ostream & operator<<(std::ostream & os, const DimAngular & d); protected: /** Extended data. */ - RS_DimAngularData edata; + DimAngularData edata; }; #endif diff --git a/src/base/dimdiametric.cpp b/src/base/dimdiametric.cpp index 811115d..934c1f2 100644 --- a/src/base/dimdiametric.cpp +++ b/src/base/dimdiametric.cpp @@ -28,19 +28,19 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for diametric dimension. */ -RS_DimDiametric::RS_DimDiametric(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimDiametricData & ed): RS_Dimension(parent, d), edata(ed) +DimDiametric::DimDiametric(EntityContainer * parent, const DimensionData & d, + const DimDiametricData & ed): Dimension(parent, d), edata(ed) { calculateBorders(); } -/*virtual*/ RS_DimDiametric::~RS_DimDiametric() +/*virtual*/ DimDiametric::~DimDiametric() { } -/*virtual*/ RS_Entity * RS_DimDiametric::clone() +/*virtual*/ Entity * DimDiametric::clone() { - RS_DimDiametric * d = new RS_DimDiametric(*this); + DimDiametric * d = new DimDiametric(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -49,7 +49,7 @@ RS_DimDiametric::RS_DimDiametric(RS_EntityContainer * parent, const RS_Dimension } /** @return RS2::EntityDimDiametric */ -/*virtual*/ RS2::EntityType RS_DimDiametric::rtti() const +/*virtual*/ RS2::EntityType DimDiametric::rtti() const { return RS2::EntityDimDiametric; } @@ -58,7 +58,7 @@ RS_DimDiametric::RS_DimDiametric(RS_EntityContainer * parent, const RS_Dimension * @return Copy of data that defines the diametric dimension. * @see getData() */ -RS_DimDiametricData RS_DimDiametric::getEData() const +DimDiametricData DimDiametric::getEData() const { return edata; } @@ -67,7 +67,7 @@ RS_DimDiametricData RS_DimDiametric::getEData() const * @return Automatically created label for the default * measurement of this dimension. */ -QString RS_DimDiametric::getMeasuredLabel() +QString DimDiametric::getMeasuredLabel() { // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint); @@ -76,7 +76,7 @@ QString RS_DimDiametric::getMeasuredLabel() QString ret; if (graphic!=NULL) { - ret = RS_Units::formatLinear(dist, graphic->getUnit(), + ret = Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); } else { @@ -86,7 +86,7 @@ QString RS_DimDiametric::getMeasuredLabel() return ret; } -VectorSolutions RS_DimDiametric::getRefPoints() +VectorSolutions DimDiametric::getRefPoints() { VectorSolutions ret(edata.definitionPoint, data.definitionPoint, data.middleOfText); return ret; @@ -98,9 +98,9 @@ VectorSolutions RS_DimDiametric::getRefPoints() * * @param autoText Automatically reposition the text label */ -void RS_DimDiametric::update(bool autoText) +void DimDiametric::update(bool autoText) { - RS_DEBUG->print("RS_DimDiametric::update"); + DEBUG->print("DimDiametric::update"); clear(); if (isUndone()) @@ -111,48 +111,48 @@ void RS_DimDiametric::update(bool autoText) calculateBorders(); } -Vector RS_DimDiametric::getDefinitionPoint() +Vector DimDiametric::getDefinitionPoint() { return edata.definitionPoint; } -double RS_DimDiametric::getLeader() +double DimDiametric::getLeader() { return edata.leader; } -void RS_DimDiametric::move(Vector offset) +void DimDiametric::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.definitionPoint.move(offset); update(); } -void RS_DimDiametric::rotate(Vector center, double angle) +void DimDiametric::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); + Dimension::rotate(center, angle); edata.definitionPoint.rotate(center, angle); update(); } -void RS_DimDiametric::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); +void DimDiametric::scale(Vector center, Vector factor) { + Dimension::scale(center, factor); edata.definitionPoint.scale(center, factor); edata.leader*=factor.x; update(); } -void RS_DimDiametric::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); +void DimDiametric::mirror(Vector axisPoint1, Vector axisPoint2) { + Dimension::mirror(axisPoint1, axisPoint2); edata.definitionPoint.mirror(axisPoint1, axisPoint2); update(); } -void RS_DimDiametric::moveRef(const Vector& ref, const Vector& offset) +void DimDiametric::moveRef(const Vector& ref, const Vector& offset) { if (ref.distanceTo(edata.definitionPoint)<1.0e-4) { Vector c = (edata.definitionPoint + data.definitionPoint)/2.0; @@ -185,7 +185,7 @@ void RS_DimDiametric::moveRef(const Vector& ref, const Vector& offset) /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_DimDiametric & d) +std::ostream & operator<<(std::ostream & os, const DimDiametric & d) { os << " DimDiametric: " << d.getData() << "\n" << d.getEData() << "\n"; return os; diff --git a/src/base/dimdiametric.h b/src/base/dimdiametric.h index d3ea959..7f4ef8d 100644 --- a/src/base/dimdiametric.h +++ b/src/base/dimdiametric.h @@ -6,13 +6,13 @@ /** * Holds the data that defines a diametric dimension entity. */ -class RS_DimDiametricData +class DimDiametricData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimDiametricData() {} + DimDiametricData() {} /** * Constructor with initialisation. @@ -20,16 +20,16 @@ public: * @param definitionPoint Definition point of the diametric dimension. * @param leader Leader length. */ - RS_DimDiametricData(const Vector& definitionPoint, + DimDiametricData(const Vector& definitionPoint, double leader) { this->definitionPoint = definitionPoint; this->leader = leader; } - friend class RS_DimDiametric; + friend class DimDiametric; //friend class RS_ActionDimDiametric; - friend std::ostream & operator<<(std::ostream & os, const RS_DimDiametricData & dd) + friend std::ostream & operator<<(std::ostream & os, const DimDiametricData & dd) { os << "(" << dd.definitionPoint << "/" << dd.leader << ")"; return os; @@ -47,15 +47,15 @@ public: * * @author Andrew Mustun */ -class RS_DimDiametric: public RS_Dimension +class DimDiametric: public Dimension { public: - RS_DimDiametric(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimDiametricData & ed); - virtual ~RS_DimDiametric(); + DimDiametric(EntityContainer * parent, const DimensionData & d, const DimDiametricData & ed); + virtual ~DimDiametric(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_DimDiametricData getEData() const; + DimDiametricData getEData() const; virtual VectorSolutions getRefPoints(); virtual QString getMeasuredLabel(); virtual void update(bool autoText=false); @@ -67,11 +67,11 @@ class RS_DimDiametric: public RS_Dimension virtual void mirror(Vector axisPoint1, Vector axisPoint2); virtual void moveRef(const Vector & ref, const Vector & offset); - friend std::ostream & operator<<(std::ostream & os, const RS_DimDiametric & d); + friend std::ostream & operator<<(std::ostream & os, const DimDiametric & d); protected: /** Extended data. */ - RS_DimDiametricData edata; + DimDiametricData edata; }; #endif diff --git a/src/base/dimension.cpp b/src/base/dimension.cpp index 56f73bd..4718345 100644 --- a/src/base/dimension.cpp +++ b/src/base/dimension.cpp @@ -23,29 +23,29 @@ /** * Constructor. */ -RS_Dimension::RS_Dimension(RS_EntityContainer * parent, const RS_DimensionData & d): - RS_EntityContainer(parent), data(d) +Dimension::Dimension(EntityContainer * parent, const DimensionData & d): + EntityContainer(parent), data(d) { } -/*virtual*/ RS_Dimension::~RS_Dimension() +/*virtual*/ Dimension::~Dimension() { } /** @return Copy of data that defines the dimension. */ -RS_DimensionData RS_Dimension::getData() const +DimensionData Dimension::getData() const { return data; } -Vector RS_Dimension::getNearestRef(const Vector & coord, double * dist) +Vector Dimension::getNearestRef(const Vector & coord, double * dist) { - return RS_Entity::getNearestRef(coord, dist); + return Entity::getNearestRef(coord, dist); } -Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist) +Vector Dimension::getNearestSelectedRef(const Vector & coord, double * dist) { - return RS_Entity::getNearestSelectedRef(coord, dist); + return Entity::getNearestSelectedRef(coord, dist); } /** @@ -56,7 +56,7 @@ Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist) * label if appropriate. * @see getMeasuredLabel */ -QString RS_Dimension::getLabel(bool resolve) +QString Dimension::getLabel(bool resolve) { if (!resolve) return data.text; @@ -82,7 +82,7 @@ QString RS_Dimension::getLabel(bool resolve) /** * Sets a new text for the label. */ -void RS_Dimension::setLabel(const QString & l) +void Dimension::setLabel(const QString & l) { data.text = l; } @@ -92,11 +92,11 @@ void RS_Dimension::setLabel(const QString & l) * * @param forceAutoText Automatically reposition the text label. */ -void RS_Dimension::updateCreateDimensionLine(const Vector & p1, +void Dimension::updateCreateDimensionLine(const Vector & p1, const Vector & p2, bool arrow1, bool arrow2, bool forceAutoText) { #if 0 -printf("RS_Dimension::updateCreateDimensionLine()...\n"); +printf("Dimension::updateCreateDimensionLine()...\n"); #endif // text height (DIMTXT) double dimtxt = getTextHeight(); @@ -110,8 +110,8 @@ printf("RS_Dimension::updateCreateDimensionLine()...\n"); double arrowAngle1, arrowAngle2; // Create dimension line: - RS_Line * dimensionLine = new RS_Line(this, RS_LineData(p1, p2)); - dimensionLine->setPen(RS_Pen(RS2::FlagInvalid)); + Line * dimensionLine = new Line(this, LineData(p1, p2)); + dimensionLine->setPen(Pen(RS2::FlagInvalid)); dimensionLine->setLayer(NULL); addEntity(dimensionLine); @@ -133,15 +133,15 @@ printf("RS_Dimension::updateCreateDimensionLine()...\n"); } // Arrows: - RS_SolidData sd; - RS_Solid * arrow; + SolidData sd; + Solid * arrow; if (arrow1) { // arrow 1 - arrow = new RS_Solid(this, sd); + arrow = new Solid(this, sd); arrow->shapeArrow(p1, arrowAngle1, getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setPen(Pen(RS2::FlagInvalid)); arrow->setLayer(NULL); addEntity(arrow); } @@ -149,21 +149,21 @@ printf("RS_Dimension::updateCreateDimensionLine()...\n"); if (arrow2) { // arrow 2: - arrow = new RS_Solid(this, sd); + arrow = new Solid(this, sd); arrow->shapeArrow(p2, arrowAngle2, getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setPen(Pen(RS2::FlagInvalid)); arrow->setLayer(NULL); addEntity(arrow); } // Text label: - RS_TextData textData; + TextData textData; Vector textPos; double dimAngle1 = dimensionLine->getAngle1(); double textAngle; bool corrected = false; - textAngle = RS_Math::makeAngleReadable(dimAngle1, true, &corrected); + textAngle = Math::makeAngleReadable(dimAngle1, true, &corrected); if (data.middleOfText.valid && !forceAutoText) { @@ -188,13 +188,13 @@ printf("RS_Dimension::updateCreateDimensionLine()...\n"); data.middleOfText = textPos; } - textData = RS_TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter, + textData = TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter, RS2::LeftToRight, RS2::Exact, 1.0, getLabel(), "standard", textAngle); #if 0 printf("--> %s\n", getLabel().toAscii().data()); #endif - RS_Text * text = new RS_Text(this, textData); + Text * text = new Text(this, textData); // move text to the side: Vector distH; @@ -205,52 +205,52 @@ printf("--> %s\n", getLabel().toAscii().data()); text->move(distH); } - text->setPen(RS_Pen(RS2::FlagInvalid)); + text->setPen(Pen(RS2::FlagInvalid)); text->setLayer(NULL); addEntity(text); } -Vector RS_Dimension::getDefinitionPoint() +Vector Dimension::getDefinitionPoint() { return data.definitionPoint; } -Vector RS_Dimension::getMiddleOfText() +Vector Dimension::getMiddleOfText() { return data.middleOfText; } -RS2::VAlign RS_Dimension::getVAlign() +RS2::VAlign Dimension::getVAlign() { return data.valign; } -RS2::HAlign RS_Dimension::getHAlign() +RS2::HAlign Dimension::getHAlign() { return data.halign; } -RS2::TextLineSpacingStyle RS_Dimension::getLineSpacingStyle() +RS2::TextLineSpacingStyle Dimension::getLineSpacingStyle() { return data.lineSpacingStyle; } -double RS_Dimension::getLineSpacingFactor() +double Dimension::getLineSpacingFactor() { return data.lineSpacingFactor; } -QString RS_Dimension::getText() +QString Dimension::getText() { return data.text; } -QString RS_Dimension::getStyle() +QString Dimension::getStyle() { return data.style; } -double RS_Dimension::getAngle() +double Dimension::getAngle() { return data.angle; } @@ -258,7 +258,7 @@ double RS_Dimension::getAngle() /** * @return arrow size in drawing units. */ -double RS_Dimension::getArrowSize() +double Dimension::getArrowSize() { return getGraphicVariable("$DIMASZ", 2.5, 40); } @@ -266,7 +266,7 @@ double RS_Dimension::getArrowSize() /** * @return extension line overlength in drawing units. */ -double RS_Dimension::getExtensionLineExtension() +double Dimension::getExtensionLineExtension() { return getGraphicVariable("$DIMEXE", 1.25, 40); } @@ -274,7 +274,7 @@ double RS_Dimension::getExtensionLineExtension() /** * @return extension line offset from entities in drawing units. */ -double RS_Dimension::getExtensionLineOffset() +double Dimension::getExtensionLineOffset() { return getGraphicVariable("$DIMEXO", 0.625, 40); } @@ -282,7 +282,7 @@ double RS_Dimension::getExtensionLineOffset() /** * @return extension line gap to text in drawing units. */ -double RS_Dimension::getDimensionLineGap() +double Dimension::getDimensionLineGap() { return getGraphicVariable("$DIMGAP", 0.625, 40); } @@ -290,7 +290,7 @@ double RS_Dimension::getDimensionLineGap() /** * @return Dimension lables text height. */ -double RS_Dimension::getTextHeight() +double Dimension::getTextHeight() { return getGraphicVariable("$DIMTXT", 2.5, 40); } @@ -301,13 +301,13 @@ double RS_Dimension::getTextHeight() * If the variable is not found it is added with the given default * value converted to the local unit. */ -double RS_Dimension::getGraphicVariable(const QString & key, double defMM, int code) +double Dimension::getGraphicVariable(const QString & key, double defMM, int code) { double v = getGraphicVariableDouble(key, RS_MINDOUBLE); if (v <= RS_MINDOUBLE) { - addGraphicVariable(key, RS_Units::convert(defMM, RS2::Millimeter, getGraphicUnit()), + addGraphicVariable(key, Units::convert(defMM, RS2::Millimeter, getGraphicUnit()), code); v = getGraphicVariableDouble(key, 1.0); } @@ -315,31 +315,31 @@ double RS_Dimension::getGraphicVariable(const QString & key, double defMM, int c return v; } -/*virtual*/ double RS_Dimension::getLength() +/*virtual*/ double Dimension::getLength() { return -1.0; } -void RS_Dimension::move(Vector offset) +void Dimension::move(Vector offset) { data.definitionPoint.move(offset); data.middleOfText.move(offset); } -void RS_Dimension::rotate(Vector center, double angle) +void Dimension::rotate(Vector center, double angle) { data.definitionPoint.rotate(center, angle); data.middleOfText.rotate(center, angle); - data.angle = RS_Math::correctAngle(data.angle+angle); + data.angle = Math::correctAngle(data.angle+angle); } -void RS_Dimension::scale(Vector center, Vector factor) +void Dimension::scale(Vector center, Vector factor) { data.definitionPoint.scale(center, factor); data.middleOfText.scale(center, factor); } -void RS_Dimension::mirror(Vector axisPoint1, Vector axisPoint2) +void Dimension::mirror(Vector axisPoint1, Vector axisPoint2) { data.definitionPoint.mirror(axisPoint1, axisPoint2); data.middleOfText.mirror(axisPoint1, axisPoint2); diff --git a/src/base/dimension.h b/src/base/dimension.h index fadc601..50360da 100644 --- a/src/base/dimension.h +++ b/src/base/dimension.h @@ -6,13 +6,13 @@ /** * Holds the data that is common to all dimension entities. */ -class RS_DimensionData: public RS_Flags +class DimensionData: public Flags { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimensionData() {} + DimensionData() {} /** * Constructor with initialisation. @@ -30,7 +30,7 @@ class RS_DimensionData: public RS_Flags * @param angle Rotation angle of dimension text away from * default orientation. */ - RS_DimensionData(const Vector & definitionPoint, + DimensionData(const Vector & definitionPoint, const Vector & middleOfText, RS2::VAlign valign, RS2::HAlign halign, @@ -51,13 +51,13 @@ class RS_DimensionData: public RS_Flags this->angle = angle; } - friend class RS_Dimension; - friend class RS_DimAligned; - friend class RS_DimLinear; + friend class Dimension; + friend class DimAligned; + friend class DimLinear; friend class RS_ActionDimAligned; friend class RS_ActionDimLinear; - friend std::ostream & operator<<(std::ostream & os, const RS_DimensionData & dd) + friend std::ostream & operator<<(std::ostream & os, const DimensionData & dd) { os << "(" << dd.definitionPoint << ")"; return os; @@ -93,13 +93,13 @@ class RS_DimensionData: public RS_Flags * * @author Andrew Mustun */ -class RS_Dimension: public RS_EntityContainer +class Dimension: public EntityContainer { public: - RS_Dimension(RS_EntityContainer * parent, const RS_DimensionData & d); - virtual ~RS_Dimension(); + Dimension(EntityContainer * parent, const DimensionData & d); + virtual ~Dimension(); - RS_DimensionData getData() const; + DimensionData getData() const; Vector getNearestRef(const Vector & coord, double * dist); Vector getNearestSelectedRef(const Vector & coord, double * dist); QString getLabel(bool resolve = true); @@ -142,7 +142,7 @@ class RS_Dimension: public RS_EntityContainer protected: /** Data common to all dimension entities. */ - RS_DimensionData data; + DimensionData data; }; #endif diff --git a/src/base/dimlinear.cpp b/src/base/dimlinear.cpp index 9ce80df..16063aa 100644 --- a/src/base/dimlinear.cpp +++ b/src/base/dimlinear.cpp @@ -29,19 +29,19 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for linear dimension. */ -RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimLinearData & ed): RS_Dimension(parent, d), edata(ed) +DimLinear::DimLinear(EntityContainer * parent, const DimensionData & d, + const DimLinearData & ed): Dimension(parent, d), edata(ed) { calculateBorders(); } -/*virtual*/ RS_DimLinear::~RS_DimLinear() +/*virtual*/ DimLinear::~DimLinear() { } -/*virtual*/ RS_Entity * RS_DimLinear::clone() +/*virtual*/ Entity * DimLinear::clone() { - RS_DimLinear * d = new RS_DimLinear(*this); + DimLinear * d = new DimLinear(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -51,7 +51,7 @@ RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & } /** @return RS2::EntityDimLinear */ -/*virtual*/ RS2::EntityType RS_DimLinear::rtti() const +/*virtual*/ RS2::EntityType DimLinear::rtti() const { return RS2::EntityDimLinear; } @@ -60,12 +60,12 @@ RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & * @return Copy of data that defines the linear dimension. * @see getData() */ -RS_DimLinearData RS_DimLinear::getEData() const +DimLinearData DimLinear::getEData() const { return edata; } -VectorSolutions RS_DimLinear::getRefPoints() +VectorSolutions DimLinear::getRefPoints() { VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2, data.definitionPoint, data.middleOfText); @@ -77,14 +77,14 @@ VectorSolutions RS_DimLinear::getRefPoints() * @return Automatically created label for the default * measurement of this dimension. */ -QString RS_DimLinear::getMeasuredLabel() +QString DimLinear::getMeasuredLabel() { // direction of dimension line Vector dirDim; dirDim.setPolar(100.0, edata.angle); // construction line for dimension line - RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint, + ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint, data.definitionPoint + dirDim)); Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1); @@ -98,17 +98,17 @@ QString RS_DimLinear::getMeasuredLabel() QString ret; if (graphic) - ret = RS_Units::formatLinear(dist, graphic->getUnit(), + ret = Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); else ret = QString("%1").arg(dist); //It's properly creating the label... -//printf("RS_DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data()); +//printf("DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data()); return ret; } -bool RS_DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2) { return (edata.extensionPoint1.isInWindow(v1, v2) || edata.extensionPoint2.isInWindow(v1, v2)); @@ -120,9 +120,9 @@ bool RS_DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2) * * @param autoText Automatically reposition the text label */ -void RS_DimLinear::update(bool autoText) +void DimLinear::update(bool autoText) { - RS_DEBUG->print("RS_DimLinear::update"); + DEBUG->print("DimLinear::update"); clear(); @@ -134,7 +134,7 @@ void RS_DimLinear::update(bool autoText) // extension line extension (DIMEXE) double dimexe = getExtensionLineExtension(); - RS_LineData ld; + LineData ld; double extAngle = edata.angle + (M_PI / 2.0); // direction of dimension line @@ -145,7 +145,7 @@ void RS_DimLinear::update(bool autoText) dirExt.setPolar(100.0, extAngle); // construction line for dimension line - RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint, + ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint, data.definitionPoint + dirDim)); Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1); @@ -154,8 +154,8 @@ void RS_DimLinear::update(bool autoText) // Definitive dimension line: updateCreateDimensionLine(dimP1, dimP2, true, true, autoText); /* - ld = RS_LineData(data.definitionPoint, dimP1); - RS_Line* dimensionLine = new RS_Line(this, ld); + ld = LineData(data.definitionPoint, dimP1); + Line* dimensionLine = new Line(this, ld); addEntity(dimensionLine); */ Vector vDimexo1, vDimexe1, vDimexo2, vDimexe2; @@ -178,78 +178,78 @@ void RS_DimLinear::update(bool autoText) } // extension lines: - ld = RS_LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1); - RS_Line * line = new RS_Line(this, ld); - line->setPen(RS_Pen(RS2::FlagInvalid)); + ld = LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1); + Line * line = new Line(this, ld); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); - ld = RS_LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2); + ld = LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2); //data.definitionPoint+vDimexe2); - line = new RS_Line(this, ld); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line = new Line(this, ld); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); calculateBorders(); } -Vector RS_DimLinear::getExtensionPoint1() +Vector DimLinear::getExtensionPoint1() { return edata.extensionPoint1; } -Vector RS_DimLinear::getExtensionPoint2() +Vector DimLinear::getExtensionPoint2() { return edata.extensionPoint2; } -double RS_DimLinear::getAngle() +double DimLinear::getAngle() { return edata.angle; } -void RS_DimLinear::setAngle(double a) +void DimLinear::setAngle(double a) { - edata.angle = RS_Math::correctAngle(a); + edata.angle = Math::correctAngle(a); } -double RS_DimLinear::getOblique() +double DimLinear::getOblique() { return edata.oblique; } -void RS_DimLinear::move(Vector offset) +void DimLinear::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.extensionPoint1.move(offset); edata.extensionPoint2.move(offset); update(); } -void RS_DimLinear::rotate(Vector center, double angle) +void DimLinear::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); + Dimension::rotate(center, angle); edata.extensionPoint1.rotate(center, angle); edata.extensionPoint2.rotate(center, angle); - edata.angle = RS_Math::correctAngle(edata.angle+angle); + edata.angle = Math::correctAngle(edata.angle+angle); update(); } -void RS_DimLinear::scale(Vector center, Vector factor) +void DimLinear::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); + Dimension::scale(center, factor); edata.extensionPoint1.scale(center, factor); edata.extensionPoint2.scale(center, factor); update(); } -void RS_DimLinear::mirror(Vector axisPoint1, Vector axisPoint2) +void DimLinear::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); + Dimension::mirror(axisPoint1, axisPoint2); edata.extensionPoint1.mirror(axisPoint1, axisPoint2); edata.extensionPoint2.mirror(axisPoint1, axisPoint2); @@ -262,7 +262,7 @@ void RS_DimLinear::mirror(Vector axisPoint1, Vector axisPoint2) update(); } -void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { //e->calculateBorders(); if (getMin().isInWindow(firstCorner, secondCorner) @@ -287,13 +287,13 @@ void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offse double ang2 = edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI/2; - double diff = RS_Math::getAngleDifference(ang1, ang2); + double diff = Math::getAngleDifference(ang1, ang2); if (diff>M_PI) { diff-=2*M_PI; } if (fabs(diff)>M_PI/2) { - ang2 = RS_Math::correctAngle(ang2+M_PI); + ang2 = Math::correctAngle(ang2+M_PI); } Vector v; @@ -305,7 +305,7 @@ void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offse update(true); } -void RS_DimLinear::moveRef(const Vector & ref, const Vector & offset) +void DimLinear::moveRef(const Vector & ref, const Vector & offset) { if (ref.distanceTo(data.definitionPoint) < 1.0e-4) { @@ -332,7 +332,7 @@ void RS_DimLinear::moveRef(const Vector & ref, const Vector & offset) /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_DimLinear & d) +std::ostream & operator<<(std::ostream & os, const DimLinear & d) { os << " DimLinear: " << d.getData() << "\n" << d.getEData() << "\n"; return os; diff --git a/src/base/dimlinear.h b/src/base/dimlinear.h index 80ed0b1..fbedb12 100644 --- a/src/base/dimlinear.h +++ b/src/base/dimlinear.h @@ -6,13 +6,13 @@ /** * Holds the data that defines a linear dimension entity. */ -class RS_DimLinearData +class DimLinearData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimLinearData() {} + DimLinearData() {} /** * Constructor with initialisation. @@ -22,7 +22,7 @@ class RS_DimLinearData * @param angle Rotation angle in rad. * @param oblique Oblique angle in rad. */ - RS_DimLinearData(const Vector & extensionPoint1, + DimLinearData(const Vector & extensionPoint1, const Vector & extensionPoint2, double angle, double oblique) { @@ -32,10 +32,10 @@ class RS_DimLinearData this->oblique = oblique; } - friend class RS_DimLinear; + friend class DimLinear; friend class RS_ActionDimLinear; - friend std::ostream & operator<<(std::ostream & os, const RS_DimLinearData & dd) + friend std::ostream & operator<<(std::ostream & os, const DimLinearData & dd) { os << "(" << dd.extensionPoint1 << "/" << dd.extensionPoint1 << ")"; return os; @@ -57,15 +57,15 @@ class RS_DimLinearData * * @author Andrew Mustun */ -class RS_DimLinear: public RS_Dimension +class DimLinear: public Dimension { public: - RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimLinearData & ed); - virtual ~RS_DimLinear(); + DimLinear(EntityContainer * parent, const DimensionData & d, const DimLinearData & ed); + virtual ~DimLinear(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_DimLinearData getEData() const; + DimLinearData getEData() const; virtual VectorSolutions getRefPoints(); virtual QString getMeasuredLabel(); virtual void update(bool autoText = false); @@ -82,11 +82,11 @@ class RS_DimLinear: public RS_Dimension virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); virtual void moveRef(const Vector & ref, const Vector & offset); - friend std::ostream & operator<<(std::ostream & os, const RS_DimLinear & d); + friend std::ostream & operator<<(std::ostream & os, const DimLinear & d); protected: /** Extended data. */ - RS_DimLinearData edata; + DimLinearData edata; }; #endif diff --git a/src/base/dimradial.cpp b/src/base/dimradial.cpp index d2d48dc..dd78362 100644 --- a/src/base/dimradial.cpp +++ b/src/base/dimradial.cpp @@ -28,18 +28,18 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for radial dimension. */ -RS_DimRadial::RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimRadialData & ed): RS_Dimension(parent, d), edata(ed) +DimRadial::DimRadial(EntityContainer * parent, const DimensionData & d, + const DimRadialData & ed): Dimension(parent, d), edata(ed) { } -/*virtual*/ RS_DimRadial::~RS_DimRadial() +/*virtual*/ DimRadial::~DimRadial() { } -/*virtual*/ RS_Entity * RS_DimRadial::clone() +/*virtual*/ Entity * DimRadial::clone() { - RS_DimRadial * d = new RS_DimRadial(*this); + DimRadial * d = new DimRadial(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -48,7 +48,7 @@ RS_DimRadial::RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & } /** @return RS2::EntityDimRadial */ -/*virtual*/ RS2::EntityType RS_DimRadial::rtti() const +/*virtual*/ RS2::EntityType DimRadial::rtti() const { return RS2::EntityDimRadial; } @@ -57,7 +57,7 @@ RS_DimRadial::RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & * @return Copy of data that defines the radial dimension. * @see getData() */ -RS_DimRadialData RS_DimRadial::getEData() const +DimRadialData DimRadial::getEData() const { return edata; } @@ -66,7 +66,7 @@ RS_DimRadialData RS_DimRadial::getEData() const * @return Automatically created label for the default * measurement of this dimension. */ -QString RS_DimRadial::getMeasuredLabel() +QString DimRadial::getMeasuredLabel() { // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint); @@ -75,7 +75,7 @@ QString RS_DimRadial::getMeasuredLabel() QString ret; if (graphic!=NULL) { - ret = RS_Units::formatLinear(dist, graphic->getUnit(), + ret = Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); } else { ret = QString("%1").arg(dist); @@ -85,7 +85,7 @@ QString RS_DimRadial::getMeasuredLabel() } -VectorSolutions RS_DimRadial::getRefPoints() { +VectorSolutions DimRadial::getRefPoints() { VectorSolutions ret(edata.definitionPoint, data.definitionPoint, data.middleOfText); return ret; @@ -97,9 +97,9 @@ VectorSolutions RS_DimRadial::getRefPoints() { * * @param autoText Automatically reposition the text label */ -void RS_DimRadial::update(bool autoText) +void DimRadial::update(bool autoText) { - RS_DEBUG->print("RS_DimRadial::update"); + DEBUG->print("DimRadial::update"); clear(); @@ -123,9 +123,9 @@ void RS_DimRadial::update(bool autoText) // length of dimension line: double length = p1.distanceTo(p2); - RS_TextData textData; + TextData textData; - textData = RS_TextData(Vector(0.0,0.0), + textData = TextData(Vector(0.0,0.0), dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter, @@ -136,7 +136,7 @@ void RS_DimRadial::update(bool autoText) "standard", 0.0); - RS_Text* text = new RS_Text(this, textData); + Text* text = new Text(this, textData); double textWidth = text->getSize().x; // do we have to put the arrow / text outside of the arc? @@ -151,14 +151,14 @@ void RS_DimRadial::update(bool autoText) } // create arrow: - RS_SolidData sd; - RS_Solid* arrow; + SolidData sd; + Solid* arrow; - arrow = new RS_Solid(this, sd); + arrow = new Solid(this, sd); arrow->shapeArrow(p2, arrowAngle, getArrowSize()); - arrow->setPen(RS_Pen(RS2::FlagInvalid)); + arrow->setPen(Pen(RS2::FlagInvalid)); arrow->setLayer(NULL); addEntity(arrow); @@ -167,8 +167,8 @@ void RS_DimRadial::update(bool autoText) p3 += p1; // Create dimension line: - RS_Line* dimensionLine = new RS_Line(this, RS_LineData(p1, p3)); - dimensionLine->setPen(RS_Pen(RS2::FlagInvalid)); + Line* dimensionLine = new Line(this, LineData(p1, p3)); + dimensionLine->setPen(Pen(RS2::FlagInvalid)); dimensionLine->setLayer(NULL); addEntity(dimensionLine); @@ -209,34 +209,34 @@ void RS_DimRadial::update(bool autoText) text->rotate(Vector(0.0,0.0), textAngle); text->move(textPos); - text->setPen(RS_Pen(RS2::FlagInvalid)); + text->setPen(Pen(RS2::FlagInvalid)); text->setLayer(NULL); addEntity(text); calculateBorders(); } -Vector RS_DimRadial::getDefinitionPoint() +Vector DimRadial::getDefinitionPoint() { return edata.definitionPoint; } -double RS_DimRadial::getLeader() +double DimRadial::getLeader() { return edata.leader; } -void RS_DimRadial::move(Vector offset) +void DimRadial::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.definitionPoint.move(offset); update(); } -void RS_DimRadial::rotate(Vector center, double angle) +void DimRadial::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); + Dimension::rotate(center, angle); edata.definitionPoint.rotate(center, angle); update(); @@ -244,8 +244,8 @@ void RS_DimRadial::rotate(Vector center, double angle) -void RS_DimRadial::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); +void DimRadial::scale(Vector center, Vector factor) { + Dimension::scale(center, factor); edata.definitionPoint.scale(center, factor); edata.leader*=factor.x; @@ -254,15 +254,15 @@ void RS_DimRadial::scale(Vector center, Vector factor) { -void RS_DimRadial::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); +void DimRadial::mirror(Vector axisPoint1, Vector axisPoint2) { + Dimension::mirror(axisPoint1, axisPoint2); edata.definitionPoint.mirror(axisPoint1, axisPoint2); update(); } -void RS_DimRadial::moveRef(const Vector& ref, const Vector& offset) { +void DimRadial::moveRef(const Vector& ref, const Vector& offset) { if (ref.distanceTo(edata.definitionPoint)<1.0e-4) { double d = data.definitionPoint.distanceTo(edata.definitionPoint); @@ -282,7 +282,7 @@ void RS_DimRadial::moveRef(const Vector& ref, const Vector& offset) { /** * Dumps the point's data to stdout. */ -std::ostream& operator << (std::ostream& os, const RS_DimRadial& d) { +std::ostream& operator << (std::ostream& os, const DimRadial& d) { os << " DimRadial: " << d.getData() << "\n" << d.getEData() << "\n"; return os; } diff --git a/src/base/dimradial.h b/src/base/dimradial.h index 4570d96..b239ac8 100644 --- a/src/base/dimradial.h +++ b/src/base/dimradial.h @@ -6,13 +6,13 @@ /** * Holds the data that defines a radial dimension entity. */ -class RS_DimRadialData +class DimRadialData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_DimRadialData() {} + DimRadialData() {} /** * Constructor with initialisation. @@ -20,17 +20,17 @@ public: * @param definitionPoint Definition point of the radial dimension. * @param leader Leader length. */ - RS_DimRadialData(const Vector& definitionPoint, + DimRadialData(const Vector& definitionPoint, double leader) { this->definitionPoint = definitionPoint; this->leader = leader; } - friend class RS_DimRadial; + friend class DimRadial; //friend class RS_ActionDimRadial; friend std::ostream& operator << (std::ostream& os, - const RS_DimRadialData& dd) { + const DimRadialData& dd) { os << "(" << dd.definitionPoint << "/" << dd.leader << ")"; return os; } @@ -47,15 +47,15 @@ public: * * @author Andrew Mustun */ -class RS_DimRadial: public RS_Dimension +class DimRadial: public Dimension { public: - RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimRadialData & ed); - virtual ~RS_DimRadial(); + DimRadial(EntityContainer * parent, const DimensionData & d, const DimRadialData & ed); + virtual ~DimRadial(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_DimRadialData getEData() const; + DimRadialData getEData() const; virtual VectorSolutions getRefPoints(); virtual QString getMeasuredLabel(); virtual void update(bool autoText = false); @@ -67,11 +67,11 @@ class RS_DimRadial: public RS_Dimension virtual void mirror(Vector axisPoint1, Vector axisPoint2); virtual void moveRef(const Vector& ref, const Vector& offset); - friend std::ostream& operator << (std::ostream& os, const RS_DimRadial& d); + friend std::ostream& operator << (std::ostream& os, const DimRadial& d); protected: /** Extended data. */ - RS_DimRadialData edata; + DimRadialData edata; }; #endif diff --git a/src/base/document.cpp b/src/base/document.cpp index cd8503e..b1d31b7 100644 --- a/src/base/document.cpp +++ b/src/base/document.cpp @@ -24,46 +24,46 @@ * @param parent Parent of the document. Often that's NULL but * for blocks it's the blocklist. */ -RS_Document::RS_Document(RS_EntityContainer * parent): - RS_EntityContainer(parent), RS_Undo() +Document::Document(EntityContainer * parent): + EntityContainer(parent), Undo() { - RS_DEBUG->print("RS_Document::RS_Document() "); + DEBUG->print("Document::Document() "); filename = ""; formatType = RS2::FormatUnknown; setModified(false); - RS_Color col(RS2::FlagByLayer); - activePen = RS_Pen(col, RS2::WidthByLayer, RS2::LineByLayer); + Color col(RS2::FlagByLayer); + activePen = Pen(col, RS2::WidthByLayer, RS2::LineByLayer); } -RS_Document::~RS_Document() +Document::~Document() { } /** * @return true for all document entities (e.g. Graphics or Blocks). */ -bool RS_Document::isDocument() const +bool Document::isDocument() const { return true; } /** * Removes an entity from the entiy container. Implementation - * from RS_Undo. + * from Undo. */ -void RS_Document::removeUndoable(RS_Undoable * u) +void Document::removeUndoable(Undoable * u) { if (u != NULL && u->undoRtti() == RS2::UndoableEntity) { - removeEntity((RS_Entity *)u); + removeEntity((Entity *)u); } } /** * @return Currently active drawing pen. */ -RS_Pen RS_Document::getActivePen() const +Pen Document::getActivePen() const { return activePen; } @@ -71,7 +71,7 @@ RS_Pen RS_Document::getActivePen() const /** * Sets the currently active drawing pen to p. */ -void RS_Document::setActivePen(RS_Pen p) +void Document::setActivePen(Pen p) { activePen = p; } @@ -80,7 +80,7 @@ void RS_Document::setActivePen(RS_Pen p) * @return File name of the document currently loaded. * Note, that the default file name is empty. */ -QString RS_Document::getFilename() const +QString Document::getFilename() const { return filename; } @@ -88,7 +88,7 @@ QString RS_Document::getFilename() const /** * Sets file name for the document currently loaded. */ -void RS_Document::setFilename(const QString & fn) +void Document::setFilename(const QString & fn) { filename = fn; } @@ -96,9 +96,9 @@ void RS_Document::setFilename(const QString & fn) /** * Sets the documents modified status to 'm'. */ -void RS_Document::setModified(bool m) +void Document::setModified(bool m) { - //std::cout << "RS_Document::setModified: %d" << (int)m << std::endl; + //std::cout << "Document::setModified: %d" << (int)m << std::endl; modified = m; } @@ -106,7 +106,7 @@ void RS_Document::setModified(bool m) * @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. */ -bool RS_Document::isModified() const +bool Document::isModified() const { return modified; } @@ -114,8 +114,8 @@ bool RS_Document::isModified() const /** * Overwritten to set modified flag before starting an undo cycle. */ -void RS_Document::startUndoCycle() +void Document::startUndoCycle() { setModified(true); - RS_Undo::startUndoCycle(); + Undo::startUndoCycle(); } diff --git a/src/base/document.h b/src/base/document.h index dd5463c..8c0044e 100644 --- a/src/base/document.h +++ b/src/base/document.h @@ -5,8 +5,8 @@ #include "entitycontainer.h" #include "undo.h" -class RS_BlockList; -class RS_LayerList; +class BlockList; +class LayerList; /** * Base class for documents. Documents can be either graphics or @@ -16,14 +16,14 @@ class RS_LayerList; * * @author Andrew Mustun */ -class RS_Document: public RS_EntityContainer, public RS_Undo +class Document: public EntityContainer, public Undo { public: - RS_Document(RS_EntityContainer * parent = NULL); - virtual ~RS_Document(); + Document(EntityContainer * parent = NULL); + virtual ~Document(); - virtual RS_LayerList * getLayerList() = 0; - virtual RS_BlockList * getBlockList() = 0; + virtual LayerList * getLayerList() = 0; + virtual BlockList * getBlockList() = 0; virtual void newDoc() = 0; virtual bool save() = 0; @@ -31,9 +31,9 @@ class RS_Document: public RS_EntityContainer, public RS_Undo virtual bool open(const QString &filename, RS2::FormatType type) = 0; virtual bool isDocument() const; - virtual void removeUndoable(RS_Undoable * u); - RS_Pen getActivePen() const; - void setActivePen(RS_Pen p); + virtual void removeUndoable(Undoable * u); + Pen getActivePen() const; + void setActivePen(Pen p); QString getFilename() const; void setFilename(const QString & fn); virtual void setModified(bool m); @@ -44,7 +44,7 @@ class RS_Document: public RS_EntityContainer, public RS_Undo /** Flag set if the document was modified and not yet saved. */ bool modified; /** Active pen. */ - RS_Pen activePen; + Pen activePen; /** File name of the document or empty for a new document. */ QString filename; /** Format type */ diff --git a/src/base/drawing.cpp b/src/base/drawing.cpp index 4193ae5..d376e04 100644 --- a/src/base/drawing.cpp +++ b/src/base/drawing.cpp @@ -28,14 +28,14 @@ /** * Default constructor. */ -Drawing::Drawing(RS_EntityContainer * parent): RS_Document(parent), layerList(), +Drawing::Drawing(EntityContainer * parent): Document(parent), layerList(), blockList(true) #ifdef RS_CAM , camData() #endif { settings.beginGroup("Defaults"); - setUnit(RS_Units::stringToUnit(settings.value("Unit", "None").toString())); + setUnit(Units::stringToUnit(settings.value("Unit", "None").toString())); settings.endGroup(); RS2::Unit unit = getUnit(); @@ -50,11 +50,11 @@ Drawing::Drawing(RS_EntityContainer * parent): RS_Document(parent), layerList(), } else { - addVariable("$DIMASZ", RS_Units::convert(2.5, RS2::Millimeter, unit), 40); - addVariable("$DIMEXE", RS_Units::convert(1.25, RS2::Millimeter, unit), 40); - addVariable("$DIMEXO", RS_Units::convert(0.625, RS2::Millimeter, unit), 40); - addVariable("$DIMGAP", RS_Units::convert(0.625, RS2::Millimeter, unit), 40); - addVariable("$DIMTXT", RS_Units::convert(2.5, RS2::Millimeter, unit), 40); + addVariable("$DIMASZ", Units::convert(2.5, RS2::Millimeter, unit), 40); + addVariable("$DIMEXE", Units::convert(1.25, RS2::Millimeter, unit), 40); + addVariable("$DIMEXO", Units::convert(0.625, RS2::Millimeter, unit), 40); + addVariable("$DIMGAP", Units::convert(0.625, RS2::Millimeter, unit), 40); + addVariable("$DIMTXT", Units::convert(2.5, RS2::Millimeter, unit), 40); } setModified(false); @@ -76,13 +76,13 @@ Drawing::~Drawing() /** * Counts the entities on the given layer. */ -unsigned long int Drawing::countLayerEntities(RS_Layer * layer) +unsigned long int Drawing::countLayerEntities(Layer * layer) { int c = 0; if (layer != NULL) { - for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) + for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) { if (t->getLayer()!=NULL && t->getLayer()->getName()==layer->getName()) { @@ -94,12 +94,12 @@ unsigned long int Drawing::countLayerEntities(RS_Layer * layer) return c; } -/*virtual*/ RS_LayerList * Drawing::getLayerList() +/*virtual*/ LayerList * Drawing::getLayerList() { return &layerList; } -/*virtual*/ RS_BlockList * Drawing::getBlockList() +/*virtual*/ BlockList * Drawing::getBlockList() { return &blockList; } @@ -110,15 +110,15 @@ unsigned long int Drawing::countLayerEntities(RS_Layer * layer) */ void Drawing::newDoc() { - RS_DEBUG->print("Drawing::newDoc"); + DEBUG->print("Drawing::newDoc"); clear(); clearLayers(); clearBlocks(); - addLayer(new RS_Layer("0")); - //addLayer(new RS_Layer("ByBlock")); + addLayer(new Layer("0")); + //addLayer(new Layer("ByBlock")); setModified(false); } @@ -130,11 +130,11 @@ bool Drawing::save() { bool ret = false; - RS_DEBUG->print("Drawing::save"); - RS_DEBUG->print(" file: %s", filename.toLatin1().data()); - RS_DEBUG->print(" format: %d", (int)formatType); - RS_DEBUG->print(" export..."); - ret = RS_FILEIO->fileExport(*this, filename, formatType); + DEBUG->print("Drawing::save"); + DEBUG->print(" file: %s", filename.toLatin1().data()); + DEBUG->print(" format: %d", (int)formatType); + DEBUG->print(" export..."); + ret = FILEIO->fileExport(*this, filename, formatType); if (ret) { @@ -143,7 +143,7 @@ bool Drawing::save() blockList.setModified(false); } - RS_DEBUG->print("Drawing::save ok"); + DEBUG->print("Drawing::save ok"); return ret; } @@ -153,7 +153,7 @@ bool Drawing::save() */ bool Drawing::saveAs(const QString & filename, RS2::FormatType type) { - RS_DEBUG->print("Drawing::saveAs"); + DEBUG->print("Drawing::saveAs"); this->filename = filename; this->formatType = type; @@ -166,20 +166,20 @@ bool Drawing::saveAs(const QString & filename, RS2::FormatType type) */ bool Drawing::open(const QString & filename, RS2::FormatType type) { - RS_DEBUG->print("Drawing::open(%s)", filename.toLatin1().data()); + DEBUG->print("Drawing::open(%s)", filename.toLatin1().data()); bool ret = false; this->filename = filename; // clean all: newDoc(); // import file: - ret = RS_FILEIO->fileImport(*this, filename, type); + ret = FILEIO->fileImport(*this, filename, type); setModified(false); layerList.setModified(false); blockList.setModified(false); //cout << *((Drawing*)graphic); //calculateBorders(); - RS_DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data()); + DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data()); return ret; } @@ -195,7 +195,7 @@ uint Drawing::countLayers() const return layerList.count(); } -RS_Layer * Drawing::layerAt(uint i) +Layer * Drawing::layerAt(uint i) { return layerList.at(i); } @@ -205,17 +205,17 @@ void Drawing::activateLayer(const QString & name) layerList.activate(name); } -void Drawing::activateLayer(RS_Layer * layer) +void Drawing::activateLayer(Layer * layer) { layerList.activate(layer); } -RS_Layer * Drawing::getActiveLayer() +Layer * Drawing::getActiveLayer() { return layerList.getActive(); } -/*virtual*/ void Drawing::addLayer(RS_Layer * layer) +/*virtual*/ void Drawing::addLayer(Layer * layer) { layerList.add(layer); } @@ -223,14 +223,14 @@ RS_Layer * Drawing::getActiveLayer() /** * Removes the given layer and undoes all entities on it. */ -/*virtual*/ void Drawing::removeLayer(RS_Layer * layer) +/*virtual*/ void Drawing::removeLayer(Layer * layer) { if (layer != NULL && layer->getName() != "0") { // remove all entities on that layer: startUndoCycle(); - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->getLayer() && e->getLayer()->getName() == layer->getName()) { @@ -245,11 +245,11 @@ RS_Layer * Drawing::getActiveLayer() // remove all entities in blocks that are on that layer: for(uint bi=0; bifirstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone)) + for(Entity * e=blk->firstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone)) { if (e->getLayer() != NULL && e->getLayer()->getName() == layer->getName()) { @@ -265,12 +265,12 @@ RS_Layer * Drawing::getActiveLayer() } } -/*virtual*/ void Drawing::editLayer(RS_Layer * layer, const RS_Layer & source) +/*virtual*/ void Drawing::editLayer(Layer * layer, const Layer & source) { layerList.edit(layer, source); } -RS_Layer * Drawing::findLayer(const QString & name) +Layer * Drawing::findLayer(const QString & name) { return layerList.find(name); } @@ -280,12 +280,12 @@ void Drawing::toggleLayer(const QString & name) layerList.toggle(name); } -void Drawing::toggleLayer(RS_Layer * layer) +void Drawing::toggleLayer(Layer * layer) { layerList.toggle(layer); } -void Drawing::toggleLayerLock(RS_Layer * layer) +void Drawing::toggleLayerLock(Layer * layer) { layerList.toggleLock(layer); } @@ -296,12 +296,12 @@ void Drawing::freezeAllLayers(bool freeze) } #if 0 -void Drawing::addLayerListListener(RS_LayerListListener * listener) +void Drawing::addLayerListListener(LayerListListener * listener) { layerList.addListener(listener); } -void Drawing::removeLayerListListener(RS_LayerListListener * listener) +void Drawing::removeLayerListListener(LayerListListener * listener) { layerList.removeListener(listener); } @@ -319,7 +319,7 @@ uint Drawing::countBlocks() return blockList.count(); } -RS_Block * Drawing::blockAt(uint i) +Block * Drawing::blockAt(uint i) { return blockList.at(i); } @@ -329,17 +329,17 @@ void Drawing::activateBlock(const QString & name) blockList.activate(name); } -void Drawing::activateBlock(RS_Block * block) +void Drawing::activateBlock(Block * block) { blockList.activate(block); } -RS_Block * Drawing::getActiveBlock() +Block * Drawing::getActiveBlock() { return blockList.getActive(); } -/*virtual*/ bool Drawing::addBlock(RS_Block * block, bool notify/*= true*/) +/*virtual*/ bool Drawing::addBlock(Block * block, bool notify/*= true*/) { return blockList.add(block, notify); } @@ -349,12 +349,12 @@ RS_Block * Drawing::getActiveBlock() blockList.addNotification(); } -/*virtual*/ void Drawing::removeBlock(RS_Block * block) +/*virtual*/ void Drawing::removeBlock(Block * block) { blockList.remove(block); } -RS_Block * Drawing::findBlock(const QString & name) +Block * Drawing::findBlock(const QString & name) { return blockList.find(name); } @@ -369,7 +369,7 @@ void Drawing::toggleBlock(const QString & name) blockList.toggle(name); } -void Drawing::toggleBlock(RS_Block * block) +void Drawing::toggleBlock(Block * block) { blockList.toggle(block); } @@ -380,12 +380,12 @@ void Drawing::freezeAllBlocks(bool freeze) } #if 0 -void Drawing::addBlockListListener(RS_BlockListListener * listener) +void Drawing::addBlockListListener(BlockListListener * listener) { blockList.addListener(listener); } -void Drawing::removeBlockListListener(RS_BlockListListener * listener) +void Drawing::removeBlockListListener(BlockListListener * listener) { blockList.removeListener(listener); } @@ -447,8 +447,8 @@ void Drawing::removeVariable(const QString & key) variableDict.remove(key); } -//Q3Dict & getVariableDict() -QMultiHash & Drawing::getVariableDict() +//Q3Dict & getVariableDict() +QMultiHash & Drawing::getVariableDict() { return variableDict.getVariableDict(); } @@ -476,7 +476,7 @@ void Drawing::setGridOn(bool on) */ void Drawing::setUnit(RS2::Unit u) { - setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u)); + setPaperSize(Units::convert(getPaperSize(), getUnit(), u)); addVariable("$INSUNITS", (int)u, 70); //unit = u; } @@ -601,7 +601,7 @@ void Drawing::setPaperInsertionBase(const Vector & p) */ Vector Drawing::getPaperSize() { - Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit()); + Vector def = Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit()); Vector v1 = getVariableVector("$PLIMMIN", Vector(0.0, 0.0)); Vector v2 = getVariableVector("$PLIMMAX", def); @@ -625,12 +625,12 @@ void Drawing::setPaperSize(const Vector & s) */ RS2::PaperFormat Drawing::getPaperFormat(bool * landscape) { - Vector size = RS_Units::convert(getPaperSize(), getUnit(), RS2::Millimeter); + Vector size = Units::convert(getPaperSize(), getUnit(), RS2::Millimeter); if (landscape != NULL) *landscape = (size.x > size.y); - return RS_Units::paperSizeToFormat(size); + return Units::paperSizeToFormat(size); } /** @@ -638,7 +638,7 @@ RS2::PaperFormat Drawing::getPaperFormat(bool * landscape) */ void Drawing::setPaperFormat(RS2::PaperFormat f, bool landscape) { - Vector size = RS_Units::paperFormatToSize(f); + Vector size = Units::paperFormatToSize(f); if (landscape) { @@ -648,7 +648,7 @@ void Drawing::setPaperFormat(RS2::PaperFormat f, bool landscape) } if (f != RS2::Custom) - setPaperSize(RS_Units::convert(size, RS2::Millimeter, getUnit())); + setPaperSize(Units::convert(size, RS2::Millimeter, getUnit())); } /** @@ -690,14 +690,14 @@ void Drawing::centerToPage() */ void Drawing::fitToPage() { - double border = RS_Units::convert(25.0, RS2::Millimeter, getUnit()); + double border = Units::convert(25.0, RS2::Millimeter, getUnit()); Vector ps = getPaperSize() - Vector(border, border); Vector s = getSize(); double fx = RS_MAXDOUBLE; double fy = RS_MAXDOUBLE; //double factor = 1.0; - //ps = RS_Units::convert(ps, getUnit(), RS2::Millimeter); + //ps = Units::convert(ps, getUnit(), RS2::Millimeter); if (fabs(s.x) > 1.0e-6) fx = ps.x / s.x; @@ -748,8 +748,8 @@ std::ostream & operator<<(std::ostream & os, Drawing & g) os << "--- Drawing: \n"; os << "---" << *g.getLayerList() << "\n"; os << "---" << *g.getBlockList() << "\n"; - os << "---" << (RS_Undo &)g << "\n"; - os << "---" << (RS_EntityContainer &)g << "\n"; + os << "---" << (Undo &)g << "\n"; + os << "---" << (EntityContainer &)g << "\n"; return os; } diff --git a/src/base/drawing.h b/src/base/drawing.h index 1190f71..3163070 100644 --- a/src/base/drawing.h +++ b/src/base/drawing.h @@ -16,16 +16,16 @@ * * @author Andrew Mustun */ -class Drawing: public RS_Document +class Drawing: public Document { public: - Drawing(RS_EntityContainer * parent = NULL); + Drawing(EntityContainer * parent = NULL); virtual ~Drawing(); virtual RS2::EntityType rtti() const; - virtual unsigned long int countLayerEntities(RS_Layer * layer); - virtual RS_LayerList * getLayerList(); - virtual RS_BlockList * getBlockList(); + virtual unsigned long int countLayerEntities(Layer * layer); + virtual LayerList * getLayerList(); + virtual BlockList * getBlockList(); virtual void newDoc(); virtual bool save(); virtual bool saveAs(const QString& filename, RS2::FormatType type); @@ -34,38 +34,38 @@ class Drawing: public RS_Document // Wrappers for Layer functions: void clearLayers(); uint countLayers() const; - RS_Layer * layerAt(uint i); + Layer * layerAt(uint i); void activateLayer(const QString & name); - void activateLayer(RS_Layer * layer); - RS_Layer * getActiveLayer(); - virtual void addLayer(RS_Layer * layer); - virtual void removeLayer(RS_Layer * layer); - virtual void editLayer(RS_Layer * layer, const RS_Layer & source); - RS_Layer * findLayer(const QString & name); + void activateLayer(Layer * layer); + Layer * getActiveLayer(); + virtual void addLayer(Layer * layer); + virtual void removeLayer(Layer * layer); + virtual void editLayer(Layer * layer, const Layer & source); + Layer * findLayer(const QString & name); void toggleLayer(const QString & name); - void toggleLayer(RS_Layer * layer); - void toggleLayerLock(RS_Layer * layer); + void toggleLayer(Layer * layer); + void toggleLayerLock(Layer * layer); void freezeAllLayers(bool freeze); -// void addLayerListListener(RS_LayerListListener * listener); -// void removeLayerListListener(RS_LayerListListener * listener); +// void addLayerListListener(LayerListListener * listener); +// void removeLayerListListener(LayerListListener * listener); // Wrapper for block functions: void clearBlocks(); uint countBlocks(); - RS_Block * blockAt(uint i); + Block * blockAt(uint i); void activateBlock(const QString & name); - void activateBlock(RS_Block * block); - RS_Block * getActiveBlock(); - virtual bool addBlock(RS_Block * block, bool notify = true); + void activateBlock(Block * block); + Block * getActiveBlock(); + virtual bool addBlock(Block * block, bool notify = true); virtual void addBlockNotification(); - virtual void removeBlock(RS_Block * block); - RS_Block * findBlock(const QString & name); + virtual void removeBlock(Block * block); + Block * findBlock(const QString & name); QString newBlockName(); void toggleBlock(const QString & name); - void toggleBlock(RS_Block * block); + void toggleBlock(Block * block); void freezeAllBlocks(bool freeze); -// void addBlockListListener(RS_BlockListListener * listener); -// void removeBlockListListener(RS_BlockListListener * listener); +// void addBlockListListener(BlockListListener * listener); +// void removeBlockListListener(BlockListListener * listener); // Wrappers for variable functions: void clearVariables(); @@ -79,8 +79,8 @@ class Drawing: public RS_Document int getVariableInt(const QString & key, int def); double getVariableDouble(const QString & key, double def); void removeVariable(const QString & key); - // Q3Dict & getVariableDict(); - QMultiHash & getVariableDict(); + // Q3Dict & getVariableDict(); + QMultiHash & getVariableDict(); RS2::LinearFormat getLinearFormat(); int getLinearPrecision(); @@ -112,9 +112,9 @@ class Drawing: public RS_Document friend std::ostream & operator<<(std::ostream & os, Drawing & g); private: - RS_LayerList layerList; - RS_BlockList blockList; - RS_VariableDict variableDict; + LayerList layerList; + BlockList blockList; + VariableDict variableDict; #ifdef RS_CAM RS_CamData camData; #endif diff --git a/src/base/ellipse.cpp b/src/base/ellipse.cpp index 030a733..5d4fbd5 100644 --- a/src/base/ellipse.cpp +++ b/src/base/ellipse.cpp @@ -25,26 +25,26 @@ /** * Constructor. */ -RS_Ellipse::RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d): - RS_AtomicEntity(parent), data(d) +Ellipse::Ellipse(EntityContainer * parent, const EllipseData & d): + AtomicEntity(parent), data(d) { //calculateEndpoints(); calculateBorders(); } -/*virtual*/ RS_Ellipse::~RS_Ellipse() +/*virtual*/ Ellipse::~Ellipse() { } -/*virtual*/ RS_Entity * RS_Ellipse::clone() +/*virtual*/ Entity * Ellipse::clone() { - RS_Ellipse * e = new RS_Ellipse(*this); + Ellipse * e = new Ellipse(*this); e->initId(); return e; } /** @return RS2::EntityEllipse */ -/*virtual*/ RS2::EntityType RS_Ellipse::rtti() const +/*virtual*/ RS2::EntityType Ellipse::rtti() const { return RS2::EntityEllipse; } @@ -52,7 +52,7 @@ RS_Ellipse::RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d): /** * @return Start point of the entity. */ -/*virtual*/ Vector RS_Ellipse::getStartpoint() const +/*virtual*/ Vector Ellipse::getStartpoint() const { Vector p; p.set(data.center.x + cos(data.angle1) * getMajorRadius(), @@ -64,7 +64,7 @@ RS_Ellipse::RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d): /** * @return End point of the entity. */ -/*virtual*/ Vector RS_Ellipse::getEndpoint() const +/*virtual*/ Vector Ellipse::getEndpoint() const { Vector p; p.set(data.center.x + cos(data.angle2) * getMajorRadius(), @@ -73,7 +73,7 @@ RS_Ellipse::RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d): return p; } -void RS_Ellipse::moveStartpoint(const Vector & pos) +void Ellipse::moveStartpoint(const Vector & pos) { data.angle1 = getEllipseAngle(pos); //data.angle1 = data.center.angleTo(pos); @@ -81,7 +81,7 @@ void RS_Ellipse::moveStartpoint(const Vector & pos) calculateBorders(); } -void RS_Ellipse::moveEndpoint(const Vector & pos) +void Ellipse::moveEndpoint(const Vector & pos) { data.angle2 = getEllipseAngle(pos); //data.angle2 = data.center.angleTo(pos); @@ -89,12 +89,12 @@ void RS_Ellipse::moveEndpoint(const Vector & pos) calculateBorders(); } -RS2::Ending RS_Ellipse::getTrimPoint(const Vector & coord, const Vector & trimPoint) +RS2::Ending Ellipse::getTrimPoint(const Vector & coord, const Vector & trimPoint) { double angEl = getEllipseAngle(trimPoint); double angM = getEllipseAngle(coord); - if (RS_Math::getAngleDifference(angM, angEl) > M_PI) + if (Math::getAngleDifference(angM, angEl) > M_PI) //if (data.reversed) { // return RS2::EndingEnd; //} @@ -110,7 +110,7 @@ RS2::Ending RS_Ellipse::getTrimPoint(const Vector & coord, const Vector & trimPo //} } -double RS_Ellipse::getEllipseAngle(const Vector & pos) +double Ellipse::getEllipseAngle(const Vector & pos) { Vector m = pos; m.rotate(data.center, -data.majorP.angle()); @@ -120,12 +120,12 @@ double RS_Ellipse::getEllipseAngle(const Vector & pos) } /** @return Copy of data that defines the ellipse. **/ -RS_EllipseData RS_Ellipse::getData() +EllipseData Ellipse::getData() { return data; } -VectorSolutions RS_Ellipse::getRefPoints() +VectorSolutions Ellipse::getRefPoints() { VectorSolutions ret(getStartpoint(), getEndpoint(), data.center); return ret; @@ -135,79 +135,79 @@ VectorSolutions RS_Ellipse::getRefPoints() * @retval true if the arc is reversed (clockwise), * @retval false otherwise */ -bool RS_Ellipse::isReversed() const +bool Ellipse::isReversed() const { return data.reversed; } /** sets the reversed status. */ -void RS_Ellipse::setReversed(bool r) +void Ellipse::setReversed(bool r) { data.reversed = r; } /** @return The rotation angle of this ellipse */ -double RS_Ellipse::getAngle() const +double Ellipse::getAngle() const { return data.majorP.angle(); } /** @return The start angle of this arc */ -double RS_Ellipse::getAngle1() +double Ellipse::getAngle1() { return data.angle1; } /** Sets new start angle. */ -void RS_Ellipse::setAngle1(double a1) +void Ellipse::setAngle1(double a1) { data.angle1 = a1; } /** @return The end angle of this arc */ -double RS_Ellipse::getAngle2() +double Ellipse::getAngle2() { return data.angle2; } /** Sets new end angle. */ -void RS_Ellipse::setAngle2(double a2) +void Ellipse::setAngle2(double a2) { data.angle2 = a2; } /** @return The center point (x) of this arc */ -Vector RS_Ellipse::getCenter() +Vector Ellipse::getCenter() { return data.center; } /** Sets new center. */ -void RS_Ellipse::setCenter(const Vector & c) +void Ellipse::setCenter(const Vector & c) { data.center = c; } /** @return The endpoint of the major axis (relative to center). */ -Vector RS_Ellipse::getMajorP() +Vector Ellipse::getMajorP() { return data.majorP; } /** Sets new major point (relative to center). */ -void RS_Ellipse::setMajorP(const Vector & p) +void Ellipse::setMajorP(const Vector & p) { data.majorP = p; } /** @return The ratio of minor to major axis */ -double RS_Ellipse::getRatio() +double Ellipse::getRatio() { return data.ratio; } /** Sets new ratio. */ -void RS_Ellipse::setRatio(double r) +void Ellipse::setRatio(double r) { data.ratio = r; } @@ -215,7 +215,7 @@ void RS_Ellipse::setRatio(double r) /** * @return Angle length in rad. */ -/*virtual*/ double RS_Ellipse::getAngleLength() const +/*virtual*/ double Ellipse::getAngleLength() const { if (isReversed()) return data.angle1 - data.angle2; @@ -224,13 +224,13 @@ void RS_Ellipse::setRatio(double r) } /** @return The major radius of this ellipse. Same as getRadius() */ -double RS_Ellipse::getMajorRadius() const +double Ellipse::getMajorRadius() const { return data.majorP.magnitude(); } /** @return The minor radius of this ellipse */ -double RS_Ellipse::getMinorRadius() const +double Ellipse::getMinorRadius() const { return data.majorP.magnitude() * data.ratio; } @@ -239,7 +239,7 @@ double RS_Ellipse::getMinorRadius() const * Recalculates the endpoints using the angles and the radius. */ /* - void RS_Ellipse::calculateEndpoints() { + void Ellipse::calculateEndpoints() { double angle = data.majorP.angle(); double radius1 = getMajorRadius(); double radius2 = getMinorRadius(); @@ -258,9 +258,9 @@ double RS_Ellipse::getMinorRadius() const * * @todo Fix that - the algorithm used is really bad / slow. */ -void RS_Ellipse::calculateBorders() +void Ellipse::calculateBorders() { - RS_DEBUG->print("RS_Ellipse::calculateBorders"); + DEBUG->print("Ellipse::calculateBorders"); double radius1 = getMajorRadius(); double radius2 = getMinorRadius(); @@ -292,15 +292,15 @@ void RS_Ellipse::calculateBorders() a += 0.03; } - while (RS_Math::isAngleBetween(RS_Math::correctAngle(a), a1, a2, false) + while (Math::isAngleBetween(Math::correctAngle(a), a1, a2, false) && a < 4 * M_PI); minV.set(minX, minY); maxV.set(maxX, maxY); - RS_DEBUG->print("RS_Ellipse::calculateBorders: OK"); + DEBUG->print("Ellipse::calculateBorders: OK"); } -Vector RS_Ellipse::getNearestEndpoint(const Vector & coord, double * dist) +Vector Ellipse::getNearestEndpoint(const Vector & coord, double * dist) { double dist1, dist2; Vector nearerPoint; @@ -326,9 +326,9 @@ Vector RS_Ellipse::getNearestEndpoint(const Vector & coord, double * dist) return nearerPoint; } -Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity) +Vector Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity) { - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity"); + DEBUG->print("Ellipse::getNearestPointOnEntity"); Vector ret(false); @@ -376,7 +376,7 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, for (i = 0; i < iMax; i++) { - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: i: %d", i); + DEBUG->print("Ellipse::getNearestPointOnEntity: i: %d", i); double dTpASqr = dT + dA * dA; double dTpBSqr = dT + dB * dB; double dInvTpASqr = 1.0 / dTpASqr; @@ -386,7 +386,7 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double dXDivASqr = dXDivA * dXDivA; double dYDivBSqr = dYDivB * dYDivB; double dF = dXDivASqr + dYDivBSqr - 1.0; - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: dF: %f", dF); + DEBUG->print("Ellipse::getNearestPointOnEntity: dF: %f", dF); if (fabs(dF) < dEpsilon) { @@ -394,12 +394,12 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, rdX = dXDivA * dA; rdY = dYDivB * dB; riIFinal = i; - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 1: %f,%f", rdX, rdY); + DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 1: %f,%f", rdX, rdY); break; } double dFDer = 2.0 * (dXDivASqr * dInvTpASqr + dYDivBSqr * dInvTpBSqr); double dRatio = dF / dFDer; - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: dRatio: %f", dRatio); + DEBUG->print("Ellipse::getNearestPointOnEntity: dRatio: %f", dRatio); if (fabs(dRatio) < dEpsilon) { @@ -407,7 +407,7 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, rdX = dXDivA * dA; rdY = dYDivB * dB; riIFinal = i; - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY); + DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY); break; } dT += dRatio; @@ -416,7 +416,7 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, if (i == iMax) { // failed to converge: - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: failed"); + DEBUG->print("Ellipse::getNearestPointOnEntity: failed"); dDistance = RS_MAXDOUBLE; } else @@ -425,8 +425,8 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double dDelta1 = rdY - dV; dDistance = sqrt(dDelta0 * dDelta0 + dDelta1 * dDelta1); ret = Vector(rdX, rdY); - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY); - RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: ret: %f,%f", ret.x, ret.y); + DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY); + DEBUG->print("Ellipse::getNearestPointOnEntity: ret: %f,%f", ret.x, ret.y); } if (dist != NULL) @@ -457,7 +457,7 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double a2 = data.center.angleTo(getEndpoint()); double a = data.center.angleTo(ret); - if (!RS_Math::isAngleBetween(a, a1, a2, data.reversed)) + if (!Math::isAngleBetween(a, a1, a2, data.reversed)) ret = Vector(false); } } @@ -471,13 +471,13 @@ Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, * @retval true if the given point is on this entity. * @retval false otherwise */ -bool RS_Ellipse::isPointOnEntity(const Vector & coord, double tolerance) +bool Ellipse::isPointOnEntity(const Vector & coord, double tolerance) { double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone); return (dist <= tolerance); } -Vector RS_Ellipse::getNearestCenter(const Vector & coord, double * dist) +Vector Ellipse::getNearestCenter(const Vector & coord, double * dist) { if (dist != NULL) *dist = coord.distanceTo(data.center); @@ -487,21 +487,21 @@ Vector RS_Ellipse::getNearestCenter(const Vector & coord, double * dist) /** * @todo Implement this. */ -Vector RS_Ellipse::getNearestMiddle(const Vector & /*coord*/, double * dist) +Vector Ellipse::getNearestMiddle(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Ellipse::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) +Vector Ellipse::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -double RS_Ellipse::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double /*solidDist*/) +double Ellipse::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double /*solidDist*/) { double dist = RS_MAXDOUBLE; getNearestPointOnEntity(coord, true, &dist, entity); @@ -509,14 +509,14 @@ double RS_Ellipse::getDistanceToPoint(const Vector & coord, RS_Entity * * entity return dist; } -void RS_Ellipse::move(Vector offset) +void Ellipse::move(Vector offset) { data.center.move(offset); //calculateEndpoints(); calculateBorders(); } -void RS_Ellipse::rotate(Vector center, double angle) +void Ellipse::rotate(Vector center, double angle) { data.center.rotate(center, angle); data.majorP.rotate(angle); @@ -524,7 +524,7 @@ void RS_Ellipse::rotate(Vector center, double angle) calculateBorders(); } -void RS_Ellipse::scale(Vector center, Vector factor) +void Ellipse::scale(Vector center, Vector factor) { data.center.scale(center, factor); data.majorP.scale(factor); @@ -535,7 +535,7 @@ void RS_Ellipse::scale(Vector center, Vector factor) /** * @todo deal with angles correctly */ -void RS_Ellipse::mirror(Vector axisPoint1, Vector axisPoint2) +void Ellipse::mirror(Vector axisPoint1, Vector axisPoint2) { Vector mp = data.center + data.majorP; @@ -561,7 +561,7 @@ void RS_Ellipse::mirror(Vector axisPoint1, Vector axisPoint2) calculateBorders(); } -void RS_Ellipse::moveRef(const Vector & ref, const Vector & offset) +void Ellipse::moveRef(const Vector & ref, const Vector & offset) { Vector startpoint = getStartpoint(); Vector endpoint = getEndpoint(); @@ -574,7 +574,7 @@ void RS_Ellipse::moveRef(const Vector & ref, const Vector & offset) moveEndpoint(endpoint + offset); } -void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (!painter || !view) return; @@ -599,7 +599,7 @@ void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*pat } // Pattern: - RS_LineTypePattern * pat; + LineTypePattern * pat; if (isSelected()) pat = &patternSelected; @@ -610,7 +610,7 @@ void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*pat return; // Pen to draw pattern is always solid: - RS_Pen pen = painter->getPen(); + Pen pen = painter->getPen(); pen.setLineType(RS2::SolidLine); painter->setPen(pen); @@ -633,8 +633,8 @@ void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*pat do { - curR = sqrt(RS_Math::pow(getMinorRadius() * cos(curA), 2.0) - + RS_Math::pow(getMajorRadius() * sin(curA), 2.0)); + curR = sqrt(Math::pow(getMinorRadius() * cos(curA), 2.0) + + Math::pow(getMajorRadius() * sin(curA), 2.0)); if (curR > 1.0e-6) { @@ -667,7 +667,7 @@ void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*pat /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Ellipse & a) +std::ostream & operator<<(std::ostream & os, const Ellipse & a) { os << " Ellipse: " << a.data << "\n"; return os; diff --git a/src/base/ellipse.h b/src/base/ellipse.h index 2ed0f98..f0bff36 100644 --- a/src/base/ellipse.h +++ b/src/base/ellipse.h @@ -6,10 +6,10 @@ /** * Holds the data that defines an ellipse. */ -class RS_EllipseData +class EllipseData { public: - RS_EllipseData(const Vector & center, const Vector & majorP, double ratio, double angle1, double angle2, bool reversed) + EllipseData(const Vector & center, const Vector & majorP, double ratio, double angle1, double angle2, bool reversed) { this->center = center; this->majorP = majorP; @@ -19,9 +19,9 @@ class RS_EllipseData this->reversed = reversed; } - friend class RS_Ellipse; + friend class Ellipse; - friend std::ostream & operator<<(std::ostream & os, const RS_EllipseData & ed) + friend std::ostream & operator<<(std::ostream & os, const EllipseData & ed) { os << "(" << ed.center << "/" << ed.majorP @@ -52,13 +52,13 @@ class RS_EllipseData * * @author Andrew Mustun */ -class RS_Ellipse: public RS_AtomicEntity +class Ellipse: public AtomicEntity { public: - RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d); - virtual ~RS_Ellipse(); + Ellipse(EntityContainer * parent, const EllipseData & d); + virtual ~Ellipse(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual Vector getStartpoint() const; virtual Vector getEndpoint() const; @@ -66,7 +66,7 @@ class RS_Ellipse: public RS_AtomicEntity virtual void moveEndpoint(const Vector & pos); virtual RS2::Ending getTrimPoint(const Vector & coord, const Vector & trimPoint); double getEllipseAngle(const Vector & pos); - RS_EllipseData getData(); + EllipseData getData(); virtual VectorSolutions getRefPoints(); bool isReversed() const; void setReversed(bool r); @@ -86,11 +86,11 @@ class RS_Ellipse: public RS_AtomicEntity double getMinorRadius() 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 getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, 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 double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual bool isPointOnEntity(const Vector & coord, double tolerance = RS_TOLERANCE); virtual void move(Vector offset); @@ -101,13 +101,13 @@ class RS_Ellipse: public RS_AtomicEntity virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Ellipse & a); + friend std::ostream & operator<<(std::ostream & os, const Ellipse & a); //virtual void calculateEndpoints(); virtual void calculateBorders(); protected: - RS_EllipseData data; + EllipseData data; }; #endif diff --git a/src/base/entity.cpp b/src/base/entity.cpp index bf5be9c..b963731 100644 --- a/src/base/entity.cpp +++ b/src/base/entity.cpp @@ -38,7 +38,7 @@ * E.g. a line might have a graphic entity or * a polyline entity as parent. */ -RS_Entity::RS_Entity(RS_EntityContainer * parent) +Entity::Entity(EntityContainer * parent) { this->parent = parent; init(); @@ -47,7 +47,7 @@ RS_Entity::RS_Entity(RS_EntityContainer * parent) /** * Copy constructor. */ -/*RS_Entity::RS_Entity(const RS_Entity& e) : RS_Flags(e.getFlags()) { +/*Entity::Entity(const Entity& e) : Flags(e.getFlags()) { cout << "copy constructor called\n"; init(); parent = e.parent; @@ -61,11 +61,11 @@ RS_Entity::RS_Entity(RS_EntityContainer * parent) /** * Destructor. */ -RS_Entity::~RS_Entity() +Entity::~Entity() { } -/*virtual*/ void RS_Entity::reparent(RS_EntityContainer * parent) +/*virtual*/ void Entity::reparent(EntityContainer * parent) { this->parent = parent; } @@ -73,13 +73,13 @@ RS_Entity::~RS_Entity() /** * Initialisation. Called from all constructors. */ -void RS_Entity::init() +void Entity::init() { resetBorders(); setFlag(RS2::FlagVisible); //layer = NULL; - //pen = RS_Pen(); + //pen = Pen(); updateEnabled = true; setLayerToActive(); setPenToActive(); @@ -89,7 +89,7 @@ void RS_Entity::init() /** * Gives this entity a new unique id. */ -void RS_Entity::initId() +void Entity::initId() { static unsigned long int idCounter = 0; id = idCounter++; @@ -98,7 +98,7 @@ void RS_Entity::initId() /** * Resets the borders of this element. */ -void RS_Entity::resetBorders() +void Entity::resetBorders() { // TODO: Check that. windoze XP crashes with MAXDOUBLE double maxd = RS_MAXDOUBLE; @@ -112,7 +112,7 @@ void RS_Entity::resetBorders() * Must be overwritten to return the rtti of this entity * (e.g. RS2::EntityArc). */ -/*virtual*/ RS2::EntityType RS_Entity::rtti() const +/*virtual*/ RS2::EntityType Entity::rtti() const { return RS2::EntityUnknown; } @@ -121,7 +121,7 @@ void RS_Entity::resetBorders() * Identify all entities as undoable entities. * @return RS2::UndoableEntity */ -/*virtual*/ RS2::UndoableType RS_Entity::undoRtti() +/*virtual*/ RS2::UndoableType Entity::undoRtti() { return RS2::UndoableEntity; } @@ -129,7 +129,7 @@ void RS_Entity::resetBorders() /** * @return Unique Id of this entity. */ -unsigned long int RS_Entity::getId() const +unsigned long int Entity::getId() const { return id; } @@ -139,7 +139,7 @@ unsigned long int RS_Entity::getId() const * is a potential edge entity of a contour. By default * this returns false. */ -/*virtual*/ bool RS_Entity::isEdge() const +/*virtual*/ bool Entity::isEdge() const { return false; } @@ -148,7 +148,7 @@ unsigned long int RS_Entity::getId() const * @return true for all document entities (e.g. Graphics or Blocks). * false otherwise. */ -/*virtual*/ bool RS_Entity::isDocument() const +/*virtual*/ bool Entity::isDocument() const { return false; } @@ -158,7 +158,7 @@ unsigned long int RS_Entity::getId() const * * @param select True to select, false to deselect. */ -bool RS_Entity::setSelected(bool select) +bool Entity::setSelected(bool select) { // layer is locked: if (select && isLocked()) @@ -175,7 +175,7 @@ bool RS_Entity::setSelected(bool select) /** * Toggles select on this entity. */ -bool RS_Entity::toggleSelected() +bool Entity::toggleSelected() { return setSelected(!isSelected()); //toggleFlag(RS2::FlagSelected); @@ -186,7 +186,7 @@ bool RS_Entity::toggleSelected() * not be selected but one of its parents is selected. In that case * this function returns false. */ -bool RS_Entity::isSelected() const +bool Entity::isSelected() const { return getFlag(RS2::FlagSelected); } @@ -194,9 +194,9 @@ bool RS_Entity::isSelected() const /** * @return true if a parent entity of this entity is selected. */ -bool RS_Entity::isParentSelected() +bool Entity::isParentSelected() { - RS_Entity * p = this; + Entity * p = this; do { @@ -215,7 +215,7 @@ bool RS_Entity::isParentSelected() * * @param on True to set, false to reset. */ -void RS_Entity::setProcessed(bool on) +void Entity::setProcessed(bool on) { if (on) setFlag(RS2::FlagProcessed); @@ -226,7 +226,7 @@ void RS_Entity::setProcessed(bool on) /** * @return True if the processed flag is set. */ -bool RS_Entity::isProcessed() const +bool Entity::isProcessed() const { return getFlag(RS2::FlagProcessed); } @@ -237,7 +237,7 @@ bool RS_Entity::isProcessed() const * @param undone true: entity has become invisible. * false: entity has become visible. */ -void RS_Entity::undoStateChanged(bool /*undone*/) +void Entity::undoStateChanged(bool /*undone*/) { setSelected(false); update(); @@ -246,18 +246,18 @@ void RS_Entity::undoStateChanged(bool /*undone*/) /** * @return true if this entity or any parent entities are undone. */ -bool RS_Entity::isUndone() const +bool Entity::isUndone() const { if (parent == NULL) - return RS_Undoable::isUndone(); + return Undoable::isUndone(); - return RS_Undoable::isUndone() || parent->isUndone(); + return Undoable::isUndone() || parent->isUndone(); } /** * @return True if the entity is in the given range. */ -bool RS_Entity::isInWindow(Vector v1, Vector v2) +bool Entity::isInWindow(Vector v1, Vector v2) { double right, left, top, bottom; @@ -276,13 +276,13 @@ bool RS_Entity::isInWindow(Vector v1, Vector v2) * @retval true if the given point is on this entity. * @retval false otherwise */ -bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance) +bool Entity::isPointOnEntity(const Vector & coord, double tolerance) { double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone); return (dist <= tolerance); } -/*virtual*/ bool RS_Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/) +/*virtual*/ bool Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/) { return false; } @@ -294,7 +294,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance) * The Layer might also be NULL. In that case the layer visiblity * is ignored. */ -/*virtual*/ bool RS_Entity::isVisible() +/*virtual*/ bool Entity::isVisible() { if (!getFlag(RS2::FlagVisible)) return false; @@ -302,7 +302,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance) if (isUndone()) return false; - /*RS_EntityCotnainer* parent = getParent(); + /*EntityCotnainer* parent = getParent(); if (parent!=NULL && parent->isUndone()) { return false; }*/ @@ -359,7 +359,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance) return false; } -/*virtual*/ void RS_Entity::setVisible(bool v) +/*virtual*/ void Entity::setVisible(bool v) { if (v) setFlag(RS2::FlagVisible); @@ -371,7 +371,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance) * Sets the highlight status of the entity. Highlighted entities * usually indicate a feedback to a user action. */ -void RS_Entity::setHighlighted(bool on) +void Entity::setHighlighted(bool on) { if (on) setFlag(RS2::FlagHighlighted); @@ -382,7 +382,7 @@ void RS_Entity::setHighlighted(bool on) /** * @return true if the entity is highlighted. */ -bool RS_Entity::isHighlighted() +bool Entity::isHighlighted() { return getFlag(RS2::FlagHighlighted); } @@ -390,7 +390,7 @@ bool RS_Entity::isHighlighted() /** * @return true if the layer this entity is on is locked. */ -bool RS_Entity::isLocked() +bool Entity::isLocked() { if (getLayer(true) != NULL && getLayer()->isLocked()) return true; @@ -402,7 +402,7 @@ bool RS_Entity::isLocked() * Implementations must return the total length of the entity * or a negative number if the entity has no length (e.g. a text or hatch). */ -/*virtual*/ double RS_Entity::getLength() +/*virtual*/ double Entity::getLength() { return -1.0; } @@ -410,7 +410,7 @@ bool RS_Entity::isLocked() /** * @return Parent of this entity or NULL if this is a root entity. */ -RS_EntityContainer * RS_Entity::getParent() const +EntityContainer * Entity::getParent() const { return parent; } @@ -418,7 +418,7 @@ RS_EntityContainer * RS_Entity::getParent() const /** * Reparents this entity. */ -void RS_Entity::setParent(RS_EntityContainer * p) +void Entity::setParent(EntityContainer * p) { parent = p; } @@ -428,7 +428,7 @@ 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. */ -Drawing * RS_Entity::getGraphic() +Drawing * Entity::getGraphic() { if (rtti() == RS2::EntityGraphic) return (Drawing *)this; @@ -443,10 +443,10 @@ Drawing * RS_Entity::getGraphic() * or the parent's parent block or NULL if none of the parents * are stored in a block. */ -RS_Block * RS_Entity::getBlock() +Block * Entity::getBlock() { if (rtti() == RS2::EntityBlock) - return (RS_Block *)this; + return (Block *)this; else if (parent == NULL) return NULL; else @@ -458,10 +458,10 @@ RS_Block * RS_Entity::getBlock() * or the parent's parent block or NULL if none of the parents * are stored in a block. */ -RS_Insert * RS_Entity::getInsert() +Insert * Entity::getInsert() { if (rtti() == RS2::EntityInsert) - return (RS_Insert *)this; + return (Insert *)this; else if (parent == NULL) return NULL; else @@ -473,7 +473,7 @@ RS_Insert * RS_Entity::getInsert() * or the parent's parent block or insert or NULL if none of the parents * are stored in a block or insert. */ -RS_Entity * RS_Entity::getBlockOrInsert() +Entity * Entity::getBlockOrInsert() { if (rtti() == RS2::EntityBlock || rtti() == RS2::EntityInsert) return this; @@ -489,10 +489,10 @@ RS_Entity * RS_Entity::getBlockOrInsert() * are stored in a document. Note that a document is usually * either a Graphic or a Block. */ -RS_Document * RS_Entity::getDocument() +Document * Entity::getDocument() { if (isDocument() == true) - return (RS_Document *)this; + return (Document *)this; else if (parent == NULL) return NULL; else @@ -504,11 +504,11 @@ RS_Document * RS_Entity::getDocument() * temporary subentities. update() is called if the entity's * paramters or undo state changed. */ -/*virtual*/ void RS_Entity::update() +/*virtual*/ void Entity::update() { } -/*virtual*/ void RS_Entity::setUpdateEnabled(bool on) +/*virtual*/ void Entity::setUpdateEnabled(bool on) { updateEnabled = on; } @@ -518,7 +518,7 @@ RS_Document * RS_Entity::getDocument() * @return minimum coordinate of the entity. * @see calculateBorders() */ -Vector RS_Entity::getMin() const +Vector Entity::getMin() const { return minV; } @@ -528,7 +528,7 @@ Vector RS_Entity::getMin() const * @return minimum coordinate of the entity. * @see calculateBorders() */ -Vector RS_Entity::getMax() const +Vector Entity::getMax() const { return maxV; } @@ -541,7 +541,7 @@ Vector RS_Entity::getMax() const * @see getMin() * @see getMax() */ -Vector RS_Entity::getSize() const +Vector Entity::getSize() const { return maxV - minV; } @@ -552,7 +552,7 @@ Vector RS_Entity::getSize() const * @param key Variable name (e.g. "$DIMASZ") * @param val Default value */ -void RS_Entity::addGraphicVariable(const QString & key, double val, int code) +void Entity::addGraphicVariable(const QString & key, double val, int code) { Drawing * graphic = getGraphic(); @@ -566,7 +566,7 @@ void RS_Entity::addGraphicVariable(const QString & key, double val, int code) * @param key Variable name (e.g. "$DIMASZ") * @param val Default value */ -void RS_Entity::addGraphicVariable(const QString & key, int val, int code) +void Entity::addGraphicVariable(const QString & key, int val, int code) { Drawing * graphic = getGraphic(); @@ -580,7 +580,7 @@ void RS_Entity::addGraphicVariable(const QString & key, int val, int code) * @param key Variable name (e.g. "$DIMASZ") * @param val Default value */ -void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int code) +void Entity::addGraphicVariable(const QString & key, const QString & val, int code) { Drawing * graphic = getGraphic(); @@ -597,7 +597,7 @@ void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int * @return value of variable or default value if the given variable * doesn't exist. */ -double RS_Entity::getGraphicVariableDouble(const QString & key, double def) +double Entity::getGraphicVariableDouble(const QString & key, double def) { Drawing * graphic = getGraphic(); double ret = def; @@ -617,7 +617,7 @@ double RS_Entity::getGraphicVariableDouble(const QString & key, double def) * @return value of variable or default value if the given variable * doesn't exist. */ -int RS_Entity::getGraphicVariableInt(const QString & key, int def) +int Entity::getGraphicVariableInt(const QString & key, int def) { Drawing * graphic = getGraphic(); int ret = def; @@ -637,7 +637,7 @@ int RS_Entity::getGraphicVariableInt(const QString & key, int def) * @return value of variable or default value if the given variable * doesn't exist. */ -QString RS_Entity::getGraphicVariableString(const QString & key, const QString & def) +QString Entity::getGraphicVariableString(const QString & key, const QString & def) { Drawing * graphic = getGraphic(); QString ret = def; @@ -652,7 +652,7 @@ QString RS_Entity::getGraphicVariableString(const QString & key, const QString & * @return The unit the parent graphic works on or None if there's no * parent graphic. */ -RS2::Unit RS_Entity::getGraphicUnit() +RS2::Unit Entity::getGraphicUnit() { Drawing * graphic = getGraphic(); RS2::Unit ret = RS2::None; @@ -666,7 +666,7 @@ RS2::Unit RS_Entity::getGraphicUnit() /** * Must be overwritten to get all reference points of the entity. */ -/*virtual*/ VectorSolutions RS_Entity::getRefPoints() +/*virtual*/ VectorSolutions Entity::getRefPoints() { VectorSolutions ret; return ret; @@ -681,7 +681,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * * @return The point with the given distance to the start- or endpoint. */ -/*virtual*/ Vector RS_Entity::getNearestDist(double /*distance*/, bool /*startp*/) +/*virtual*/ Vector Entity::getNearestDist(double /*distance*/, bool /*startp*/) { return Vector(false); } @@ -697,7 +697,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * * @return The closest point with the given distance to the endpoint. */ -/*virtual*/ Vector RS_Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/) +/*virtual*/ Vector Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/) { VectorSolutions s = getRefPoints(); @@ -717,7 +717,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * * @return The closest point with the given distance to the endpoint. */ -/*virtual*/ Vector RS_Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/) +/*virtual*/ Vector Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/) { if (isSelected()) return getNearestRef(coord, dist); @@ -729,7 +729,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * Acts like scale(Vector) but with equal factors. * Equal to scale(center, Vector(factor, factor)). */ -/*virtual*/ void RS_Entity::scale(Vector center, double factor) +/*virtual*/ void Entity::scale(Vector center, double factor) { scale(center, Vector(factor, factor)); } @@ -738,7 +738,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * Implementations must drag the reference point(s) of all * (sub-)entities that are very close to ref by offset. */ -/*virtual*/ void RS_Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/) +/*virtual*/ void Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/) { return; } @@ -747,7 +747,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * Implementations must drag the reference point(s) of selected * (sub-)entities that are very close to ref by offset. */ -/*virtual*/ void RS_Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/) +/*virtual*/ void Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/) { return; } @@ -764,7 +764,7 @@ RS2::Unit RS_Entity::getGraphicUnit() * layer NULL is returned. If all parents are on layer NULL, NULL * is returned. */ -RS_Layer * RS_Entity::getLayer(bool resolve) const +Layer * Entity::getLayer(bool resolve) const { if (resolve) { @@ -786,7 +786,7 @@ RS_Layer * RS_Entity::getLayer(bool resolve) const /** * Sets the layer of this entity to the layer with the given name */ -void RS_Entity::setLayer(const QString & name) +void Entity::setLayer(const QString & name) { Drawing * graphic = getGraphic(); @@ -799,7 +799,7 @@ void RS_Entity::setLayer(const QString & name) /** * Sets the layer of this entity to the layer given. */ -void RS_Entity::setLayer(RS_Layer * l) +void Entity::setLayer(Layer * l) { layer = l; } @@ -809,7 +809,7 @@ void RS_Entity::setLayer(RS_Layer * l) * the graphic this entity is in. If this entity (and none * of its parents) are in a graphic the layer is set to NULL. */ -void RS_Entity::setLayerToActive() +void Entity::setLayerToActive() { Drawing * graphic = getGraphic(); @@ -830,14 +830,14 @@ void RS_Entity::setLayerToActive() * * @return Pen for this entity. */ -RS_Pen RS_Entity::getPen(bool resolve) const +Pen Entity::getPen(bool resolve) const { if (!resolve) return pen; else { - RS_Pen p = pen; - RS_Layer * l = getLayer(true); + Pen p = pen; + Layer * l = getLayer(true); // use parental attributes (e.g. vertex of a polyline, block // entities when they are drawn in block documents): @@ -876,7 +876,7 @@ RS_Pen RS_Entity::getPen(bool resolve) const * Sets the explicit pen for this entity or a pen with special * attributes such as BY_LAYER, .. */ -void RS_Entity::setPen(const RS_Pen & pen) +void Entity::setPen(const Pen & pen) { this->pen = pen; } @@ -886,19 +886,19 @@ void RS_Entity::setPen(const RS_Pen & pen) * the graphic this entity is in. If this entity (and none * of its parents) are in a graphic the pen is not changed. */ -void RS_Entity::setPenToActive() +void Entity::setPenToActive() { - RS_Document * doc = getDocument(); + Document * doc = getDocument(); if (doc != NULL) pen = doc->getActivePen(); else { - //RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Entity::setPenToActive(): " + //DEBUG->print(Debug::D_WARNING, "Entity::setPenToActive(): " // "No document / active pen linked to this entity."); } //else { - // pen = RS_Pen(); + // pen = Pen(); //} } @@ -907,7 +907,7 @@ void RS_Entity::setPenToActive() * by the given offset. This default implementation moves the * whole entity if it is completely inside the given range. */ -void RS_Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { //e->calculateBorders(); if (getMin().isInWindow(firstCorner, secondCorner) @@ -919,7 +919,7 @@ void RS_Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset) * @return Factor for scaling the line styles considering the current * paper scaling and the fact that styles are stored in Millimeter. */ -double RS_Entity::getStyleFactor(GraphicView * view) +double Entity::getStyleFactor(GraphicView * view) { double styleFactor = 1.0; @@ -938,7 +938,7 @@ double RS_Entity::getStyleFactor(GraphicView * view) { unit = g->getUnit(); //double scale = g->getPaperScale(); - styleFactor = RS_Units::convert(1.0, RS2::Millimeter, unit); + styleFactor = Units::convert(1.0, RS2::Millimeter, unit); // / scale; } @@ -958,8 +958,8 @@ double RS_Entity::getStyleFactor(GraphicView * view) } } - //RS_DEBUG->print("stylefactor: %f", styleFactor); - //RS_DEBUG->print("viewfactor: %f", view->getFactor().x); + //DEBUG->print("stylefactor: %f", styleFactor); + //DEBUG->print("viewfactor: %f", view->getFactor().x); if (styleFactor * view->getFactor().x < 0.2) styleFactor = -1.0; @@ -970,7 +970,7 @@ double RS_Entity::getStyleFactor(GraphicView * view) /** * @return User defined variable connected to this entity. */ -QString * RS_Entity::getUserDefVar(QString key) +QString * Entity::getUserDefVar(QString key) { // return (this->varList.find(key)); return (this->varList.value(key)); @@ -979,7 +979,7 @@ QString * RS_Entity::getUserDefVar(QString key) /** * Add a user defined variable to this entity. */ -void RS_Entity::setUserDefVar(QString key, QString val) +void Entity::setUserDefVar(QString key, QString val) { varList.insert(key, new QString(val)); } @@ -987,7 +987,7 @@ void RS_Entity::setUserDefVar(QString key, QString val) /** * Deletes the given user defined variable. */ -void RS_Entity::delUserDefVar(QString key) +void Entity::delUserDefVar(QString key) { varList.remove(key); } @@ -995,7 +995,7 @@ void RS_Entity::delUserDefVar(QString key) /** * @return A list of all keys connected to this entity. */ -QStringList RS_Entity::getAllKeys() +QStringList Entity::getAllKeys() { QStringList keys; // Q3DictIterator it(varList); @@ -1015,7 +1015,7 @@ QStringList RS_Entity::getAllKeys() /** * Dumps the elements data to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_Entity & e) +std::ostream & operator<<(std::ostream & os, Entity & e) { //os << "Warning: Virtual entity!\n"; //return os; @@ -1062,35 +1062,35 @@ std::ostream & operator<<(std::ostream & os, RS_Entity & e) switch (e.rtti()) { case RS2::EntityPoint: - os << (RS_Point &)e; + os << (Point &)e; break; case RS2::EntityLine: - os << (RS_Line &)e; + os << (Line &)e; break; case RS2::EntityPolyline: - os << (RS_Polyline &)e; + os << (Polyline &)e; break; case RS2::EntityArc: - os << (RS_Arc &)e; + os << (Arc &)e; break; case RS2::EntityCircle: - os << (RS_Circle &)e; + os << (Circle &)e; break; case RS2::EntityEllipse: - os << (RS_Ellipse &)e; + os << (Ellipse &)e; break; case RS2::EntityInsert: - os << (RS_Insert &)e; + os << (Insert &)e; break; case RS2::EntityText: - os << (RS_Text &)e; + os << (Text &)e; break; default: diff --git a/src/base/entity.h b/src/base/entity.h index 8aad246..c7c996c 100644 --- a/src/base/entity.h +++ b/src/base/entity.h @@ -2,7 +2,7 @@ #define __ENTITY_H__ #include -#include "rs.h" +#include "enums.h" #include "layer.h" #include "mathextra.h" #include "pen.h" @@ -10,18 +10,18 @@ #include "vector.h" #include "vectorsolutions.h" -class RS_Arc; -class RS_Block; -class RS_Circle; -class RS_Document; -class RS_EntityContainer; +class Arc; +class Block; +class Circle; +class Document; +class EntityContainer; class Drawing; class GraphicView; -class RS_Insert; -class RS_Line; -class RS_Point; -class RS_Polyline; -class RS_Text; +class Insert; +class Line; +class Point; +class Polyline; +class Text; class PaintInterface; /** @@ -29,16 +29,16 @@ class PaintInterface; * * @author Andrew Mustun */ -class RS_Entity: public RS_Undoable +class Entity: public Undoable { public: - RS_Entity(RS_EntityContainer * parent = NULL); - virtual ~RS_Entity(); + Entity(EntityContainer * parent = NULL); + virtual ~Entity(); void init(); virtual void initId(); - virtual RS_Entity * clone() = 0; - virtual void reparent(RS_EntityContainer * parent); + virtual Entity * clone() = 0; + virtual void reparent(EntityContainer * parent); void resetBorders(); virtual RS2::EntityType rtti() const; virtual RS2::UndoableType undoRtti(); @@ -57,21 +57,21 @@ class RS_Entity: public RS_Undoable virtual unsigned long int countDeep() = 0; virtual double getLength(); - RS_EntityContainer * getParent() const; - void setParent(RS_EntityContainer * p); + EntityContainer * getParent() const; + void setParent(EntityContainer * p); Drawing * getGraphic(); - RS_Block * getBlock(); - RS_Insert * getInsert(); - RS_Entity * getBlockOrInsert(); - RS_Document * getDocument(); + Block * getBlock(); + Insert * getInsert(); + Entity * getBlockOrInsert(); + Document * getDocument(); void setLayer(const QString & name); - void setLayer(RS_Layer * l); + void setLayer(Layer * l); void setLayerToActive(); - RS_Layer * getLayer(bool resolve = true) const; - void setPen(const RS_Pen & pen); + Layer * getLayer(bool resolve = true) const; + void setPen(const Pen & pen); void setPenToActive(); - RS_Pen getPen(bool resolve = true) const; + Pen getPen(bool resolve = true) const; /** * Must be overwritten to return true if an entity type @@ -144,7 +144,7 @@ class RS_Entity: public RS_Undoable * @return The closest coordinate. */ virtual Vector getNearestPointOnEntity(const Vector& /*coord*/, - bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL) = 0; + bool onEntity = true, double * dist = NULL, Entity ** entity = NULL) = 0; /** * Must be overwritten to get the (nearest) center point to the @@ -207,7 +207,7 @@ class RS_Entity: public RS_Undoable * * @return The measured distance between \p coord and the entity. */ - virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, + virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE) = 0; virtual bool isPointOnEntity(const Vector & coord, double tolerance = RS_TOLERANCE); @@ -251,27 +251,27 @@ class RS_Entity: public RS_Undoable void setUserDefVar(QString key, QString val); void delUserDefVar(QString key); - friend std::ostream & operator<<(std::ostream & os, RS_Entity & e); + friend std::ostream & operator<<(std::ostream & os, Entity & e); /** Recalculates the borders of this entity. */ virtual void calculateBorders() = 0; protected: //! Entity's parent entity or NULL is this entity has no parent. - RS_EntityContainer * parent; + EntityContainer * parent; //! minimum coordinates Vector minV; //! maximum coordinates Vector maxV; //! Pointer to layer - RS_Layer * layer; + Layer * layer; //! Entity id unsigned long int id; //! pen (attributes) for this entity - RS_Pen pen; + Pen pen; //! auto updating enabled? bool updateEnabled; diff --git a/src/base/entitycontainer.cpp b/src/base/entitycontainer.cpp index 238c5a8..7babc88 100644 --- a/src/base/entitycontainer.cpp +++ b/src/base/entitycontainer.cpp @@ -29,21 +29,21 @@ #include "graphicview.h" #include "paintinterface.h" -bool RS_EntityContainer::autoUpdateBorders = true; +bool EntityContainer::autoUpdateBorders = true; /** * Default constructor. * * @param owner True if we own and also delete the entities. */ -RS_EntityContainer::RS_EntityContainer(RS_EntityContainer * parent/*= NULL*/, bool owner/*= true*/): - RS_Entity(parent), entityIterator(entities) +EntityContainer::EntityContainer(EntityContainer * parent/*= NULL*/, bool owner/*= true*/): + Entity(parent), entityIterator(entities) //NOTE: This constructor may not be explicitly OR implicitly called, meaning that // entityIterator will not get initialized! { #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // entities.setAutoDelete(owner); - RS_DEBUG->print("RS_EntityContainer::RS_EntityContainer: owner: %d", (int)owner); + DEBUG->print("EntityContainer::EntityContainer: owner: %d", (int)owner); subContainer = NULL; //autoUpdateBorders = true; } @@ -52,8 +52,8 @@ RS_EntityContainer::RS_EntityContainer(RS_EntityContainer * parent/*= NULL*/, bo * Copy constructor. Makes a deep copy of all entities. */ /* -RS_EntityContainer::RS_EntityContainer(const RS_EntityContainer& ec) - : RS_Entity(ec) +EntityContainer::EntityContainer(const EntityContainer& ec) + : Entity(ec) { } */ @@ -61,18 +61,18 @@ RS_EntityContainer::RS_EntityContainer(const RS_EntityContainer& ec) /** * Destructor. */ -RS_EntityContainer::~RS_EntityContainer() +EntityContainer::~EntityContainer() { clear(); } -RS_Entity * RS_EntityContainer::clone() +Entity * EntityContainer::clone() { -// RS_DEBUG->print("RS_EntityContainer::clone: ori autoDel: %d", entities.autoDelete()); - RS_EntityContainer * ec = new RS_EntityContainer(*this); +// DEBUG->print("EntityContainer::clone: ori autoDel: %d", entities.autoDelete()); + EntityContainer * ec = new EntityContainer(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // ec->entities.setAutoDelete(entities.autoDelete()); -// RS_DEBUG->print("RS_EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete()); +// DEBUG->print("EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete()); ec->detach(); ec->initId(); @@ -83,17 +83,17 @@ RS_Entity * RS_EntityContainer::clone() * Detaches shallow copies and creates deep copies of all subentities. * This is called after cloning entity containers. */ -void RS_EntityContainer::detach() +void EntityContainer::detach() { -// Q3PtrList tmp; - QList tmp; +// Q3PtrList tmp; + QList tmp; #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // bool autoDel = entities.autoDelete(); -// RS_DEBUG->print("RS_EntityContainer::detach: autoDel: %d", (int)autoDel); +// DEBUG->print("EntityContainer::detach: autoDel: %d", (int)autoDel); // entities.setAutoDelete(false); // make deep copies of all entities: - for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity()) + for(Entity * e=firstEntity(); e!=NULL; e=nextEntity()) { if (!e->getFlag(RS2::FlagTemp)) { @@ -106,27 +106,27 @@ void RS_EntityContainer::detach() // entities.setAutoDelete(autoDel); // point to new deep copies: -// for(RS_Entity * e=tmp.first(); e!=NULL; e=tmp.next()) +// for(Entity * e=tmp.first(); e!=NULL; e=tmp.next()) for(int i=0; ireparent(this); } } /** @return RS2::EntityContainer */ -/*virtual*/ RS2::EntityType RS_EntityContainer::rtti() const +/*virtual*/ RS2::EntityType EntityContainer::rtti() const { return RS2::EntityContainer; } -void RS_EntityContainer::reparent(RS_EntityContainer * parent) +void EntityContainer::reparent(EntityContainer * parent) { - RS_Entity::reparent(parent); + Entity::reparent(parent); // All sub-entities: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { e->reparent(parent); } @@ -136,7 +136,7 @@ void RS_EntityContainer::reparent(RS_EntityContainer * parent) * @return true: because entities made from this class * and subclasses are containers for other entities. */ -/*virtual*/ bool RS_EntityContainer::isContainer() const +/*virtual*/ bool EntityContainer::isContainer() const { return true; } @@ -145,7 +145,7 @@ void RS_EntityContainer::reparent(RS_EntityContainer * parent) * @return false: because entities made from this class * and subclasses are containers for other entities. */ -/*virtual*/ bool RS_EntityContainer::isAtomic() const +/*virtual*/ bool EntityContainer::isAtomic() const { return false; } @@ -156,28 +156,28 @@ void RS_EntityContainer::reparent(RS_EntityContainer * parent) * @param undone true: entity has become invisible. * false: entity has become visible. */ -void RS_EntityContainer::undoStateChanged(bool undone) +void EntityContainer::undoStateChanged(bool undone) { - RS_Entity::undoStateChanged(undone); + Entity::undoStateChanged(undone); // ! don't pass on to subentities. undo list handles them // All sub-entities: - /*for (RS_Entity* e=firstEntity(RS2::ResolveNone); + /*for (Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { e->setUndoState(undone); }*/ } -void RS_EntityContainer::setVisible(bool v) +void EntityContainer::setVisible(bool v) { - RS_DEBUG->print("RS_EntityContainer::setVisible: %d", v); - RS_Entity::setVisible(v); + DEBUG->print("EntityContainer::setVisible: %d", v); + Entity::setVisible(v); // All sub-entities: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - RS_DEBUG->print("RS_EntityContainer::setVisible: subentity: %d", v); + DEBUG->print("EntityContainer::setVisible: subentity: %d", v); e->setVisible(v); } } @@ -185,11 +185,11 @@ void RS_EntityContainer::setVisible(bool v) /** * @return Total length of all entities in this container. */ -double RS_EntityContainer::getLength() +double EntityContainer::getLength() { double ret = 0.0; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->isVisible()) { @@ -213,13 +213,13 @@ double RS_EntityContainer::getLength() /** * Selects this entity. */ -bool RS_EntityContainer::setSelected(bool select) +bool EntityContainer::setSelected(bool select) { // This entity's select: - if (RS_Entity::setSelected(select)) + if (Entity::setSelected(select)) { // All sub-entity's select: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->isVisible()) { @@ -238,14 +238,14 @@ bool RS_EntityContainer::setSelected(bool select) /** * Toggles select on this entity. */ -bool RS_EntityContainer::toggleSelected() +bool EntityContainer::toggleSelected() { // Toggle this entity's select: - if (RS_Entity::toggleSelected()) + if (Entity::toggleSelected()) { // Toggle all sub-entity's select: - /*for (RS_Entity* e=firstEntity(RS2::ResolveNone); + /*for (Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { e->toggleSelected(); @@ -263,11 +263,11 @@ bool RS_EntityContainer::toggleSelected() * * @param select True to select, False to deselect the entities. */ -void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross) +void EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross) { bool included; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { included = false; @@ -280,25 +280,25 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr } else if (cross == true) { - RS_Line l[] = + Line l[] = { - RS_Line(NULL, RS_LineData(v1, Vector(v2.x, v1.y))), - RS_Line(NULL, RS_LineData(Vector(v2.x, v1.y), v2)), - RS_Line(NULL, RS_LineData(v2, Vector(v1.x, v2.y))), - RS_Line(NULL, RS_LineData(Vector(v1.x, v2.y), v1)) + Line(NULL, LineData(v1, Vector(v2.x, v1.y))), + Line(NULL, LineData(Vector(v2.x, v1.y), v2)), + Line(NULL, LineData(v2, Vector(v1.x, v2.y))), + Line(NULL, LineData(Vector(v1.x, v2.y), v1)) }; VectorSolutions sol; if (e->isContainer()) { - RS_EntityContainer * ec = (RS_EntityContainer *)e; + EntityContainer * ec = (EntityContainer *)e; - for(RS_Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false; + for(Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false; se=ec->nextEntity(RS2::ResolveAll)) { for(int i=0; i<4; ++i) { - sol = RS_Information::getIntersection(se, &l[i], true); + sol = Information::getIntersection(se, &l[i], true); if (sol.hasValid()) { @@ -312,7 +312,7 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr { for(int i=0; i<4; ++i) { - sol = RS_Information::getIntersection(e, &l[i], true); + sol = Information::getIntersection(e, &l[i], true); if (sol.hasValid()) { @@ -335,20 +335,20 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr * Adds a entity to this container and updates the borders of this * entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::addEntity(RS_Entity * entity) +void EntityContainer::addEntity(Entity * entity) { /* if (isDocument()) { - RS_LayerList* lst = getDocument()->getLayerList(); + LayerList* lst = getDocument()->getLayerList(); if (lst!=NULL) { - RS_Layer* l = lst->getActive(); + Layer* l = lst->getActive(); if (l!=NULL && l->isLocked()) { return; } } } */ -//printf("RS_EntityContainer::addEntity(): entity=%08X\n", entity); +//printf("EntityContainer::addEntity(): entity=%08X\n", entity); if (!entity) return; @@ -367,7 +367,7 @@ void RS_EntityContainer::addEntity(RS_Entity * entity) * Inserts a entity to this container at the given position and updates * the borders of this entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::insertEntity(int index, RS_Entity * entity) +void EntityContainer::insertEntity(int index, Entity * entity) { if (entity == NULL) return; @@ -382,7 +382,7 @@ void RS_EntityContainer::insertEntity(int index, RS_Entity * entity) * Replaces the entity at the given index with the given entity * and updates the borders of this entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::replaceEntity(int index, RS_Entity * entity) +void EntityContainer::replaceEntity(int index, Entity * entity) { if (entity == NULL) return; @@ -397,7 +397,7 @@ void RS_EntityContainer::replaceEntity(int index, RS_Entity * entity) * Removes an entity from this container and updates the borders of * this entity-container if autoUpdateBorders is true. */ -bool RS_EntityContainer::removeEntity(RS_Entity * entity) +bool EntityContainer::removeEntity(Entity * entity) { // bool ret = entities.remove(entity); bool ret = (bool)entities.removeAll(entity); @@ -411,7 +411,7 @@ bool RS_EntityContainer::removeEntity(RS_Entity * entity) /** * Erases all entities in this container and resets the borders.. */ -void RS_EntityContainer::clear() +void EntityContainer::clear() { entities.clear(); resetBorders(); @@ -420,7 +420,7 @@ void RS_EntityContainer::clear() /** * Counts all entities (branches of the tree). */ -unsigned long int RS_EntityContainer::count() +unsigned long int EntityContainer::count() { return entities.count(); } @@ -428,11 +428,11 @@ unsigned long int RS_EntityContainer::count() /** * Counts all entities (leaves of the tree). */ -unsigned long int RS_EntityContainer::countDeep() +unsigned long int EntityContainer::countDeep() { unsigned long int c = 0; - for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) + for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) { c += t->countDeep(); } @@ -443,11 +443,11 @@ unsigned long int RS_EntityContainer::countDeep() /** * Counts the selected entities in this container. */ -unsigned long int RS_EntityContainer::countSelected() +unsigned long int EntityContainer::countSelected() { unsigned long int c = 0; - for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) + for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) { if (t->isSelected()) { @@ -462,7 +462,7 @@ unsigned long int RS_EntityContainer::countSelected() * Enables / disables automatic update of borders on entity removals * and additions. By default this is turned on. */ -/*virtual*/ void RS_EntityContainer::setAutoUpdateBorders(bool enable) +/*virtual*/ void EntityContainer::setAutoUpdateBorders(bool enable) { autoUpdateBorders = enable; } @@ -470,9 +470,9 @@ unsigned long int RS_EntityContainer::countSelected() /** * Adjusts the borders of this graphic (max/min values) */ -void RS_EntityContainer::adjustBorders(RS_Entity * entity) +void EntityContainer::adjustBorders(Entity * entity) { - //RS_DEBUG->print("RS_EntityContainer::adjustBorders"); + //DEBUG->print("EntityContainer::adjustBorders"); //resetBorders(); if (entity != NULL) @@ -496,17 +496,17 @@ void RS_EntityContainer::adjustBorders(RS_Entity * entity) /** * Recalculates the borders of this entity container. */ -void RS_EntityContainer::calculateBorders() +void EntityContainer::calculateBorders() { - RS_DEBUG->print("RS_EntityContainer::calculateBorders"); + DEBUG->print("EntityContainer::calculateBorders"); resetBorders(); - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - RS_Layer * layer = e->getLayer(); + Layer * layer = e->getLayer(); - RS_DEBUG->print("RS_EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible()); + DEBUG->print("EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible()); if (e->isVisible() && (layer == NULL || !layer->isFrozen())) { @@ -515,7 +515,7 @@ void RS_EntityContainer::calculateBorders() } } - RS_DEBUG->print("RS_EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y); + DEBUG->print("EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y); // needed for correcting corrupt data (PLANS.dxf) if (minV.x > maxV.x || minV.x > RS_MAXDOUBLE || maxV.x > RS_MAXDOUBLE @@ -532,31 +532,31 @@ void RS_EntityContainer::calculateBorders() maxV.y = 0.0; } - RS_DEBUG->print("RS_EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y); + DEBUG->print("EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y); - //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); + //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); //printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y); - //RS_Entity::calculateBorders(); + //Entity::calculateBorders(); } /** * Recalculates the borders of this entity container including * invisible entities. */ -void RS_EntityContainer::forcedCalculateBorders() +void EntityContainer::forcedCalculateBorders() { - //RS_DEBUG->print("RS_EntityContainer::calculateBorders"); + //DEBUG->print("EntityContainer::calculateBorders"); resetBorders(); - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - //RS_Layer* layer = e->getLayer(); + //Layer* layer = e->getLayer(); if (e->isContainer()) { - ((RS_EntityContainer *)e)->forcedCalculateBorders(); + ((EntityContainer *)e)->forcedCalculateBorders(); } else { @@ -581,74 +581,74 @@ void RS_EntityContainer::forcedCalculateBorders() maxV.y = 0.0; } - //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); + //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); //printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y); - //RS_Entity::calculateBorders(); + //Entity::calculateBorders(); } /** * Updates all Dimension entities in this container and * reposition their labels. */ -void RS_EntityContainer::updateDimensions() +void EntityContainer::updateDimensions() { - RS_DEBUG->print("RS_EntityContainer::updateDimensions()"); + DEBUG->print("EntityContainer::updateDimensions()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 -// Q3PtrListIterator it = createIterator(); - QListIterator it = createIterator(); -// return QListIterator(entities); +// Q3PtrListIterator it = createIterator(); + QListIterator it = createIterator(); +// return QListIterator(entities); - RS_Entity * e; + Entity * e; while ((e = it.current()) != NULL) { ++it; - if (RS_Information::isDimension(e->rtti())) + if (Information::isDimension(e->rtti())) { // update and reposition label: - ((RS_Dimension *)e)->update(true); + ((Dimension *)e)->update(true); } else if (e->isContainer()) { - ((RS_EntityContainer *)e)->updateDimensions(); + ((EntityContainer *)e)->updateDimensions(); } } #else for(int i=0; irtti())) + if (Information::isDimension(e->rtti())) // update and reposition label: - ((RS_Dimension *)e)->update(true); + ((Dimension *)e)->update(true); else if (e->isContainer()) - ((RS_EntityContainer *)e)->updateDimensions(); + ((EntityContainer *)e)->updateDimensions(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateDimensions() OK"); + DEBUG->print("EntityContainer::updateDimensions() OK"); } /** * Updates all Insert entities in this container. */ -void RS_EntityContainer::updateInserts() +void EntityContainer::updateInserts() { - RS_DEBUG->print("RS_EntityContainer::updateInserts()"); + DEBUG->print("EntityContainer::updateInserts()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity * e; + Q3PtrListIterator it = createIterator(); + Entity * e; while ((e = it.current()) != NULL) { @@ -656,126 +656,126 @@ void RS_EntityContainer::updateInserts() //// Only update our own inserts and not inserts of inserts if (e->rtti() == RS2::EntityInsert /*&& e->getParent()==this*/) { - ((RS_Insert *)e)->update(); + ((Insert *)e)->update(); } else if (e->isContainer() && e->rtti() != RS2::EntityHatch) { - ((RS_EntityContainer *)e)->updateInserts(); + ((EntityContainer *)e)->updateInserts(); } } #else for(int i=0; irtti() == RS2::EntityInsert /*&& e->getParent()==this*/) - ((RS_Insert *)e)->update(); + ((Insert *)e)->update(); else if (e->isContainer() && e->rtti() != RS2::EntityHatch) - ((RS_EntityContainer *)e)->updateInserts(); + ((EntityContainer *)e)->updateInserts(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateInserts() OK"); + DEBUG->print("EntityContainer::updateInserts() OK"); } /** * Renames all inserts with name 'oldName' to 'newName'. This is * called after a block was rename to update the inserts. */ -void RS_EntityContainer::renameInserts(const QString& oldName, const QString& newName) +void EntityContainer::renameInserts(const QString& oldName, const QString& newName) { - RS_DEBUG->print("RS_EntityContainer::renameInserts()"); + DEBUG->print("EntityContainer::renameInserts()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it; if (e->rtti()==RS2::EntityInsert) { - RS_Insert* i = ((RS_Insert*)e); + Insert* i = ((Insert*)e); if (i->getName()==oldName) { i->setName(newName); } } else if (e->isContainer()) { - ((RS_EntityContainer*)e)->renameInserts(oldName, newName); + ((EntityContainer*)e)->renameInserts(oldName, newName); } } #else for(int i=0; irtti() == RS2::EntityInsert) { - RS_Insert * i = ((RS_Insert *)e); + Insert * i = ((Insert *)e); if (i->getName() == oldName) i->setName(newName); } else if (e->isContainer()) - ((RS_EntityContainer *)e)->renameInserts(oldName, newName); + ((EntityContainer *)e)->renameInserts(oldName, newName); } #endif - RS_DEBUG->print("RS_EntityContainer::renameInserts() OK"); + DEBUG->print("EntityContainer::renameInserts() OK"); } /** * Updates all Spline entities in this container. */ -void RS_EntityContainer::updateSplines() +void EntityContainer::updateSplines() { - RS_DEBUG->print("RS_EntityContainer::updateSplines()"); + DEBUG->print("EntityContainer::updateSplines()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it; //// Only update our own inserts and not inserts of inserts if (e->rtti()==RS2::EntitySpline /*&& e->getParent()==this*/) { - ((RS_Spline*)e)->update(); + ((Spline*)e)->update(); } else if (e->isContainer() && e->rtti()!=RS2::EntityHatch) { - ((RS_EntityContainer*)e)->updateSplines(); + ((EntityContainer*)e)->updateSplines(); } } #else for(int i=0; irtti() == RS2::EntitySpline /*&& e->getParent()==this*/) - ((RS_Spline *)e)->update(); + ((Spline *)e)->update(); else if (e->isContainer() && e->rtti() != RS2::EntityHatch) - ((RS_EntityContainer *)e)->updateSplines(); + ((EntityContainer *)e)->updateSplines(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateSplines() OK"); + DEBUG->print("EntityContainer::updateSplines() OK"); } /** * Updates the sub entities of this container. */ -void RS_EntityContainer::update() +void EntityContainer::update() { - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it; e->update(); @@ -783,7 +783,7 @@ void RS_EntityContainer::update() #else for(int i=0; iupdate(); entities[i]->update(); } @@ -794,7 +794,7 @@ void RS_EntityContainer::update() * Returns the first entity or NULL if this graphic is empty. * @param level */ -RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) +Entity * EntityContainer::firstEntity(RS2::ResolveLevel level) { switch (level) { @@ -808,15 +808,15 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { subContainer = NULL; -// RS_Entity * e = entities.first(); +// Entity * e = entities.first(); // entityIterator.toFront(); entityIterator = entities; - RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); + Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -833,15 +833,15 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { subContainer = NULL; -// RS_Entity * e = entities.first(); +// Entity * e = entities.first(); // entityIterator.toFront(); entityIterator = entities; - RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); + Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -866,7 +866,7 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) * \li \p 1 (default) only Groups are resolved * \li \p 2 all Entity Containers are resolved */ -RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) +Entity * EntityContainer::lastEntity(RS2::ResolveLevel level) { switch (level) { @@ -879,16 +879,16 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { -// RS_Entity * e = entities.last(); +// Entity * e = entities.last(); entityIterator = entities; entityIterator.toBack(); - RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); + Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); subContainer = NULL; if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); } return e; @@ -897,16 +897,16 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { -// RS_Entity * e = entities.last(); +// Entity * e = entities.last(); entityIterator = entities; entityIterator.toBack(); - RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); + Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); subContainer = NULL; if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); } return e; @@ -921,7 +921,7 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) * Returns the next entity or container or \p NULL if the last entity * returned by \p next() was the last entity in the container. */ -RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) +Entity * EntityContainer::nextEntity(RS2::ResolveLevel level) { switch (level) { @@ -932,7 +932,7 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { - RS_Entity * e = NULL; + Entity * e = NULL; if (subContainer != NULL) { @@ -956,8 +956,8 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -973,7 +973,7 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { - RS_Entity * e = NULL; + Entity * e = NULL; if (subContainer != NULL) { @@ -993,8 +993,8 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -1015,9 +1015,9 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) * Returns the prev entity or container or \p NULL if the last entity * returned by \p prev() was the first entity in the container. */ -RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) +Entity * EntityContainer::prevEntity(RS2::ResolveLevel level) { - RS_Entity * e = NULL; + Entity * e = NULL; switch (level) { @@ -1047,8 +1047,8 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); // emtpy container: if (e == NULL) @@ -1081,8 +1081,8 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); // emtpy container: if (e == NULL) @@ -1101,7 +1101,7 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) /** * @return Entity at the given index or NULL if the index is out of range. */ -RS_Entity * RS_EntityContainer::entityAt(uint index) +Entity * EntityContainer::entityAt(uint index) { return entities.at(index); } @@ -1109,7 +1109,7 @@ RS_Entity * RS_EntityContainer::entityAt(uint index) /** * @return Current index. */ -int RS_EntityContainer::entityAt() +int EntityContainer::entityAt() { #warning "!!! Not sure how to convert this from Qt3 -> Qt4 !!! (it seems we can ignore this for now as nothing calls it)" // return entities.at(); @@ -1119,7 +1119,7 @@ int RS_EntityContainer::entityAt() /** * Finds the given entity and makes it the current entity if found. */ -int RS_EntityContainer::findEntity(RS_Entity * entity) +int EntityContainer::findEntity(Entity * entity) { // return entities.find(entity); @@ -1132,7 +1132,7 @@ int RS_EntityContainer::findEntity(RS_Entity * entity) /** * @return The current entity. */ -RS_Entity * RS_EntityContainer::currentEntity() +Entity * EntityContainer::currentEntity() { // return entities.current(); @@ -1146,15 +1146,15 @@ RS_Entity * RS_EntityContainer::currentEntity() /** * Returns the copy to a new iterator for traversing the entities. */ -//Q3PtrListIterator RS_EntityContainer::createIterator() -QListIterator RS_EntityContainer::createIterator() +//Q3PtrListIterator EntityContainer::createIterator() +QListIterator EntityContainer::createIterator() { -// return Q3PtrListIterator(entities); - return QListIterator(entities); +// return Q3PtrListIterator(entities); + return QListIterator(entities); } #endif -/*virtual*/ bool RS_EntityContainer::isEmpty() +/*virtual*/ bool EntityContainer::isEmpty() { return (count() == 0); } @@ -1163,18 +1163,18 @@ QListIterator RS_EntityContainer::createIterator() * @return The point which is closest to 'coord' * (one of the vertexes) */ -Vector RS_EntityContainer::getNearestEndpoint(const Vector & coord, double * dist) +Vector EntityContainer::getNearestEndpoint(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - //Q3PtrListIterator it = createIterator(); - //RS_Entity* en; + //Q3PtrListIterator it = createIterator(); + //Entity* en; //while ( (en = it.current()) != NULL ) { // ++it; - for (RS_Entity* en = firstEntity(); + for (Entity* en = firstEntity(); en != NULL; en = nextEntity()) { @@ -1193,12 +1193,12 @@ Vector RS_EntityContainer::getNearestEndpoint(const Vector & coord, double * dis return closestPoint; } -Vector RS_EntityContainer::getNearestPointOnEntity(const Vector & coord, - bool onEntity, double * dist, RS_Entity ** entity) +Vector EntityContainer::getNearestPointOnEntity(const Vector & coord, + bool onEntity, double * dist, Entity ** entity) { Vector point(false); - RS_Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone); + Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone); if (e && e->isVisible()) point = e->getNearestPointOnEntity(coord, onEntity, dist, entity); @@ -1206,10 +1206,10 @@ Vector RS_EntityContainer::getNearestPointOnEntity(const Vector & coord, return point; } -Vector RS_EntityContainer::getNearestCenter(const Vector & coord, double * dist) +Vector EntityContainer::getNearestCenter(const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestCenter(coord, dist); @@ -1217,10 +1217,10 @@ Vector RS_EntityContainer::getNearestCenter(const Vector & coord, double * dist) return point; } -Vector RS_EntityContainer::getNearestMiddle(const Vector & coord, double * dist) +Vector EntityContainer::getNearestMiddle(const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestMiddle(coord, dist); @@ -1228,11 +1228,11 @@ Vector RS_EntityContainer::getNearestMiddle(const Vector & coord, double * dist) return point; } -Vector RS_EntityContainer::getNearestDist(double distance, const Vector & coord, +Vector EntityContainer::getNearestDist(double distance, const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestDist(distance, coord, dist); @@ -1243,7 +1243,7 @@ Vector RS_EntityContainer::getNearestDist(double distance, const Vector & coord, /** * @return The intersection which is closest to 'coord' */ -Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, +Vector EntityContainer::getNearestIntersection(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance @@ -1251,18 +1251,18 @@ Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found VectorSolutions sol; - RS_Entity * closestEntity; + Entity * closestEntity; closestEntity = getNearestEntity(coord, NULL, RS2::ResolveAll); if (closestEntity) { - for(RS_Entity * en=firstEntity(RS2::ResolveAll); en!=NULL; + for(Entity * en=firstEntity(RS2::ResolveAll); en!=NULL; en = nextEntity(RS2::ResolveAll)) { if (en->isVisible() && en!=closestEntity) { - sol = RS_Information::getIntersection(closestEntity, en, true); + sol = Information::getIntersection(closestEntity, en, true); for(int i=0; i<4; i++) { @@ -1289,14 +1289,14 @@ Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, return closestPoint; } -Vector RS_EntityContainer::getNearestRef(const Vector & coord, double * dist) +Vector EntityContainer::getNearestRef(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (en->isVisible()) { @@ -1316,7 +1316,7 @@ Vector RS_EntityContainer::getNearestRef(const Vector & coord, double * dist) return closestPoint; } -Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, +Vector EntityContainer::getNearestSelectedRef(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance @@ -1324,7 +1324,7 @@ Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (en->isVisible() && en->isSelected() && !en->isParentSelected()) { @@ -1344,25 +1344,25 @@ Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, return closestPoint; } -double RS_EntityContainer::getDistanceToPoint(const Vector & coord, - RS_Entity ** entity, RS2::ResolveLevel level, double solidDist) +double EntityContainer::getDistanceToPoint(const Vector & coord, + Entity ** entity, RS2::ResolveLevel level, double solidDist) { - RS_DEBUG->print("RS_EntityContainer::getDistanceToPoint"); + DEBUG->print("EntityContainer::getDistanceToPoint"); double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance - RS_Entity * closestEntity = NULL; // closest entity found - RS_Entity * subEntity = NULL; + Entity * closestEntity = NULL; // closest entity found + Entity * subEntity = NULL; //int k=0; - for(RS_Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level)) + for(Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level)) { if (e->isVisible()) { - RS_DEBUG->print("entity: getDistanceToPoint"); - RS_DEBUG->print("entity: %d", e->rtti()); + DEBUG->print("entity: getDistanceToPoint"); + DEBUG->print("entity: %d", e->rtti()); curDist = e->getDistanceToPoint(coord, &subEntity, level, solidDist); - RS_DEBUG->print("entity: getDistanceToPoint: OK"); + DEBUG->print("entity: getDistanceToPoint: OK"); if (curDistprint("RS_EntityContainer::getDistanceToPoint: OK"); + DEBUG->print("EntityContainer::getDistanceToPoint: OK"); return minDist; } -RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, +Entity * EntityContainer::getNearestEntity(const Vector & coord, double * dist, RS2::ResolveLevel level) { - RS_DEBUG->print("RS_EntityContainer::getNearestEntity"); - RS_Entity * e = NULL; + DEBUG->print("EntityContainer::getNearestEntity"); + Entity * e = NULL; // distance for points inside solids: double solidDist = RS_MAXDOUBLE; @@ -1404,7 +1404,7 @@ RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, if (dist) *dist = d; - RS_DEBUG->print("RS_EntityContainer::getNearestEntity: OK"); + DEBUG->print("EntityContainer::getNearestEntity: OK"); return e; } @@ -1416,24 +1416,24 @@ RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, * @retval true all contours were closed * @retval false at least one contour is not closed */ -bool RS_EntityContainer::optimizeContours() +bool EntityContainer::optimizeContours() { - RS_DEBUG->print("RS_EntityContainer::optimizeContours"); + DEBUG->print("EntityContainer::optimizeContours"); Vector current(false); Vector start(false); - RS_EntityContainer tmp; + EntityContainer tmp; bool changed = false; bool closed = true; for(uint ci=0; ciisEdge() && !e1->isContainer() && !e1->isProcessed()) { - RS_AtomicEntity * ce = (RS_AtomicEntity *)e1; + AtomicEntity * ce = (AtomicEntity *)e1; // next contour start: ce->setProcessed(true); @@ -1449,12 +1449,12 @@ bool RS_EntityContainer::optimizeContours() done = true; for(uint ei=0; eiisEdge() && !e2->isContainer() && !e2->isProcessed()) { - RS_AtomicEntity * e = (RS_AtomicEntity *)e2; + AtomicEntity * e = (AtomicEntity *)e2; if (e->getStartpoint().distanceTo(current) < 1.0e-4) { @@ -1466,7 +1466,7 @@ bool RS_EntityContainer::optimizeContours() else if (e->getEndpoint().distanceTo(current) < 1.0e-4) { e->setProcessed(true); - RS_AtomicEntity * cl = (RS_AtomicEntity *)e->clone(); + AtomicEntity * cl = (AtomicEntity *)e->clone(); cl->reverse(); tmp.addEntity(cl); current = cl->getEndpoint(); @@ -1493,7 +1493,7 @@ bool RS_EntityContainer::optimizeContours() { done = true; - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (!en->isContainer()) { @@ -1506,19 +1506,19 @@ bool RS_EntityContainer::optimizeContours() while (!done); // add new sorted entities: - for(RS_Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) + for(Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) { en->setProcessed(false); addEntity(en->clone()); } - RS_DEBUG->print("RS_EntityContainer::optimizeContours: OK"); + DEBUG->print("EntityContainer::optimizeContours: OK"); return closed; } -bool RS_EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->hasEndpointsWithinWindow(v1, v2)) return true; @@ -1527,29 +1527,29 @@ bool RS_EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) return false; } -void RS_EntityContainer::move(Vector offset) +void EntityContainer::move(Vector offset) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->move(offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::rotate(Vector center, double angle) +void EntityContainer::rotate(Vector center, double angle) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->rotate(center, angle); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::scale(Vector center, Vector factor) +void EntityContainer::scale(Vector center, Vector factor) { if (fabs(factor.x) > RS_TOLERANCE && fabs(factor.y) > RS_TOLERANCE) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->scale(center, factor); } @@ -1557,16 +1557,16 @@ void RS_EntityContainer::scale(Vector center, Vector factor) calculateBorders(); } -void RS_EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2) +void EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2) { if (axisPoint1.distanceTo(axisPoint2) > 1.0e-6) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->mirror(axisPoint1, axisPoint2); } } -void RS_EntityContainer::stretch(Vector firstCorner, Vector secondCorner, +void EntityContainer::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { if (getMin().isInWindow(firstCorner, secondCorner) && @@ -1576,51 +1576,51 @@ void RS_EntityContainer::stretch(Vector firstCorner, Vector secondCorner, } else { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->stretch(firstCorner, secondCorner, offset); } - // some entitiycontainers might need an update (e.g. RS_Leader): + // some entitiycontainers might need an update (e.g. Leader): update(); } -void RS_EntityContainer::moveRef(const Vector & ref, const Vector & offset) +void EntityContainer::moveRef(const Vector & ref, const Vector & offset) { - for(RS_Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->moveRef(ref, offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset) +void EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->moveSelectedRef(ref, offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (!painter || !view) return; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) #if 0 { if (e->rtti() == RS2::EntityText) { std::cout << "About to draw TEXT entity... " - << "TEXT=\"" << ((RS_Text *)e)->getText().toAscii().data() << "\"" << std::endl; + << "TEXT=\"" << ((Text *)e)->getText().toAscii().data() << "\"" << std::endl; } //OK, we have text, but no insert entities at least none that are drawn... //Ah! But with a standard text entity, it DOES have them! else if (e->rtti() == RS2::EntityInsert) { std::cout << "About to draw INSERT entity... " - << "INSERT=\"" << ((RS_Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl; + << "INSERT=\"" << ((Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl; } #endif view->drawEntity(e); @@ -1632,7 +1632,7 @@ else if (e->rtti() == RS2::EntityInsert) /** * Dumps the entities to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec) +std::ostream & operator<<(std::ostream & os, EntityContainer & ec) { static int indent = 0; char * tab = new char[indent * 2 + 1]; @@ -1648,7 +1648,7 @@ std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec) os << tab << "Borders[" << id << "]: " << ec.minV << " - " << ec.maxV << "\n"; //os << tab << "Unit[" << id << "]: " - //<< RS_Units::unit2string (ec.unit) << "\n"; + //<< Units::unit2string (ec.unit) << "\n"; if (ec.getLayer()) { os << tab << "Layer[" << id << "]: " @@ -1672,25 +1672,25 @@ QString s; os << "(# of entities in this = " << ec.entities.size() << ")\n"; for(int i=0; irtti()); os << s.toAscii().data(); } s.sprintf("(firstEntity = $%08X)\n", ec.firstEntity()); os << s.toAscii().data(); - for(RS_Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity()) + for(Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity()) { switch (t->rtti()) { case RS2::EntityInsert: - os << tab << *((RS_Insert *)t); - os << tab << *((RS_Entity *)t); - os << tab << *((RS_EntityContainer *)t); + os << tab << *((Insert *)t); + os << tab << *((Entity *)t); + os << tab << *((EntityContainer *)t); break; default: if (t->isContainer()) - os << tab << *((RS_EntityContainer *)t); + os << tab << *((EntityContainer *)t); else os << tab << *t; diff --git a/src/base/entitycontainer.h b/src/base/entitycontainer.h index a8c4d9e..f055724 100644 --- a/src/base/entitycontainer.h +++ b/src/base/entitycontainer.h @@ -15,17 +15,17 @@ * * @author Andrew Mustun */ -class RS_EntityContainer: public RS_Entity +class EntityContainer: public Entity { public: - RS_EntityContainer(RS_EntityContainer * parent = NULL, bool owner = true); - //RS_EntityContainer(const RS_EntityContainer& ec); - virtual ~RS_EntityContainer(); + EntityContainer(EntityContainer * parent = NULL, bool owner = true); + //EntityContainer(const EntityContainer& ec); + virtual ~EntityContainer(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual void detach(); virtual RS2::EntityType rtti() const; - void reparent(RS_EntityContainer * parent); + void reparent(EntityContainer * parent); virtual bool isContainer() const; virtual bool isAtomic() const; virtual double getLength(); @@ -38,29 +38,29 @@ class RS_EntityContainer: public RS_Entity virtual void selectWindow(Vector v1, Vector v2, bool select = true, bool cross = false); - virtual void addEntity(RS_Entity * entity); - virtual void insertEntity(int index, RS_Entity * entity); - virtual void replaceEntity(int index, RS_Entity * entity); - virtual bool removeEntity(RS_Entity * entity); - virtual RS_Entity * firstEntity(RS2::ResolveLevel level = RS2::ResolveNone); - virtual RS_Entity * lastEntity(RS2::ResolveLevel level = RS2::ResolveNone); - virtual RS_Entity * nextEntity(RS2::ResolveLevel level = RS2::ResolveNone); - virtual RS_Entity * prevEntity(RS2::ResolveLevel level = RS2::ResolveNone); - virtual RS_Entity * entityAt(uint index); - virtual RS_Entity * currentEntity(); + virtual void addEntity(Entity * entity); + virtual void insertEntity(int index, Entity * entity); + virtual void replaceEntity(int index, Entity * entity); + virtual bool removeEntity(Entity * entity); + virtual Entity * firstEntity(RS2::ResolveLevel level = RS2::ResolveNone); + virtual Entity * lastEntity(RS2::ResolveLevel level = RS2::ResolveNone); + virtual Entity * nextEntity(RS2::ResolveLevel level = RS2::ResolveNone); + virtual Entity * prevEntity(RS2::ResolveLevel level = RS2::ResolveNone); + virtual Entity * entityAt(uint index); + virtual Entity * currentEntity(); virtual int entityAt(); - virtual int findEntity(RS_Entity * entity); + virtual int findEntity(Entity * entity); virtual void clear(); - // Q3PtrListIterator createIterator(); -// QListIterator createIterator(); + // Q3PtrListIterator createIterator(); +// QListIterator createIterator(); virtual bool isEmpty(); virtual unsigned long int count(); virtual unsigned long int countDeep(); virtual unsigned long int countSelected(); virtual void setAutoUpdateBorders(bool enable); - virtual void adjustBorders(RS_Entity * entity); + virtual void adjustBorders(Entity * entity); virtual void calculateBorders(); virtual void forcedCalculateBorders(); virtual void updateDimensions(); @@ -71,11 +71,11 @@ class RS_EntityContainer: public RS_Entity virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL); - RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL, + Entity * getNearestEntity(const Vector & point, double * dist = NULL, RS2::ResolveLevel level = RS2::ResolveAll); virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, - double * dist = NULL, RS_Entity ** entity = NULL); + double * dist = NULL, Entity ** entity = NULL); virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL); virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL); @@ -84,7 +84,7 @@ class RS_EntityContainer: public RS_Entity virtual Vector getNearestRef(const Vector & coord, double * dist = NULL); virtual Vector getNearestSelectedRef(const Vector & coord, double * dist = NULL); - virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity, + virtual double getDistanceToPoint(const Vector & coord, Entity ** entity, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual bool optimizeContours(); @@ -101,14 +101,14 @@ class RS_EntityContainer: public RS_Entity virtual void moveSelectedRef(const Vector & ref, const Vector & offset); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec); + friend std::ostream & operator<<(std::ostream & os, EntityContainer & ec); protected: /** entities in the container */ - QList entities; + QList entities; /** sub container used only temporarly for iteration. */ - RS_EntityContainer * subContainer; + EntityContainer * subContainer; /** * Class variable: @@ -118,7 +118,7 @@ class RS_EntityContainer: public RS_Entity static bool autoUpdateBorders; private: - QListIterator entityIterator; + QListIterator entityIterator; }; #endif // __ENTITYCONTAINER_H__ diff --git a/src/base/rs.h b/src/base/enums.h similarity index 75% rename from src/base/rs.h rename to src/base/enums.h index d0bfc41..667f311 100644 --- a/src/base/rs.h +++ b/src/base/enums.h @@ -1,5 +1,5 @@ -#ifndef __RS_H__ -#define __RS_H__ +#ifndef __ENUMS_H__ +#define __ENUMS_H__ #include #include @@ -21,6 +21,7 @@ * @author James Hammons * @author Andrew Mustun */ +//change from RS2 to EN (for ENum) class RS2 { public: @@ -62,7 +63,7 @@ public: }; /** - * Variable types used by RS_VariableDict and RS_Variable. + * Variable types used by VariableDict and Variable. */ enum VariableType { VariableString, @@ -594,88 +595,6 @@ public: LineByBlock = -2 /**< Line type defined by block not entity */ }; - /** - * Wrapper for Qt - */ - static Qt::PenStyle rsToQtLineType(RS2::LineType t) { - switch (t) { - case NoPen: - return Qt::NoPen; - break; - case SolidLine: - return Qt::SolidLine; - break; - case DotLine: - case DotLine2: - case DotLineX2: - return Qt::DotLine; - break; - case DashLine: - case DashLine2: - case DashLineX2: - return Qt::DashLine; - break; - case DashDotLine: - case DashDotLine2: - case DashDotLineX2: - return Qt::DashDotLine; - break; - case DivideLine: - case DivideLine2: - case DivideLineX2: - return Qt::DashDotDotLine; - break; - case CenterLine: - case CenterLine2: - case CenterLineX2: - return Qt::DashDotLine; - break; - case BorderLine: - case BorderLine2: - case BorderLineX2: - return Qt::DashDotLine; - break; - case LineByLayer: - case LineByBlock: - default: - return Qt::SolidLine; - break; - } - return Qt::SolidLine; - } - - /** - * Wrapper for Qt. - */ - static RS2::LineType qtToRsPenStyle(Qt::PenStyle s) - { - switch (s) - { - case Qt::NoPen: - return NoPen; - case Qt::SolidLine: - return SolidLine; - break; - case Qt::DashLine: - return DashLine; - break; - case Qt::DotLine: - return DotLine; - break; - case Qt::DashDotLine: - return DashDotLine; - break; - case Qt::DashDotDotLine: - return DivideLine; - break; - default: - return SolidLine; - break; - } - - return SolidLine; - } - /** * \brief Struct that stores a line type pattern (e.g. dash dot dot). */ @@ -719,121 +638,6 @@ public: WidthDefault = -3 /**< Line width defaults to the predefined line width. */ }; - /** - * Wrapper for Qt - */ - static LineWidth intToLineWidth(int w) - { - if (w == -3) - { - return WidthDefault; - } - else if (w == -2) - { - return WidthByBlock; - } - else if (w == -1) - { - return WidthByLayer; - } - else if (w < 3) - { - return Width00; - } - else if (w < 8) - { - return Width01; - } - else if (w < 12) - { - return Width02; - } - else if (w < 14) - { - return Width03; - } - else if (w < 17) - { - return Width04; - } - else if (w < 19) - { - return Width05; - } - else if (w < 23) - { - return Width06; - } - else if (w < 28) - { - return Width07; - } - else if (w < 33) - { - return Width08; - } - else if (w < 38) - { - return Width09; - } - else if (w < 46) - { - return Width10; - } - else if (w < 52) - { - return Width11; - } - else if (w < 57) - { - return Width12; - } - else if (w < 66) - { - return Width13; - } - else if (w < 76) - { - return Width14; - } - else if (w < 86) - { - return Width15; - } - else if (w < 96) - { - return Width16; - } - else if (w < 104) - { - return Width17; - } - else if (w < 114) - { - return Width18; - } - else if (w < 131) - { - return Width19; - } - else if (w < 150) - { - return Width20; - } - else if (w < 180) - { - return Width21; - } - else if (w < 206) - { - return Width22; - } - else - { - return Width23; - } - } - /** * Enum of cursor types. */ @@ -861,69 +665,6 @@ public: MovingHandCursor /**< Moving hand - a little flat hand. */ }; - /** - * Wrapper for Qt. - */ - static Qt::CursorShape rsToQtCursorType(RS2::CursorType t) - { - switch (t) - { - case ArrowCursor: - return Qt::ArrowCursor; - break; - case UpArrowCursor: - return Qt::UpArrowCursor; - break; - case CrossCursor: - return Qt::CrossCursor; - break; - case WaitCursor: - return Qt::WaitCursor; - break; - case IbeamCursor: - return Qt::IBeamCursor; - break; - case SizeVerCursor: - return Qt::SizeVerCursor; - break; - case SizeHorCursor: - return Qt::SizeHorCursor; - break; - case SizeBDiagCursor: - return Qt::SizeBDiagCursor; - break; - case SizeFDiagCursor: - return Qt::SizeFDiagCursor; - break; - case SizeAllCursor: - return Qt::SizeAllCursor; - break; - case BlankCursor: - return Qt::BlankCursor; - break; - case SplitVCursor: - return Qt::SplitVCursor; - break; - case SplitHCursor: - return Qt::SplitHCursor; - break; - case PointingHandCursor: - return Qt::PointingHandCursor; - break; - case ForbiddenCursor: - return Qt::ForbiddenCursor; - break; - case WhatsThisCursor: - return Qt::WhatsThisCursor; - break; - default: - return Qt::ArrowCursor; - break; - } - - return Qt::ArrowCursor; - } - /** * Paper formats. */ @@ -962,116 +703,14 @@ public: NPageSize }; - /** - * Wrapper for Qt. - */ - static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f) - { - QPrinter::PageSize ret; - - switch (f) - { - case Custom: - ret = QPrinter::Custom; - break; - case Letter: - ret = QPrinter::Letter; - break; - case Legal: - ret = QPrinter::Legal; - break; - case Executive: - ret = QPrinter::Executive; - break; - case A0: - ret = QPrinter::A0; - break; - case A1: - ret = QPrinter::A1; - break; - case A2: - ret = QPrinter::A2; - break; - case A3: - ret = QPrinter::A3; - break; - default: - case A4: - ret = QPrinter::A4; - break; - case A5: - ret = QPrinter::A5; - break; - case A6: - ret = QPrinter::A6; - break; - case A7: - ret = QPrinter::A7; - break; - case A8: - ret = QPrinter::A8; - break; - case A9: - ret = QPrinter::A9; - break; - case B0: - ret = QPrinter::B0; - break; - case B1: - ret = QPrinter::B1; - break; - case B2: - ret = QPrinter::B2; - break; - case B3: - ret = QPrinter::B3; - break; - case B4: - ret = QPrinter::B4; - break; - case B5: - ret = QPrinter::B5; - break; - case B6: - ret = QPrinter::B6; - break; - case B7: - ret = QPrinter::B7; - break; - case B8: - ret = QPrinter::B8; - break; - case B9: - ret = QPrinter::B9; - break; - case B10: - ret = QPrinter::B10; - break; - case C5E: - ret = QPrinter::C5E; - break; - case Comm10E: - ret = QPrinter::Comm10E; - break; - case DLE: - ret = QPrinter::DLE; - break; - case Folio: - ret = QPrinter::Folio; - break; - //case Ledger: - // ret = QPrinter::Ledger; - // break; - case Tabloid: - ret = QPrinter::Tabloid; - break; - case NPageSize: - ret = QPrinter::NPageSize; - break; - } - - return ret; - } + /** + * Wrappers for Qt (ICK) + */ + static Qt::PenStyle rsToQtLineType(RS2::LineType t); + static RS2::LineType qtToRsPenStyle(Qt::PenStyle s); + static RS2::LineWidth intToLineWidth(int w); + static Qt::CursorShape rsToQtCursorType(RS2::CursorType t); + static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f); }; -#endif // __RS_H__ +#endif // __ENUMS_H__ diff --git a/src/base/eventhandler.cpp b/src/base/eventhandler.cpp index 58334af..a8b6417 100644 --- a/src/base/eventhandler.cpp +++ b/src/base/eventhandler.cpp @@ -26,7 +26,7 @@ /** * Constructor. */ -RS_EventHandler::RS_EventHandler(GraphicView * graphicView) +EventHandler::EventHandler(GraphicView * graphicView) { this->graphicView = graphicView; actionIndex = -1; @@ -41,9 +41,9 @@ RS_EventHandler::RS_EventHandler(GraphicView * graphicView) /** * Destructor. */ -RS_EventHandler::~RS_EventHandler() +EventHandler::~EventHandler() { - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler"); + DEBUG->print("EventHandler::~EventHandler"); if (defaultAction != NULL) { @@ -54,7 +54,7 @@ RS_EventHandler::~RS_EventHandler() killAllActions(); - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: Deleting all actions.."); + DEBUG->print("EventHandler::~EventHandler: Deleting all actions.."); for(int i=0; iprint("RS_EventHandler::~RS_EventHandler: Deleting all actions..: OK"); - RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: OK"); + DEBUG->print("EventHandler::~EventHandler: Deleting all actions..: OK"); + DEBUG->print("EventHandler::~EventHandler: OK"); } /** * Go back in current action. */ -void RS_EventHandler::back() +void EventHandler::back() { QMouseEvent e(QEvent::MouseButtonRelease, QPoint(0, 0), Qt::RightButton, Qt::RightButton, Qt::NoModifier); @@ -84,7 +84,7 @@ void RS_EventHandler::back() /** * Go enter pressed event for current action. */ -void RS_EventHandler::enter() +void EventHandler::enter() { // QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, '\n', 0); QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier, "\n", false, 0); @@ -94,7 +94,7 @@ void RS_EventHandler::enter() /** * Called by GraphicView */ -void RS_EventHandler::mousePressEvent(QMouseEvent * e) +void EventHandler::mousePressEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] != NULL) { @@ -110,7 +110,7 @@ void RS_EventHandler::mousePressEvent(QMouseEvent * e) } else { - RS_DEBUG->print("currently no action defined"); + DEBUG->print("currently no action defined"); e->ignore(); } } @@ -119,12 +119,12 @@ void RS_EventHandler::mousePressEvent(QMouseEvent * e) /** * Called by GraphicView */ -void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e) +void EventHandler::mouseReleaseEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] != NULL && !currentActions[actionIndex]->isFinished()) { - RS_DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data()); + DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data()); currentActions[actionIndex]->mouseReleaseEvent(e); // Clean up actions - one might be finished now @@ -143,7 +143,7 @@ void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e) /** * Called by GraphicView */ -void RS_EventHandler::mouseMoveEvent(QMouseEvent * e) +void EventHandler::mouseMoveEvent(QMouseEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -160,14 +160,14 @@ void RS_EventHandler::mouseMoveEvent(QMouseEvent * e) } else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::mouseLeaveEvent() +void EventHandler::mouseLeaveEvent() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -178,14 +178,14 @@ void RS_EventHandler::mouseLeaveEvent() { if (defaultAction) defaultAction->suspend(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::mouseEnterEvent() +void EventHandler::mouseEnterEvent() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -202,7 +202,7 @@ void RS_EventHandler::mouseEnterEvent() /** * Called by GraphicView */ -void RS_EventHandler::keyPressEvent(QKeyEvent * e) +void EventHandler::keyPressEvent(QKeyEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -216,14 +216,14 @@ void RS_EventHandler::keyPressEvent(QKeyEvent * e) else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Called by GraphicView */ -void RS_EventHandler::keyReleaseEvent(QKeyEvent * e) +void EventHandler::keyReleaseEvent(QKeyEvent * e) { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -237,16 +237,16 @@ void RS_EventHandler::keyReleaseEvent(QKeyEvent * e) else e->ignore(); - //RS_DEBUG->print("currently no action defined"); + //DEBUG->print("currently no action defined"); } } /** * Handles command line events. */ -void RS_EventHandler::commandEvent(RS_CommandEvent * e) +void EventHandler::commandEvent(CommandEvent * e) { - RS_DEBUG->print("RS_EventHandler::commandEvent"); + DEBUG->print("EventHandler::commandEvent"); QString cmd = e->getCommand(); if (coordinateInputEnabled) @@ -260,27 +260,27 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) && !currentActions[actionIndex]->isFinished()) { int commaPos = cmd.indexOf(','); - RS_DEBUG->print("RS_EventHandler::commandEvent: 001"); + DEBUG->print("EventHandler::commandEvent: 001"); bool ok1, ok2; - RS_DEBUG->print("RS_EventHandler::commandEvent: 002"); - double x = RS_Math::eval(cmd.left(commaPos), &ok1); - RS_DEBUG->print("RS_EventHandler::commandEvent: 003a"); - double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); - RS_DEBUG->print("RS_EventHandler::commandEvent: 004"); + DEBUG->print("EventHandler::commandEvent: 002"); + double x = Math::eval(cmd.left(commaPos), &ok1); + DEBUG->print("EventHandler::commandEvent: 003a"); + double y = Math::eval(cmd.mid(commaPos + 1), &ok2); + DEBUG->print("EventHandler::commandEvent: 004"); if (ok1 && ok2) { -// RS_DEBUG->print("RS_EventHandler::commandEvent: 005"); -// RS_CoordinateEvent ce(Vector(x, y)); - RS_DEBUG->print("RS_EventHandler::commandEvent: 006"); +// DEBUG->print("EventHandler::commandEvent: 005"); +// CoordinateEvent ce(Vector(x, y)); + DEBUG->print("EventHandler::commandEvent: 006"); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(x, y); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -298,20 +298,20 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) { int commaPos = cmd.indexOf(','); bool ok1, ok2; - double x = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1); - double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double x = Math::eval(cmd.mid(1, commaPos - 1), &ok1); + double y = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { -// RS_CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero()); +// CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero()); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(Vector(x,y) + graphicView->getRelativeZero()); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -329,21 +329,21 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) { int commaPos = cmd.indexOf('<'); bool ok1, ok2; - double r = RS_Math::eval(cmd.left(commaPos), &ok1); - double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double r = Math::eval(cmd.left(commaPos), &ok1); + double a = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { Vector pos; - pos.setPolar(r,RS_Math::deg2rad(a)); -// RS_CoordinateEvent ce(pos); + pos.setPolar(r,Math::deg2rad(a)); +// CoordinateEvent ce(pos); // currentActions[actionIndex]->coordinateEvent(&ce); currentActions[actionIndex]->coordinateEvent(&pos); } else { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -362,22 +362,22 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) // int commaPos = cmd.find('<'); int commaPos = cmd.indexOf('<'); bool ok1, ok2; - double r = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1); - double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2); + double r = Math::eval(cmd.mid(1, commaPos - 1), &ok1); + double a = Math::eval(cmd.mid(commaPos + 1), &ok2); if (ok1 && ok2) { Vector pos; - pos.setPolar(r,RS_Math::deg2rad(a)); -// RS_CoordinateEvent ce(pos + graphicView->getRelativeZero()); + pos.setPolar(r,Math::deg2rad(a)); +// CoordinateEvent ce(pos + graphicView->getRelativeZero()); // currentActions[actionIndex]->coordinateEvent(&ce); Vector ce(pos + graphicView->getRelativeZero()); currentActions[actionIndex]->coordinateEvent(&ce); } else { - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->commandMessage("Expression Syntax Error"); + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage("Expression Syntax Error"); } e->accept(); @@ -402,13 +402,13 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) } } - RS_DEBUG->print("RS_EventHandler::commandEvent: OK"); + DEBUG->print("EventHandler::commandEvent: OK"); } /** * Enables coordinate input in the command line. */ -void RS_EventHandler::enableCoordinateInput() +void EventHandler::enableCoordinateInput() { coordinateInputEnabled = true; } @@ -416,7 +416,7 @@ void RS_EventHandler::enableCoordinateInput() /** * Enables coordinate input in the command line. */ -void RS_EventHandler::disableCoordinateInput() +void EventHandler::disableCoordinateInput() { coordinateInputEnabled = false; } @@ -424,7 +424,7 @@ void RS_EventHandler::disableCoordinateInput() /** * @return Current action. */ -ActionInterface * RS_EventHandler::getCurrentAction() +ActionInterface * EventHandler::getCurrentAction() { if (actionIndex >= 0 && currentActions[actionIndex] && !currentActions[actionIndex]->isFinished()) @@ -436,7 +436,7 @@ ActionInterface * RS_EventHandler::getCurrentAction() /** * @return The current default action. */ -ActionInterface * RS_EventHandler::getDefaultAction() +ActionInterface * EventHandler::getDefaultAction() { return defaultAction; } @@ -444,7 +444,7 @@ ActionInterface * RS_EventHandler::getDefaultAction() /** * Sets the default action. */ -void RS_EventHandler::setDefaultAction(ActionInterface * action) +void EventHandler::setDefaultAction(ActionInterface * action) { if (defaultAction) { @@ -459,9 +459,9 @@ void RS_EventHandler::setDefaultAction(ActionInterface * action) /** * Sets the current action. */ -void RS_EventHandler::setCurrentAction(ActionInterface * action) +void EventHandler::setCurrentAction(ActionInterface * action) { - RS_DEBUG->print("RS_EventHandler::setCurrentAction"); + DEBUG->print("EventHandler::setCurrentAction"); if (!action) return; @@ -507,35 +507,35 @@ void RS_EventHandler::setCurrentAction(ActionInterface * action) // Set current action: currentActions[actionIndex] = action; - RS_DEBUG->print("RS_EventHandler::setCurrentAction: current action is: %s", + DEBUG->print("EventHandler::setCurrentAction: current action is: %s", currentActions[actionIndex]->getName().toLatin1().data()); // Initialisation of our new action: - RS_DEBUG->print("RS_EventHandler::setCurrentAction: init current action"); + DEBUG->print("EventHandler::setCurrentAction: init current action"); action->init(); // ## new: if (action->isFinished() == false) { - RS_DEBUG->print("RS_EventHandler::setCurrentAction: show options"); + DEBUG->print("EventHandler::setCurrentAction: show options"); currentActions[actionIndex]->showOptions(); - RS_DEBUG->print("RS_EventHandler::setCurrentAction: set predecessor"); + DEBUG->print("EventHandler::setCurrentAction: set predecessor"); action->setPredecessor(predecessor); } - RS_DEBUG->print("RS_EventHandler::setCurrentAction: cleaning up.."); + DEBUG->print("EventHandler::setCurrentAction: cleaning up.."); cleanUp(); - RS_DEBUG->print("RS_EventHandler::setCurrentAction: debugging actions"); + DEBUG->print("EventHandler::setCurrentAction: debugging actions"); debugActions(); - RS_DEBUG->print("GraphicView::setCurrentAction: OK"); + DEBUG->print("GraphicView::setCurrentAction: OK"); } /** * Kills all running selection actions. Called when a selection action * is launched to reduce confusion. */ -void RS_EventHandler::killSelectActions() +void EventHandler::killSelectActions() { for(int c=0; cprint("RS_EventHandler::cleanUp"); + DEBUG->print("EventHandler::cleanUp"); int o = 0; // old index int n = 0; // new index @@ -650,13 +650,13 @@ void RS_EventHandler::cleanUp() } } - RS_DEBUG->print("RS_EventHandler::cleanUp: OK"); + DEBUG->print("EventHandler::cleanUp: OK"); } /** * Sets the snap mode for all currently active actions. */ -void RS_EventHandler::setSnapMode(RS2::SnapMode sm) +void EventHandler::setSnapMode(RS2::SnapMode sm) { #if 0 for(int c=0; cprint("---"); + DEBUG->print("---"); for(int c=0; cprint("Current"); + DEBUG->print("Current"); if (currentActions[c]) - RS_DEBUG->print("Action %03d: %s [%s]", + DEBUG->print("Action %03d: %s [%s]", c, currentActions[c]->getName().toLatin1().data(), currentActions[c]->isFinished() ? "finished" : "active"); else - RS_DEBUG->print("Action %03d: NULL", c); + DEBUG->print("Action %03d: NULL", c); } } diff --git a/src/base/eventhandler.h b/src/base/eventhandler.h index aab7f39..4651a89 100644 --- a/src/base/eventhandler.h +++ b/src/base/eventhandler.h @@ -2,12 +2,12 @@ #define __EVENTHANDLER_H__ #include -#include "rs.h" +#include "enums.h" #define RS_MAXACTIONS 16 class ActionInterface; -class RS_CommandEvent; +class CommandEvent; class GraphicView; /** @@ -15,11 +15,11 @@ class GraphicView; * active. All events going from the view to the actions come over * this class. */ -class RS_EventHandler +class EventHandler { public: - RS_EventHandler(GraphicView * graphicView); - ~RS_EventHandler(); + EventHandler(GraphicView * graphicView); + ~EventHandler(); void back(); void enter(); @@ -30,7 +30,7 @@ class RS_EventHandler void mouseEnterEvent(); void keyPressEvent(QKeyEvent * e); void keyReleaseEvent(QKeyEvent * e); - void commandEvent(RS_CommandEvent * e); + void commandEvent(CommandEvent * e); void enableCoordinateInput(); void disableCoordinateInput(); void setDefaultAction(ActionInterface * action); diff --git a/src/base/fileio.cpp b/src/base/fileio.cpp index 3187bed..cde23ea 100644 --- a/src/base/fileio.cpp +++ b/src/base/fileio.cpp @@ -22,20 +22,20 @@ #include "filterdxf1.h" #include "filterinterface.h" -RS_FileIO * RS_FileIO::uniqueInstance = NULL; +FileIO * FileIO::uniqueInstance = NULL; // Constructor -RS_FileIO::RS_FileIO() +FileIO::FileIO() { } /** * @return Instance to the unique import object. */ -/*static*/ RS_FileIO * RS_FileIO::instance() +/*static*/ FileIO * FileIO::instance() { if (!uniqueInstance) - uniqueInstance = new RS_FileIO(); + uniqueInstance = new FileIO(); return uniqueInstance; } @@ -43,7 +43,7 @@ RS_FileIO::RS_FileIO() /** * Registers a new import filter. */ -void RS_FileIO::registerFilter(RS_FilterInterface * f) +void FileIO::registerFilter(FilterInterface * f) { filterList.append(f); } @@ -51,7 +51,7 @@ void RS_FileIO::registerFilter(RS_FilterInterface * f) /** * @return List of registered filters. */ -QList RS_FileIO::getFilterList() +QList FileIO::getFilterList() { return filterList; } @@ -59,11 +59,11 @@ QList RS_FileIO::getFilterList() /** * @return Filter which can import the given file type. */ -RS_FilterInterface * RS_FileIO::getImportFilter(RS2::FormatType t) +FilterInterface * FileIO::getImportFilter(RS2::FormatType t) { for(int i=0; icanImport(t)) return f; @@ -75,11 +75,11 @@ RS_FilterInterface * RS_FileIO::getImportFilter(RS2::FormatType t) /** * @return Filter which can export the given file type. */ -RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t) +FilterInterface * FileIO::getExportFilter(RS2::FormatType t) { for(int i=0; icanExport(t)) return f; @@ -97,11 +97,11 @@ RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t) * it can also be a polyline, text, ... * @param file Path and name of the file to import. */ -bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type) +bool FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type) { - RS_DEBUG->print("Trying to import file '%s'...", file.toAscii().data()); + DEBUG->print("Trying to import file '%s'...", file.toAscii().data()); - RS_FilterInterface * filter = NULL; + FilterInterface * filter = NULL; RS2::FormatType t = (type == RS2::FormatUnknown ? detectFormat(file) : type); filter = getImportFilter(t); @@ -109,7 +109,7 @@ bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatT return filter->fileImport(graphic, file, t); else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_FileIO::fileImport: failed to import file: %s", + DEBUG->print(Debug::D_WARNING, "FileIO::fileImport: failed to import file: %s", file.toAscii().data()); } @@ -122,9 +122,9 @@ bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatT * * @param file Path and name of the file to import. */ -bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type) +bool FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type) { - RS_DEBUG->print("RS_FileIO::fileExport"); + DEBUG->print("FileIO::fileExport"); if (type == RS2::FormatUnknown) { @@ -136,12 +136,12 @@ bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatT type = RS2::FormatCXF; } - RS_FilterInterface * filter = getExportFilter(type); + FilterInterface * filter = getExportFilter(type); if (filter) return filter->fileExport(graphic, file, type); - RS_DEBUG->print("RS_FileIO::fileExport: no filter found"); + DEBUG->print("FileIO::fileExport: no filter found"); return false; } @@ -149,7 +149,7 @@ bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatT /** * Detects and returns the file format of the given file. */ -RS2::FormatType RS_FileIO::detectFormat(const QString & file) +RS2::FormatType FileIO::detectFormat(const QString & file) { RS2::FormatType type = RS2::FormatUnknown; QFileInfo info(file); @@ -167,13 +167,13 @@ RS2::FormatType RS_FileIO::detectFormat(const QString & file) if (!f.open(QIODevice::ReadOnly)) { // Error opening file: - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FileIO::detectFormat: Cannot open file: %s", file.toAscii().data()); + DEBUG->print(Debug::D_WARNING, + "FileIO::detectFormat: Cannot open file: %s", file.toAscii().data()); type = RS2::FormatUnknown; } else { - RS_DEBUG->print("RS_FileIO::detectFormat: Successfully opened DXF file: %s", + DEBUG->print("FileIO::detectFormat: Successfully opened DXF file: %s", file.toAscii().data()); QTextStream ts(&f); diff --git a/src/base/fileio.h b/src/base/fileio.h index a564f78..d3b90ed 100644 --- a/src/base/fileio.h +++ b/src/base/fileio.h @@ -2,12 +2,12 @@ #define __FILEIO_H__ #include -#include "rs.h" +#include "enums.h" -#define RS_FILEIO RS_FileIO::instance() +#define FILEIO FileIO::instance() class Drawing; -class RS_FilterInterface; +class FilterInterface; /** * API Class for importing files. @@ -15,17 +15,17 @@ class RS_FilterInterface; * @author James Hammons * @author Andrew Mustun */ -class RS_FileIO +class FileIO { protected: - RS_FileIO(); + FileIO(); public: - static RS_FileIO * instance(); - void registerFilter(RS_FilterInterface * f); - QList getFilterList(); - RS_FilterInterface * getImportFilter(RS2::FormatType t); - RS_FilterInterface * getExportFilter(RS2::FormatType t); + static FileIO * instance(); + void registerFilter(FilterInterface * f); + QList getFilterList(); + FilterInterface * getImportFilter(RS2::FormatType t); + FilterInterface * getExportFilter(RS2::FormatType t); bool fileImport(Drawing & graphic, const QString & file, RS2::FormatType type = RS2::FormatUnknown); bool fileExport(Drawing & graphic, const QString & file, @@ -33,8 +33,8 @@ class RS_FileIO RS2::FormatType detectFormat(const QString & file); protected: - static RS_FileIO * uniqueInstance; - QList filterList; + static FileIO * uniqueInstance; + QList filterList; }; #endif // __FILEIO_H__ diff --git a/src/base/filtercxf.cpp b/src/base/filtercxf.cpp index 31c80e7..a8c5b20 100644 --- a/src/base/filtercxf.cpp +++ b/src/base/filtercxf.cpp @@ -27,15 +27,15 @@ /** * Default constructor. */ -RS_FilterCXF::RS_FilterCXF(): RS_FilterInterface() +FilterCXF::FilterCXF(): FilterInterface() { - RS_DEBUG->print("Setting up CXF filter..."); + DEBUG->print("Setting up CXF filter..."); addImportFormat(RS2::FormatCXF); addExportFormat(RS2::FormatCXF); } -RS_FilterCXF::~RS_FilterCXF() +FilterCXF::~FilterCXF() { } @@ -47,21 +47,21 @@ 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(Drawing & g, const QString & file, RS2::FormatType /*type*/) +bool FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { - RS_DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data()); + DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data()); //this->graphic = &g; bool success = false; // Load font file as we normally do, but the font doesn't own the // letters (we'll add them to the graphic instead. Hence 'false'). - RS_Font font(file, false); + Font font(file, false); success = font.loadFont(); if (!success) { - RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data()); + DEBUG->print(Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data()); return false; } @@ -74,11 +74,11 @@ bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType if (!font.getEncoding().isEmpty()) g.addVariable("Encoding", font.getEncoding(), 0); - RS_BlockList * letterList = font.getLetterList(); + BlockList * letterList = font.getLetterList(); for(uint i=0; igetName().at(0).unicode(), 16); @@ -105,34 +105,34 @@ bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType * * @param file Full path to the CXF file that will be written. */ -bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/) +bool FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { - RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data()); + DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data()); // crashes under windoze xp: //std::ofstream fout; - RS_DEBUG->print("RS_FilterCXF::fileExport: open"); + DEBUG->print("FilterCXF::fileExport: open"); //fout.open((const char*)file.local8Bit()); FILE * fp; if ((fp = fopen((const char *)file.toLocal8Bit(), "wt")) != NULL) { - RS_DEBUG->print("RS_FilterCXF::fileExport: open: OK"); - RS_DEBUG->print("RS_FilterCXF::fileExport: header"); + DEBUG->print("FilterCXF::fileExport: open: OK"); + DEBUG->print("FilterCXF::fileExport: header"); // header: fprintf(fp, "# Format: QCad II Font\n"); - fprintf(fp, "# Creator: %s\n", (const char *)RS_SYSTEM->getAppName().toLocal8Bit()); - fprintf(fp, "# Version: %s\n", (const char *)RS_SYSTEM->getAppVersion().toLocal8Bit()); + fprintf(fp, "# Creator: %s\n", (const char *)SYSTEM->getAppName().toLocal8Bit()); + fprintf(fp, "# Version: %s\n", (const char *)SYSTEM->getAppVersion().toLocal8Bit()); - RS_DEBUG->print("001"); + DEBUG->print("001"); QString ns = g.getVariableString("Names", ""); if (!ns.isEmpty()) { QStringList names = ns.split(','); - RS_DEBUG->print("002"); + DEBUG->print("002"); for(QStringList::Iterator it=names.begin(); it!=names.end(); ++it) { @@ -140,76 +140,76 @@ bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType } } - RS_DEBUG->print("003"); + DEBUG->print("003"); QString es = g.getVariableString("Encoding", ""); if (!es.isEmpty()) fprintf(fp, "# Encoding: %s\n", (const char *)es.toLocal8Bit()); - RS_DEBUG->print("004a"); + DEBUG->print("004a"); fprintf(fp, "# LetterSpacing: %f\n", g.getVariableDouble("LetterSpacing", 3.0)); fprintf(fp, "# WordSpacing: %f\n", g.getVariableDouble("WordSpacing", 6.75)); fprintf(fp, "# LineSpacingFactor: %f\n", g.getVariableDouble("LineSpacingFactor", 1.0)); QString sa = g.getVariableString("Authors", ""); - RS_DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit()); + DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit()); if (!sa.isEmpty()) { QStringList authors = sa.split(','); - RS_DEBUG->print("006"); - RS_DEBUG->print("count: %d", authors.count()); + DEBUG->print("006"); + DEBUG->print("count: %d", authors.count()); QString a; for(QStringList::Iterator it2=authors.begin(); it2!=authors.end(); ++it2) { - RS_DEBUG->print("006a"); + DEBUG->print("006a"); a = QString(*it2); - RS_DEBUG->print("006b"); - RS_DEBUG->print("string is: %s", a.toAscii().data()); - RS_DEBUG->print("006b0"); + DEBUG->print("006b"); + DEBUG->print("string is: %s", a.toAscii().data()); + DEBUG->print("006b0"); fprintf(fp, "# Author: "); - RS_DEBUG->print("006b1"); + DEBUG->print("006b1"); fprintf(fp, "%s\n", a.toAscii().data()); //fout << "# Author: " << a.ascii() << "\n"; } - RS_DEBUG->print("007"); + DEBUG->print("007"); } - RS_DEBUG->print("RS_FilterCXF::fileExport: header: OK"); + DEBUG->print("FilterCXF::fileExport: header: OK"); - RS_DEBUG->print("008"); + DEBUG->print("008"); // iterate through blocks (=letters of font) for(uint i=0; iprint("block: %d", i); - RS_DEBUG->print("001"); + DEBUG->print("block: %d", i); + DEBUG->print("001"); if (blk != NULL) { - RS_DEBUG->print("002"); - RS_DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit())); + DEBUG->print("002"); + DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit())); fprintf(fp, "\n%s\n", (const char *)(blk->getName().toLocal8Bit())); // iterate through entities of this letter: - for(RS_Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL; + for(Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL; e=blk->nextEntity(RS2::ResolveAll)) { if (!e->isUndone()) { - RS_DEBUG->print("004"); + DEBUG->print("004"); // lines: if (e->rtti() == RS2::EntityLine) { - RS_Line * l = (RS_Line *)e; + Line * l = (Line *)e; fprintf(fp, "L %f,%f,%f,%f\n", l->getStartpoint().x, l->getStartpoint().y, l->getEndpoint().x, l->getEndpoint().y); @@ -217,7 +217,7 @@ bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType // arcs: else if (e->rtti() == RS2::EntityArc) { - RS_Arc * a = (RS_Arc *)e; + Arc * a = (Arc *)e; if (!a->isReversed()) { @@ -237,21 +237,21 @@ bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType } } - RS_DEBUG->print("005"); + DEBUG->print("005"); } - RS_DEBUG->print("006"); + DEBUG->print("006"); } - RS_DEBUG->print("007"); + DEBUG->print("007"); } //fout.close(); fclose(fp); - RS_DEBUG->print("CXF Filter: exporting file: OK"); + DEBUG->print("CXF Filter: exporting file: OK"); return true; } else { - RS_DEBUG->print("CXF Filter: exporting file failed"); + DEBUG->print("CXF Filter: exporting file failed"); } return false; @@ -262,7 +262,7 @@ bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType * * @param value A double value. e.g. 2.700000 */ -void RS_FilterCXF::stream(std::ofstream & fs, double value) +void FilterCXF::stream(std::ofstream & fs, double value) { - fs << (const char *)RS_Utility::doubleToString(value).toAscii().data(); + fs << (const char *)Utility::doubleToString(value).toAscii().data(); } diff --git a/src/base/filtercxf.h b/src/base/filtercxf.h index 973af92..e07f9f8 100644 --- a/src/base/filtercxf.h +++ b/src/base/filtercxf.h @@ -9,11 +9,11 @@ * * @author Andrew Mustun */ -class RS_FilterCXF: public RS_FilterInterface +class FilterCXF: public FilterInterface { public: - RS_FilterCXF(); - ~RS_FilterCXF(); + FilterCXF(); + ~FilterCXF(); /** * @return RS2::FormatCXF. diff --git a/src/base/filterdxf.cpp b/src/base/filterdxf.cpp index 18fb3f9..5bc1058 100644 --- a/src/base/filterdxf.cpp +++ b/src/base/filterdxf.cpp @@ -35,9 +35,9 @@ * Default constructor. * */ -RS_FilterDXF::RS_FilterDXF(): RS_FilterInterface() +FilterDXF::FilterDXF(): FilterInterface() { - RS_DEBUG->print("RS_FilterDXF::RS_FilterDXF()"); + DEBUG->print("FilterDXF::FilterDXF()"); addImportFormat(RS2::FormatDXF); addExportFormat(RS2::FormatDXF); @@ -52,16 +52,16 @@ RS_FilterDXF::RS_FilterDXF(): RS_FilterInterface() graphic = NULL; //exportVersion = DL_Codes::VER_2002; //systemVariables.setAutoDelete(true); - RS_DEBUG->print("RS_FilterDXF::RS_FilterDXF(): OK"); + DEBUG->print("FilterDXF::FilterDXF(): OK"); } /** * Destructor. */ -RS_FilterDXF::~RS_FilterDXF() +FilterDXF::~FilterDXF() { - RS_DEBUG->print("RS_FilterDXF::~RS_FilterDXF()"); - RS_DEBUG->print("RS_FilterDXF::~RS_FilterDXF(): OK"); + DEBUG->print("FilterDXF::~FilterDXF()"); + DEBUG->print("FilterDXF::~FilterDXF(): OK"); } /** @@ -72,50 +72,50 @@ 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(Drawing & g, const QString & file, RS2::FormatType /*type*/) +bool FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { - RS_DEBUG->print("RS_FilterDXF::fileImport"); - //RS_DEBUG->timestamp(); + DEBUG->print("FilterDXF::fileImport"); + //DEBUG->timestamp(); - RS_DEBUG->print("DXF Filter: importing file '%s'...", (const char *)QFile::encodeName(file)); + DEBUG->print("DXF Filter: importing file '%s'...", (const char *)QFile::encodeName(file)); graphic = &g; currentContainer = graphic; this->file = file; - RS_DEBUG->print("graphic->countLayers(): %d", graphic->countLayers()); + DEBUG->print("graphic->countLayers(): %d", graphic->countLayers()); //graphic->setAutoUpdateBorders(false); - RS_DEBUG->print("RS_FilterDXF::fileImport: reading file"); + DEBUG->print("FilterDXF::fileImport: reading file"); bool success = dxf.in((const char *)QFile::encodeName(file), this); - RS_DEBUG->print("RS_FilterDXF::fileImport: reading file: OK"); + DEBUG->print("FilterDXF::fileImport: reading file: OK"); //graphic->setAutoUpdateBorders(true); if (!success) { - RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open DXF file '%s'.", + DEBUG->print(Debug::D_WARNING, "Cannot open DXF file '%s'.", (const char *)QFile::encodeName(file)); return false; } - RS_DEBUG->print("RS_FilterDXF::fileImport: adding variables"); + DEBUG->print("FilterDXF::fileImport: adding variables"); // add some variables that need to be there for DXF drawings: if (graphic->getVariableString("$DIMSTYLE", "").isEmpty()) { - RS_DEBUG->print("RS_FilterDXF::fileImport: adding DIMSTYLE"); + DEBUG->print("FilterDXF::fileImport: adding DIMSTYLE"); graphic->addVariable("$DIMSTYLE", "Standard", 2); - RS_DEBUG->print("RS_FilterDXF::fileImport: adding DIMSTYLE: OK"); + DEBUG->print("FilterDXF::fileImport: adding DIMSTYLE: OK"); } - RS_DEBUG->print("RS_FilterDXF::fileImport: adding variables: OK"); + DEBUG->print("FilterDXF::fileImport: adding variables: OK"); - RS_DEBUG->print("RS_FilterDXF::fileImport: updating inserts"); + DEBUG->print("FilterDXF::fileImport: updating inserts"); graphic->updateInserts(); - RS_DEBUG->print("RS_FilterDXF::fileImport: updating inserts: OK"); + DEBUG->print("FilterDXF::fileImport: updating inserts: OK"); - RS_DEBUG->print("RS_FilterDXF::fileImport OK"); - //RS_DEBUG->timestamp(); + DEBUG->print("FilterDXF::fileImport OK"); + //DEBUG->timestamp(); return true; } @@ -123,17 +123,17 @@ bool RS_FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /** * Implementation of the method which handles layers. */ -void RS_FilterDXF::addLayer(const DL_LayerData& data) { - RS_DEBUG->print("RS_FilterDXF::addLayer"); - RS_DEBUG->print(" adding layer: %s", data.name.c_str()); +void FilterDXF::addLayer(const DL_LayerData& data) { + DEBUG->print("FilterDXF::addLayer"); + DEBUG->print(" adding layer: %s", data.name.c_str()); - RS_DEBUG->print("RS_FilterDXF::addLayer: creating layer"); - RS_Layer* layer = new RS_Layer(data.name.c_str()); - RS_DEBUG->print("RS_FilterDXF::addLayer: set pen"); + DEBUG->print("FilterDXF::addLayer: creating layer"); + Layer* layer = new Layer(data.name.c_str()); + DEBUG->print("FilterDXF::addLayer: set pen"); layer->setPen(attributesToPen(attributes)); //layer->setFlags(data.flags&0x07); - RS_DEBUG->print("RS_FilterDXF::addLayer: flags"); + DEBUG->print("FilterDXF::addLayer: flags"); if (data.flags&0x01) { layer->freeze(true); } @@ -141,9 +141,9 @@ void RS_FilterDXF::addLayer(const DL_LayerData& data) { layer->lock(true); } - RS_DEBUG->print("RS_FilterDXF::addLayer: add layer to graphic"); + DEBUG->print("FilterDXF::addLayer: add layer to graphic"); graphic->addLayer(layer); - RS_DEBUG->print("RS_FilterDXF::addLayer: OK"); + DEBUG->print("FilterDXF::addLayer: OK"); } /** @@ -151,10 +151,10 @@ void RS_FilterDXF::addLayer(const DL_LayerData& data) { * * @todo Adding blocks to blocks (stack for currentContainer) */ -void RS_FilterDXF::addBlock(const DL_BlockData & data) +void FilterDXF::addBlock(const DL_BlockData & data) { - RS_DEBUG->print("RS_FilterDXF::addBlock"); - RS_DEBUG->print(" adding block: %s", data.name.c_str()); + DEBUG->print("FilterDXF::addBlock"); + DEBUG->print(" adding block: %s", data.name.c_str()); // Prevent special blocks (paper_space, model_space) from being added: if (QString(data.name.c_str()).toLower() != "*paper_space0" @@ -168,7 +168,7 @@ void RS_FilterDXF::addBlock(const DL_BlockData & data) #ifndef RS_NO_COMPLEX_ENTITIES if (QString(data.name.c_str()).startsWith("__CE")) { - RS_EntityContainer * ec = new RS_EntityContainer(); + EntityContainer * ec = new EntityContainer(); ec->setLayer("0"); currentContainer = ec; graphic->addEntity(ec); @@ -178,7 +178,7 @@ void RS_FilterDXF::addBlock(const DL_BlockData & data) { #endif Vector bp(data.bpx, data.bpy); - RS_Block * block = new RS_Block(graphic, RS_BlockData(data.name.c_str(), bp, false)); + Block * block = new Block(graphic, BlockData(data.name.c_str(), bp, false)); //block->setFlags(flags); if (graphic->addBlock(block)) @@ -192,7 +192,7 @@ void RS_FilterDXF::addBlock(const DL_BlockData & data) /** * Implementation of the method which closes blocks. */ -void RS_FilterDXF::endBlock() +void FilterDXF::endBlock() { currentContainer = graphic; } @@ -200,10 +200,10 @@ void RS_FilterDXF::endBlock() /** * Implementation of the method which handles point entities. */ -void RS_FilterDXF::addPoint(const DL_PointData & data) +void FilterDXF::addPoint(const DL_PointData & data) { Vector v(data.x, data.y); - RS_Point * entity = new RS_Point(currentContainer, RS_PointData(v)); + Point * entity = new Point(currentContainer, PointData(v)); setEntityAttributes(entity, attributes); currentContainer->addEntity(entity); } @@ -211,27 +211,27 @@ void RS_FilterDXF::addPoint(const DL_PointData & data) /** * Implementation of the method which handles line entities. */ -void RS_FilterDXF::addLine(const DL_LineData & data) +void FilterDXF::addLine(const DL_LineData & data) { - RS_DEBUG->print("RS_FilterDXF::addLine"); + DEBUG->print("FilterDXF::addLine"); Vector v1(data.x1, data.y1); Vector v2(data.x2, data.y2); - RS_DEBUG->print("RS_FilterDXF::addLine: create line"); + DEBUG->print("FilterDXF::addLine: create line"); if (currentContainer == NULL) - RS_DEBUG->print("RS_FilterDXF::addLine: currentContainer is NULL"); + DEBUG->print("FilterDXF::addLine: currentContainer is NULL"); - RS_Line * entity = new RS_Line(currentContainer, RS_LineData(v1, v2)); - RS_DEBUG->print("RS_FilterDXF::addLine: set attributes"); + Line * entity = new Line(currentContainer, LineData(v1, v2)); + DEBUG->print("FilterDXF::addLine: set attributes"); setEntityAttributes(entity, attributes); - RS_DEBUG->print("RS_FilterDXF::addLine: add entity"); + DEBUG->print("FilterDXF::addLine: add entity"); currentContainer->addEntity(entity); - RS_DEBUG->print("RS_FilterDXF::addLine: OK"); + DEBUG->print("FilterDXF::addLine: OK"); } /** @@ -240,17 +240,17 @@ void RS_FilterDXF::addLine(const DL_LineData & data) * @param angle1 Start angle in deg (!) * @param angle2 End angle in deg (!) */ -void RS_FilterDXF::addArc(const DL_ArcData& data) { - RS_DEBUG->print("RS_FilterDXF::addArc"); +void FilterDXF::addArc(const DL_ArcData& data) { + DEBUG->print("FilterDXF::addArc"); //printf("LINE (%12.6f, %12.6f, %12.6f) (%12.6f, %12.6f, %12.6f)\n", // p1[0], p1[1], p1[2], // p2[0], p2[1], p2[2]); Vector v(data.cx, data.cy); - RS_ArcData d(v, data.radius, + ArcData d(v, data.radius, data.angle1/ARAD, data.angle2/ARAD, false); - RS_Arc* entity = new RS_Arc(currentContainer, d); + Arc* entity = new Arc(currentContainer, d); setEntityAttributes(entity, attributes); currentContainer->addEntity(entity); @@ -264,18 +264,18 @@ void RS_FilterDXF::addArc(const DL_ArcData& data) { * @param angle1 Start angle in rad (!) * @param angle2 End angle in rad (!) */ -void RS_FilterDXF::addEllipse(const DL_EllipseData& data) { - RS_DEBUG->print("RS_FilterDXF::addEllipse"); +void FilterDXF::addEllipse(const DL_EllipseData& data) { + DEBUG->print("FilterDXF::addEllipse"); Vector v1(data.cx, data.cy); Vector v2(data.mx, data.my); - RS_EllipseData ed(v1, v2, + EllipseData ed(v1, v2, data.ratio, data.angle1, data.angle2, false); - RS_Ellipse* entity = new RS_Ellipse(currentContainer, ed); + Ellipse* entity = new Ellipse(currentContainer, ed); setEntityAttributes(entity, attributes); currentContainer->addEntity(entity); @@ -286,15 +286,15 @@ void RS_FilterDXF::addEllipse(const DL_EllipseData& data) { /** * Implementation of the method which handles circle entities. */ -void RS_FilterDXF::addCircle(const DL_CircleData& data) { - RS_DEBUG->print("RS_FilterDXF::addCircle"); +void FilterDXF::addCircle(const DL_CircleData& data) { + DEBUG->print("FilterDXF::addCircle"); //printf("LINE (%12.6f, %12.6f, %12.6f) (%12.6f, %12.6f, %12.6f)\n", // p1[0], p1[1], p1[2], // p2[0], p2[1], p2[2]); Vector v(data.cx, data.cy); - RS_CircleData d(v, data.radius); - RS_Circle* entity = new RS_Circle(currentContainer, d); + CircleData d(v, data.radius); + Circle* entity = new Circle(currentContainer, d); setEntityAttributes(entity, attributes); currentContainer->addEntity(entity); @@ -305,13 +305,13 @@ void RS_FilterDXF::addCircle(const DL_CircleData& data) { /** * Implementation of the method which handles polyline entities. */ -void RS_FilterDXF::addPolyline(const DL_PolylineData& data) { - RS_DEBUG->print("RS_FilterDXF::addPolyline"); - //RS_DEBUG->print("RS_FilterDXF::addPolyline()"); - RS_PolylineData d(Vector(false), +void FilterDXF::addPolyline(const DL_PolylineData& data) { + DEBUG->print("FilterDXF::addPolyline"); + //DEBUG->print("FilterDXF::addPolyline()"); + PolylineData d(Vector(false), Vector(false), data.flags&0x1); - polyline = new RS_Polyline(currentContainer, d); + polyline = new Polyline(currentContainer, d); setEntityAttributes(polyline, attributes); currentContainer->addEntity(polyline); @@ -322,8 +322,8 @@ void RS_FilterDXF::addPolyline(const DL_PolylineData& data) { /** * Implementation of the method which handles polyline vertices. */ -void RS_FilterDXF::addVertex(const DL_VertexData& data) { - RS_DEBUG->print("RS_FilterDXF::addVertex(): %f/%f bulge: %f", +void FilterDXF::addVertex(const DL_VertexData& data) { + DEBUG->print("FilterDXF::addVertex(): %f/%f bulge: %f", data.x, data.y, data.bulge); Vector v(data.x, data.y); @@ -338,32 +338,32 @@ void RS_FilterDXF::addVertex(const DL_VertexData& data) { /** * Implementation of the method which handles splines. */ -void RS_FilterDXF::addSpline(const DL_SplineData& data) { - RS_DEBUG->print("RS_FilterDXF::addSpline: degree: %d", data.degree); +void FilterDXF::addSpline(const DL_SplineData& data) { + DEBUG->print("FilterDXF::addSpline: degree: %d", data.degree); if (data.degree>=1 && data.degree<=3) { - RS_SplineData d(data.degree, ((data.flags&0x1)==0x1)); - spline = new RS_Spline(currentContainer, d); + SplineData d(data.degree, ((data.flags&0x1)==0x1)); + spline = new Spline(currentContainer, d); setEntityAttributes(spline, attributes); currentContainer->addEntity(spline); } else { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FilterDXF::addSpline: Invalid degree for spline: %d. " + DEBUG->print(Debug::D_WARNING, + "FilterDXF::addSpline: Invalid degree for spline: %d. " "Accepted values are 1..3.", data.degree); } } -/*virtual*/ void RS_FilterDXF::addKnot(const DL_KnotData &) +/*virtual*/ void FilterDXF::addKnot(const DL_KnotData &) { } /** * Implementation of the method which handles spline control points. */ -void RS_FilterDXF::addControlPoint(const DL_ControlPointData & data) +void FilterDXF::addControlPoint(const DL_ControlPointData & data) { - RS_DEBUG->print("RS_FilterDXF::addControlPoint: %f/%f", data.x, data.y); + DEBUG->print("FilterDXF::addControlPoint: %f/%f", data.x, data.y); Vector v(data.x, data.y); @@ -377,9 +377,9 @@ void RS_FilterDXF::addControlPoint(const DL_ControlPointData & data) /** * Implementation of the method which handles inserts. */ -void RS_FilterDXF::addInsert(const DL_InsertData & data) +void FilterDXF::addInsert(const DL_InsertData & data) { - RS_DEBUG->print("RS_FilterDXF::addInsert"); + DEBUG->print("FilterDXF::addInsert"); if (QString(data.name.c_str()).left(3) == "A$C") return; @@ -390,20 +390,20 @@ void RS_FilterDXF::addInsert(const DL_InsertData & data) //cout << "Insert: " << name << " " << ip << " " << cols << "/" << rows << endl; - RS_InsertData d(data.name.c_str(), ip, sc, data.angle / ARAD, data.cols, data.rows, + InsertData d(data.name.c_str(), ip, sc, data.angle / ARAD, data.cols, data.rows, sp, NULL, RS2::NoUpdate); - RS_Insert * entity = new RS_Insert(currentContainer, d); + Insert * entity = new Insert(currentContainer, d); setEntityAttributes(entity, attributes); - RS_DEBUG->print(" id: %d", entity->getId()); + DEBUG->print(" id: %d", entity->getId()); //entity->update(); currentContainer->addEntity(entity); } -/*virtual*/ void RS_FilterDXF::addTrace(const DL_TraceData &) +/*virtual*/ void FilterDXF::addTrace(const DL_TraceData &) { } -/*virtual*/ void RS_FilterDXF::addSolid(const DL_SolidData &) +/*virtual*/ void FilterDXF::addSolid(const DL_SolidData &) { } @@ -411,15 +411,15 @@ void RS_FilterDXF::addInsert(const DL_InsertData & data) * Implementation of the method which handles text * chunks for MText entities. */ -void RS_FilterDXF::addMTextChunk(const char * text) +void FilterDXF::addMTextChunk(const char * text) { - RS_DEBUG->print("RS_FilterDXF::addMTextChunk: %s", text); + DEBUG->print("FilterDXF::addMTextChunk: %s", text); //mtext += text; //mtext += QString::fromUtf8(text); /* QCString locallyEncoded = text; - QString enc = RS_System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252")); + QString enc = System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252")); QTextCodec *codec = QTextCodec::codecForName(enc); // get the codec for Japanese if (codec!=NULL) { mtext += codec->toUnicode(toNativeString(locallyEncoded)); @@ -434,9 +434,9 @@ void RS_FilterDXF::addMTextChunk(const char * text) * Implementation of the method which handles * multi texts (MTEXT). */ -void RS_FilterDXF::addMText(const DL_MTextData & data) +void FilterDXF::addMText(const DL_MTextData & data) { - RS_DEBUG->print("RS_FilterDXF::addMText: %s", data.text.c_str()); + DEBUG->print("FilterDXF::addMText: %s", data.text.c_str()); Vector ip(data.ipx, data.ipy); RS2::VAlign valign; @@ -474,7 +474,7 @@ void RS_FilterDXF::addMText(const DL_MTextData & data) mtext += QString(data.text.c_str()); QString locallyEncoded = mtext; - QString enc = RS_System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252")); + QString enc = System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252")); // get the codec for Japanese QTextCodec * codec = QTextCodec::codecForName(enc.toAscii()); @@ -495,12 +495,12 @@ void RS_FilterDXF::addMText(const DL_MTextData & data) sty = variables.getString("$TEXTSTYLE", "Standard"); } - RS_DEBUG->print("Text as unicode:"); - RS_DEBUG->printUnicode(mtext); + DEBUG->print("Text as unicode:"); + DEBUG->printUnicode(mtext); - RS_TextData d(ip, data.height, data.width, valign, halign, dir, lss, + TextData d(ip, data.height, data.width, valign, halign, dir, lss, data.lineSpacingFactor, mtext, sty, data.angle, RS2::NoUpdate); - RS_Text * entity = new RS_Text(currentContainer, d); + Text * entity = new Text(currentContainer, d); setEntityAttributes(entity, attributes); entity->update(); @@ -515,8 +515,8 @@ void RS_FilterDXF::addMText(const DL_MTextData & data) * Implementation of the method which handles * texts (TEXT). */ -void RS_FilterDXF::addText(const DL_TextData& data) { - RS_DEBUG->print("RS_FilterDXF::addText"); +void FilterDXF::addText(const DL_TextData& data) { + DEBUG->print("FilterDXF::addText"); int attachmentPoint; Vector refPoint; double angle = data.angle; @@ -604,7 +604,7 @@ void RS_FilterDXF::addText(const DL_TextData& data) { * Implementation of the method which handles * dimensions (DIMENSION). */ -RS_DimensionData RS_FilterDXF::convDimensionData( +DimensionData FilterDXF::convDimensionData( const DL_DimensionData& data) { Vector defP(data.dpx, data.dpy); @@ -650,11 +650,11 @@ RS_DimensionData RS_FilterDXF::convDimensionData( sty = variables.getString("$DIMSTYLE", "Standard"); } - RS_DEBUG->print("Text as unicode:"); - RS_DEBUG->printUnicode(t); + DEBUG->print("Text as unicode:"); + DEBUG->printUnicode(t); // data needed to add the actual dimension entity - return RS_DimensionData(defP, midP, + return DimensionData(defP, midP, valign, halign, lss, data.lineSpacingFactor, @@ -667,18 +667,18 @@ RS_DimensionData RS_FilterDXF::convDimensionData( * Implementation of the method which handles * aligned dimensions (DIMENSION). */ -void RS_FilterDXF::addDimAlign(const DL_DimensionData& data, +void FilterDXF::addDimAlign(const DL_DimensionData& data, const DL_DimAlignedData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimAligned"); + DEBUG->print("FilterDXF::addDimAligned"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector ext1(edata.epx1, edata.epy1); Vector ext2(edata.epx2, edata.epy2); - RS_DimAlignedData d(ext1, ext2); + DimAlignedData d(ext1, ext2); - RS_DimAligned* entity = new RS_DimAligned(currentContainer, + DimAligned* entity = new DimAligned(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); entity->update(); @@ -691,19 +691,19 @@ void RS_FilterDXF::addDimAlign(const DL_DimensionData& data, * Implementation of the method which handles * linear dimensions (DIMENSION). */ -void RS_FilterDXF::addDimLinear(const DL_DimensionData& data, +void FilterDXF::addDimLinear(const DL_DimensionData& data, const DL_DimLinearData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimLinear"); + DEBUG->print("FilterDXF::addDimLinear"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector dxt1(edata.dpx1, edata.dpy1); Vector dxt2(edata.dpx2, edata.dpy2); - RS_DimLinearData d(dxt1, dxt2, RS_Math::deg2rad(edata.angle), - RS_Math::deg2rad(edata.oblique)); + DimLinearData d(dxt1, dxt2, Math::deg2rad(edata.angle), + Math::deg2rad(edata.oblique)); - RS_DimLinear* entity = new RS_DimLinear(currentContainer, + DimLinear* entity = new DimLinear(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); entity->update(); @@ -716,16 +716,16 @@ void RS_FilterDXF::addDimLinear(const DL_DimensionData& data, * Implementation of the method which handles * radial dimensions (DIMENSION). */ -void RS_FilterDXF::addDimRadial(const DL_DimensionData& data, +void FilterDXF::addDimRadial(const DL_DimensionData& data, const DL_DimRadialData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimRadial"); + DEBUG->print("FilterDXF::addDimRadial"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector dp(edata.dpx, edata.dpy); - RS_DimRadialData d(dp, edata.leader); + DimRadialData d(dp, edata.leader); - RS_DimRadial* entity = new RS_DimRadial(currentContainer, + DimRadial* entity = new DimRadial(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); @@ -739,16 +739,16 @@ void RS_FilterDXF::addDimRadial(const DL_DimensionData& data, * Implementation of the method which handles * diametric dimensions (DIMENSION). */ -void RS_FilterDXF::addDimDiametric(const DL_DimensionData& data, +void FilterDXF::addDimDiametric(const DL_DimensionData& data, const DL_DimDiametricData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimDiametric"); + DEBUG->print("FilterDXF::addDimDiametric"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector dp(edata.dpx, edata.dpy); - RS_DimDiametricData d(dp, edata.leader); + DimDiametricData d(dp, edata.leader); - RS_DimDiametric* entity = new RS_DimDiametric(currentContainer, + DimDiametric* entity = new DimDiametric(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); @@ -762,19 +762,19 @@ void RS_FilterDXF::addDimDiametric(const DL_DimensionData& data, * Implementation of the method which handles * angular dimensions (DIMENSION). */ -void RS_FilterDXF::addDimAngular(const DL_DimensionData& data, +void FilterDXF::addDimAngular(const DL_DimensionData& data, const DL_DimAngularData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimAngular"); + DEBUG->print("FilterDXF::addDimAngular"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector dp1(edata.dpx1, edata.dpy1); Vector dp2(edata.dpx2, edata.dpy2); Vector dp3(edata.dpx3, edata.dpy3); Vector dp4(edata.dpx4, edata.dpy4); - RS_DimAngularData d(dp1, dp2, dp3, dp4); + DimAngularData d(dp1, dp2, dp3, dp4); - RS_DimAngular* entity = new RS_DimAngular(currentContainer, + DimAngular* entity = new DimAngular(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); @@ -788,20 +788,20 @@ void RS_FilterDXF::addDimAngular(const DL_DimensionData& data, * Implementation of the method which handles * angular dimensions (DIMENSION). */ -void RS_FilterDXF::addDimAngular3P(const DL_DimensionData& data, +void FilterDXF::addDimAngular3P(const DL_DimensionData& data, const DL_DimAngular3PData& edata) { - RS_DEBUG->print("RS_FilterDXF::addDimAngular3P"); + DEBUG->print("FilterDXF::addDimAngular3P"); - RS_DimensionData dimensionData = convDimensionData(data); + DimensionData dimensionData = convDimensionData(data); Vector dp1(edata.dpx3, edata.dpy3); Vector dp2(edata.dpx1, edata.dpy1); Vector dp3(edata.dpx3, edata.dpy3); Vector dp4 = dimensionData.definitionPoint; dimensionData.definitionPoint = Vector(edata.dpx2, edata.dpy2); - RS_DimAngularData d(dp1, dp2, dp3, dp4); + DimAngularData d(dp1, dp2, dp3, dp4); - RS_DimAngular* entity = new RS_DimAngular(currentContainer, + DimAngular* entity = new DimAngular(currentContainer, dimensionData, d); setEntityAttributes(entity, attributes); @@ -814,11 +814,11 @@ void RS_FilterDXF::addDimAngular3P(const DL_DimensionData& data, /** * Implementation of the method which handles leader entities. */ -void RS_FilterDXF::addLeader(const DL_LeaderData& data) { - RS_DEBUG->print("RS_FilterDXF::addDimLeader"); - //RS_DEBUG->print("RS_FilterDXF::addPolyline()"); - RS_LeaderData d(data.arrowHeadFlag==1); - leader = new RS_Leader(currentContainer, d); +void FilterDXF::addLeader(const DL_LeaderData& data) { + DEBUG->print("FilterDXF::addDimLeader"); + //DEBUG->print("FilterDXF::addPolyline()"); + LeaderData d(data.arrowHeadFlag==1); + leader = new Leader(currentContainer, d); setEntityAttributes(leader, attributes); currentContainer->addEntity(leader); @@ -829,9 +829,9 @@ void RS_FilterDXF::addLeader(const DL_LeaderData& data) { /** * Implementation of the method which handles leader vertices. */ -void RS_FilterDXF::addLeaderVertex(const DL_LeaderVertexData& data) { - RS_DEBUG->print("RS_FilterDXF::addLeaderVertex"); - //RS_DEBUG->print("RS_FilterDXF::addVertex() bulge: %f", bulge); +void FilterDXF::addLeaderVertex(const DL_LeaderVertexData& data) { + DEBUG->print("FilterDXF::addLeaderVertex"); + //DEBUG->print("FilterDXF::addVertex() bulge: %f", bulge); Vector v(data.x, data.y); @@ -845,11 +845,11 @@ void RS_FilterDXF::addLeaderVertex(const DL_LeaderVertexData& data) { /** * Implementation of the method which handles hatch entities. */ -void RS_FilterDXF::addHatch(const DL_HatchData& data) { - RS_DEBUG->print("RS_FilterDXF::addHatch()"); +void FilterDXF::addHatch(const DL_HatchData& data) { + DEBUG->print("FilterDXF::addHatch()"); - hatch = new RS_Hatch(currentContainer, - RS_HatchData(data.solid, + hatch = new Hatch(currentContainer, + HatchData(data.solid, data.scale, data.angle, QString(data.pattern.c_str()))); @@ -863,10 +863,10 @@ void RS_FilterDXF::addHatch(const DL_HatchData& data) { /** * Implementation of the method which handles hatch loops. */ -void RS_FilterDXF::addHatchLoop(const DL_HatchLoopData& /*data*/) { - RS_DEBUG->print("RS_FilterDXF::addHatchLoop()"); +void FilterDXF::addHatchLoop(const DL_HatchLoopData& /*data*/) { + DEBUG->print("FilterDXF::addHatchLoop()"); if (hatch!=NULL) { - hatchLoop = new RS_EntityContainer(hatch); + hatchLoop = new EntityContainer(hatch); hatchLoop->setLayer(NULL); hatch->addEntity(hatchLoop); } @@ -877,41 +877,41 @@ void RS_FilterDXF::addHatchLoop(const DL_HatchLoopData& /*data*/) { /** * Implementation of the method which handles hatch edge entities. */ -void RS_FilterDXF::addHatchEdge(const DL_HatchEdgeData& data) { - RS_DEBUG->print("RS_FilterDXF::addHatchEdge()"); +void FilterDXF::addHatchEdge(const DL_HatchEdgeData& data) { + DEBUG->print("FilterDXF::addHatchEdge()"); if (hatchLoop!=NULL) { - RS_Entity* e = NULL; + Entity* e = NULL; switch (data.type) { case 1: - RS_DEBUG->print("RS_FilterDXF::addHatchEdge(): " + DEBUG->print("FilterDXF::addHatchEdge(): " "line: %f,%f %f,%f", data.x1, data.y1, data.x2, data.y2); - e = new RS_Line(hatchLoop, - RS_LineData(Vector(data.x1, data.y1), + e = new Line(hatchLoop, + LineData(Vector(data.x1, data.y1), Vector(data.x2, data.y2))); break; case 2: if (data.ccw && data.angle1<1.0e-6 && data.angle2>2*M_PI-1.0e-6) { - e = new RS_Circle(hatchLoop, - RS_CircleData(Vector(data.cx, data.cy), + e = new Circle(hatchLoop, + CircleData(Vector(data.cx, data.cy), data.radius)); } else { if (data.ccw) { - e = new RS_Arc( + e = new Arc( hatchLoop, - RS_ArcData(Vector(data.cx, data.cy), + ArcData(Vector(data.cx, data.cy), data.radius, - RS_Math::correctAngle(data.angle1), - RS_Math::correctAngle(data.angle2), + Math::correctAngle(data.angle1), + Math::correctAngle(data.angle2), false)); } else { - e = new RS_Arc( + e = new Arc( hatchLoop, - RS_ArcData(Vector(data.cx, data.cy), + ArcData(Vector(data.cx, data.cy), data.radius, - RS_Math::correctAngle(2*M_PI-data.angle1), - RS_Math::correctAngle(2*M_PI-data.angle2), + Math::correctAngle(2*M_PI-data.angle1), + Math::correctAngle(2*M_PI-data.angle2), true)); } } @@ -932,18 +932,18 @@ void RS_FilterDXF::addHatchEdge(const DL_HatchEdgeData& data) { /** * Implementation of the method which handles image entities. */ -void RS_FilterDXF::addImage(const DL_ImageData& data) { - RS_DEBUG->print("RS_FilterDXF::addImage"); +void FilterDXF::addImage(const DL_ImageData& data) { + DEBUG->print("FilterDXF::addImage"); Vector ip(data.ipx, data.ipy); Vector uv(data.ux, data.uy); Vector vv(data.vx, data.vy); Vector size(data.width, data.height); - RS_Image* image = - new RS_Image( + Image* image = + new Image( currentContainer, - RS_ImageData(QString(data.ref.c_str()).toInt(NULL, 16), + ImageData(QString(data.ref.c_str()).toInt(NULL, 16), ip, uv, vv, size, QString(""), @@ -958,9 +958,9 @@ void RS_FilterDXF::addImage(const DL_ImageData& data) { /** * Implementation of the method which links image entities to image files. */ -void RS_FilterDXF::linkImage(const DL_ImageDefData & data) +void FilterDXF::linkImage(const DL_ImageDefData & data) { - RS_DEBUG->print("RS_FilterDXF::linkImage"); + DEBUG->print("FilterDXF::linkImage"); int handle = QString(data.ref.c_str()).toInt(NULL, 16); QString sfile(data.file.c_str()); @@ -972,7 +972,7 @@ void RS_FilterDXF::linkImage(const DL_ImageDefData & data) // first: absolute path: if (!fiBitmap.exists()) { - RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(sfile)); + DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(sfile)); // try relative path: // QString f1 = fiDxf.dirPath(true) + "/" + sfile; QString f1 = fiDxf.absolutePath() + "/" + sfile; @@ -981,7 +981,7 @@ void RS_FilterDXF::linkImage(const DL_ImageDefData & data) sfile = f1; else { - RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f1)); + DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f1)); // try drawing path: // QString f2 = fiDxf.dirPath(true) + "/" + fiBitmap.fileName(); QString f2 = fiDxf.absolutePath() + "/" + fiBitmap.fileName(); @@ -992,23 +992,23 @@ void RS_FilterDXF::linkImage(const DL_ImageDefData & data) } else { - RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f2)); + DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f2)); } } } // Also link images in subcontainers (e.g. inserts): - for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; + for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; e=graphic->nextEntity(RS2::ResolveNone)) { if (e->rtti() == RS2::EntityImage) { - RS_Image * img = (RS_Image *)e; + Image * img = (Image *)e; if (img->getHandle() == handle) { img->setFile(sfile); - RS_DEBUG->print("image found: %s", (const char *)QFile::encodeName(img->getFile())); + DEBUG->print("image found: %s", (const char *)QFile::encodeName(img->getFile())); img->update(); } } @@ -1017,18 +1017,18 @@ void RS_FilterDXF::linkImage(const DL_ImageDefData & data) // update images in blocks: for(uint i=0; icountBlocks(); ++i) { - RS_Block * b = graphic->blockAt(i); + Block * b = graphic->blockAt(i); - for(RS_Entity * e=b->firstEntity(RS2::ResolveNone); e!=NULL; e=b->nextEntity(RS2::ResolveNone)) + for(Entity * e=b->firstEntity(RS2::ResolveNone); e!=NULL; e=b->nextEntity(RS2::ResolveNone)) { if (e->rtti() == RS2::EntityImage) { - RS_Image * img = (RS_Image *)e; + Image * img = (Image *)e; if (img->getHandle() == handle) { img->setFile(sfile); - RS_DEBUG->print("image in block found: %s", + DEBUG->print("image in block found: %s", (const char*)QFile::encodeName(img->getFile())); img->update(); } @@ -1036,42 +1036,42 @@ void RS_FilterDXF::linkImage(const DL_ImageDefData & data) } } - RS_DEBUG->print("linking image: OK"); + DEBUG->print("linking image: OK"); } /** * Finishes a hatch entity. */ -void RS_FilterDXF::endEntity() +void FilterDXF::endEntity() { - RS_DEBUG->print("RS_FilterDXF::endEntity"); + DEBUG->print("FilterDXF::endEntity"); if (hatch != NULL) { - RS_DEBUG->print("hatch->update()"); + DEBUG->print("hatch->update()"); if (hatch->validate()) hatch->update(); else { graphic->removeEntity(hatch); - RS_DEBUG->print(RS_Debug::D_ERROR, "RS_FilterDXF::endEntity(): updating hatch failed: invalid hatch area"); + DEBUG->print(Debug::D_ERROR, "FilterDXF::endEntity(): updating hatch failed: invalid hatch area"); } hatch = NULL; } } -/*virtual*/ void RS_FilterDXF::endSequence() +/*virtual*/ void FilterDXF::endSequence() { } /** * Sets a vector variable from the DXF file. */ -void RS_FilterDXF::setVariableVector(const char * key, double v1, double v2, double v3, int code) +void FilterDXF::setVariableVector(const char * key, double v1, double v2, double v3, int code) { - RS_DEBUG->print("RS_FilterDXF::setVariableVector"); + DEBUG->print("FilterDXF::setVariableVector"); // update document's variable list: if (currentContainer->rtti() == RS2::EntityGraphic) @@ -1081,9 +1081,9 @@ void RS_FilterDXF::setVariableVector(const char * key, double v1, double v2, dou /** * Sets a string variable from the DXF file. */ -void RS_FilterDXF::setVariableString(const char * key, const char * value, int code) +void FilterDXF::setVariableString(const char * key, const char * value, int code) { - RS_DEBUG->print("RS_FilterDXF::setVariableString"); + DEBUG->print("FilterDXF::setVariableString"); // update local DXF variable list: variables.add(QString(key), QString(value), code); @@ -1100,8 +1100,8 @@ void RS_FilterDXF::setVariableString(const char * key, const char * value, int c /** * Sets an int variable from the DXF file. */ -void RS_FilterDXF::setVariableInt(const char* key, int value, int code) { - RS_DEBUG->print("RS_FilterDXF::setVariableInt"); +void FilterDXF::setVariableInt(const char* key, int value, int code) { + DEBUG->print("FilterDXF::setVariableInt"); // update document's variable list: if (currentContainer->rtti()==RS2::EntityGraphic) { @@ -1115,8 +1115,8 @@ void RS_FilterDXF::setVariableInt(const char* key, int value, int code) { /** * Sets a double variable from the DXF file. */ -void RS_FilterDXF::setVariableDouble(const char* key, double value, int code) { - RS_DEBUG->print("RS_FilterDXF::setVariableDouble"); +void FilterDXF::setVariableDouble(const char* key, double value, int code) { + DEBUG->print("FilterDXF::setVariableDouble"); // update document's variable list: if (currentContainer->rtti() == RS2::EntityGraphic) @@ -1131,11 +1131,11 @@ 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(Drawing & g, const QString & file, RS2::FormatType type) +bool FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType type) { - RS_DEBUG->print("RS_FilterDXF::fileExport: exporting file '%s'...", + DEBUG->print("FilterDXF::fileExport: exporting file '%s'...", (const char *)QFile::encodeName(file)); - RS_DEBUG->print("RS_FilterDXF::fileExport: file type '%d'", (int)type); + DEBUG->print("FilterDXF::fileExport: file type '%d'", (int)type); this->graphic = &g; @@ -1146,7 +1146,7 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType if (QFileInfo(path).isWritable() == false) { - RS_DEBUG->print("RS_FilterDXF::fileExport: can't write file: no permission"); + DEBUG->print("FilterDXF::fileExport: can't write file: no permission"); return false; } // @@ -1169,27 +1169,27 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType if (dw == NULL) { - RS_DEBUG->print("RS_FilterDXF::fileExport: can't write file"); + DEBUG->print("FilterDXF::fileExport: can't write file"); return false; } // Header - RS_DEBUG->print("writing headers..."); + DEBUG->print("writing headers..."); dxf.writeHeader(*dw); // Variables - RS_DEBUG->print("writing variables..."); + DEBUG->print("writing variables..."); writeVariables(*dw); // Section TABLES - RS_DEBUG->print("writing tables..."); + DEBUG->print("writing tables..."); dw->sectionTables(); // VPORT: dxf.writeVPort(*dw); // Line types: - RS_DEBUG->print("writing line types..."); + DEBUG->print("writing line types..."); int numLT = (int)RS2::BorderLineX2 - (int)RS2::LineByBlock; if (type == RS2::FormatDXF12) @@ -1206,37 +1206,37 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType dw->tableEnd(); // Layers: - RS_DEBUG->print("writing layers..."); + DEBUG->print("writing layers..."); dw->tableLayers(graphic->countLayers()); for(uint i=0; icountLayers(); ++i) { - RS_Layer * l = graphic->layerAt(i); + Layer * l = graphic->layerAt(i); writeLayer(*dw, l); } dw->tableEnd(); // STYLE: - RS_DEBUG->print("writing styles..."); + DEBUG->print("writing styles..."); dxf.writeStyle(*dw); // VIEW: - RS_DEBUG->print("writing views..."); + DEBUG->print("writing views..."); dxf.writeView(*dw); // UCS: - RS_DEBUG->print("writing ucs..."); + DEBUG->print("writing ucs..."); dxf.writeUcs(*dw); // Appid: - RS_DEBUG->print("writing appid..."); + DEBUG->print("writing appid..."); dw->tableAppid(1); writeAppid(*dw, "ACAD"); dw->tableEnd(); // DIMSTYLE: - RS_DEBUG->print("writing dim styles..."); + DEBUG->print("writing dim styles..."); dxf.writeDimStyle(*dw, graphic->getVariableDouble("$DIMASZ", 2.5), graphic->getVariableDouble("$DIMEXE", 1.25), @@ -1247,12 +1247,12 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType // BLOCK_RECORD: if (type == RS2::FormatDXF) { - RS_DEBUG->print("writing block records..."); + DEBUG->print("writing block records..."); dxf.writeBlockRecord(*dw); for(uint i=0; icountBlocks(); ++i) { - RS_Block * blk = graphic->blockAt(i); + Block * blk = graphic->blockAt(i); dxf.writeBlockRecord(*dw, std::string((const char *)blk->getName().toLocal8Bit())); /* // v2.0.4.9..: @@ -1272,26 +1272,26 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType } // end of tables: - RS_DEBUG->print("writing end of section TABLES..."); + DEBUG->print("writing end of section TABLES..."); dw->sectionEnd(); // Section BLOCKS: - RS_DEBUG->print("writing blocks..."); + DEBUG->print("writing blocks..."); dw->sectionBlocks(); if (type == RS2::FormatDXF) { - RS_Block b1(graphic, RS_BlockData("*Model_Space", Vector(0.0, 0.0), false)); + Block b1(graphic, BlockData("*Model_Space", Vector(0.0, 0.0), false)); writeBlock(*dw, &b1); - RS_Block b2(graphic, RS_BlockData("*Paper_Space", Vector(0.0, 0.0), false)); + Block b2(graphic, BlockData("*Paper_Space", Vector(0.0, 0.0), false)); writeBlock(*dw, &b2); - RS_Block b3(graphic, RS_BlockData("*Paper_Space0", Vector(0.0, 0.0), false)); + Block b3(graphic, BlockData("*Paper_Space0", Vector(0.0, 0.0), false)); writeBlock(*dw, &b3); } for(uint i=0; icountBlocks(); ++i) { - RS_Block * blk = graphic->blockAt(i); + Block * blk = graphic->blockAt(i); // Save block if it's not a model or paper space: // Careful: other blocks with * / $ exist @@ -1304,21 +1304,21 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType dw->sectionEnd(); // Section ENTITIES: - RS_DEBUG->print("writing section ENTITIES..."); + DEBUG->print("writing section ENTITIES..."); dw->sectionEntities(); - for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; + for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; e=graphic->nextEntity(RS2::ResolveNone)) { writeEntity(*dw, e); } - RS_DEBUG->print("writing end of section ENTITIES..."); + DEBUG->print("writing end of section ENTITIES..."); dw->sectionEnd(); if (type == RS2::FormatDXF) { - RS_DEBUG->print("writing section OBJECTS..."); + DEBUG->print("writing section OBJECTS..."); dxf.writeObjects(*dw); // IMAGEDEF's from images in entities and images in blocks @@ -1326,14 +1326,14 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType for(uint i=0; icountBlocks(); ++i) { - RS_Block * block = graphic->blockAt(i); + Block * block = graphic->blockAt(i); - for(RS_Entity * e=block->firstEntity(RS2::ResolveAll); e!=NULL; + for(Entity * e=block->firstEntity(RS2::ResolveAll); e!=NULL; e=block->nextEntity(RS2::ResolveAll)) { if (e->rtti() == RS2::EntityImage) { - RS_Image * img = ((RS_Image *)e); + Image * img = ((Image *)e); if (written.contains(file) == 0 && img->getHandle() != 0) { @@ -1344,12 +1344,12 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType } } - for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; + for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL; e=graphic->nextEntity(RS2::ResolveNone)) { if (e->rtti() == RS2::EntityImage) { - RS_Image * img = ((RS_Image *)e); + Image * img = ((Image *)e); if (written.contains(file) == 0 && img->getHandle() != 0) { @@ -1358,14 +1358,14 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType } } } - RS_DEBUG->print("writing end of section OBJECTS..."); + DEBUG->print("writing end of section OBJECTS..."); dxf.writeObjectsEnd(*dw); } - RS_DEBUG->print("writing EOF..."); + DEBUG->print("writing EOF..."); dw->dxfEOF(); - RS_DEBUG->print("close.."); + DEBUG->print("close.."); dw->close(); delete dw; @@ -1373,7 +1373,7 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType // check if file was actually written (strange world of windoze xp): if (QFileInfo(file).exists() == false) { - RS_DEBUG->print("RS_FilterDXF::fileExport: file could not be written"); + DEBUG->print("FilterDXF::fileExport: file could not be written"); return false; } @@ -1383,10 +1383,10 @@ bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /** * Writes all known variable settings to the DXF file. */ -void RS_FilterDXF::writeVariables(DL_WriterA & dw) +void FilterDXF::writeVariables(DL_WriterA & dw) { -// Q3DictIterator it(graphic->getVariableDict()); - QHashIterator it(graphic->getVariableDict()); +// Q3DictIterator it(graphic->getVariableDict()); + QHashIterator it(graphic->getVariableDict()); // for (; it.current(); ++it) while (it.hasNext()) @@ -1434,28 +1434,28 @@ void RS_FilterDXF::writeVariables(DL_WriterA & dw) * * @todo Add support for unicode layer names */ -void RS_FilterDXF::writeLayer(DL_WriterA & dw, RS_Layer * l) +void FilterDXF::writeLayer(DL_WriterA & dw, Layer * l) { if (l == NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_FilterDXF::writeLayer: layer is NULL"); + DEBUG->print(Debug::D_WARNING, "FilterDXF::writeLayer: layer is NULL"); return; } - RS_DEBUG->print("RS_FilterDXF::writeLayer %s", l->getName().toLatin1().data()); + DEBUG->print("FilterDXF::writeLayer %s", l->getName().toLatin1().data()); dxf.writeLayer(dw, DL_LayerData((const char *)l->getName().toLocal8Bit(), l->isFrozen() + (l->isLocked() << 2)), DL_Attributes(std::string(""), colorToNumber(l->getPen().getColor()), widthToNumber(l->getPen().getWidth()), (const char *)lineTypeToName(l->getPen().getLineType()).toLocal8Bit())); - RS_DEBUG->print("RS_FilterDXF::writeLayer end"); + DEBUG->print("FilterDXF::writeLayer end"); } /** * Writes a line type to the DXF file. */ -void RS_FilterDXF::writeLineType(DL_WriterA & dw, RS2::LineType t) +void FilterDXF::writeLineType(DL_WriterA & dw, RS2::LineType t) { dxf.writeLineType(dw, DL_LineTypeData((const char *)lineTypeToName(t).toLocal8Bit(), 0)); } @@ -1467,7 +1467,7 @@ void RS_FilterDXF::writeLineType(DL_WriterA & dw, RS2::LineType t) * * @param appid Application ID (e.g. "QCad"). */ -void RS_FilterDXF::writeAppid(DL_WriterA& dw, const char* appid) { +void FilterDXF::writeAppid(DL_WriterA& dw, const char* appid) { dxf.writeAppid(dw, appid); } @@ -1476,21 +1476,21 @@ void RS_FilterDXF::writeAppid(DL_WriterA& dw, const char* appid) { /** * Writes a block (just the definition, not the entities in it). */ -void RS_FilterDXF::writeBlock(DL_WriterA& dw, RS_Block* blk) { +void FilterDXF::writeBlock(DL_WriterA& dw, Block* blk) { if (blk==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FilterDXF::writeBlock: Block is NULL"); + DEBUG->print(Debug::D_WARNING, + "FilterDXF::writeBlock: Block is NULL"); return; } - RS_DEBUG->print("writing block: %s", (const char*)blk->getName().toLocal8Bit()); + DEBUG->print("writing block: %s", (const char*)blk->getName().toLocal8Bit()); dxf.writeBlock(dw, DL_BlockData((const char*)blk->getName().toLocal8Bit(), 0, blk->getBasePoint().x, blk->getBasePoint().y, blk->getBasePoint().z)); - for (RS_Entity* e=blk->firstEntity(RS2::ResolveNone); + for (Entity* e=blk->firstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone)) { writeEntity(dw, e); @@ -1503,7 +1503,7 @@ void RS_FilterDXF::writeBlock(DL_WriterA& dw, RS_Block* blk) { /** * Writes the given entity to the DXF file. */ -void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e) { +void FilterDXF::writeEntity(DL_WriterA& dw, Entity* e) { writeEntity(dw, e, getEntityAttributes(e)); } @@ -1511,43 +1511,43 @@ void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e) { /** * Writes the given entity to the DXF file. */ -void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e, +void FilterDXF::writeEntity(DL_WriterA& dw, Entity* e, const DL_Attributes& attrib) { if (e==NULL || e->getFlag(RS2::FlagUndone)) { return; } - RS_DEBUG->print("writing Entity"); + DEBUG->print("writing Entity"); switch (e->rtti()) { case RS2::EntityPoint: - writePoint(dw, (RS_Point*)e, attrib); + writePoint(dw, (Point*)e, attrib); break; case RS2::EntityLine: - writeLine(dw, (RS_Line*)e, attrib); + writeLine(dw, (Line*)e, attrib); break; case RS2::EntityPolyline: - writePolyline(dw, (RS_Polyline*)e, attrib); + writePolyline(dw, (Polyline*)e, attrib); break; case RS2::EntitySpline: - writeSpline(dw, (RS_Spline*)e, attrib); + writeSpline(dw, (Spline*)e, attrib); break; case RS2::EntityVertex: break; case RS2::EntityCircle: - writeCircle(dw, (RS_Circle*)e, attrib); + writeCircle(dw, (Circle*)e, attrib); break; case RS2::EntityArc: - writeArc(dw, (RS_Arc*)e, attrib); + writeArc(dw, (Arc*)e, attrib); break; case RS2::EntityEllipse: - writeEllipse(dw, (RS_Ellipse*)e, attrib); + writeEllipse(dw, (Ellipse*)e, attrib); break; case RS2::EntityInsert: - writeInsert(dw, (RS_Insert*)e, attrib); + writeInsert(dw, (Insert*)e, attrib); break; case RS2::EntityText: - writeText(dw, (RS_Text*)e, attrib); + writeText(dw, (Text*)e, attrib); break; case RS2::EntityDimAligned: @@ -1555,25 +1555,25 @@ void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e, case RS2::EntityDimLinear: case RS2::EntityDimRadial: case RS2::EntityDimDiametric: - writeDimension(dw, (RS_Dimension*)e, attrib); + writeDimension(dw, (Dimension*)e, attrib); break; case RS2::EntityDimLeader: - writeLeader(dw, (RS_Leader*)e, attrib); + writeLeader(dw, (Leader*)e, attrib); break; case RS2::EntityHatch: - writeHatch(dw, (RS_Hatch*)e, attrib); + writeHatch(dw, (Hatch*)e, attrib); break; case RS2::EntityImage: - writeImage(dw, (RS_Image*)e, attrib); + writeImage(dw, (Image*)e, attrib); break; case RS2::EntitySolid: - writeSolid(dw, (RS_Solid*)e, attrib); + writeSolid(dw, (Solid*)e, attrib); break; #ifndef RS_NO_COMPLEX_ENTITIES case RS2::EntityContainer: - writeEntityContainer(dw, (RS_EntityContainer*)e, attrib); + writeEntityContainer(dw, (EntityContainer*)e, attrib); break; #endif @@ -1587,7 +1587,7 @@ void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e, /** * Writes the given Point entity to the file. */ -void RS_FilterDXF::writePoint(DL_WriterA& dw, RS_Point* p, +void FilterDXF::writePoint(DL_WriterA& dw, Point* p, const DL_Attributes& attrib) { dxf.writePoint( dw, @@ -1601,7 +1601,7 @@ void RS_FilterDXF::writePoint(DL_WriterA& dw, RS_Point* p, /** * Writes the given Line( entity to the file. */ -void RS_FilterDXF::writeLine(DL_WriterA& dw, RS_Line* l, +void FilterDXF::writeLine(DL_WriterA& dw, Line* l, const DL_Attributes& attrib) { dxf.writeLine( dw, @@ -1619,8 +1619,8 @@ void RS_FilterDXF::writeLine(DL_WriterA& dw, RS_Line* l, /** * Writes the given polyline entity to the file. */ -void RS_FilterDXF::writePolyline(DL_WriterA& dw, - RS_Polyline* l, +void FilterDXF::writePolyline(DL_WriterA& dw, + Polyline* l, const DL_Attributes& attrib) { int count = l->count(); @@ -1635,10 +1635,10 @@ void RS_FilterDXF::writePolyline(DL_WriterA& dw, l->isClosed()*0x1), attrib); bool first = true; - RS_Entity* nextEntity = 0; - RS_AtomicEntity* ae = NULL; - RS_Entity* lastEntity = l->lastEntity(RS2::ResolveNone); - for (RS_Entity* v=l->firstEntity(RS2::ResolveNone); + Entity* nextEntity = 0; + AtomicEntity* ae = NULL; + Entity* lastEntity = l->lastEntity(RS2::ResolveNone); + for (Entity* v=l->firstEntity(RS2::ResolveNone); v!=NULL; v=nextEntity) { @@ -1648,13 +1648,13 @@ void RS_FilterDXF::writePolyline(DL_WriterA& dw, continue; } - ae = (RS_AtomicEntity*)v; + ae = (AtomicEntity*)v; double bulge=0.0; // Write vertex: if (first) { if (v->rtti()==RS2::EntityArc) { - bulge = ((RS_Arc*)v)->getBulge(); + bulge = ((Arc*)v)->getBulge(); } dxf.writeVertex(dw, DL_VertexData(ae->getStartpoint().x, @@ -1667,7 +1667,7 @@ void RS_FilterDXF::writePolyline(DL_WriterA& dw, //if (dxf.getVersion()==VER_R12) { if (nextEntity!=NULL) { if (nextEntity->rtti()==RS2::EntityArc) { - bulge = ((RS_Arc*)nextEntity)->getBulge(); + bulge = ((Arc*)nextEntity)->getBulge(); } else { bulge = 0.0; @@ -1675,7 +1675,7 @@ void RS_FilterDXF::writePolyline(DL_WriterA& dw, } /*} else { if (v->rtti()==RS2::EntityArc) { - bulge = ((RS_Arc*)v)->getBulge(); + bulge = ((Arc*)v)->getBulge(); } }*/ @@ -1696,7 +1696,7 @@ void RS_FilterDXF::writePolyline(DL_WriterA& dw, /** * Writes the given spline entity to the file. */ -void RS_FilterDXF::writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attributes & attrib) +void FilterDXF::writeSpline(DL_WriterA & dw, Spline * s, const DL_Attributes & attrib) { // split spline into atomic entities for DXF R12: if (dxf.getVersion() == VER_R12) @@ -1707,7 +1707,7 @@ void RS_FilterDXF::writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attribut if (s->getNumberOfControlPoints() < s->getDegree() + 1) { - RS_DEBUG->print(RS_Debug::D_ERROR, "RS_FilterDXF::writeSpline: " + DEBUG->print(Debug::D_ERROR, "FilterDXF::writeSpline: " "Discarding spline: not enough control points given."); return; } @@ -1757,7 +1757,7 @@ void RS_FilterDXF::writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attribut /** * Writes the given circle entity to the file. */ -void RS_FilterDXF::writeCircle(DL_WriterA& dw, RS_Circle* c, +void FilterDXF::writeCircle(DL_WriterA& dw, Circle* c, const DL_Attributes& attrib) { dxf.writeCircle( dw, @@ -1771,7 +1771,7 @@ void RS_FilterDXF::writeCircle(DL_WriterA& dw, RS_Circle* c, -void RS_FilterDXF::writeArc(DL_WriterA& dw, RS_Arc* a, +void FilterDXF::writeArc(DL_WriterA& dw, Arc* a, const DL_Attributes& attrib) { double a1, a2; if (a->isReversed()) { @@ -1792,7 +1792,7 @@ void RS_FilterDXF::writeArc(DL_WriterA& dw, RS_Arc* a, } -void RS_FilterDXF::writeEllipse(DL_WriterA& dw, RS_Ellipse* s, +void FilterDXF::writeEllipse(DL_WriterA& dw, Ellipse* s, const DL_Attributes& attrib) { if (s->isReversed()) { dxf.writeEllipse( @@ -1823,7 +1823,7 @@ void RS_FilterDXF::writeEllipse(DL_WriterA& dw, RS_Ellipse* s, } } -void RS_FilterDXF::writeInsert(DL_WriterA & dw, RS_Insert * i, const DL_Attributes & attrib) +void FilterDXF::writeInsert(DL_WriterA & dw, Insert * i, const DL_Attributes & attrib) { dxf.writeInsert(dw, DL_InsertData(i->getName().toLatin1().data(), i->getInsertionPoint().x, i->getInsertionPoint().y, 0.0, @@ -1833,7 +1833,7 @@ void RS_FilterDXF::writeInsert(DL_WriterA & dw, RS_Insert * i, const DL_Attribut attrib); } -void RS_FilterDXF::writeText(DL_WriterA & dw, RS_Text * t, const DL_Attributes & attrib) +void FilterDXF::writeText(DL_WriterA & dw, Text * t, const DL_Attributes & attrib) { if (dxf.getVersion()==VER_R12) { @@ -1915,7 +1915,7 @@ void RS_FilterDXF::writeText(DL_WriterA & dw, RS_Text * t, const DL_Attributes & -void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, +void FilterDXF::writeDimension(DL_WriterA& dw, Dimension* d, const DL_Attributes& attrib) { // split hatch into atomic entities: @@ -1975,7 +1975,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, d->getAngle()); if (d->rtti()==RS2::EntityDimAligned) { - RS_DimAligned* da = (RS_DimAligned*)d; + DimAligned* da = (DimAligned*)d; DL_DimAlignedData dimAlignedData(da->getExtensionPoint1().x, da->getExtensionPoint1().y, @@ -1986,7 +1986,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, dxf.writeDimAligned(dw, dimData, dimAlignedData, attrib); } else if (d->rtti()==RS2::EntityDimLinear) { - RS_DimLinear* dl = (RS_DimLinear*)d; + DimLinear* dl = (DimLinear*)d; DL_DimLinearData dimLinearData(dl->getExtensionPoint1().x, dl->getExtensionPoint1().y, @@ -1999,7 +1999,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, dxf.writeDimLinear(dw, dimData, dimLinearData, attrib); } else if (d->rtti()==RS2::EntityDimRadial) { - RS_DimRadial* dr = (RS_DimRadial*)d; + DimRadial* dr = (DimRadial*)d; DL_DimRadialData dimRadialData(dr->getDefinitionPoint().x, dr->getDefinitionPoint().y, @@ -2008,7 +2008,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, dxf.writeDimRadial(dw, dimData, dimRadialData, attrib); } else if (d->rtti()==RS2::EntityDimDiametric) { - RS_DimDiametric* dr = (RS_DimDiametric*)d; + DimDiametric* dr = (DimDiametric*)d; DL_DimDiametricData dimDiametricData(dr->getDefinitionPoint().x, dr->getDefinitionPoint().y, @@ -2017,7 +2017,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, dxf.writeDimDiametric(dw, dimData, dimDiametricData, attrib); } else if (d->rtti()==RS2::EntityDimAngular) { - RS_DimAngular* da = (RS_DimAngular*)d; + DimAngular* da = (DimAngular*)d; DL_DimAngularData dimAngularData(da->getDefinitionPoint1().x, da->getDefinitionPoint1().y, @@ -2038,7 +2038,7 @@ void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d, } -void RS_FilterDXF::writeLeader(DL_WriterA& dw, RS_Leader* l, +void FilterDXF::writeLeader(DL_WriterA& dw, Leader* l, const DL_Attributes& attrib) { if (l->count()>0) { dxf.writeLeader( @@ -2053,13 +2053,13 @@ void RS_FilterDXF::writeLeader(DL_WriterA& dw, RS_Leader* l, l->count()), attrib); bool first = true; - for (RS_Entity* v=l->firstEntity(RS2::ResolveNone); + for (Entity* v=l->firstEntity(RS2::ResolveNone); v!=NULL; v=l->nextEntity(RS2::ResolveNone)) { // Write line verties: if (v->rtti()==RS2::EntityLine) { - RS_Line* l = (RS_Line*)v; + Line* l = (Line*)v; if (first) { dxf.writeLeaderVertex( dw, @@ -2076,13 +2076,13 @@ void RS_FilterDXF::writeLeader(DL_WriterA& dw, RS_Leader* l, } } } else { - RS_DEBUG->print(RS_Debug::D_WARNING, + DEBUG->print(Debug::D_WARNING, "dropping leader with no vertices"); } } -void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, +void FilterDXF::writeHatch(DL_WriterA& dw, Hatch* h, const DL_Attributes& attrib) { // split hatch into atomic entities: @@ -2094,7 +2094,7 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, bool writeIt = true; if (h->countLoops()>0) { // check if all of the loops contain entities: - for (RS_Entity* l=h->firstEntity(RS2::ResolveNone); + for (Entity* l=h->firstEntity(RS2::ResolveNone); l!=NULL; l=h->nextEntity(RS2::ResolveNone)) { @@ -2109,8 +2109,8 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, } if (!writeIt) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FilterDXF::writeHatch: Dropping Hatch"); + DEBUG->print(Debug::D_WARNING, + "FilterDXF::writeHatch: Dropping Hatch"); } else { DL_HatchData data(h->countLoops(), h->isSolid(), @@ -2119,23 +2119,23 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, (const char*)h->getPattern().toLocal8Bit()); dxf.writeHatch1(dw, data, attrib); - for (RS_Entity* l=h->firstEntity(RS2::ResolveNone); + for (Entity* l=h->firstEntity(RS2::ResolveNone); l!=NULL; l=h->nextEntity(RS2::ResolveNone)) { // Write hatch loops: if (l->isContainer() && !l->getFlag(RS2::FlagTemp)) { - RS_EntityContainer* loop = (RS_EntityContainer*)l; + EntityContainer* loop = (EntityContainer*)l; DL_HatchLoopData lData(loop->count()); dxf.writeHatchLoop1(dw, lData); - for (RS_Entity* ed=loop->firstEntity(RS2::ResolveNone); + for (Entity* ed=loop->firstEntity(RS2::ResolveNone); ed!=NULL; ed=loop->nextEntity(RS2::ResolveNone)) { // Write hatch loop edges: if (ed->rtti()==RS2::EntityLine) { - RS_Line* ln = (RS_Line*)ed; + Line* ln = (Line*)ed; dxf.writeHatchEdge( dw, DL_HatchEdgeData(ln->getStartpoint().x, @@ -2143,7 +2143,7 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, ln->getEndpoint().x, ln->getEndpoint().y)); } else if (ed->rtti()==RS2::EntityArc) { - RS_Arc* ar = (RS_Arc*)ed; + Arc* ar = (Arc*)ed; if (!ar->isReversed()) { dxf.writeHatchEdge( dw, @@ -2164,7 +2164,7 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, false)); } } else if (ed->rtti()==RS2::EntityCircle) { - RS_Circle* ci = (RS_Circle*)ed; + Circle* ci = (Circle*)ed; dxf.writeHatchEdge( dw, DL_HatchEdgeData(ci->getCenter().x, @@ -2185,7 +2185,7 @@ void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h, -void RS_FilterDXF::writeSolid(DL_WriterA& dw, RS_Solid* s, +void FilterDXF::writeSolid(DL_WriterA& dw, Solid* s, const DL_Attributes& attrib) { // split solid into line entities: @@ -2206,7 +2206,7 @@ void RS_FilterDXF::writeSolid(DL_WriterA& dw, RS_Solid* s, } -void RS_FilterDXF::writeImage(DL_WriterA& dw, RS_Image* i, +void FilterDXF::writeImage(DL_WriterA& dw, Image* i, const DL_Attributes& attrib) { int handle = dxf.writeImage( dw, @@ -2231,7 +2231,7 @@ void RS_FilterDXF::writeImage(DL_WriterA& dw, RS_Image* i, -void RS_FilterDXF::writeEntityContainer(DL_WriterA& dw, RS_EntityContainer* con, +void FilterDXF::writeEntityContainer(DL_WriterA& dw, EntityContainer* con, const DL_Attributes& /*attrib*/) { QString blkName; blkName = "__CE"; @@ -2263,11 +2263,11 @@ void RS_FilterDXF::writeEntityContainer(DL_WriterA& dw, RS_EntityContainer* con, dw.dxfString(0, "ENDTAB"); //Block creation - RS_BlockData blkdata(blkName, Vector(0,0), false); + BlockData blkdata(blkName, Vector(0,0), false); - RS_Block* blk = new RS_Block(graphic, blkdata); + Block* blk = new Block(graphic, blkdata); - for (RS_Entity* e1 = con->firstEntity(); e1 != NULL; + for (Entity* e1 = con->firstEntity(); e1 != NULL; e1 = con->nextEntity() ) { blk->addEntity(e1); } @@ -2281,11 +2281,11 @@ void RS_FilterDXF::writeEntityContainer(DL_WriterA& dw, RS_EntityContainer* con, /** * Writes the atomic entities of the given cotnainer to the file. */ -void RS_FilterDXF::writeAtomicEntities(DL_WriterA& dw, RS_EntityContainer* c, +void FilterDXF::writeAtomicEntities(DL_WriterA& dw, EntityContainer* c, const DL_Attributes& attrib, RS2::ResolveLevel level) { - for (RS_Entity* e=c->firstEntity(level); + for (Entity* e=c->firstEntity(level); e!=NULL; e=c->nextEntity(level)) { @@ -2296,7 +2296,7 @@ void RS_FilterDXF::writeAtomicEntities(DL_WriterA& dw, RS_EntityContainer* c, /** * Writes an IMAGEDEF object into an OBJECT section. */ -void RS_FilterDXF::writeImageDef(DL_WriterA& dw, RS_Image* i) { +void FilterDXF::writeImageDef(DL_WriterA& dw, Image* i) { if (i==NULL || i->getFlag(RS2::FlagUndone)) { return; } @@ -2327,11 +2327,11 @@ void RS_FilterDXF::writeImageDef(DL_WriterA& dw, RS_Image* i) { * Sets the entities attributes according to the attributes * that come from a DXF file. */ -void RS_FilterDXF::setEntityAttributes(RS_Entity* entity, +void FilterDXF::setEntityAttributes(Entity* entity, const DL_Attributes& attrib) { - RS_DEBUG->print("RS_FilterDXF::setEntityAttributes"); + DEBUG->print("FilterDXF::setEntityAttributes"); - RS_Pen pen; + Pen pen; pen.setColor(Qt::black); pen.setLineType(RS2::SolidLine); @@ -2356,16 +2356,16 @@ void RS_FilterDXF::setEntityAttributes(RS_Entity* entity, pen.setWidth(numberToWidth(attrib.getWidth())); entity->setPen(pen); - RS_DEBUG->print("RS_FilterDXF::setEntityAttributes: OK"); + DEBUG->print("FilterDXF::setEntityAttributes: OK"); } /** * Gets the entities attributes as a DL_Attributes object. */ -DL_Attributes RS_FilterDXF::getEntityAttributes(RS_Entity * entity) +DL_Attributes FilterDXF::getEntityAttributes(Entity * entity) { // Layer: - RS_Layer * layer = entity->getLayer(); + Layer * layer = entity->getLayer(); QString layerName; if (layer != NULL) @@ -2373,7 +2373,7 @@ DL_Attributes RS_FilterDXF::getEntityAttributes(RS_Entity * entity) else layerName = "NULL"; - RS_Pen pen = entity->getPen(false); + Pen pen = entity->getPen(false); // Color: int color = colorToNumber(pen.getColor()); @@ -2393,14 +2393,14 @@ DL_Attributes RS_FilterDXF::getEntityAttributes(RS_Entity * entity) /** * @return Pen with the same attributes as 'attrib'. */ -RS_Pen RS_FilterDXF::attributesToPen(const DL_Attributes & attrib) const +Pen FilterDXF::attributesToPen(const DL_Attributes & attrib) const { /* printf("converting Color %d to %s\n", attrib.getColor(), numberToColor(attrib.getColor()).name().toLatin1()); */ - RS_Pen pen(numberToColor(attrib.getColor()), + Pen pen(numberToColor(attrib.getColor()), numberToWidth(attrib.getWidth()), nameToLineType(attrib.getLineType().c_str())); return pen; @@ -2409,13 +2409,13 @@ RS_Pen RS_FilterDXF::attributesToPen(const DL_Attributes & attrib) const /** - * Converts a color index (num) into a RS_Color object. + * Converts a color index (num) into a Color object. * Please refer to the dxflib documentation for details. * * @param num Color number. * @param comp Compatibility with older QCad versions (1.5.3 and older) */ -RS_Color RS_FilterDXF::numberToColor(int num, bool comp) { +Color FilterDXF::numberToColor(int num, bool comp) { // Compatibility with QCad 1.5.3 and older: if (comp) { switch(num) { @@ -2472,20 +2472,20 @@ RS_Color RS_FilterDXF::numberToColor(int num, bool comp) { } } else { if (num==0) { - return RS_Color(RS2::FlagByBlock); + return Color(RS2::FlagByBlock); } else if (num==256) { - return RS_Color(RS2::FlagByLayer); + return Color(RS2::FlagByLayer); } else if (num<=255 && num>=0) { - return RS_Color((int)(dxfColors[num][0]*255), + return Color((int)(dxfColors[num][0]*255), (int)(dxfColors[num][1]*255), (int)(dxfColors[num][2]*255)); } else { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_FilterDXF::numberToColor: Invalid color number given."); - return RS_Color(RS2::FlagByLayer); + DEBUG->print(Debug::D_WARNING, + "FilterDXF::numberToColor: Invalid color number given."); + return Color(RS2::FlagByLayer); } } - return RS_Color(); + return Color(); } @@ -2494,7 +2494,7 @@ RS_Color RS_FilterDXF::numberToColor(int num, bool comp) { * Converts a color into a color number in the DXF palette. * The color that fits best is chosen. */ -int RS_FilterDXF::colorToNumber(const RS_Color& col) { +int FilterDXF::colorToNumber(const Color& col) { //printf("Searching color for %s\n", col.name().toLatin1()); @@ -2548,7 +2548,7 @@ int RS_FilterDXF::colorToNumber(const RS_Color& col) { * Converts a line type name (e.g. "CONTINUOUS") into a RS2::LineType * object. */ -RS2::LineType RS_FilterDXF::nameToLineType(const QString & name) +RS2::LineType FilterDXF::nameToLineType(const QString & name) { QString uName = name.toUpper(); @@ -2601,9 +2601,9 @@ RS2::LineType RS_FilterDXF::nameToLineType(const QString & name) } /** - * Converts a RS_LineType into a name for a line type. + * Converts a LineType into a name for a line type. */ -QString RS_FilterDXF::lineTypeToName(RS2::LineType lineType) +QString FilterDXF::lineTypeToName(RS2::LineType lineType) { // Standard linetypes for QCad II / AutoCAD switch (lineType) @@ -2689,9 +2689,9 @@ QString RS_FilterDXF::lineTypeToName(RS2::LineType lineType) /** - * Converts a RS_LineType into a name for a line type. + * Converts a LineType into a name for a line type. */ -/*QString RS_FilterDXF::lineTypeToDescription(RS2::LineType lineType) { +/*QString FilterDXF::lineTypeToDescription(RS2::LineType lineType) { // Standard linetypes for QCad II / AutoCAD switch (lineType) { @@ -2721,7 +2721,7 @@ QString RS_FilterDXF::lineTypeToName(RS2::LineType lineType) /** * Converts a line width number (e.g. 1) into a RS2::LineWidth. */ -RS2::LineWidth RS_FilterDXF::numberToWidth(int num) { +RS2::LineWidth FilterDXF::numberToWidth(int num) { switch (num) { case -1: return RS2::WidthByLayer; @@ -2792,7 +2792,7 @@ RS2::LineWidth RS_FilterDXF::numberToWidth(int num) { /** * Converts a RS2::LineWidth into an int width. */ -int RS_FilterDXF::widthToNumber(RS2::LineWidth width) { +int FilterDXF::widthToNumber(RS2::LineWidth width) { switch (width) { case RS2::WidthByLayer: return -1; @@ -2818,7 +2818,7 @@ int RS_FilterDXF::widthToNumber(RS2::LineWidth width) { * - %%%d for a degree sign * - %%%p for a plus/minus sign */ -QString RS_FilterDXF::toDxfString(const QString & string) +QString FilterDXF::toDxfString(const QString & string) { /* QString res = string; @@ -2880,7 +2880,7 @@ QString RS_FilterDXF::toDxfString(const QString & string) /** * Converts a DXF encoded string into a native Unicode string. */ -QString RS_FilterDXF::toNativeString(const QString & string) +QString FilterDXF::toNativeString(const QString & string) { QString res = string; // Line feed: @@ -2952,8 +2952,8 @@ QString RS_FilterDXF::toNativeString(const QString & string) res = res.replace("}", ""); res = res.replace("#curly#", "}"); - RS_DEBUG->print("RS_FilterDXF::toNativeString:"); - RS_DEBUG->printUnicode(res); + DEBUG->print("FilterDXF::toNativeString:"); + DEBUG->printUnicode(res); return res; } @@ -2965,7 +2965,7 @@ QString RS_FilterDXF::toNativeString(const QString & string) * * @ret Matching AngleFormat enum value. */ -RS2::AngleFormat RS_FilterDXF::numberToAngleFormat(int num) { +RS2::AngleFormat FilterDXF::numberToAngleFormat(int num) { RS2::AngleFormat af; @@ -2995,7 +2995,7 @@ RS2::AngleFormat RS_FilterDXF::numberToAngleFormat(int num) { /** * Converts AngleFormat enum to DXF number. */ -int RS_FilterDXF::angleFormatToNumber(RS2::AngleFormat af) { +int FilterDXF::angleFormatToNumber(RS2::AngleFormat af) { int num; @@ -3026,7 +3026,7 @@ int RS_FilterDXF::angleFormatToNumber(RS2::AngleFormat af) { /** * converts a DXF unit setting (e.g. INSUNITS) to a unit enum. */ -RS2::Unit RS_FilterDXF::numberToUnit(int num) { +RS2::Unit FilterDXF::numberToUnit(int num) { switch (num) { default: case 0: @@ -3102,7 +3102,7 @@ RS2::Unit RS_FilterDXF::numberToUnit(int num) { /** * Converst a unit enum into a DXF unit number e.g. for INSUNITS. */ -int RS_FilterDXF::unitToNumber(RS2::Unit unit) { +int FilterDXF::unitToNumber(RS2::Unit unit) { switch (unit) { default: case RS2::None: @@ -3178,7 +3178,7 @@ int RS_FilterDXF::unitToNumber(RS2::Unit unit) { /** * Checks if the given variable is two-dimensional (e.g. $LIMMIN). */ -bool RS_FilterDXF::isVariableTwoDimensional(const QString& var) { +bool FilterDXF::isVariableTwoDimensional(const QString& var) { if (var=="$LIMMIN" || var=="$LIMMAX" || var=="$PLIMMIN" || diff --git a/src/base/filterdxf.h b/src/base/filterdxf.h index 1287da1..70801e0 100644 --- a/src/base/filterdxf.h +++ b/src/base/filterdxf.h @@ -28,11 +28,11 @@ class DL_WriterA; * * @author Andrew Mustun */ -class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface +class FilterDXF: public FilterInterface, DL_CreationInterface { public: - RS_FilterDXF(); - ~RS_FilterDXF(); + FilterDXF(); + ~FilterDXF(); /** * @return RS2::FormatDXF. @@ -74,7 +74,7 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface virtual void addMText(const DL_MTextData & data); virtual void addText(const DL_TextData & data); //virtual void addDimension(const DL_DimensionData& data); - RS_DimensionData convDimensionData(const DL_DimensionData & data); + DimensionData convDimensionData(const DL_DimensionData & data); virtual void addDimAlign(const DL_DimensionData & data, const DL_DimAlignedData & edata); virtual void addDimLinear(const DL_DimensionData & data, const DL_DimLinearData & edata); virtual void addDimRadial(const DL_DimensionData & data, const DL_DimRadialData & edata); @@ -100,44 +100,44 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type); void writeVariables(DL_WriterA & dw); - void writeLayer(DL_WriterA & dw, RS_Layer * l); + void writeLayer(DL_WriterA & dw, Layer * l); void writeLineType(DL_WriterA & dw, RS2::LineType t); void writeAppid(DL_WriterA & dw, const char * appid); - void writeBlock(DL_WriterA & dw, RS_Block * blk); - void writeEntity(DL_WriterA & dw, RS_Entity * e); - void writeEntity(DL_WriterA & dw, RS_Entity * e, const DL_Attributes & attrib); - void writePoint(DL_WriterA & dw, RS_Point * p, const DL_Attributes & attrib); - void writeLine(DL_WriterA & dw, RS_Line * l, const DL_Attributes & attrib); - void writePolyline(DL_WriterA & dw, RS_Polyline * l, const DL_Attributes & attrib); - void writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attributes & attrib); - void writeCircle(DL_WriterA & dw, RS_Circle * c, const DL_Attributes & attrib); - void writeArc(DL_WriterA & dw, RS_Arc * a, const DL_Attributes & attrib); - void writeEllipse(DL_WriterA & dw, RS_Ellipse * s, const DL_Attributes & attrib); - void writeInsert(DL_WriterA & dw, RS_Insert * i, const DL_Attributes & attrib); - void writeText(DL_WriterA & dw, RS_Text * t, const DL_Attributes & attrib); - void writeDimension(DL_WriterA & dw, RS_Dimension * d, const DL_Attributes & attrib); - void writeLeader(DL_WriterA & dw, RS_Leader * l, const DL_Attributes & attrib); - void writeHatch(DL_WriterA & dw, RS_Hatch * h, const DL_Attributes & attrib); - void writeSolid(DL_WriterA & dw, RS_Solid * s, const DL_Attributes & attrib); - void writeImage(DL_WriterA & dw, RS_Image * i, const DL_Attributes & attrib); - void writeEntityContainer(DL_WriterA & dw, RS_EntityContainer * con, + void writeBlock(DL_WriterA & dw, Block * blk); + void writeEntity(DL_WriterA & dw, Entity * e); + void writeEntity(DL_WriterA & dw, Entity * e, const DL_Attributes & attrib); + void writePoint(DL_WriterA & dw, Point * p, const DL_Attributes & attrib); + void writeLine(DL_WriterA & dw, Line * l, const DL_Attributes & attrib); + void writePolyline(DL_WriterA & dw, Polyline * l, const DL_Attributes & attrib); + void writeSpline(DL_WriterA & dw, Spline * s, const DL_Attributes & attrib); + void writeCircle(DL_WriterA & dw, Circle * c, const DL_Attributes & attrib); + void writeArc(DL_WriterA & dw, Arc * a, const DL_Attributes & attrib); + void writeEllipse(DL_WriterA & dw, Ellipse * s, const DL_Attributes & attrib); + void writeInsert(DL_WriterA & dw, Insert * i, const DL_Attributes & attrib); + void writeText(DL_WriterA & dw, Text * t, const DL_Attributes & attrib); + void writeDimension(DL_WriterA & dw, Dimension * d, const DL_Attributes & attrib); + void writeLeader(DL_WriterA & dw, Leader * l, const DL_Attributes & attrib); + void writeHatch(DL_WriterA & dw, Hatch * h, const DL_Attributes & attrib); + void writeSolid(DL_WriterA & dw, Solid * s, const DL_Attributes & attrib); + void writeImage(DL_WriterA & dw, Image * i, const DL_Attributes & attrib); + void writeEntityContainer(DL_WriterA & dw, EntityContainer * con, const DL_Attributes & attrib); - void writeAtomicEntities(DL_WriterA & dw, RS_EntityContainer * c, + void writeAtomicEntities(DL_WriterA & dw, EntityContainer * c, const DL_Attributes & attrib, RS2::ResolveLevel level); - void writeImageDef(DL_WriterA & dw, RS_Image * i); + void writeImageDef(DL_WriterA & dw, Image * i); - void setEntityAttributes(RS_Entity * entity, const DL_Attributes& attrib); - DL_Attributes getEntityAttributes(RS_Entity * entity); + void setEntityAttributes(Entity * entity, const DL_Attributes& attrib); + DL_Attributes getEntityAttributes(Entity * entity); static QString toDxfString(const QString & string); static QString toNativeString(const QString & string); public: - RS_Pen attributesToPen(const DL_Attributes & attrib) const; + Pen attributesToPen(const DL_Attributes & attrib) const; - static RS_Color numberToColor(int num, bool comp = false); - static int colorToNumber(const RS_Color & col); + static Color numberToColor(int num, bool comp = false); + static int colorToNumber(const Color & col); static RS2::LineType nameToLineType(const QString& name); static QString lineTypeToName(RS2::LineType lineType); @@ -162,21 +162,21 @@ class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface /** string for concatinating text parts of MTEXT entities. */ QString mtext; /** Pointer to current polyline entity we're adding vertices to. */ - RS_Polyline * polyline; + Polyline * polyline; /** Pointer to current spline entity we're adding control points to. */ - RS_Spline * spline; + Spline * spline; /** Pointer to current leader entity we're adding vertices to. */ - RS_Leader * leader; + Leader * leader; /** Pointer to current entity container (either block or graphic) */ - RS_EntityContainer * currentContainer; + EntityContainer * currentContainer; /** Pointer to current hatch or NULL. */ - RS_Hatch * hatch; + Hatch * hatch; /** Pointer to current hatch loop or NULL. */ - RS_EntityContainer * hatchLoop; + EntityContainer * hatchLoop; DL_Dxf dxf; - RS_VariableDict variables; + VariableDict variables; }; #endif // __FILTERDXF_H__ diff --git a/src/base/filterdxf1.cpp b/src/base/filterdxf1.cpp index 4a03ad5..75dbbaf 100644 --- a/src/base/filterdxf1.cpp +++ b/src/base/filterdxf1.cpp @@ -31,9 +31,9 @@ /** * Default constructor. */ -RS_FilterDXF1::RS_FilterDXF1(): RS_FilterInterface() +FilterDXF1::FilterDXF1(): FilterInterface() { - RS_DEBUG->print("Setting up DXF 1 filter..."); + DEBUG->print("Setting up DXF 1 filter..."); graphic = NULL; addImportFormat(RS2::FormatDXF1); } @@ -46,9 +46,9 @@ 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(Drawing& g, const QString& file, RS2::FormatType /*type*/) +bool FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/) { - RS_DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data()); + DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data()); this->graphic = &g; @@ -73,9 +73,9 @@ bool RS_FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /** * Reads a dxf1 file from buffer. */ -bool RS_FilterDXF1::readFromBuffer() +bool FilterDXF1::readFromBuffer() { - RS_DEBUG->print("\nDXF: Read from buffer"); + DEBUG->print("\nDXF: Read from buffer"); bool ret; // returned value QString dxfLine; // A line in the dxf file @@ -93,38 +93,38 @@ bool RS_FilterDXF1::readFromBuffer() QString lastLayer; // Last used layer name (test adding only // if the new layer!=lastLayer) //int currentLayerNum=0; // Current layer number - RS_Layer * currentLayer = 0; // Pointer to current layer + Layer * currentLayer = 0; // Pointer to current layer //QList blockList; // List of blocks //blockList.setAutoDelete( true ); //bool oldColorNumbers=false; // use old color numbers (qcad<1.5.3) - RS_Pen pen; + Pen pen; ///if(!add) graphic->clearLayers(); //graphic->addLayer(DEF_DEFAULTLAYER); - //RS_DEBUG->print( "\nDefault layer added" ); + //DEBUG->print( "\nDefault layer added" ); // Loaded graphics without unit information: load as unit less: //graphic->setUnit( None ); - RS_DEBUG->print("\nUnit set"); + DEBUG->print("\nUnit set"); resetBufP(); if (fBuf) { - RS_DEBUG->print("\nBuffer OK"); - RS_DEBUG->print("\nBuffer: "); - RS_DEBUG->print(fBuf); + DEBUG->print("\nBuffer OK"); + DEBUG->print("\nBuffer: "); + DEBUG->print(fBuf); do { dxfLine = getBufLine(); - pen = RS_Pen(RS_Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer); + pen = Pen(Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer); - RS_DEBUG->print("\ndxfLine: "); - RS_DEBUG->print(dxfLine.toAscii().data()); + DEBUG->print("\ndxfLine: "); + DEBUG->print(dxfLine.toAscii().data()); // $-Setting in the header of DXF found // @@ -374,7 +374,7 @@ bool RS_FilterDXF1::readFromBuffer() if (!dxfLine.isEmpty()) { graphic->addVariable("$DIMADEC", dxfLine, 70); - //graphic->setAngleDimensionExactness( RS_Math::pow(0.1, dxfLine.toInt()) ); + //graphic->setAngleDimensionExactness( Math::pow(0.1, dxfLine.toInt()) ); } } } @@ -520,7 +520,7 @@ bool RS_FilterDXF1::readFromBuffer() if (dxfLine=="(null)" || dxfLine=="default") { dxfLine = "0"; } - graphic->addLayer(new RS_Layer(dxfLine)); + graphic->addLayer(new Layer(dxfLine)); graphic->activateLayer(dxfLine); currentLayer = graphic->getActiveLayer(); lastLayer=dxfLine; @@ -537,14 +537,14 @@ bool RS_FilterDXF1::readFromBuffer() case 6: // style //if(currentLayer) //currentLayer->setStyle( graphic->nameToStyle(dxfLine) ); - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 39: // Thickness //if(currentLayer) currentLayer->setWidth(dxfLine.toInt()); - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); //if(currentLayer) { // currentLayer->setColor( graphic->numberToColor(dxfLine.toInt(), !oldColorNumbers)); //} @@ -579,7 +579,7 @@ bool RS_FilterDXF1::readFromBuffer() if(!dxfLine.isEmpty()) { switch(code) { case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer //if(dxfLine!=lastLayer) { @@ -599,10 +599,10 @@ bool RS_FilterDXF1::readFromBuffer() vy1 = dxfLine.toDouble(); break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: break; @@ -613,8 +613,8 @@ bool RS_FilterDXF1::readFromBuffer() while(!dxfCode.isEmpty() && code != 0); graphic->setActivePen(pen); - graphic->addEntity(new RS_Point(graphic, - RS_PointData(Vector(vx1, vy1)))); + graphic->addEntity(new Point(graphic, + PointData(Vector(vx1, vy1)))); } // ----- @@ -633,7 +633,7 @@ bool RS_FilterDXF1::readFromBuffer() if(!dxfLine.isEmpty()) { switch(code) { case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer //if(dxfLine!=lastLayer) { @@ -661,10 +661,10 @@ bool RS_FilterDXF1::readFromBuffer() vy2 = dxfLine.toDouble(); break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: break; @@ -676,8 +676,8 @@ bool RS_FilterDXF1::readFromBuffer() //if(!mtCompFloat(vx1, vx2) || !mtCompFloat(vy1, vy2)) { //graphic->addLine(vx1, vy1, vx2, vy2, currentLayerNum, add); graphic->setActivePen(pen); - graphic->addEntity(new RS_Line(graphic, - RS_LineData(Vector(vx1, vy1), Vector(vx2, vy2)))); + graphic->addEntity(new Line(graphic, + LineData(Vector(vx1, vy1), Vector(vx2, vy2)))); //} } @@ -695,7 +695,7 @@ bool RS_FilterDXF1::readFromBuffer() if(!dxfLine.isEmpty()) { switch(code) { case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer //if(dxfLine!=lastLayer) { @@ -720,17 +720,17 @@ bool RS_FilterDXF1::readFromBuffer() break; case 50: // Start Angle dxfLine.replace( QRegExp(","), "." ); - va1 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD); + va1 = Math::correctAngle(dxfLine.toDouble()/ARAD); break; case 51: // End Angle dxfLine.replace( QRegExp(","), "." ); - va2 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD); + va2 = Math::correctAngle(dxfLine.toDouble()/ARAD); break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: break; @@ -742,8 +742,8 @@ bool RS_FilterDXF1::readFromBuffer() // graphic->addArc(vcx, vcy, vcr, va1, va2, false, currentLayerNum, add); //} graphic->setActivePen(pen); - graphic->addEntity(new RS_Arc(graphic, - RS_ArcData(Vector(vcx, vcy), + graphic->addEntity(new Arc(graphic, + ArcData(Vector(vcx, vcy), vcr, va1, va2, false))); } @@ -760,7 +760,7 @@ bool RS_FilterDXF1::readFromBuffer() if(!dxfLine.isEmpty()) { switch(code) { case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer //if(dxfLine!=lastLayer) { @@ -784,10 +784,10 @@ bool RS_FilterDXF1::readFromBuffer() vcr = dxfLine.toDouble(); break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: break; @@ -799,8 +799,8 @@ bool RS_FilterDXF1::readFromBuffer() graphic->addCircle(vcx, vcy, vcr, 0.0, 360.0, false, currentLayerNum, add); }*/ graphic->setActivePen(pen); - graphic->addEntity(new RS_Circle(graphic, - RS_CircleData(Vector(vcx, vcy), + graphic->addEntity(new Circle(graphic, + CircleData(Vector(vcx, vcy), vcr))); } @@ -905,7 +905,7 @@ bool RS_FilterDXF1::readFromBuffer() break; case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 7: @@ -1018,10 +1018,10 @@ bool RS_FilterDXF1::readFromBuffer() } break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: break; @@ -1039,8 +1039,8 @@ bool RS_FilterDXF1::readFromBuffer() } graphic->addEntity( - new RS_Text(graphic, - RS_TextData( + new Text(graphic, + TextData( Vector(vx1, vy1), vheight, 100.0, @@ -1090,7 +1090,7 @@ bool RS_FilterDXF1::readFromBuffer() strDecodeDxfString(dimText); break; case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer //if(dxfLine!=lastLayer) { @@ -1153,10 +1153,10 @@ bool RS_FilterDXF1::readFromBuffer() typ = dxfLine.toInt(); break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; default: @@ -1179,10 +1179,10 @@ bool RS_FilterDXF1::readFromBuffer() switch(typ) { // Horiz. / vert.: case 0: { - RS_DimLinear* d = - new RS_DimLinear( + DimLinear* d = + new DimLinear( graphic, - RS_DimensionData( + DimensionData( Vector(v10, v20), Vector(0.0, 0.0), RS2::VAlignBottom, @@ -1193,7 +1193,7 @@ bool RS_FilterDXF1::readFromBuffer() "ISO-25", 0.0 ), - RS_DimLinearData( + DimLinearData( Vector(v13, v23), Vector(v14, v24), v50/ARAD, @@ -1216,10 +1216,10 @@ bool RS_FilterDXF1::readFromBuffer() defP.setPolar(dist, angle); defP+=Vector(v14, v24); - RS_DimAligned* d = - new RS_DimAligned( + DimAligned* d = + new DimAligned( graphic, - RS_DimensionData( + DimensionData( defP, Vector(0.0, 0.0), RS2::VAlignBottom, @@ -1230,7 +1230,7 @@ bool RS_FilterDXF1::readFromBuffer() "ISO-25", 0.0 ), - RS_DimAlignedData( + DimAlignedData( Vector(v13, v23), Vector(v14, v24) ) @@ -1242,18 +1242,18 @@ bool RS_FilterDXF1::readFromBuffer() // Angle: case 2: { - RS_Line tl1(NULL, - RS_LineData(Vector(v13, v23), + Line tl1(NULL, + LineData(Vector(v13, v23), Vector(v14, v24))); - RS_Line tl2(NULL, - RS_LineData(Vector(v10, v20), + Line tl2(NULL, + LineData(Vector(v10, v20), Vector(v15, v25))); VectorSolutions s; //bool inters=false; //tmpEl1.getIntersection(&tmpEl2, // &inters, &vcx, &vcy, 0,0,0,0, false); - s = RS_Information::getIntersection( + s = Information::getIntersection( &tl1, &tl2, false); if (s.get(0).valid) { @@ -1284,10 +1284,10 @@ bool RS_FilterDXF1::readFromBuffer() */ //Vector dp4; //dp4.setPolar(); - RS_DimAngular* d = - new RS_DimAngular( + DimAngular* d = + new DimAngular( graphic, - RS_DimensionData( + DimensionData( Vector(v10, v20), Vector(0.0, 0.0), RS2::VAlignBottom, @@ -1298,7 +1298,7 @@ bool RS_FilterDXF1::readFromBuffer() "ISO-25", 0.0 ), - RS_DimAngularData( + DimAngularData( Vector(v13, v23), Vector(vcx, vcy), Vector(vcx, vcy), @@ -1327,10 +1327,10 @@ bool RS_FilterDXF1::readFromBuffer() .angleTo(Vector(v15, v25)); Vector v2; v2.setPolar(v40, ang); - RS_DimRadial* d = - new RS_DimRadial( + DimRadial* d = + new DimRadial( graphic, - RS_DimensionData( + DimensionData( Vector(v10, v20), Vector(0.0, 0.0), RS2::VAlignBottom, @@ -1341,7 +1341,7 @@ bool RS_FilterDXF1::readFromBuffer() "ISO-25", 0.0 ), - RS_DimRadialData( + DimRadialData( Vector(v10, v20) + v2, 0.0 ) @@ -1366,10 +1366,10 @@ bool RS_FilterDXF1::readFromBuffer() .angleTo(Vector(v15, v25)); Vector v2; v2.setPolar(v40, ang); - RS_DimDiametric* d = - new RS_DimDiametric( + DimDiametric* d = + new DimDiametric( graphic, - RS_DimensionData( + DimensionData( Vector(v10, v20), Vector(0.0, 0.0), RS2::VAlignBottom, @@ -1380,7 +1380,7 @@ bool RS_FilterDXF1::readFromBuffer() "ISO-25", 0.0 ), - RS_DimDiametricData( + DimDiametricData( Vector(v10, v20) + v2, 0.0 ) @@ -1388,9 +1388,9 @@ bool RS_FilterDXF1::readFromBuffer() d->update(); graphic->addEntity(d); */ - RS_LeaderData data(true); - RS_Leader* d = - new RS_Leader(graphic, data); + LeaderData data(true); + Leader* d = + new Leader(graphic, data); d->addVertex(Vector(v14, v24)); d->addVertex(Vector(v10, v20)); d->update(); @@ -1428,7 +1428,7 @@ bool RS_FilterDXF1::readFromBuffer() patternName = dxfLine; break; case 6: // style - pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine)); + pen.setLineType(FilterDXF::nameToLineType(dxfLine)); break; case 8: // Layer // if(dxfLine!=lastLayer) { @@ -1497,10 +1497,10 @@ bool RS_FilterDXF1::readFromBuffer() break; case 39: // Thickness - pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt())); + pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt())); break; case 62: // Color - pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt())); + pen.setColor(FilterDXF::numberToColor(dxfLine.toInt())); break; case 91: // Number of boundary paths (loops) //numPaths=dxfLine.toInt(); @@ -1559,7 +1559,7 @@ bool RS_FilterDXF1::readFromBuffer() * Resets the whole object * (base class too) */ -void RS_FilterDXF1::reset() +void FilterDXF1::reset() { file.reset(); @@ -1577,7 +1577,7 @@ void RS_FilterDXF1::reset() /** * Reset buffer pointer to the beginning of the buffer: */ -void RS_FilterDXF1::resetBufP() +void FilterDXF1::resetBufP() { fBufP = 0; } @@ -1585,7 +1585,7 @@ void RS_FilterDXF1::resetBufP() /** * Set buffer pointer to the given index: */ -void RS_FilterDXF1::setBufP(int _fBufP) +void FilterDXF1::setBufP(int _fBufP) { if (_fBufP < (int)fSize) fBufP = _fBufP; @@ -1594,7 +1594,7 @@ void RS_FilterDXF1::setBufP(int _fBufP) /** * delete buffer: */ -void RS_FilterDXF1::delBuffer() +void FilterDXF1::delBuffer() { if (fBuf) { @@ -1606,7 +1606,7 @@ void RS_FilterDXF1::delBuffer() /** * Remove any 13-characters in the buffer: */ -void RS_FilterDXF1::dos2unix() +void FilterDXF1::dos2unix() { char * src = fBuf, * dst = fBuf; @@ -1632,7 +1632,7 @@ void RS_FilterDXF1::dos2unix() // return: -Null-string: end of buffer // -String which is the next line in buffer // -QString RS_FilterDXF1::getBufLine() +QString FilterDXF1::getBufLine() { char * ret; QString str; @@ -1666,7 +1666,7 @@ QString RS_FilterDXF1::getBufLine() // return: -Null-string: end of buffer // -String which is the next line in buffer // -char * RS_FilterDXF1::getBufLineCh() +char * FilterDXF1::getBufLineCh() { char * ret; @@ -1694,7 +1694,7 @@ char * RS_FilterDXF1::getBufLineCh() // Copy buffer from a given string: // -void RS_FilterDXF1::copyBufFrom(const char * _buf) +void FilterDXF1::copyBufFrom(const char * _buf) { if (_buf) { @@ -1709,7 +1709,7 @@ void RS_FilterDXF1::copyBufFrom(const char * _buf) // return: true: line found // false: end of buffer // -bool RS_FilterDXF1::gotoBufLine(char * _lstr) +bool FilterDXF1::gotoBufLine(char * _lstr) { QString l; @@ -1732,7 +1732,7 @@ bool RS_FilterDXF1::gotoBufLine(char * _lstr) // false: end of buffer // // -bool RS_FilterDXF1::gotoBufLineString(char * _lstr) +bool FilterDXF1::gotoBufLineString(char * _lstr) { QString l; @@ -1751,7 +1751,7 @@ bool RS_FilterDXF1::gotoBufLineString(char * _lstr) // Replace bynary Bytes (<32) by an other (given) byte: // -void RS_FilterDXF1::replaceBinaryBytesBy(char _c) +void FilterDXF1::replaceBinaryBytesBy(char _c) { int bc; @@ -1767,7 +1767,7 @@ void RS_FilterDXF1::replaceBinaryBytesBy(char _c) // Separate buffer (change chars sc1 and sc2 in '\0' // -void RS_FilterDXF1::separateBuf(char _c1, +void FilterDXF1::separateBuf(char _c1, char _c2, char _c3, char _c4) @@ -1786,7 +1786,7 @@ void RS_FilterDXF1::separateBuf(char _c1, // remove comment between '_fc' and '_lc' // comments get replaced by '\0' // -void RS_FilterDXF1::removeComment(char _fc, char _lc) +void FilterDXF1::removeComment(char _fc, char _lc) { bool rem = false; // Are we removing currrently? int bc; // counter @@ -1814,7 +1814,7 @@ void RS_FilterDXF1::removeComment(char _fc, char _lc) // return: true: successful // false: file not found // -bool RS_FilterDXF1::readFileInBuffer(char * _name, int _bNum) +bool FilterDXF1::readFileInBuffer(char * _name, int _bNum) { // file.setName(_name); file.setFileName(_name); @@ -1828,7 +1828,7 @@ bool RS_FilterDXF1::readFileInBuffer(char * _name, int _bNum) // return: true: successful // false: file not found // -bool RS_FilterDXF1::readFileInBuffer(int _bNum) +bool FilterDXF1::readFileInBuffer(int _bNum) { fPointer = fopen(name.toAscii().data(), "rb"); @@ -1865,7 +1865,7 @@ bool RS_FilterDXF1::readFileInBuffer(int _bNum) // Decode a DXF string to the C-convention (special character \P is a \n) // -void RS_FilterDXF1::strDecodeDxfString(QString & str) +void FilterDXF1::strDecodeDxfString(QString & str) { if (str.isEmpty()) return; @@ -1882,7 +1882,7 @@ void RS_FilterDXF1::strDecodeDxfString(QString & str) // return: true: values are equal // false: values are not equal // -bool RS_FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol) +bool FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol) { double delta = _v2 - _v1; diff --git a/src/base/filterdxf1.h b/src/base/filterdxf1.h index 422fa2c..1deea27 100644 --- a/src/base/filterdxf1.h +++ b/src/base/filterdxf1.h @@ -14,11 +14,11 @@ * * @author Andrew Mustun */ -class RS_FilterDXF1 : public RS_FilterInterface +class FilterDXF1 : public FilterInterface { public: - RS_FilterDXF1(); - ~RS_FilterDXF1() {} + FilterDXF1(); + ~FilterDXF1() {} /** * @return RS2::FormatDXF1. @@ -40,7 +40,7 @@ public: virtual bool fileExport(Drawing& /*g*/, const QString& /*file*/, RS2::FormatType /*type*/) { - RS_DEBUG->print(RS_Debug::D_WARNING, + DEBUG->print(Debug::D_WARNING, "Exporting of QCad 1.x file not implemented"); return false; } diff --git a/src/base/filterinterface.cpp b/src/base/filterinterface.cpp index 4b7a091..3259794 100644 --- a/src/base/filterinterface.cpp +++ b/src/base/filterinterface.cpp @@ -21,16 +21,16 @@ /** * Constructor. */ -RS_FilterInterface::RS_FilterInterface() +FilterInterface::FilterInterface() { - //std::cout << "RS_FilterInterface\n"; + //std::cout << "FilterInterface\n"; //graphic = NULL; } /** * Destructor. */ -/*virtual*/ RS_FilterInterface::~RS_FilterInterface() +/*virtual*/ FilterInterface::~FilterInterface() { } @@ -40,7 +40,7 @@ RS_FilterInterface::RS_FilterInterface() * @retval true if the filter can import the file type * @retval false otherwise. */ -/*virtual*/ bool RS_FilterInterface::canImport(RS2::FormatType t) +/*virtual*/ bool FilterInterface::canImport(RS2::FormatType t) { // return !(importFormats.find(t) == importFormats.end()); return (importFormats.indexOf(t) != -1); @@ -52,7 +52,7 @@ RS_FilterInterface::RS_FilterInterface() * @return true if the filter can export the file type, * false otherwise. */ -/*virtual*/ bool RS_FilterInterface::canExport(RS2::FormatType t) +/*virtual*/ bool FilterInterface::canExport(RS2::FormatType t) { // return !(exportFormats.find(t) == exportFormats.end()); return (exportFormats.indexOf(t) != -1); @@ -61,17 +61,17 @@ RS_FilterInterface::RS_FilterInterface() /** * Adds a file extension which can be imported by this filter. */ -void RS_FilterInterface::addImportFormat(RS2::FormatType type) +void FilterInterface::addImportFormat(RS2::FormatType type) { - RS_DEBUG->print("Filter can import %d", (int)type); + DEBUG->print("Filter can import %d", (int)type); importFormats += type; } /** * Adds a file extension which can be exported by this filter. */ -void RS_FilterInterface::addExportFormat(RS2::FormatType type) +void FilterInterface::addExportFormat(RS2::FormatType type) { - RS_DEBUG->print("Filter can export %d", (int)type); + DEBUG->print("Filter can export %d", (int)type); exportFormats += type; } diff --git a/src/base/filterinterface.h b/src/base/filterinterface.h index 7addd6e..3150eea 100644 --- a/src/base/filterinterface.h +++ b/src/base/filterinterface.h @@ -6,20 +6,20 @@ /** * This is the interface that must be implemented for all - * format filter classes. The RS_FileIO class + * format filter classes. The FileIO class * uses the methods defined in here to interact with the format * filter classes. * * @author Andrew Mustun */ -class RS_FilterInterface +class FilterInterface { public: /** * Constructor. */ - RS_FilterInterface(); - virtual ~RS_FilterInterface(); + FilterInterface(); + virtual ~FilterInterface(); virtual bool canImport(RS2::FormatType t); virtual bool canExport(RS2::FormatType t); diff --git a/src/base/flags.cpp b/src/base/flags.cpp index 3261795..d5b4dd5 100644 --- a/src/base/flags.cpp +++ b/src/base/flags.cpp @@ -17,52 +17,52 @@ #include "flags.h" /** Default constructor. Resets all flags to 0. */ -RS_Flags::RS_Flags() +Flags::Flags() { flags = 0; } /** Constructor with initialisation to the given flags. */ -RS_Flags::RS_Flags(unsigned int f) +Flags::Flags(unsigned int f) { flags = f; } -/*virtual*/ RS_Flags::~RS_Flags() +/*virtual*/ Flags::~Flags() { } -unsigned int RS_Flags::getFlags() const +unsigned int Flags::getFlags() const { return flags; } -void RS_Flags::resetFlags() +void Flags::resetFlags() { flags = 0; } -void RS_Flags::setFlags(unsigned int f) +void Flags::setFlags(unsigned int f) { flags = f; } -void RS_Flags::setFlag(unsigned int f) +void Flags::setFlag(unsigned int f) { flags = flags | f; } -void RS_Flags::delFlag(unsigned int f) +void Flags::delFlag(unsigned int f) { flags = flags & (~f); } -void RS_Flags::toggleFlag(unsigned int f) +void Flags::toggleFlag(unsigned int f) { flags = flags ^ f; } -bool RS_Flags::getFlag(unsigned int f) const +bool Flags::getFlag(unsigned int f) const { return (flags & f ? true : false); } diff --git a/src/base/flags.h b/src/base/flags.h index d8a7133..29ab0e0 100644 --- a/src/base/flags.h +++ b/src/base/flags.h @@ -6,12 +6,12 @@ * * @author Andrew Mustun */ -class RS_Flags +class Flags { public: - RS_Flags(); - RS_Flags(unsigned int f); - virtual ~RS_Flags(); + Flags(); + Flags(unsigned int f); + virtual ~Flags(); unsigned int getFlags() const; void resetFlags(); diff --git a/src/base/font.cpp b/src/base/font.cpp index b5a1303..33c37d5 100644 --- a/src/base/font.cpp +++ b/src/base/font.cpp @@ -27,50 +27,50 @@ * @param owner true if the font owns the letters (blocks). Otherwise * the letters will be deleted when the font is deleted. */ -RS_Font::RS_Font(const QString & fn, bool owner): letterList(owner), fileName(fn), +Font::Font(const QString & fn, bool owner): letterList(owner), fileName(fn), encoding(""), loaded(false), letterSpacing(3.0), wordSpacing(6.75), lineSpacingFactor(1.0) { } /** @return the fileName of this font. */ -QString RS_Font::getFileName() const +QString Font::getFileName() const { return fileName; } /** @return the encoding of this font. */ -QString RS_Font::getEncoding() const +QString Font::getEncoding() const { return encoding; } /** @return the alternative names of this font. */ -const QStringList & RS_Font::getNames() const +const QStringList & Font::getNames() const { return names; } /** @return the author(s) of this font. */ -const QStringList & RS_Font::getAuthors() const +const QStringList & Font::getAuthors() const { return authors; } /** @return Default letter spacing for this font */ -double RS_Font::getLetterSpacing() +double Font::getLetterSpacing() { return letterSpacing; } /** @return Default word spacing for this font */ -double RS_Font::getWordSpacing() +double Font::getWordSpacing() { return wordSpacing; } /** @return Default line spacing factor for this font */ -double RS_Font::getLineSpacingFactor() +double Font::getLineSpacingFactor() { return lineSpacingFactor; } @@ -81,9 +81,9 @@ double RS_Font::getLineSpacingFactor() * @retval true font was already loaded or is loaded now. * @retval false font could not be loaded. */ -bool RS_Font::loadFont() +bool Font::loadFont() { - RS_DEBUG->print("RS_Font::loadFont"); + DEBUG->print("Font::loadFont"); if (loaded) return true; @@ -93,7 +93,7 @@ bool RS_Font::loadFont() // Search for the appropriate font if we have only the name of the font: if (!fileName.toLower().contains(".cxf")) { - QStringList fonts = RS_SYSTEM->getFontList(); + QStringList fonts = SYSTEM->getFontList(); QFileInfo file; for(QStringList::Iterator it=fonts.begin(); it!=fonts.end(); it++) @@ -112,7 +112,7 @@ bool RS_Font::loadFont() // No font paths found: if (path.isEmpty()) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: No fonts available."); + DEBUG->print(Debug::D_WARNING, "Font::loadFont: No fonts available."); return false; } @@ -121,12 +121,12 @@ bool RS_Font::loadFont() if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: Cannot open font file: %s", + DEBUG->print(Debug::D_WARNING, "Font::loadFont: Cannot open font file: %s", path.toAscii().data()); return false; } - RS_DEBUG->print("RS_Font::loadFont: Successfully opened font file: %s", path.toAscii().data()); + DEBUG->print("Font::loadFont: Successfully opened font file: %s", path.toAscii().data()); QTextStream ts(&file); @@ -151,12 +151,12 @@ bool RS_Font::loadFont() file.close(); loaded = true; - RS_DEBUG->print("RS_Font::loadFont OK"); + DEBUG->print("Font::loadFont OK"); return true; } -void RS_Font::ParseIdentifier(QTextStream & ts, QString line) +void Font::ParseIdentifier(QTextStream & ts, QString line) { QStringList list = line.mid(1).split(":"); QString identifier = "", value = ""; @@ -184,7 +184,7 @@ void RS_Font::ParseIdentifier(QTextStream & ts, QString line) } } -void RS_Font::ParseCharacter(QTextStream & ts, QString line) +void Font::ParseCharacter(QTextStream & ts, QString line) { // Unicode character: QChar ch; @@ -213,7 +213,7 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) } // Create new letter: - RS_FontChar * letter = new RS_FontChar(NULL, ch, Vector(0.0, 0.0)); + FontChar * letter = new FontChar(NULL, ch, Vector(0.0, 0.0)); // Read entities of this letter: line = ts.readLine(); @@ -229,9 +229,9 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) double x2 = (*it2++).toDouble(); double y2 = (*it2).toDouble(); - RS_LineData ld(Vector(x1, y1), Vector(x2, y2)); - RS_Line * line = new RS_Line(letter, ld); - line->setPen(RS_Pen(RS2::FlagInvalid)); + LineData ld(Vector(x1, y1), Vector(x2, y2)); + Line * line = new Line(letter, ld); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); letter->addEntity(line); } @@ -244,9 +244,9 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) double a2 = (*it2).toDouble() / ARAD; bool reversed = (line.at(1) == 'R'); - RS_ArcData ad(Vector(cx, cy), r, a1, a2, reversed); - RS_Arc * arc = new RS_Arc(letter, ad); - arc->setPen(RS_Pen(RS2::FlagInvalid)); + ArcData ad(Vector(cx, cy), r, a1, a2, reversed); + Arc * arc = new Arc(letter, ad); + arc->setPen(Pen(RS2::FlagInvalid)); arc->setLayer(NULL); letter->addEntity(arc); } @@ -259,22 +259,22 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) } // Wrappers for block list (letters) functions -RS_BlockList * RS_Font::getLetterList() +BlockList * Font::getLetterList() { return &letterList; } -RS_Block * RS_Font::findLetter(const QString & name) +Block * Font::findLetter(const QString & name) { return letterList.find(name); } -uint RS_Font::countLetters() +uint Font::countLetters() { return letterList.count(); } -RS_Block * RS_Font::letterAt(uint i) +Block * Font::letterAt(uint i) { return letterList.at(i); } @@ -282,9 +282,9 @@ RS_Block * RS_Font::letterAt(uint i) /** * Dumps the fonts data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Font & f) +std::ostream & operator<<(std::ostream & os, const Font & f) { os << " Font file name: " << f.getFileName().toLatin1().data() << "\n"; - //<< (RS_BlockList&)f << "\n"; + //<< (BlockList&)f << "\n"; return os; } diff --git a/src/base/font.h b/src/base/font.h index f47d0cf..f2e1bbf 100644 --- a/src/base/font.h +++ b/src/base/font.h @@ -12,12 +12,12 @@ * * @author Andrew Mustun */ -class RS_Font +class Font { - friend class RS_FontList; + friend class FontList; public: - RS_Font(const QString & name, bool owner = true); + Font(const QString & name, bool owner = true); QString getFileName() const; QString getEncoding() const; @@ -29,12 +29,12 @@ class RS_Font bool loadFont(); // Wrappers for block list (letters) functions - RS_BlockList * getLetterList(); - RS_Block * findLetter(const QString & name); + BlockList * getLetterList(); + Block * findLetter(const QString & name); uint countLetters(); - RS_Block * letterAt(uint i); + Block * letterAt(uint i); - friend std::ostream & operator<<(std::ostream & os, const RS_Font & l); + friend std::ostream & operator<<(std::ostream & os, const Font & l); #if 1 private: @@ -44,7 +44,7 @@ class RS_Font private: //! block list (letters) - RS_BlockList letterList; + BlockList letterList; //! Font file name QString fileName; //! Font encoding (see docu for QTextCodec) diff --git a/src/base/fontchar.h b/src/base/fontchar.h index df74ae5..40b84ea 100644 --- a/src/base/fontchar.h +++ b/src/base/fontchar.h @@ -8,7 +8,7 @@ * * @author Andrew Mustun */ -class RS_FontChar: public RS_Block +class FontChar: public Block { public: /** @@ -17,10 +17,10 @@ public: * an identifier. * @param basePoint Base point (offset) of the letter (usually 0/0). */ - RS_FontChar(RS_EntityContainer * parent, const QString & name, Vector basePoint): - RS_Block(parent, RS_BlockData(name, basePoint, false)) {} + FontChar(EntityContainer * parent, const QString & name, Vector basePoint): + Block(parent, BlockData(name, basePoint, false)) {} - virtual ~RS_FontChar() {} + virtual ~FontChar() {} /** @return RS2::EntityFontChar */ virtual RS2::EntityType rtti() const @@ -28,9 +28,9 @@ public: return RS2::EntityFontChar; } - /*friend std::ostream& operator << (std::ostream& os, const RS_FontChar& b) { + /*friend std::ostream& operator << (std::ostream& os, const FontChar& b) { os << " name: " << b.getName().latin1() << "\n"; - os << " entities: " << (RS_EntityContainer&)b << "\n"; + os << " entities: " << (EntityContainer&)b << "\n"; return os; }*/ protected: diff --git a/src/base/fontlist.cpp b/src/base/fontlist.cpp index 80527a4..2c1b742 100644 --- a/src/base/fontlist.cpp +++ b/src/base/fontlist.cpp @@ -22,12 +22,12 @@ //[DONE] #warning "!!! NEED TO FIX ITERATORS IN THIS CLASS !!!" -RS_FontList * RS_FontList::uniqueInstance = NULL; +FontList * FontList::uniqueInstance = NULL; /** * Default constructor. */ -RS_FontList::RS_FontList(): fontIterator(fonts) +FontList::FontList(): fontIterator(fonts) { //Dealt with here... //#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" @@ -35,61 +35,61 @@ RS_FontList::RS_FontList(): fontIterator(fonts) //fontListListeners.setAutoDelete(false); } -/*static*/ RS_FontList * RS_FontList::instance() +/*static*/ FontList * FontList::instance() { if (uniqueInstance == NULL) - uniqueInstance = new RS_FontList(); + uniqueInstance = new FontList(); return uniqueInstance; } -RS_FontList::~RS_FontList() +FontList::~FontList() { clearFonts(); } /** - * Initializes the font list by creating empty RS_Font + * Initializes the font list by creating empty Font * objects, one for each font that could be found. */ -void RS_FontList::init() +void FontList::init() { - RS_DEBUG->print("RS_FontList::initFonts"); + DEBUG->print("FontList::initFonts"); - QStringList list = RS_SYSTEM->getFontList(); + QStringList list = SYSTEM->getFontList(); // Q3Dict added; //used to remeber added fonts (avoid duplication) QMultiHash added; //used to remeber added fonts (avoid duplication) for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it) { - RS_DEBUG->print("font: %s:", (*it).toLatin1().data()); -//printf("RS_FontList::init(): font: %s:\n", (*it).toLatin1().data()); + DEBUG->print("font: %s:", (*it).toLatin1().data()); +//printf("FontList::init(): font: %s:\n", (*it).toLatin1().data()); QFileInfo fi(*it); // if (!added[fi.baseName()]) if (added.value(fi.baseName()) == 0) { - RS_Font * font = new RS_Font(fi.baseName()); + Font * font = new Font(fi.baseName()); fonts.append(font); added.insert(fi.baseName(), (char *)1); } - RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data()); + DEBUG->print("base: %s", fi.baseName().toLatin1().data()); } } /** * Removes all fonts in the fontlist. */ -void RS_FontList::clearFonts() +void FontList::clearFonts() { // fonts.clear(); while (!fonts.isEmpty()) delete fonts.takeFirst(); } -int RS_FontList::countFonts() +int FontList::countFonts() { return fonts.count(); } @@ -99,9 +99,9 @@ int RS_FontList::countFonts() * Listeners are notified after the font was removed from * the list but before it gets deleted. */ -void RS_FontList::removeFont(RS_Font * font) +void FontList::removeFont(Font * font) { - RS_DEBUG->print("RS_FontList::removeFont()"); + DEBUG->print("FontList::removeFont()"); // here the font is removed from the list but not deleted // fonts.remove(font); @@ -113,7 +113,7 @@ void RS_FontList::removeFont(RS_Font * font) delete fonts.takeAt(i); //for (uint i=0; ifontRemoved(font); //} } @@ -123,12 +123,12 @@ void RS_FontList::removeFont(RS_Font * font) * \p NULL if no such font was found. The font will be loaded into * memory if it's not already. */ -RS_Font * RS_FontList::requestFont(const QString & name) +Font * FontList::requestFont(const QString & name) { - RS_DEBUG->print("RS_FontList::requestFont %s", name.toLatin1().data()); + DEBUG->print("FontList::requestFont %s", name.toLatin1().data()); QString name2 = name.toLower(); - RS_Font * foundFont = NULL; + Font * foundFont = NULL; // QCad 1 compatibility: if (name2.contains('#') && name2.contains('_')) @@ -138,13 +138,13 @@ RS_Font * RS_FontList::requestFont(const QString & name) // name2 = name2.left(name2.find('#')); name2 = name2.left(name2.indexOf('#')); - RS_DEBUG->print("name2: %s", name2.toLatin1().data()); + DEBUG->print("name2: %s", name2.toLatin1().data()); // Search our list of available fonts: -// for(RS_Font * f=fonts.first(); f!=NULL; f=fonts.next()) +// for(Font * f=fonts.first(); f!=NULL; f=fonts.next()) for(int i=0; igetFileName() == name2) { @@ -162,7 +162,7 @@ RS_Font * RS_FontList::requestFont(const QString & name) } //! @return First font of the list. -RS_Font * RS_FontList::firstFont() +Font * FontList::firstFont() { // return fonts.first(); // fontIterator.toFront(); @@ -176,7 +176,7 @@ RS_Font * RS_FontList::firstFont() * @return Next font from the list after * calling firstFont() or nextFont(). */ -RS_Font * RS_FontList::nextFont() +Font * FontList::nextFont() { // return fonts.next(); // return fontIterator.next(); @@ -186,11 +186,11 @@ RS_Font * RS_FontList::nextFont() /** * Dumps the fonts to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_FontList & l) +std::ostream & operator<<(std::ostream & os, FontList & l) { os << "Fontlist: \n"; - for(RS_Font * f=l.firstFont(); f!=NULL; f=l.nextFont()) + for(Font * f=l.firstFont(); f!=NULL; f=l.nextFont()) os << *f << "\n"; return os; diff --git a/src/base/fontlist.h b/src/base/fontlist.h index 4030493..29d1dc0 100644 --- a/src/base/fontlist.h +++ b/src/base/fontlist.h @@ -3,47 +3,47 @@ #include -#define RS_FONTLIST RS_FontList::instance() +#define FONTLIST FontList::instance() -class RS_Font; +class Font; /** * The global list of fonts. This is implemented as a singleton. - * Use RS_FontList::instance() to get a pointer to the object. + * Use FontList::instance() to get a pointer to the object. * * @author James Hammons * @author Andrew Mustun */ -class RS_FontList +class FontList { protected: - RS_FontList(); + FontList(); public: /** * @return Instance to the unique font list. */ - static RS_FontList * instance(); + static FontList * instance(); - virtual ~RS_FontList(); + virtual ~FontList(); void init(); void clearFonts(); int countFonts(); - virtual void removeFont(RS_Font * font); - RS_Font * requestFont(const QString & name); - RS_Font * firstFont(); - RS_Font * nextFont(); + virtual void removeFont(Font * font); + Font * requestFont(const QString & name); + Font * firstFont(); + Font * nextFont(); - friend std::ostream & operator<<(std::ostream & os, RS_FontList & l); + friend std::ostream & operator<<(std::ostream & os, FontList & l); protected: - static RS_FontList * uniqueInstance; + static FontList * uniqueInstance; private: //! fonts in the graphic - QList fonts; - QListIterator fontIterator; + QList fonts; + QListIterator fontIterator; }; #endif // __FONTLIST_H__ diff --git a/src/base/grid.cpp b/src/base/grid.cpp index d6e5fbd..163a12b 100644 --- a/src/base/grid.cpp +++ b/src/base/grid.cpp @@ -18,26 +18,15 @@ #include "drawing.h" #include "graphicview.h" -//#include "graphicview.h" #include "settings.h" #include "units.h" #include "vector.h" #warning "!!! Clean out all references to RS_GraphicView here and in header !!!" -#if 0 /** * Constructor. */ -RS_Grid::RS_Grid(RS_GraphicView * gv): graphicView(gv), pt(NULL), number(0), - metaX(NULL), numMetaX(0), metaY(NULL), numMetaY(0) -{ -} -#endif - -/** - * Constructor II. - */ -RS_Grid::RS_Grid(GraphicView * gv): graphicView(gv), pt(NULL), number(0), +Grid::Grid(GraphicView * gv): graphicView(gv), pt(NULL), number(0), metaX(NULL), numMetaX(0), metaY(NULL), numMetaY(0) { } @@ -45,7 +34,7 @@ RS_Grid::RS_Grid(GraphicView * gv): graphicView(gv), pt(NULL), number(0), /** * Destructor. */ -RS_Grid::~RS_Grid() +Grid::~Grid() { if (pt != NULL) delete[] pt; @@ -60,9 +49,9 @@ RS_Grid::~RS_Grid() /** * Updates the grid point array. */ -void RS_Grid::update() +void Grid::update() { - RS_DEBUG->print("RS_Grid::update"); + DEBUG->print("Grid::update"); if (!graphicView->isGridOn()) return; @@ -104,7 +93,7 @@ void RS_Grid::update() numMetaX = 0; numMetaY = 0; - RS_DEBUG->print("RS_Grid::update: 001"); + DEBUG->print("Grid::update: 001"); // find out unit: RS2::Unit unit = RS2::None; @@ -119,11 +108,11 @@ void RS_Grid::update() Vector gridWidth; Vector metaGridWidth; - RS_DEBUG->print("RS_Grid::update: 002"); + DEBUG->print("Grid::update: 002"); // init grid spacing: // metric grid: - if (RS_Units::isMetric(unit) || unit == RS2::None + if (Units::isMetric(unit) || unit == RS2::None || format == RS2::Decimal || format == RS2::Engineering) { if (userGrid.x > 0.0) @@ -136,7 +125,7 @@ void RS_Grid::update() else gridWidth.y = 0.000001; - RS_DEBUG->print("RS_Grid::update: 003"); + DEBUG->print("Grid::update: 003"); // auto scale grid if (scaleGrid) @@ -151,12 +140,12 @@ void RS_Grid::update() metaGridWidth.x = gridWidth.x * 10; metaGridWidth.y = gridWidth.y * 10; - RS_DEBUG->print("RS_Grid::update: 004"); + DEBUG->print("Grid::update: 004"); } // imperial grid: else { - RS_DEBUG->print("RS_Grid::update: 005"); + DEBUG->print("Grid::update: 005"); if (userGrid.x > 0.0) gridWidth.x = userGrid.x; @@ -168,30 +157,30 @@ void RS_Grid::update() else gridWidth.y = 1.0 / 1024.0; - RS_DEBUG->print("RS_Grid::update: 006"); + DEBUG->print("Grid::update: 006"); if (unit == RS2::Inch) { - RS_DEBUG->print("RS_Grid::update: 007"); + DEBUG->print("Grid::update: 007"); // auto scale grid if (scaleGrid) { while (graphicView->toGuiDX(gridWidth.x) < minGridSpacing) { - if (RS_Math::round(gridWidth.x) >= 36) + if (Math::round(gridWidth.x) >= 36) { gridWidth.x *= 2; } - else if (RS_Math::round(gridWidth.x) >= 12) + else if (Math::round(gridWidth.x) >= 12) { gridWidth.x *= 3; } - else if (RS_Math::round(gridWidth.x) >= 4) + else if (Math::round(gridWidth.x) >= 4) { gridWidth.x *= 3; } - else if (RS_Math::round(gridWidth.x) >= 1) + else if (Math::round(gridWidth.x) >= 1) { gridWidth.x *= 2; } @@ -203,19 +192,19 @@ void RS_Grid::update() while (graphicView->toGuiDY(gridWidth.y) < minGridSpacing) { - if (RS_Math::round(gridWidth.y) >= 36) + if (Math::round(gridWidth.y) >= 36) { gridWidth.y *= 2; } - else if (RS_Math::round(gridWidth.y) >= 12) + else if (Math::round(gridWidth.y) >= 12) { gridWidth.y *= 3; } - else if (RS_Math::round(gridWidth.y) >= 4) + else if (Math::round(gridWidth.y) >= 4) { gridWidth.y *= 3; } - else if (RS_Math::round(gridWidth.y) >= 1) + else if (Math::round(gridWidth.y) >= 1) { gridWidth.y *= 2; } @@ -226,7 +215,7 @@ void RS_Grid::update() } } - RS_DEBUG->print("RS_Grid::update: 008"); + DEBUG->print("Grid::update: 008"); // metagrid X shows inches.. metaGridWidth.x = 1.0; @@ -253,7 +242,7 @@ void RS_Grid::update() } } - RS_DEBUG->print("RS_Grid::update: 009"); + DEBUG->print("Grid::update: 009"); // metagrid Y shows inches.. metaGridWidth.y = 1.0; @@ -282,11 +271,11 @@ void RS_Grid::update() } } - RS_DEBUG->print("RS_Grid::update: 010"); + DEBUG->print("Grid::update: 010"); } else { - RS_DEBUG->print("RS_Grid::update: 011"); + DEBUG->print("Grid::update: 011"); if (scaleGrid) { @@ -304,13 +293,13 @@ void RS_Grid::update() metaGridWidth.y = -1.0; } - RS_DEBUG->print("RS_Grid::update: 012"); + DEBUG->print("Grid::update: 012"); } //gridWidth.y = gridWidth.x; //metaGridWidth.y = metaGridWidth.x; } - RS_DEBUG->print("RS_Grid::update: 013"); + DEBUG->print("Grid::update: 013"); // for grid info: spacing = gridWidth.x; @@ -338,11 +327,11 @@ void RS_Grid::update() bottom -= gridWidth.y; // calculate number of visible grid points - int numberX = (RS_Math::round((right-left) / gridWidth.x) + 1); - int numberY = (RS_Math::round((top-bottom) / gridWidth.y) + 1); + int numberX = (Math::round((right-left) / gridWidth.x) + 1); + int numberY = (Math::round((top-bottom) / gridWidth.y) + 1); number = numberX * numberY; - RS_DEBUG->print("RS_Grid::update: 014"); + DEBUG->print("Grid::update: 014"); // create grid array: if (number > 0 && number < 1000000) @@ -364,7 +353,7 @@ void RS_Grid::update() pt = NULL; } - RS_DEBUG->print("RS_Grid::update: 015"); + DEBUG->print("Grid::update: 015"); } // find meta grid boundaries @@ -387,8 +376,8 @@ void RS_Grid::update() mbottom -= metaGridWidth.y; // calculate number of visible meta grid lines: - numMetaX = (RS_Math::round((mright - mleft) / metaGridWidth.x) + 1); - numMetaY = (RS_Math::round((mtop - mbottom) / metaGridWidth.y) + 1); + numMetaX = (Math::round((mright - mleft) / metaGridWidth.x) + 1); + numMetaY = (Math::round((mtop - mbottom) / metaGridWidth.y) + 1); if (numMetaX > 0 && numMetaY > 0) { @@ -415,13 +404,13 @@ void RS_Grid::update() } } - RS_DEBUG->print("RS_Grid::update: OK"); + DEBUG->print("Grid::update: OK"); } /** * @return Array of all visible grid points. */ -Vector * RS_Grid::getPoints() +Vector * Grid::getPoints() { return pt; } @@ -429,7 +418,7 @@ Vector * RS_Grid::getPoints() /** * @return Number of visible grid points. */ -int RS_Grid::count() +int Grid::count() { return number; } @@ -437,7 +426,7 @@ int RS_Grid::count() /** * @return Grid info for status widget. */ -QString RS_Grid::getInfo() +QString Grid::getInfo() { return QString("%1 / %2").arg(spacing).arg(metaSpacing); } @@ -445,7 +434,7 @@ QString RS_Grid::getInfo() /** * @return Meta grid positions in X. */ -double * RS_Grid::getMetaX() +double * Grid::getMetaX() { return metaX; } @@ -453,7 +442,7 @@ double * RS_Grid::getMetaX() /** * @return Number of visible meta grid lines in X. */ -int RS_Grid::countMetaX() +int Grid::countMetaX() { return numMetaX; } @@ -461,7 +450,7 @@ int RS_Grid::countMetaX() /** * @return Meta grid positions in Y. */ -double * RS_Grid::getMetaY() +double * Grid::getMetaY() { return metaY; } @@ -469,7 +458,7 @@ double * RS_Grid::getMetaY() /** * @return Number of visible meta grid lines in Y. */ -int RS_Grid::countMetaY() +int Grid::countMetaY() { return numMetaY; } diff --git a/src/base/grid.h b/src/base/grid.h index 62c2808..b037bf0 100644 --- a/src/base/grid.h +++ b/src/base/grid.h @@ -13,12 +13,12 @@ class Vector; * * @author Andrew Mustun */ -class RS_Grid +class Grid { public: -// RS_Grid(RS_GraphicView *); - RS_Grid(GraphicView *); - ~RS_Grid(); +// Grid(RS_GraphicView *); + Grid(GraphicView *); + ~Grid(); void update(); diff --git a/src/base/hatch.cpp b/src/base/hatch.cpp index 1ff0902..f7442de 100644 --- a/src/base/hatch.cpp +++ b/src/base/hatch.cpp @@ -27,21 +27,21 @@ /** * Constructor. */ -RS_Hatch::RS_Hatch(RS_EntityContainer * parent, const RS_HatchData & d): - RS_EntityContainer(parent), data(d) +Hatch::Hatch(EntityContainer * parent, const HatchData & d): + EntityContainer(parent), data(d) { hatch = NULL; updateRunning = false; needOptimization = true; } -/*virtual*/ RS_Hatch::~RS_Hatch() +/*virtual*/ Hatch::~Hatch() { } -RS_Entity * RS_Hatch::clone() +Entity * Hatch::clone() { - RS_Hatch * t = new RS_Hatch(*this); + Hatch * t = new Hatch(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // t->entities.setAutoDelete(entities.autoDelete()); t->initId(); @@ -51,7 +51,7 @@ RS_Entity * RS_Hatch::clone() } /** @return RS2::EntityHatch */ -/*virtual*/ RS2::EntityType RS_Hatch::rtti() const +/*virtual*/ RS2::EntityType Hatch::rtti() const { return RS2::EntityHatch; } @@ -60,7 +60,7 @@ RS_Entity * RS_Hatch::clone() * @return true: if this is a hatch with lines (hatch pattern), * false: if this is filled with a solid color. */ -/*virtual*/ bool RS_Hatch::isContainer() const +/*virtual*/ bool Hatch::isContainer() const { if (isSolid()) return false; @@ -69,7 +69,7 @@ RS_Entity * RS_Hatch::clone() } /** @return Copy of data that defines the hatch. */ -RS_HatchData RS_Hatch::getData() const +HatchData Hatch::getData() const { return data; } @@ -77,16 +77,16 @@ RS_HatchData RS_Hatch::getData() const /** * Validates the hatch. */ -bool RS_Hatch::validate() +bool Hatch::validate() { bool ret = true; // loops: - for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) + for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) { if (l->rtti() == RS2::EntityContainer) { - RS_EntityContainer * loop = (RS_EntityContainer *)l; + EntityContainer * loop = (EntityContainer *)l; ret = loop->optimizeContours() && ret; } } @@ -97,7 +97,7 @@ bool RS_Hatch::validate() /** * @return Number of loops. */ -int RS_Hatch::countLoops() +int Hatch::countLoops() { if (data.solid) return count(); @@ -106,42 +106,42 @@ int RS_Hatch::countLoops() } /** @return true if this is a solid fill. false if it is a pattern hatch. */ -bool RS_Hatch::isSolid() const +bool Hatch::isSolid() const { return data.solid; } -void RS_Hatch::setSolid(bool solid) +void Hatch::setSolid(bool solid) { data.solid = solid; } -QString RS_Hatch::getPattern() +QString Hatch::getPattern() { return data.pattern; } -void RS_Hatch::setPattern(const QString & pattern) +void Hatch::setPattern(const QString & pattern) { data.pattern = pattern; } -double RS_Hatch::getScale() +double Hatch::getScale() { return data.scale; } -void RS_Hatch::setScale(double scale) +void Hatch::setScale(double scale) { data.scale = scale; } -double RS_Hatch::getAngle() +double Hatch::getAngle() { return data.angle; } -void RS_Hatch::setAngle(double angle) +void Hatch::setAngle(double angle) { data.angle = angle; } @@ -149,14 +149,14 @@ void RS_Hatch::setAngle(double angle) /** * Recalculates the borders of this hatch. */ -void RS_Hatch::calculateBorders() +void Hatch::calculateBorders() { - RS_DEBUG->print("RS_Hatch::calculateBorders"); + DEBUG->print("Hatch::calculateBorders"); activateContour(true); - RS_EntityContainer::calculateBorders(); + EntityContainer::calculateBorders(); - RS_DEBUG->print("RS_Hatch::calculateBorders: size: %f,%f", getSize().x, getSize().y); + DEBUG->print("Hatch::calculateBorders: size: %f,%f", getSize().x, getSize().y); activateContour(false); } @@ -165,10 +165,10 @@ void RS_Hatch::calculateBorders() * Updates the Hatch. Called when the * hatch or it's data, position, alignment, .. changes. */ -void RS_Hatch::update() +void Hatch::update() { - RS_DEBUG->print("RS_Hatch::update"); - RS_DEBUG->print("RS_Hatch::update: contour has %d loops", count()); + DEBUG->print("Hatch::update"); + DEBUG->print("Hatch::update: contour has %d loops", count()); if (updateRunning) return; @@ -179,7 +179,7 @@ void RS_Hatch::update() if (data.solid == true) return; - RS_DEBUG->print("RS_Hatch::update"); + DEBUG->print("Hatch::update"); updateRunning = true; // delete old hatch: @@ -197,39 +197,39 @@ void RS_Hatch::update() if (!validate()) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Hatch::update: invalid contour in hatch found"); + DEBUG->print(Debug::D_WARNING, "Hatch::update: invalid contour in hatch found"); updateRunning = false; return; } // search pattern: - RS_DEBUG->print("RS_Hatch::update: requesting pattern"); - RS_Pattern * pat = RS_PATTERNLIST->requestPattern(data.pattern); + DEBUG->print("Hatch::update: requesting pattern"); + Pattern * pat = PATTERNLIST->requestPattern(data.pattern); if (pat == NULL) { updateRunning = false; - RS_DEBUG->print("RS_Hatch::update: requesting pattern: not found"); + DEBUG->print("Hatch::update: requesting pattern: not found"); return; } - RS_DEBUG->print("RS_Hatch::update: requesting pattern: OK"); + DEBUG->print("Hatch::update: requesting pattern: OK"); - RS_DEBUG->print("RS_Hatch::update: cloning pattern"); - pat = (RS_Pattern*)pat->clone(); - RS_DEBUG->print("RS_Hatch::update: cloning pattern: OK"); + DEBUG->print("Hatch::update: cloning pattern"); + pat = (Pattern*)pat->clone(); + DEBUG->print("Hatch::update: cloning pattern: OK"); // scale pattern - RS_DEBUG->print("RS_Hatch::update: scaling pattern"); + DEBUG->print("Hatch::update: scaling pattern"); pat->scale(Vector(0.0,0.0), Vector(data.scale, data.scale)); pat->calculateBorders(); forcedCalculateBorders(); - RS_DEBUG->print("RS_Hatch::update: scaling pattern: OK"); + DEBUG->print("Hatch::update: scaling pattern: OK"); // find out how many pattern-instances we need in x/y: int px1, py1, px2, py2; double f; - RS_Hatch * copy = (RS_Hatch *)this->clone(); + Hatch * copy = (Hatch *)this->clone(); copy->rotate(Vector(0.0, 0.0), -data.angle); copy->forcedCalculateBorders(); @@ -238,8 +238,8 @@ void RS_Hatch::update() Vector cPos = getMin(); Vector cSize = getSize(); - RS_DEBUG->print("RS_Hatch::update: pattern size: %f/%f", pSize.x, pSize.y); - RS_DEBUG->print("RS_Hatch::update: contour size: %f/%f", cSize.x, cSize.y); + DEBUG->print("Hatch::update: pattern size: %f/%f", pSize.x, pSize.y); + DEBUG->print("Hatch::update: contour size: %f/%f", cSize.x, cSize.y); if (cSize.x < 1.0e-6 || cSize.y < 1.0e-6 || pSize.x < 1.0e-6 || pSize.y < 1.0e-6 || cSize.x > RS_MAXDOUBLE - 1 || cSize.y > RS_MAXDOUBLE - 1 @@ -248,13 +248,13 @@ void RS_Hatch::update() delete pat; delete copy; updateRunning = false; - RS_DEBUG->print("RS_Hatch::update: contour size or pattern size too small"); + DEBUG->print("Hatch::update: contour size or pattern size too small"); return; } // avoid huge memory consumption: else if (cSize.x / pSize.x > 100 || cSize.y / pSize.y > 100) { - RS_DEBUG->print("RS_Hatch::update: contour size too large or pattern size too small"); + DEBUG->print("Hatch::update: contour size too large or pattern size too small"); return; } @@ -267,18 +267,18 @@ void RS_Hatch::update() f = copy->getMax().y/pat->getSize().y; py2 = (int)ceil(f) - 1; - RS_EntityContainer tmp; // container for untrimmed lines + EntityContainer tmp; // container for untrimmed lines // adding array of patterns to tmp: - RS_DEBUG->print("RS_Hatch::update: creating pattern carpet"); + DEBUG->print("Hatch::update: creating pattern carpet"); for(int px=px1; px<=px2; px++) { for(int py=py1; py<=py2; py++) { - for(RS_Entity * e=pat->firstEntity(); e!=NULL; e=pat->nextEntity()) + for(Entity * e=pat->firstEntity(); e!=NULL; e=pat->nextEntity()) { - RS_Entity * te = e->clone(); + Entity * te = e->clone(); te->rotate(Vector(0.0, 0.0), data.angle); Vector v1, v2; v1.setPolar(px * pSize.x, data.angle); @@ -291,16 +291,16 @@ void RS_Hatch::update() delete pat; pat = NULL; - RS_DEBUG->print("RS_Hatch::update: creating pattern carpet: OK"); + DEBUG->print("Hatch::update: creating pattern carpet: OK"); - RS_DEBUG->print("RS_Hatch::update: cutting pattern carpet"); + DEBUG->print("Hatch::update: cutting pattern carpet"); // cut pattern to contour shape: - RS_EntityContainer tmp2; // container for small cut lines - RS_Line * line = NULL; - RS_Arc * arc = NULL; - RS_Circle * circle = NULL; + EntityContainer tmp2; // container for small cut lines + Line * line = NULL; + Arc * arc = NULL; + Circle * circle = NULL; - for(RS_Entity * e=tmp.firstEntity(); e!=NULL; e=tmp.nextEntity()) + for(Entity * e=tmp.firstEntity(); e!=NULL; e=tmp.nextEntity()) { Vector startPoint; Vector endPoint; @@ -309,7 +309,7 @@ void RS_Hatch::update() if (e->rtti() == RS2::EntityLine) { - line = (RS_Line *)e; + line = (Line *)e; arc = NULL; circle = NULL; startPoint = line->getStartpoint(); @@ -319,7 +319,7 @@ void RS_Hatch::update() } else if (e->rtti() == RS2::EntityArc) { - arc = (RS_Arc *)e; + arc = (Arc *)e; line = NULL; circle = NULL; startPoint = arc->getStartpoint(); @@ -329,7 +329,7 @@ void RS_Hatch::update() } else if (e->rtti() == RS2::EntityCircle) { - circle = (RS_Circle *)e; + circle = (Circle *)e; line = NULL; arc = NULL; startPoint = circle->getCenter() + Vector(circle->getRadius(), 0.0); @@ -348,20 +348,20 @@ void RS_Hatch::update() // is.setAutoDelete(true); is.append(new Vector(startPoint)); - for(RS_Entity * loop=firstEntity(); loop!=NULL; loop=nextEntity()) + for(Entity * loop=firstEntity(); loop!=NULL; loop=nextEntity()) { if (loop->isContainer()) { - for(RS_Entity * p=((RS_EntityContainer *)loop)->firstEntity(); p!=NULL; p=((RS_EntityContainer*)loop)->nextEntity()) + for(Entity * p=((EntityContainer *)loop)->firstEntity(); p!=NULL; p=((EntityContainer*)loop)->nextEntity()) { - VectorSolutions sol = RS_Information::getIntersection(e, p, true); + VectorSolutions sol = Information::getIntersection(e, p, true); for(int i=0; i<=1; ++i) { if (sol.get(i).valid) { is.append(new Vector(sol.get(i))); - RS_DEBUG->print(" pattern line intersection: %f/%f", sol.get(i).x, sol.get(i).y); + DEBUG->print(" pattern line intersection: %f/%f", sol.get(i).x, sol.get(i).y); } } } @@ -469,11 +469,11 @@ void RS_Hatch::update() { if (line != NULL) { - tmp2.addEntity(new RS_Line(&tmp2, RS_LineData(*v1, *v2))); + tmp2.addEntity(new Line(&tmp2, LineData(*v1, *v2))); } else if (arc != NULL || circle != NULL) { - tmp2.addEntity(new RS_Arc(&tmp2, RS_ArcData(center, center.distanceTo(*v1), + tmp2.addEntity(new Arc(&tmp2, ArcData(center, center.distanceTo(*v1), center.angleTo(*v1), center.angleTo(*v2), reversed))); } } @@ -483,30 +483,30 @@ void RS_Hatch::update() } // updating hatch / adding entities that are inside - RS_DEBUG->print("RS_Hatch::update: cutting pattern carpet: OK"); + DEBUG->print("Hatch::update: cutting pattern carpet: OK"); // the hatch pattern entities: - hatch = new RS_EntityContainer(this); - hatch->setPen(RS_Pen(RS2::FlagInvalid)); + hatch = new EntityContainer(this); + hatch->setPen(Pen(RS2::FlagInvalid)); hatch->setLayer(NULL); hatch->setFlag(RS2::FlagTemp); //calculateBorders(); - for(RS_Entity * e=tmp2.firstEntity(); e!=NULL; e=tmp2.nextEntity()) + for(Entity * e=tmp2.firstEntity(); e!=NULL; e=tmp2.nextEntity()) { Vector middlePoint; Vector middlePoint2; if (e->rtti() == RS2::EntityLine) { - RS_Line * line = (RS_Line *)e; + Line * line = (Line *)e; middlePoint = line->getMiddlepoint(); middlePoint2 = line->getNearestDist(line->getLength() / 2.1, line->getStartpoint()); } else if (e->rtti() == RS2::EntityArc) { - RS_Arc * arc = (RS_Arc *)e; + Arc * arc = (Arc *)e; middlePoint = arc->getMiddlepoint(); middlePoint2 = arc->getNearestDist(arc->getLength() / 2.1, arc->getStartpoint()); } @@ -520,11 +520,11 @@ void RS_Hatch::update() { bool onContour = false; - if (RS_Information::isPointInsideContour(middlePoint, this, &onContour) - || RS_Information::isPointInsideContour(middlePoint2, this)) + if (Information::isPointInsideContour(middlePoint, this, &onContour) + || Information::isPointInsideContour(middlePoint2, this)) { - RS_Entity * te = e->clone(); - te->setPen(RS_Pen(RS2::FlagInvalid)); + Entity * te = e->clone(); + te->setPen(Pen(RS2::FlagInvalid)); te->setLayer(NULL); te->reparent(hatch); hatch->addEntity(te); @@ -542,47 +542,47 @@ void RS_Hatch::update() updateRunning = false; - RS_DEBUG->print("RS_Hatch::update: OK"); + DEBUG->print("Hatch::update: OK"); } /** * Activates of deactivates the hatch boundary. */ -void RS_Hatch::activateContour(bool on) +void Hatch::activateContour(bool on) { - RS_DEBUG->print("RS_Hatch::activateContour: %d", (int)on); + DEBUG->print("Hatch::activateContour: %d", (int)on); - for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity()) + for(Entity * e=firstEntity(); e!=NULL; e=nextEntity()) { if (!e->isUndone()) { if (!e->getFlag(RS2::FlagTemp)) { - RS_DEBUG->print("RS_Hatch::activateContour: set visible"); + DEBUG->print("Hatch::activateContour: set visible"); e->setVisible(on); } else { - RS_DEBUG->print("RS_Hatch::activateContour: entity temp"); + DEBUG->print("Hatch::activateContour: entity temp"); } } else { - RS_DEBUG->print("RS_Hatch::activateContour: entity undone"); + DEBUG->print("Hatch::activateContour: entity undone"); } } - RS_DEBUG->print("RS_Hatch::activateContour: OK"); + DEBUG->print("Hatch::activateContour: OK"); } /** * Overrides drawing of subentities. This is only ever called for solid fills. */ -void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (!data.solid) { - for(RS_Entity * se=firstEntity(); se!=NULL; se = nextEntity()) + for(Entity * se=firstEntity(); se!=NULL; se = nextEntity()) view->drawEntity(se); return; @@ -601,11 +601,11 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte // loops: if (needOptimization == true) { - for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) + for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) { if (l->rtti() == RS2::EntityContainer) { - RS_EntityContainer * loop = (RS_EntityContainer *)l; + EntityContainer * loop = (EntityContainer *)l; loop->optimizeContours(); } } @@ -614,16 +614,16 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte } // loops: - for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) + for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone)) { l->setLayer(getLayer()); if (l->rtti() == RS2::EntityContainer) { - RS_EntityContainer * loop = (RS_EntityContainer *)l; + EntityContainer * loop = (EntityContainer *)l; // edges: - for(RS_Entity * e=loop->firstEntity(RS2::ResolveNone); e!=NULL; e=loop->nextEntity(RS2::ResolveNone)) + for(Entity * e=loop->firstEntity(RS2::ResolveNone); e!=NULL; e=loop->nextEntity(RS2::ResolveNone)) { e->setLayer(getLayer()); @@ -631,12 +631,12 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte { case RS2::EntityLine: { - RS_Line * line = (RS_Line *)e; + Line * line = (Line *)e; - int x1 = RS_Math::round(view->toGuiX(line->getStartpoint().x)); - int y1 = RS_Math::round(view->toGuiY(line->getStartpoint().y)); - int x2 = RS_Math::round(view->toGuiX(line->getEndpoint().x)); - int y2 = RS_Math::round(view->toGuiY(line->getEndpoint().y)); + int x1 = Math::round(view->toGuiX(line->getStartpoint().x)); + int y1 = Math::round(view->toGuiY(line->getStartpoint().y)); + int x2 = Math::round(view->toGuiX(line->getEndpoint().x)); + int y2 = Math::round(view->toGuiY(line->getEndpoint().y)); if (lastValid && (lastX != x1 || lastY != y1)) { @@ -658,12 +658,12 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte case RS2::EntityArc: { - RS_Arc * arc = (RS_Arc *)e; + Arc * arc = (Arc *)e; - int x1 = RS_Math::round(view->toGuiX(arc->getStartpoint().x)); - int y1 = RS_Math::round(view->toGuiY(arc->getStartpoint().y)); - int x2 = RS_Math::round(view->toGuiX(arc->getEndpoint().x)); - int y2 = RS_Math::round(view->toGuiY(arc->getEndpoint().y)); + int x1 = Math::round(view->toGuiX(arc->getStartpoint().x)); + int y1 = Math::round(view->toGuiY(arc->getStartpoint().y)); + int x2 = Math::round(view->toGuiX(arc->getEndpoint().x)); + int y2 = Math::round(view->toGuiY(arc->getEndpoint().y)); if (lastValid && (lastX != x1 || lastY != y1)) { @@ -695,10 +695,10 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte case RS2::EntityCircle: { - RS_Circle * circle = (RS_Circle *)e; + Circle * circle = (Circle *)e; - int x1 = RS_Math::round(view->toGuiX(circle->getCenter().x + circle->getRadius())); - int y1 = RS_Math::round(view->toGuiY(circle->getCenter().y)); + int x1 = Math::round(view->toGuiX(circle->getCenter().x + circle->getRadius())); + int y1 = Math::round(view->toGuiY(circle->getCenter().y)); int x2 = x1; int y2 = y1; @@ -747,12 +747,12 @@ void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patte painter->drawPolygon(pa); } -/*virtual*/ double RS_Hatch::getLength() +/*virtual*/ double Hatch::getLength() { return -1.0; } -double RS_Hatch::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, +double Hatch::getDistanceToPoint(const Vector & coord, Entity ** entity, RS2::ResolveLevel level, double solidDist) { if (data.solid == true) @@ -762,7 +762,7 @@ double RS_Hatch::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, bool onContour; - if (RS_Information::isPointInsideContour(coord, this, &onContour)) + if (Information::isPointInsideContour(coord, this, &onContour)) // distance is the snap range: return solidDist; @@ -770,48 +770,48 @@ double RS_Hatch::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, } else { - return RS_EntityContainer::getDistanceToPoint(coord, entity, level, solidDist); + return EntityContainer::getDistanceToPoint(coord, entity, level, solidDist); } } -void RS_Hatch::move(Vector offset) +void Hatch::move(Vector offset) { - RS_EntityContainer::move(offset); + EntityContainer::move(offset); update(); } -void RS_Hatch::rotate(Vector center, double angle) +void Hatch::rotate(Vector center, double angle) { - RS_EntityContainer::rotate(center, angle); - data.angle = RS_Math::correctAngle(data.angle + angle); + EntityContainer::rotate(center, angle); + data.angle = Math::correctAngle(data.angle + angle); update(); } -void RS_Hatch::scale(Vector center, Vector factor) +void Hatch::scale(Vector center, Vector factor) { - RS_EntityContainer::scale(center, factor); + EntityContainer::scale(center, factor); data.scale *= factor.x; update(); } -void RS_Hatch::mirror(Vector axisPoint1, Vector axisPoint2) +void Hatch::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_EntityContainer::mirror(axisPoint1, axisPoint2); + EntityContainer::mirror(axisPoint1, axisPoint2); double ang = axisPoint1.angleTo(axisPoint2); - data.angle = RS_Math::correctAngle(data.angle + ang*2.0); + data.angle = Math::correctAngle(data.angle + ang*2.0); update(); } -void RS_Hatch::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Hatch::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { - RS_EntityContainer::stretch(firstCorner, secondCorner, offset); + EntityContainer::stretch(firstCorner, secondCorner, offset); update(); } /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Hatch & p) +std::ostream & operator<<(std::ostream & os, const Hatch & p) { os << " Hatch: " << p.getData() << "\n"; return os; diff --git a/src/base/hatch.h b/src/base/hatch.h index 298f38c..6d1959b 100644 --- a/src/base/hatch.h +++ b/src/base/hatch.h @@ -7,20 +7,20 @@ /** * Holds the data that defines a hatch entity. */ -class RS_HatchData +class HatchData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_HatchData() {} + HatchData() {} /** * @param solid true: solid fill, false: pattern. * @param scale Pattern scale or spacing. * @param pattern Pattern name. */ - RS_HatchData(bool solid, double scale, double angle, const QString & pattern) + HatchData(bool solid, double scale, double angle, const QString & pattern) { this->solid = solid; this->scale = scale; @@ -30,7 +30,7 @@ class RS_HatchData //std::cout << "RS_H__atchData: " << pattern.latin1() << "\n"; } - friend std::ostream & operator<<(std::ostream & os, const RS_HatchData & td) + friend std::ostream & operator<<(std::ostream & os, const HatchData & td) { os << "(" << td.pattern.toAscii().data() << ")"; return os; @@ -49,16 +49,16 @@ class RS_HatchData * @author James Hammons * @author Andrew Mustun */ -class RS_Hatch: public RS_EntityContainer +class Hatch: public EntityContainer { public: - RS_Hatch(RS_EntityContainer * parent, const RS_HatchData & d); - virtual ~RS_Hatch(); + Hatch(EntityContainer * parent, const HatchData & d); + virtual ~Hatch(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual bool isContainer() const; - RS_HatchData getData() const; + HatchData getData() const; bool validate(); int countLoops(); @@ -77,7 +77,7 @@ class RS_Hatch: public RS_EntityContainer void activateContour(bool on); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); virtual double getLength(); - virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, + virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual void move(Vector offset); virtual void rotate(Vector center, double angle); @@ -85,11 +85,11 @@ class RS_Hatch: public RS_EntityContainer virtual void mirror(Vector axisPoint1, Vector axisPoint2); virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); - friend std::ostream & operator<<(std::ostream & os, const RS_Hatch & p); + friend std::ostream & operator<<(std::ostream & os, const Hatch & p); protected: - RS_HatchData data; - RS_EntityContainer * hatch; + HatchData data; + EntityContainer * hatch; bool updateRunning; bool needOptimization; }; diff --git a/src/base/image.cpp b/src/base/image.cpp index fa493ec..202bd9a 100644 --- a/src/base/image.cpp +++ b/src/base/image.cpp @@ -25,8 +25,8 @@ /** * Constructor. */ -RS_Image::RS_Image(RS_EntityContainer * parent, const RS_ImageData & d): - RS_AtomicEntity(parent), data(d) +Image::Image(EntityContainer * parent, const ImageData & d): + AtomicEntity(parent), data(d) { update(); calculateBorders(); @@ -35,16 +35,16 @@ RS_Image::RS_Image(RS_EntityContainer * parent, const RS_ImageData & d): /** * Destructor. */ -RS_Image::~RS_Image() +Image::~Image() { /*if (img!=NULL) { delete[] img; }*/ } -RS_Entity * RS_Image::clone() +Entity * Image::clone() { - RS_Image * i = new RS_Image(*this); + Image * i = new Image(*this); i->setHandle(getHandle()); i->initId(); i->update(); @@ -52,14 +52,14 @@ RS_Entity * RS_Image::clone() } /** @return RS2::EntityImage */ -/*virtual*/ RS2::EntityType RS_Image::rtti() const +/*virtual*/ RS2::EntityType Image::rtti() const { return RS2::EntityImage; } -void RS_Image::update() +void Image::update() { - RS_DEBUG->print("RS_Image::update"); + DEBUG->print("Image::update"); // the whole image: //QImage image = QImage(data.file); @@ -68,7 +68,7 @@ void RS_Image::update() if (!img.isNull()) data.size = Vector(img.width(), img.height()); - RS_DEBUG->print("RS_Image::update: OK"); + DEBUG->print("Image::update: OK"); /* // number of small images: @@ -106,101 +106,101 @@ void RS_Image::update() } /** @return Copy of data that defines the image. */ -RS_ImageData RS_Image::getData() const +ImageData Image::getData() const { return data; } /** @return Insertion point of the entity */ -/*virtual*/ Vector RS_Image::getInsertionPoint() const +/*virtual*/ Vector Image::getInsertionPoint() const { return data.insertionPoint; } /** Sets the insertion point for the image. */ -void RS_Image::setInsertionPoint(Vector ip) +void Image::setInsertionPoint(Vector ip) { data.insertionPoint = ip; calculateBorders(); } /** @return File name of the image. */ -QString RS_Image::getFile() const +QString Image::getFile() const { return data.file; } /** Sets the file name of the image. */ -void RS_Image::setFile(const QString & file) +void Image::setFile(const QString & file) { data.file = file; } /** @return u Vector. Points along bottom, 1 pixel long. */ -Vector RS_Image::getUVector() const +Vector Image::getUVector() const { return data.uVector; } /** @return v Vector. Points along left, 1 pixel long. */ -Vector RS_Image::getVVector() const +Vector Image::getVVector() const { return data.vVector; } /** @return Width of image in pixels. */ -int RS_Image::getWidth() const +int Image::getWidth() const { return (int)data.size.x; } /** @return Height of image in pixels. */ -int RS_Image::getHeight() const +int Image::getHeight() const { return (int)data.size.y; } /** @return Brightness. */ -int RS_Image::getBrightness() const +int Image::getBrightness() const { return data.brightness; } /** @return Contrast. */ -int RS_Image::getContrast() const +int Image::getContrast() const { return data.contrast; } /** @return Fade. */ -int RS_Image::getFade() const +int Image::getFade() const { return data.fade; } /** @return Image definition handle. */ -int RS_Image::getHandle() const +int Image::getHandle() const { return data.handle; } /** Sets the image definition handle. */ -void RS_Image::setHandle(int h) +void Image::setHandle(int h) { data.handle = h; } /** @return The four corners. **/ -VectorSolutions RS_Image::getCorners() +VectorSolutions Image::getCorners() { VectorSolutions sol(4); sol.set(0, data.insertionPoint); sol.set(1, - data.insertionPoint + data.uVector * RS_Math::round(data.size.x)); + data.insertionPoint + data.uVector * Math::round(data.size.x)); sol.set(3, - data.insertionPoint + data.vVector * RS_Math::round(data.size.y)); - sol.set(2, sol.get(3) + data.uVector * RS_Math::round(data.size.x)); + data.insertionPoint + data.vVector * Math::round(data.size.y)); + sol.set(2, sol.get(3) + data.uVector * Math::round(data.size.x)); return sol; } @@ -208,7 +208,7 @@ VectorSolutions RS_Image::getCorners() /** * @return image with in graphic units. */ -double RS_Image::getImageWidth() +double Image::getImageWidth() { return data.size.x * data.uVector.magnitude(); } @@ -216,12 +216,12 @@ double RS_Image::getImageWidth() /** * @return image height in graphic units. */ -double RS_Image::getImageHeight() +double Image::getImageHeight() { return data.size.y * data.vVector.magnitude(); } -void RS_Image::calculateBorders() +void Image::calculateBorders() { resetBorders(); VectorSolutions sol = getCorners(); @@ -233,13 +233,13 @@ void RS_Image::calculateBorders() } } -Vector RS_Image::getNearestEndpoint(const Vector & coord, double * dist) +Vector Image::getNearestEndpoint(const Vector & coord, double * dist) { VectorSolutions corners = getCorners(); return corners.getClosest(coord, dist); } -Vector RS_Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity) +Vector Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity) { if (entity != NULL) *entity = this; @@ -247,11 +247,11 @@ Vector RS_Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, do VectorSolutions corners = getCorners(); VectorSolutions points(4); - RS_Line l[] = { - RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))), - RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))), - RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))), - RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0))) + Line l[] = { + Line(NULL, LineData(corners.get(0), corners.get(1))), + Line(NULL, LineData(corners.get(1), corners.get(2))), + Line(NULL, LineData(corners.get(2), corners.get(3))), + Line(NULL, LineData(corners.get(3), corners.get(0))) }; for (int i = 0; i < 4; ++i) @@ -260,7 +260,7 @@ Vector RS_Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, do return points.getClosest(coord, dist); } -Vector RS_Image::getNearestCenter(const Vector & coord, double * dist) +Vector Image::getNearestCenter(const Vector & coord, double * dist) { VectorSolutions points(4); VectorSolutions corners = getCorners(); @@ -273,22 +273,22 @@ Vector RS_Image::getNearestCenter(const Vector & coord, double * dist) return points.getClosest(coord, dist); } -Vector RS_Image::getNearestMiddle(const Vector & coord, double * dist) +Vector Image::getNearestMiddle(const Vector & coord, double * dist) { return getNearestCenter(coord, dist); } -Vector RS_Image::getNearestDist(double distance, const Vector & coord, double * dist) +Vector Image::getNearestDist(double distance, const Vector & coord, double * dist) { VectorSolutions corners = getCorners(); VectorSolutions points(4); - RS_Line l[] = + Line l[] = { - RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))), - RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))), - RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))), - RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0))) + Line(NULL, LineData(corners.get(0), corners.get(1))), + Line(NULL, LineData(corners.get(1), corners.get(2))), + Line(NULL, LineData(corners.get(2), corners.get(3))), + Line(NULL, LineData(corners.get(3), corners.get(0))) }; for (int i = 0; i < 4; ++i) @@ -297,7 +297,7 @@ Vector RS_Image::getNearestDist(double distance, const Vector & coord, double * return points.getClosest(coord, dist); } -double RS_Image::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel /*level*/, double /*solidDist*/) +double Image::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel /*level*/, double /*solidDist*/) { if (entity != NULL) *entity = this; @@ -306,12 +306,12 @@ double RS_Image::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, double dist; double minDist = RS_MAXDOUBLE; - RS_Line l[] = + Line l[] = { - RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))), - RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))), - RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))), - RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0))) + Line(NULL, LineData(corners.get(0), corners.get(1))), + Line(NULL, LineData(corners.get(1), corners.get(2))), + Line(NULL, LineData(corners.get(2), corners.get(3))), + Line(NULL, LineData(corners.get(3), corners.get(0))) }; for (int i = 0; i < 4; ++i) @@ -325,18 +325,18 @@ double RS_Image::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, return minDist; } -/*virtual*/ double RS_Image::getLength() +/*virtual*/ double Image::getLength() { return -1.0; } -void RS_Image::move(Vector offset) +void Image::move(Vector offset) { data.insertionPoint.move(offset); calculateBorders(); } -void RS_Image::rotate(Vector center, double angle) +void Image::rotate(Vector center, double angle) { data.insertionPoint.rotate(center, angle); data.uVector.rotate(angle); @@ -344,7 +344,7 @@ void RS_Image::rotate(Vector center, double angle) calculateBorders(); } -void RS_Image::scale(Vector center, Vector factor) +void Image::scale(Vector center, Vector factor) { data.insertionPoint.scale(center, factor); data.uVector.scale(factor); @@ -352,7 +352,7 @@ void RS_Image::scale(Vector center, Vector factor) calculateBorders(); } -void RS_Image::mirror(Vector axisPoint1, Vector axisPoint2) +void Image::mirror(Vector axisPoint1, Vector axisPoint2) { data.insertionPoint.mirror(axisPoint1, axisPoint2); data.uVector.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1); @@ -360,7 +360,7 @@ void RS_Image::mirror(Vector axisPoint1, Vector axisPoint2) calculateBorders(); } -void RS_Image::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Image::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (painter == NULL || view == NULL || img.isNull()) return; @@ -431,7 +431,7 @@ void RS_Image::draw(PaintInterface * painter, GraphicView * view, double /*patte /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Image & i) +std::ostream & operator<<(std::ostream & os, const Image & i) { os << " Image: " << i.getData() << "\n"; return os; diff --git a/src/base/image.h b/src/base/image.h index 082c26c..54fa790 100644 --- a/src/base/image.h +++ b/src/base/image.h @@ -7,17 +7,17 @@ /** * Holds the data that defines a line. */ -class RS_ImageData +class ImageData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_ImageData() + ImageData() { } - RS_ImageData(int handle, const Vector & insertionPoint, const Vector & uVector, const Vector & vVector, const Vector & size, const QString & file, int brightness, int contrast, int fade) + ImageData(int handle, const Vector & insertionPoint, const Vector & uVector, const Vector & vVector, const Vector & size, const QString & file, int brightness, int contrast, int fade) { this->handle = handle; this->insertionPoint = insertionPoint; @@ -30,7 +30,7 @@ class RS_ImageData this->fade = fade; } - friend std::ostream & operator<<(std::ostream & os, const RS_ImageData & ld) + friend std::ostream & operator<<(std::ostream & os, const ImageData & ld) { os << "(" << ld.insertionPoint << ")"; return os; @@ -62,16 +62,16 @@ class RS_ImageData * * @author Andrew Mustun */ -class RS_Image: public RS_AtomicEntity +class Image: public AtomicEntity { public: - RS_Image(RS_EntityContainer * parent, const RS_ImageData & d); - virtual ~RS_Image(); + Image(EntityContainer * parent, const ImageData & d); + virtual ~Image(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual void update(); - RS_ImageData getData() const; + ImageData getData() const; virtual Vector getInsertionPoint() const; void setInsertionPoint(Vector ip); QString getFile() const; @@ -90,11 +90,11 @@ class RS_Image: public RS_AtomicEntity double getImageHeight(); 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 getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, 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 double getDistanceToPoint(const Vector & coord, Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual double getLength(); virtual void move(Vector offset); virtual void rotate(Vector center, double angle); @@ -103,12 +103,12 @@ class RS_Image: public RS_AtomicEntity /*virtual void stretch(Vector firstCorner,Vector secondCorner, Vector offset);*/ virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Image & l); + friend std::ostream & operator<<(std::ostream & os, const Image & l); virtual void calculateBorders(); protected: - RS_ImageData data; + ImageData data; QImage img; }; diff --git a/src/base/infoarea.cpp b/src/base/infoarea.cpp index 1046349..9309d60 100644 --- a/src/base/infoarea.cpp +++ b/src/base/infoarea.cpp @@ -22,14 +22,14 @@ /** * Constructor. */ -RS_InfoArea::RS_InfoArea() +InfoArea::InfoArea() { } /** * Destructor. */ -RS_InfoArea::~RS_InfoArea() +InfoArea::~InfoArea() { } @@ -38,7 +38,7 @@ RS_InfoArea::~RS_InfoArea() * * @param p co-ordinate of the point */ -void RS_InfoArea::addPoint(const Vector & p) +void InfoArea::addPoint(const Vector & p) { if (thePoints.empty()) baseY = p.y; @@ -49,7 +49,7 @@ void RS_InfoArea::addPoint(const Vector & p) /** * Resets the points. */ -void RS_InfoArea::reset() +void InfoArea::reset() { thePoints.clear(); area = 0.0; @@ -59,13 +59,13 @@ void RS_InfoArea::reset() /** * Closes the polygon if it is not closed already. */ -void RS_InfoArea::close() +void InfoArea::close() { if (isValid() && isClosed() == false) { thePoints.append(thePoints.first()); - RS_DEBUG->print("RS_InfoArea::close: closed"); + DEBUG->print("InfoArea::close: closed"); } } @@ -74,7 +74,7 @@ void RS_InfoArea::close() * identical) * @retval false Otherwise. */ -bool RS_InfoArea::isClosed() +bool InfoArea::isClosed() { return (thePoints.first().distanceTo(thePoints.last()) < 1.0e-4); } @@ -83,16 +83,16 @@ bool RS_InfoArea::isClosed() * @retval true If the area is defined (i.e. there are at least 3 points) * @retval false If there are only two or less points. */ -bool RS_InfoArea::isValid() +bool InfoArea::isValid() { - RS_DEBUG->print("RS_InfoArea::isValid: count: %d", thePoints.count()); + DEBUG->print("InfoArea::isValid: count: %d", thePoints.count()); return (thePoints.count() > 2); } /** * Calculates the area and the circumference of the area. */ -void RS_InfoArea::calculate() +void InfoArea::calculate() { area = 0.0; circumference = 0.0; @@ -131,17 +131,17 @@ void RS_InfoArea::calculate() area = fabs(area); } -double RS_InfoArea::getArea() +double InfoArea::getArea() { return area; } -double RS_InfoArea::getCircumference() +double InfoArea::getCircumference() { return circumference; } -int RS_InfoArea::count() +int InfoArea::count() { return thePoints.count(); } @@ -152,7 +152,7 @@ int RS_InfoArea::count() * @param p1 first point * @param p2 second point */ -double RS_InfoArea::calcSubArea(const Vector & p1, const Vector & p2) +double InfoArea::calcSubArea(const Vector & p1, const Vector & p2) { double width = p2.x - p1.x; double height = (p1.y - baseY) + (p2.y - baseY); @@ -165,7 +165,7 @@ double RS_InfoArea::calcSubArea(const Vector & p1, const Vector & p2) \param _p2 second point */ /*double -RS_InfoArea::calcDistance(Vector *_p1, Vector *_p2) +InfoArea::calcDistance(Vector *_p1, Vector *_p2) { return mtGetDistance(_p1->getX(), _p1->getY(), _p2->getX(), _p2->getY()); }*/ diff --git a/src/base/infoarea.h b/src/base/infoarea.h index 607a5c7..0f1e5f5 100644 --- a/src/base/infoarea.h +++ b/src/base/infoarea.h @@ -9,11 +9,11 @@ * * @author Andrew Mustun */ -class RS_InfoArea +class InfoArea { public: - RS_InfoArea(); - ~RS_InfoArea(); + InfoArea(); + ~InfoArea(); void reset(); void addPoint(const Vector & p); diff --git a/src/base/information.cpp b/src/base/information.cpp index ee95485..6c63857 100644 --- a/src/base/information.cpp +++ b/src/base/information.cpp @@ -26,7 +26,7 @@ * entities. Usually that's an Drawing entity but * it can also be a polyline, text, ... */ -RS_Information::RS_Information(RS_EntityContainer& container) +Information::Information(EntityContainer& container) { this->container = &container; } @@ -35,7 +35,7 @@ RS_Information::RS_Information(RS_EntityContainer& container) * @return true: if the entity is a dimensioning enity. * false: otherwise */ -bool RS_Information::isDimension(RS2::EntityType type) +bool Information::isDimension(RS2::EntityType type) { if (type == RS2::EntityDimAligned || type == RS2::EntityDimLinear || type == RS2::EntityDimRadial || type == RS2::EntityDimDiametric @@ -53,7 +53,7 @@ bool RS_Information::isDimension(RS2::EntityType type) * @retval true the entity can be trimmed. * i.e. it is in a graphic or in a polyline. */ -bool RS_Information::isTrimmable(RS_Entity * e) +bool Information::isTrimmable(Entity * e) { if (e) { @@ -80,7 +80,7 @@ bool RS_Information::isTrimmable(RS_Entity * e) * @retval true the two entities can be trimmed to each other; * i.e. they are in a graphic or in the same polyline. */ -bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2) +bool Information::isTrimmable(Entity * e1, Entity * e2) { if (e1 && e2) { @@ -91,10 +91,10 @@ bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2) && e1->getParent()==e2->getParent()) { // in the same polyline - RS_EntityContainer * pl = e1->getParent(); + EntityContainer * pl = e1->getParent(); int idx1 = pl->findEntity(e1); int idx2 = pl->findEntity(e2); - RS_DEBUG->print("RS_Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2); + DEBUG->print("Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2); if (abs(idx1 - idx2) == 1 || abs(idx1 - idx2) == pl->count() - 1) { @@ -137,7 +137,7 @@ bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2) * if there are no elements at all in this graphics * container. */ -Vector RS_Information::getNearestEndpoint(const Vector & coord, double * dist) const +Vector Information::getNearestEndpoint(const Vector & coord, double * dist) const { return container->getNearestEndpoint(coord, dist); } @@ -155,8 +155,8 @@ Vector RS_Information::getNearestEndpoint(const Vector & coord, double * dist) c * if there are no elements at all in this graphics * container. */ -Vector RS_Information::getNearestPointOnEntity(const Vector & coord, - bool onEntity, double * dist, RS_Entity ** entity) const +Vector Information::getNearestPointOnEntity(const Vector & coord, + bool onEntity, double * dist, Entity ** entity) const { return container->getNearestPointOnEntity(coord, onEntity, dist, entity); } @@ -172,7 +172,7 @@ Vector RS_Information::getNearestPointOnEntity(const Vector & coord, * @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, +Entity * Information::getNearestEntity(const Vector & coord, double * dist, RS2::ResolveLevel level) const { return container->getNearestEntity(coord, dist, level); @@ -190,8 +190,8 @@ RS_Entity * RS_Information::getNearestEntity(const Vector & coord, * @return All intersections of the two entities. The tangent flag in * VectorSolutions is set if one intersection is a tangent point. */ -VectorSolutions RS_Information::getIntersection(RS_Entity * e1, - RS_Entity * e2, bool onEntities) +VectorSolutions Information::getIntersection(Entity * e1, + Entity * e2, bool onEntities) { VectorSolutions ret; double tol = 1.0e-4; @@ -212,15 +212,15 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, { if (e2->rtti() == RS2::EntityEllipse) { - RS_Entity * tmp = e1; + Entity * tmp = e1; e1 = e2; e2 = tmp; } if (e2->rtti() == RS2::EntityLine) { - RS_Ellipse * ellipse = (RS_Ellipse *)e1; - ret = getIntersectionLineEllipse((RS_Line *)e2, ellipse); + Ellipse * ellipse = (Ellipse *)e1; + ret = getIntersectionLineEllipse((Line *)e2, ellipse); tol = 1.0e-1; } // ellipse / arc, ellipse / ellipse: not supported: @@ -231,20 +231,20 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, } else { - RS_Entity * te1 = e1; - RS_Entity * te2 = e2; + Entity * te1 = e1; + Entity * te2 = e2; // entity copies - so we only have to deal with lines and arcs - RS_Line l1(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); - RS_Line l2(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); + Line l1(NULL, LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); + Line l2(NULL, LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); - RS_Arc a1(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); - RS_Arc a2(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); + Arc a1(NULL, ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); + Arc a2(NULL, ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); // convert construction lines to lines: if (e1->rtti() == RS2::EntityConstructionLine) { - RS_ConstructionLine * cl = (RS_ConstructionLine *)e1; + ConstructionLine * cl = (ConstructionLine *)e1; l1.setStartpoint(cl->getPoint1()); l1.setEndpoint(cl->getPoint2()); te1 = &l1; @@ -252,7 +252,7 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, if (e2->rtti() == RS2::EntityConstructionLine) { - RS_ConstructionLine * cl = (RS_ConstructionLine *)e2; + ConstructionLine * cl = (ConstructionLine *)e2; l2.setStartpoint(cl->getPoint1()); l2.setEndpoint(cl->getPoint2()); te2 = &l2; @@ -261,16 +261,16 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, // convert circles to arcs: if (e1->rtti() == RS2::EntityCircle) { - RS_Circle * c = (RS_Circle *)e1; - RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); + Circle * c = (Circle *)e1; + ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); a1.setData(data); te1 = &a1; } if (e2->rtti() == RS2::EntityCircle) { - RS_Circle * c = (RS_Circle *)e2; - RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); + Circle * c = (Circle *)e2; + ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); a2.setData(data); te2 = &a2; } @@ -280,37 +280,37 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, //else if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityLine) { - RS_Line * line1 = (RS_Line *)te1; - RS_Line * line2 = (RS_Line *)te2; + Line * line1 = (Line *)te1; + Line * line2 = (Line *)te2; ret = getIntersectionLineLine(line1, line2); } // line / arc: // else if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityArc) { - RS_Line * line = (RS_Line *)te1; - RS_Arc * arc = (RS_Arc *)te2; + Line * line = (Line *)te1; + Arc * arc = (Arc *)te2; ret = getIntersectionLineArc(line, arc); } // arc / line: // else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityLine) { - RS_Arc * arc = (RS_Arc *)te1; - RS_Line * line = (RS_Line *)te2; + Arc * arc = (Arc *)te1; + Line * line = (Line *)te2; ret = getIntersectionLineArc(line, arc); } // arc / arc: // else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityArc) { - RS_Arc * arc1 = (RS_Arc *)te1; - RS_Arc * arc2 = (RS_Arc *)te2; + Arc * arc1 = (Arc *)te1; + Arc * arc2 = (Arc *)te2; ret = getIntersectionArcArc(arc1, arc2); } else { - RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type."); + DEBUG->print("Information::getIntersection:: Unsupported entity type."); } } @@ -360,7 +360,7 @@ VectorSolutions RS_Information::getIntersection(RS_Entity * e1, /** * @return Intersection between two lines. */ -VectorSolutions RS_Information::getIntersectionLineLine(RS_Line * e1, RS_Line * e2) +VectorSolutions Information::getIntersectionLineLine(Line * e1, Line * e2) { VectorSolutions ret; @@ -392,7 +392,7 @@ VectorSolutions RS_Information::getIntersectionLineLine(RS_Line * e1, RS_Line * /** * @return One or two intersection points between given entities. */ -VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * arc) +VectorSolutions Information::getIntersectionLineArc(Line * line, Arc * arc) { VectorSolutions ret; @@ -422,9 +422,9 @@ VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * Vector delta = p - c; // root term: - double term = RS_Math::pow(Vector::dotP(d, delta), 2.0) - - RS_Math::pow(d.magnitude(), 2.0) - * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0)); + double term = Math::pow(Vector::dotP(d, delta), 2.0) + - Math::pow(d.magnitude(), 2.0) + * (Math::pow(delta.magnitude(), 2.0) - Math::pow(r, 2.0)); // no intersection: if (term<0.0) { @@ -435,7 +435,7 @@ VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * // one or two intersections: else { double t1 = (- Vector::dotP(d, delta) + sqrt(term)) - / RS_Math::pow(d.magnitude(), 2.0); + / Math::pow(d.magnitude(), 2.0); double t2; bool tangent = false; @@ -448,7 +448,7 @@ VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * // two intersections else { t2 = (-Vector::dotP(d, delta) - sqrt(term)) - / RS_Math::pow(d.magnitude(), 2.0); + / Math::pow(d.magnitude(), 2.0); } Vector sol1; @@ -470,7 +470,7 @@ VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * /** * @return One or two intersection points between given entities. */ -VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2) +VectorSolutions Information::getIntersectionArcArc(Arc * e1, Arc * e2) { VectorSolutions ret; @@ -495,9 +495,9 @@ VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2) double s, t1, t2, term; - s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0); + s = 1.0/2.0 * ((r1*r1 - r2*r2)/(Math::pow(u.magnitude(), 2.0)) + 1.0); - term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s; + term = (r1*r1)/(Math::pow(u.magnitude(), 2.0)) - s*s; // no intersection: if (term<0.0) { @@ -530,7 +530,7 @@ VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2) /** * @return One or two intersection points between given entities. */ -VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse) +VectorSolutions Information::getIntersectionLineEllipse(Line * line, Ellipse * ellipse) { VectorSolutions ret; @@ -558,7 +558,7 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_El double d = b*b - a*c; if (d < 0) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0"); + DEBUG->print("Information::getIntersectionLineEllipse: outside 0"); } else if ( d > 0 ) { double root = sqrt(d); double t_a = (-b - root) / a; @@ -566,24 +566,24 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_El /*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) { if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1"); + DEBUG->print("Information::getIntersectionLineEllipse: outside 1"); } else { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1"); + DEBUG->print("Information::getIntersectionLineEllipse: inside 1"); } } else {*/ - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1"); + DEBUG->print("Information::getIntersectionLineEllipse: intersection 1"); Vector ret1(false); Vector ret2(false); //if ( 0 <= t_a && t_a <= 1 ) { - //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1"); + //DEBUG->print("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); + DEBUG->print("Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y); //} //if ( 0 <= t_b && t_b <= 1 ) { - //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1"); + //DEBUG->print("Information::getIntersectionLineEllipse: 0<=t_b<=1"); ret2 = a1.lerp(a2, t_b); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y); + DEBUG->print("Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y); //} if (ret1.valid && ret2.valid) { ret = VectorSolutions(ret1, ret2); @@ -600,12 +600,12 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_El } else { double t = -b/a; if ( 0 <= t && t <= 1 ) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1"); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2"); + DEBUG->print("Information::getIntersectionLineEllipse: 0<=t<=1"); + DEBUG->print("Information::getIntersectionLineEllipse: intersection 2"); ret = VectorSolutions(a1.lerp(a2, t)); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y); + DEBUG->print("Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y); } else { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2"); + DEBUG->print("Information::getIntersectionLineEllipse: outside 2"); } } @@ -615,13 +615,13 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_El /* - RS_Arc* arc = new RS_Arc(NULL, - RS_ArcData(ellipse->getCenter(), + Arc* arc = new Arc(NULL, + ArcData(ellipse->getCenter(), ellipse->getMajorRadius(), ellipse->getAngle1(), ellipse->getAngle2(), false)); - RS_Line* other = (RS_Line*)line->clone(); + Line* other = (Line*)line->clone(); double angle = ellipse->getAngle(); //double ratio = ellipse->getRatio(); @@ -651,12 +651,12 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_El * @param onContour Will be set to true if the given point it exactly * on the contour. */ -bool RS_Information::isPointInsideContour(const Vector & point, - RS_EntityContainer * contour, bool * onContour) +bool Information::isPointInsideContour(const Vector & point, + EntityContainer * contour, bool * onContour) { if (contour==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Information::isPointInsideContour: contour is NULL"); + DEBUG->print(Debug::D_WARNING, + "Information::isPointInsideContour: contour is NULL"); return false; } @@ -677,18 +677,18 @@ bool RS_Information::isPointInsideContour(const Vector & point, // create ray: Vector v; v.setPolar(width*10.0, rayAngle); - RS_Line ray(NULL, RS_LineData(point, point+v)); + Line ray(NULL, LineData(point, point+v)); counter = 0; VectorSolutions sol; if (onContour) *onContour = false; - for(RS_Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL; + for(Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL; e=contour->nextEntity(RS2::ResolveAll)) { // intersection(s) from ray with contour entity: - sol = RS_Information::getIntersection(&ray, e, true); + sol = Information::getIntersection(&ray, e, true); for(int i=0; i<=1; ++i) { @@ -708,12 +708,12 @@ bool RS_Information::isPointInsideContour(const Vector & point, { if (e->rtti() == RS2::EntityLine) { - RS_Line * line = (RS_Line *)e; + Line * line = (Line *)e; // ray goes through startpoint of line: if (p.distanceTo(line->getStartpoint()) < 1.0e-4) { - if (RS_Math::correctAngle(line->getAngle1()) < M_PI) + if (Math::correctAngle(line->getAngle1()) < M_PI) { counter++; sure = false; @@ -722,7 +722,7 @@ bool RS_Information::isPointInsideContour(const Vector & point, // ray goes through endpoint of line: else if (p.distanceTo(line->getEndpoint()) < 1.0e-4) { - if (RS_Math::correctAngle(line->getAngle2()) < M_PI) + if (Math::correctAngle(line->getAngle2()) < M_PI) { counter++; sure = false; @@ -736,7 +736,7 @@ bool RS_Information::isPointInsideContour(const Vector & point, } else if (e->rtti() == RS2::EntityArc) { - RS_Arc * arc = (RS_Arc *)e; + Arc * arc = (Arc *)e; if (p.distanceTo(arc->getStartpoint()) < 1.0e-4) { diff --git a/src/base/information.h b/src/base/information.h index 4af7994..3682977 100644 --- a/src/base/information.h +++ b/src/base/information.h @@ -14,29 +14,29 @@ * * @author Andrew Mustun */ -class RS_Information +class Information { public: - RS_Information(RS_EntityContainer & entityContainer); + Information(EntityContainer & entityContainer); static bool isDimension(RS2::EntityType type); - static bool isTrimmable(RS_Entity * e); - static bool isTrimmable(RS_Entity * e1, RS_Entity * e2); + static bool isTrimmable(Entity * e); + static bool isTrimmable(Entity * e1, Entity * e2); Vector getNearestEndpoint(const Vector & point, double * dist = NULL) const; Vector getNearestPointOnEntity(const Vector & point, bool onEntity = true, - double * dist = NULL, RS_Entity ** entity = NULL) const; - RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL, + double * dist = NULL, Entity ** entity = NULL) const; + Entity * getNearestEntity(const Vector & point, double * dist = NULL, RS2::ResolveLevel level = RS2::ResolveAll) const; - static VectorSolutions getIntersection(RS_Entity * e1, RS_Entity * e2, bool onEntities = false); - static VectorSolutions getIntersectionLineLine(RS_Line * e1, RS_Line * e2); - static VectorSolutions getIntersectionLineArc(RS_Line * line, RS_Arc * arc); - static VectorSolutions getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2); - static VectorSolutions getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse); - static bool isPointInsideContour(const Vector & point, RS_EntityContainer * contour, + static VectorSolutions getIntersection(Entity * e1, Entity * e2, bool onEntities = false); + static VectorSolutions getIntersectionLineLine(Line * e1, Line * e2); + static VectorSolutions getIntersectionLineArc(Line * line, Arc * arc); + static VectorSolutions getIntersectionArcArc(Arc * e1, Arc * e2); + static VectorSolutions getIntersectionLineEllipse(Line * line, Ellipse * ellipse); + static bool isPointInsideContour(const Vector & point, EntityContainer * contour, bool * onContour = NULL); protected: - RS_EntityContainer * container; + EntityContainer * container; }; #endif diff --git a/src/base/insert.cpp b/src/base/insert.cpp index 5365b00..c6b9ea1 100644 --- a/src/base/insert.cpp +++ b/src/base/insert.cpp @@ -22,8 +22,8 @@ /** * @param parent The graphic this block belongs to. */ -RS_Insert::RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d): - RS_EntityContainer(parent), data(d) +Insert::Insert(EntityContainer * parent, const InsertData & d): + EntityContainer(parent), data(d) { block = NULL; @@ -37,13 +37,13 @@ RS_Insert::RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d): /** * Destructor. */ -RS_Insert::~RS_Insert() +Insert::~Insert() { } -/*virtual*/ RS_Entity * RS_Insert::clone() +/*virtual*/ Entity * Insert::clone() { - RS_Insert * i = new RS_Insert(*this); + Insert * i = new Insert(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // i->entities.setAutoDelete(entities.autoDelete()); i->initId(); @@ -52,13 +52,13 @@ RS_Insert::~RS_Insert() } /** @return RS2::EntityInsert */ -/*virtual*/ RS2::EntityType RS_Insert::rtti() const +/*virtual*/ RS2::EntityType Insert::rtti() const { return RS2::EntityInsert; } /** @return Copy of data that defines the insert. **/ -RS_InsertData RS_Insert::getData() const +InsertData Insert::getData() const { return data; } @@ -66,9 +66,9 @@ RS_InsertData RS_Insert::getData() const /** * Reimplementation of reparent. Invalidates block cache pointer. */ -/*virtual*/ void RS_Insert::reparent(RS_EntityContainer * parent) +/*virtual*/ void Insert::reparent(EntityContainer * parent) { - RS_Entity::reparent(parent); + Entity::reparent(parent); block = NULL; } @@ -78,12 +78,12 @@ RS_InsertData RS_Insert::getData() const * from the blockSource if one was supplied and otherwise from * the closest parent graphic. */ -RS_Block * RS_Insert::getBlockForInsert() +Block * Insert::getBlockForInsert() { if (block) return block; - RS_BlockList * blkList; + BlockList * blkList; if (!data.blockSource) { @@ -94,7 +94,7 @@ RS_Block * RS_Insert::getBlockForInsert() blkList = data.blockSource; } - RS_Block * blk = NULL; + Block * blk = NULL; if (blkList) blk = blkList->find(data.name); @@ -114,75 +114,75 @@ RS_Block * RS_Insert::getBlockForInsert() * Updates the entity buffer of this insert entity. This method * needs to be called whenever the block this insert is based on changes. */ -void RS_Insert::update() +void Insert::update() { - RS_DEBUG->print("RS_Insert::update"); - RS_DEBUG->print("RS_Insert::update: name: %s", data.name.toLatin1().data()); - RS_DEBUG->print("RS_Insert::update: insertionPoint: %f/%f", + DEBUG->print("Insert::update"); + DEBUG->print("Insert::update: name: %s", data.name.toLatin1().data()); + DEBUG->print("Insert::update: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); if (!updateEnabled) return; clear(); - RS_Block * blk = getBlockForInsert(); + Block * blk = getBlockForInsert(); if (!blk) { - RS_DEBUG->print("RS_Insert::update: Block is NULL"); + DEBUG->print("Insert::update: Block is NULL"); return; } if (isUndone()) { - RS_DEBUG->print("RS_Insert::update: Insert is in undo list"); + DEBUG->print("Insert::update: Insert is in undo list"); return; } if (fabs(data.scaleFactor.x) < 1.0e-6 || fabs(data.scaleFactor.y) < 1.0e-6) { - RS_DEBUG->print("RS_Insert::update: scale factor is 0"); + DEBUG->print("Insert::update: scale factor is 0"); return; } - RS_Pen tmpPen; + Pen tmpPen; - /*Q3PtrListIterator it = createIterator(); - RS_Entity* e; + /*Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it;*/ - RS_DEBUG->print("RS_Insert::update: cols: %d, rows: %d", data.cols, data.rows); - RS_DEBUG->print("RS_Insert::update: block has %d entities", blk->count()); + DEBUG->print("Insert::update: cols: %d, rows: %d", data.cols, data.rows); + DEBUG->print("Insert::update: block has %d entities", blk->count()); - for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) + for(Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity()) { for(int c=0; cprint("RS_Insert::update: col %d", c); + DEBUG->print("Insert::update: col %d", c); for(int r=0; rprint("RS_Insert::update: row %d", r); + DEBUG->print("Insert::update: row %d", r); if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate) { - RS_DEBUG->print("RS_Insert::update: updating sub-insert"); - ((RS_Insert *)e)->update(); + DEBUG->print("Insert::update: updating sub-insert"); + ((Insert *)e)->update(); } - RS_DEBUG->print("RS_Insert::update: cloning entity"); + DEBUG->print("Insert::update: cloning entity"); - RS_Entity * ne = e->clone(); + Entity * ne = e->clone(); ne->initId(); ne->setUpdateEnabled(false); ne->setParent(this); ne->setVisible(getFlag(RS2::FlagVisible)); - RS_DEBUG->print("RS_Insert::update: transforming entity"); + DEBUG->print("Insert::update: transforming entity"); // Move: - RS_DEBUG->print("RS_Insert::update: move 1"); + DEBUG->print("Insert::update: move 1"); if (fabs(data.scaleFactor.x) > 1.0e-6 && fabs(data.scaleFactor.y) > 1.0e-6) { ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c, data.spacing.y / data.scaleFactor.y * r)); @@ -193,13 +193,13 @@ void RS_Insert::update() } // Move because of block base point: - RS_DEBUG->print("RS_Insert::update: move 2"); + DEBUG->print("Insert::update: move 2"); ne->move(blk->getBasePoint() * -1); // Scale: - RS_DEBUG->print("RS_Insert::update: scale"); + DEBUG->print("Insert::update: scale"); ne->scale(data.insertionPoint, data.scaleFactor); // Rotate: - RS_DEBUG->print("RS_Insert::update: rotate"); + DEBUG->print("Insert::update: rotate"); ne->rotate(data.insertionPoint, data.angle); // Select: ne->setSelected(isSelected()); @@ -208,7 +208,7 @@ void RS_Insert::update() tmpPen = ne->getPen(false); // color from block (free floating): - if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock)) + if (tmpPen.getColor() == Color(RS2::FlagByBlock)) tmpPen.setColor(getPen().getColor()); // line width from block (free floating): @@ -229,11 +229,11 @@ void RS_Insert::update() if (data.updateMode != RS2::PreviewUpdate) { - RS_DEBUG->print("RS_Insert::update: updating new entity"); + DEBUG->print("Insert::update: updating new entity"); ne->update(); } - RS_DEBUG->print("RS_Insert::update: adding new entity"); + DEBUG->print("Insert::update: adding new entity"); addEntity(ne); } } @@ -241,82 +241,82 @@ void RS_Insert::update() calculateBorders(); - RS_DEBUG->print("RS_Insert::update: OK"); + DEBUG->print("Insert::update: OK"); } -QString RS_Insert::getName() const +QString Insert::getName() const { return data.name; } -void RS_Insert::setName(const QString & newName) +void Insert::setName(const QString & newName) { data.name = newName; update(); } -Vector RS_Insert::getInsertionPoint() const +Vector Insert::getInsertionPoint() const { return data.insertionPoint; } -void RS_Insert::setInsertionPoint(const Vector & i) +void Insert::setInsertionPoint(const Vector & i) { data.insertionPoint = i; } -Vector RS_Insert::getScale() const +Vector Insert::getScale() const { return data.scaleFactor; } -void RS_Insert::setScale(const Vector & s) +void Insert::setScale(const Vector & s) { data.scaleFactor = s; } -double RS_Insert::getAngle() const +double Insert::getAngle() const { return data.angle; } -void RS_Insert::setAngle(double a) +void Insert::setAngle(double a) { data.angle = a; } -int RS_Insert::getCols() const +int Insert::getCols() const { return data.cols; } -void RS_Insert::setCols(int c) +void Insert::setCols(int c) { data.cols = c; } -int RS_Insert::getRows() const +int Insert::getRows() const { return data.rows; } -void RS_Insert::setRows(int r) +void Insert::setRows(int r) { data.rows = r; } -Vector RS_Insert::getSpacing() const +Vector Insert::getSpacing() const { return data.spacing; } -void RS_Insert::setSpacing(const Vector & s) +void Insert::setSpacing(const Vector & s) { data.spacing = s; } /** - * Is this insert visible? (re-implementation from RS_Entity) + * Is this insert visible? (re-implementation from Entity) * * @return true Only if the entity and the block and the layer it is on * are visible. @@ -325,9 +325,9 @@ void RS_Insert::setSpacing(const Vector & s) * The Block might also be NULL. In that case the block visiblity * is ignored. */ -bool RS_Insert::isVisible() +bool Insert::isVisible() { - RS_Block * blk = getBlockForInsert(); + Block * blk = getBlockForInsert(); if (blk != NULL) { @@ -337,58 +337,58 @@ bool RS_Insert::isVisible() } } - return RS_Entity::isVisible(); + return Entity::isVisible(); } -VectorSolutions RS_Insert::getRefPoints() +VectorSolutions Insert::getRefPoints() { VectorSolutions ret(data.insertionPoint); return ret; } -Vector RS_Insert::getNearestRef(const Vector & coord, double * dist) +Vector Insert::getNearestRef(const Vector & coord, double * dist) { return getRefPoints().getClosest(coord, dist); } -void RS_Insert::move(Vector offset) +void Insert::move(Vector offset) { - RS_DEBUG->print("RS_Insert::move: offset: %f/%f", + DEBUG->print("Insert::move: offset: %f/%f", offset.x, offset.y); - RS_DEBUG->print("RS_Insert::move1: insertionPoint: %f/%f", + DEBUG->print("Insert::move1: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); data.insertionPoint.move(offset); - RS_DEBUG->print("RS_Insert::move2: insertionPoint: %f/%f", + DEBUG->print("Insert::move2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::rotate(Vector center, double angle) +void Insert::rotate(Vector center, double angle) { - RS_DEBUG->print("RS_Insert::rotate1: insertionPoint: %f/%f " + DEBUG->print("Insert::rotate1: insertionPoint: %f/%f " "/ center: %f/%f", data.insertionPoint.x, data.insertionPoint.y, center.x, center.y); data.insertionPoint.rotate(center, angle); - data.angle = RS_Math::correctAngle(data.angle + angle); - RS_DEBUG->print("RS_Insert::rotate2: insertionPoint: %f/%f", + data.angle = Math::correctAngle(data.angle + angle); + DEBUG->print("Insert::rotate2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::scale(Vector center, Vector factor) +void Insert::scale(Vector center, Vector factor) { - RS_DEBUG->print("RS_Insert::scale1: insertionPoint: %f/%f", + DEBUG->print("Insert::scale1: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); data.insertionPoint.scale(center, factor); data.scaleFactor.scale(Vector(0.0, 0.0), factor); data.spacing.scale(Vector(0.0, 0.0), factor); - RS_DEBUG->print("RS_Insert::scale2: insertionPoint: %f/%f", + DEBUG->print("Insert::scale2: insertionPoint: %f/%f", data.insertionPoint.x, data.insertionPoint.y); update(); } -void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) +void Insert::mirror(Vector axisPoint1, Vector axisPoint2) { data.insertionPoint.mirror(axisPoint1, axisPoint2); @@ -402,7 +402,7 @@ void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) update(); } -std::ostream & operator<<(std::ostream & os, const RS_Insert & i) +std::ostream & operator<<(std::ostream & os, const Insert & i) { os << " Insert: " << i.getData() << std::endl; return os; diff --git a/src/base/insert.h b/src/base/insert.h index b6e17ae..a9fbe65 100644 --- a/src/base/insert.h +++ b/src/base/insert.h @@ -8,13 +8,13 @@ /** * Holds the data that defines an insert. */ -class RS_InsertData +class InsertData { public: /** * Default constructor. */ - RS_InsertData() {} + InsertData() {} /** * @param name The name of the block used as an identifier. @@ -26,7 +26,7 @@ class RS_InsertData * @param spacing Spacing between rows and cols. * @param blockSource Source for the block to insert if other than parent. * Normally blocks are requested from the entity's parent but the - * block can also come from another resource. RS_Text uses that + * block can also come from another resource. Text uses that * to share the blocks (letters) from a font. * @param updateMode RS2::Update will update the insert entity instantly * RS2::NoUpdate will not update the insert. You can update @@ -34,8 +34,8 @@ class RS_InsertData * often the case since you might want to adjust attributes * after creating an insert entity. */ - RS_InsertData(const QString & name, Vector insertionPoint, Vector scaleFactor, - double angle, int cols, int rows, Vector spacing, RS_BlockList * blockSource = NULL, + InsertData(const QString & name, Vector insertionPoint, Vector scaleFactor, + double angle, int cols, int rows, Vector spacing, BlockList * blockSource = NULL, RS2::UpdateMode updateMode = RS2::Update) { this->name = name; @@ -49,9 +49,9 @@ class RS_InsertData this->updateMode = updateMode; } - friend class RS_Insert; + friend class Insert; - friend std::ostream & operator<<(std::ostream & os, const RS_InsertData & d) + friend std::ostream & operator<<(std::ostream & os, const InsertData & d) { os << "(" << d.name.toLatin1().data() << ")"; return os; @@ -63,7 +63,7 @@ class RS_InsertData double angle; int cols, rows; Vector spacing; - RS_BlockList * blockSource; + BlockList * blockSource; RS2::UpdateMode updateMode; }; @@ -76,18 +76,18 @@ class RS_InsertData * * @author Andrew Mustun */ -class RS_Insert: public RS_EntityContainer +class Insert: public EntityContainer { public: - RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d); - virtual ~RS_Insert(); + Insert(EntityContainer * parent, const InsertData & d); + virtual ~Insert(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_InsertData getData() const; - virtual void reparent(RS_EntityContainer * parent); + InsertData getData() const; + virtual void reparent(EntityContainer * parent); - RS_Block * getBlockForInsert(); + Block * getBlockForInsert(); virtual void update(); QString getName() const; @@ -114,11 +114,11 @@ class RS_Insert: public RS_EntityContainer virtual void scale(Vector center, Vector factor); virtual void mirror(Vector axisPoint1, Vector axisPoint2); - friend std::ostream & operator<<(std::ostream & os, const RS_Insert & i); + friend std::ostream & operator<<(std::ostream & os, const Insert & i); protected: - RS_InsertData data; - RS_Block * block; + InsertData data; + Block * block; }; #endif diff --git a/src/base/layer.cpp b/src/base/layer.cpp index 4146aa2..986616d 100644 --- a/src/base/layer.cpp +++ b/src/base/layer.cpp @@ -22,7 +22,7 @@ /** * Constructor. */ -RS_Layer::RS_Layer(const QString & name) +Layer::Layer(const QString & name) { setName(name); @@ -33,31 +33,31 @@ RS_Layer::RS_Layer(const QString & name) data.locked = false; } -RS_Layer * RS_Layer::clone() +Layer * Layer::clone() { - return new RS_Layer(*this); + return new Layer(*this); } /** sets a new name for this layer. */ -void RS_Layer::setName(const QString & name) +void Layer::setName(const QString & name) { data.name = name; } /** @return the name of this layer. */ -QString RS_Layer::getName() const +QString Layer::getName() const { return data.name; } /** sets the default pen for this layer. */ -void RS_Layer::setPen(const RS_Pen & pen) +void Layer::setPen(const Pen & pen) { data.pen = pen; } /** @return default pen for this layer. */ -RS_Pen RS_Layer::getPen() const +Pen Layer::getPen() const { return data.pen; } @@ -66,7 +66,7 @@ RS_Pen RS_Layer::getPen() const * @retval true if this layer is frozen (invisible) * @retval false if this layer isn't frozen (visible) */ -bool RS_Layer::isFrozen() const +bool Layer::isFrozen() const { return data.frozen; //getFlag(RS2::FlagFrozen); @@ -76,7 +76,7 @@ bool RS_Layer::isFrozen() const * @retval true the layer has been converted already * @retval false the layer still needs to be converted */ -bool RS_Layer::isConverted() const +bool Layer::isConverted() const { return data.converted; } @@ -84,7 +84,7 @@ bool RS_Layer::isConverted() const /** * Sets the converted flag */ -void RS_Layer::setConverted(bool c) +void Layer::setConverted(bool c) { data.converted = c; } @@ -93,7 +93,7 @@ void RS_Layer::setConverted(bool c) * Toggles the visibility of this layer. * Freezes the layer if it's not frozen, thaws the layer otherwise */ -void RS_Layer::toggle() +void Layer::toggle() { //toggleFlag(RS2::FlagFrozen); data.frozen = !data.frozen; @@ -104,7 +104,7 @@ void RS_Layer::toggle() * * @param freeze true: freeze, false: defreeze */ -void RS_Layer::freeze(bool freeze) +void Layer::freeze(bool freeze) { data.frozen = freeze; /*if (freeze) { @@ -117,7 +117,7 @@ void RS_Layer::freeze(bool freeze) /** * Toggles the lock of this layer. */ -void RS_Layer::toggleLock() +void Layer::toggleLock() { //toggleFlag(RS2::FlagFrozen); data.locked = !data.locked; @@ -128,7 +128,7 @@ void RS_Layer::toggleLock() * * @param l true: lock, false: unlock */ -void RS_Layer::lock(bool l) +void Layer::lock(bool l) { data.locked = l; } @@ -136,7 +136,7 @@ void RS_Layer::lock(bool l) /** * return the LOCK state of the Layer */ -bool RS_Layer::isLocked() +bool Layer::isLocked() { return data.locked; } @@ -145,7 +145,7 @@ bool RS_Layer::isLocked() * Copies all attributes (pen) and the name of the layer. */ /* -RS_Layer & RS_Layer::operator=(const RS_Layer & l) +Layer & Layer::operator=(const Layer & l) { setName(l.getName()); setPen(l.getPen()); @@ -157,7 +157,7 @@ RS_Layer & RS_Layer::operator=(const RS_Layer & l) /** * Dumps the layers data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Layer & l) +std::ostream & operator<<(std::ostream & os, const Layer & l) { os << " name: " << l.getName().toLatin1().data() << " pen: " << l.getPen() diff --git a/src/base/layer.h b/src/base/layer.h index 187b675..249fc73 100644 --- a/src/base/layer.h +++ b/src/base/layer.h @@ -16,12 +16,12 @@ /** * Holds the data that defines a layer. */ -class RS_LayerData +class LayerData { public: - RS_LayerData() {} + LayerData() {} - RS_LayerData(const QString & name, const RS_Pen & pen, bool frozen, bool locked) + LayerData(const QString & name, const Pen & pen, bool frozen, bool locked) { this->name = name; this->pen = pen; @@ -33,7 +33,7 @@ class RS_LayerData QString name; //! default pen for this layer - RS_Pen pen; + Pen pen; //! Frozen flag bool frozen; @@ -50,17 +50,17 @@ class RS_LayerData * * @author Andrew Mustun */ -class RS_Layer +class Layer { public: - explicit RS_Layer(const QString & name); - //RS_Layer(const char* name); + explicit Layer(const QString & name); + //Layer(const char* name); - RS_Layer * clone(); + Layer * clone(); void setName(const QString & name); QString getName() const; - void setPen(const RS_Pen & pen); - RS_Pen getPen() const; + void setPen(const Pen & pen); + Pen getPen() const; bool isFrozen() const; bool isConverted() const; void setConverted(bool c); @@ -69,15 +69,15 @@ class RS_Layer void toggleLock(); void lock(bool l); bool isLocked(); - //RS_Layer & operator=(const RS_Layer & l); + //Layer & operator=(const Layer & l); - friend std::ostream & operator<<(std::ostream & os, const RS_Layer & l); + friend std::ostream & operator<<(std::ostream & os, const Layer & l); - //friend class RS_LayerList; + //friend class LayerList; private: //! Layer data - RS_LayerData data; + LayerData data; }; #endif diff --git a/src/base/layerlist.cpp b/src/base/layerlist.cpp index d468904..4196381 100644 --- a/src/base/layerlist.cpp +++ b/src/base/layerlist.cpp @@ -24,7 +24,7 @@ /** * Default constructor. */ -RS_LayerList::RS_LayerList() +LayerList::LayerList() { // Good news, we don't have to screw with this shit // layers.setAutoDelete(false); @@ -33,14 +33,14 @@ RS_LayerList::RS_LayerList() setModified(false); } -/*virtual*/ RS_LayerList::~RS_LayerList() +/*virtual*/ LayerList::~LayerList() { } /** * Removes all layers in the layerlist. */ -void RS_LayerList::clear() +void LayerList::clear() { layers.clear(); setModified(true); @@ -49,7 +49,7 @@ void RS_LayerList::clear() /** * @return Number of layers in the list. */ -uint RS_LayerList::count() const +uint LayerList::count() const { return layers.count(); } @@ -57,7 +57,7 @@ uint RS_LayerList::count() const /** * @return Layer at given position or NULL if i is out of range. */ -RS_Layer * RS_LayerList::at(uint i) +Layer * LayerList::at(uint i) { return layers.at(i); } @@ -67,20 +67,20 @@ RS_Layer * RS_LayerList::at(uint i) * * @param notify Notify listeners. */ -void RS_LayerList::activate(const QString & name, bool notify) +void LayerList::activate(const QString & name, bool notify) { - RS_DEBUG->print("RS_LayerList::activate: %s, notify: %d begin", name.toLatin1().data(), notify); + DEBUG->print("LayerList::activate: %s, notify: %d begin", name.toLatin1().data(), notify); activate(find(name), notify); /* if (activeLayer==NULL) { - RS_DEBUG->print("activeLayer is NULL"); + DEBUG->print("activeLayer is NULL"); } else { - RS_DEBUG->print("activeLayer is %s", activeLayer->getName().latin1()); + DEBUG->print("activeLayer is %s", activeLayer->getName().latin1()); } */ - RS_DEBUG->print("RS_LayerList::activate: %s end", name.toLatin1().data()); + DEBUG->print("LayerList::activate: %s end", name.toLatin1().data()); } /** @@ -88,15 +88,15 @@ void RS_LayerList::activate(const QString & name, bool notify) * * @param notify Notify listeners. */ -void RS_LayerList::activate(RS_Layer * layer, bool notify) +void LayerList::activate(Layer * layer, bool notify) { - RS_DEBUG->print("RS_LayerList::activate notify: %d begin", notify); + DEBUG->print("LayerList::activate notify: %d begin", notify); /*if (layer!=NULL) { - RS_DEBUG->print("RS_LayerList::activate: %s", + DEBUG->print("LayerList::activate: %s", layer->getName().latin1()); } else { - RS_DEBUG->print("RS_LayerList::activate: NULL"); + DEBUG->print("LayerList::activate: NULL"); }*/ activeLayer = layer; @@ -106,18 +106,18 @@ void RS_LayerList::activate(RS_Layer * layer, bool notify) { for(int i=0; ilayerActivated(activeLayer); - RS_DEBUG->print("RS_LayerList::activate listener notified"); + DEBUG->print("LayerList::activate listener notified"); } } #endif - RS_DEBUG->print("RS_LayerList::activate end"); + DEBUG->print("LayerList::activate end"); } //! @return The active layer of NULL if no layer is activated. -RS_Layer * RS_LayerList::getActive() +Layer * LayerList::getActive() { return activeLayer; } @@ -130,15 +130,15 @@ RS_Layer * RS_LayerList::getActive() * * Listeners are notified. */ -void RS_LayerList::add(RS_Layer * layer) +void LayerList::add(Layer * layer) { - RS_DEBUG->print("RS_LayerList::addLayer()"); + DEBUG->print("LayerList::addLayer()"); if (layer == NULL) return; // check if layer already exists: - RS_Layer * l = find(layer->getName()); + Layer * l = find(layer->getName()); if (l == NULL) { @@ -148,7 +148,7 @@ void RS_LayerList::add(RS_Layer * layer) // notify listeners for(int i=0; ilayerAdded(layer); } #endif @@ -177,9 +177,9 @@ void RS_LayerList::add(RS_Layer * layer) * Listeners are notified after the layer was removed from * the list but before it gets deleted. */ -void RS_LayerList::remove(RS_Layer * layer) +void LayerList::remove(Layer * layer) { - RS_DEBUG->print("RS_LayerList::removeLayer()"); + DEBUG->print("LayerList::removeLayer()"); if (layer == NULL) return; @@ -194,7 +194,7 @@ void RS_LayerList::remove(RS_Layer * layer) #if 0 for(int i=0; ilayerRemoved(layer); } #endif @@ -214,7 +214,7 @@ void RS_LayerList::remove(RS_Layer * layer) * are copied from layer 'source'. * Listeners are notified. */ -void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source) +void LayerList::edit(Layer * layer, const Layer & source) { if (!layer) return; @@ -224,7 +224,7 @@ void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source) #if 0 for(int i=0; ilayerEdited(layer); } #endif @@ -236,21 +236,21 @@ void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source) * @return Pointer to the layer with the given name or * \p NULL if no such layer was found. */ -RS_Layer * RS_LayerList::find(const QString & name) +Layer * LayerList::find(const QString & name) { - //RS_DEBUG->print("RS_LayerList::find begin"); + //DEBUG->print("LayerList::find begin"); - RS_Layer * ret = NULL; + Layer * ret = NULL; for(int i=0; igetName() == name) ret = l; } - //RS_DEBUG->print("RS_LayerList::find end"); + //DEBUG->print("LayerList::find end"); return ret; } @@ -259,15 +259,15 @@ RS_Layer * RS_LayerList::find(const QString & name) * @return Index of the given layer in the layer list or -1 if the layer * was not found. */ -int RS_LayerList::getIndex(const QString & name) +int LayerList::getIndex(const QString & name) { #if 0 - //RS_DEBUG->print("RS_LayerList::find begin"); + //DEBUG->print("LayerList::find begin"); int ret = -1; int i = 0; - for(RS_Layer * l=layers.first(); l!=NULL; l=layers.next()) + for(Layer * l=layers.first(); l!=NULL; l=layers.next()) { if (l->getName() == name) { @@ -278,13 +278,13 @@ int RS_LayerList::getIndex(const QString & name) i++; } - //RS_DEBUG->print("RS_LayerList::find end"); + //DEBUG->print("LayerList::find end"); return ret; #else for(int i=0; igetName() == name) return i; @@ -298,15 +298,15 @@ int RS_LayerList::getIndex(const QString & name) * @return Index of the given layer in the layer list or -1 if the layer * was not found. */ -int RS_LayerList::getIndex(RS_Layer * layer) +int LayerList::getIndex(Layer * layer) { #if 0 - //RS_DEBUG->print("RS_LayerList::find begin"); + //DEBUG->print("LayerList::find begin"); int ret = -1; int i = 0; - for(RS_Layer* l=layers.first(); l!=NULL; l=layers.next()) + for(Layer* l=layers.first(); l!=NULL; l=layers.next()) { if (l == layer) { @@ -317,7 +317,7 @@ int RS_LayerList::getIndex(RS_Layer * layer) i++; } - //RS_DEBUG->print("RS_LayerList::find end"); + //DEBUG->print("LayerList::find end"); return ret; #else @@ -329,7 +329,7 @@ int RS_LayerList::getIndex(RS_Layer * layer) * Switches on / off the given layer. * Listeners are notified. */ -void RS_LayerList::toggle(const QString & name) +void LayerList::toggle(const QString & name) { toggle(find(name)); } @@ -338,7 +338,7 @@ void RS_LayerList::toggle(const QString & name) * Switches on / off the given layer. * Listeners are notified. */ -void RS_LayerList::toggle(RS_Layer * layer) +void LayerList::toggle(Layer * layer) { if (!layer) return; @@ -349,7 +349,7 @@ void RS_LayerList::toggle(RS_Layer * layer) // Notify listeners: for(int i=0; i < layerListListeners.count(); ++i) { - RS_LayerListListener * l = layerListListeners.at(i); + LayerListListener * l = layerListListeners.at(i); l->layerToggled(layer); } #endif @@ -359,7 +359,7 @@ void RS_LayerList::toggle(RS_Layer * layer) * Locks or unlocks the given layer. * Listeners are notified. */ -void RS_LayerList::toggleLock(RS_Layer * layer) +void LayerList::toggleLock(Layer * layer) { if (!layer) return; @@ -370,7 +370,7 @@ void RS_LayerList::toggleLock(RS_Layer * layer) // Notify listeners: for(int i=0; ilayerToggled(layer); } #endif @@ -381,7 +381,7 @@ void RS_LayerList::toggleLock(RS_Layer * layer) * * @param freeze true: freeze, false: defreeze */ -void RS_LayerList::freezeAll(bool freeze) +void LayerList::freezeAll(bool freeze) { for(uint l=0; lfreeze(freeze); @@ -389,7 +389,7 @@ void RS_LayerList::freezeAll(bool freeze) #if 0 for(int i=0; ilayerToggled(NULL); } #endif @@ -402,7 +402,7 @@ void RS_LayerList::freezeAll(bool freeze) * * Typical listeners are: layer list widgets, pen toolbar, graphic view */ -void RS_LayerList::addListener(RS_LayerListListener * listener) +void LayerList::addListener(LayerListListener * listener) { layerListListeners.append(listener); } @@ -410,7 +410,7 @@ void RS_LayerList::addListener(RS_LayerListListener * listener) /** * removes a LayerListListener from the list of listeners. */ -void RS_LayerList::removeListener(RS_LayerListListener * listener) +void LayerList::removeListener(LayerListListener * listener) { // layerListListeners.remove(listener); @@ -424,7 +424,7 @@ void RS_LayerList::removeListener(RS_LayerListListener * listener) /** * Sets the layer lists modified status to 'm'. */ -void RS_LayerList::setModified(bool m) +void LayerList::setModified(bool m) { modified = m; } @@ -433,7 +433,7 @@ void RS_LayerList::setModified(bool m) * @retval true The layer list has been modified. * @retval false The layer list has not been modified. */ -/*virtual*/ bool RS_LayerList::isModified() const +/*virtual*/ bool LayerList::isModified() const { return modified; } @@ -441,7 +441,7 @@ void RS_LayerList::setModified(bool m) /** * Dumps the layers to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_LayerList & l) +std::ostream & operator<<(std::ostream & os, LayerList & l) { os << "Layerlist: \n"; diff --git a/src/base/layerlist.h b/src/base/layerlist.h index 2ee231e..9886a43 100644 --- a/src/base/layerlist.h +++ b/src/base/layerlist.h @@ -4,50 +4,50 @@ #include #include -class RS_Layer; -//class RS_LayerListListener; +class Layer; +//class LayerListListener; /** * A list of layers. * * @author Andrew Mustun */ -class RS_LayerList +class LayerList { public: - RS_LayerList(); - virtual ~RS_LayerList(); + LayerList(); + virtual ~LayerList(); void clear(); uint count() const; - RS_Layer * at(uint i); + Layer * at(uint i); void activate(const QString & name, bool notify = false); - void activate(RS_Layer * layer, bool notify = false); - RS_Layer * getActive(); - virtual void add(RS_Layer * layer); - virtual void remove(RS_Layer * layer); - virtual void edit(RS_Layer * layer, const RS_Layer & source); - RS_Layer * find(const QString & name); + void activate(Layer * layer, bool notify = false); + Layer * getActive(); + virtual void add(Layer * layer); + virtual void remove(Layer * layer); + virtual void edit(Layer * layer, const Layer & source); + Layer * find(const QString & name); int getIndex(const QString & name); - int getIndex(RS_Layer * layer); + int getIndex(Layer * layer); void toggle(const QString & name); - void toggle(RS_Layer * layer); - void toggleLock(RS_Layer * layer); + void toggle(Layer * layer); + void toggleLock(Layer * layer); void freezeAll(bool freeze); -// void addListener(RS_LayerListListener * listener); -// void removeListener(RS_LayerListListener * listener); +// void addListener(LayerListListener * listener); +// void removeListener(LayerListListener * listener); void setModified(bool m); virtual bool isModified() const; - friend std::ostream & operator<<(std::ostream & os, RS_LayerList & l); + friend std::ostream & operator<<(std::ostream & os, LayerList & l); private: //! layers in the graphic - QList layers; + QList layers; //! List of registered LayerListListeners -// QList layerListListeners; +// QList layerListListeners; //! Currently active layer - RS_Layer * activeLayer; + Layer * activeLayer; /** Flag set if the layer list was modified and not yet saved. */ bool modified; }; diff --git a/src/base/leader.cpp b/src/base/leader.cpp index 945e3df..995a21b 100644 --- a/src/base/leader.cpp +++ b/src/base/leader.cpp @@ -23,7 +23,7 @@ /** * Constructor. */ -RS_Leader::RS_Leader(RS_EntityContainer * parent): RS_EntityContainer(parent) +Leader::Leader(EntityContainer * parent): EntityContainer(parent) { empty = true; } @@ -32,8 +32,8 @@ RS_Leader::RS_Leader(RS_EntityContainer * parent): RS_EntityContainer(parent) * Constructor. * @param d Leader data */ -RS_Leader::RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d): - RS_EntityContainer(parent), data(d) +Leader::Leader(EntityContainer * parent, const LeaderData & d): + EntityContainer(parent), data(d) { empty = true; } @@ -41,13 +41,13 @@ RS_Leader::RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d): /** * Destructor */ -RS_Leader::~RS_Leader() +Leader::~Leader() { } -/*virtual*/ RS_Entity * RS_Leader::clone() +/*virtual*/ Entity * Leader::clone() { - RS_Leader * p = new RS_Leader(*this); + Leader * p = new Leader(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // p->entities.setAutoDelete(entities.autoDelete()); p->initId(); @@ -56,7 +56,7 @@ RS_Leader::~RS_Leader() } /** @return RS2::EntityDimLeader */ -/*virtual*/ RS2::EntityType RS_Leader::rtti() const +/*virtual*/ RS2::EntityType Leader::rtti() const { return RS2::EntityDimLeader; } @@ -64,10 +64,10 @@ RS_Leader::~RS_Leader() /** * Implementation of update. Updates the arrow. */ -void RS_Leader::update() +void Leader::update() { // find and delete arrow: - for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity()) + for(Entity * e=firstEntity(); e!=NULL; e=nextEntity()) { if (e->rtti() == RS2::EntitySolid) { @@ -82,33 +82,33 @@ void RS_Leader::update() return; } - RS_Entity * fe = firstEntity(); + Entity * fe = firstEntity(); if (fe != NULL && fe->isAtomic()) { - Vector p1 = ((RS_AtomicEntity *)fe)->getStartpoint(); - Vector p2 = ((RS_AtomicEntity *)fe)->getEndpoint(); + Vector p1 = ((AtomicEntity *)fe)->getStartpoint(); + Vector p2 = ((AtomicEntity *)fe)->getEndpoint(); // first entity must be the line which gets the arrow: if (hasArrowHead()) { - RS_Solid * s = new RS_Solid(this, RS_SolidData()); + Solid * s = new Solid(this, SolidData()); s->shapeArrow(p1, p2.angleTo(p1), getGraphicVariableDouble("$DIMASZ", 2.5)); - s->setPen(RS_Pen(RS2::FlagInvalid)); + s->setPen(Pen(RS2::FlagInvalid)); s->setLayer(NULL); - RS_EntityContainer::addEntity(s); + EntityContainer::addEntity(s); } } } /** @return Copy of data that defines the leader. */ -RS_LeaderData RS_Leader::getData() const +LeaderData Leader::getData() const { return data; } /** @return true: if this leader has an arrow at the beginning. */ -bool RS_Leader::hasArrowHead() +bool Leader::hasArrowHead() { return data.arrowHead; } @@ -124,9 +124,9 @@ bool RS_Leader::hasArrowHead() * @return Pointer to the entity that was addded or NULL if this * was the first vertex added. */ -RS_Entity * RS_Leader::addVertex(const Vector & v) +Entity * Leader::addVertex(const Vector & v) { - RS_Entity * entity = NULL; + Entity * entity = NULL; static Vector last = Vector(false); if (empty) @@ -137,10 +137,10 @@ RS_Entity * RS_Leader::addVertex(const Vector & v) else { // add line to the leader: - entity = new RS_Line(this, RS_LineData(last, v)); - entity->setPen(RS_Pen(RS2::FlagInvalid)); + entity = new Line(this, LineData(last, v)); + entity->setPen(Pen(RS2::FlagInvalid)); entity->setLayer(NULL); - RS_EntityContainer::addEntity(entity); + EntityContainer::addEntity(entity); if (count() == 1 && hasArrowHead()) update(); @@ -157,9 +157,9 @@ RS_Entity * RS_Leader::addVertex(const Vector & v) * * To add entities use addVertex() instead. */ -void RS_Leader::addEntity(RS_Entity * entity) +void Leader::addEntity(Entity * entity) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Leader::addEntity: should never be called"); + DEBUG->print(Debug::D_WARNING, "Leader::addEntity: should never be called"); if (entity == NULL) return; @@ -167,48 +167,48 @@ void RS_Leader::addEntity(RS_Entity * entity) delete entity; } -/*virtual*/ double RS_Leader::getLength() +/*virtual*/ double Leader::getLength() { return -1.0; } -void RS_Leader::move(Vector offset) +void Leader::move(Vector offset) { - RS_EntityContainer::move(offset); + EntityContainer::move(offset); update(); } -void RS_Leader::rotate(Vector center, double angle) +void Leader::rotate(Vector center, double angle) { - RS_EntityContainer::rotate(center, angle); + EntityContainer::rotate(center, angle); update(); } -void RS_Leader::scale(Vector center, Vector factor) +void Leader::scale(Vector center, Vector factor) { - RS_EntityContainer::scale(center, factor); + EntityContainer::scale(center, factor); update(); } -void RS_Leader::mirror(Vector axisPoint1, Vector axisPoint2) +void Leader::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_EntityContainer::mirror(axisPoint1, axisPoint2); + EntityContainer::mirror(axisPoint1, axisPoint2); update(); } -void RS_Leader::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Leader::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { - RS_EntityContainer::stretch(firstCorner, secondCorner, offset); + EntityContainer::stretch(firstCorner, secondCorner, offset); update(); } /** * Dumps the leader's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Leader & l) +std::ostream & operator<<(std::ostream & os, const Leader & l) { os << " Leader: " << l.getData() << " {\n"; - os << (RS_EntityContainer &)l; + os << (EntityContainer &)l; os << "\n}\n"; return os; diff --git a/src/base/leader.h b/src/base/leader.h index 521093e..9f14cf0 100644 --- a/src/base/leader.h +++ b/src/base/leader.h @@ -7,16 +7,16 @@ /** * Holds the data that defines a leader. */ -class RS_LeaderData +class LeaderData { public: - RS_LeaderData() {} - RS_LeaderData(bool arrowHeadFlag) + LeaderData() {} + LeaderData(bool arrowHeadFlag) { arrowHead = arrowHeadFlag; } - friend std::ostream & operator<<(std::ostream & os, const RS_LeaderData & /*ld*/) + friend std::ostream & operator<<(std::ostream & os, const LeaderData & /*ld*/) { os << "(Leader)"; return os; @@ -31,20 +31,20 @@ class RS_LeaderData * * @author Andrew Mustun */ -class RS_Leader: public RS_EntityContainer +class Leader: public EntityContainer { public: - RS_Leader(RS_EntityContainer * parent = NULL); - RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d); - virtual ~RS_Leader(); + Leader(EntityContainer * parent = NULL); + Leader(EntityContainer * parent, const LeaderData & d); + virtual ~Leader(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual void update(); - RS_LeaderData getData() const; + LeaderData getData() const; bool hasArrowHead(); - virtual RS_Entity * addVertex(const Vector & v); - virtual void addEntity(RS_Entity * entity); + virtual Entity * addVertex(const Vector & v); + virtual void addEntity(Entity * entity); virtual double getLength(); virtual void move(Vector offset); virtual void rotate(Vector center, double angle); @@ -52,10 +52,10 @@ class RS_Leader: public RS_EntityContainer virtual void mirror(Vector axisPoint1, Vector axisPoint2); virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); - friend std::ostream & operator<<(std::ostream & os, const RS_Leader & l); + friend std::ostream & operator<<(std::ostream & os, const Leader & l); protected: - RS_LeaderData data; + LeaderData data; bool empty; }; diff --git a/src/base/line.cpp b/src/base/line.cpp index 7b8404c..918d6e7 100644 --- a/src/base/line.cpp +++ b/src/base/line.cpp @@ -25,8 +25,8 @@ /** * Constructor. */ -RS_Line::RS_Line(RS_EntityContainer * parent, const RS_LineData & d): - RS_AtomicEntity(parent), data(d) +Line::Line(EntityContainer * parent, const LineData & d): + AtomicEntity(parent), data(d) { calculateBorders(); } @@ -34,68 +34,68 @@ RS_Line::RS_Line(RS_EntityContainer * parent, const RS_LineData & d): /** * Destructor. */ -RS_Line::~RS_Line() +Line::~Line() { } -RS_Entity * RS_Line::clone() +Entity * Line::clone() { - RS_Line * l = new RS_Line(*this); + Line * l = new Line(*this); l->initId(); return l; } -void RS_Line::calculateBorders() +void Line::calculateBorders() { minV = Vector::minimum(data.startpoint, data.endpoint); maxV = Vector::maximum(data.startpoint, data.endpoint); } /** @return RS2::EntityLine */ -RS2::EntityType RS_Line::rtti() const +RS2::EntityType Line::rtti() const { return RS2::EntityLine; } /** @return true */ -bool RS_Line::isEdge() const +bool Line::isEdge() const { return true; } /** @return Copy of data that defines the line. */ -RS_LineData RS_Line::getData() const +LineData Line::getData() const { return data; } -VectorSolutions RS_Line::getRefPoints() +VectorSolutions Line::getRefPoints() { VectorSolutions ret(data.startpoint, data.endpoint); return ret; } /** @return Start point of the entity */ -Vector RS_Line::getStartpoint() const +Vector Line::getStartpoint() const { return data.startpoint; } /** @return End point of the entity */ -Vector RS_Line::getEndpoint() const +Vector Line::getEndpoint() const { return data.endpoint; } /** Sets the startpoint */ -void RS_Line::setStartpoint(Vector s) +void Line::setStartpoint(Vector s) { data.startpoint = s; calculateBorders(); } /** Sets the endpoint */ -void RS_Line::setEndpoint(Vector e) +void Line::setEndpoint(Vector e) { data.endpoint = e; calculateBorders(); @@ -105,7 +105,7 @@ void RS_Line::setEndpoint(Vector e) * @return Direction 1. The angle at which the line starts at * the startpoint. */ -double RS_Line::getDirection1() const +double Line::getDirection1() const { return getAngle1(); } @@ -114,12 +114,12 @@ double RS_Line::getDirection1() const * @return Direction 2. The angle at which the line starts at * the endpoint. */ -double RS_Line::getDirection2() const +double Line::getDirection2() const { return getAngle2(); } -Vector RS_Line::getNearestEndpoint(const Vector & coord, double * dist) +Vector Line::getNearestEndpoint(const Vector & coord, double * dist) { double dist1, dist2; Vector * nearerPoint; @@ -145,8 +145,8 @@ Vector RS_Line::getNearestEndpoint(const Vector & coord, double * dist) return *nearerPoint; } -Vector RS_Line::getNearestPointOnEntity(const Vector & coord, - bool onEntity, double * dist, RS_Entity ** entity) +Vector Line::getNearestPointOnEntity(const Vector & coord, + bool onEntity, double * dist, Entity ** entity) { if (entity != NULL) *entity = this; @@ -182,7 +182,7 @@ Vector RS_Line::getNearestPointOnEntity(const Vector & coord, } } -Vector RS_Line::getNearestCenter(const Vector & coord, double * dist) +Vector Line::getNearestCenter(const Vector & coord, double * dist) { Vector p = (data.startpoint + data.endpoint) / 2.0; @@ -192,12 +192,12 @@ Vector RS_Line::getNearestCenter(const Vector & coord, double * dist) return p; } -Vector RS_Line::getNearestMiddle(const Vector & coord, double * dist) +Vector Line::getNearestMiddle(const Vector & coord, double * dist) { return getNearestCenter(coord, dist); } -Vector RS_Line::getNearestDist(double distance, const Vector & coord, double * dist) +Vector Line::getNearestDist(double distance, const Vector & coord, double * dist) { double a1 = getAngle1(); @@ -235,7 +235,7 @@ Vector RS_Line::getNearestDist(double distance, const Vector & coord, double * d return *nearerPoint; } -Vector RS_Line::getNearestDist(double distance, bool startp) +Vector Line::getNearestDist(double distance, bool startp) { double a1 = getAngle1(); @@ -251,7 +251,7 @@ Vector RS_Line::getNearestDist(double distance, bool startp) return ret; } -/*Vector RS_Line::getNearestRef(const Vector& coord, double* dist) +/*Vector Line::getNearestRef(const Vector& coord, double* dist) { double d1, d2, d; Vector p; @@ -273,10 +273,10 @@ Vector RS_Line::getNearestDist(double distance, bool startp) return p; }*/ -double RS_Line::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, +double Line::getDistanceToPoint(const Vector & coord, Entity ** entity, RS2::ResolveLevel /*level*/, double /*solidDist*/) { - RS_DEBUG->print("RS_Line::getDistanceToPoint"); + DEBUG->print("Line::getDistanceToPoint"); if (entity != NULL) *entity = this; @@ -286,7 +286,7 @@ double RS_Line::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, if (dist < 1.0e-4) { - RS_DEBUG->print("RS_Line::getDistanceToPoint: OK1"); + DEBUG->print("Line::getDistanceToPoint: OK1"); return dist; } @@ -294,7 +294,7 @@ double RS_Line::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, if (dist < 1.0e-4) { - RS_DEBUG->print("RS_Line::getDistanceToPoint: OK2"); + DEBUG->print("Line::getDistanceToPoint: OK2"); return dist; } @@ -306,46 +306,46 @@ double RS_Line::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, if (ae.magnitude() < 1.0e-6 || ea.magnitude() < 1.0e-6) { - RS_DEBUG->print("RS_Line::getDistanceToPoint: OK2a"); + DEBUG->print("Line::getDistanceToPoint: OK2a"); return dist; } // Orthogonal projection from both sides: - Vector ba = ae * Vector::dotP(ae, ap) / RS_Math::pow(ae.magnitude(), 2); - Vector be = ea * Vector::dotP(ea, ep) / RS_Math::pow(ea.magnitude(), 2); + Vector ba = ae * Vector::dotP(ae, ap) / Math::pow(ae.magnitude(), 2); + Vector be = ea * Vector::dotP(ea, ep) / Math::pow(ea.magnitude(), 2); // Check if the projection is outside this line: if (ba.magnitude() > ae.magnitude() || be.magnitude() > ea.magnitude()) { // return distance to endpoint getNearestEndpoint(coord, &dist); - RS_DEBUG->print("RS_Line::getDistanceToPoint: OK3"); + DEBUG->print("Line::getDistanceToPoint: OK3"); return dist; } - //RS_DEBUG->print("ba: %f", ba.magnitude()); - //RS_DEBUG->print("ae: %f", ae.magnitude()); + //DEBUG->print("ba: %f", ba.magnitude()); + //DEBUG->print("ae: %f", ae.magnitude()); Vector cp = Vector::crossP(ap, ae); dist = cp.magnitude() / ae.magnitude(); - RS_DEBUG->print("RS_Line::getDistanceToPoint: OK4"); + DEBUG->print("Line::getDistanceToPoint: OK4"); return dist; } -void RS_Line::moveStartpoint(const Vector & pos) +void Line::moveStartpoint(const Vector & pos) { data.startpoint = pos; calculateBorders(); } -void RS_Line::moveEndpoint(const Vector & pos) +void Line::moveEndpoint(const Vector & pos) { data.endpoint = pos; calculateBorders(); } -RS2::Ending RS_Line::getTrimPoint(const Vector & coord, const Vector & trimPoint) +RS2::Ending Line::getTrimPoint(const Vector & coord, const Vector & trimPoint) { double angEl = getAngle1(); double angM = trimPoint.angleTo(coord); @@ -363,7 +363,7 @@ RS2::Ending RS_Line::getTrimPoint(const Vector & coord, const Vector & trimPoint return RS2::EndingEnd; } -void RS_Line::reverse() +void Line::reverse() { Vector v = data.startpoint; data.startpoint = data.endpoint; @@ -371,20 +371,20 @@ void RS_Line::reverse() } /** @return the center point of the line. */ -Vector RS_Line::getMiddlepoint() +Vector Line::getMiddlepoint() { return (data.startpoint + data.endpoint) / 2.0; } /** Sets the y coordinate of the startpoint */ -void RS_Line::setStartpointY(double val) +void Line::setStartpointY(double val) { data.startpoint.y = val; calculateBorders(); } /** Sets the y coordinate of the endpoint */ -void RS_Line::setEndpointY(double val) +void Line::setEndpointY(double val) { data.endpoint.y = val; calculateBorders(); @@ -393,7 +393,7 @@ void RS_Line::setEndpointY(double val) /** * @return The length of the line. */ -double RS_Line::getLength() +double Line::getLength() { return data.startpoint.distanceTo(data.endpoint); } @@ -401,7 +401,7 @@ double RS_Line::getLength() /** * @return The angle of the line (from start to endpoint). */ -double RS_Line::getAngle1() const +double Line::getAngle1() const { return data.startpoint.angleTo(data.endpoint); } @@ -409,12 +409,12 @@ double RS_Line::getAngle1() const /** * @return The angle of the line (from end to startpoint). */ -double RS_Line::getAngle2() const +double Line::getAngle2() const { return data.endpoint.angleTo(data.startpoint); } -bool RS_Line::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool Line::hasEndpointsWithinWindow(Vector v1, Vector v2) { if (data.startpoint.isInWindow(v1, v2) || data.endpoint.isInWindow(v1, v2)) return true; @@ -422,43 +422,43 @@ bool RS_Line::hasEndpointsWithinWindow(Vector v1, Vector v2) return false; } -void RS_Line::move(Vector offset) +void Line::move(Vector offset) { - RS_DEBUG->print("RS_Line::move1: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::move1: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); - RS_DEBUG->print("RS_Line::move1: offset: %f/%f", offset.x, offset.y); + DEBUG->print("Line::move1: offset: %f/%f", offset.x, offset.y); data.startpoint.move(offset); data.endpoint.move(offset); calculateBorders(); - RS_DEBUG->print("RS_Line::move2: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::move2: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); } -void RS_Line::rotate(Vector center, double angle) +void Line::rotate(Vector center, double angle) { - RS_DEBUG->print("RS_Line::rotate"); - RS_DEBUG->print("RS_Line::rotate1: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::rotate"); + DEBUG->print("Line::rotate1: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); data.startpoint.rotate(center, angle); data.endpoint.rotate(center, angle); - RS_DEBUG->print("RS_Line::rotate2: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::rotate2: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); calculateBorders(); - RS_DEBUG->print("RS_Line::rotate: OK"); + DEBUG->print("Line::rotate: OK"); } -void RS_Line::scale(Vector center, Vector factor) +void Line::scale(Vector center, Vector factor) { - RS_DEBUG->print("RS_Line::scale1: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::scale1: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); data.startpoint.scale(center, factor); data.endpoint.scale(center, factor); - RS_DEBUG->print("RS_Line::scale2: sp: %f/%f, ep: %f/%f", + DEBUG->print("Line::scale2: sp: %f/%f, ep: %f/%f", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); calculateBorders(); } -void RS_Line::mirror(Vector axisPoint1, Vector axisPoint2) +void Line::mirror(Vector axisPoint1, Vector axisPoint2) { data.startpoint.mirror(axisPoint1, axisPoint2); data.endpoint.mirror(axisPoint1, axisPoint2); @@ -468,7 +468,7 @@ void RS_Line::mirror(Vector axisPoint1, Vector axisPoint2) /** * Stretches the given range of the entity by the given offset. */ -void RS_Line::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Line::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { if (getStartpoint().isInWindow(firstCorner, secondCorner)) moveStartpoint(getStartpoint() + offset); @@ -477,7 +477,7 @@ void RS_Line::stretch(Vector firstCorner, Vector secondCorner, Vector offset) moveEndpoint(getEndpoint() + offset); } -void RS_Line::moveRef(const Vector& ref, const Vector& offset) +void Line::moveRef(const Vector& ref, const Vector& offset) { if (ref.distanceTo(data.startpoint)<1.0e-4) { moveStartpoint(data.startpoint+offset); @@ -487,11 +487,11 @@ void RS_Line::moveRef(const Vector& ref, const Vector& offset) } } -void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternOffset) +void Line::draw(PaintInterface * painter, GraphicView * view, double patternOffset) { if (!painter || !view) //{ -//printf("RS_Line::draw(): Bailing out!!! painter=%08X, view=%08X\n", painter, view); +//printf("Line::draw(): Bailing out!!! painter=%08X, view=%08X\n", painter, view); return; //} @@ -501,33 +501,33 @@ void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternO || view->getDrawingMode() == RS2::ModePreview || styleFactor < 0.0) { -//printf("RS_Line::draw(): Drawing line...\n"); +//printf("Line::draw(): Drawing line...\n"); painter->drawLine(view->toGui(getStartpoint()), view->toGui(getEndpoint())); return; } // Pattern: #if 0 - RS_LineTypePattern * pat; + LineTypePattern * pat; if (isSelected()) pat = &patternSelected; else pat = view->getPattern(getPen().getLineType()); #else - RS_LineTypePattern * pat = (isSelected() ? &patternSelected : view->getPattern(getPen().getLineType())); + LineTypePattern * pat = (isSelected() ? &patternSelected : view->getPattern(getPen().getLineType())); #endif if (!pat) { -//printf("RS_Line::draw(): Pattern == NULL!\n"); - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Line::draw: Invalid line pattern"); +//printf("Line::draw(): Pattern == NULL!\n"); + DEBUG->print(Debug::D_WARNING, "Line::draw: Invalid line pattern"); return; } -//printf("RS_Line::draw(): Drawing a patterned line...(?)\n"); +//printf("Line::draw(): Drawing a patterned line...(?)\n"); // Pen to draw pattern is always solid: - RS_Pen pen = painter->getPen(); + Pen pen = painter->getPen(); pen.setLineType(RS2::SolidLine); painter->setPen(pen); @@ -564,7 +564,7 @@ void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternO //if (patternOffset<0.0) { // patternOffset+=patternSegmentLength; //} - //RS_DEBUG->print("pattern. offset: %f", patternOffset); + //DEBUG->print("pattern. offset: %f", patternOffset); Vector patternOffsetVec; patternOffsetVec.setPolar(patternOffset, angle); @@ -616,7 +616,7 @@ void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternO curP += dp[i]; tot += fabs(pat->pattern[i] * styleFactor); - //RS_DEBUG->print("pattern. tot: %f", tot); + //DEBUG->print("pattern. tot: %f", tot); i++; @@ -633,7 +633,7 @@ void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternO /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Line & l) +std::ostream & operator<<(std::ostream & os, const Line & l) { os << " Line: " << l.getData() << "\n"; return os; diff --git a/src/base/line.h b/src/base/line.h index 695bec7..816472b 100644 --- a/src/base/line.h +++ b/src/base/line.h @@ -6,24 +6,19 @@ /** * Holds the data that defines a line. */ -class RS_LineData +class LineData { public: /** * Default constructor. Leaves the data object uninitialized. */ - RS_LineData() {} + LineData() {} + LineData(const Vector & start, const Vector & end): startpoint(start), endpoint(end) {} - RS_LineData(const Vector & start, const Vector & end): startpoint(start), endpoint(end) - { -// this->startpoint = startpoint; -// this->endpoint = endpoint; - } - - friend class RS_Line; - friend class RS_ActionDrawLine; + friend class Line; + friend class ActionDrawLine; - friend std::ostream & operator<<(std::ostream & os, const RS_LineData & ld) + friend std::ostream & operator<<(std::ostream & os, const LineData & ld) { os << "(" << ld.startpoint << "/" << ld.endpoint << ")"; return os; @@ -39,18 +34,16 @@ class RS_LineData * * @author Andrew Mustun */ -class RS_Line: public RS_AtomicEntity +class Line: public AtomicEntity { public: - //RS_Line(RS_EntityContainer* parent); - //RS_Line(const RS_Line& l); - RS_Line(RS_EntityContainer * parent, const RS_LineData & d); - virtual ~RS_Line(); + Line(EntityContainer * parent, const LineData & d); + virtual ~Line(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual bool isEdge() const; - RS_LineData getData() const; + LineData getData() const; virtual VectorSolutions getRefPoints(); virtual Vector getStartpoint() const; @@ -73,14 +66,14 @@ class RS_Line: public RS_AtomicEntity 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); + bool onEntity = true, double * dist = NULL, 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 Vector getNearestDist(double distance, bool startp); //virtual Vector getNearestRef(const Vector& coord, double* dist = NULL); virtual double getDistanceToPoint(const Vector & coord, - RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, + Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual void move(Vector offset); @@ -91,12 +84,12 @@ class RS_Line: public RS_AtomicEntity virtual void moveRef(const Vector & ref, const Vector & offset); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Line & l); + friend std::ostream & operator<<(std::ostream & os, const Line & l); virtual void calculateBorders(); protected: - RS_LineData data; + LineData data; }; #endif diff --git a/src/base/linetypepattern.cpp b/src/base/linetypepattern.cpp index 8488a22..b7c3757 100644 --- a/src/base/linetypepattern.cpp +++ b/src/base/linetypepattern.cpp @@ -16,7 +16,7 @@ #include "linetypepattern.h" -RS_LineTypePattern::RS_LineTypePattern(int count ...) +LineTypePattern::LineTypePattern(int count ...) { va_list ap; int i = 0; @@ -31,7 +31,7 @@ RS_LineTypePattern::RS_LineTypePattern(int count ...) va_end(ap); } -RS_LineTypePattern::~RS_LineTypePattern() +LineTypePattern::~LineTypePattern() { delete[] pattern; } diff --git a/src/base/linetypepattern.h b/src/base/linetypepattern.h index 7674177..1ce8e24 100644 --- a/src/base/linetypepattern.h +++ b/src/base/linetypepattern.h @@ -6,11 +6,11 @@ /** * Stores a line type pattern. */ -class RS_LineTypePattern +class LineTypePattern { public: - RS_LineTypePattern(int count ...); - ~RS_LineTypePattern(); + LineTypePattern(int count ...); + ~LineTypePattern(); public: double * pattern; @@ -18,39 +18,39 @@ class RS_LineTypePattern }; // Create line patterns -static RS_LineTypePattern patternSolidLine(1, 10.0); +static LineTypePattern patternSolidLine(1, 10.0); -static RS_LineTypePattern patternDotLine(2, 0.1, -6.2); -static RS_LineTypePattern patternDotLine2(2, 0.1, -3.1); -static RS_LineTypePattern patternDotLineX2(2, 0.1, -12.4); +static LineTypePattern patternDotLine(2, 0.1, -6.2); +static LineTypePattern patternDotLine2(2, 0.1, -3.1); +static LineTypePattern patternDotLineX2(2, 0.1, -12.4); -static RS_LineTypePattern patternDashLine(2, 12.0, -6.0); -static RS_LineTypePattern patternDashLine2(2, 6.0, -3.0); -static RS_LineTypePattern patternDashLineX2(2, 24.0, -12.0); +static LineTypePattern patternDashLine(2, 12.0, -6.0); +static LineTypePattern patternDashLine2(2, 6.0, -3.0); +static LineTypePattern patternDashLineX2(2, 24.0, -12.0); -static RS_LineTypePattern patternDashDotLine(4, 12.0, -5.95, 0.1, -5.95); -static RS_LineTypePattern patternDashDotLine2(4, 6.0, -2.95, 0.1, -2.95); -static RS_LineTypePattern patternDashDotLineX2(4, 24.0, -11.95, 0.1, -11.95); +static LineTypePattern patternDashDotLine(4, 12.0, -5.95, 0.1, -5.95); +static LineTypePattern patternDashDotLine2(4, 6.0, -2.95, 0.1, -2.95); +static LineTypePattern patternDashDotLineX2(4, 24.0, -11.95, 0.1, -11.95); -static RS_LineTypePattern patternDivideLine( +static LineTypePattern patternDivideLine( 6, 12.0, -5.9, 0.15, -5.9, 0.15, -5.9); -static RS_LineTypePattern patternDivideLine2( +static LineTypePattern patternDivideLine2( 6, 6.0, -2.9, 0.15, -2.9, 0.15, -2.9); -static RS_LineTypePattern patternDivideLineX2( +static LineTypePattern patternDivideLineX2( 6, 24.0, -11.9, 0.15, -11.9, 0.15, -11.9); -static RS_LineTypePattern patternCenterLine(4, 32.0, -6.0, 6.0, -6.0); -static RS_LineTypePattern patternCenterLine2(4, 16.0, -3.0, 3.0, -3.0); -static RS_LineTypePattern patternCenterLineX2(4, 64.0, -12.0, 12.0, -12.0); +static LineTypePattern patternCenterLine(4, 32.0, -6.0, 6.0, -6.0); +static LineTypePattern patternCenterLine2(4, 16.0, -3.0, 3.0, -3.0); +static LineTypePattern patternCenterLineX2(4, 64.0, -12.0, 12.0, -12.0); -static RS_LineTypePattern patternBorderLine( +static LineTypePattern patternBorderLine( 6, 12.0, -6.0, 12.0, -5.95, 0.1, -5.95); -static RS_LineTypePattern patternBorderLine2( +static LineTypePattern patternBorderLine2( 6, 6.0, -3.0, 6.0, -2.95, 0.1, -2.95); -static RS_LineTypePattern patternBorderLineX2( +static LineTypePattern patternBorderLineX2( 6, 24.0, -12.0, 24.0, -11.95, 0.1, -11.95); -static RS_LineTypePattern patternBlockLine(2, 0.5, -0.5); -static RS_LineTypePattern patternSelected(2, 1.0, -3.0); +static LineTypePattern patternBlockLine(2, 0.5, -0.5); +static LineTypePattern patternSelected(2, 1.0, -3.0); #endif diff --git a/src/base/mainwindowinterface.h b/src/base/mainwindowinterface.h index eefd0e2..2fa4f7a 100644 --- a/src/base/mainwindowinterface.h +++ b/src/base/mainwindowinterface.h @@ -2,21 +2,21 @@ #define __MAINWINDOWINTERFACE_H__ class GraphicView; -class RS_Document; +class Document; /** * Interface for main application windows. */ -class RS_MainWindowInterface +class MainWindowInterface { public: - RS_MainWindowInterface() {} - virtual ~RS_MainWindowInterface() {} + MainWindowInterface() {} + virtual ~MainWindowInterface() {} virtual GraphicView * getGraphicView() = 0; - virtual RS_Document * getDocument() = 0; + virtual Document * getDocument() = 0; - virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL) = 0; + virtual void createNewDocument(const QString & fileName = QString::null, Document * doc = NULL) = 0; virtual void showSimulationControls() = 0; }; diff --git a/src/base/mathextra.cpp b/src/base/mathextra.cpp index 7646bf0..6598030 100644 --- a/src/base/mathextra.cpp +++ b/src/base/mathextra.cpp @@ -25,7 +25,7 @@ /** * Rounds the given double to the next int. */ -int RS_Math::round(double v) +int Math::round(double v) { return (v - floor(v) < 0.5 ? (int)floor(v) : (int)ceil(v)); } @@ -33,19 +33,19 @@ int RS_Math::round(double v) /** * Save pow function */ -double RS_Math::pow(double x, double y) +double Math::pow(double x, double y) { errno = 0; double ret = ::pow(x, y); if (errno == EDOM) { - RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Math::pow: EDOM in pow"); + DEBUG->print(Debug::D_ERROR, "Math::pow: EDOM in pow"); ret = 0.0; } else if (errno == ERANGE) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Math::pow: ERANGE in pow"); + DEBUG->print(Debug::D_WARNING, "Math::pow: ERANGE in pow"); ret = 0.0; } @@ -55,7 +55,7 @@ double RS_Math::pow(double x, double y) /** * Converts radians to degrees. */ -double RS_Math::rad2deg(double a) +double Math::rad2deg(double a) { return (a / (2.0 * M_PI) * 360.0); } @@ -63,7 +63,7 @@ double RS_Math::rad2deg(double a) /** * Converts degrees to radians. */ -double RS_Math::deg2rad(double a) +double Math::deg2rad(double a) { return ((a / 360.0) * (2.0 * M_PI)); } @@ -71,7 +71,7 @@ double RS_Math::deg2rad(double a) /** * Converts radians to gradians. */ -double RS_Math::rad2gra(double a) +double Math::rad2gra(double a) { return (a / (2.0 * M_PI) * 400.0); } @@ -79,7 +79,7 @@ double RS_Math::rad2gra(double a) /** * Finds greatest common divider using Euclid's algorithm. */ -int RS_Math::findGCD(int a, int b) +int Math::findGCD(int a, int b) { while (b != 0) { @@ -99,7 +99,7 @@ int RS_Math::findGCD(int a, int b) * @param reversed true for clockwise testing. false for ccw testing. * @return true if the angle a is between a1 and a2. */ -bool RS_Math::isAngleBetween(double a, double a1, double a2, bool reversed) +bool Math::isAngleBetween(double a, double a1, double a2, bool reversed) { bool ret = false; @@ -121,7 +121,7 @@ bool RS_Math::isAngleBetween(double a, double a1, double a2, bool reversed) ret = true; } - //RS_DEBUG->print("angle %f is %sbetween %f and %f", + //DEBUG->print("angle %f is %sbetween %f and %f", // a, ret ? "" : "not ", a1, a2); return ret; } @@ -129,7 +129,7 @@ bool RS_Math::isAngleBetween(double a, double a1, double a2, bool reversed) /** * Corrects the given angle to the range of 0-2*Pi. */ -double RS_Math::correctAngle(double a) +double Math::correctAngle(double a) { while (a > 2 * M_PI) a -= 2 * M_PI; @@ -144,7 +144,7 @@ double RS_Math::correctAngle(double a) * @return The angle that needs to be added to a1 to reach a2. * Always positive and less than 2*pi. */ -double RS_Math::getAngleDifference(double a1, double a2) +double Math::getAngleDifference(double a1, double a2) { double ret; @@ -170,7 +170,7 @@ double RS_Math::getAngleDifference(double a1, double a2) * @return The given angle or the given angle+PI, depending which on * is readable from the bottom or right. */ -double RS_Math::makeAngleReadable(double angle, bool readable, bool * corrected) +double Math::makeAngleReadable(double angle, bool readable, bool * corrected) { double ret; bool cor = isAngleReadable(angle) ^ readable; @@ -192,7 +192,7 @@ double RS_Math::makeAngleReadable(double angle, bool readable, bool * corrected) * @return true: if the given angle is in a range that is readable * for texts created with that angle. */ -bool RS_Math::isAngleReadable(double angle) +bool Math::isAngleReadable(double angle) { if (angle > M_PI /2.0 * 3.0 + 0.001 || angle < M_PI / 2.0 + 0.001) return true; @@ -204,7 +204,7 @@ bool RS_Math::isAngleReadable(double angle) * @param tol Tolerance in rad. * @retval true The two angles point in the same direction. */ -bool RS_Math::isSameDirection(double dir1, double dir2, double tol) +bool Math::isSameDirection(double dir1, double dir2, double tol) { double diff = fabs(dir1 - dir2); @@ -217,7 +217,7 @@ bool RS_Math::isSameDirection(double dir1, double dir2, double tol) /** * Compares two double values with a tolerance. */ -bool RS_Math::cmpDouble(double v1, double v2, double tol) +bool Math::cmpDouble(double v1, double v2, double tol) { return (fabs(v2 - v1) < tol); } @@ -226,10 +226,10 @@ bool RS_Math::cmpDouble(double v1, double v2, double tol) * Evaluates a mathematical expression and returns the result. * If an error occured, the given default value 'def' will be returned. */ -double RS_Math::eval(const QString & expr, double def) +double Math::eval(const QString & expr, double def) { bool ok; - double res = RS_Math::eval(expr, &ok); + double res = Math::eval(expr, &ok); if (!ok) return def; @@ -241,7 +241,7 @@ double RS_Math::eval(const QString & expr, double def) * Evaluates a mathematical expression and returns the result. * If an error occured, ok will be set to false (if ok isn't NULL). */ -double RS_Math::eval(const QString & expr, bool * ok) +double Math::eval(const QString & expr, bool * ok) { if (expr.isEmpty()) { @@ -299,26 +299,26 @@ double RS_Math::eval(const QString & expr, bool * ok) * @param prec Precision e.g. a precision of 1 would mean that a * value of 2.12030 will be converted to "2.1". 2.000 is always just "2"). */ -QString RS_Math::doubleToString(double value, double prec) +QString Math::doubleToString(double value, double prec) { if (prec < 1.0e-12) { - std::cerr << "RS_Math::doubleToString: invalid precision\n"; + std::cerr << "Math::doubleToString: invalid precision\n"; return ""; } QString ret; - int num = RS_Math::round(value / prec); + int num = Math::round(value / prec); - QString exaStr = RS_Math::doubleToString(prec, 10); + QString exaStr = Math::doubleToString(prec, 10); int dotPos = exaStr.indexOf('.'); if (dotPos == -1) - ret.sprintf("%d", RS_Math::round(num * prec)); + ret.sprintf("%d", Math::round(num * prec)); else { int digits = exaStr.length() - dotPos - 1; - ret = RS_Math::doubleToString(num * prec, digits); + ret = Math::doubleToString(num * prec, digits); } return ret; @@ -330,7 +330,7 @@ QString RS_Math::doubleToString(double value, double prec) * @param value The double value * @param prec Precision */ -QString RS_Math::doubleToString(double value, int prec) +QString Math::doubleToString(double value, int prec) { QString valStr; @@ -352,35 +352,35 @@ QString RS_Math::doubleToString(double value, int prec) /** * Performs some testing for the math class. */ -void RS_Math::test() +void Math::test() { - std::cout << "RS_Math::test: doubleToString:\n"; + std::cout << "Math::test: doubleToString:\n"; double v = 0.1; - QString s = RS_Math::doubleToString(v, 0.1); + QString s = Math::doubleToString(v, 0.1); assert(s == "0.1"); - s = RS_Math::doubleToString(v, 0.01); + s = Math::doubleToString(v, 0.01); assert(s == "0.1"); - s = RS_Math::doubleToString(v, 0.0); + s = Math::doubleToString(v, 0.0); assert(s == "0"); v = 0.01; - s = RS_Math::doubleToString(v, 0.1); + s = Math::doubleToString(v, 0.1); assert(s == "0"); - s = RS_Math::doubleToString(v, 0.01); + s = Math::doubleToString(v, 0.01); assert(s == "0.01"); - s = RS_Math::doubleToString(v, 0.0); + s = Math::doubleToString(v, 0.0); assert(s == "0"); v = 0.001; - s = RS_Math::doubleToString(v, 0.1); + s = Math::doubleToString(v, 0.1); assert(s == "0"); - s = RS_Math::doubleToString(v, 0.01); + s = Math::doubleToString(v, 0.01); assert(s == "0"); - s = RS_Math::doubleToString(v, 0.001); + s = Math::doubleToString(v, 0.001); assert(s == "0.001"); - s = RS_Math::doubleToString(v, 0.0); + s = Math::doubleToString(v, 0.0); assert(s == "0"); - std::cout << "RS_Math::test: complete\n"; + std::cout << "Math::test: complete\n"; } diff --git a/src/base/mathextra.h b/src/base/mathextra.h index eeb1ea6..d772b3f 100644 --- a/src/base/mathextra.h +++ b/src/base/mathextra.h @@ -10,28 +10,28 @@ /** * Math functions. */ -class RS_Math +class Math { -public: - static int round(double v); - static double pow(double x, double y); - static double rad2deg(double a); - static double deg2rad(double a); - static double rad2gra(double a); - static int findGCD(int a, int b); - static bool isAngleBetween(double a, double a1, double a2, bool reversed); - static double correctAngle(double a); - static double getAngleDifference(double a1, double a2); - static double makeAngleReadable(double angle, bool readable = true, bool * corrected = NULL); - static bool isAngleReadable(double angle); - static bool isSameDirection(double dir1, double dir2, double tol); - static double eval(const QString & expr, double def = 0.0); - static bool cmpDouble(double v1, double v2, double tol = 0.001); - static double eval(const QString & expr, bool * ok); - static QString doubleToString(double value, double prec); - static QString doubleToString(double value, int prec); + public: + static int round(double v); + static double pow(double x, double y); + static double rad2deg(double a); + static double deg2rad(double a); + static double rad2gra(double a); + static int findGCD(int a, int b); + static bool isAngleBetween(double a, double a1, double a2, bool reversed); + static double correctAngle(double a); + static double getAngleDifference(double a1, double a2); + static double makeAngleReadable(double angle, bool readable = true, bool * corrected = NULL); + static bool isAngleReadable(double angle); + static bool isSameDirection(double dir1, double dir2, double tol); + static double eval(const QString & expr, double def = 0.0); + static bool cmpDouble(double v1, double v2, double tol = 0.001); + static double eval(const QString & expr, bool * ok); + static QString doubleToString(double value, double prec); + static QString doubleToString(double value, int prec); - static void test(); + static void test(); }; #endif // __MATHEXTRA_H__ diff --git a/src/base/modification.cpp b/src/base/modification.cpp index c93ea26..9cac119 100644 --- a/src/base/modification.cpp +++ b/src/base/modification.cpp @@ -36,7 +36,7 @@ * any views to be updated. * @param handleUndo true: Handle undo functionalitiy. */ -RS_Modification::RS_Modification(RS_EntityContainer & container, +Modification::Modification(EntityContainer & container, GraphicView * graphicView, bool handleUndo) { this->container = &container; @@ -49,31 +49,31 @@ RS_Modification::RS_Modification(RS_EntityContainer & container, /** * Deletes all selected entities. */ -void RS_Modification::remove() +void Modification::remove() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::remove: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::remove: no valid container", Debug::D_WARNING); return; } - if (document != NULL) + if (document) document->startUndoCycle(); // not safe (?) - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { - if (e != NULL && e->isSelected()) + if (e && e->isSelected()) { e->setSelected(false); e->changeUndoState(); - if (document != NULL) + if (document) document->addUndoable(e); } } - if (document != NULL) + if (document) document->endUndoCycle(); graphicView->redraw(); @@ -82,29 +82,29 @@ void RS_Modification::remove() /** * Changes the attributes of all selected */ -bool RS_Modification::changeAttributes(RS_AttributesData & data) +bool Modification::changeAttributes(AttributesData & data) { if (!container) { - RS_DEBUG->print("RS_Modification::changeAttributes: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::changeAttributes: no valid container", Debug::D_WARNING); return false; } - QList addList; + QList addList; if (document) document->startUndoCycle(); - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); - RS_Pen pen = ec->getPen(false); + Pen pen = ec->getPen(false); if (data.changeLayer == true) ec->setLayer(data.layer); @@ -127,7 +127,7 @@ bool RS_Modification::changeAttributes(RS_AttributesData & data) // ec->setPenToActive(); //} //if (ec->rtti()==RS2::EntityInsert) { - // ((RS_Insert*)ec)->update(); + // ((Insert*)ec)->update(); //} ec->update(); addList.append(ec); @@ -156,19 +156,19 @@ bool RS_Modification::changeAttributes(RS_AttributesData & data) * @param ref Reference point. The entities will be moved by -ref. * @param cut true: cut instead of copying, false: copy */ -void RS_Modification::copy(const Vector& ref, const bool cut) { +void Modification::copy(const Vector& ref, const bool cut) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::copy: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::copy: no valid container", + Debug::D_WARNING); return; } - RS_CLIPBOARD->clear(); + CLIPBOARD->clear(); if (graphic!=NULL) { - RS_CLIPBOARD->getGraphic()->setUnit(graphic->getUnit()); + CLIPBOARD->getGraphic()->setUnit(graphic->getUnit()); } else { - RS_CLIPBOARD->getGraphic()->setUnit(RS2::None); + CLIPBOARD->getGraphic()->setUnit(RS2::None); } // start undo cycle for the container if we're cutting @@ -177,10 +177,10 @@ void RS_Modification::copy(const Vector& ref, const bool cut) { } // copy entities / layers / blocks - for (RS_Entity* e=container->firstEntity(); e!=NULL; + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { copyEntity(e, ref, cut); @@ -203,7 +203,7 @@ void RS_Modification::copy(const Vector& ref, const bool cut) { * @param ref Reference point. The entities will be moved by -ref. * @param cut true: cut instead of copying, false: copy */ -void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool cut) +void Modification::copyEntity(Entity * e, const Vector & ref, const bool cut) { if (e && e->isSelected()) { @@ -236,15 +236,15 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c } // add entity to clipboard: - RS_Entity * c = e->clone(); + Entity * c = e->clone(); c->move(-ref); - RS_CLIPBOARD->addEntity(c); + CLIPBOARD->addEntity(c); copyLayers(e); copyBlocks(e); // set layer to the layer clone: - RS_Layer * l = e->getLayer(); + Layer * l = e->getLayer(); if (l) c->setLayer(l->getName()); @@ -252,13 +252,13 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c // make sure all sub entities point to layers of the clipboard if (c->isContainer()) { - RS_EntityContainer * ec = (RS_EntityContainer *)c; + EntityContainer * ec = (EntityContainer *)c; - for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; + for(Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; e2=ec->nextEntity(RS2::ResolveAll)) { - //RS_Entity* e2 = ec->entityAt(i); - RS_Layer * l2 = e2->getLayer(); + //Entity* e2 = ec->entityAt(i); + Layer * l2 = e2->getLayer(); if (l2) e2->setLayer(l2->getName()); @@ -280,7 +280,7 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c /** * Copies all layers of the given entity to the clipboard. */ -void RS_Modification::copyLayers(RS_Entity* e) { +void Modification::copyLayers(Entity* e) { if (e==NULL) { return; @@ -289,10 +289,10 @@ void RS_Modification::copyLayers(RS_Entity* e) { // add layer(s) of the entity if it's not an insert // (inserts are on layer '0'): if (e->rtti()!=RS2::EntityInsert) { - RS_Layer* l = e->getLayer(); + Layer* l = e->getLayer(); if (l!=NULL) { - if (!RS_CLIPBOARD->hasLayer(l->getName())) { - RS_CLIPBOARD->addLayer(l->clone()); + if (!CLIPBOARD->hasLayer(l->getName())) { + CLIPBOARD->addLayer(l->clone()); } } } @@ -300,12 +300,12 @@ void RS_Modification::copyLayers(RS_Entity* e) { // special handling of inserts: else { // insert: add layer(s) of subentities: - RS_Block* b = ((RS_Insert*)e)->getBlockForInsert(); + Block* b = ((Insert*)e)->getBlockForInsert(); if (b!=NULL) { - for (RS_Entity* e2=b->firstEntity(); e2!=NULL; + for (Entity* e2=b->firstEntity(); e2!=NULL; e2=b->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e2 = b->entityAt(i); + //Entity* e2 = b->entityAt(i); copyLayers(e2); } } @@ -317,7 +317,7 @@ void RS_Modification::copyLayers(RS_Entity* e) { /** * Copies all blocks of the given entity to the clipboard. */ -void RS_Modification::copyBlocks(RS_Entity* e) { +void Modification::copyBlocks(Entity* e) { if (e==NULL) { return; @@ -325,17 +325,17 @@ void RS_Modification::copyBlocks(RS_Entity* e) { // add block of the entity if it's an insert if (e->rtti()==RS2::EntityInsert) { - RS_Block* b = ((RS_Insert*)e)->getBlockForInsert(); + Block* b = ((Insert*)e)->getBlockForInsert(); if (b!=NULL) { // add block of an insert: - if (!RS_CLIPBOARD->hasBlock(b->getName())) { - RS_CLIPBOARD->addBlock((RS_Block*)b->clone()); + if (!CLIPBOARD->hasBlock(b->getName())) { + CLIPBOARD->addBlock((Block*)b->clone()); } - for (RS_Entity* e2=b->firstEntity(); e2!=NULL; + for (Entity* e2=b->firstEntity(); e2!=NULL; e2=b->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e2 = b->entityAt(i); + //Entity* e2 = b->entityAt(i); copyBlocks(e2); } } @@ -353,23 +353,23 @@ void RS_Modification::copyBlocks(RS_Entity* e) { * @param source The source from where to paste. NULL means the source * is the clipboard. */ -void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { +void Modification::paste(const PasteData& data, Drawing* source) { if (graphic==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::paste: Graphic is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::paste: Graphic is NULL"); return; } double factor = 1.0; if (source==NULL) { - source = RS_CLIPBOARD->getGraphic(); + source = CLIPBOARD->getGraphic(); // graphics from the clipboard need to be scaled. from the part lib not: RS2::Unit sourceUnit = source->getUnit(); RS2::Unit targetUnit = graphic->getUnit(); - factor = RS_Units::convert(1.0, sourceUnit, targetUnit); + factor = Units::convert(1.0, sourceUnit, targetUnit); } if (document!=NULL) { @@ -379,9 +379,9 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // insert layers: if (graphic!=NULL) { - RS_Layer* layer = graphic->getActiveLayer(); + Layer* layer = graphic->getActiveLayer(); for(uint i=0; icountLayers(); ++i) { - RS_Layer* l = source->layerAt(i); + Layer* l = source->layerAt(i); if (l!=NULL) { if (graphic->findLayer(l->getName())==NULL) { graphic->addLayer(l->clone()); @@ -394,24 +394,24 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // insert blocks: if (graphic!=NULL) { for(uint i=0; icountBlocks(); ++i) { - RS_Block* b = source->blockAt(i); + Block* b = source->blockAt(i); if (b!=NULL) { if (graphic->findBlock(b->getName())==NULL) { - RS_Block* bc = (RS_Block*)b->clone(); + Block* bc = (Block*)b->clone(); bc->reparent(container); //bc->scale(bc->getBasePoint(), Vector(factor, factor)); // scale block but don't scale inserts in block // (they already scale with their block) for(uint i2=0; i2count(); ++i2) { - RS_Entity* e = bc->entityAt(i2); + Entity* e = bc->entityAt(i2); if (e!=NULL && e->rtti()!=RS2::EntityInsert) { e->scale(bc->getBasePoint(), Vector(factor, factor)); } else { - Vector ip = ((RS_Insert*)e)->getInsertionPoint(); + Vector ip = ((Insert*)e)->getInsertionPoint(); ip.scale(bc->getBasePoint(), Vector(factor, factor)); - ((RS_Insert*)e)->setInsertionPoint(ip); + ((Insert*)e)->setInsertionPoint(ip); e->update(); } } @@ -423,19 +423,19 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } // add entities to this host (graphic or a new block) - RS_EntityContainer* host = container; + EntityContainer* host = container; QString blockName; // create new block: if (graphic!=NULL) { if (data.asInsert==true) { - RS_BlockList* blkList = graphic->getBlockList(); + BlockList* blkList = graphic->getBlockList(); if (blkList!=NULL) { blockName = blkList->newName(data.blockName); - RS_Block* blk = - new RS_Block(graphic, - RS_BlockData(blockName, + Block* blk = + new Block(graphic, + BlockData(blockName, Vector(0.0,0.0), false)); graphic->addBlock(blk); @@ -445,29 +445,29 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } // insert entities: - //for (uint i=0; i<((RS_EntityContainer*)source)->count(); ++i) { - //RS_Entity* e = source->entityAt(i); - for (RS_Entity* e=((RS_EntityContainer*)source)->firstEntity(); + //for (uint i=0; i<((EntityContainer*)source)->count(); ++i) { + //Entity* e = source->entityAt(i); + for (Entity* e=((EntityContainer*)source)->firstEntity(); e!=NULL; - e=((RS_EntityContainer*)source)->nextEntity()) { + e=((EntityContainer*)source)->nextEntity()) { if (e!=NULL) { QString layerName = "0"; - RS_Layer* layer = e->getLayer(); + Layer* layer = e->getLayer(); if (layer!=NULL) { layerName = layer->getName(); } - RS_Entity* e2 = e->clone(); + Entity* e2 = e->clone(); e2->reparent(host); if (data.asInsert==false) { e2->move(data.insertionPoint); } // don't adjust insert factor - block was already adjusted to unit if (e2->rtti()==RS2::EntityInsert) { - Vector ip = ((RS_Insert*)e2)->getInsertionPoint(); + Vector ip = ((Insert*)e2)->getInsertionPoint(); ip.scale(data.insertionPoint, Vector(factor, factor)); - ((RS_Insert*)e2)->setInsertionPoint(ip); + ((Insert*)e2)->setInsertionPoint(ip); e2->update(); } else { e2->scale(data.insertionPoint, Vector(factor, factor)); @@ -477,13 +477,13 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // make sure all sub entities point to layers of the container if (e2->isContainer()) { - RS_EntityContainer* ec = (RS_EntityContainer*)e2; + EntityContainer* ec = (EntityContainer*)e2; - for (RS_Entity* e3 = ec->firstEntity(RS2::ResolveAll); e3!=NULL; + for (Entity* e3 = ec->firstEntity(RS2::ResolveAll); e3!=NULL; e3 = ec->nextEntity(RS2::ResolveAll)) { - //RS_Entity* e3 = ec->entityAt(i); - RS_Layer* l2 = e3->getLayer(); + //Entity* e3 = ec->entityAt(i); + Layer* l2 = e3->getLayer(); if (l2!=NULL) { e3->setLayer(l2->getName()); } @@ -497,9 +497,9 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } if (data.asInsert==true) { - RS_Insert* ins = - new RS_Insert(container, - RS_InsertData( + Insert* ins = + new Insert(container, + InsertData( blockName, data.insertionPoint, Vector(data.factor, data.factor), @@ -539,30 +539,30 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { * * @return true */ -bool RS_Modification::splitPolyline(RS_Polyline& polyline, - RS_Entity& e1, Vector v1, - RS_Entity& e2, Vector v2, - RS_Polyline** polyline1, - RS_Polyline** polyline2) const { +bool Modification::splitPolyline(Polyline& polyline, + Entity& e1, Vector v1, + Entity& e2, Vector v2, + Polyline** polyline1, + Polyline** polyline2) const { if (container==NULL) { - RS_DEBUG->print("RS_Modification::splitPolyline: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::splitPolyline: no valid container", + Debug::D_WARNING); return false; } - RS_Entity* firstEntity = polyline.firstEntity(); + Entity* firstEntity = polyline.firstEntity(); Vector firstPoint(false); if (firstEntity->rtti()==RS2::EntityLine) { - firstPoint = ((RS_Line*)firstEntity)->getStartpoint(); + firstPoint = ((Line*)firstEntity)->getStartpoint(); } - RS_Polyline* pl1 = - new RS_Polyline(container, - RS_PolylineData(firstPoint, Vector(0.0,0.0), 0)); - RS_Polyline* pl2 = new RS_Polyline(container); - RS_Polyline* pl = pl1; // Current polyline - RS_Line* line = NULL; - RS_Arc* arc = NULL; + Polyline* pl1 = + new Polyline(container, + PolylineData(firstPoint, Vector(0.0,0.0), 0)); + Polyline* pl2 = new Polyline(container); + Polyline* pl = pl1; // Current polyline + Line* line = NULL; + Arc* arc = NULL; if (polyline1!=NULL) { *polyline1 = pl1; @@ -571,15 +571,15 @@ bool RS_Modification::splitPolyline(RS_Polyline& polyline, *polyline2 = pl2; } - for (RS_Entity* e = polyline.firstEntity(); + for (Entity* e = polyline.firstEntity(); e != NULL; e = polyline.nextEntity()) { if (e->rtti()==RS2::EntityLine) { - line = (RS_Line*)e; + line = (Line*)e; arc = NULL; } else if (e->rtti()==RS2::EntityArc) { - arc = (RS_Arc*)e; + arc = (Arc*)e; line = NULL; } else { line = NULL; @@ -638,25 +638,25 @@ bool RS_Modification::splitPolyline(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, - const RS_AtomicEntity& segment, +Polyline* Modification::addPolylineNode(Polyline& polyline, + const AtomicEntity& segment, const Vector& node) { - RS_DEBUG->print("RS_Modification::addPolylineNode"); + DEBUG->print("Modification::addPolylineNode"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNode: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNode: no valid container", + Debug::D_WARNING); return NULL; } if (segment.getParent()!=&polyline) { - RS_DEBUG->print("RS_Modification::addPolylineNode: " + DEBUG->print("Modification::addPolylineNode: " "segment not part of the polyline", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -664,23 +664,23 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, // copy polyline and add new node: bool first = true; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::addPolylineNode: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::addPolylineNode: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: line segment"); + DEBUG->print("Modification::addPolylineNode: line segment"); bulge = 0.0; } if (first) { - RS_DEBUG->print("RS_Modification::addPolylineNode: first segment: %f/%f", + DEBUG->print("Modification::addPolylineNode: first segment: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -690,15 +690,15 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, // segment to split: if (ae==&segment) { - RS_DEBUG->print("RS_Modification::addPolylineNode: split segment found"); + DEBUG->print("Modification::addPolylineNode: split segment found"); - RS_DEBUG->print("RS_Modification::addPolylineNode: node: %f/%f", + DEBUG->print("Modification::addPolylineNode: node: %f/%f", node.x, node.y); newPolyline->setNextBulge(0.0); newPolyline->addVertex(node); - RS_DEBUG->print("RS_Modification::addPolylineNode: after node: %f/%f", + DEBUG->print("Modification::addPolylineNode: after node: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (ae!=lastEntity || polyline.isClosed()==false) { @@ -706,7 +706,7 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: normal vertex found: %f/%f", + DEBUG->print("Modification::addPolylineNode: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (ae!=lastEntity || polyline.isClosed()==false) { @@ -715,9 +715,9 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, } } } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: " + DEBUG->print("Modification::addPolylineNode: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } @@ -755,29 +755,29 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, +Polyline* Modification::deletePolylineNode(Polyline& polyline, const Vector& node) { - RS_DEBUG->print("RS_Modification::deletePolylineNode"); + DEBUG->print("Modification::deletePolylineNode"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNode: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNode: no valid container", + Debug::D_WARNING); return NULL; } if (node.valid==false) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: " + DEBUG->print("Modification::deletePolylineNode: " "node not valid", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check if the polyline is no longer there after deleting the node: if (polyline.count()==1) { - RS_Entity* e = polyline.firstEntity(); + Entity* e = polyline.firstEntity(); if (e!=NULL && e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (node.distanceTo(ae->getStartpoint())<1.0e-6 || node.distanceTo(ae->getEndpoint())<1.0e-6) { @@ -796,7 +796,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, return NULL; } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -805,18 +805,18 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // copy polyline and drop deleted node: bool first = true; bool lastDropped = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::deletePolylineNode: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: line segment"); + DEBUG->print("Modification::deletePolylineNode: line segment"); bulge = 0.0; } @@ -827,7 +827,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // first vertex (startpoint) if (first && node.distanceTo(ae->getStartpoint())>1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: first node: %f/%f", + DEBUG->print("Modification::deletePolylineNode: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -837,7 +837,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // normal node (not deleted): if (first==false && node.distanceTo(ae->getEndpoint())>1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: normal vertex found: %f/%f", + DEBUG->print("Modification::deletePolylineNode: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (lastDropped) { //bulge = 0.0; @@ -849,18 +849,18 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // drop deleted node: else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: deleting vertex: %f/%f", + DEBUG->print("Modification::deletePolylineNode: deleting vertex: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); lastDropped = true; } } else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: " + DEBUG->print("Modification::deletePolylineNode: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } - RS_DEBUG->print("RS_Modification::deletePolylineNode: ending polyline"); + DEBUG->print("Modification::deletePolylineNode: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); @@ -868,14 +868,14 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, //} // add new polyline: - RS_DEBUG->print("RS_Modification::deletePolylineNode: adding new polyline"); + DEBUG->print("Modification::deletePolylineNode: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::deletePolylineNode: handling undo"); + DEBUG->print("Modification::deletePolylineNode: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -901,46 +901,46 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, - RS_AtomicEntity& segment, const Vector& node1, const Vector& node2) { +Polyline* Modification::deletePolylineNodesBetween(Polyline& polyline, + AtomicEntity& segment, const Vector& node1, const Vector& node2) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween"); + DEBUG->print("Modification::deletePolylineNodesBetween"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNodesBetween: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNodesBetween: no valid container", + Debug::D_WARNING); return NULL; } if (node1.valid==false || node2.valid==false) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "node not valid", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } if (node1.distanceTo(node2)<1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "nodes are identical", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check if there's nothing to delete: - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if ((node1.distanceTo(ae->getStartpoint())<1.0e-6 && node2.distanceTo(ae->getEndpoint())<1.0e-6) || (node2.distanceTo(ae->getStartpoint())<1.0e-6 && node1.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "nothing to delete", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } } @@ -961,11 +961,11 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, bool found = false; double length1 = 0.0; double length2 = 0.0; - RS_Entity* e=polyline.firstEntity(); + Entity* e=polyline.firstEntity(); if (startpointInvolved) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; length1+=ae->getLength(); } e = polyline.nextEntity(); @@ -973,7 +973,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, for (; e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (node1.distanceTo(ae->getStartpoint())<1.0e-6 || node2.distanceTo(ae->getStartpoint())<1.0e-6) { @@ -995,7 +995,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, } } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -1011,28 +1011,28 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, bool removing = deleteStart; bool done = false; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); + Entity* lastEntity = polyline.lastEntity(); int i=0; double bulge = 0.0; - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: entity: %d", i++); - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: removing: %d", (int)removing); + DEBUG->print("Modification::deletePolylineNodesBetween: entity: %d", i++); + DEBUG->print("Modification::deletePolylineNodesBetween: removing: %d", (int)removing); if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::deletePolylineNodesBetween: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: line segment"); + DEBUG->print("Modification::deletePolylineNodesBetween: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "dropping last vertex of closed polyline"); continue; } @@ -1040,7 +1040,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // first vertex (startpoint) if (first) { if (!removing) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: first node: %f/%f", + DEBUG->print("Modification::deletePolylineNodesBetween: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); newPolyline->addVertex(ae->getStartpoint()); @@ -1052,7 +1052,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, if (removing==true && (node1.distanceTo(ae->getEndpoint())<1.0e-6 || node2.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "stop removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = false; @@ -1064,7 +1064,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // normal node (not deleted): if (removing==false && (done==false || deleteStart==false)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { @@ -1077,7 +1077,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // drop deleted node: else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "deleting vertex: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); } @@ -1086,7 +1086,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, if (done==false && removing==false && (node1.distanceTo(ae->getEndpoint())<1.0e-6 || node2.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "start removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = true; @@ -1096,25 +1096,25 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, done=false; } } else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: ending polyline"); + DEBUG->print("Modification::deletePolylineNodesBetween: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); // add new polyline: - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: adding new polyline"); + DEBUG->print("Modification::deletePolylineNodesBetween: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: handling undo"); + DEBUG->print("Modification::deletePolylineNodesBetween: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1142,44 +1142,44 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, - RS_AtomicEntity& segment1, - RS_AtomicEntity& segment2) { +Polyline* Modification::polylineTrim(Polyline& polyline, + AtomicEntity& segment1, + AtomicEntity& segment2) { - RS_DEBUG->print("RS_Modification::polylineTrim"); + DEBUG->print("Modification::polylineTrim"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNodesBetween: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNodesBetween: no valid container", + Debug::D_WARNING); return NULL; } if (segment1.getParent()!=&polyline || segment2.getParent()!=&polyline) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments not in polyline", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } if (&segment1==&segment2) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments are identical", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } VectorSolutions sol; - sol = RS_Information::getIntersection(&segment1, &segment2, false); + sol = Information::getIntersection(&segment1, &segment2, false); if (sol.getNumber()==0) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments cannot be trimmed", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check which segment comes first in the polyline: - RS_AtomicEntity* firstSegment; + AtomicEntity* firstSegment; if (polyline.findEntity(&segment1) > polyline.findEntity(&segment2)) { firstSegment = &segment2; } else { @@ -1188,12 +1188,12 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // find out if we need to trim towards the open part of the polyline bool reverseTrim; - reverseTrim = !RS_Math::isSameDirection(firstSegment->getDirection1(), + reverseTrim = !Math::isSameDirection(firstSegment->getDirection1(), firstSegment->getStartpoint().angleTo(sol.get(0)), M_PI/2.0); - //reverseTrim = reverseTrim || !RS_Math::isSameDirection(segment2.getDirection1(), + //reverseTrim = reverseTrim || !Math::isSameDirection(segment2.getDirection1(), // segment2.getStartpoint().angleTo(sol.get(0)), M_PI/2.0); - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -1205,31 +1205,31 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, bool first = true; bool removing = false; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::polylineTrim: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::polylineTrim: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::polylineTrim: line segment"); + DEBUG->print("Modification::polylineTrim: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "dropping last vertex of closed polyline"); continue; } // first vertex (startpoint) if (first) { - RS_DEBUG->print("RS_Modification::polylineTrim: first node: %f/%f", + DEBUG->print("Modification::polylineTrim: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -1239,7 +1239,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // trim and start removing nodes: if (removing==false && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "start removing at trim point %f/%f", sol.get(0).x, sol.get(0).y); newPolyline->setNextBulge(0.0); @@ -1250,14 +1250,14 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // stop removing nodes: else if (removing==true && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: stop removing at: %f/%f", + DEBUG->print("Modification::polylineTrim: stop removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = false; } // normal node (not deleted): if (removing==false) { - RS_DEBUG->print("RS_Modification::polylineTrim: normal vertex found: %f/%f", + DEBUG->print("Modification::polylineTrim: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { newPolyline->setNextBulge(0.0); @@ -1268,9 +1268,9 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } } @@ -1281,31 +1281,31 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, //bool first = true; bool removing = true; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::polylineTrim: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::polylineTrim: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::polylineTrim: line segment"); + DEBUG->print("Modification::polylineTrim: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "dropping last vertex of closed polyline"); continue; } // trim and stop removing nodes: if (removing==true && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "stop removing at trim point %f/%f", sol.get(0).x, sol.get(0).y); newPolyline->setNextBulge(0.0); @@ -1317,7 +1317,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // start removing nodes again: else if (removing==false && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: start removing at: %f/%f", + DEBUG->print("Modification::polylineTrim: start removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); newPolyline->setNextBulge(0.0); // start of new polyline: @@ -1327,7 +1327,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // normal node (not deleted): if (removing==false) { - RS_DEBUG->print("RS_Modification::polylineTrim: normal vertex found: %f/%f", + DEBUG->print("Modification::polylineTrim: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { newPolyline->setNextBulge(0.0); @@ -1338,26 +1338,26 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } } - RS_DEBUG->print("RS_Modification::polylineTrim: ending polyline"); + DEBUG->print("Modification::polylineTrim: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); // add new polyline: - RS_DEBUG->print("RS_Modification::polylineTrim: adding new polyline"); + DEBUG->print("Modification::polylineTrim: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::polylineTrim: handling undo"); + DEBUG->print("Modification::polylineTrim: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1376,17 +1376,17 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, * Moves all selected entities with the given data for the move * modification. */ -bool RS_Modification::move(RS_MoveData & data) +bool Modification::move(MoveData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::move: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::move: no valid container", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document != NULL && handleUndo) document->startUndoCycle(); @@ -1396,12 +1396,12 @@ bool RS_Modification::move(RS_MoveData & data) { // too slow: //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + //Entity* e = container->entityAt(i); + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->move(data.offset * num); if (data.useCurrentLayer) @@ -1411,7 +1411,7 @@ bool RS_Modification::move(RS_MoveData & data) ec->setPenToActive(); if (ec->rtti() == RS2::EntityInsert) - ((RS_Insert *)ec)->update(); + ((Insert *)ec)->update(); // since 2.0.4.0: keep selection ec->setSelected(true); @@ -1435,18 +1435,18 @@ bool RS_Modification::move(RS_MoveData & data) /** * Rotates all selected entities with the given data for the rotation. */ -bool RS_Modification::rotate(RS_RotateData & data) +bool Modification::rotate(RotateData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::rotate: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::rotate: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) document->startUndoCycle(); @@ -1454,14 +1454,14 @@ bool RS_Modification::rotate(RS_RotateData & data) // Create new entites for(int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for (Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); ec->rotate(data.center, data.angle*num); @@ -1472,7 +1472,7 @@ bool RS_Modification::rotate(RS_RotateData & data) ec->setPenToActive(); if (ec->rtti() == RS2::EntityInsert) - ((RS_Insert *)ec)->update(); + ((Insert *)ec)->update(); addList.append(ec); } @@ -1495,17 +1495,17 @@ bool RS_Modification::rotate(RS_RotateData & data) * Moves all selected entities with the given data for the scale * modification. */ -bool RS_Modification::scale(RS_ScaleData & data) +bool Modification::scale(ScaleData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::scale: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::scale: no valid container", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) document->startUndoCycle(); @@ -1513,15 +1513,15 @@ bool RS_Modification::scale(RS_ScaleData & data) // Create new entites for(int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); - ec->scale(data.referencePoint, RS_Math::pow(data.factor, num)); + ec->scale(data.referencePoint, Math::pow(data.factor, num)); if (data.useCurrentLayer) ec->setLayerToActive(); @@ -1530,7 +1530,7 @@ bool RS_Modification::scale(RS_ScaleData & data) ec->setPenToActive(); if (ec->rtti()==RS2::EntityInsert) - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); addList.append(ec); } @@ -1553,17 +1553,17 @@ bool RS_Modification::scale(RS_ScaleData & data) * Mirror all selected entities with the given data for the mirror * modification. */ -bool RS_Modification::mirror(RS_MirrorData & data) +bool Modification::mirror(MirrorData & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::mirror: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::mirror: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1573,14 +1573,14 @@ bool RS_Modification::mirror(RS_MirrorData & data) for (int num=1; num<=(int)data.copy || (data.copy==false && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->mirror(data.axisPoint1, data.axisPoint2); @@ -1591,7 +1591,7 @@ bool RS_Modification::mirror(RS_MirrorData & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1614,17 +1614,17 @@ bool RS_Modification::mirror(RS_MirrorData & data) /** * Rotates entities around two centers with the given parameters. */ -bool RS_Modification::rotate2(RS_Rotate2Data & data) +bool Modification::rotate2(Rotate2Data & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::rotate2: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::rotate2: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1635,14 +1635,14 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->rotate(data.center1, data.angle1*num); @@ -1657,7 +1657,7 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1680,17 +1680,17 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) /** * Moves and rotates entities with the given parameters. */ -bool RS_Modification::moveRotate(RS_MoveRotateData & data) +bool Modification::moveRotate(MoveRotateData & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::moveRotate: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::moveRotate: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1700,14 +1700,14 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) for (int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->move(data.offset*num); @@ -1720,7 +1720,7 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1745,19 +1745,19 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) * * @param remove true: Remove entites. */ -void RS_Modification::deselectOriginals(bool remove) +void Modification::deselectOriginals(bool remove) { - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL) { bool selected = false; /* if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (ae->isStartpointSelected() || ae->isEndpointSelected()) { @@ -1800,13 +1800,13 @@ void RS_Modification::deselectOriginals(bool remove) * * @param addList Entities to add. */ -//void RS_Modification::addNewEntities(Q3PtrList & addList) -void RS_Modification::addNewEntities(QList & addList) +//void Modification::addNewEntities(Q3PtrList & addList) +void Modification::addNewEntities(QList & addList) { -// for(RS_Entity * e=addList.first(); e!=NULL; e=addList.next()) +// for(Entity * e=addList.first(); e!=NULL; e=addList.next()) for(int i=0; i & addList) * @param limitEntity Entity to which the trim entity will be trimmed. * @param both true: Trim both entities. false: trim trimEntity only. */ -bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, - const Vector& limitCoord, RS_Entity* limitEntity, bool both) +bool Modification::trim(const Vector& trimCoord, AtomicEntity* trimEntity, + const Vector& limitCoord, Entity* limitEntity, bool both) { if (trimEntity==NULL || limitEntity==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::trim: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::trim: At least one entity is NULL"); return false; } if (both && !limitEntity->isAtomic()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::trim: limitEntity is not atomic"); + DEBUG->print(Debug::D_WARNING, + "Modification::trim: limitEntity is not atomic"); } VectorSolutions sol; @@ -1854,21 +1854,21 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, if (limitEntity->isAtomic()) { // intersection(s) of the two entities: - sol = RS_Information::getIntersection(trimEntity, limitEntity, false); + sol = Information::getIntersection(trimEntity, limitEntity, false); } else if (limitEntity->isContainer()) { - RS_EntityContainer* ec = (RS_EntityContainer*)limitEntity; + EntityContainer* ec = (EntityContainer*)limitEntity; sol.alloc(128); int i=0; - for (RS_Entity* e=ec->firstEntity(RS2::ResolveAll); e!=NULL; + for (Entity* e=ec->firstEntity(RS2::ResolveAll); e!=NULL; e=ec->nextEntity(RS2::ResolveAll)) { //for (int i=0; icount(); ++i) { - // RS_Entity* e = container->entityAt(i); + // Entity* e = container->entityAt(i); if (e!=NULL) { - VectorSolutions s2 = RS_Information::getIntersection(trimEntity, + VectorSolutions s2 = Information::getIntersection(trimEntity, e, false); if (s2.hasValid()) { @@ -1888,23 +1888,23 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, if (!sol.hasValid()) return false; - RS_AtomicEntity * trimmed1 = NULL; - RS_AtomicEntity * trimmed2 = NULL; + AtomicEntity * trimmed1 = NULL; + AtomicEntity * trimmed2 = NULL; // remove trim entity from view: if (trimEntity->rtti() == RS2::EntityCircle) { // convert a circle into a trimmable arc - RS_Circle * c = (RS_Circle *)trimEntity; + Circle * c = (Circle *)trimEntity; double am = c->getCenter().angleTo(trimCoord); - RS_ArcData d(c->getCenter(), c->getRadius(), - RS_Math::correctAngle(am - M_PI / 2), - RS_Math::correctAngle(am + M_PI / 2), false); - trimmed1 = new RS_Arc(trimEntity->getParent(), d); + ArcData d(c->getCenter(), c->getRadius(), + Math::correctAngle(am - M_PI / 2), + Math::correctAngle(am + M_PI / 2), false); + trimmed1 = new Arc(trimEntity->getParent(), d); } else { - trimmed1 = (RS_AtomicEntity *)trimEntity->clone(); + trimmed1 = (AtomicEntity *)trimEntity->clone(); trimmed1->setHighlighted(false); } @@ -1917,7 +1917,7 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, // remove limit entity from view: if (both) { - trimmed2 = (RS_AtomicEntity *)limitEntity->clone(); + trimmed2 = (AtomicEntity *)limitEntity->clone(); trimmed2->setHighlighted(false); #warning "!!! Old rendering path needs upgrading !!!" @@ -1931,13 +1931,13 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, int ind = 0; Vector is = sol.getClosest(limitCoord, NULL, &ind); //sol.getClosest(limitCoord, NULL, &ind); - RS_DEBUG->print("RS_Modification::trim: limitCoord: %f/%f", limitCoord.x, limitCoord.y); - RS_DEBUG->print("RS_Modification::trim: sol.get(0): %f/%f", sol.get(0).x, sol.get(0).y); - RS_DEBUG->print("RS_Modification::trim: sol.get(1): %f/%f", sol.get(1).x, sol.get(1).y); - RS_DEBUG->print("RS_Modification::trim: ind: %d", ind); + DEBUG->print("Modification::trim: limitCoord: %f/%f", limitCoord.x, limitCoord.y); + DEBUG->print("Modification::trim: sol.get(0): %f/%f", sol.get(0).x, sol.get(0).y); + DEBUG->print("Modification::trim: sol.get(1): %f/%f", sol.get(1).x, sol.get(1).y); + DEBUG->print("Modification::trim: ind: %d", ind); Vector is2 = sol.get(ind==0 ? 1 : 0); //Vector is2 = sol.get(ind); - RS_DEBUG->print("RS_Modification::trim: is2: %f/%f", is2.x, is2.y); + DEBUG->print("Modification::trim: is2: %f/%f", is2.x, is2.y); //RS2::Ending ending = trimmed1->getTrimPoint(trimCoord, is); RS2::Ending ending = trimmed1->getTrimPoint(trimCoord, is); @@ -2017,19 +2017,19 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, * @param trimEntity Entity which will be trimmed. * @param dist Amount to trim by. */ -bool RS_Modification::trimAmount(const Vector & trimCoord, - RS_AtomicEntity * trimEntity, double dist) +bool Modification::trimAmount(const Vector & trimCoord, + AtomicEntity * trimEntity, double dist) { if (!trimEntity) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Modification::trimAmount: Entity is NULL"); + DEBUG->print(Debug::D_WARNING, "Modification::trimAmount: Entity is NULL"); return false; } - RS_AtomicEntity * trimmed = NULL; + AtomicEntity * trimmed = NULL; // remove trim entity: - trimmed = (RS_AtomicEntity*)trimEntity->clone(); + trimmed = (AtomicEntity*)trimEntity->clone(); #warning "!!! Old rendering path needs upgrading !!!" #if 0 @@ -2075,26 +2075,26 @@ bool RS_Modification::trimAmount(const Vector & trimCoord, /** * Cuts the given entity at the given point. */ -bool RS_Modification::cut(const Vector& cutCoord, - RS_AtomicEntity* cutEntity) { +bool Modification::cut(const Vector& cutCoord, + AtomicEntity* cutEntity) { if (cutEntity==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Entity is NULL"); return false; } if (!cutCoord.valid) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Point invalid."); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Point invalid."); return false; } // cut point is at endpoint of entity: if (cutCoord.distanceTo(cutEntity->getStartpoint())<1.0e-6 || cutCoord.distanceTo(cutEntity->getEndpoint())<1.0e-6) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Cutting point on endpoint"); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Cutting point on endpoint"); return false; } @@ -2105,15 +2105,15 @@ bool RS_Modification::cut(const Vector& cutCoord, graphicView->deleteEntity(cutEntity); #endif - RS_AtomicEntity * cut1 = NULL; - RS_AtomicEntity * cut2 = NULL; + AtomicEntity * cut1 = NULL; + AtomicEntity * cut2 = NULL; // create new two halves: if (cutEntity->rtti() == RS2::EntityCircle) { - RS_Circle * c = (RS_Circle *)cutEntity; - cut1 = new RS_Arc(cutEntity->getParent(), - RS_ArcData(c->getCenter(), + Circle * c = (Circle *)cutEntity; + cut1 = new Arc(cutEntity->getParent(), + ArcData(c->getCenter(), c->getRadius(), 0.0,0.0, false)); cut1->setPen(cutEntity->getPen()); @@ -2125,8 +2125,8 @@ bool RS_Modification::cut(const Vector& cutCoord, } else { - cut1 = (RS_AtomicEntity*)cutEntity->clone(); - cut2 = (RS_AtomicEntity*)cutEntity->clone(); + cut1 = (AtomicEntity*)cutEntity->clone(); + cut2 = (AtomicEntity*)cutEntity->clone(); cut1->trimEndpoint(cutCoord); cut2->trimStartpoint(cutCoord); @@ -2162,30 +2162,30 @@ bool RS_Modification::cut(const Vector& cutCoord, /** * Stretching. */ -bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCorner, +bool Modification::stretch(const Vector& firstCorner, const Vector& secondCorner, const Vector& offset) { if (!offset.valid) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::stretch: Offset invalid"); + DEBUG->print(Debug::D_WARNING, + "Modification::stretch: Offset invalid"); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } // Create new entites - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (int i=0; icount(); ++i) { - // RS_Entity* e = container->entityAt(i); + // Entity* e = container->entityAt(i); if (e!=NULL && e->isVisible() && @@ -2193,7 +2193,7 @@ bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCor (e->isInWindow(firstCorner, secondCorner) || e->hasEndpointsWithinWindow(firstCorner, secondCorner))) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->stretch(firstCorner, secondCorner, offset); addList.append(ec); e->setSelected(true); @@ -2224,19 +2224,19 @@ bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCor * @param entity2 Second entity of the corner. * @param data Lengths and trim flag. */ -bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, - const Vector& coord2, RS_AtomicEntity* entity2, - RS_BevelData& data) { +bool Modification::bevel(const Vector& coord1, AtomicEntity* entity1, + const Vector& coord2, AtomicEntity* entity2, + BevelData& data) { - RS_DEBUG->print("RS_Modification::bevel"); + DEBUG->print("Modification::bevel"); if (entity1==NULL || entity2==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::bevel: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::bevel: At least one entity is NULL"); return false; } - RS_EntityContainer* baseContainer = container; + EntityContainer* baseContainer = container; bool isPolyline = false; bool isClosedPolyline = false; @@ -2246,16 +2246,16 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // find out whether we're bevelling within a polyline: if (entity1->getParent()!=NULL && entity1->getParent()->rtti()==RS2::EntityPolyline) { - RS_DEBUG->print("RS_Modification::bevel: trimming polyline segments"); + DEBUG->print("Modification::bevel: trimming polyline segments"); if (entity1->getParent()!=entity2->getParent()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::bevel: entities not in the same polyline"); + DEBUG->print(Debug::D_WARNING, + "Modification::bevel: entities not in the same polyline"); return false; } // clone polyline for undo if (document!=NULL && handleUndo) { - RS_EntityContainer* cl = - (RS_EntityContainer*)entity1->getParent()->clone(); + EntityContainer* cl = + (EntityContainer*)entity1->getParent()->clone(); container->addEntity(cl); //cl->setUndoState(true); document->addUndoable(cl); @@ -2266,33 +2266,33 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, baseContainer = cl; } - entity1 = (RS_AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); - entity2 = (RS_AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); + entity1 = (AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); + entity2 = (AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); //baseContainer = entity1->getParent(); isPolyline = true; - isClosedPolyline = ((RS_Polyline*)entity1)->isClosed(); + isClosedPolyline = ((Polyline*)entity1)->isClosed(); } - RS_DEBUG->print("RS_Modification::bevel: getting intersection"); + DEBUG->print("Modification::bevel: getting intersection"); VectorSolutions sol = - RS_Information::getIntersection(entity1, entity2, false); + Information::getIntersection(entity1, entity2, false); if (sol.getNumber()==0) { return false; } - RS_AtomicEntity* trimmed1 = NULL; - RS_AtomicEntity* trimmed2 = NULL; + AtomicEntity* trimmed1 = NULL; + AtomicEntity* trimmed2 = NULL; //if (data.trim || isPolyline) { if (isPolyline) { trimmed1 = entity1; trimmed2 = entity2; } else { - trimmed1 = (RS_AtomicEntity*)entity1->clone(); - trimmed2 = (RS_AtomicEntity*)entity2->clone(); + trimmed1 = (AtomicEntity*)entity1->clone(); + trimmed2 = (AtomicEntity*)entity2->clone(); } #warning "!!! Old rendering path needs upgrading !!!" @@ -2316,7 +2316,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, #endif // trim entities to intersection - RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 01"); + DEBUG->print("Modification::bevel: trim entities to intersection 01"); bool start1 = false; Vector is = sol.getClosest(coord2); RS2::Ending ending1 = trimmed1->getTrimPoint(coord1, is); @@ -2333,7 +2333,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, break; } - RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 02"); + DEBUG->print("Modification::bevel: trim entities to intersection 02"); bool start2 = false; is = sol.getClosest(coord1); RS2::Ending ending2 = trimmed2->getTrimPoint(coord2, is); @@ -2353,12 +2353,12 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // find definitive bevel points - RS_DEBUG->print("RS_Modification::bevel: find definitive bevel points"); + DEBUG->print("Modification::bevel: find definitive bevel points"); Vector bp1 = trimmed1->getNearestDist(data.length1, start1); Vector bp2 = trimmed2->getNearestDist(data.length2, start2); // final trim: - RS_DEBUG->print("RS_Modification::bevel: final trim"); + DEBUG->print("Modification::bevel: final trim"); if (data.trim==true) { switch (ending1) { case RS2::EndingStart: @@ -2397,8 +2397,8 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // add bevel line: - RS_DEBUG->print("RS_Modification::bevel: add bevel line"); - RS_Line* bevel = new RS_Line(baseContainer, RS_LineData(bp1, bp2)); + DEBUG->print("Modification::bevel: add bevel line"); + Line* bevel = new Line(baseContainer, LineData(bp1, bp2)); if (isPolyline==false) { baseContainer->addEntity(bevel); @@ -2436,7 +2436,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } if (isPolyline) { - ((RS_Polyline*)baseContainer)->updateEndpoints(); + ((Polyline*)baseContainer)->updateEndpoints(); } if (graphicView!=NULL) { @@ -2447,7 +2447,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } } - RS_DEBUG->print("RS_Modification::bevel: handling undo"); + DEBUG->print("Modification::bevel: handling undo"); if (document!=NULL && handleUndo) { //document->startUndoCycle(); @@ -2470,10 +2470,10 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } if (data.trim==false) { - RS_DEBUG->print("RS_Modification::bevel: delete trimmed elements"); + DEBUG->print("Modification::bevel: delete trimmed elements"); delete trimmed1; delete trimmed2; - RS_DEBUG->print("RS_Modification::bevel: delete trimmed elements: ok"); + DEBUG->print("Modification::bevel: delete trimmed elements: ok"); } return true; @@ -2490,20 +2490,20 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, * @param entity2 Second entity of the corner. * @param data Radius and trim flag. */ -bool RS_Modification::round(const Vector& coord, +bool Modification::round(const Vector& coord, const Vector& coord1, - RS_AtomicEntity* entity1, + AtomicEntity* entity1, const Vector& coord2, - RS_AtomicEntity* entity2, - RS_RoundData& data) { + AtomicEntity* entity2, + RoundData& data) { if (entity1==NULL || entity2==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::round: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::round: At least one entity is NULL"); return false; } - RS_EntityContainer* baseContainer = container; + EntityContainer* baseContainer = container; bool isPolyline = false; bool isClosedPolyline = false; @@ -2516,8 +2516,8 @@ bool RS_Modification::round(const Vector& coord, entity1->getParent()->rtti()==RS2::EntityPolyline) { if (entity1->getParent()!=entity2->getParent()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::round: entities not in " + DEBUG->print(Debug::D_WARNING, + "Modification::round: entities not in " "the same polyline"); if (document!=NULL && handleUndo) { document->endUndoCycle(); @@ -2527,8 +2527,8 @@ bool RS_Modification::round(const Vector& coord, // clone polyline for undo if (document!=NULL && handleUndo) { - RS_EntityContainer* cl = - (RS_EntityContainer*)entity1->getParent()->clone(); + EntityContainer* cl = + (EntityContainer*)entity1->getParent()->clone(); container->addEntity(cl); document->addUndoable(cl); @@ -2538,23 +2538,23 @@ bool RS_Modification::round(const Vector& coord, baseContainer = cl; } - entity1 = (RS_AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); - entity2 = (RS_AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); + entity1 = (AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); + entity2 = (AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); isPolyline = true; - isClosedPolyline = ((RS_Polyline*)entity1)->isClosed(); + isClosedPolyline = ((Polyline*)entity1)->isClosed(); } // create 2 tmp parallels - RS_Creation creation(NULL, NULL); - RS_Entity* par1 = creation.createParallel(coord, data.radius, 1, entity1); - RS_Entity* par2 = creation.createParallel(coord, data.radius, 1, entity2); + Creation creation(NULL, NULL); + Entity* par1 = creation.createParallel(coord, data.radius, 1, entity1); + Entity* par2 = creation.createParallel(coord, data.radius, 1, entity2); VectorSolutions sol2 = - RS_Information::getIntersection(entity1, entity2, false); + Information::getIntersection(entity1, entity2, false); VectorSolutions sol = - RS_Information::getIntersection(par1, par2, false); + Information::getIntersection(par1, par2, false); if (sol.getNumber()==0) { if (document!=NULL && handleUndo) { @@ -2569,25 +2569,25 @@ bool RS_Modification::round(const Vector& coord, Vector p2 = entity2->getNearestPointOnEntity(is, false); double ang1 = is.angleTo(p1); double ang2 = is.angleTo(p2); - bool reversed = (RS_Math::getAngleDifference(ang1, ang2)>M_PI); + bool reversed = (Math::getAngleDifference(ang1, ang2)>M_PI); - RS_Arc* arc = new RS_Arc(baseContainer, - RS_ArcData(is, + Arc* arc = new Arc(baseContainer, + ArcData(is, data.radius, ang1, ang2, reversed)); - RS_AtomicEntity* trimmed1 = NULL; - RS_AtomicEntity* trimmed2 = NULL; + AtomicEntity* trimmed1 = NULL; + AtomicEntity* trimmed2 = NULL; if (data.trim || isPolyline) { if (isPolyline) { trimmed1 = entity1; trimmed2 = entity2; } else { - trimmed1 = (RS_AtomicEntity*)entity1->clone(); - trimmed2 = (RS_AtomicEntity*)entity2->clone(); + trimmed1 = (AtomicEntity*)entity1->clone(); + trimmed2 = (AtomicEntity*)entity2->clone(); } #warning "!!! Old rendering path needs upgrading !!!" @@ -2659,10 +2659,10 @@ bool RS_Modification::round(const Vector& coord, arc->setLayer(baseContainer->getLayer()); arc->setPen(baseContainer->getPen()); - RS_DEBUG->print("RS_Modification::round: idx1print("RS_Modification::round: idx1!=0: %d", (int)(idx1!=0)); - RS_DEBUG->print("RS_Modification::round: idx2==0: %d", (int)(idx2==0)); - RS_DEBUG->print("RS_Modification::round: idx1==(int)baseContainer->count()-1: %d", + DEBUG->print("Modification::round: idx1print("Modification::round: idx1!=0: %d", (int)(idx1!=0)); + DEBUG->print("Modification::round: idx2==0: %d", (int)(idx2==0)); + DEBUG->print("Modification::round: idx1==(int)baseContainer->count()-1: %d", (int)(idx1==(int)baseContainer->count()-1)); bool insertAfter1 = false; @@ -2692,7 +2692,7 @@ bool RS_Modification::round(const Vector& coord, } if (isPolyline) { - ((RS_Polyline*)baseContainer)->updateEndpoints(); + ((Polyline*)baseContainer)->updateEndpoints(); } if (graphicView!=NULL) { @@ -2731,39 +2731,39 @@ bool RS_Modification::round(const Vector& coord, * Removes the selected entity containers and adds the entities in them as * new single entities. */ -bool RS_Modification::explode() +bool Modification::explode() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::explode: no valid container for addinge entities", - RS_Debug::D_WARNING); + DEBUG->print("Modification::explode: no valid container for addinge entities", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { if (e->isContainer()) { // add entities from container: - RS_EntityContainer* ec = (RS_EntityContainer*)e; + EntityContainer* ec = (EntityContainer*)e; //ec->setSelected(false); // iterate and explode container: //for (uint i2=0; i2count(); ++i2) { - // RS_Entity* e2 = ec->entityAt(i2); + // Entity* e2 = ec->entityAt(i2); RS2::ResolveLevel rl; bool resolvePen; bool resolveLayer; @@ -2801,11 +2801,11 @@ bool RS_Modification::explode() break; } - for (RS_Entity* e2 = ec->firstEntity(rl); e2!=NULL; + for (Entity* e2 = ec->firstEntity(rl); e2!=NULL; e2 = ec->nextEntity(rl)) { if (e2!=NULL) { - RS_Entity* clone = e2->clone(); + Entity* clone = e2->clone(); clone->setSelected(false); clone->reparent(container); @@ -2842,30 +2842,30 @@ bool RS_Modification::explode() return true; } -bool RS_Modification::explodeTextIntoLetters() +bool Modification::explodeTextIntoLetters() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::explodeTextIntoLetters: no valid container" - " for addinge entities", RS_Debug::D_WARNING); + DEBUG->print("Modification::explodeTextIntoLetters: no valid container" + " for addinge entities", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e!=NULL && e->isSelected()) { if (e->rtti()==RS2::EntityText) { // add letters of text: - RS_Text* text = (RS_Text*)e; + Text* text = (Text*)e; explodeTextIntoLetters(text, addList); } else { e->setSelected(false); @@ -2887,14 +2887,14 @@ bool RS_Modification::explodeTextIntoLetters() return true; } -//bool RS_Modification::explodeTextIntoLetters(RS_Text* text, Q3PtrList& addList) -bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList & addList) +//bool Modification::explodeTextIntoLetters(Text* text, Q3PtrList& addList) +bool Modification::explodeTextIntoLetters(Text * text, QList & addList) { if (text == NULL) return false; // iterate though lines: - for(RS_Entity * e2=text->firstEntity(); e2!=NULL; e2=text->nextEntity()) + for(Entity * e2=text->firstEntity(); e2!=NULL; e2=text->nextEntity()) { if (e2 == NULL) break; @@ -2902,23 +2902,23 @@ bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList // text lines: if (e2->rtti() == RS2::EntityContainer) { - RS_EntityContainer * line = (RS_EntityContainer *)e2; + EntityContainer * line = (EntityContainer *)e2; // iterate though letters: - for(RS_Entity * e3=line->firstEntity(); e3!=NULL; e3=line->nextEntity()) + for(Entity * e3=line->firstEntity(); e3!=NULL; e3=line->nextEntity()) { if (e3 == NULL) break; // super / sub texts: if (e3->rtti() == RS2::EntityText) - explodeTextIntoLetters((RS_Text *)e3, addList); + explodeTextIntoLetters((Text *)e3, addList); // normal letters: else if (e3->rtti() == RS2::EntityInsert) { - RS_Insert * letter = (RS_Insert *)e3; + Insert * letter = (Insert *)e3; - RS_Text * tl = new RS_Text(container, RS_TextData(letter->getInsertionPoint(), + Text * tl = new Text(container, TextData(letter->getInsertionPoint(), text->getHeight(), 100.0, RS2::VAlignBottom, RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, letter->getName(), text->getStyle(), letter->getAngle(), RS2::Update)); @@ -2939,27 +2939,27 @@ bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList /** * Moves all reference points of selected entities with the given data. */ -bool RS_Modification::moveRef(RS_MoveRefData& data) +bool Modification::moveRef(MoveRefData& data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::moveRef: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::moveRef: no valid container", Debug::D_WARNING); return false; } - // Q3PtrList addList; + // Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document != NULL && handleUndo) document->startUndoCycle(); // Create new entites - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->moveRef(data.ref, data.offset); // since 2.0.4.0: keep it selected ec->setSelected(true); diff --git a/src/base/modification.h b/src/base/modification.h index fc139dd..5534522 100644 --- a/src/base/modification.h +++ b/src/base/modification.h @@ -8,7 +8,7 @@ /** * Holds the data needed for move modifications. */ -class RS_MoveData +class MoveData { public: int number; @@ -20,7 +20,7 @@ class RS_MoveData /** * Holds the data needed for rotation modifications. */ -class RS_RotateData +class RotateData { public: int number; @@ -33,7 +33,7 @@ class RS_RotateData /** * Holds the data needed for scale modifications. */ -class RS_ScaleData +class ScaleData { public: int number; @@ -46,7 +46,7 @@ class RS_ScaleData /** * Holds the data needed for mirror modifications. */ -class RS_MirrorData +class MirrorData { public: bool copy; @@ -59,7 +59,7 @@ class RS_MirrorData /** * Holds the data needed for move/rotate modifications. */ -class RS_MoveRotateData +class MoveRotateData { public: int number; @@ -73,7 +73,7 @@ class RS_MoveRotateData /** * Holds the data needed for rotation around two centers modifications. */ -class RS_Rotate2Data +class Rotate2Data { public: int number; @@ -88,7 +88,7 @@ class RS_Rotate2Data /** * Holds the data needed for beveling modifications. */ -class RS_BevelData +class BevelData { public: double length1; @@ -99,7 +99,7 @@ class RS_BevelData /** * Holds the data needed for rounding modifications. */ -class RS_RoundData +class RoundData { public: double radius; @@ -109,7 +109,7 @@ class RS_RoundData /** * Holds the data needed for moving reference points. */ -class RS_MoveRefData +class MoveRefData { public: Vector ref; @@ -119,11 +119,11 @@ class RS_MoveRefData /** * Holds the data needed for changing attributes. */ -class RS_AttributesData +class AttributesData { public: QString layer; - RS_Pen pen; + Pen pen; bool changeLayer; bool changeColor; bool changeLineType; @@ -133,10 +133,10 @@ class RS_AttributesData /** * Holds the data needed for pasting. */ -class RS_PasteData +class PasteData { public: - RS_PasteData(Vector insertionPoint, double factor, double angle, + PasteData(Vector insertionPoint, double factor, double angle, bool asInsert, const QString & blockName) { this->insertionPoint = insertionPoint; @@ -170,69 +170,69 @@ class RS_PasteData * * @author Andrew Mustun */ -class RS_Modification +class Modification { public: - RS_Modification(RS_EntityContainer & entityContainer, + Modification(EntityContainer & entityContainer, GraphicView * graphicView = NULL, bool handleUndo = true); void remove(); - bool changeAttributes(RS_AttributesData& data); + bool changeAttributes(AttributesData& data); void copy(const Vector & ref, const bool cut); private: - void copyEntity(RS_Entity * e, const Vector & ref, const bool cut); + void copyEntity(Entity * e, const Vector & ref, const bool cut); public: - void copyLayers(RS_Entity * e); - void copyBlocks(RS_Entity * e); - void paste(const RS_PasteData & data, Drawing * source = NULL); - - bool move(RS_MoveData & data); - bool rotate(RS_RotateData & data); - bool scale(RS_ScaleData & data); - bool mirror(RS_MirrorData & data); - bool moveRotate(RS_MoveRotateData & data); - bool rotate2(RS_Rotate2Data & data); - - bool trim(const Vector & trimCoord, RS_AtomicEntity * trimEntity, - const Vector & limitCoord, RS_Entity * limitEntity, + void copyLayers(Entity * e); + void copyBlocks(Entity * e); + void paste(const PasteData & data, Drawing * source = NULL); + + bool move(MoveData & data); + bool rotate(RotateData & data); + bool scale(ScaleData & data); + bool mirror(MirrorData & data); + bool moveRotate(MoveRotateData & data); + bool rotate2(Rotate2Data & data); + + bool trim(const Vector & trimCoord, AtomicEntity * trimEntity, + const Vector & limitCoord, Entity * limitEntity, bool both); - bool trimAmount(const Vector & trimCoord, RS_AtomicEntity * trimEntity, + bool trimAmount(const Vector & trimCoord, AtomicEntity * trimEntity, double dist); - bool cut(const Vector& cutCoord, RS_AtomicEntity* cutEntity); + bool cut(const Vector& cutCoord, AtomicEntity* cutEntity); bool stretch(const Vector & firstCorner, const Vector & secondCorner, const Vector & offset); - bool bevel(const Vector & coord1, RS_AtomicEntity * entity1, - const Vector & coord2, RS_AtomicEntity * entity2, - RS_BevelData & data); - bool round(const Vector & coord, const Vector & coord1, RS_AtomicEntity * entity1, - const Vector & coord2, RS_AtomicEntity * entity2, RS_RoundData & data); + bool bevel(const Vector & coord1, AtomicEntity * entity1, + const Vector & coord2, AtomicEntity * entity2, + BevelData & data); + bool round(const Vector & coord, const Vector & coord1, AtomicEntity * entity1, + const Vector & coord2, AtomicEntity * entity2, RoundData & data); bool explode(); bool explodeTextIntoLetters(); - bool explodeTextIntoLetters(RS_Text * text, QList & addList); - bool moveRef(RS_MoveRefData & data); - - bool splitPolyline(RS_Polyline & polyline, RS_Entity & e1, Vector v1, - RS_Entity & e2, Vector v2, RS_Polyline ** polyline1, RS_Polyline ** polyline2) const; - RS_Polyline * addPolylineNode(RS_Polyline& polyline, - const RS_AtomicEntity& segment, const Vector& node); - RS_Polyline * deletePolylineNode(RS_Polyline& polyline, const Vector& node); - RS_Polyline * deletePolylineNodesBetween(RS_Polyline & polyline, RS_AtomicEntity & segment, + bool explodeTextIntoLetters(Text * text, QList & addList); + bool moveRef(MoveRefData & data); + + bool splitPolyline(Polyline & polyline, Entity & e1, Vector v1, + Entity & e2, Vector v2, Polyline ** polyline1, Polyline ** polyline2) const; + Polyline * addPolylineNode(Polyline& polyline, + const AtomicEntity& segment, const Vector& node); + Polyline * deletePolylineNode(Polyline& polyline, const Vector& node); + Polyline * deletePolylineNodesBetween(Polyline & polyline, AtomicEntity & segment, const Vector& node1, const Vector & node2); - RS_Polyline * polylineTrim(RS_Polyline & polyline, - RS_AtomicEntity & segment1, RS_AtomicEntity & segment2); + Polyline * polylineTrim(Polyline & polyline, + AtomicEntity & segment1, AtomicEntity & segment2); private: void deselectOriginals(bool remove); - void addNewEntities(QList & addList); + void addNewEntities(QList & addList); protected: - RS_EntityContainer * container; + EntityContainer * container; Drawing * graphic; - RS_Document * document; + Document * document; GraphicView * graphicView; bool handleUndo; }; diff --git a/src/base/paintinterface.cpp b/src/base/paintinterface.cpp index 1fd7751..fdcbee4 100644 --- a/src/base/paintinterface.cpp +++ b/src/base/paintinterface.cpp @@ -47,7 +47,7 @@ void PaintInterface::createArc(QPolygon & pa, const Vector& cp, double radius, { if (radius < 1.0e-6) { - RS_DEBUG->print(RS_Debug::D_WARNING, "PaintInterface::createArc: invalid radius: %f", radius); + DEBUG->print(Debug::D_WARNING, "PaintInterface::createArc: invalid radius: %f", radius); return; } @@ -120,7 +120,7 @@ void PaintInterface::drawRect(const Vector & p1, const Vector & p2) drawLine(Vector(p1.x, p2.y), Vector(p1.x, p1.y)); } -void PaintInterface::drawHandle(const Vector & p, const RS_Color & c, int size) +void PaintInterface::drawHandle(const Vector & p, const Color & c, int size) { if (size < 0) size = 2; @@ -147,12 +147,12 @@ void PaintInterface::setOffset(const Vector & o) int PaintInterface::toScreenX(double x) { - return RS_Math::round(offset.x + x); + return Math::round(offset.x + x); } int PaintInterface::toScreenY(double y) { - return RS_Math::round(offset.y + y); + return Math::round(offset.y + y); } /** @@ -339,7 +339,7 @@ void PaintInterface::drawArc(const Vector & cp, double radius, double a1, double */ void PaintInterface::drawArcMac(const Vector& cp, double radius, double a1, double a2, bool reversed) { - RS_DEBUG->print("PaintInterface::drawArcMac"); + DEBUG->print("PaintInterface::drawArcMac"); if (radius <= 0.5) drawGridPoint(cp); else @@ -411,7 +411,7 @@ void PaintInterface::drawCircle(const Vector & cp, double radius) if (drawingMode == RS2::ModeXOR && radius < 500) { // This is _very_ slow for large arcs: - painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), RS_Math::round(2.0 * radius), RS_Math::round(2.0 * radius)); + painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), Math::round(2.0 * radius), Math::round(2.0 * radius)); } else { @@ -422,7 +422,7 @@ void PaintInterface::drawCircle(const Vector & cp, double radius) #endif } #else -// painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), RS_Math::round(2.0 * radius), RS_Math::round(2.0 * radius)); +// painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), Math::round(2.0 * radius), Math::round(2.0 * radius)); painter->drawEllipse(QPointF(cp.x, cp.y), radius, radius); #endif } @@ -498,7 +498,7 @@ void PaintInterface::drawImg(QImage & img, const Vector & pos, QMatrix wm; wm.translate(pos.x, pos.y); wm.scale(factor.x, factor.y); - wm.rotate(RS_Math::rad2deg(-angle)); + wm.rotate(Math::rad2deg(-angle)); painter->setWorldMatrix(wm); if (fabs(angle) < 1.0e-4) @@ -509,7 +509,7 @@ void PaintInterface::drawImg(QImage & img, const Vector & pos, painter->restore(); } -void PaintInterface::fillRect(int x1, int y1, int w, int h, const RS_Color & col) +void PaintInterface::fillRect(int x1, int y1, int w, int h, const Color & col) { painter->fillRect(x1, y1, w, h, col); } @@ -539,33 +539,33 @@ int PaintInterface::getHeight() void PaintInterface::setPreviewPen() { - setPen(RS_Color(0, 255, 255)); + setPen(Color(0, 255, 255)); } -RS_Pen PaintInterface::getPen() +Pen PaintInterface::getPen() { return lpen; } -void PaintInterface::setPen(const RS_Pen & pen) +void PaintInterface::setPen(const Pen & pen) { lpen = pen; if (drawingMode == RS2::ModeBW) - lpen.setColor(RS_Color(0, 0, 0)); + lpen.setColor(Color(0, 0, 0)); - QPen p(lpen.getColor(), RS_Math::round(lpen.getScreenWidth()), RS2::rsToQtLineType(lpen.getLineType())); + QPen p(lpen.getColor(), Math::round(lpen.getScreenWidth()), RS2::rsToQtLineType(lpen.getLineType())); p.setJoinStyle(Qt::RoundJoin); p.setCapStyle(Qt::RoundCap); painter->setPen(p); } -void PaintInterface::setPen(const RS_Color & color) +void PaintInterface::setPen(const Color & color) { if (drawingMode == RS2::ModeBW) { - lpen.setColor(RS_Color(0, 0, 0)); - painter->setPen(RS_Color(0, 0, 0)); + lpen.setColor(Color(0, 0, 0)); + painter->setPen(Color(0, 0, 0)); } else { @@ -584,11 +584,11 @@ void PaintInterface::setPen(int r, int g, int b) void PaintInterface::disablePen(void) { - lpen = RS_Pen(RS2::FlagInvalid); + lpen = Pen(RS2::FlagInvalid); painter->setPen(Qt::NoPen); } -void PaintInterface::setBrush(const RS_Color & color) +void PaintInterface::setBrush(const Color & color) { if (drawingMode == RS2::ModeBW) painter->setBrush(QColor(0, 0, 0)); @@ -598,7 +598,7 @@ void PaintInterface::setBrush(const RS_Color & color) void PaintInterface::disableBrush(void) { -// lpen = RS_Pen(RS2::FlagInvalid); +// lpen = Pen(RS2::FlagInvalid); painter->setBrush(Qt::NoBrush); } diff --git a/src/base/paintinterface.h b/src/base/paintinterface.h index 072d333..94701cf 100644 --- a/src/base/paintinterface.h +++ b/src/base/paintinterface.h @@ -2,7 +2,7 @@ #define ____PAINTINTERFACE_H____ #include -#include "rs.h" +#include "enums.h" #include "vector.h" #include "color.h" #include "pen.h" @@ -38,16 +38,16 @@ class PaintInterface double angle, double angle1, double angle2, bool reversed); void drawImg(QImage & img, const Vector & pos, double angle, const Vector & factor, int sx, int sy, int sw, int sh); - void fillRect(int x1, int y1, int w, int h, const RS_Color & col); + void fillRect(int x1, int y1, int w, int h, const Color & col); void fillTriangle(const Vector & p1, const Vector & p2, const Vector & p3); - void drawHandle(const Vector & p, const RS_Color & c, int size = -1); + void drawHandle(const Vector & p, const Color & c, int size = -1); void setPreviewPen(); - RS_Pen getPen(); - void setPen(const RS_Pen & pen); - void setPen(const RS_Color & color); + Pen getPen(); + void setPen(const Pen & pen); + void setPen(const Color & color); void setPen(int r, int g, int b); void disablePen(); - void setBrush(const RS_Color & color); + void setBrush(const Color & color); void disableBrush(); void drawPolygon(const QPolygon & p); void erase(); @@ -73,7 +73,7 @@ class PaintInterface * A fixed offset added to all entities drawn (useful for previews). */ Vector offset; - RS_Pen lpen; + Pen lpen; }; #endif // __PAINTINTERFACE_H____ diff --git a/src/base/pattern.cpp b/src/base/pattern.cpp index 5d14519..26af65b 100644 --- a/src/base/pattern.cpp +++ b/src/base/pattern.cpp @@ -26,9 +26,9 @@ * * @param fileName File name of a DXF file defining the pattern */ -RS_Pattern::RS_Pattern(const QString & fileName): RS_EntityContainer(NULL) +Pattern::Pattern(const QString & fileName): EntityContainer(NULL) { - RS_DEBUG->print("RS_Pattern::RS_Pattern() "); + DEBUG->print("Pattern::Pattern() "); this->fileName = fileName; loaded = false; @@ -42,14 +42,14 @@ RS_Pattern::RS_Pattern(const QString & fileName): RS_EntityContainer(NULL) * @param name Pattern name. * */ -/*RS_Pattern::RS_Pattern(const QString& fileName, const QString& name) - : RS_EntityContainer(NULL) { +/*Pattern::Pattern(const QString& fileName, const QString& name) + : EntityContainer(NULL) { this->fileName = fileName; this->name = name; loaded = false; }*/ -RS_Pattern::~RS_Pattern() +Pattern::~Pattern() { } @@ -60,19 +60,19 @@ RS_Pattern::~RS_Pattern() * @param filename File name of the pattern file (without path and * extension or full path. */ -bool RS_Pattern::loadPattern() +bool Pattern::loadPattern() { if (loaded) return true; - RS_DEBUG->print("RS_Pattern::loadPattern"); + DEBUG->print("Pattern::loadPattern"); QString path; // Search for the appropriate pattern if we have only the name of the pattern: if (!fileName.toLower().contains(".dxf")) { - QStringList patterns = RS_SYSTEM->getPatternList(); + QStringList patterns = SYSTEM->getPatternList(); QFileInfo file; for(QStringList::Iterator it=patterns.begin(); it!=patterns.end(); it++) @@ -80,7 +80,7 @@ bool RS_Pattern::loadPattern() if (QFileInfo(*it).baseName().toLower() == fileName.toLower()) { path = *it; - RS_DEBUG->print("Pattern found: %s", path.toLatin1().data()); + DEBUG->print("Pattern found: %s", path.toLatin1().data()); break; } } @@ -94,21 +94,21 @@ bool RS_Pattern::loadPattern() // No pattern paths found: if (path.isEmpty()) { - RS_DEBUG->print("No pattern \"%s\"available.", fileName.toLatin1().data()); + DEBUG->print("No pattern \"%s\"available.", fileName.toLatin1().data()); return false; } Drawing * gr = new Drawing(); // TODO: Find out why the new dxf filter doesn't work for patterns: - RS_FILEIO->fileImport(*gr, path, RS2::FormatDXF1); + FILEIO->fileImport(*gr, path, RS2::FormatDXF1); - for(RS_Entity * e=gr->firstEntity(); e!=NULL; e=gr->nextEntity()) + for(Entity * e=gr->firstEntity(); e!=NULL; e=gr->nextEntity()) { if (e->rtti() == RS2::EntityLine || e->rtti() == RS2::EntityArc) { - RS_Layer * l = e->getLayer(); - RS_Entity * cl = e->clone(); + Layer * l = e->getLayer(); + Entity * cl = e->clone(); cl->reparent(this); if (l != NULL) @@ -122,13 +122,13 @@ bool RS_Pattern::loadPattern() delete gr; loaded = true; - RS_DEBUG->print("RS_Pattern::loadPattern: OK"); + DEBUG->print("Pattern::loadPattern: OK"); return true; } /** @return the fileName of this pattern. */ -QString RS_Pattern::getFileName() const +QString Pattern::getFileName() const { return fileName; } diff --git a/src/base/pattern.h b/src/base/pattern.h index 9852573..8818d51 100644 --- a/src/base/pattern.h +++ b/src/base/pattern.h @@ -3,19 +3,19 @@ #include "entitycontainer.h" -class RS_PatternList; +class PatternList; /** - * Patterns are used for hatches. They are stored in a RS_PatternList. - * Use RS_PatternList to access a pattern. + * Patterns are used for hatches. They are stored in a PatternList. + * Use PatternList to access a pattern. * * @author Andrew Mustun */ -class RS_Pattern: public RS_EntityContainer +class Pattern: public EntityContainer { public: - RS_Pattern(const QString & fileName); - virtual ~RS_Pattern(); + Pattern(const QString & fileName); + virtual ~Pattern(); virtual bool loadPattern(); QString getFileName() const; diff --git a/src/base/patternlist.cpp b/src/base/patternlist.cpp index c9f1499..989d406 100644 --- a/src/base/patternlist.cpp +++ b/src/base/patternlist.cpp @@ -18,67 +18,67 @@ #include "system.h" -RS_PatternList * RS_PatternList::uniqueInstance = NULL; +PatternList * PatternList::uniqueInstance = NULL; /** * Default constructor. */ -RS_PatternList::RS_PatternList(): patternIterator(patterns) +PatternList::PatternList(): patternIterator(patterns) { #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // patterns.setAutoDelete(true); //patternListListeners.setAutoDelete(false); } -/*virtual*/ RS_PatternList::~RS_PatternList() +/*virtual*/ PatternList::~PatternList() { } /** * @return Instance to the unique pattern list. */ -/*static*/ RS_PatternList * RS_PatternList::instance() +/*static*/ PatternList * PatternList::instance() { if (uniqueInstance == NULL) - uniqueInstance = new RS_PatternList(); + uniqueInstance = new PatternList(); return uniqueInstance; } /** - * Initializes the pattern list by creating empty RS_Pattern + * Initializes the pattern list by creating empty Pattern * objects, one for each pattern that could be found. */ -void RS_PatternList::init() +void PatternList::init() { - RS_DEBUG->print("RS_PatternList::initPatterns"); + DEBUG->print("PatternList::initPatterns"); - QStringList list = RS_SYSTEM->getPatternList(); - RS_Pattern * pattern; + QStringList list = SYSTEM->getPatternList(); + Pattern * pattern; patterns.clear(); for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it) { - RS_DEBUG->print("pattern: %s:", (*it).toLatin1().data()); + DEBUG->print("pattern: %s:", (*it).toLatin1().data()); QFileInfo fi(*it); - pattern = new RS_Pattern(fi.baseName().toLower()); + pattern = new Pattern(fi.baseName().toLower()); patterns.append(pattern); - RS_DEBUG->print("base: %s", pattern->getFileName().toLatin1().data()); + DEBUG->print("base: %s", pattern->getFileName().toLatin1().data()); } } /** * Removes all patterns in the patternlist. */ -void RS_PatternList::clearPatterns() +void PatternList::clearPatterns() { patterns.clear(); } -int RS_PatternList::countPatterns() +int PatternList::countPatterns() { return patterns.count(); } @@ -88,9 +88,9 @@ int RS_PatternList::countPatterns() * Listeners are notified after the pattern was removed from * the list but before it gets deleted. */ -void RS_PatternList::removePattern(RS_Pattern * pattern) +void PatternList::removePattern(Pattern * pattern) { - RS_DEBUG->print("RS_PatternList::removePattern()"); + DEBUG->print("PatternList::removePattern()"); // here the pattern is removed from the list but not deleted // patterns.remove(pattern); @@ -102,7 +102,7 @@ void RS_PatternList::removePattern(RS_Pattern * pattern) delete patterns.takeAt(i); //for (uint i=0; ipatternRemoved(pattern); //} } @@ -112,20 +112,20 @@ void RS_PatternList::removePattern(RS_Pattern * pattern) * \p NULL if no such pattern was found. The pattern will be loaded into * memory if it's not already. */ -RS_Pattern * RS_PatternList::requestPattern(const QString & name) +Pattern * PatternList::requestPattern(const QString & name) { - RS_DEBUG->print("RS_PatternList::requestPattern %s", name.toLatin1().data()); + DEBUG->print("PatternList::requestPattern %s", name.toLatin1().data()); QString name2 = name.toLower(); - RS_Pattern * foundPattern = NULL; + Pattern * foundPattern = NULL; - RS_DEBUG->print("name2: %s", name2.toLatin1().data()); + DEBUG->print("name2: %s", name2.toLatin1().data()); // Search our list of available patterns: -// for(RS_Pattern * p=patterns.first(); p!=NULL; p=patterns.next()) +// for(Pattern * p=patterns.first(); p!=NULL; p=patterns.next()) for(int i=0; igetFileName() == name2) { @@ -144,7 +144,7 @@ RS_Pattern * RS_PatternList::requestPattern(const QString & name) } //! @return First pattern of the list. -RS_Pattern * RS_PatternList::firstPattern() +Pattern * PatternList::firstPattern() { patternIterator.toFront(); return patternIterator.next(); @@ -154,20 +154,20 @@ RS_Pattern * RS_PatternList::firstPattern() * @return Next pattern from the list after * calling firstPattern() or nextPattern(). */ -RS_Pattern * RS_PatternList::nextPattern() +Pattern * PatternList::nextPattern() { return patternIterator.next(); } -bool RS_PatternList::contains(const QString & name) +bool PatternList::contains(const QString & name) { QString name2 = name.toLower(); // Search our list of available patterns: -// for(RS_Pattern * p=patterns.first(); p!=NULL; p=patterns.next()) +// for(Pattern * p=patterns.first(); p!=NULL; p=patterns.next()) for(int i=0; igetFileName() == name2) return true; @@ -179,10 +179,10 @@ bool RS_PatternList::contains(const QString & name) /** * Dumps the patterns to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_PatternList & l) +std::ostream & operator<<(std::ostream & os, PatternList & l) { os << "Patternlist: \n"; - for(RS_Pattern * p=l.firstPattern(); p!=NULL; p=l.nextPattern()) + for(Pattern * p=l.firstPattern(); p!=NULL; p=l.nextPattern()) os << *p << "\n"; return os; diff --git a/src/base/patternlist.h b/src/base/patternlist.h index 0690203..1661b3b 100644 --- a/src/base/patternlist.h +++ b/src/base/patternlist.h @@ -5,42 +5,42 @@ #include "pattern.h" #include "entity.h" -#define RS_PATTERNLIST RS_PatternList::instance() +#define PATTERNLIST PatternList::instance() /** * The global list of patterns. This is implemented as a singleton. - * Use RS_PatternList::instance() to get a pointer to the object. + * Use PatternList::instance() to get a pointer to the object. * * @author James Hammons * @author Andrew Mustun */ -class RS_PatternList +class PatternList { protected: - RS_PatternList(); + PatternList(); public: - virtual ~RS_PatternList(); + virtual ~PatternList(); - static RS_PatternList * instance(); + static PatternList * instance(); void init(); void clearPatterns(); int countPatterns(); - virtual void removePattern(RS_Pattern * pattern); - RS_Pattern * requestPattern(const QString & name); - RS_Pattern * firstPattern(); - RS_Pattern * nextPattern(); + virtual void removePattern(Pattern * pattern); + Pattern * requestPattern(const QString & name); + Pattern * firstPattern(); + Pattern * nextPattern(); bool contains(const QString & name); - friend std::ostream & operator<<(std::ostream & os, RS_PatternList & l); + friend std::ostream & operator<<(std::ostream & os, PatternList & l); protected: - static RS_PatternList * uniqueInstance; + static PatternList * uniqueInstance; private: //! patterns in the graphic - QList patterns; - QListIterator patternIterator; + QList patterns; + QListIterator patternIterator; }; #endif // __PATTERNLIST_H__ diff --git a/src/base/pen.cpp b/src/base/pen.cpp index ee68475..4e96d6f 100644 --- a/src/base/pen.cpp +++ b/src/base/pen.cpp @@ -19,9 +19,9 @@ /** * Creates a default pen (black, solid, width 0). */ -RS_Pen::RS_Pen(): RS_Flags() +Pen::Pen(): Flags() { - setColor(RS_Color(0, 0, 0)); + setColor(Color(0, 0, 0)); setWidth(RS2::Width00); setLineType(RS2::SolidLine); setScreenWidth(0); @@ -30,7 +30,7 @@ RS_Pen::RS_Pen(): RS_Flags() /** * Creates a pen with the given attributes. */ -RS_Pen::RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t): RS_Flags() +Pen::Pen(const Color & c, RS2::LineWidth w, RS2::LineType t): Flags() { setColor(c); setWidth(w); @@ -44,77 +44,77 @@ RS_Pen::RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t): RS_Flags( * * e.g.: *
    - *   RS_Pen p(RS2::FlagInvalid);
    + *   Pen p(RS2::FlagInvalid);
      * 
    */ -RS_Pen::RS_Pen(unsigned int f): RS_Flags(f) +Pen::Pen(unsigned int f): Flags(f) { - setColor(RS_Color(0, 0, 0)); + setColor(Color(0, 0, 0)); setWidth(RS2::Width00); setLineType(RS2::SolidLine); setScreenWidth(0); } -/*virtual*/ RS_Pen::~RS_Pen() +/*virtual*/ Pen::~Pen() { } -RS2::LineType RS_Pen::getLineType() const +RS2::LineType Pen::getLineType() const { return lineType; } -void RS_Pen::setLineType(RS2::LineType t) +void Pen::setLineType(RS2::LineType t) { lineType = t; } -RS2::LineWidth RS_Pen::getWidth() const +RS2::LineWidth Pen::getWidth() const { return width; } -void RS_Pen::setWidth(RS2::LineWidth w) +void Pen::setWidth(RS2::LineWidth w) { width = w; } -double RS_Pen::getScreenWidth() const +double Pen::getScreenWidth() const { return screenWidth; } -void RS_Pen::setScreenWidth(double w) +void Pen::setScreenWidth(double w) { screenWidth = w; } -const RS_Color & RS_Pen::getColor() const +const Color & Pen::getColor() const { return color; } -void RS_Pen::setColor(const RS_Color & c) +void Pen::setColor(const Color & c) { color = c; } -bool RS_Pen::isValid() +bool Pen::isValid() { return !getFlag(RS2::FlagInvalid); } -bool RS_Pen::operator==(const RS_Pen & p) const +bool Pen::operator==(const Pen & p) const { return (lineType == p.lineType && width == p.width && color == p.color); } -bool RS_Pen::operator!=(const RS_Pen & p) const +bool Pen::operator!=(const Pen & p) const { return !(*this == p); } -/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Pen & p) +/*friend*/ std::ostream & operator<<(std::ostream & os, const Pen & p) { //os << "style: " << p.style << std::endl; os << " pen color: " << p.getColor() diff --git a/src/base/pen.h b/src/base/pen.h index 526dade..a49c3e7 100644 --- a/src/base/pen.h +++ b/src/base/pen.h @@ -1,7 +1,7 @@ #ifndef __PEN_H__ #define __PEN_H__ -#include "rs.h" +#include "enums.h" #include "color.h" #include "flags.h" @@ -12,13 +12,13 @@ * @author James Hammons * @author Andrew Mustun */ -class RS_Pen: public RS_Flags +class Pen: public Flags { public: - RS_Pen(); - RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t); - RS_Pen(unsigned int f); - virtual ~RS_Pen(); + Pen(); + Pen(const Color & c, RS2::LineWidth w, RS2::LineType t); + Pen(unsigned int f); + virtual ~Pen(); RS2::LineType getLineType() const; void setLineType(RS2::LineType t); @@ -26,19 +26,19 @@ class RS_Pen: public RS_Flags void setWidth(RS2::LineWidth w); double getScreenWidth() const; void setScreenWidth(double w); - const RS_Color & getColor() const; - void setColor(const RS_Color & c); + const Color & getColor() const; + void setColor(const Color & c); bool isValid(); - bool operator==(const RS_Pen & p) const; - bool operator!=(const RS_Pen & p) const; + bool operator==(const Pen & p) const; + bool operator!=(const Pen & p) const; - friend std::ostream & operator<<(std::ostream & os, const RS_Pen & p); + friend std::ostream & operator<<(std::ostream & os, const Pen & p); protected: RS2::LineType lineType; RS2::LineWidth width; double screenWidth; - RS_Color color; + Color color; }; #endif diff --git a/src/base/point.cpp b/src/base/point.cpp index 6a680db..e0308ef 100644 --- a/src/base/point.cpp +++ b/src/base/point.cpp @@ -22,21 +22,21 @@ /** * Default constructor. */ -RS_Point::RS_Point(RS_EntityContainer * parent, const RS_PointData & d): - RS_AtomicEntity(parent), data(d) +Point::Point(EntityContainer * parent, const PointData & d): + AtomicEntity(parent), data(d) { calculateBorders(); } -/*virtual*/ RS_Entity * RS_Point::clone() +/*virtual*/ Entity * Point::clone() { - RS_Point * p = new RS_Point(*this); + Point * p = new Point(*this); p->initId(); return p; } /** @return RS_ENTITY_POINT */ -/*virtual*/ RS2::EntityType RS_Point::rtti() const +/*virtual*/ RS2::EntityType Point::rtti() const { return RS2::EntityPoint; } @@ -44,7 +44,7 @@ RS_Point::RS_Point(RS_EntityContainer * parent, const RS_PointData & d): /** * @return Start point of the entity. */ -/*virtual*/ Vector RS_Point::getStartpoint() const +/*virtual*/ Vector Point::getStartpoint() const { return data.pos; } @@ -52,41 +52,41 @@ RS_Point::RS_Point(RS_EntityContainer * parent, const RS_PointData & d): /** * @return End point of the entity. */ -/*virtual*/ Vector RS_Point::getEndpoint() const +/*virtual*/ Vector Point::getEndpoint() const { return data.pos; } /** @return Copy of data that defines the point. */ -RS_PointData RS_Point::getData() const +PointData Point::getData() const { return data; } /** @return Position of the point */ -Vector RS_Point::getPos() +Vector Point::getPos() { return data.pos; } /** Sets a new position for this point. */ -void RS_Point::setPos(const Vector & pos) +void Point::setPos(const Vector & pos) { data.pos = pos; } -void RS_Point::calculateBorders() +void Point::calculateBorders() { minV = maxV = data.pos; } -VectorSolutions RS_Point::getRefPoints() +VectorSolutions Point::getRefPoints() { VectorSolutions ret(data.pos); return ret; } -Vector RS_Point::getNearestEndpoint(const Vector & coord, double * dist) +Vector Point::getNearestEndpoint(const Vector & coord, double * dist) { if (dist != NULL) *dist = data.pos.distanceTo(coord); @@ -94,8 +94,8 @@ Vector RS_Point::getNearestEndpoint(const Vector & coord, double * dist) return data.pos; } -Vector RS_Point::getNearestPointOnEntity(const Vector & coord, - bool /*onEntity*/, double * dist, RS_Entity ** entity) +Vector Point::getNearestPointOnEntity(const Vector & coord, + bool /*onEntity*/, double * dist, Entity ** entity) { if (dist != NULL) *dist = data.pos.distanceTo(coord); @@ -106,7 +106,7 @@ Vector RS_Point::getNearestPointOnEntity(const Vector & coord, return data.pos; } -Vector RS_Point::getNearestCenter(const Vector & coord, double * dist) +Vector Point::getNearestCenter(const Vector & coord, double * dist) { if (dist != NULL) *dist = data.pos.distanceTo(coord); @@ -114,7 +114,7 @@ Vector RS_Point::getNearestCenter(const Vector & coord, double * dist) return data.pos; } -Vector RS_Point::getNearestMiddle(const Vector & coord, double * dist) +Vector Point::getNearestMiddle(const Vector & coord, double * dist) { if (dist != NULL) *dist = data.pos.distanceTo(coord); @@ -122,7 +122,7 @@ Vector RS_Point::getNearestMiddle(const Vector & coord, double * dist) return data.pos; } -Vector RS_Point::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) +Vector Point::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; @@ -130,7 +130,7 @@ Vector RS_Point::getNearestDist(double /*distance*/, const Vector & /*coord*/, d return Vector(false); } -double RS_Point::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, +double Point::getDistanceToPoint(const Vector & coord, Entity ** entity, RS2::ResolveLevel /*level*/, double /*solidDist*/) { if (entity != NULL) @@ -139,37 +139,37 @@ double RS_Point::getDistanceToPoint(const Vector & coord, RS_Entity ** entity, return data.pos.distanceTo(coord); } -void RS_Point::moveStartpoint(const Vector & pos) +void Point::moveStartpoint(const Vector & pos) { data.pos = pos; calculateBorders(); } -void RS_Point::move(Vector offset) +void Point::move(Vector offset) { data.pos.move(offset); calculateBorders(); } -void RS_Point::rotate(Vector center, double angle) +void Point::rotate(Vector center, double angle) { data.pos.rotate(center, angle); calculateBorders(); } -void RS_Point::scale(Vector center, Vector factor) +void Point::scale(Vector center, Vector factor) { data.pos.scale(center, factor); calculateBorders(); } -void RS_Point::mirror(Vector axisPoint1, Vector axisPoint2) +void Point::mirror(Vector axisPoint1, Vector axisPoint2) { data.pos.mirror(axisPoint1, axisPoint2); calculateBorders(); } -void RS_Point::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Point::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (painter == NULL || view == NULL) return; @@ -180,7 +180,7 @@ void RS_Point::draw(PaintInterface * painter, GraphicView * view, double /*patte /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Point & p) +std::ostream & operator<<(std::ostream & os, const Point & p) { os << " Point: " << p.getData() << "\n"; return os; diff --git a/src/base/point.h b/src/base/point.h index 20fb95e..4e467d0 100644 --- a/src/base/point.h +++ b/src/base/point.h @@ -6,15 +6,15 @@ /** * Holds the data that defines a point. */ -class RS_PointData +class PointData { public: - RS_PointData(const Vector & pos) + PointData(const Vector & pos) { this->pos = pos; } - friend std::ostream & operator<<(std::ostream & os, const RS_PointData & pd) + friend std::ostream & operator<<(std::ostream & os, const PointData & pd) { os << "(" << pd.pos << ")"; return os; @@ -28,28 +28,28 @@ class RS_PointData * * @author Andrew Mustun */ -class RS_Point: public RS_AtomicEntity +class Point: public AtomicEntity { public: - RS_Point(RS_EntityContainer * parent, const RS_PointData & d); + Point(EntityContainer * parent, const PointData & d); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; virtual Vector getStartpoint() const; virtual Vector getEndpoint() const; virtual void moveStartpoint(const Vector & pos); - RS_PointData getData() const; + PointData getData() const; virtual VectorSolutions getRefPoints(); Vector getPos(); void setPos(const Vector & pos); 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); + bool onEntity = true, double * dist = NULL, 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, + virtual double getDistanceToPoint(const Vector& coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); virtual void move(Vector offset); @@ -58,13 +58,13 @@ class RS_Point: public RS_AtomicEntity virtual void mirror(Vector axisPoint1, Vector axisPoint2); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Point & p); + friend std::ostream & operator<<(std::ostream & os, const Point & p); /** Recalculates the borders of this entity. */ virtual void calculateBorders(); protected: - RS_PointData data; + PointData data; //Vector point; }; diff --git a/src/base/polyline.cpp b/src/base/polyline.cpp index 77fdbab..29f7a92 100644 --- a/src/base/polyline.cpp +++ b/src/base/polyline.cpp @@ -25,7 +25,7 @@ /** * Constructor. */ -RS_Polyline::RS_Polyline(RS_EntityContainer * parent): RS_EntityContainer(parent), +Polyline::Polyline(EntityContainer * parent): EntityContainer(parent), closingEntity(NULL), nextBulge(0.0) { } @@ -34,8 +34,8 @@ RS_Polyline::RS_Polyline(RS_EntityContainer * parent): RS_EntityContainer(parent * Constructor. * @param d Polyline data */ -RS_Polyline::RS_Polyline(RS_EntityContainer* parent, const RS_PolylineData& d): - RS_EntityContainer(parent), data(d) +Polyline::Polyline(EntityContainer* parent, const PolylineData& d): + EntityContainer(parent), data(d) { closingEntity = NULL; nextBulge = 0.0; @@ -45,13 +45,13 @@ RS_Polyline::RS_Polyline(RS_EntityContainer* parent, const RS_PolylineData& d): /** * Destructor */ -RS_Polyline::~RS_Polyline() +Polyline::~Polyline() { } -/*virtual*/ RS_Entity * RS_Polyline::clone() +/*virtual*/ Entity * Polyline::clone() { - RS_Polyline * p = new RS_Polyline(*this); + Polyline * p = new Polyline(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // p->entities.setAutoDelete(entities.autoDelete()); p->initId(); @@ -60,19 +60,19 @@ RS_Polyline::~RS_Polyline() } /** @return RS2::EntityPolyline */ -/*virtual*/ RS2::EntityType RS_Polyline::rtti() const +/*virtual*/ RS2::EntityType Polyline::rtti() const { return RS2::EntityPolyline; } /** @return Copy of data that defines the polyline. */ -RS_PolylineData RS_Polyline::getData() const +PolylineData Polyline::getData() const { return data; } /** sets a new start point of the polyline */ -void RS_Polyline::setStartpoint(Vector & v) +void Polyline::setStartpoint(Vector & v) { data.startpoint = v; @@ -81,19 +81,19 @@ void RS_Polyline::setStartpoint(Vector & v) } /** @return Start point of the entity */ -Vector RS_Polyline::getStartpoint() +Vector Polyline::getStartpoint() { return data.startpoint; } /** sets a new end point of the polyline */ -void RS_Polyline::setEndpoint(Vector & v) +void Polyline::setEndpoint(Vector & v) { data.endpoint = v; } /** @return End point of the entity */ -Vector RS_Polyline::getEndpoint() +Vector Polyline::getEndpoint() { return data.endpoint; } @@ -101,9 +101,9 @@ Vector RS_Polyline::getEndpoint() /** * Removes the last vertex of this polyline. */ -void RS_Polyline::removeLastVertex() +void Polyline::removeLastVertex() { - RS_Entity * last = lastEntity(); + Entity * last = lastEntity(); if (last != NULL) { @@ -113,9 +113,9 @@ void RS_Polyline::removeLastVertex() if (last != NULL) { if (last->isAtomic()) - data.endpoint = ((RS_AtomicEntity*)last)->getEndpoint(); + data.endpoint = ((AtomicEntity*)last)->getEndpoint(); else - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Polyline::removeLastVertex: " + DEBUG->print(Debug::D_WARNING, "Polyline::removeLastVertex: " "polyline contains non-atomic entity"); } } @@ -135,9 +135,9 @@ void RS_Polyline::removeLastVertex() * @return Pointer to the entity that was addded or NULL if this * was the first vertex added. */ -RS_Entity * RS_Polyline::addVertex(const Vector & v, double bulge, bool prepend) +Entity * Polyline::addVertex(const Vector & v, double bulge, bool prepend) { - RS_Entity * entity = NULL; + Entity * entity = NULL; //static double nextBulge = 0.0; // very first vertex: @@ -153,11 +153,11 @@ RS_Entity * RS_Polyline::addVertex(const Vector & v, double bulge, bool prepend) entity = createVertex(v, nextBulge, prepend); if (entity!=NULL) { if (prepend==false) { - RS_EntityContainer::addEntity(entity); + EntityContainer::addEntity(entity); data.endpoint = v; } else { - RS_EntityContainer::insertEntity(0, entity); + EntityContainer::insertEntity(0, entity); data.startpoint = v; } } @@ -184,25 +184,25 @@ RS_Entity * RS_Polyline::addVertex(const Vector & v, double bulge, bool prepend) * @return Pointer to the entity that was created or NULL if this * was the first vertex added. */ -RS_Entity* RS_Polyline::createVertex(const Vector& v, double bulge, bool prepend) { +Entity* Polyline::createVertex(const Vector& v, double bulge, bool prepend) { - RS_Entity* entity=NULL; + Entity* entity=NULL; - RS_DEBUG->print("RS_Polyline::createVertex: %f/%f to %f/%f bulge: %f", + DEBUG->print("Polyline::createVertex: %f/%f to %f/%f bulge: %f", data.endpoint.x, data.endpoint.y, v.x, v.y, bulge); // create line for the polyline: if (fabs(bulge)setSelected(isSelected()); - entity->setPen(RS_Pen(RS2::FlagInvalid)); + entity->setPen(Pen(RS2::FlagInvalid)); entity->setLayer(NULL); - //RS_EntityContainer::addEntity(entity); + //EntityContainer::addEntity(entity); //data.endpoint = v; } @@ -231,7 +231,7 @@ RS_Entity* RS_Polyline::createVertex(const Vector& v, double bulge, bool prepend // alpha can't be 0.0 at this point radius = fabs(dist / sin(alpha/2.0)); - double wu = fabs(RS_Math::pow(radius, 2.0) - RS_Math::pow(dist, 2.0)); + double wu = fabs(Math::pow(radius, 2.0) - Math::pow(dist, 2.0)); double h = sqrt(wu); if (bulge>0.0) { @@ -259,13 +259,13 @@ RS_Entity* RS_Polyline::createVertex(const Vector& v, double bulge, bool prepend a2 = center.angleTo(data.startpoint); } - RS_ArcData d(center, radius, + ArcData d(center, radius, a1, a2, reversed); - entity = new RS_Arc(this, d); + entity = new Arc(this, d); entity->setSelected(isSelected()); - entity->setPen(RS_Pen(RS2::FlagInvalid)); + entity->setPen(Pen(RS2::FlagInvalid)); entity->setLayer(NULL); } @@ -275,13 +275,13 @@ RS_Entity* RS_Polyline::createVertex(const Vector& v, double bulge, bool prepend /** * Ends polyline and adds the last entity if the polyline is closed */ -void RS_Polyline::endPolyline() +void Polyline::endPolyline() { - RS_DEBUG->print("RS_Polyline::endPolyline"); + DEBUG->print("Polyline::endPolyline"); if (isClosed()) { - RS_DEBUG->print("RS_Polyline::endPolyline: adding closing entity"); + DEBUG->print("Polyline::endPolyline: adding closing entity"); // remove old closing entity: if (closingEntity!=NULL) @@ -293,7 +293,7 @@ void RS_Polyline::endPolyline() closingEntity = createVertex(data.startpoint, nextBulge); if (closingEntity!=NULL) { - RS_EntityContainer::addEntity(closingEntity); + EntityContainer::addEntity(closingEntity); //data.endpoint = data.startpoint; } } @@ -302,12 +302,12 @@ void RS_Polyline::endPolyline() /** * @return The bulge of the closing entity. */ -double RS_Polyline::getClosingBulge() +double Polyline::getClosingBulge() { if (isClosed()) { - RS_Entity* e = lastEntity(); + Entity* e = lastEntity(); if (e!=NULL && e->rtti()==RS2::EntityArc) { - return ((RS_Arc*)e)->getBulge(); + return ((Arc*)e)->getBulge(); } } @@ -317,17 +317,17 @@ double RS_Polyline::getClosingBulge() /** * Sets the polylines start and endpoint to match the first and last vertex. */ -void RS_Polyline::updateEndpoints() +void Polyline::updateEndpoints() { - RS_Entity * e1 = firstEntity(); + Entity * e1 = firstEntity(); if (e1 != NULL && e1->isAtomic()) { - Vector v = ((RS_AtomicEntity *)e1)->getStartpoint(); + Vector v = ((AtomicEntity *)e1)->getStartpoint(); setStartpoint(v); } - RS_Entity * e2 = lastEntity(); + Entity * e2 = lastEntity(); if (isClosed()) { @@ -336,18 +336,18 @@ void RS_Polyline::updateEndpoints() if (e2 != NULL && e2->isAtomic()) { - Vector v = ((RS_AtomicEntity *)e2)->getEndpoint(); + Vector v = ((AtomicEntity *)e2)->getEndpoint(); setEndpoint(v); } } /** @return true if the polyline is closed. false otherwise */ -bool RS_Polyline::isClosed() const +bool Polyline::isClosed() const { return data.getFlag(RS2::FlagClosed); } -void RS_Polyline::setClosed(bool cl) +void Polyline::setClosed(bool cl) { if (cl) data.setFlag(RS2::FlagClosed); @@ -361,9 +361,9 @@ void RS_Polyline::setClosed(bool cl) * * To add entities use addVertex() or addSegment() instead. */ -void RS_Polyline::addEntity(RS_Entity * entity) +void Polyline::addEntity(Entity * entity) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Polyline::addEntity: should never be called"); + DEBUG->print(Debug::D_WARNING, "Polyline::addEntity: should never be called"); if (entity == NULL) return; @@ -371,7 +371,7 @@ void RS_Polyline::addEntity(RS_Entity * entity) delete entity; } -/*virtual*/ void RS_Polyline::setNextBulge(double bulge) +/*virtual*/ void Polyline::setNextBulge(double bulge) { nextBulge = bulge; } @@ -379,12 +379,12 @@ void RS_Polyline::addEntity(RS_Entity * entity) /** * Adds a segment to the polyline. */ -/*void RS_Polyline::addSegment(RS_Entity* entity) { - RS_EntityContainer::addEntity(entity); +/*void Polyline::addSegment(Entity* entity) { + EntityContainer::addEntity(entity); // TODO: reorder and check polyline }*/ -VectorSolutions RS_Polyline::getRefPoints() +VectorSolutions Polyline::getRefPoints() { VectorSolutions ret(count()+1); @@ -392,11 +392,11 @@ VectorSolutions RS_Polyline::getRefPoints() ret.set(0, data.startpoint); i++; - for (RS_Entity* e=firstEntity(RS2::ResolveNone); + for (Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone), i++) { if (e->isAtomic()) { - ret.set(i, ((RS_AtomicEntity*)e)->getEndpoint()); + ret.set(i, ((AtomicEntity*)e)->getEndpoint()); } } @@ -405,22 +405,22 @@ VectorSolutions RS_Polyline::getRefPoints() return ret; } -Vector RS_Polyline::getNearestRef(const Vector& coord, +Vector Polyline::getNearestRef(const Vector& coord, double* dist) { - return RS_Entity::getNearestRef(coord, dist); + return Entity::getNearestRef(coord, dist); } -Vector RS_Polyline::getNearestSelectedRef(const Vector& coord, +Vector Polyline::getNearestSelectedRef(const Vector& coord, double* dist) { - return RS_Entity::getNearestSelectedRef(coord, dist); + return Entity::getNearestSelectedRef(coord, dist); } /* -void RS_Polyline::reorder() { +void Polyline::reorder() { // current point: Vector cp; @@ -433,39 +433,39 @@ void RS_Polyline::reorder() { -void RS_Polyline::move(Vector offset) { - RS_EntityContainer::move(offset); +void Polyline::move(Vector offset) { + EntityContainer::move(offset); data.startpoint.move(offset); data.endpoint.move(offset); } -void RS_Polyline::rotate(Vector center, double angle) { - RS_EntityContainer::rotate(center, angle); +void Polyline::rotate(Vector center, double angle) { + EntityContainer::rotate(center, angle); data.startpoint.rotate(center, angle); data.endpoint.rotate(center, angle); } -void RS_Polyline::scale(Vector center, Vector factor) { - RS_EntityContainer::scale(center, factor); +void Polyline::scale(Vector center, Vector factor) { + EntityContainer::scale(center, factor); data.startpoint.scale(center, factor); data.endpoint.scale(center, factor); } -void RS_Polyline::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_EntityContainer::mirror(axisPoint1, axisPoint2); +void Polyline::mirror(Vector axisPoint1, Vector axisPoint2) { + EntityContainer::mirror(axisPoint1, axisPoint2); data.startpoint.mirror(axisPoint1, axisPoint2); data.endpoint.mirror(axisPoint1, axisPoint2); } -void RS_Polyline::moveRef(const Vector & ref, const Vector & offset) +void Polyline::moveRef(const Vector & ref, const Vector & offset) { - RS_EntityContainer::moveRef(ref, offset); + EntityContainer::moveRef(ref, offset); if (ref.distanceTo(data.startpoint) < 1.0e-4) data.startpoint.move(offset); @@ -476,7 +476,7 @@ void RS_Polyline::moveRef(const Vector & ref, const Vector & offset) //update(); } -void RS_Polyline::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void Polyline::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { if (data.startpoint.isInWindow(firstCorner, secondCorner)) data.startpoint.move(offset); @@ -484,33 +484,33 @@ void RS_Polyline::stretch(Vector firstCorner, Vector secondCorner, Vector offset if (data.endpoint.isInWindow(firstCorner, secondCorner)) data.endpoint.move(offset); - RS_EntityContainer::stretch(firstCorner, secondCorner, offset); + EntityContainer::stretch(firstCorner, secondCorner, offset); } /** * Slightly optimized drawing for polylines. */ -void RS_Polyline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Polyline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (!painter || !view) return; // draw first entity and set correct pen: - RS_Entity * e = firstEntity(RS2::ResolveNone); + Entity * e = firstEntity(RS2::ResolveNone); view->drawEntity(e); // draw subsequent entities with same pen: - for(RS_Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone)) + for(Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone)) view->drawEntityPlain(e); } /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Polyline & l) +std::ostream & operator<<(std::ostream & os, const Polyline & l) { os << " Polyline: " << l.getData() << " {\n"; - os << (RS_EntityContainer &)l; + os << (EntityContainer &)l; os << "\n}\n"; return os; diff --git a/src/base/polyline.h b/src/base/polyline.h index 49c9b09..b6fba86 100644 --- a/src/base/polyline.h +++ b/src/base/polyline.h @@ -7,26 +7,26 @@ /** * Holds the data that defines a polyline. */ -class RS_PolylineData: public RS_Flags +class PolylineData: public Flags { public: - RS_PolylineData() + PolylineData() { startpoint = endpoint = Vector(false); } - RS_PolylineData(const Vector & startpoint, const Vector & endpoint, bool closed) + PolylineData(const Vector & startpoint, const Vector & endpoint, bool closed) { this->startpoint = startpoint; this->endpoint = endpoint; - if (closed == true) + if (closed) setFlag(RS2::FlagClosed); } - friend class RS_Polyline; + friend class Polyline; - friend std::ostream & operator<<(std::ostream & os, const RS_PolylineData & pd) + friend std::ostream & operator<<(std::ostream & os, const PolylineData & pd) { os << "(" << pd.startpoint << "/" << pd.endpoint << ")"; return os; @@ -42,16 +42,16 @@ class RS_PolylineData: public RS_Flags * * @author Andrew Mustun */ -class RS_Polyline: public RS_EntityContainer +class Polyline: public EntityContainer { public: - RS_Polyline(RS_EntityContainer * parent = NULL); - RS_Polyline(RS_EntityContainer * parent, const RS_PolylineData & d); - virtual ~RS_Polyline(); + Polyline(EntityContainer * parent = NULL); + Polyline(EntityContainer * parent, const PolylineData & d); + virtual ~Polyline(); - virtual RS_Entity * clone(); + virtual Entity * clone(); virtual RS2::EntityType rtti() const; - RS_PolylineData getData() const; + PolylineData getData() const; void setStartpoint(Vector & v); Vector getStartpoint(); void setEndpoint(Vector & v); @@ -64,10 +64,10 @@ class RS_Polyline: public RS_EntityContainer virtual VectorSolutions getRefPoints(); virtual Vector getNearestRef(const Vector & coord, double * dist = NULL); virtual Vector getNearestSelectedRef(const Vector & coord, double * dist = NULL); - virtual RS_Entity * addVertex(const Vector & v, double bulge = 0.0, bool prepend = false); + virtual Entity * addVertex(const Vector & v, double bulge = 0.0, bool prepend = false); virtual void setNextBulge(double bulge); - virtual void addEntity(RS_Entity * entity); - //virtual void addSegment(RS_Entity* entity); + virtual void addEntity(Entity * entity); + //virtual void addSegment(Entity* entity); virtual void removeLastVertex(); virtual void endPolyline(); //virtual void reorder(); @@ -79,14 +79,14 @@ class RS_Polyline: public RS_EntityContainer virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - friend std::ostream & operator<<(std::ostream & os, const RS_Polyline & l); + friend std::ostream & operator<<(std::ostream & os, const Polyline & l); protected: - virtual RS_Entity * createVertex(const Vector & v, double bulge = 0.0, bool prepend = false); + virtual Entity * createVertex(const Vector & v, double bulge = 0.0, bool prepend = false); protected: - RS_PolylineData data; - RS_Entity * closingEntity; + PolylineData data; + Entity * closingEntity; double nextBulge; }; diff --git a/src/base/preview.cpp b/src/base/preview.cpp index 1a873b8..b0d6066 100644 --- a/src/base/preview.cpp +++ b/src/base/preview.cpp @@ -25,7 +25,7 @@ /** * Constructor. */ -RS_Preview::RS_Preview(RS_EntityContainer * parent): RS_EntityContainer(parent), +Preview::Preview(EntityContainer * parent): EntityContainer(parent), visible(false) { settings.beginGroup("Appearance"); @@ -36,7 +36,7 @@ RS_Preview::RS_Preview(RS_EntityContainer * parent): RS_EntityContainer(parent), /** * Destructor. */ -RS_Preview::~RS_Preview() +Preview::~Preview() { } @@ -44,7 +44,7 @@ RS_Preview::~RS_Preview() * Adds an entity to this preview and removes any attributes / layer * connectsions before that. */ -void RS_Preview::addEntity(RS_Entity * entity) +void Preview::addEntity(Entity * entity) { if (entity == NULL || entity->isUndone()) return; @@ -73,15 +73,15 @@ void RS_Preview::addEntity(RS_Entity * entity) Vector min = entity->getMin(); Vector max = entity->getMax(); - RS_Line * l1 = new RS_Line(this, RS_LineData(Vector(min.x, min.y), Vector(max.x, min.y))); - RS_Line * l2 = new RS_Line(this, RS_LineData(Vector(max.x, min.y), Vector(max.x, max.y))); - RS_Line * l3 = new RS_Line(this, RS_LineData(Vector(max.x, max.y), Vector(min.x, max.y))); - RS_Line * l4 = new RS_Line(this, RS_LineData(Vector(min.x, max.y), Vector(min.x, min.y))); + Line * l1 = new Line(this, LineData(Vector(min.x, min.y), Vector(max.x, min.y))); + Line * l2 = new Line(this, LineData(Vector(max.x, min.y), Vector(max.x, max.y))); + Line * l3 = new Line(this, LineData(Vector(max.x, max.y), Vector(min.x, max.y))); + Line * l4 = new Line(this, LineData(Vector(min.x, max.y), Vector(min.x, min.y))); - RS_EntityContainer::addEntity(l1); - RS_EntityContainer::addEntity(l2); - RS_EntityContainer::addEntity(l3); - RS_EntityContainer::addEntity(l4); + EntityContainer::addEntity(l1); + EntityContainer::addEntity(l2); + EntityContainer::addEntity(l3); + EntityContainer::addEntity(l4); delete entity; entity = NULL; @@ -91,35 +91,35 @@ void RS_Preview::addEntity(RS_Entity * entity) entity->setLayer(NULL); entity->setSelected(false); entity->reparent(this); - entity->setPen(RS_Pen(RS_Color(255, 255, 255), RS2::Width00, RS2::SolidLine)); - RS_EntityContainer::addEntity(entity); + entity->setPen(Pen(Color(255, 255, 255), RS2::Width00, RS2::SolidLine)); + EntityContainer::addEntity(entity); } } /** * Clones the given entity and adds the clone to the preview. */ -void RS_Preview::addCloneOf(RS_Entity * entity) +void Preview::addCloneOf(Entity * entity) { if (!entity) return; - RS_Entity * clone = entity->clone(); + Entity * clone = entity->clone(); addEntity(clone); } /** * Adds all entities from 'container' to the preview (unselected). */ -void RS_Preview::addAllFrom(RS_EntityContainer & container) +void Preview::addAllFrom(EntityContainer & container) { int c = 0; - for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) + for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) { if (c < maxEntities) { - RS_Entity * clone = e->clone(); + Entity * clone = e->clone(); clone->setSelected(false); clone->reparent(this); @@ -133,15 +133,15 @@ void RS_Preview::addAllFrom(RS_EntityContainer & container) /** * Adds all selected entities from 'container' to the preview (unselected). */ -void RS_Preview::addSelectionFrom(RS_EntityContainer & container) +void Preview::addSelectionFrom(EntityContainer & container) { int c = 0; - for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) + for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) { if (e->isSelected() && c < maxEntities) { - RS_Entity * clone = e->clone(); + Entity * clone = e->clone(); clone->setSelected(false); clone->reparent(this); @@ -156,17 +156,17 @@ void RS_Preview::addSelectionFrom(RS_EntityContainer & container) * Adds all entities in the given range and those which have endpoints in the * given range to the preview. */ -void RS_Preview::addStretchablesFrom(RS_EntityContainer & container, const Vector & v1, +void Preview::addStretchablesFrom(EntityContainer & container, const Vector & v1, const Vector & v2) { int c = 0; - for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) + for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity()) { if (e->isVisible() && e->rtti() != RS2::EntityHatch && (e->isInWindow(v1, v2) || e->hasEndpointsWithinWindow(v1, v2)) && c < maxEntities) { - RS_Entity * clone = e->clone(); + Entity * clone = e->clone(); //clone->setSelected(false); clone->reparent(this); @@ -177,37 +177,37 @@ void RS_Preview::addStretchablesFrom(RS_EntityContainer & container, const Vecto } } -void RS_Preview::SetOffset(Vector v) +void Preview::SetOffset(Vector v) { offset = v; } -Vector RS_Preview::Offset(void) +Vector Preview::Offset(void) { return offset; } -void RS_Preview::SetVisible(bool visibility/*= true*/) +void Preview::SetVisible(bool visibility/*= true*/) { visible = visibility; } -bool RS_Preview::Visible(void) +bool Preview::Visible(void) { return visible; } -void RS_Preview::Draw(GraphicView * view, PaintInterface * painter) +void Preview::Draw(GraphicView * view, PaintInterface * painter) { if (isEmpty()) return; - painter->setPen(RS_Pen(RS_Color(60, 255, 80), RS2::Width00, RS2::SolidLine)); + painter->setPen(Pen(Color(60, 255, 80), RS2::Width00, RS2::SolidLine)); painter->setOffset(offset); // We have to traverse the container ourselves, because RS_Container::draw() // uses drawEntity() instead of drawEntityPlain()... - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) view->drawEntityPlain(e); painter->setOffset(Vector(0, 0)); diff --git a/src/base/preview.h b/src/base/preview.h index 42ed4d0..4f2a39b 100644 --- a/src/base/preview.h +++ b/src/base/preview.h @@ -4,27 +4,27 @@ #include "entitycontainer.h" #include "vector.h" -class RS_Entity; +class Entity; class PaintInterface; /** - * This class supports previewing. The RS_Snapper class uses - * an instance of RS_Preview to preview entities, ranges, + * This class supports previewing. The Snapper class uses + * an instance of Preview to preview entities, ranges, * lines, arcs, ... on the fly. * * @author Andrew Mustun */ -class RS_Preview: public RS_EntityContainer +class Preview: public EntityContainer { public: - RS_Preview(RS_EntityContainer * parent = NULL); - ~RS_Preview(); + Preview(EntityContainer * parent = NULL); + ~Preview(); - virtual void addEntity(RS_Entity * entity); - void addCloneOf(RS_Entity * entity); - virtual void addSelectionFrom(RS_EntityContainer & container); - virtual void addAllFrom(RS_EntityContainer & container); - virtual void addStretchablesFrom(RS_EntityContainer & container, + virtual void addEntity(Entity * entity); + void addCloneOf(Entity * entity); + virtual void addSelectionFrom(EntityContainer & container); + virtual void addAllFrom(EntityContainer & container); + virtual void addStretchablesFrom(EntityContainer & container, const Vector & v1, const Vector & v2); void SetOffset(Vector); diff --git a/src/base/python.cpp b/src/base/python.cpp deleted file mode 100644 index b3a92d3..0000000 --- a/src/base/python.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// python.cpp -// -// Part of the Architektonas Project -// Originally part of QCad Community Edition by Andrew Mustun -// Extensively rewritten and refactored by James L. Hammons -// Portions copyright (C) 2001-2003 RibbonSoft -// Copyright (C) 2010 Underground Software -// See the README and GPLv2 files for licensing and warranty information -// -// JLH = James L. Hammons -// -// Who When What -// --- ---------- ----------------------------------------------------------- -// JLH 06/02/2010 Added this text. :-) -// - -#include "python.h" - -#ifdef RS_OPT_PYTHON - -// -// This is exported from the Boost::Python library declarations -// that are declared inside rs_python_wrappers.cpp. -// -extern "C" void initqcad(); - -/** - * The unique instance of the Python scripting engine - */ -RS_Python* RS_Python::uniqueInstance = NULL; - -/** - * Constructor - */ -RS_Python::RS_Python() -{ - graphic = NULL; - Py_Initialize(); - initqcad(); -} - -/** - * Gets the one and only RS_Python instance - * (creates a new one on first call only) - * - * @return Pointer to the single instance of this - * singleton class - */ -RS_Python* RS_Python::instance() { - if(uniqueInstance==NULL) { - uniqueInstance = new RS_Python; - } - return uniqueInstance; -} - - -/** - * Launches the given script. - */ -int RS_Python::launch(const QString& script) { - PyObject *modname, *mod, *mdict, *func, *rslt; - //Py_SetProgramName(argv[0]); - - modname = PyString_FromString(script); - mod = PyImport_Import(modname); - if (mod) { - //printf( "mod\n"); - mdict = PyModule_GetDict(mod); - - // Borrowed reference to start function - func = PyDict_GetItemString(mdict, "start"); - if (func) { - //printf( "func\n"); - if (PyCallable_Check(func)) { - //printf("calling..\n"); - rslt = PyObject_CallFunction(func, "(s)", "noparam"); - //printf("calling ok\n"); - if (rslt) { - // The result value is currently not used - Py_XDECREF(rslt); - } else - { - // Give user some feed back what went wrong - printf("*** PYTHON RUNTIME ERROR ***\n"); - PyErr_Print(); - } - } - } else { - printf("no such function: start\n"); - } - Py_XDECREF(mod); - } else { - printf("*** ERROR LOADING SCRIPT '%s' ***\n", script.latin1()); - PyErr_Print(); - } - Py_XDECREF(modname); - //Py_Finalize(); - return 0; -} - -#endif diff --git a/src/base/python.h b/src/base/python.h deleted file mode 100644 index 7e1a7db..0000000 --- a/src/base/python.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __PYTHON_H__ -#define __PYTHON_H__ - -#ifdef RS_OPT_PYTHON - -#include "Python.h" - -#include "drawing.h" - -#define __PYTHON RS_Python::instance() - -/** - * Python scripting support. - * - * OBSOLETE - * - * @author Andrew Mustun - */ -class RS_Python { -private: - RS_Python(); - -public: - static RS_Python* instance(); - - void setGraphic(Drawing* g) { - graphic = g; - } - - Drawing* getGraphic() { - return graphic; - } - - int launch(const QString& script); - -private: - static RS_Python* uniqueInstance; - Drawing* graphic; -}; - -#endif - -#endif diff --git a/src/base/python_wrappers.cpp b/src/base/python_wrappers.cpp deleted file mode 100644 index 68901f4..0000000 --- a/src/base/python_wrappers.cpp +++ /dev/null @@ -1,602 +0,0 @@ -/*************************************************************************** -** $Id -** -** Python language bindings for QCad II -** -** Copyright (C) 2003 Markus Meyer -** -** Permission to copy, use, modify, sell and distribute this file is granted -** provided this copyright notice is not removed or altered. -** This software is provided "as is" without express or implied -** warranty, and with no claim as to its suitability for any purpose. -** -***************************************************************************/ - -/** - * TODO: - * - Complete block support - * - Support for hatches, dimensions, text, solids - * - Support for user interactions - * - Support for more than one document - */ -#ifdef RS_OPT_PYTHON - -#include -using namespace boost::python; - -#include "python_wrappers.h" -#include "python.h" - -#include "rs.h" -#include "arc.h" -#include "atomicentity.h" -#include "block.h" -#include "blocklist.h" -#include "circle.h" -#include "color.h" -#include "constructionline.h" -#include "document.h" -#include "ellipse.h" -#include "entitycontainer.h" -#include "entity.h" -#include "flags.h" -#include "drawing.h" -#include "image.h" -#include "insert.h" -#include "layer.h" -#include "layerlist.h" -#include "line.h" -#include "pen.h" -#include "point.h" -#include "polyline.h" -#include "vector.h" - -/* Global root functions */ -Drawing* currentGraphic() { return RS_PYTHON->getGraphic(); } - - /* more to be added later (access to global properties, all documents, - creation of new documents, ... */ - -/* To/From Python string conversion logic for string management */ -namespace QString_Python_Conversions { - namespace { - struct QString_to_python_str - { - static PyObject* convert(QString const& s) - { - return boost::python::incref(boost::python::object((const char*)s).ptr()); - } - }; - - struct QString_from_python_str - { - QString_from_python_str() - { - boost::python::converter::registry::push_back( - &convertible, - &construct, - boost::python::type_id()); - } - - static void* convertible(PyObject* obj_ptr) - { - if (!PyString_Check(obj_ptr)) return 0; - return obj_ptr; - } - - static void construct( - PyObject* obj_ptr, - boost::python::converter::rvalue_from_python_stage1_data* data) - { - const char* value = PyString_AsString(obj_ptr); - if (!value) - boost::python::throw_error_already_set(); - void* storage = ( - (boost::python::converter::rvalue_from_python_storage*) - data)->storage.bytes; - new (storage) QString(value); - data->convertible = storage; - } - }; - - void registerConversions() - { - using namespace boost::python; - - boost::python::to_python_converter< - QString, QString_to_python_str>(); - - QString_from_python_str(); - } - } -} - -/* Transfer of ownership is done by using auto pointers */ -/* These are the helper functions needed for this mechanism */ - -#define TRANSFER_OWNERSHIP_FUNCTION(fname, container, addfunc, entity) \ - void fname(container& cont, std::auto_ptr obj) \ - { cont.addfunc(obj.get()); obj.release(); } - -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) \ - TRANSFER_OWNERSHIP_FUNCTION(fname, RS_EntityContainer, addEntity, entity) - -ADDVERTEX_FUNCTION(RS_EntityContainer_addArc, RS_Arc) -ADDVERTEX_FUNCTION(RS_EntityContainer_addBlock, RS_Block) -ADDVERTEX_FUNCTION(RS_EntityContainer_addCircle, RS_Circle) -ADDVERTEX_FUNCTION(RS_EntityContainer_addConstructionLine, RS_ConstructionLine) -ADDVERTEX_FUNCTION(RS_EntityContainer_addEllipse, RS_Ellipse) -ADDVERTEX_FUNCTION(RS_EntityContainer_addImage, RS_Image) -ADDVERTEX_FUNCTION(RS_EntityContainer_addLine, RS_Line) -ADDVERTEX_FUNCTION(RS_EntityContainer_addPoint, RS_Point) -ADDVERTEX_FUNCTION(RS_EntityContainer_addPolyline, RS_Polyline) - -/* Overloaded functions helpers */ -void (RS_LayerList::*RS_LayerList_activate_string)(const QString&) = &RS_LayerList::activate; -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 (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; - -/** - * The main python module - */ - -BOOST_PYTHON_MODULE(qcad) -{ - /* Initialization code */ - QString_Python_Conversions::registerConversions(); - - /* Unbound functions */ - - def("currentGraphic", currentGraphic, return_value_policy()); - - /* Enums */ - enum_("Flag") - .value("Undone", RS2::FlagUndone) - .value("Visible", RS2::FlagVisible) - .value("ByLayer", RS2::FlagByLayer) - .value("ByBlock", RS2::FlagByBlock) - .value("Frozen", RS2::FlagFrozen) - .value("DefFrozen", RS2::FlagDefFrozen) - .value("Locked", RS2::FlagLocked) - .value("Invalid", RS2::FlagInvalid) - .value("Selected", RS2::FlagSelected) - .value("Closed", RS2::FlagClosed) - .value("Temp", RS2::FlagTemp) - .value("Processed", RS2::FlagProcessed) - .value("Selected1", RS2::FlagSelected1) - .value("Selected2", RS2::FlagSelected2) - ; - - enum_("VariableType") - .value("String", RS2::VariableString) - .value("Int", RS2::VariableInt) - .value("Double", RS2::VariableDouble) - .value("Vector", RS2::VariableVector) - .value("Void", RS2::VariableVoid) - ; - - enum_("EntityType") - .value("Unknown", RS2::EntityUnknown) - .value("Container", RS2::EntityContainer) - .value("Block", RS2::EntityBlock) - .value("FontChar", RS2::EntityFontChar) - .value("Insert", RS2::EntityInsert) - .value("Graphic", RS2::EntityGraphic) - .value("Point", RS2::EntityPoint) - .value("Line", RS2::EntityLine) - .value("Polyline", RS2::EntityPolyline) - .value("Vertex", RS2::EntityVertex) - .value("Arc", RS2::EntityArc) - .value("Circle", RS2::EntityCircle) - .value("Ellipse", RS2::EntityEllipse) - .value("Solid", RS2::EntitySolid) - .value("ConstructionLine", RS2::EntityConstructionLine) - .value("Text", RS2::EntityText) - .value("DimAligned", RS2::EntityDimAligned) - .value("DimLinear", RS2::EntityDimLinear) - .value("DimRadial", RS2::EntityDimRadial) - .value("DimDiametric", RS2::EntityDimDiametric) - .value("DimAngular", RS2::EntityDimAngular) - .value("DimLeader", RS2::EntityDimLeader) - .value("Hatch", RS2::EntityHatch) - .value("Image", RS2::EntityImage) - ; - - enum_("LineType") - .value("NoPen", RS2::NoPen) - .value("SolidLine", RS2::SolidLine) - .value("DotLine", RS2::DotLine) - .value("DotLine2", RS2::DotLine2) - .value("DotLineX2", RS2::DotLineX2) - .value("DashLine", RS2::DashLine) - .value("DashLine2", RS2::DashLine2) - .value("DashLineX2", RS2::DashLineX2) - .value("DashDotLine", RS2::DashDotLine) - .value("DashDotLine2", RS2::DashDotLine2) - .value("DashDotLineX2", RS2::DashDotLineX2) - .value("DivideLine", RS2::DivideLine) - .value("DivideLine2", RS2::DivideLine2) - .value("DivideLineX2", RS2::DivideLineX2) - .value("CenterLine", RS2::CenterLine) - .value("CenterLine2", RS2::CenterLine2) - .value("CenterLineX2", RS2::CenterLineX2) - .value("BorderLine", RS2::BorderLine) - .value("BorderLine2", RS2::BorderLine2) - .value("BorderLineX2", RS2::BorderLineX2) - .value("ByLayer", RS2::LineByLayer) - .value("ByBlock", RS2::LineByBlock) - ; - - enum_("LineWidth") - .value("Width00", RS2::Width00) - .value("Width01", RS2::Width01) - .value("Width02", RS2::Width02) - .value("Width03", RS2::Width03) - .value("Width04", RS2::Width04) - .value("Width05", RS2::Width05) - .value("Width06", RS2::Width06) - .value("Width07", RS2::Width07) - .value("Width08", RS2::Width08) - .value("Width09", RS2::Width09) - .value("Width10", RS2::Width10) - .value("Width11", RS2::Width11) - .value("Width12", RS2::Width12) - .value("Width13", RS2::Width13) - .value("Width14", RS2::Width14) - .value("Width15", RS2::Width15) - .value("Width16", RS2::Width16) - .value("Width17", RS2::Width17) - .value("Width18", RS2::Width18) - .value("Width19", RS2::Width19) - .value("Width20", RS2::Width20) - .value("Width21", RS2::Width21) - .value("Width22", RS2::Width22) - .value("Width23", RS2::Width23) - .value("ByLayer", RS2::WidthByLayer) - .value("ByBlock", RS2::WidthByBlock) - .value("Default", RS2::WidthDefault) - ; - - /* "Small" classes */ - - class_("Flags") - .def(init()) - .add_property("flags", &RS_Flags::getFlags, &RS_Flags::setFlags) - .def("resetFlags", &RS_Flags::resetFlags) - .def("setFlag", &RS_Flags::setFlag) - .def("delFlag", &RS_Flags::delFlag) - .def("toggleFlag", &RS_Flags::toggleFlag) - .def("getFlag", &RS_Flags::getFlag) - ; - - class_ >("Color") - .def(init()) - .def(init()) - .def("stripFlags", &RS_Color::stripFlags) - .add_property("byLayer", &RS_Color::isByLayer) - .add_property("byBlock", &RS_Color::isByBlock) - ; - - class_("Vector") - .def(init >()) - .def("set", &RS_Vector::set) - .def("setPolar", &RS_Vector::setPolar) - .def("distanceTo", &RS_Vector::distanceTo) - .def("angle", &RS_Vector::angle) - .def("angleTo", &RS_Vector::angleTo) - .def("magnitude", &RS_Vector::magnitude) - .def("move", &RS_Vector::move) - .def_readwrite("x", &RS_Vector::x) - .def_readwrite("y", &RS_Vector::y) - .def_readwrite("z", &RS_Vector::z) - .def_readwrite("valid", &RS_Vector::valid) - ; - - class_ >("Pen") - .def(init()) - .add_property("lineType", &RS_Pen::getLineType, &RS_Pen::setLineType) - .add_property("width", &RS_Pen::getWidth, &RS_Pen::setWidth) - .add_property("screenWidth", &RS_Pen::getScreenWidth, &RS_Pen::setScreenWidth) - .add_property("color", make_function(&RS_Pen::getColor, return_value_policy()), &RS_Pen::setColor) - .add_property("valid", &RS_Pen::isValid) - ; - - /* Common stuff */ - - class_("EntityContainer", init >()) - /* Wrapper functions for ownership transfer */ - .def("addEntity", RS_EntityContainer_addArc) - .def("addEntity", RS_EntityContainer_addBlock) - .def("addEntity", RS_EntityContainer_addCircle) - .def("addEntity", RS_EntityContainer_addConstructionLine) - .def("addEntity", RS_EntityContainer_addEllipse) - .def("addEntity", RS_EntityContainer_addImage) - .def("addEntity", RS_EntityContainer_addLine) - .def("addEntity", RS_EntityContainer_addPoint) - .def("addEntity", RS_EntityContainer_addPolyline) - - /** Owner-Containers will automatically delete entities upon removing, - * so no problem here. Other containers are not allowed in Python at the moment. - */ - .def("removeEntity", &RS_EntityContainer::removeEntity) - - /* Standard wrappers */ - .def("clear", &RS_EntityContainer::clear) - .add_property("empty", &RS_EntityContainer::isEmpty) - .def("entityAt", &RS_EntityContainer::entityAt, return_value_policy()) - - /* Iterators */ - .def("firstEntity", &RS_EntityContainer::firstEntity, return_value_policy()) - .def("lastEntity", &RS_EntityContainer::lastEntity, return_value_policy()) - .def("nextEntity", &RS_EntityContainer::nextEntity, return_value_policy()) - ; - - class_("LayerData") - .def(init()) - .def_readwrite("name", &RS_LayerData::name) - .def_readwrite("pen", &RS_LayerData::pen) - .def_readwrite("frozen", &RS_LayerData::frozen) - ; - - class_ >("Layer", init()) - .add_property("name", &RS_Layer::getName, &RS_Layer::setName) - .add_property("pen", &RS_Layer::getPen, &RS_Layer::setPen) - .add_property("frozen", &RS_Layer::isFrozen, &RS_Layer::freeze) - .add_property("toggle", &RS_Layer::toggle) - ; - - class_("LayerList") - .def("clear", &RS_LayerList::clear) - .def("count", &RS_LayerList::count) - .def("at", &RS_LayerList::at, return_value_policy()) - .add_property("active", make_function(&RS_LayerList::getActive, return_value_policy()), - RS_LayerList_activate_layer) - .def("activate", RS_LayerList_activate_string) - .def("activate", RS_LayerList_activate_layer) - .def("add", RS_LayerList_add) - .def("remove", &RS_LayerList::remove) - .def("edit", &RS_LayerList::edit) - .def("find", &RS_LayerList::find, return_value_policy()) - .def("toggle", RS_LayerList_toggle_string) - .def("toggle", RS_LayerList_toggle_layer) - .def("freezeAll", &RS_LayerList::freezeAll) - ; - - class_, boost::noncopyable >("Document", no_init) - .add_property("layerList", make_function(&RS_Document::getLayerList, return_value_policy())) - .add_property("blockList", make_function(&RS_Document::getBlockList, return_value_policy())) - .def("newDoc", &RS_Document::newDoc) - .def("save", &RS_Document::save) - .def("saveAs", &RS_Document::saveAs) - .def("open", &RS_Document::open) - .add_property("modified", &RS_Document::isModified) - .add_property("activePen", &RS_Document::getActivePen, &RS_Document::setActivePen) - .add_property("filename", &RS_Document::getFilename) - ; - - 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 */ - - class_("Entity", no_init) - .def("init", &RS_Entity::init) - .def("initId", &RS_Entity::initId) - .def("clone", &RS_Entity::clone, return_value_policy()) - .def("reparent", &RS_Entity::reparent) - .def("resetBorders", &RS_Entity::resetBorders) - .add_property("id", &RS_Entity::getId) - .add_property("count", &RS_Entity::count) - .add_property("parent", make_function(&RS_Entity::getParent, return_value_policy()), &RS_Entity::setParent) - .add_property("graphic", make_function(&RS_Entity::getGraphic, return_value_policy())) - .add_property("block", make_function(&RS_Entity::getBlock, return_value_policy())) - .add_property("insert", make_function(&RS_Entity::getInsert, return_value_policy())) - .add_property("blockOrInsert", make_function(&RS_Entity::getBlockOrInsert, return_value_policy())) - .add_property("document", make_function(&RS_Entity::getDocument, return_value_policy())) - .add_property("layer", make_function(&RS_Entity::getLayer, return_value_policy()), - RS_Entity_setLayer_layer) - .def("setLayer", RS_Entity_setLayer_string) - .def("setLayer", RS_Entity_setLayer_layer) - .def("setLayerToActive", &RS_Entity::setLayerToActive) - .add_property("isContainer", &RS_Entity::isContainer) - .add_property("isAtomic", &RS_Entity::isAtomic) - .add_property("isEdge", &RS_Entity::isEdge) - .add_property("isDocument", &RS_Entity::isDocument) - .add_property("selected", &RS_Entity::isSelected, &RS_Entity::setSelected) - .def("toggleSelected", &RS_Entity::toggleSelected) - .add_property("processed", &RS_Entity::isProcessed, &RS_Entity::setProcessed) - .add_property("visible", &RS_Entity::isVisible, &RS_Entity::setVisible) - .add_property("min", &RS_Entity::getMin) - .add_property("max", &RS_Entity::getMax) - .add_property("size", &RS_Entity::getSize) - .def("move", &RS_Entity::move) - .def("rotate", &RS_Entity::rotate) - .def("calculateBorders", &RS_Entity::calculateBorders) - ; - - class_, boost::noncopyable>("AtomicEntity", no_init) - .add_property("startpointSelected", &RS_AtomicEntity::isStartpointSelected) - .add_property("endpointSelected", &RS_AtomicEntity::isEndpointSelected) - .def("moveStartpoint", &RS_AtomicEntity::moveStartpoint) - .def("moveEndpoint", &RS_AtomicEntity::moveEndpoint) - .add_property("trimPoint", &RS_AtomicEntity::getTrimPoint) - .def("reverse", &RS_AtomicEntity::reverse) - ; - - /* Entities Data */ - - class_("ArcData") - .def(init()) - .def("reset", &RS_ArcData::reset) - .add_property("valid", &RS_ArcData::isValid) - .def_readwrite("center", &RS_ArcData::center) - .def_readwrite("radius", &RS_ArcData::radius) - .def_readwrite("angle1", &RS_ArcData::angle1) - .def_readwrite("angle2", &RS_ArcData::angle2) - .def_readwrite("reversed", &RS_ArcData::reversed) - ; - - class_("BlockData") - .def(init()) - .add_property("valid", &RS_BlockData::isValid) - .def_readwrite("name", &RS_BlockData::name) - .def_readwrite("basePoint", &RS_BlockData::basePoint) - .def_readwrite("frozen", &RS_BlockData::frozen) - ; - - class_("CircleData") - .def(init()) - .def("reset", &RS_CircleData::reset) - .add_property("valid", &RS_CircleData::isValid) - .def_readwrite("center", &RS_CircleData::center) - .def_readwrite("radius", &RS_CircleData::radius) - ; - - class_("ConstructionLineData") - .def(init()) - ; - - class_("EllipseData", init()) - ; - - class_("ImageData") - .def(init()) - .def_readwrite("handle", &RS_ImageData::handle) - .def_readwrite("insertionPoint", &RS_ImageData::insertionPoint) - .def_readwrite("uVector", &RS_ImageData::uVector) - .def_readwrite("vVector", &RS_ImageData::vVector) - .def_readwrite("size", &RS_ImageData::size) - .def_readwrite("file", &RS_ImageData::file) - .def_readwrite("brightness", &RS_ImageData::brightness) - .def_readwrite("contrast", &RS_ImageData::contrast) - .def_readwrite("fade", &RS_ImageData::fade) - ; - - class_("LineData") - .def(init()) - .def_readwrite("startpoint", &RS_LineData::startpoint) - .def_readwrite("endpoint", &RS_LineData::endpoint) - ; - - class_("PointData", init()) - ; - - class_("PolylineData") - .def(init()) - ; - - /* Entities */ - - class_, std::auto_ptr >("Arc", init()) - .add_property("data", &RS_Arc::getData, &RS_Arc::setData) - .add_property("center", &RS_Arc::getCenter, &RS_Arc::setCenter) - .add_property("radius", &RS_Arc::getRadius, &RS_Arc::setRadius) - .add_property("angle1", &RS_Arc::getAngle1, &RS_Arc::setAngle1) - .add_property("angle2", &RS_Arc::getAngle2, &RS_Arc::setAngle2) - .add_property("direction1", &RS_Arc::getDirection1) - .add_property("direction2", &RS_Arc::getDirection2) - .add_property("reversed", &RS_Arc::isReversed, &RS_Arc::setReversed) - .add_property("middlepoint", &RS_Arc::getMiddlepoint) - .add_property("angleLength", &RS_Arc::getAngleLength) - .add_property("length", &RS_Arc::getLength) - .add_property("bulge", &RS_Arc::getBulge) - .def("createFrom3P", &RS_Arc::createFrom3P) - ; - - class_, std::auto_ptr >("Block", init()) - .add_property("name", &RS_Block::getName, &RS_Block::setName) - .add_property("basePoint", &RS_Block::getBasePoint) - .add_property("frozen", &RS_Block::isFrozen, &RS_Block::freeze) - .def("toggle", &RS_Block::toggle) - ; - - class_, std::auto_ptr >("Circle", init()) - .add_property("data", &RS_Circle::getData) - .add_property("center", &RS_Circle::getCenter, &RS_Circle::setCenter) - .add_property("radius", &RS_Circle::getRadius, &RS_Circle::setRadius) - .add_property("angleLength", &RS_Circle::getAngleLength) - .def("createFromCR", &RS_Circle::createFromCR) - .def("createFrom2P", &RS_Circle::createFrom2P) - .def("createFrom3P", &RS_Circle::createFrom3P) - ; - - class_, std::auto_ptr > - ("ConstructionLine", init()) - .add_property("data", &RS_ConstructionLine::getData) - .add_property("point1", &RS_ConstructionLine::getPoint1) - .add_property("point2", &RS_ConstructionLine::getPoint2) - ; - - class_, std::auto_ptr > - ("Ellipse", init()) - .add_property("data", &RS_Ellipse::getData) - .add_property("reversed", &RS_Ellipse::isReversed, &RS_Ellipse::setReversed) - .add_property("angle", &RS_Ellipse::getAngle) - .add_property("angle1", &RS_Ellipse::getAngle1, &RS_Ellipse::setAngle1) - .add_property("angle2", &RS_Ellipse::getAngle2, &RS_Ellipse::setAngle2) - .add_property("center", &RS_Ellipse::getCenter, &RS_Ellipse::setCenter) - .add_property("majorP", &RS_Ellipse::getMajorP, &RS_Ellipse::setMajorP) - .add_property("ratio", &RS_Ellipse::getRatio, &RS_Ellipse::setRatio) - .add_property("majorRadius", &RS_Ellipse::getMajorRadius) - .add_property("minorRadius", &RS_Ellipse::getMinorRadius) - ; - - class_, std::auto_ptr > - ("Image", init()) - .add_property("data", &RS_Image::getData) - .add_property("insertionPoint", &RS_Image::getInsertionPoint, &RS_Image::setInsertionPoint) - .add_property("file", &RS_Image::getFile, &RS_Image::setFile) - .add_property("uVector", &RS_Image::getUVector) - .add_property("vVector", &RS_Image::getVVector) - .add_property("width", &RS_Image::getWidth) - .add_property("height", &RS_Image::getHeight) - .add_property("brightness", &RS_Image::getBrightness) - .add_property("contrast", &RS_Image::getContrast) - .add_property("fade", &RS_Image::getFade) - .add_property("handle", &RS_Image::getHandle, &RS_Image::setHandle) - .add_property("imageWidth", &RS_Image::getImageWidth) - .add_property("imageHeight", &RS_Image::getImageHeight) - ; - - class_, std::auto_ptr > - ("Line", init()) - .add_property("data", &RS_Line::getData) - .add_property("startpoint", &RS_Line::getStartpoint, &RS_Line::setStartpoint) - .add_property("endpoint", &RS_Line::getEndpoint, &RS_Line::setEndpoint) - ; - - class_, std::auto_ptr > - ("Point", init()) - .add_property("pos", &RS_Point::getPos, &RS_Point::setPos) - ; - - class_, std::auto_ptr > - ("Polyline", init()) - .def(init()) - .add_property("startpoint", &RS_Polyline::getStartpoint, &RS_Polyline::setStartpoint) - .add_property("endpoint", &RS_Polyline::getEndpoint) - .add_property("closed", &RS_Polyline::isClosed) - .def("addVertex", &RS_Polyline::addVertex, return_value_policy()) - .def("createVertex", &RS_Polyline::createVertex, return_value_policy()) - .def("endPolyline", &RS_Polyline::endPolyline) - ; -} - -#endif diff --git a/src/base/python_wrappers.h b/src/base/python_wrappers.h deleted file mode 100644 index a07d00a..0000000 --- a/src/base/python_wrappers.h +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This function is automatically exported by the Boost::Python - * libraries. It adds the QCad scripting module to the environment - * - * OBSOLETE - */ -#ifdef RS_OPT_PYTHON -extern "C" void initqcad(); -#endif - diff --git a/src/base/script.cpp b/src/base/script.cpp index 5cb583a..13381f8 100644 --- a/src/base/script.cpp +++ b/src/base/script.cpp @@ -19,19 +19,19 @@ /** * Constructor. */ -RS_Script::RS_Script(const QString & name, const QString & /*path*/) +Script::Script(const QString & name, const QString & /*path*/) { this->name = name; } /** @return the name of this script. */ -QString RS_Script::getName() const +QString Script::getName() const { return name; } /** @return the full path and file name of this script. */ -QString RS_Script::getPath() const +QString Script::getPath() const { return path; } diff --git a/src/base/script.h b/src/base/script.h index 18a3bb6..ed9a3fc 100644 --- a/src/base/script.h +++ b/src/base/script.h @@ -3,6 +3,7 @@ #include +#warning "!!! THIS CLASS IS OBSOLETE !!!" /** * Class for representing a script. This is implemented as a QString * containing the script name. @@ -11,11 +12,11 @@ * * @author Andrew Mustun */ -class RS_Script +class Script { public: - RS_Script(const QString & name, const QString & path); - //RS_Script(const char* name); + Script(const QString & name, const QString & path); + //Script(const char* name); QString getName() const; QString getPath() const; diff --git a/src/base/scriptlist.cpp b/src/base/scriptlist.cpp index 4b6b007..4fc8d64 100644 --- a/src/base/scriptlist.cpp +++ b/src/base/scriptlist.cpp @@ -18,12 +18,12 @@ #include "system.h" -RS_ScriptList * RS_ScriptList::uniqueInstance = NULL; +ScriptList * ScriptList::uniqueInstance = NULL; /** * Default constructor. */ -RS_ScriptList::RS_ScriptList(): scriptIterator(scripts) +ScriptList::ScriptList(): scriptIterator(scripts) { //Should be dealt with... //#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" @@ -33,7 +33,7 @@ RS_ScriptList::RS_ScriptList(): scriptIterator(scripts) //activeScript = NULL; } -/*virtual*/ RS_ScriptList::~RS_ScriptList() +/*virtual*/ ScriptList::~ScriptList() { while (!scripts.isEmpty()) delete scripts.takeFirst(); @@ -42,51 +42,51 @@ RS_ScriptList::RS_ScriptList(): scriptIterator(scripts) /** * @return Instance to the unique script list. */ -/*static*/ RS_ScriptList * RS_ScriptList::instance() +/*static*/ ScriptList * ScriptList::instance() { if (uniqueInstance == NULL) - uniqueInstance = new RS_ScriptList(); + uniqueInstance = new ScriptList(); return uniqueInstance; } /** - * Initializes the script list by creating RS_Script + * Initializes the script list by creating Script * objects, one for each script that could be found. */ -void RS_ScriptList::init() +void ScriptList::init() { - RS_DEBUG->print("RS_ScriptList::initScripts"); + DEBUG->print("ScriptList::initScripts"); scripts.clear(); - QStringList list = RS_SYSTEM->getScriptList(); - RS_Script * script; + QStringList list = SYSTEM->getScriptList(); + Script * script; for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it) { - RS_DEBUG->print("script: %s:", (*it).toLatin1().data()); + DEBUG->print("script: %s:", (*it).toLatin1().data()); QFileInfo fi(*it); - script = new RS_Script(fi.baseName(), fi.absoluteFilePath()); + script = new Script(fi.baseName(), fi.absoluteFilePath()); scripts.append(script); - RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data()); - RS_DEBUG->print("path: %s", fi.absoluteFilePath().toLatin1().data()); + DEBUG->print("base: %s", fi.baseName().toLatin1().data()); + DEBUG->print("path: %s", fi.absoluteFilePath().toLatin1().data()); } - //RS_Script* f = new RS_Script("normal"); + //Script* f = new Script("normal"); //scripts.append(f); } /** * Removes all scripts in the scriptlist. */ -void RS_ScriptList::clearScripts() +void ScriptList::clearScripts() { scripts.clear(); } -int RS_ScriptList::countScripts() +int ScriptList::countScripts() { return scripts.count(); } @@ -96,9 +96,9 @@ int RS_ScriptList::countScripts() * Listeners are notified after the script was removed from * the list but before it gets deleted. */ -void RS_ScriptList::removeScript(RS_Script * script) +void ScriptList::removeScript(Script * script) { - RS_DEBUG->print("RS_ScriptList::removeScript()"); + DEBUG->print("ScriptList::removeScript()"); // here the script is removed from the list but not deleted // scripts.remove(script); @@ -109,7 +109,7 @@ void RS_ScriptList::removeScript(RS_Script * script) delete scripts.takeAt(i); //for (uint i=0; iscriptRemoved(script); //} @@ -127,20 +127,20 @@ void RS_ScriptList::removeScript(RS_Script * script) * \p NULL if no such script was found. The script will be loaded into * memory if it's not already. */ -RS_Script * RS_ScriptList::requestScript(const QString & name) +Script * ScriptList::requestScript(const QString & name) { - RS_DEBUG->print("RS_ScriptList::requestScript %s", name.toLatin1().data()); + DEBUG->print("ScriptList::requestScript %s", name.toLatin1().data()); QString name2 = name.toLower(); - RS_Script * foundScript = NULL; + Script * foundScript = NULL; - RS_DEBUG->print("name2: %s", name2.toLatin1().data()); + DEBUG->print("name2: %s", name2.toLatin1().data()); // Search our list of available scripts: -// for(RS_Script * s=scripts.first(); s!=NULL; s=scripts.next()) +// for(Script * s=scripts.first(); s!=NULL; s=scripts.next()) for(int i=0; igetName() == name2) { @@ -154,7 +154,7 @@ RS_Script * RS_ScriptList::requestScript(const QString & name) } //! @return First script of the list. -RS_Script * RS_ScriptList::firstScript() +Script * ScriptList::firstScript() { // return scripts.first(); scriptIterator.toFront(); @@ -164,7 +164,7 @@ RS_Script * RS_ScriptList::firstScript() /** @return Next script from the list after * calling firstScript() or nextScript(). */ -RS_Script * RS_ScriptList::nextScript() +Script * ScriptList::nextScript() { // return scripts.next(); return scriptIterator.next(); @@ -174,17 +174,17 @@ RS_Script * RS_ScriptList::nextScript() * @return Pointer to the script with the given name or * \p NULL if no such script was found. */ -//RS_Script* RS_ScriptList::loadScript(const QString& name) { +//Script* ScriptList::loadScript(const QString& name) { //} /** * Tests the script list and its ability to load scripts. */ -bool RS_ScriptList::test() +bool ScriptList::test() { - //RS_ScriptList* l = RS_ScriptList::instance(); + //ScriptList* l = ScriptList::instance(); - //std::cout << "RS_ScriptList: " << *l << std::endl; + //std::cout << "ScriptList: " << *l << std::endl; return true; } diff --git a/src/base/scriptlist.h b/src/base/scriptlist.h index 417d00a..c3331fd 100644 --- a/src/base/scriptlist.h +++ b/src/base/scriptlist.h @@ -4,42 +4,42 @@ #include #include "script.h" -#define RS_SCRIPTLIST RS_ScriptList::instance() +#define SCRIPTLIST ScriptList::instance() #warning "!!! THIS CLASS IS OBSOLETE !!!" /** * The global list of scripts. This is implemented as a singleton. - * Use RS_ScriptList::instance() to get a pointer to the object. + * Use ScriptList::instance() to get a pointer to the object. * * OBSOLETE * * @author Andrew Mustun */ -class RS_ScriptList +class ScriptList { protected: - RS_ScriptList(); + ScriptList(); public: - virtual ~RS_ScriptList(); + virtual ~ScriptList(); - static RS_ScriptList * instance(); + static ScriptList * instance(); void init(); void clearScripts(); int countScripts(); - virtual void removeScript(RS_Script * script); - RS_Script * requestScript(const QString & name); - RS_Script * firstScript(); - RS_Script * nextScript(); + virtual void removeScript(Script * script); + Script * requestScript(const QString & name); + Script * firstScript(); + Script * nextScript(); static bool test(); protected: - static RS_ScriptList * uniqueInstance; + static ScriptList * uniqueInstance; private: //! all scripts available - QList scripts; - QListIterator scriptIterator; + QList