Gui::Document Class Reference

The Gui Document This is the document on GUI level. More...

#include <Document.h>

Inheritance diagram for Gui::Document:
Base::Persistence Base::BaseClass

List of all members.

Public Member Functions

bool canClose ()
 handels the application close event
 Document (App::Document *pcDocument, Application *app)
App::DocumentgetDocument (void) const
 Getter for the App Document.
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object.
bool isLastView (void)
bool isModified () const
void setModified (bool)
 Observer message from the App doc.
 ~Document ()
methods for the UNDO REDO handling



void abortCommand (void)
 Abort the Undo transaction on the document.
void commitCommand (void)
 Commit the Undo transaction on the document.
std::vector< std::string > getRedoVector (void) const
 Get an Redo string vector with the Redo names.
std::vector< std::string > getUndoVector (void) const
 Get an Undo string vector with the Undo names.
void openCommand (const char *sName=0)
 Open a new Undo transaction on the document.
void redo (int iSteps)
 Will REDO one or more steps.
void undo (int iSteps)
 Will UNDO one or more steps.
methods for View handling



void attachView (Gui::BaseView *pcView, bool bPassiv=false)
 Attach a view (get called by the MDIView constructor).
void createView (const char *sType)
 Creat a new view.
void detachView (Gui::BaseView *pcView, bool bPassiv=false)
 Detach a view (get called by the MDIView destructor).
Gui::MDIViewgetActiveView (void) const
 Getter for the active view.
std::list< MDIView * > getMDIViews () const
 returns a list of all attached MDI views
void onRelabel (void)
 call relabel to all attached views
void onUpdate (void)
 call update on all attached views
bool sendMsgToViews (const char *pMsg)
 send messages to the active view Send a specific massage to the active view and is able to recive a return massage
View provider handling



ViewProvidergetAnnotationViewProvider (const char *name) const
 get an annotation view provider
ViewProvidergetInEdit (void) const
 get the in edit ViewProvider or NULL
ViewProvidergetViewProvider (const App::DocumentObject *) const
 Get the view provider for that object.
ViewProvidergetViewProviderByName (const char *name) const
std::vector< ViewProvider * > getViewProvidersOfType (const Base::Type &typeId) const
bool isShow (const char *name)
 test if the feature is in show
void removeAnnotationViewProvider (const char *name)
 remove an annotation view provider
void resetEdit (void)
 reset from edit mode
void setAnnotationViewProvider (const char *name, ViewProvider *pcProvider)
 set an annotation view provider
bool setEdit (Gui::ViewProvider *p, int ModNum=0)
 set the ViewProvider in special edit mode
void setHide (const char *name)
 set the feature in Noshow
void setPos (const char *name, const Base::Matrix4D &rclMtrx)
 set the feature transformation (only viewing)
void setShow (const char *name)
 put the feature in show

Public Attributes

Signals of the document



boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalActivatedObject
 signal on activated Object
boost::signal< void(const
Gui::ViewProviderDocumentObject
&, const App::Property &)> 
signalChangedObject
 signal on changed Object, the 2nd argument is the changed property of the referenced document object, not of the view provider
boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalDeletedObject
 signal on deleted Object
boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalInEdit
 signal on goes in edti mode
boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalNewObject
 signal on new Object
boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalRenamedObject
 signal on renamed Object
boost::signal< void(const
Gui::ViewProviderDocumentObject &)> 
signalResetEdit
 signal on leave edit mode

Protected Attributes

Gui::DocumentPy_pcDocPy

I/O of the document



void exportObjects (const std::vector< App::DocumentObject * > &, Base::Writer &)
unsigned int getMemSize (void) const
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
void importObjects (const std::vector< App::DocumentObject * > &, Base::Reader &)
virtual void Restore (Base::XMLReader &reader)
 This method is used to restore properties from an XML document.
