From b9c25c84029cbfdc33f5c9d601d7db0a0f007f63 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 22 Sep 2016 15:29:10 +0200 Subject: [PATCH] fix -Wextra & -Wdeprecated in Drawing --- src/Mod/Drawing/App/DrawingExport.cpp | 4 +- src/Mod/Drawing/App/FeatureProjection.cpp | 1 - src/Mod/Drawing/App/FeatureView.cpp | 1 - src/Mod/Drawing/App/ProjectionAlgos.cpp | 2 +- src/Mod/Drawing/Gui/Command.cpp | 16 +++- src/Mod/Drawing/Gui/DrawingView.cpp | 95 +++++++++++------------ src/Mod/Drawing/Gui/TaskOrthoViews.cpp | 5 +- src/Mod/Drawing/Gui/ViewProviderPage.cpp | 1 + 8 files changed, 66 insertions(+), 59 deletions(-) diff --git a/src/Mod/Drawing/App/DrawingExport.cpp b/src/Mod/Drawing/App/DrawingExport.cpp index d0a2d7830..8ad64b502 100644 --- a/src/Mod/Drawing/App/DrawingExport.cpp +++ b/src/Mod/Drawing/App/DrawingExport.cpp @@ -569,7 +569,7 @@ void DXFOutput::printCircle(const BRepAdaptor_Curve& c, std::ostream& out) } } -void DXFOutput::printEllipse(const BRepAdaptor_Curve& c, int id, std::ostream& out) +void DXFOutput::printEllipse(const BRepAdaptor_Curve& c, int /*id*/, std::ostream& out) { gp_Elips ellp = c.Ellipse(); const gp_Pnt& p= ellp.Location(); @@ -713,7 +713,7 @@ void DXFOutput::printBSpline(const BRepAdaptor_Curve& c, int id, std::ostream& o } } -void DXFOutput::printGeneric(const BRepAdaptor_Curve& c, int id, std::ostream& out) +void DXFOutput::printGeneric(const BRepAdaptor_Curve& c, int /*id*/, std::ostream& out) { double uStart = c.FirstParameter(); gp_Pnt PS; diff --git a/src/Mod/Drawing/App/FeatureProjection.cpp b/src/Mod/Drawing/App/FeatureProjection.cpp index 78e9c9e53..542840014 100644 --- a/src/Mod/Drawing/App/FeatureProjection.cpp +++ b/src/Mod/Drawing/App/FeatureProjection.cpp @@ -31,7 +31,6 @@ #endif -#include #include #include #include diff --git a/src/Mod/Drawing/App/FeatureView.cpp b/src/Mod/Drawing/App/FeatureView.cpp index 7ba1879e0..45f3fa943 100644 --- a/src/Mod/Drawing/App/FeatureView.cpp +++ b/src/Mod/Drawing/App/FeatureView.cpp @@ -29,7 +29,6 @@ #endif -#include #include #include #include diff --git a/src/Mod/Drawing/App/ProjectionAlgos.cpp b/src/Mod/Drawing/App/ProjectionAlgos.cpp index 7fca3747f..f8335fc45 100644 --- a/src/Mod/Drawing/App/ProjectionAlgos.cpp +++ b/src/Mod/Drawing/App/ProjectionAlgos.cpp @@ -262,7 +262,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to /* dxf output section - Dan Falck 2011/09/25 */ -std::string ProjectionAlgos::getDXF(ExtractionType type, double scale, double tolerance) +std::string ProjectionAlgos::getDXF(ExtractionType type, double /*scale*/, double tolerance) { std::stringstream result; DXFOutput output; diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index c9b8a09a2..b263f5f03 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -64,9 +64,9 @@ CmdDrawingOpen::CmdDrawingOpen() sPixmap = "actions/document-new"; } - void CmdDrawingOpen::activated(int iMsg) { + Q_UNUSED(iMsg); // Reading an image QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString::null, QString::fromLatin1("%1 (*.svg *.svgz)").arg(QObject::tr("Scalable Vector Graphic"))); @@ -281,6 +281,7 @@ CmdDrawingNewA3Landscape::CmdDrawingNewA3Landscape() void CmdDrawingNewA3Landscape::activated(int iMsg) { + Q_UNUSED(iMsg); std::string FeatName = getUniqueObjectName("Page"); openCommand("Create page"); @@ -319,6 +320,7 @@ CmdDrawingNewView::CmdDrawingNewView() void CmdDrawingNewView::activated(int iMsg) { + Q_UNUSED(iMsg); std::vector shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId()); if (shapes.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -397,6 +399,7 @@ CmdDrawingOrthoViews::CmdDrawingOrthoViews() void CmdDrawingOrthoViews::activated(int iMsg) { + Q_UNUSED(iMsg); const std::vector shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId()); if (shapes.size() != 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -446,6 +449,7 @@ CmdDrawingOpenBrowserView::CmdDrawingOpenBrowserView() void CmdDrawingOpenBrowserView::activated(int iMsg) { + Q_UNUSED(iMsg); unsigned int n = getSelection().countObjectsOfType(Drawing::FeaturePage::getClassTypeId()); if (n != 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -483,7 +487,7 @@ CmdDrawingAnnotation::CmdDrawingAnnotation() void CmdDrawingAnnotation::activated(int iMsg) { - + Q_UNUSED(iMsg); std::vector pages = getSelection().getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); if (pages.empty()) { pages = this->getDocument()->getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); @@ -531,7 +535,7 @@ CmdDrawingClip::CmdDrawingClip() void CmdDrawingClip::activated(int iMsg) { - + Q_UNUSED(iMsg); std::vector pages = getSelection().getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); if (pages.empty()) { pages = this->getDocument()->getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); @@ -576,7 +580,7 @@ CmdDrawingSymbol::CmdDrawingSymbol() void CmdDrawingSymbol::activated(int iMsg) { - + Q_UNUSED(iMsg); std::vector pages = getSelection().getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); if (pages.empty()) { pages = this->getDocument()->getObjectsOfType(Drawing::FeaturePage::getClassTypeId()); @@ -632,6 +636,7 @@ CmdDrawingExportPage::CmdDrawingExportPage() void CmdDrawingExportPage::activated(int iMsg) { + Q_UNUSED(iMsg); unsigned int n = getSelection().countObjectsOfType(Drawing::FeaturePage::getClassTypeId()); if (n != 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -682,6 +687,7 @@ CmdDrawingProjectShape::CmdDrawingProjectShape() void CmdDrawingProjectShape::activated(int iMsg) { + Q_UNUSED(iMsg); Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog(); if (!dlg) { dlg = new DrawingGui::TaskProjection(); @@ -718,6 +724,7 @@ CmdDrawingDraftView::CmdDrawingDraftView() void CmdDrawingDraftView::activated(int iMsg) { + Q_UNUSED(iMsg); addModule(Gui,"Draft"); doCommand(Gui,"Gui.runCommand(\"Draft_Drawing\")"); } @@ -748,6 +755,7 @@ CmdDrawingSpreadsheetView::CmdDrawingSpreadsheetView() void CmdDrawingSpreadsheetView::activated(int iMsg) { + Q_UNUSED(iMsg); const std::vector spreads = getSelection().getObjectsOfType(Spreadsheet::Sheet::getClassTypeId()); if (spreads.size() != 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 6e657d8d2..381cd008c 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -50,7 +50,6 @@ # include # include # include -# include # include #endif @@ -381,7 +380,7 @@ void DrawingView::setRenderer(QAction *action) } } -bool DrawingView::onMsg(const char* pMsg, const char** ppReturn) +bool DrawingView::onMsg(const char* pMsg, const char** ) { if (strcmp("ViewFit",pMsg) == 0) { viewAll(); @@ -613,53 +612,53 @@ void DrawingView::print(QPrinter* printer) QPrinter::PageSize DrawingView::getPageSize(int w, int h) const { - static const float paperSizes[][2] = { - {210, 297}, // A4 - {176, 250}, // B5 - {215.9f, 279.4f}, // Letter - {215.9f, 355.6f}, // Legal - {190.5f, 254}, // Executive - {841, 1189}, // A0 - {594, 841}, // A1 - {420, 594}, // A2 - {297, 420}, // A3 - {148, 210}, // A5 - {105, 148}, // A6 - {74, 105}, // A7 - {52, 74}, // A8 - {37, 52}, // A8 - {1000, 1414}, // B0 - {707, 1000}, // B1 - {31, 44}, // B10 - {500, 707}, // B2 - {353, 500}, // B3 - {250, 353}, // B4 - {125, 176}, // B6 - {88, 125}, // B7 - {62, 88}, // B8 - {33, 62}, // B9 - {163, 229}, // C5E - {105, 241}, // US Common - {110, 220}, // DLE - {210, 330}, // Folio - {431.8f, 279.4f}, // Ledger - {279.4f, 431.8f} // Tabloid - }; - + static const float paperSizes[][2] = { + {210, 297}, // A4 + {176, 250}, // B5 + {215.9f, 279.4f}, // Letter + {215.9f, 355.6f}, // Legal + {190.5f, 254}, // Executive + {841, 1189}, // A0 + {594, 841}, // A1 + {420, 594}, // A2 + {297, 420}, // A3 + {148, 210}, // A5 + {105, 148}, // A6 + {74, 105}, // A7 + {52, 74}, // A8 + {37, 52}, // A8 + {1000, 1414}, // B0 + {707, 1000}, // B1 + {31, 44}, // B10 + {500, 707}, // B2 + {353, 500}, // B3 + {250, 353}, // B4 + {125, 176}, // B6 + {88, 125}, // B7 + {62, 88}, // B8 + {33, 62}, // B9 + {163, 229}, // C5E + {105, 241}, // US Common + {110, 220}, // DLE + {210, 330}, // Folio + {431.8f, 279.4f}, // Ledger + {279.4f, 431.8f} // Tabloid + }; + QPrinter::PageSize ps = QPrinter::Custom; - for (int i=0; i<30; i++) { - if (std::abs(paperSizes[i][0]-w) <= 1 && - std::abs(paperSizes[i][1]-h) <= 1) { - ps = static_cast(i); - break; - } - else - if (std::abs(paperSizes[i][0]-h) <= 1 && - std::abs(paperSizes[i][1]-w) <= 1) { - ps = static_cast(i); - break; - } - } + for (int i=0; i<30; i++) { + if (std::abs(paperSizes[i][0]-w) <= 1 && + std::abs(paperSizes[i][1]-h) <= 1) { + ps = static_cast(i); + break; + } + else + if (std::abs(paperSizes[i][0]-h) <= 1 && + std::abs(paperSizes[i][1]-w) <= 1) { + ps = static_cast(i); + break; + } + } return ps; } diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp index 7d895fc74..cda34471e 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp @@ -867,6 +867,7 @@ void OrthoViews::get_configs(float configs[5]) // get scale & posit TaskOrthoViews::TaskOrthoViews(QWidget *parent) : ui(new Ui_TaskOrthoViews) { + Q_UNUSED(parent); ui->setupUi(this); std::vector obj = Gui::Selection().getObjectsOfType(Part::Feature::getClassTypeId()); const char * part = obj.front()->getNameInDocument(); @@ -1074,7 +1075,7 @@ void TaskOrthoViews::projectionChanged(int index) set_configs(); } -void TaskOrthoViews::setPrimary(int dir) +void TaskOrthoViews::setPrimary(int /*dir*/) { int p_sel = ui->view_from->currentIndex(); // index for entry selected for 'view from' int r_sel = ui->axis_right->currentIndex(); // index for entry selected for 'rightwards axis' @@ -1229,7 +1230,7 @@ void TaskOrthoViews::setup_axo_tab() ui->axoScale->setText(QString::number(axo_scale)); } -void TaskOrthoViews::change_axo(int p) +void TaskOrthoViews::change_axo(int /*p*/) { int u_sel = ui->axoUp->currentIndex(); // index for entry selected for 'view from' int r_sel = ui->axoRight->currentIndex(); // index for entry selected for 'rightwards axis' diff --git a/src/Mod/Drawing/Gui/ViewProviderPage.cpp b/src/Mod/Drawing/Gui/ViewProviderPage.cpp index e9836f51c..3ee0535a7 100644 --- a/src/Mod/Drawing/Gui/ViewProviderPage.cpp +++ b/src/Mod/Drawing/Gui/ViewProviderPage.cpp @@ -154,6 +154,7 @@ void ViewProviderDrawingPage::setupContextMenu(QMenu* menu, QObject* receiver, c bool ViewProviderDrawingPage::setEdit(int ModNum) { + Q_UNUSED(ModNum); doubleClicked(); return false; }