~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Mod/Drawing/Gui/ViewProviderPage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2010-01-11 08:48:33 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100111084833-4g9vgdqbkw8u34zb
Tags: 0.9.2646.5-1
* New upstream version (closes: #561696).
* Added swig to Build-Depends (closes: #563523, #563772).
* Removed python-opencv from Build-Depends and Recommends (closes: #560768).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "PreCompiled.h"
25
25
 
26
26
#ifndef _PreComp_
27
 
 
 
27
# ifdef FC_OS_WIN32
 
28
#  include <windows.h>
 
29
# endif
28
30
#endif
29
31
 
30
32
/// Here the FreeCAD includes sorted by Base,App,Gui......
38
40
#include <App/Feature.h>
39
41
#include <Gui/SoFCSelection.h>
40
42
#include <Gui/Selection.h>
 
43
#include <Gui/MainWindow.h>
 
44
#include <Gui/BitmapFactory.h>
 
45
#include <Gui/ViewProviderDocumentObjectGroup.h>
41
46
 
42
47
 
43
48
#include "ViewProviderPage.h"
44
 
 
45
 
//#include <Mod/Drawing/App/DrawingFeature.h>
46
 
 
47
 
 
48
 
//#include "Tree.h"
49
 
 
50
 
 
 
49
#include <Mod/Drawing/App/FeaturePage.h>
51
50
 
52
51
using namespace DrawingGui;
53
52
 
54
 
PROPERTY_SOURCE(DrawingGui::ViewProviderDrawingPage, Gui::ViewProviderDocumentObject)
 
53
PROPERTY_SOURCE(DrawingGui::ViewProviderDrawingPage, Gui::ViewProviderDocumentObjectGroup)
55
54
 
56
55
 
57
56
//**************************************************************************
58
57
// Construction/Destruction
59
58
 
60
 
       
61
59
ViewProviderDrawingPage::ViewProviderDrawingPage()
 
60
  : view(0)
62
61
{
63
 
 
64
 
 
65
 
  sPixmap = "Page";
66
 
 
 
62
    sPixmap = "Page";
67
63
}
68
64
 
69
65
ViewProviderDrawingPage::~ViewProviderDrawingPage()
70
66
{
71
67
}
72
68
 
73
 
 
74
69
void ViewProviderDrawingPage::attach(App::DocumentObject *pcFeat)
75
70
{
76
 
  // call parent attach method
77
 
  ViewProviderDocumentObject::attach(pcFeat);
78
 
 
79
 
 
 
71
    // call parent attach method
 
72
    ViewProviderDocumentObject::attach(pcFeat);
80
73
}
81
74
 
82
75
void ViewProviderDrawingPage::setDisplayMode(const char* ModeName)
83
76
{
84
 
 
85
 
  ViewProviderDocumentObject::setDisplayMode( ModeName );
 
77
    ViewProviderDocumentObject::setDisplayMode( ModeName );
86
78
}
87
79
 
88
80
std::vector<std::string> ViewProviderDrawingPage::getDisplayModes(void) const
89
81
{
90
 
  // get the modes of the father
91
 
  std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
92
 
 
93
 
 
94
 
  return StrList;
95
 
}
96
 
 
97
 
void ViewProviderDrawingPage::updateData(const App::Property*)
98
 
{
99
 
 
100
 
 
101
 
}
102
 
 
103
 
 
 
82
    // get the modes of the father
 
83
    std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
 
84
 
 
85
    return StrList;
 
86
}
 
87
 
 
88
void ViewProviderDrawingPage::updateData(const App::Property* prop)
 
89
{
 
90
    Gui::ViewProviderDocumentObjectGroup::updateData(prop);
 
91
    if (prop->getTypeId() == App::PropertyFileIncluded::getClassTypeId()) {
 
92
        if (std::string(getPageObject()->PageResult.getValue()) != ""){
 
93
            if (!view){
 
94
                view = new DrawingView(Gui::getMainWindow());
 
95
                view->load(QString::fromUtf8(getPageObject()->PageResult.getValue()));
 
96
                view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
 
97
                view->setWindowTitle(QObject::tr("Drawing viewer"));
 
98
                view->resize(400, 300);
 
99
                view->oneToOneDrawing();
 
100
                Gui::getMainWindow()->addWindow(view);
 
101
            }
 
102
            else {
 
103
                try{
 
104
                    view->load(QString::fromUtf8(getPageObject()->PageResult.getValue()));
 
105
                }catch(...){}// dirty hack for the moment....
 
106
            }
 
107
        }
 
108
    }
 
109
}
 
110
 
 
111
bool ViewProviderDrawingPage::doubleClicked(void)
 
112
{
 
113
 /*   view = new DrawingView(Gui::getMainWindow());
 
114
    view->load(QString::fromUtf8(getPageObject()->PageResult.getValue()));
 
115
    view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
 
116
    view->setWindowTitle(QObject::tr("Drawing viewer"));
 
117
    view->resize( 400, 300 );
 
118
    Gui::getMainWindow()->addWindow(view);
 
119
 
 
120
    return true;*/
 
121
    return false;
 
122
}
 
123
 
 
124
Drawing::FeaturePage* ViewProviderDrawingPage::getPageObject(void)
 
125
{
 
126
    return dynamic_cast<Drawing::FeaturePage*>(pcObject);
 
127
}