virtual void RestoreDocFile (Base::Reader &reader)
 This method is used to restore large amounts of data from a binary file.
virtual void Save (Base::Writer &writer) const
 This method is used to save properties or very small amounts of data to an XML document.
bool save (void)
 Save the document.
bool saveAs (void)
 Save the document under a new file name.
virtual void SaveDocFile (Base::Writer &writer) const
 This method is used to save large amounts of data to a binary file.
void slotActivatedObject (const App::DocumentObject &)
void slotChangedObject (const App::DocumentObject &, const App::Property &)
void slotDeletedObject (const App::DocumentObject &)
void slotNewObject (const App::DocumentObject &)
 This slot is connected to the App::Document::signalNewObject(...).
void slotRenamedObject (const App::DocumentObject &)
void slotRestoredDocument (const App::Document &)

Detailed Description

The Gui Document This is the document on GUI level.

Its main responsibility is keeping track off open windows for a document and warning on unsaved closes. All handled views on the document must inherit from MDIView

See also:
App::Document
MDIView
Author:
Jürgen Riegel

Definition at line 56 of file Gui/Document.h.


Constructor & Destructor Documentation

Document::Document ( App::Document pcDocument,
Application app 
)
Document::~Document (  ) 

Member Function Documentation

void Document::abortCommand ( void   ) 

Abort the Undo transaction on the document.

Definition at line 1038 of file Gui/Document.cpp.

References App::Document::abortTransaction(), and getDocument().

Referenced by Gui::Command::abortCommand().

void Document::attachView ( Gui::BaseView pcView,
bool  bPassiv = false 
)

Attach a view (get called by the MDIView constructor).

Definition at line 834 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews, and Gui::DocumentP::passiveViews.

Referenced by Gui::BaseView::BaseView(), and Gui::BaseView::setDocument().

bool Document::canClose ( void   ) 

handels the application close event

This method checks if the document can be closed.

It checks on the save state of the document and is able to abort the closing.

Definition at line 915 of file Gui/Document.cpp.

References Gui::ControlSingleton::activeDialog(), Gui::Control(), getActiveView(), getDocument(), isModified(), save(), and Gui::ControlSingleton::showDialog().

void Document::commitCommand ( void   ) 
void Document::createView ( const char *  sType  ) 
void Document::detachView ( Gui::BaseView pcView,
bool  bPassiv = false 
)
void Document::exportObjects ( const std::vector< App::DocumentObject * > &  obj,
Base::Writer writer 
)
MDIView * Document::getActiveView ( void   )  const

Getter for the active view.

Definition at line 992 of file Gui/Document.cpp.

References Gui::MainWindow::activeWindow(), Gui::getMainWindow(), and getMDIViews().

Referenced by DrawingGui::TaskProjection::accept(), StdCmdMeasureDistance::activated(), StdCmdViewCreate::activated(), CmdPointsPolyCut::activated(), CmdShapeInfo::activated(), CmdMeshFillInteractiveHole::activated(), CmdMeshRemoveCompByHand::activated(), CmdMeshEvaluateFacet::activated(), CmdMeshPolySplit::activated(), CmdMeshPolyCut::activated(), CmdMeshAddFacet::activated(), CmdMeshPolySelect::activated(), CmdMeshPolySegm::activated(), CmdMeshVertexCurvatureInfo::activated(), CmdInspectElement::activated(), Gui::DocumentPy::activeView(), Gui::SelectionSingleton::addSelection(), Gui::Command::adjustCameraPosition(), canClose(), PartGui::CrossSections::CrossSections(), Gui::ViewProviderDocumentObject::getActiveView(), Gui::DocumentPy::getActiveView(), getInEdit(), Gui::Command::isViewOfType(), Gui::TreeView::mouseDoubleClickEvent(), Gui::TreeWidget::mouseDoubleClickEvent(), MeshGui::DlgEvaluateMeshImp::on_refreshButton_clicked(), CamGui::Cutting::on_SelectFace_button_clicked(), CamGui::Cutting::on_toolpath_calculation_highest_level_button_clicked(), CamGui::Cutting::on_toolpath_calculation_lowest_level_button_clicked(), CamGui::Cutting::on_toolpath_calculation_middle_level_button_clicked(), Gui::TreeWidget::onActivateDocument(), Gui::SelectionSingleton::rmvPreselect(), setEdit(), Gui::SelectionSingleton::setPreselect(), and Gui::ViewProviderDocumentObjectGroup::updateData().

