diff --git a/src/Gui/Document.h b/src/Gui/Document.h index b79cba96b..b8c6de358 100644 --- a/src/Gui/Document.h +++ b/src/Gui/Document.h @@ -51,12 +51,13 @@ class ViewProvider; class ViewProviderDocumentObject; class Application; class DocumentPy; +enum HighlightMode; /** 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 App::Document + * @see App::Document * @see MDIView * @author Jürgen Riegel */ @@ -141,7 +142,7 @@ public: void setModified(bool); bool isModified() const; - /// Getter for the App Document + /// Getter for the App Document App::Document* getDocument(void) const; /** @name methods for View handling */ @@ -152,7 +153,7 @@ public: Gui::MDIView* getViewOfViewProvider(Gui::ViewProvider*) const; /// Create a new view void createView(const Base::Type& typeId); - /** send messages to the active view + /** send messages to the active view * Send a specific massage to the active view and is able to recive a * return massage */ diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index a17e8fce1..47ebbd742 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -113,7 +113,7 @@ TreeWidget::TreeWidget(QWidget* parent) this->statusTimer = new QTimer(this); - connect(this->statusTimer, SIGNAL(timeout()), + connect(this->statusTimer, SIGNAL(timeout()), this, SLOT(onTestStatus())); connect(this, SIGNAL(itemEntered(QTreeWidgetItem*, int)), this, SLOT(onItemEntered(QTreeWidgetItem*))); @@ -506,7 +506,7 @@ void TreeWidget::dropEvent(QDropEvent *event) // one of the source items is also the destination item, that's not allowed if (this->isItemSelected(targetitem)) return; - + // filter out the selected items we cannot handle QList items; QList idxs = selectedIndexes(); @@ -640,7 +640,7 @@ void TreeWidget::slotActiveDocument(const Gui::Document& Doc) void TreeWidget::markItem(const App::DocumentObject* Obj,bool mark) { - // never call without Object! + // never call without Object! assert(Obj); Gui::Document* Doc = Gui::Application::Instance->getDocument(Obj->getDocument()); @@ -819,7 +819,7 @@ void TreeWidget::setItemsSelected (const QList items, bool se QItemSelection range; for (QList::const_iterator it = items.begin(); it != items.end(); ++it) range.select(this->indexFromItem(*it),this->indexFromItem(*it)); - selectionModel()->select(range, select ? + selectionModel()->select(range, select ? QItemSelectionModel::Select : QItemSelectionModel::Deselect); } @@ -836,7 +836,7 @@ TreeDockWidget::TreeDockWidget(Gui::Document* pcDocument,QWidget *parent) ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView"); this->treeWidget->setIndentation(hGrp->GetInt("Indentation", this->treeWidget->indentation())); - QGridLayout* pLayout = new QGridLayout(this); + QGridLayout* pLayout = new QGridLayout(this); pLayout->setSpacing(0); pLayout->setMargin (0); pLayout->addWidget(this->treeWidget, 0, 0 ); @@ -882,7 +882,7 @@ void DocumentItem::slotInEdit(const Gui::ViewProviderDocumentObject& v) { std::string name (v.getObject()->getNameInDocument()); std::map::iterator it = ObjectMap.find(name); - if (it != ObjectMap.end()) + if (it != ObjectMap.end()) it->second->setBackgroundColor(0,Qt::yellow); } @@ -1090,7 +1090,7 @@ const Gui::Document* DocumentItem::document() const void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark) { - // never call without Object! + // never call without Object! assert(Obj); @@ -1105,7 +1105,7 @@ void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark) //void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark) //{ -// // never call without Object! +// // never call without Object! // assert(Obj); // // @@ -1299,7 +1299,7 @@ void DocumentObjectItem::testStatus() App::DocumentObject* pObject = viewObject->getObject(); // if status has changed then continue - int currentStatus = + int currentStatus = ((pObject->isError() ? 1 : 0) << 2) | ((pObject->mustExecute() == 1 ? 1 : 0) << 1) | (viewObject->isShow() ? 1 : 0); diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index 8ed57c67e..0b39b9a42 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -44,7 +44,7 @@ enum HighlightMode { Underlined, Italic , Overlined , Bold , - Blue + Blue }; /// highlight modes for the tree items @@ -131,7 +131,7 @@ private: }; /** The link between the tree and a document. - * Every document in the application gets its associated DocumentItem which controls + * Every document in the application gets its associated DocumentItem which controls * the visibility and the functions of the document. * \author Jürgen Riegel */ @@ -186,7 +186,7 @@ private: }; /** The link between the tree and a document object. - * Every object in the document gets its associated DocumentObjectItem which controls + * Every object in the document gets its associated DocumentObjectItem which controls * the visibility and the functions of the object. * @author Werner Mayer */ diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index b4c54ec1e..d7eee8216 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -60,7 +60,7 @@ using namespace Gui; PROPERTY_SOURCE_ABSTRACT(Gui::ViewProvider, App::PropertyContainer) -ViewProvider::ViewProvider() +ViewProvider::ViewProvider() : pcAnnotation(0) , pyViewObject(0) , _iActualMode(-1) @@ -144,6 +144,12 @@ void ViewProvider::setUpdatesEnabled (bool enable) _updateData = enable; } +void highlight(const HighlightMode& high) +{ + + +} + void ViewProvider::eventCallback(void * ud, SoEventCallback * node) { const SoEvent * ev = node->getEvent(); diff --git a/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp b/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp index 7ca515bfc..ef5fda285 100644 --- a/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp +++ b/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp @@ -30,29 +30,39 @@ #include #include +#include +#include +#include #include // pointer to the active assembly object -Assembly::Item *ActiveAsmObject =0; +Assembly::Item *ActiveAsmObject =0; +Gui::Document *ActiveGuiDoc =0; +Gui::ViewProviderDocumentObject *ActiveVp =0; + /* module functions */ static PyObject * setActiveAssembly(PyObject *self, PyObject *args) { - PyObject *object; - if (PyArg_ParseTuple(args,"O!",&(Assembly::ItemPy::Type), &object)) { + PyObject *object=0; + if (PyArg_ParseTuple(args,"|O",&(Assembly::ItemPy::Type), &object)) { Assembly::Item* Item = static_cast(object)->getItemPtr(); // Should be set! assert(Item); + // get the gui document of the Assembly Item + Gui::Document* GuiDoc = Gui::Application::Instance->getDocument(Item->getDocument()); + Gui::ViewProviderDocumentObject* vp = dynamic_cast (GuiDoc->getViewProvider(Item)) ; if(ActiveAsmObject){ - + + GuiDoc->signalHighlightObject(*vp,Gui::HiglightMode::None); ActiveAsmObject = 0; } ActiveAsmObject = Item; - Gui::ViewProvider* vp = Gui::Application::Instance -> getViewProvider(ActiveAsmObject); + //Gui::ViewProvider* vp = Gui::Application::Instance -> getViewProvider(ActiveAsmObject); //PyErr_SetString(PyExc_Exception, "empty shape"); } diff --git a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp index 73eeefac9..13a2794bb 100644 --- a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp +++ b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp @@ -27,8 +27,8 @@ #endif #include "ViewProviderAssembly.h" -//#include -//#include +#include +#include using namespace AssemblyGui; @@ -44,6 +44,7 @@ ViewProviderItemAssembly::~ViewProviderItemAssembly() bool ViewProviderItemAssembly::doubleClicked(void) { + Gui::Command::doCommand(Gui::Command::Doc,"AssemblyGui.setActiveAssembly(App.activeDocument().%s)",this->getObject()->getNameInDocument()); return true; }