Tidy up after bad merge

This commit is contained in:
Ian Rees 2016-05-28 22:03:30 +12:00 committed by wmayer
parent fb439b3d34
commit 268aa8b3ec
3 changed files with 14 additions and 14 deletions

View File

@ -79,19 +79,19 @@ using namespace std;
//TODO: code is duplicated in CommandCreateDims and CommandDecorate
TechDraw::DrawPage* _findPage(Gui::Command* cmd)
{
TechDraw::DrawPage* page = 0;
//check if a DrawPage is currently displayed
Gui::MainWindow* w = Gui::getMainWindow();
Gui::MDIView* mv = w->activeWindow();
MDIViewPage* mvp = dynamic_cast<MDIViewPage*>(mv);
auto mdiView( Gui::getMainWindow()->activeWindow() );
auto mvp( dynamic_cast<MDIViewPage *>(mdiView) );
if (mvp) {
QGVPage* qp = mvp->getQGVPage();
page = qp->getDrawPage();
return mvp->getQGVPage()->getDrawPage();
} else {
TechDraw::DrawPage* page(nullptr);
//DrawPage not displayed, check Selection and/or Document for a DrawPage
std::vector<App::DocumentObject*> selPages = cmd->getSelection().getObjectsOfType(TechDraw::DrawPage::getClassTypeId());
auto drawPageType( TechDraw::DrawPage::getClassTypeId() );
auto selPages( cmd->getSelection().getObjectsOfType(drawPageType) );
if (selPages.empty()) { //no page in selection
selPages = cmd->getDocument()->getObjectsOfType(TechDraw::DrawPage::getClassTypeId());
selPages = cmd->getDocument()->getObjectsOfType(drawPageType);
if (selPages.empty()) { //no page in document
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No page found"),
QObject::tr("Create a page first."));
@ -108,10 +108,11 @@ TechDraw::DrawPage* _findPage(Gui::Command* cmd)
QObject::tr("Select exactly 1 page."));
return page;
} else { //use only page in selection
page = dynamic_cast<TechDraw::DrawPage*>(selPages.front());
page = dynamic_cast<TechDraw::DrawPage *>(selPages.front());
}
return page;
}
return page;
}
bool isDrawingPageActive(Gui::Document *doc)

View File

@ -57,7 +57,6 @@
#include <Mod/TechDraw/App/DrawViewSymbol.h>
#include <Mod/TechDraw/App/DrawViewClip.h>
#include "ViewProviderPage.h"
#include "QGIDrawingTemplate.h"
#include "QGISVGTemplate.h"

View File

@ -25,6 +25,8 @@
#include <QGraphicsView>
#include "ViewProviderPage.h"
namespace TechDraw {
class DrawViewPart;
class DrawProjGroup;
@ -44,7 +46,6 @@ class QGIView;
class QGIViewDimension;
class QGITemplate;
class QGIHatch;
class ViewProviderPage;
class TechDrawGuiExport QGVPage : public QGraphicsView
{
@ -83,7 +84,7 @@ public:
void removeTemplate();
/// Getter for DrawPage feature
TechDraw::DrawPage * getDrawPage() { return pageFeat; }
TechDraw::DrawPage * getDrawPage() { return pageGui->getPageObject(); }
void toggleEdit(bool enable);
@ -112,7 +113,6 @@ private:
RendererType m_renderer;
bool drawBkg;
TechDraw::DrawPage *pageFeat;
QGraphicsRectItem *m_backgroundItem;
QGraphicsRectItem *m_outlineItem;
QBrush *bkgBrush;