ViewProvider * Document::getAnnotationViewProvider ( const char *  name  )  const

get an annotation view provider

Definition at line 247 of file Gui/Document.cpp.

References Gui::DocumentP::_ViewProviderMapAnnotation.

Referenced by Gui::View3DInventorPy::removeAnnotation().

App::Document * Document::getDocument ( void   )  const

Getter for the App Document.

Definition at line 482 of file Gui/Document.cpp.

References Gui::DocumentP::_pcDocument.

Referenced by abortCommand(), InspectionGui::VisualInspection::accept(), PartGui::LoftWidget::accept(), StdCmdHideObjects::activated(), StdCmdShowObjects::activated(), StdCmdToggleObjects::activated(), StdCmdExport::activated(), StdCmdImport::activated(), CmdRaytracingWriteView::activated(), Gui::DocumentPy::activeObject(), canClose(), commitCommand(), createView(), Gui::PointMarker::customEvent(), Gui::DocumentIndex::data(), Gui::DocumentPy::getActiveObject(), Gui::BaseView::getAppDocument(), Gui::DocumentPy::getDocument(), Gui::Command::getDocument(), getRedoVector(), getUndoVector(), Gui::Command::getUniqueObjectName(), getViewProviderByName(), Gui::Command::isActiveObjectValid(), MeshGui::DlgEvaluateMeshImp::on_refreshButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairAllTogether_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDegeneratedButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDuplicatedFacesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDuplicatedPointsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairFoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairIndicesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairNonmanifoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairOrientationButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairSelfIntersectionButton_clicked(), Gui::TreeWidget::onCreateGroup(), Gui::TreeWidget::onFinishEditing(), Gui::Application::onLastWindowClosed(), Gui::MDIView::onRelabel(), Gui::View3DInventor::onRename(), openCommand(), redo(), saveAs(), Gui::DocumentItem::selectItems(), Gui::Application::setActiveDocument(), Gui::DocumentItem::setData(), Gui::DocumentPy::setEdit(), Gui::ViewProviderPythonFeatureObserver::slotDeleteDocument(), undo(), and Gui::DocumentItem::updateSelection().

ViewProvider * Document::getInEdit ( void   )  const
std::list< MDIView * > Document::getMDIViews (  )  const

returns a list of all attached MDI views

Definition at line 957 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews.

Referenced by getActiveView(), Save(), and setModified().

unsigned int Document::getMemSize ( void   )  const [virtual]

This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?

Implements Base::Persistence.

Definition at line 556 of file Gui/Document.cpp.

References Gui::DocumentP::_ViewProviderMap.

PyObject * Document::getPyObject ( void   )  [virtual]

This method returns the Python wrapper for a C++ object.

It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.

The default implementation returns 'None'.

Reimplemented from Base::BaseClass.

Definition at line 1071 of file Gui/Document.cpp.

References _pcDocPy, and Base::PyObjectBase::IncRef().

Referenced by Gui::Application::sActiveDocument(), and Gui::Application::sGetDocument().

std::vector< std::string > Document::getRedoVector ( void   )  const

Get an Redo string vector with the Redo names.

Get a string vector with the 'Redo' actions.

Definition at line 1050 of file Gui/Document.cpp.

References App::Document::getAvailableRedoNames(), and getDocument().

Referenced by Gui::Dialog::RedoDialog::onFetchInfo().

