Finally fixing the highlight code

This commit is contained in:
jriegel 2012-04-01 15:02:40 +02:00 committed by Stefan Tröger
parent 0ec1c40d25
commit 8537926edc
5 changed files with 39 additions and 37 deletions

View File

@ -638,23 +638,23 @@ void TreeWidget::slotActiveDocument(const Gui::Document& Doc)
}
}
void TreeWidget::markItem(const App::DocumentObject* Obj,bool mark)
{
// never call without Object!
assert(Obj);
Gui::Document* Doc = Gui::Application::Instance->getDocument(Obj->getDocument());
std::map<const Gui::Document*, DocumentItem*>::iterator jt = DocumentMap.find(Doc);
for (std::map<const Gui::Document*, DocumentItem*>::iterator it = DocumentMap.begin();
it != DocumentMap.end(); ++it)
{
it->second->markItem(Obj,mark);
QFont f = it->second->font(0);
f.setBold(it == jt);
it->second->setFont(0,f);
}
}
//void TreeWidget::markItem(const App::DocumentObject* Obj,bool mark)
//{
// // never call without Object!
// assert(Obj);
// Gui::Document* Doc = Gui::Application::Instance->getDocument(Obj->getDocument());
//
// std::map<const Gui::Document*, DocumentItem*>::iterator jt = DocumentMap.find(Doc);
// for (std::map<const Gui::Document*, DocumentItem*>::iterator it = DocumentMap.begin();
// it != DocumentMap.end(); ++it)
// {
// it->second->markItem(Obj,mark);
//
// QFont f = it->second->font(0);
// f.setBold(it == jt);
// it->second->setFont(0,f);
// }
//}
void TreeWidget::onTestStatus(void)
{
@ -1053,6 +1053,7 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o
break;
}
jt->second->setFont(0,f);
}
void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,const Gui::TreeItemMode& mode)
@ -1087,20 +1088,20 @@ const Gui::Document* DocumentItem::document() const
return this->pDocument;
}
void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark)
{
// never call without Object!
assert(Obj);
std::map<std::string,DocumentObjectItem*>::iterator pos;
pos = ObjectMap.find(Obj->getNameInDocument());
if (pos != ObjectMap.end()) {
QFont f = pos->second->font(0);
f.setUnderline(mark);
pos->second->setFont(0,f);
}
}
//void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark)
//{
// // never call without Object!
// assert(Obj);
//
//
// std::map<std::string,DocumentObjectItem*>::iterator pos;
// pos = ObjectMap.find(Obj->getNameInDocument());
// if (pos != ObjectMap.end()) {
// QFont f = pos->second->font(0);
// f.setUnderline(mark);
// pos->second->setFont(0,f);
// }
//}
//void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark)
//{

View File

@ -149,7 +149,7 @@ public:
void selectItems(void);
void testStatus(void);
void setData(int column, int role, const QVariant & value);
void markItem(const App::DocumentObject* Obj,bool mark);
// void markItem(const App::DocumentObject* Obj,bool mark);
protected:
/** Adds a view provider to the document item.

View File

@ -464,7 +464,7 @@ Py::Object View3DInventorPy::viewRotateLeft(const Py::Tuple& args)
SbRotation rot = cam->orientation.getValue();
SbVec3f vdir(0, 0, -1);
rot.multVec(vdir, vdir);
SbRotation nrot(vdir,float( M_PI/2));
SbRotation nrot(vdir, (float)M_PI/2);
cam->orientation.setValue(rot*nrot);
}
catch (const Base::Exception& e) {
@ -490,7 +490,7 @@ Py::Object View3DInventorPy::viewRotateRight(const Py::Tuple& args)
SbRotation rot = cam->orientation.getValue();
SbVec3f vdir(0, 0, -1);
rot.multVec(vdir, vdir);
SbRotation nrot(vdir, float(-M_PI/2));
SbRotation nrot(vdir, (float)-M_PI/2);
cam->orientation.setValue(rot*nrot);
}
catch (const Base::Exception& e) {

View File

@ -55,17 +55,17 @@ static PyObject * setActiveAssembly(PyObject *self, PyObject *args)
// get the gui document of the Assembly Item
if(ActiveAsmObject){
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::None);
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue,false);
ActiveAsmObject = 0;
}
ActiveAsmObject = Item;
ActiveGuiDoc = Gui::Application::Instance->getDocument(Item->getDocument());
ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*> (ActiveGuiDoc->getViewProvider(Item)) ;
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Underlined);
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue,true);
}else{
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::None);
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue,false);
ActiveAsmObject = 0;
}

View File

@ -236,6 +236,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
int tangId = Constraint::GeoUndef;
float smlTangDist = 1e15f;
// Do not consider if distance is more than that.
// Decrease this value when a candidate is found.
double tangDeviation = 0.1 * sketchgui->getScaleFactor();