1
/***************************************************************************
2
* Copyright (c) 2016 WandererFan <wandererfan@gmail.com> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
25
#include <App/DocumentObject.h>
27
#include "ViewProviderImage.h"
30
using namespace TechDrawGui;
32
PROPERTY_SOURCE(TechDrawGui::ViewProviderImage, TechDrawGui::ViewProviderDrawingView)
34
//**************************************************************************
35
// Construction/Destruction
37
ViewProviderImage::ViewProviderImage()
39
sPixmap = "actions/TechDraw_Image";
41
ADD_PROPERTY_TYPE(Crop ,(false), "Image", App::Prop_None, "Crop image to Width x Height");
44
ViewProviderImage::~ViewProviderImage()
48
void ViewProviderImage::updateData(const App::Property* prop)
50
if (prop == &(getViewObject()->Width) ||
51
prop == &(getViewObject()->Height) ||
52
prop == &(getViewObject()->Scale) ) {
53
QGIView* qgiv = getQView();
55
qgiv->QGIView::updateView(true);
59
ViewProviderDrawingView::updateData(prop);
62
void ViewProviderImage::onChanged(const App::Property *prop)
64
App::DocumentObject* obj = getObject();
65
if (!obj || obj->isRestoring()) {
66
Gui::ViewProviderDocumentObject::onChanged(prop);
71
QGIView* qgiv = getQView();
73
qgiv->updateView(true);
77
Gui::ViewProviderDocumentObject::onChanged(prop);
81
TechDraw::DrawViewImage* ViewProviderImage::getViewObject() const
83
return dynamic_cast<TechDraw::DrawViewImage*>(pcObject);