std::vector< std::string > Document::getUndoVector ( void   )  const

Get an Undo string vector with the Undo names.

Get a string vector with the 'Undo' actions.

Definition at line 1044 of file Gui/Document.cpp.

References App::Document::getAvailableUndoNames(), and getDocument().

Referenced by Gui::Dialog::UndoDialog::onFetchInfo().

ViewProvider * Document::getViewProvider ( const App::DocumentObject Feat  )  const
ViewProvider * Document::getViewProviderByName ( const char *  name  )  const
std::vector< ViewProvider * > Document::getViewProvidersOfType ( const Base::Type typeId  )  const
void Document::importObjects ( const std::vector< App::DocumentObject * > &  obj,
Base::Reader reader 
)
bool Document::isLastView ( void   ) 

Definition at line 904 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews.

Referenced by Gui::MDIView::closeEvent().

bool Document::isModified (  )  const

Definition at line 477 of file Gui/Document.cpp.

References Gui::DocumentP::_isModified.

Referenced by canClose(), and Gui::Application::open().

bool Document::isShow ( const char *  name  ) 

test if the feature is in show

Definition at line 311 of file Gui/Document.cpp.

References getViewProviderByName(), and Gui::ViewProvider::isShow().

Referenced by StdCmdToggleObjects::activated(), and StdCmdToggleVisibility::activated().

void Document::onRelabel ( void   ) 

call relabel to all attached views

Definition at line 887 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews, Base::Console(), and Gui::DocumentP::passiveViews.

void Document::onUpdate ( void   ) 

call update on all attached views

Definition at line 870 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews, Base::Console(), and Gui::DocumentP::passiveViews.

Referenced by Gui::DocumentPy::update(), and Gui::Application::updateActive().

void Document::openCommand ( const char *  sName = 0  ) 

Open a new Undo transaction on the document.

Open a new Undo transaction on the active document This method opens a new UNDO transaction on the active document.

This transaction will later appear in the UNDO/REDO dialog with the name of the command. If the user recall the transaction everything changed on the document between OpenCommand() and CommitCommand will be undone (or redone). You can use an alternetive name for the operation default is the command name.

See also:
CommitCommand(),AbortCommand()

Definition at line 1028 of file Gui/Document.cpp.

References getDocument(), and App::Document::openTransaction().

Referenced by InspectionGui::VisualInspection::accept(), PartGui::LoftWidget::accept(), Gui::Dialog::TransformStrategy::commitTransform(), MeshGui::RemoveComponents::deleteSelection(), Gui::TreeWidget::dropEvent(), MeshGui::DlgEvaluateMeshImp::on_repairAllTogether_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDegeneratedButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDuplicatedFacesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairDuplicatedPointsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairFoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairIndicesButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairNonmanifoldsButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairOrientationButton_clicked(), MeshGui::DlgEvaluateMeshImp::on_repairSelfIntersectionButton_clicked(), Gui::TreeWidget::onCreateGroup(), and Gui::Command::openCommand().

void Document::redo ( int  iSteps  ) 

Will REDO one or more steps.

Definition at line 1064 of file Gui/Document.cpp.

References getDocument(), and App::Document::redo().

Referenced by Gui::View3DInventor::onMsg().

void Document::removeAnnotationViewProvider ( const char *  name  ) 
void Document::resetEdit ( void   ) 
void Document::Restore ( Base::XMLReader reader  )  [virtual]

This method is used to restore properties from an XML document.

Loads a separate XML file from the projects file with information about the view providers.

Implements Base::Persistence.

Definition at line 596 of file Gui/Document.cpp.

References Gui::DocumentP::_ViewProviderMap, and Base::XMLReader::addFile().

Referenced by Document().

void Document::RestoreDocFile ( Base::Reader reader  )  [virtual]
void Document::Save ( Base::Writer writer  )  const [virtual]

This method is used to save properties or very small amounts of data to an XML document.

Adds a separate XML file to the projects file that contains information about the view providers.

Implements Base::Persistence.

Definition at line 570 of file Gui/Document.cpp.

References Gui::DocumentP::_pcDocument, Base::Writer::addFile(), App::Document::FileName, App::GetApplication(), Gui::View3DInventor::getClassTypeId(), getMDIViews(), Base::Writer::isForceXML(), Gui::Thumbnail::Save(), Gui::Thumbnail::setFileName(), Gui::Thumbnail::setSize(), Gui::Thumbnail::setViewer(), and Gui::DocumentP::thumb.

Referenced by Document().

bool Document::save ( void   ) 
bool Document::saveAs ( void   ) 
void Document::SaveDocFile ( Base::Writer writer  )  const [virtual]
bool Document::sendMsgToViews ( const char *  pMsg  ) 

send messages to the active view Send a specific massage to the active view and is able to recive a return massage

send messages to the active view

send Messages to all views

Definition at line 971 of file Gui/Document.cpp.

References Gui::DocumentP::baseViews, and Gui::DocumentP::passiveViews.

void Document::setAnnotationViewProvider ( const char *  name,
ViewProvider pcProvider 
)
bool Document::setEdit ( Gui::ViewProvider p,
int  ModNum = 0 
)
void Document::setHide ( const char *  name  ) 
void Document::setModified ( bool  b  ) 
void Document::setPos ( const char *  name,
const Base::Matrix4D rclMtrx 
)

set the feature transformation (only viewing)

set the feature in Noshow

Definition at line 338 of file Gui/Document.cpp.

References getViewProviderByName(), and Gui::ViewProvider::setTransformation().

Referenced by Gui::DocumentPy::setPos().

void Document::setShow ( const char *  name  ) 
void Document::slotActivatedObject ( const App::DocumentObject Obj  )  [protected]
void Document::slotChangedObject ( const App::DocumentObject Obj,
const App::Property Prop 
) [protected]
void Document::slotDeletedObject ( const App::DocumentObject Obj  )  [protected]
void Document::slotNewObject ( const App::DocumentObject Obj  )  [protected]
void Document::slotRenamedObject ( const App::DocumentObject Obj  )  [protected]
void Document::slotRestoredDocument ( const App::Document  )  [protected]

Definition at line 660 of file Gui/Document.cpp.

References Gui::DocumentP::_ViewProviderMap.

Referenced by Document().

void Document::undo ( int  iSteps  ) 

Will UNDO one or more steps.

Definition at line 1056 of file Gui/Document.cpp.

References getDocument(), and App::Document::undo().

Referenced by Gui::View3DInventor::onMsg().


Member Data Documentation

Definition at line 199 of file Gui/Document.h.

Referenced by Document(), getPyObject(), and ~Document().

signal on activated Object

Definition at line 88 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and slotActivatedObject().

signal on changed Object, the 2nd argument is the changed property of the referenced document object, not of the view provider

Definition at line 84 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and slotChangedObject().

signal on deleted Object

Definition at line 80 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and slotDeletedObject().

boost::signal<void (const Gui::ViewProviderDocumentObject&)> Gui::Document::signalInEdit [mutable]

signal on goes in edti mode

Definition at line 90 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and setEdit().

boost::signal<void (const Gui::ViewProviderDocumentObject&)> Gui::Document::signalNewObject [mutable]

signal on new Object

Definition at line 78 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and slotNewObject().

signal on renamed Object

Definition at line 86 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and slotRenamedObject().

boost::signal<void (const Gui::ViewProviderDocumentObject&)> Gui::Document::signalResetEdit [mutable]

signal on leave edit mode

Definition at line 92 of file Gui/Document.h.

Referenced by Gui::DocumentItem::DocumentItem(), and resetEdit().


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:01:59 2011 for FreeCAD by  doxygen 1.6.1