Gui: fix trailing whitespace
This commit is contained in:
@@ -94,7 +94,7 @@ bool Gui::GuiNativeEvent::xcbEventFilter(void *xcb_void, long* result)
|
||||
return false;
|
||||
|
||||
spnav_event navEvent;
|
||||
|
||||
|
||||
const xcb_client_message_event_t* xcb_ev = static_cast<const xcb_client_message_event_t*>(xcb_void);
|
||||
// Qt4 used XEvents in native event filters, but Qt5 changed to XCB. The
|
||||
// SpaceNavigator API only works with XEvent, so we need to construct a
|
||||
@@ -169,15 +169,15 @@ bool Gui::GuiNativeEvent::x11EventFilter(XEvent *event)
|
||||
if (event->type == ClientMessage)
|
||||
{
|
||||
Atom message_type = event->xclient.message_type;
|
||||
|
||||
|
||||
if (message_type == motion_flush_event)
|
||||
{
|
||||
nMotionEvents--;
|
||||
if (nMotionEvents == 0)
|
||||
{
|
||||
{
|
||||
mainApp->postMotionEvent(motionDataArray);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
} // XEvent: motion_flush_event
|
||||
} // XEvent: ClientMessage
|
||||
@@ -185,7 +185,7 @@ bool Gui::GuiNativeEvent::x11EventFilter(XEvent *event)
|
||||
/*
|
||||
From here on we deal with spacenav events only:
|
||||
- motion: The event data is saved and a self addressed flush event
|
||||
is sent through the window system (XEvent).
|
||||
is sent through the window system (XEvent).
|
||||
In the case of an event flooding, the motion data is added up.
|
||||
- button: A Spaceball event is posted (QInputEvent).
|
||||
*/
|
||||
@@ -197,8 +197,8 @@ bool Gui::GuiNativeEvent::x11EventFilter(XEvent *event)
|
||||
{
|
||||
/*
|
||||
If the motion data of the preceding event has not been processed
|
||||
through posting an Spaceball event (flooding situation),
|
||||
the motion data provided by the incoming event is added to the saved data.
|
||||
through posting an Spaceball event (flooding situation),
|
||||
the motion data provided by the incoming event is added to the saved data.
|
||||
*/
|
||||
int dx, dy, dz, drx, dry, drz;
|
||||
|
||||
@@ -220,36 +220,36 @@ bool Gui::GuiNativeEvent::x11EventFilter(XEvent *event)
|
||||
dry = motionDataArray[4];
|
||||
drz = motionDataArray[5];
|
||||
}
|
||||
|
||||
|
||||
motionDataArray[0] = -navEvent.motion.x;
|
||||
motionDataArray[1] = -navEvent.motion.z;
|
||||
motionDataArray[2] = -navEvent.motion.y;
|
||||
motionDataArray[3] = -navEvent.motion.rx;
|
||||
motionDataArray[4] = -navEvent.motion.rz;
|
||||
motionDataArray[5] = -navEvent.motion.ry;
|
||||
|
||||
|
||||
motionDataArray[0] += dx;
|
||||
motionDataArray[1] += dy;
|
||||
motionDataArray[2] += dz;
|
||||
motionDataArray[3] += drx;
|
||||
motionDataArray[4] += dry;
|
||||
motionDataArray[5] += drz;
|
||||
|
||||
|
||||
/*
|
||||
Send a self addressed flush event through the window system. This will
|
||||
trigger a Spaceball event if FreeCAD is ready to do so.
|
||||
*/
|
||||
nMotionEvents++;
|
||||
XClientMessageEvent flushEvent;
|
||||
|
||||
|
||||
flushEvent.display = display;
|
||||
flushEvent.window = event->xclient.window;
|
||||
flushEvent.type = ClientMessage;
|
||||
flushEvent.format = 8;
|
||||
flushEvent.format = 8;
|
||||
flushEvent.message_type = motion_flush_event;
|
||||
|
||||
|
||||
XSendEvent (display, flushEvent.window, False, 0, (XEvent*)&flushEvent); // siehe spnavd, False, 0
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ const I3dMouseParam& Gui::GuiNativeEvent::MouseParams() const
|
||||
void Gui::GuiNativeEvent::Move3d(HANDLE device, std::vector<float>& motionData)
|
||||
{
|
||||
Q_UNUSED(device);
|
||||
|
||||
|
||||
motionDataArray[0] = -ceil(motionData[0]);
|
||||
motionDataArray[1] = ceil(motionData[1]);
|
||||
motionDataArray[2] = ceil(motionData[2]);
|
||||
@@ -388,7 +388,7 @@ void Gui::GuiNativeEvent::Move3d(HANDLE device, std::vector<float>& motionData)
|
||||
void Gui::GuiNativeEvent::On3dmouseKeyDown(HANDLE device, int virtualKeyCode)
|
||||
{
|
||||
Q_UNUSED(device);
|
||||
|
||||
|
||||
mainApp->postButtonEvent(virtualKeyCode - 1, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="BaseClassPy"
|
||||
Name="AxisOriginPy"
|
||||
Twin="AxisOrigin"
|
||||
TwinPointer="AxisOrigin"
|
||||
Include="Gui/AxisOrigin.h"
|
||||
Namespace="Gui"
|
||||
<PythonExport
|
||||
Father="BaseClassPy"
|
||||
Name="AxisOriginPy"
|
||||
Twin="AxisOrigin"
|
||||
TwinPointer="AxisOrigin"
|
||||
Include="Gui/AxisOrigin.h"
|
||||
Namespace="Gui"
|
||||
FatherInclude="Base/BaseClassPy.h"
|
||||
FatherNamespace="Base"
|
||||
Constructor="true"
|
||||
|
||||
@@ -68,17 +68,17 @@ FilterTyped::FilterTyped(const std::string &typeIn) : FilterBase(), type(typeIn)
|
||||
|
||||
bool FilterTyped::goFilter(const Gui::DAG::Vertex& vertexIn, const Graph& graphIn, const GraphLinkContainer& linkIn) const
|
||||
{
|
||||
Q_UNUSED(graphIn);
|
||||
Q_UNUSED(graphIn);
|
||||
if (type.empty())
|
||||
return false;
|
||||
Base::Type theType = Base::Type::fromName(type.c_str());
|
||||
if (theType == Base::Type::badType())
|
||||
return false;
|
||||
|
||||
|
||||
const GraphLinkRecord &sourceRecord = findRecord(vertexIn, linkIn);
|
||||
if (sourceRecord.DObject->getTypeId() == theType)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Gui
|
||||
bool enabled;
|
||||
Type type;
|
||||
};
|
||||
|
||||
|
||||
/*! Hide all children of app::origin that are not
|
||||
* used by subsequent features
|
||||
*/
|
||||
@@ -58,7 +58,7 @@ namespace Gui
|
||||
FilterOrigin();
|
||||
bool goFilter(const Vertex &vertexIn, const Graph &graphIn, const GraphLinkContainer &linkIn) const override;
|
||||
};
|
||||
|
||||
|
||||
/*! Hide nodes of type*/
|
||||
class FilterTyped : public FilterBase
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ void LineEdit::keyPressEvent(QKeyEvent *eventIn)
|
||||
eventIn->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QLineEdit::keyPressEvent(eventIn);
|
||||
}
|
||||
|
||||
@@ -98,31 +98,31 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen
|
||||
//turned off BSP as it was giving inconsistent discovery of items
|
||||
//underneath cursor.
|
||||
this->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
|
||||
|
||||
theGraph = std::make_shared<Graph>();
|
||||
graphLink = std::make_shared<GraphLinkContainer>();
|
||||
setupViewConstants();
|
||||
setupFilters();
|
||||
|
||||
|
||||
graphDirty = false;
|
||||
currentPrehighlight = nullptr;
|
||||
|
||||
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("DAGView");
|
||||
selectionMode = static_cast<SelectionMode>(group->GetInt("SelectionMode", 0));
|
||||
group->SetInt("SelectionMode", static_cast<int>(selectionMode)); //ensure entry exists.
|
||||
|
||||
|
||||
QIcon temp(Gui::BitmapFactory().iconFromTheme("dagViewVisible"));
|
||||
visiblePixmapEnabled = temp.pixmap(iconSize, iconSize, QIcon::Normal, QIcon::On);
|
||||
visiblePixmapDisabled = temp.pixmap(iconSize, iconSize, QIcon::Disabled, QIcon::Off);
|
||||
|
||||
|
||||
QIcon passIcon(Gui::BitmapFactory().iconFromTheme("dagViewPass"));
|
||||
passPixmap = passIcon.pixmap(iconSize, iconSize);
|
||||
QIcon failIcon(Gui::BitmapFactory().iconFromTheme("dagViewFail"));
|
||||
failPixmap = failIcon.pixmap(iconSize, iconSize);
|
||||
QIcon pendingIcon(Gui::BitmapFactory().iconFromTheme("dagViewPending"));
|
||||
pendingPixmap = pendingIcon.pixmap(iconSize, iconSize);
|
||||
|
||||
|
||||
renameAction = new QAction(this);
|
||||
renameAction->setText(tr("Rename"));
|
||||
renameAction->setStatusTip(tr("Rename object"));
|
||||
@@ -130,13 +130,13 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen
|
||||
renameAction->setShortcut(Qt::Key_F2);
|
||||
#endif
|
||||
connect(renameAction, SIGNAL(triggered()), this, SLOT(onRenameSlot()));
|
||||
|
||||
|
||||
editingFinishedAction = new QAction(this);
|
||||
editingFinishedAction->setText(tr("Finish editing"));
|
||||
editingFinishedAction->setStatusTip(tr("Finish editing object"));
|
||||
connect(this->editingFinishedAction, SIGNAL(triggered()),
|
||||
this, SLOT(editingFinishedSlot()));
|
||||
|
||||
|
||||
connectNewObject = documentIn.signalNewObject.connect(boost::bind(&Model::slotNewObject, this, bp::_1));
|
||||
connectDelObject = documentIn.signalDeletedObject.connect(boost::bind(&Model::slotDeleteObject, this, bp::_1));
|
||||
connectChgObject = documentIn.signalChangedObject.connect(boost::bind(&Model::slotChangeObject, this, bp::_1, bp::_2));
|
||||
@@ -162,7 +162,7 @@ Model::~Model()
|
||||
connectEdtObject.disconnect();
|
||||
if(connectResObject.connected())
|
||||
connectResObject.disconnect();
|
||||
|
||||
|
||||
removeAllItems();
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ void Model::setupViewConstants()
|
||||
{
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("DAGView");
|
||||
|
||||
|
||||
//get font point size.
|
||||
int fontPointSize = group->GetInt("FontPointSize", 0);
|
||||
group->SetInt("FontPointSize", fontPointSize); //ensure entry exists.
|
||||
@@ -187,13 +187,13 @@ void Model::setupViewConstants()
|
||||
tempFont.setPointSize(fontPointSize);
|
||||
this->setFont(tempFont);
|
||||
}
|
||||
|
||||
|
||||
//get direction
|
||||
direction = group->GetFloat("Direction", 1.0);
|
||||
if (direction != -1.0 && direction != 1.0)
|
||||
direction = 1.0;
|
||||
group->SetFloat("Direction", direction); //ensure entry exists.
|
||||
|
||||
|
||||
QFontMetrics fontMetric(this->font());
|
||||
fontHeight = fontMetric.height();
|
||||
verticalSpacing = 1.0;
|
||||
@@ -206,7 +206,7 @@ void Model::setupViewConstants()
|
||||
iconToText = iconSize / 2.0;
|
||||
rowPadding = fontHeight;
|
||||
backgroundBrushes = {this->palette().base(), this->palette().alternateBase()};
|
||||
forgroundBrushes =
|
||||
forgroundBrushes =
|
||||
{
|
||||
QBrush(Qt::red),
|
||||
QBrush(Qt::darkRed),
|
||||
@@ -229,9 +229,9 @@ void Model::setupViewConstants()
|
||||
void Model::slotNewObject(const ViewProviderDocumentObject &VPDObjectIn)
|
||||
{
|
||||
Vertex virginVertex = boost::add_vertex(*theGraph);
|
||||
|
||||
|
||||
addVertexItemsToScene(virginVertex);
|
||||
|
||||
|
||||
GraphLinkRecord virginRecord;
|
||||
virginRecord.DObject = VPDObjectIn.getObject();
|
||||
virginRecord.VPDObject = &VPDObjectIn;
|
||||
@@ -239,19 +239,19 @@ void Model::slotNewObject(const ViewProviderDocumentObject &VPDObjectIn)
|
||||
virginRecord.uniqueName = std::string(virginRecord.DObject->getNameInDocument());
|
||||
virginRecord.vertex = virginVertex;
|
||||
graphLink->insert(virginRecord);
|
||||
|
||||
|
||||
//setup rectangle.
|
||||
auto rectangle = (*theGraph)[virginVertex].rectangle.get();
|
||||
rectangle->setEditingBrush(QBrush(Qt::yellow));
|
||||
|
||||
|
||||
auto icon = (*theGraph)[virginVertex].icon;
|
||||
icon->setPixmap(VPDObjectIn.getIcon().pixmap(iconSize, iconSize));
|
||||
(*theGraph)[virginVertex].stateIcon->setPixmap(passPixmap);
|
||||
(*theGraph)[virginVertex].text->setFont(this->font());
|
||||
(*theGraph)[virginVertex].connChangeIcon =
|
||||
(*theGraph)[virginVertex].connChangeIcon =
|
||||
const_cast<Gui::ViewProviderDocumentObject&>(VPDObjectIn).signalChangeIcon.connect(
|
||||
boost::bind(&Model::slotChangeIcon, this, boost::cref(VPDObjectIn), icon));
|
||||
|
||||
|
||||
graphDirty = true;
|
||||
lastAddedVertex = Graph::null_vertex();
|
||||
}
|
||||
@@ -265,27 +265,27 @@ void Model::slotChangeIcon(const ViewProviderDocumentObject &VPDObjectIn, std::s
|
||||
void Model::slotDeleteObject(const ViewProviderDocumentObject &VPDObjectIn)
|
||||
{
|
||||
Vertex vertex = findRecord(&VPDObjectIn, *graphLink).vertex;
|
||||
|
||||
|
||||
//remove items from scene.
|
||||
removeVertexItemsFromScene(vertex);
|
||||
|
||||
//remove connector items
|
||||
|
||||
//remove connector items
|
||||
auto outRange = boost::out_edges(vertex, *theGraph);
|
||||
for (auto outEdgeIt = outRange.first; outEdgeIt != outRange.second; ++outEdgeIt)
|
||||
this->removeItem((*theGraph)[*outEdgeIt].connector.get());
|
||||
auto inRange = boost::in_edges(vertex, *theGraph);
|
||||
for (auto inEdgeIt = inRange.first; inEdgeIt != inRange.second; ++inEdgeIt)
|
||||
this->removeItem((*theGraph)[*inEdgeIt].connector.get());
|
||||
|
||||
|
||||
if (vertex == lastAddedVertex)
|
||||
lastAddedVertex = Graph::null_vertex();
|
||||
|
||||
(*theGraph)[vertex].connChangeIcon.disconnect();
|
||||
|
||||
|
||||
//remove the actual vertex.
|
||||
boost::clear_vertex(vertex, *theGraph);
|
||||
boost::remove_vertex(vertex, *theGraph);
|
||||
|
||||
|
||||
eraseRecord(&VPDObjectIn, *graphLink);
|
||||
graphDirty = true;
|
||||
}
|
||||
@@ -296,11 +296,11 @@ void Model::slotChangeObject(const ViewProviderDocumentObject &VPDObjectIn, cons
|
||||
if (propertyIn.hasName())
|
||||
name = propertyIn.getName();
|
||||
assert(!name.empty());
|
||||
|
||||
// std::cout << std::endl << "inside changed object." << std::endl <<
|
||||
|
||||
// std::cout << std::endl << "inside changed object." << std::endl <<
|
||||
// "Property name is: " << name << std::endl <<
|
||||
// "Property type is: " << propertyIn.getTypeId().getName() << std::endl << std::endl;
|
||||
|
||||
|
||||
//renaming of objects.
|
||||
if (std::string("Label") == name)
|
||||
{
|
||||
@@ -334,23 +334,23 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
{
|
||||
//TODO: note that treeview uses set selection which sends a message with just a document name
|
||||
//and no object name. Have to explore further.
|
||||
|
||||
|
||||
auto getAllEdges = [this](const Vertex &vertexIn)
|
||||
{
|
||||
//is there really no function to get both in and out edges?
|
||||
std::vector<Edge> out;
|
||||
|
||||
|
||||
OutEdgeIterator outIt, outItEnd;
|
||||
for (boost::tie(outIt, outItEnd) = boost::out_edges(vertexIn, *theGraph); outIt != outItEnd; ++outIt)
|
||||
out.push_back(*outIt);
|
||||
|
||||
|
||||
InEdgeIterator inIt, inItEnd;
|
||||
for (boost::tie(inIt, inItEnd) = boost::in_edges(vertexIn, *theGraph); inIt != inItEnd; ++inIt)
|
||||
out.push_back(*inIt);
|
||||
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
|
||||
auto highlightConnectorOn = [this, getAllEdges](const Vertex &vertexIn)
|
||||
{
|
||||
QColor color = (*theGraph)[vertexIn].text->defaultTextColor();
|
||||
@@ -363,7 +363,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
(*theGraph)[edge].connector->setZValue(1.0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
auto highlightConnectorOff = [this, getAllEdges](const Vertex &vertexIn)
|
||||
{
|
||||
auto edges = getAllEdges(vertexIn);
|
||||
@@ -373,7 +373,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
(*theGraph)[edge].connector->setZValue(0.0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//lambda for clearing selections.
|
||||
auto clearSelection = [this, highlightConnectorOff]()
|
||||
{
|
||||
@@ -385,7 +385,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
highlightConnectorOff(currentVertex);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//lambda for getting rectangle.
|
||||
auto getRectangle = [this](const char *in)
|
||||
{
|
||||
@@ -397,7 +397,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
assert(rect);
|
||||
return rect;
|
||||
};
|
||||
|
||||
|
||||
if (msg.Type == SelectionChanges::AddSelection)
|
||||
{
|
||||
if (msg.pObjectName)
|
||||
@@ -419,7 +419,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
else if(msg.Type == SelectionChanges::SetSelection)
|
||||
{
|
||||
clearSelection();
|
||||
|
||||
|
||||
auto selections = Gui::Selection().getSelection(msg.pDocName);
|
||||
for (const auto &selection : selections)
|
||||
{
|
||||
@@ -433,7 +433,7 @@ void Model::selectionChanged(const SelectionChanges& msg)
|
||||
{
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
@@ -451,13 +451,13 @@ void Model::updateSlot()
|
||||
{
|
||||
//empty outList means it is a root.
|
||||
//empty inList means it is a leaf.
|
||||
|
||||
|
||||
//NOTE: some of the following loops can/should be combined
|
||||
//for speed. Not doing yet, as I want a simple algorithm until
|
||||
//a more complete picture is formed.
|
||||
|
||||
|
||||
Base::TimeInfo startTime;
|
||||
|
||||
|
||||
//here we will cycle through the graph updating edges.
|
||||
//we have to do this first and in isolation because everything is dependent on an up to date graph.
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
@@ -479,7 +479,7 @@ void Model::updateSlot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//apply filters.
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
{
|
||||
@@ -492,7 +492,7 @@ void Model::updateSlot()
|
||||
(*theGraph)[currentVertex].dagVisible = false;
|
||||
}
|
||||
}
|
||||
//inclusion takes precedence. Separate loop because filters might probe
|
||||
//inclusion takes precedence. Separate loop because filters might probe
|
||||
//children and parents. So we want to ensure all exclusions are done
|
||||
//before inclusions start.
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
@@ -505,7 +505,7 @@ void Model::updateSlot()
|
||||
(*theGraph)[currentVertex].dagVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//sync scene items to graph vertex dagVisible.
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
{
|
||||
@@ -514,20 +514,20 @@ void Model::updateSlot()
|
||||
if ((!(*theGraph)[currentVertex].dagVisible) && (*theGraph)[currentVertex].rectangle->scene())
|
||||
removeVertexItemsFromScene(currentVertex);
|
||||
}
|
||||
|
||||
|
||||
//sync scene items for graph edge.
|
||||
BGL_FORALL_EDGES(currentEdge, *theGraph, Graph)
|
||||
{
|
||||
Vertex source = boost::source(currentEdge, *theGraph);
|
||||
Vertex target = boost::target(currentEdge, *theGraph);
|
||||
|
||||
|
||||
bool edgeVisible = (*theGraph)[source].dagVisible && (*theGraph)[target].dagVisible;
|
||||
if (edgeVisible && (!(*theGraph)[currentEdge].connector->scene()))
|
||||
this->addItem((*theGraph)[currentEdge].connector.get());
|
||||
if ((!edgeVisible) && (*theGraph)[currentEdge].connector->scene())
|
||||
this->removeItem((*theGraph)[currentEdge].connector.get());
|
||||
}
|
||||
|
||||
|
||||
indexVerticesEdges();
|
||||
Path sorted;
|
||||
try
|
||||
@@ -548,7 +548,7 @@ void Model::updateSlot()
|
||||
(*theGraph)[currentVertex].topoSortIndex = tempIndex;
|
||||
tempIndex++;
|
||||
}
|
||||
|
||||
|
||||
//draw graph(nodes and connectors).
|
||||
int currentRow = 0;
|
||||
int currentColumn = -1; //we know first column is going to be root so will be kicked up to 0.
|
||||
@@ -558,7 +558,7 @@ void Model::updateSlot()
|
||||
{
|
||||
if (!(*theGraph)[currentVertex].dagVisible)
|
||||
continue;
|
||||
|
||||
|
||||
if (boost::out_degree(currentVertex, *theGraph) == 0)
|
||||
currentColumn = 0;
|
||||
else
|
||||
@@ -572,7 +572,7 @@ void Model::updateSlot()
|
||||
for (;it != itEnd; ++it)
|
||||
{
|
||||
// std::cout << std::endl << "name: " << findRecord(currentVertex, *graphLink).DObject->Label.getValue() << std::endl;
|
||||
|
||||
|
||||
Vertex target = boost::target(*it, *theGraph);
|
||||
parentVertices.push_back(target);
|
||||
int currentParentIndex = (*theGraph)[target].topoSortIndex;
|
||||
@@ -584,23 +584,23 @@ void Model::updateSlot()
|
||||
for (it = start; it != end; ++it)
|
||||
{
|
||||
// std::cout << " parent: " << findRecord(*it, *graphLink).DObject->Label.getValue() << std::endl;
|
||||
|
||||
|
||||
columnMask |= (*theGraph)[*it].column;
|
||||
}
|
||||
farthestParentIndex = currentParentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//have to create a smaller subset to get through std::cout.
|
||||
// std::bitset<8> testSet;
|
||||
// for (unsigned int index = 0; index < testSet.size(); ++index)
|
||||
// testSet[index]= columnMask[index];
|
||||
// std::cout << "mask for " << findRecord(currentVertex, *graphLink).DObject->Label.getValue() << " " <<
|
||||
// testSet.to_string() << std::endl;
|
||||
|
||||
|
||||
//now we should have a mask representing the columns that are being used.
|
||||
//this is from the lowest parent, in the topo sort, to last entry.
|
||||
|
||||
|
||||
//try to use the same column as one of the parents.(*theGraph)[*it].column
|
||||
int destinationColumn = 0; //default to first column
|
||||
for (const auto ¤tParent : parentVertices)
|
||||
@@ -629,9 +629,9 @@ void Model::updateSlot()
|
||||
|
||||
currentColumn = destinationColumn;
|
||||
}
|
||||
|
||||
|
||||
assert(currentColumn < static_cast<int>(ColumnMask().size())); //temp limitation.
|
||||
|
||||
|
||||
maxColumn = std::max(currentColumn, maxColumn);
|
||||
QBrush currentBrush(forgroundBrushes.at(currentColumn % forgroundBrushes.size()));
|
||||
|
||||
@@ -639,26 +639,26 @@ void Model::updateSlot()
|
||||
rectangle->setRect(-rowPadding, 0.0, rowPadding, rowHeight); //calculate actual length later.
|
||||
rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * currentRow));
|
||||
rectangle->setBackgroundBrush(backgroundBrushes[currentRow % backgroundBrushes.size()]);
|
||||
|
||||
|
||||
auto point = (*theGraph)[currentVertex].point.get();
|
||||
point->setRect(0.0, 0.0, pointSize, pointSize);
|
||||
point->setTransform(QTransform::fromTranslate(pointSpacing * currentColumn,
|
||||
rowHeight * currentRow + rowHeight / 2.0 - pointSize / 2.0));
|
||||
point->setBrush(currentBrush);
|
||||
|
||||
|
||||
float cheat = 0.0;
|
||||
if (direction == -1)
|
||||
cheat = rowHeight;
|
||||
|
||||
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
visiblePixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
|
||||
auto statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
statePixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
|
||||
auto pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
pixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
|
||||
auto text = (*theGraph)[currentVertex].text.get();
|
||||
text->setPlainText(QString::fromUtf8(findRecord(currentVertex, *graphLink).DObject->Label.getValue()));
|
||||
text->setDefaultTextColor(currentBrush.color());
|
||||
@@ -666,11 +666,11 @@ void Model::updateSlot()
|
||||
text->setTransform(QTransform::fromTranslate
|
||||
(0.0, rowHeight * currentRow - verticalSpacing * 2.0 + cheat)); //calculate x location later.
|
||||
(*theGraph)[currentVertex].lastVisibleState = VisibilityState::None; //force visual update for color.
|
||||
|
||||
|
||||
//store column and row int the graph. use for connectors later.
|
||||
(*theGraph)[currentVertex].row = currentRow;
|
||||
(*theGraph)[currentVertex].column.reset().set((currentColumn));
|
||||
|
||||
|
||||
//our list is topo sorted so all dependents should be located, so we can build the connectors.
|
||||
//will have some more logic for connector path, simple for now.
|
||||
float currentX = pointSpacing * currentColumn + pointSize / 2.0;
|
||||
@@ -685,7 +685,7 @@ void Model::updateSlot()
|
||||
float dependentX = pointSpacing * static_cast<int>(columnFromMask((*theGraph)[target].column)) + pointSize / 2.0; //on center.
|
||||
columnFromMask((*theGraph)[target].column);
|
||||
float dependentY = rowHeight * (*theGraph)[target].row + rowHeight / 2.0;
|
||||
|
||||
|
||||
QGraphicsPathItem *pathItem = (*theGraph)[*it].connector.get();
|
||||
pathItem->setBrush(Qt::NoBrush);
|
||||
QPainterPath path;
|
||||
@@ -696,9 +696,9 @@ void Model::updateSlot()
|
||||
{
|
||||
//connector with bend.
|
||||
float radius = pointSpacing / 1.9; //no zero length line.
|
||||
|
||||
|
||||
path.lineTo(currentX, dependentY + radius * direction);
|
||||
|
||||
|
||||
float yPosition;
|
||||
if (direction == -1.0)
|
||||
yPosition = dependentY - 2.0 * radius;
|
||||
@@ -720,10 +720,10 @@ void Model::updateSlot()
|
||||
}
|
||||
pathItem->setPath(path);
|
||||
}
|
||||
|
||||
|
||||
currentRow++;
|
||||
}
|
||||
|
||||
|
||||
//now that we have the graph drawn we know where to place icons and text.
|
||||
float columnSpacing = (maxColumn * pointSpacing);
|
||||
for (const auto ¤tVertex : sorted)
|
||||
@@ -733,32 +733,32 @@ void Model::updateSlot()
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
QTransform visibleIconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
visiblePixmap->setTransform(visiblePixmap->transform() * visibleIconTransform);
|
||||
|
||||
|
||||
localCurrentX += iconSize + iconToIcon;
|
||||
auto statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
QTransform stateIconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
statePixmap->setTransform(statePixmap->transform() * stateIconTransform);
|
||||
|
||||
|
||||
localCurrentX += iconSize + iconToIcon;
|
||||
auto pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
QTransform iconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
pixmap->setTransform(pixmap->transform() * iconTransform);
|
||||
|
||||
|
||||
localCurrentX += iconSize + iconToText;
|
||||
auto text = (*theGraph)[currentVertex].text.get();
|
||||
QTransform textTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
text->setTransform(text->transform() * textTransform);
|
||||
|
||||
|
||||
auto rectangle = (*theGraph)[currentVertex].rectangle.get();
|
||||
QRectF rect = rectangle->rect();
|
||||
rect.setWidth(localCurrentX + maxTextLength + 2.0 * rowPadding);
|
||||
rectangle->setRect(rect);
|
||||
}
|
||||
|
||||
|
||||
//Modeling_Challenge_Casting_ta4 with 59 features: "Initialize DAG View time: 0.007"
|
||||
//keeping algo simple with extra loops only added 0.002 to above number.
|
||||
// std::cout << "Initialize DAG View time: " << Base::TimeInfo::diffTimeF(startTime, Base::TimeInfo()) << std::endl;
|
||||
|
||||
|
||||
// outputGraphviz<Graph>(*theGraph, "./graphviz.dot");
|
||||
graphDirty = false;
|
||||
}
|
||||
@@ -766,7 +766,7 @@ void Model::updateSlot()
|
||||
void Model::indexVerticesEdges()
|
||||
{
|
||||
std::size_t index = 0;
|
||||
|
||||
|
||||
//index vertices.
|
||||
VertexIterator it, itEnd;
|
||||
for(boost::tie(it, itEnd) = boost::vertices(*theGraph); it != itEnd; ++it)
|
||||
@@ -791,7 +791,7 @@ void Model::removeAllItems()
|
||||
{
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
removeVertexItemsFromScene(currentVertex);
|
||||
|
||||
|
||||
BGL_FORALL_EDGES(currentEdge, *theGraph, Graph)
|
||||
{
|
||||
if ((*theGraph)[currentEdge].connector->scene())
|
||||
@@ -830,11 +830,11 @@ void Model::updateStates()
|
||||
{
|
||||
//not sure I want to use the same pixmap merge for failing feature icons.
|
||||
//thinking maybe red background or another column of icons for state?
|
||||
|
||||
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
{
|
||||
const GraphLinkRecord &record = findRecord(currentVertex, *graphLink);
|
||||
|
||||
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
VisibilityState currentVisibilityState = (record.VPDObject->isShow()) ? (VisibilityState::On) : (VisibilityState::Off);
|
||||
if
|
||||
@@ -849,7 +849,7 @@ void Model::updateStates()
|
||||
visiblePixmap->setPixmap(visiblePixmapDisabled);
|
||||
(*theGraph)[currentVertex].lastVisibleState = currentVisibilityState;
|
||||
}
|
||||
|
||||
|
||||
FeatureState currentFeatureState = FeatureState::Pass;
|
||||
if (record.DObject->isError())
|
||||
currentFeatureState = FeatureState::Fail;
|
||||
@@ -889,7 +889,7 @@ RectItem* Model::getRectFromPosition(const QPointF& position)
|
||||
rect = dynamic_cast<RectItem *>(currentItem);
|
||||
if (rect) break;
|
||||
}
|
||||
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -903,22 +903,22 @@ void Model::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
|
||||
currentPrehighlight = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
RectItem *rect = getRectFromPosition(event->scenePos());
|
||||
if (!rect)
|
||||
{
|
||||
clearPrehighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (rect == currentPrehighlight)
|
||||
return;
|
||||
|
||||
|
||||
clearPrehighlight();
|
||||
rect->preHighlightOn();
|
||||
currentPrehighlight = rect;
|
||||
invalidate();
|
||||
|
||||
|
||||
QGraphicsScene::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
selectionRecord.DObject->getNameInDocument());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
auto toggleSelect = [](const App::DocumentObject *dObjectIn, RectItem *rectIn)
|
||||
{
|
||||
if (rectIn->isSelected())
|
||||
@@ -946,17 +946,17 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
else
|
||||
Gui::Selection().addSelection(dObjectIn->getDocument()->getName(), dObjectIn->getNameInDocument());
|
||||
};
|
||||
|
||||
|
||||
if (proxy)
|
||||
renameAcceptedSlot();
|
||||
|
||||
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
RectItem *rect = getRectFromPosition(event->scenePos());
|
||||
if (rect)
|
||||
{
|
||||
const GraphLinkRecord &record = findRecord(rect, *graphLink);
|
||||
|
||||
|
||||
//don't like that I am doing this again here after getRectFromPosition call.
|
||||
QGraphicsItem *item = itemAt(event->scenePos(), QTransform());
|
||||
auto pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
@@ -967,10 +967,10 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
const_cast<ViewProviderDocumentObject *>(record.VPDObject)->show(); //const hack
|
||||
else
|
||||
const_cast<ViewProviderDocumentObject *>(record.VPDObject)->hide(); //const hack
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const App::DocumentObject *dObject = record.DObject;
|
||||
if (selectionMode == SelectionMode::Single)
|
||||
{
|
||||
@@ -1008,7 +1008,7 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
Gui::Selection().clearSelection(); //get document name?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QGraphicsScene::mousePressEvent(event);
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ void Model::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
|
||||
getMainWindow()->setActiveWindow(view);
|
||||
const_cast<ViewProviderDocumentObject*>(record.VPDObject)->doubleClicked();
|
||||
}
|
||||
|
||||
|
||||
QGraphicsScene::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
@@ -1034,13 +1034,13 @@ void Model::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
|
||||
std::vector<Gui::DAG::Vertex> Model::getAllSelected()
|
||||
{
|
||||
std::vector<Gui::DAG::Vertex> out;
|
||||
|
||||
|
||||
BGL_FORALL_VERTICES(currentVertex, *theGraph, Graph)
|
||||
{
|
||||
if ((*theGraph)[currentVertex].rectangle->isSelected())
|
||||
out.push_back(currentVertex);
|
||||
}
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
if (rect)
|
||||
{
|
||||
const GraphLinkRecord &record = findRecord(rect, *graphLink);
|
||||
|
||||
|
||||
//don't like that I am doing this again here after getRectFromPosition call.
|
||||
QGraphicsItem *item = itemAt(event->scenePos(), QTransform());
|
||||
auto pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
@@ -1059,7 +1059,7 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
visiblyIsolate(record.vertex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!rect->isSelected())
|
||||
{
|
||||
Gui::Selection().clearSelection(record.DObject->getDocument()->getName());
|
||||
@@ -1067,12 +1067,12 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
lastPickValid = true;
|
||||
lastPick = event->scenePos();
|
||||
}
|
||||
|
||||
|
||||
MenuItem view;
|
||||
Gui::Application::Instance->setupContextMenu("Tree", &view);
|
||||
QMenu contextMenu;
|
||||
MenuManager::getInstance()->setupContextMenu(&view, contextMenu);
|
||||
|
||||
|
||||
//actions for only one selection.
|
||||
std::vector<Gui::DAG::Vertex> selections = getAllSelected();
|
||||
if (selections.size() == 1)
|
||||
@@ -1085,11 +1085,11 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
else
|
||||
contextMenu.addAction(editingFinishedAction);
|
||||
}
|
||||
|
||||
|
||||
if (contextMenu.actions().count() > 0)
|
||||
contextMenu.exec(event->screenPos());
|
||||
}
|
||||
|
||||
|
||||
QGraphicsScene::contextMenuEvent(event);
|
||||
}
|
||||
|
||||
@@ -1098,32 +1098,32 @@ void Model::onRenameSlot()
|
||||
assert(!proxy);
|
||||
std::vector<Gui::DAG::Vertex> selections = getAllSelected();
|
||||
assert(selections.size() == 1);
|
||||
|
||||
|
||||
auto lineEdit = new LineEdit();
|
||||
auto text = (*theGraph)[selections.front()].text.get();
|
||||
lineEdit->setText(text->toPlainText());
|
||||
connect(lineEdit, SIGNAL(acceptedSignal()), this, SLOT(renameAcceptedSlot()));
|
||||
connect(lineEdit, SIGNAL(rejectedSignal()), this, SLOT(renameRejectedSlot()));
|
||||
|
||||
|
||||
proxy = this->addWidget(lineEdit);
|
||||
proxy->setGeometry(text->sceneBoundingRect());
|
||||
|
||||
|
||||
lineEdit->selectAll();
|
||||
QTimer::singleShot(0, lineEdit, SLOT(setFocus()));
|
||||
QTimer::singleShot(0, lineEdit, SLOT(setFocus()));
|
||||
}
|
||||
|
||||
void Model::renameAcceptedSlot()
|
||||
{
|
||||
assert(proxy);
|
||||
|
||||
|
||||
std::vector<Gui::DAG::Vertex> selections = getAllSelected();
|
||||
assert(selections.size() == 1);
|
||||
const GraphLinkRecord &record = findRecord(selections.front(), *graphLink);
|
||||
|
||||
|
||||
auto lineEdit = dynamic_cast<LineEdit*>(proxy->widget());
|
||||
assert(lineEdit);
|
||||
const_cast<App::DocumentObject*>(record.DObject)->Label.setValue(lineEdit->text().toUtf8().constData()); //const hack
|
||||
|
||||
|
||||
finishRename();
|
||||
}
|
||||
|
||||
@@ -1181,10 +1181,10 @@ void Model::visiblyIsolate(Gui::DAG::Vertex sourceIn)
|
||||
if (type != Base::Type::badType()) out.push_back(type);
|
||||
type = Base::Type::fromName("PartDesign::Body");
|
||||
if (type != Base::Type::badType()) out.push_back(type);
|
||||
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
|
||||
auto testSkipType = [](const App::DocumentObject *dObject, const std::vector<Base::Type> &types)
|
||||
{
|
||||
for (const auto ¤tType : types)
|
||||
@@ -1194,13 +1194,13 @@ void Model::visiblyIsolate(Gui::DAG::Vertex sourceIn)
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
indexVerticesEdges();
|
||||
Path connectedVertices;
|
||||
ConnectionVisitor visitor(connectedVertices);
|
||||
boost::breadth_first_search(*theGraph, sourceIn, boost::visitor(visitor));
|
||||
boost::breadth_first_search(boost::make_reverse_graph(*theGraph), sourceIn, boost::visitor(visitor));
|
||||
|
||||
|
||||
//note source vertex is added twice to Path. Once for each search.
|
||||
static std::vector<Base::Type> skipTypes = buildSkipTypes();
|
||||
for (const auto ¤tVertex : connectedVertices)
|
||||
@@ -1210,7 +1210,7 @@ void Model::visiblyIsolate(Gui::DAG::Vertex sourceIn)
|
||||
continue;
|
||||
const_cast<ViewProviderDocumentObject *>(record.VPDObject)->hide(); //const hack
|
||||
}
|
||||
|
||||
|
||||
const GraphLinkRecord &sourceRecord = findRecord(sourceIn, *graphLink);
|
||||
if (!testSkipType(sourceRecord.DObject, skipTypes))
|
||||
const_cast<ViewProviderDocumentObject *>(sourceRecord.VPDObject)->show(); //const hack
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Gui
|
||||
class Document;
|
||||
class ViewProviderDocumentObject;
|
||||
class SelectionChanges;
|
||||
|
||||
|
||||
namespace DAG
|
||||
{
|
||||
class LineEdit : public QLineEdit
|
||||
@@ -59,7 +59,7 @@ namespace Gui
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent*) override;
|
||||
};
|
||||
|
||||
|
||||
class Model : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -68,13 +68,13 @@ namespace Gui
|
||||
~Model() override;
|
||||
void awake(); //!< hooked up to event dispatcher for update when idle.
|
||||
void selectionChanged(const SelectionChanges& msg);
|
||||
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateSlot();
|
||||
void onRenameSlot();
|
||||
@@ -82,7 +82,7 @@ namespace Gui
|
||||
void renameRejectedSlot();
|
||||
void editingStartSlot();
|
||||
void editingFinishedSlot();
|
||||
|
||||
|
||||
private:
|
||||
Model(){}
|
||||
//documentObject slots.
|
||||
@@ -102,20 +102,20 @@ namespace Gui
|
||||
void slotInEdit(const Gui::ViewProviderDocumentObject &VPDObjectIn);
|
||||
void slotResetEdit(const Gui::ViewProviderDocumentObject &VPDObjectIn);
|
||||
void slotChangeIcon(const Gui::ViewProviderDocumentObject &VPDObjectIn, std::shared_ptr<QGraphicsPixmapItem> icon);
|
||||
|
||||
|
||||
std::shared_ptr<GraphLinkContainer> graphLink;
|
||||
std::shared_ptr<Graph> theGraph;
|
||||
bool graphDirty;
|
||||
|
||||
|
||||
void indexVerticesEdges();
|
||||
void removeAllItems();
|
||||
void addVertexItemsToScene(const Vertex &vertexIn);
|
||||
void removeVertexItemsFromScene(const Vertex &vertexIn);
|
||||
void updateStates();
|
||||
std::size_t columnFromMask(const ColumnMask&);
|
||||
|
||||
|
||||
RectItem* getRectFromPosition(const QPointF &position); //!< can be nullptr
|
||||
|
||||
|
||||
//! @name View Constants for spacing
|
||||
//@{
|
||||
float fontHeight; //!< height of the current qApp default font.
|
||||
@@ -133,9 +133,9 @@ namespace Gui
|
||||
std::vector<QBrush> forgroundBrushes; //!< brushes to paint points, connectors, text.
|
||||
void setupViewConstants();
|
||||
//@}
|
||||
|
||||
|
||||
RectItem *currentPrehighlight;
|
||||
|
||||
|
||||
enum class SelectionMode
|
||||
{
|
||||
Single,
|
||||
@@ -144,22 +144,22 @@ namespace Gui
|
||||
SelectionMode selectionMode;
|
||||
std::vector<Vertex> getAllSelected();
|
||||
void visiblyIsolate(Vertex sourceIn); //!< hide any connected feature and turn on sourceIn.
|
||||
|
||||
|
||||
QPointF lastPick;
|
||||
bool lastPickValid = false;
|
||||
|
||||
|
||||
QPixmap visiblePixmapEnabled;
|
||||
QPixmap visiblePixmapDisabled;
|
||||
QPixmap passPixmap;
|
||||
QPixmap failPixmap;
|
||||
QPixmap pendingPixmap;
|
||||
Vertex lastAddedVertex = Graph::null_vertex(); //!< needed because python objects are not ready.
|
||||
|
||||
|
||||
QAction *renameAction;
|
||||
QAction *editingFinishedAction;
|
||||
QGraphicsProxyWidget *proxy = nullptr;
|
||||
void finishRename();
|
||||
|
||||
|
||||
//filters
|
||||
void setupFilters();
|
||||
using FilterContainer = std::vector<std::shared_ptr<FilterBase> >;
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
using namespace Gui;
|
||||
using namespace DAG;
|
||||
|
||||
VertexProperty::VertexProperty() :
|
||||
VertexProperty::VertexProperty() :
|
||||
rectangle(new RectItem()),
|
||||
point(new QGraphicsEllipseItem()),
|
||||
point(new QGraphicsEllipseItem()),
|
||||
visibleIcon(new QGraphicsPixmapItem()),
|
||||
stateIcon(new QGraphicsPixmapItem()),
|
||||
icon(new QGraphicsPixmapItem()),
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace App{class DocumentObject;}
|
||||
namespace Gui
|
||||
{
|
||||
class ViewProviderDocumentObject;
|
||||
|
||||
|
||||
namespace DAG
|
||||
{
|
||||
enum class VisibilityState
|
||||
@@ -54,7 +54,7 @@ namespace Gui
|
||||
On, //<! shown
|
||||
Off //<! hidden
|
||||
};
|
||||
|
||||
|
||||
enum class FeatureState
|
||||
{
|
||||
None = 0, //<! not determined.
|
||||
@@ -62,12 +62,12 @@ namespace Gui
|
||||
Fail, //<! feature failed to update.
|
||||
Pending //<! feature is pending an update.
|
||||
};
|
||||
|
||||
|
||||
//limit of column width? boost::dynamic_bitset?
|
||||
//did a trial run with this set at 4096, not much difference.
|
||||
//going to leave a big number by default and see how it goes.
|
||||
using ColumnMask = std::bitset<1024>;
|
||||
|
||||
|
||||
/*! @brief Graph vertex information
|
||||
*
|
||||
* My data stored for each vertex;
|
||||
@@ -98,7 +98,7 @@ namespace Gui
|
||||
boost::vertex_index_t, std::size_t,
|
||||
boost::property <boost::vertex_color_t, boost::default_color_type, VertexProperty>
|
||||
>;
|
||||
|
||||
|
||||
/*! @brief Graph edge information
|
||||
*
|
||||
* My data stored for each edge;
|
||||
@@ -119,7 +119,7 @@ namespace Gui
|
||||
};
|
||||
/*! @brief needed to create an internal index for graph edges. needed for setS.*/
|
||||
using edge_prop = boost::property<boost::edge_index_t, std::size_t, EdgeProperty>;
|
||||
|
||||
|
||||
using Graph = boost::adjacency_list<boost::setS, boost::listS, boost::bidirectionalS, vertex_prop, edge_prop>;
|
||||
using Vertex = boost::graph_traits<Graph>::vertex_descriptor;
|
||||
using Edge = boost::graph_traits<Graph>::edge_descriptor;
|
||||
@@ -130,7 +130,7 @@ namespace Gui
|
||||
using VertexAdjacencyIterator = boost::graph_traits<Graph>::adjacency_iterator;
|
||||
using GraphReversed = boost::reverse_graph<Graph, Graph&>;
|
||||
using Path = std::vector<Vertex>; //!< a path or any array of vertices
|
||||
|
||||
|
||||
template <class GraphEW>
|
||||
class Edge_writer {
|
||||
public:
|
||||
@@ -145,7 +145,7 @@ namespace Gui
|
||||
private:
|
||||
const GraphEW &graphEW;
|
||||
};
|
||||
|
||||
|
||||
template <class GraphVW>
|
||||
class Vertex_writer {
|
||||
public:
|
||||
@@ -154,13 +154,13 @@ namespace Gui
|
||||
void operator()(std::ostream& out, const VertexW& vertexW) const
|
||||
{
|
||||
out << "[label=\"";
|
||||
out << graphVW[vertexW].text->toPlainText().toLatin1().data();
|
||||
out << graphVW[vertexW].text->toPlainText().toLatin1().data();
|
||||
out << "\"]";
|
||||
}
|
||||
private:
|
||||
const GraphVW &graphVW;
|
||||
};
|
||||
|
||||
|
||||
template <class GraphIn>
|
||||
void outputGraphviz(const GraphIn &graphIn, const std::string &filePath)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ namespace Gui
|
||||
boost::write_graphviz(file, graphIn, Vertex_writer<GraphIn>(graphIn),
|
||||
Edge_writer<GraphIn>(graphIn));
|
||||
}
|
||||
|
||||
|
||||
//! get all the leaves of the templated graph. Not used right now.
|
||||
template <class GraphIn>
|
||||
class RakeLeaves
|
||||
@@ -190,7 +190,7 @@ namespace Gui
|
||||
private:
|
||||
const GraphIn &graph;
|
||||
};
|
||||
|
||||
|
||||
//! get all the roots of the templated graph. Not used right now.
|
||||
template <class GraphIn>
|
||||
class DigRoots
|
||||
@@ -212,24 +212,24 @@ namespace Gui
|
||||
private:
|
||||
const GraphIn &graph;
|
||||
};
|
||||
|
||||
|
||||
/*! @brief Get connected components.
|
||||
*/
|
||||
class ConnectionVisitor : public boost::default_bfs_visitor
|
||||
{
|
||||
public:
|
||||
explicit ConnectionVisitor(std::vector<Vertex> &verticesIn) : vertices(verticesIn){}
|
||||
|
||||
|
||||
template<typename TVertex, typename TGraph>
|
||||
void discover_vertex(TVertex vertex, TGraph &graph)
|
||||
{
|
||||
Q_UNUSED(graph);
|
||||
Q_UNUSED(graph);
|
||||
vertices.push_back(vertex);
|
||||
}
|
||||
private:
|
||||
std::vector<Vertex> &vertices;
|
||||
};
|
||||
|
||||
|
||||
/*! Multi_index record. */
|
||||
struct GraphLinkRecord
|
||||
{
|
||||
@@ -238,17 +238,17 @@ namespace Gui
|
||||
const RectItem *rectItem; //!< qgraphics item.
|
||||
std::string uniqueName; //!< name for document object.
|
||||
Vertex vertex; //!< vertex in graph.
|
||||
|
||||
|
||||
//@{
|
||||
//! used as tags.
|
||||
struct ByDObject{};
|
||||
struct ByVPDObject{};
|
||||
struct ByRectItem{};
|
||||
struct ByVPDObject{};
|
||||
struct ByRectItem{};
|
||||
struct ByUniqueName{};
|
||||
struct ByVertex{};
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
namespace BMI = boost::multi_index;
|
||||
using GraphLinkContainer = boost::multi_index_container
|
||||
<
|
||||
@@ -282,7 +282,7 @@ namespace Gui
|
||||
>
|
||||
>
|
||||
>;
|
||||
|
||||
|
||||
bool hasRecord(const App::DocumentObject* dObjectIn, const GraphLinkContainer &containerIn);
|
||||
const GraphLinkRecord& findRecord(Vertex vertexIn, const GraphLinkContainer &containerIn);
|
||||
const GraphLinkRecord& findRecord(const App::DocumentObject* dObjectIn, const GraphLinkContainer &containerIn);
|
||||
|
||||
@@ -43,8 +43,8 @@ RectItem::RectItem(QGraphicsItem* parent) : QGraphicsRectItem(parent)
|
||||
|
||||
void RectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->save();
|
||||
|
||||
QStyleOptionViewItem styleOption;
|
||||
|
||||
@@ -52,7 +52,7 @@ View::View(QWidget* parentIn): QGraphicsView(parentIn)
|
||||
this->setRenderHint(QPainter::TextAntialiasing, true);
|
||||
conActive = Application::Instance->signalActiveDocument.connect(boost::bind(&View::slotActiveDocument, this, bp::_1));
|
||||
conDelete = Application::Instance->signalDeleteDocument.connect(boost::bind(&View::slotDeleteDocument, this, bp::_1));
|
||||
|
||||
|
||||
//just update the dagview when the gui process is idle.
|
||||
connect(QAbstractEventDispatcher::instance(), SIGNAL(awake()), this, SLOT(awakeSlot()));
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void Gui::Dialog::DlgCreateNewPreferencePackImp::accept()
|
||||
// Ensure that the chosen name is either unique, or that the user actually wants to overwrite the old one
|
||||
if (auto chosenName = ui->lineEdit->text().toStdString();
|
||||
std::find(_existingPackNames.begin(), _existingPackNames.end(), chosenName) != _existingPackNames.end()) {
|
||||
auto result = QMessageBox::warning(this, tr("Pack already exists"),
|
||||
auto result = QMessageBox::warning(this, tr("Pack already exists"),
|
||||
tr("A preference pack with that name already exists. Do you want to overwrite it?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel);
|
||||
if (result == QMessageBox::Cancel)
|
||||
|
||||
@@ -40,9 +40,9 @@ class Ui_DlgCreateNewPreferencePack;
|
||||
|
||||
/**
|
||||
* \class DlgCreateNewPreferencePackImp
|
||||
*
|
||||
* A dialog to request a preferencePack name and a set of preferencePack templates.
|
||||
*
|
||||
*
|
||||
* A dialog to request a preferencePack name and a set of preferencePack templates.
|
||||
*
|
||||
* \author Chris Hennes
|
||||
*/
|
||||
class GuiExport DlgCreateNewPreferencePackImp : public QDialog
|
||||
|
||||
@@ -166,7 +166,7 @@ void DlgObjectSelection::init(const std::vector<App::DocumentObject*> &objs,
|
||||
this, SLOT(onDepItemChanged(QTreeWidgetItem*,int)));
|
||||
connect(ui->treeWidget, SIGNAL(itemSelectionChanged()),
|
||||
this, SLOT(onItemSelectionChanged()));
|
||||
connect(useOriginalsBtn, SIGNAL(clicked()),
|
||||
connect(useOriginalsBtn, SIGNAL(clicked()),
|
||||
this, SLOT(onUseOriginalsBtnClicked()));
|
||||
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
@@ -611,7 +611,7 @@ void DlgObjectSelection::onItemSelectionChanged() {
|
||||
for (auto obj : inlist)
|
||||
createDepItem(ui->inList, obj);
|
||||
}
|
||||
|
||||
|
||||
if (enabled)
|
||||
ui->depList->setSortingEnabled(true);
|
||||
if (enabled2)
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
/// Options for getSelections()
|
||||
enum class SelectionOptions {
|
||||
/// Invert the selection, i.e. return the unselected objects
|
||||
/// Invert the selection, i.e. return the unselected objects
|
||||
Invert = 1,
|
||||
/// Sort the returned object in depending order
|
||||
Sort = 2,
|
||||
@@ -126,8 +126,8 @@ private:
|
||||
std::map<App::SubObjectT, QTreeWidgetItem*> depMap;
|
||||
std::map<App::SubObjectT, QTreeWidgetItem*> inMap;
|
||||
std::map<App::SubObjectT, Qt::CheckState> itemChanged;
|
||||
QTreeWidgetItem *allItem = nullptr;
|
||||
|
||||
QTreeWidgetItem *allItem = nullptr;
|
||||
|
||||
QPushButton* useOriginalsBtn;
|
||||
bool returnOriginals = false;
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ std::vector<std::string> DlgPreferencePackManagementImp::getPacksFromDirectory(c
|
||||
void DlgPreferencePackManagementImp::deleteUserPack(const std::string& name)
|
||||
{
|
||||
// Do the deletion here...
|
||||
auto result = QMessageBox::warning(this, tr("Delete saved preference pack?"),
|
||||
auto result = QMessageBox::warning(this, tr("Delete saved preference pack?"),
|
||||
tr("Are you sure you want to delete the preference pack named '%1'? This cannot be undone.").arg(QString::fromStdString(name)),
|
||||
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
if (result == QMessageBox::Yes) {
|
||||
|
||||
@@ -39,9 +39,9 @@ class Ui_DlgPreferencePackManagement;
|
||||
|
||||
/**
|
||||
* \class DlgCreateNewPreferencePackImp
|
||||
*
|
||||
* A dialog to request a preferencePack name and a set of preferencePack templates.
|
||||
*
|
||||
*
|
||||
* A dialog to request a preferencePack name and a set of preferencePack templates.
|
||||
*
|
||||
* \author Chris Hennes
|
||||
*/
|
||||
class GuiExport DlgPreferencePackManagementImp : public QDialog
|
||||
|
||||
@@ -53,7 +53,7 @@ DlgRevertToBackupConfigImp::~DlgRevertToBackupConfigImp()
|
||||
void Gui::Dialog::DlgRevertToBackupConfigImp::onItemSelectionChanged()
|
||||
{
|
||||
auto items = ui->listWidget->selectedItems();
|
||||
if (items.count() == 1)
|
||||
if (items.count() == 1)
|
||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(true);
|
||||
else
|
||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);
|
||||
|
||||
@@ -186,7 +186,7 @@ A VBO is an OpenGL feature that provides methods for uploading
|
||||
vertex data (position, normal vector, color, etc.) to the graphics card.
|
||||
VBOs offer substantial performance gains because the data resides
|
||||
in the graphics memory rather than the system memory and so it
|
||||
can be rendered directly by GPU.
|
||||
can be rendered directly by GPU.
|
||||
|
||||
Note: Sometimes this feature may lead to a host of different
|
||||
issues ranging from graphical anomalies to GPU crash bugs. Remember to
|
||||
@@ -222,7 +222,7 @@ report this setting as enabled when seeking support on the FreeCAD forums</strin
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>'Render Caching' is another way to say 'Rendering Acceleration'.
|
||||
There are 3 options available to achieve this:
|
||||
There are 3 options available to achieve this:
|
||||
1) 'Auto' (default), let Coin3D decide where to cache.
|
||||
2) 'Distributed', manually turn on cache for all view provider root node.
|
||||
3) 'Centralized', manually turn off cache in all nodes of all view provider, and
|
||||
|
||||
@@ -41,7 +41,7 @@ const uint DlgSettingsLazyLoadedImp::WorkbenchNameRole = Qt::UserRole;
|
||||
/* TRANSLATOR Gui::Dialog::DlgSettingsLazyLoadedImp */
|
||||
|
||||
/**
|
||||
* Constructs a DlgSettingsLazyLoadedImp
|
||||
* Constructs a DlgSettingsLazyLoadedImp
|
||||
*/
|
||||
DlgSettingsLazyLoadedImp::DlgSettingsLazyLoadedImp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
@@ -74,7 +74,7 @@ void DlgSettingsLazyLoadedImp::saveSettings()
|
||||
|
||||
void DlgSettingsLazyLoadedImp::loadSettings()
|
||||
{
|
||||
// There are two different "autoload" settings: the first, in FreeCAD since 2004,
|
||||
// There are two different "autoload" settings: the first, in FreeCAD since 2004,
|
||||
// controls the module the user sees first when starting FreeCAD, and defaults to the Start workbench
|
||||
std::string start = App::Application::Config()["StartWorkbench"];
|
||||
_startupModule = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")->
|
||||
@@ -111,7 +111,7 @@ void DlgSettingsLazyLoadedImp::buildUnloadedWorkbenchList()
|
||||
{
|
||||
QStringList workbenches = Application::Instance->workbenches();
|
||||
workbenches.sort();
|
||||
|
||||
|
||||
ui->workbenchTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||
ui->workbenchTable->setRowCount(0);
|
||||
_autoloadCheckboxes.clear(); // setRowCount(0) just invalidated all of these pointers
|
||||
@@ -146,14 +146,14 @@ void DlgSettingsLazyLoadedImp::buildUnloadedWorkbenchList()
|
||||
auto textLabel = new QLabel(wbDisplayName);
|
||||
textLabel->setToolTip(wbTooltip);
|
||||
ui->workbenchTable->setCellWidget(rowNumber, 1, textLabel);
|
||||
|
||||
|
||||
// Column 3: Autoloaded checkbox
|
||||
//
|
||||
//
|
||||
// To get the checkbox centered, we have to jump through some hoops...
|
||||
auto checkWidget = new QWidget(this);
|
||||
auto autoloadCheckbox = new QCheckBox(this);
|
||||
autoloadCheckbox->setToolTip(tr("If checked") +
|
||||
QString::fromUtf8(", ") + wbDisplayName + QString::fromUtf8(" ") +
|
||||
autoloadCheckbox->setToolTip(tr("If checked") +
|
||||
QString::fromUtf8(", ") + wbDisplayName + QString::fromUtf8(" ") +
|
||||
tr("will be loaded automatically when FreeCAD starts up"));
|
||||
auto checkLayout = new QHBoxLayout(checkWidget);
|
||||
checkLayout->addWidget(autoloadCheckbox);
|
||||
@@ -175,13 +175,13 @@ void DlgSettingsLazyLoadedImp::buildUnloadedWorkbenchList()
|
||||
_autoloadCheckboxes.insert(std::make_pair(wbName, autoloadCheckbox));
|
||||
}
|
||||
ui->workbenchTable->setCellWidget(rowNumber, 2, checkWidget);
|
||||
|
||||
|
||||
// Column 4: Load button/loaded indicator
|
||||
if (WorkbenchManager::instance()->getWorkbench(wbName.toStdString())) {
|
||||
auto label = new QLabel(tr("Loaded"));
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
ui->workbenchTable->setCellWidget(rowNumber, 3, label);
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto button = new QPushButton(tr("Load now"));
|
||||
connect(button, &QPushButton::clicked, this, [this,wbName]() { onLoadClicked(wbName); });
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
if(count)
|
||||
*count = propSize;
|
||||
}
|
||||
if(v)
|
||||
if(v)
|
||||
*v = QString::fromLatin1(propName);
|
||||
return;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ private:
|
||||
* @param parent Parent object owning the completer.
|
||||
*/
|
||||
|
||||
ExpressionCompleter::ExpressionCompleter(const App::DocumentObject * currentDocObj,
|
||||
ExpressionCompleter::ExpressionCompleter(const App::DocumentObject * currentDocObj,
|
||||
QObject *parent, bool noProperty, bool checkInList)
|
||||
: QCompleter(parent), currentObj(currentDocObj)
|
||||
, noProperty(noProperty), checkInList(checkInList)
|
||||
|
||||
@@ -48,7 +48,7 @@ class GuiExport ExpressionCompleter : public QCompleter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExpressionCompleter(const App::DocumentObject * currentDocObj,
|
||||
ExpressionCompleter(const App::DocumentObject * currentDocObj,
|
||||
QObject *parent = nullptr, bool noProperty = false, bool checkInList = true);
|
||||
|
||||
void getPrefixRange(int &start, int &end) const {
|
||||
|
||||
@@ -114,7 +114,7 @@ void SoAutoZoomTranslation::doAction(SoAction * action)
|
||||
// scaleFactor.setValue(SbVec3f(sf,sf,sf));
|
||||
// //this->enableNotify ( true );
|
||||
// //scaleFactor.setDirty (true);
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
void SoAutoZoomTranslation::getMatrix(SoGetMatrixAction * action)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="BaseClassPy"
|
||||
Name="LinkViewPy"
|
||||
Twin="LinkView"
|
||||
TwinPointer="LinkView"
|
||||
Include="Gui/ViewProviderLink.h"
|
||||
Namespace="Gui"
|
||||
<PythonExport
|
||||
Father="BaseClassPy"
|
||||
Name="LinkViewPy"
|
||||
Twin="LinkView"
|
||||
TwinPointer="LinkView"
|
||||
Include="Gui/ViewProviderLink.h"
|
||||
Namespace="Gui"
|
||||
FatherInclude="Base/BaseClass.h"
|
||||
FatherNamespace="Base"
|
||||
Constructor="true"
|
||||
@@ -26,10 +26,10 @@
|
||||
setMaterial(Material): set the override material of the entire linked object
|
||||
|
||||
setMaterial([Material,...]): set the materials for the elements of the link
|
||||
array/group.
|
||||
array/group.
|
||||
|
||||
setMaterial({Int:Material,...}): set the material for the elements of the
|
||||
link array/group by index.
|
||||
link array/group by index.
|
||||
|
||||
If material is None, then the material is unset. If the material of an element
|
||||
is unset, it defaults to the override material of the linked object, if there
|
||||
@@ -70,15 +70,15 @@ setTransform({index:matrix,...}): set transformation for elements of the link
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setChildren([obj...],vis=[],type=0)
|
||||
Group a list of children objects. Note, this mode of operation is incompatible
|
||||
Group a list of children objects. Note, this mode of operation is incompatible
|
||||
with link array. Calling this function will deactivate link array. And calling
|
||||
setSize() will reset all linked children.
|
||||
|
||||
vis: initial visibility status of the children
|
||||
|
||||
type: children linking type,
|
||||
0: override transformation and visibility,
|
||||
1: override visibility,
|
||||
type: children linking type,
|
||||
0: override transformation and visibility,
|
||||
1: override visibility,
|
||||
2: override none.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BASE_PREFERENCEPACKMANAGER_H
|
||||
#define BASE_PREFERENCEPACKMANAGER_H
|
||||
#ifndef BASE_PREFERENCEPACKMANAGER_H
|
||||
#define BASE_PREFERENCEPACKMANAGER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -78,10 +78,10 @@ namespace Gui {
|
||||
|
||||
/**
|
||||
* \class PreferencePackManager handles storable and loadable collections of user preferences
|
||||
*
|
||||
*
|
||||
* This class provides some additional utility functions for allowing users to save their current
|
||||
* preferences as a PreferencePack based on a set of template files provided either in the main
|
||||
* FreeCAD distribution, or inside various installed mods.
|
||||
* FreeCAD distribution, or inside various installed mods.
|
||||
*/
|
||||
class PreferencePackManager {
|
||||
public:
|
||||
@@ -129,36 +129,36 @@ namespace Gui {
|
||||
|
||||
|
||||
/**
|
||||
* \struct TemplateFile A file containing a set of preferences that can be saved into
|
||||
* \struct TemplateFile A file containing a set of preferences that can be saved into
|
||||
* a PreferencePack
|
||||
*
|
||||
* PreferencePacks can contain any parameters at all, but inside FreeCAD there is no
|
||||
* centralized list of all of these parameters, and at any given time the user.cfg file
|
||||
* usually does not store a value for all possible parameters. Instead, it simply allows
|
||||
* calling code to use whatever default values that code sets. This is all completely
|
||||
* PreferencePacks can contain any parameters at all, but inside FreeCAD there is no
|
||||
* centralized list of all of these parameters, and at any given time the user.cfg file
|
||||
* usually does not store a value for all possible parameters. Instead, it simply allows
|
||||
* calling code to use whatever default values that code sets. This is all completely
|
||||
* hidden from the users: FreeCAD behaves as though those values exist in the config file.
|
||||
*
|
||||
* When a user saves their current configuration as a pack, they likely expect that saved
|
||||
* configuration to include those default values, so that if they later apply their saved
|
||||
* configuration those defaults are restored. To enable this a set of template files
|
||||
* listing default values for various types of parameters can be used. Each file is
|
||||
* presented to the user as a checkable box when saving a new preferences pack, and the
|
||||
* intention is that these files will list out the various user-facing parameters that
|
||||
*
|
||||
* When a user saves their current configuration as a pack, they likely expect that saved
|
||||
* configuration to include those default values, so that if they later apply their saved
|
||||
* configuration those defaults are restored. To enable this a set of template files
|
||||
* listing default values for various types of parameters can be used. Each file is
|
||||
* presented to the user as a checkable box when saving a new preferences pack, and the
|
||||
* intention is that these files will list out the various user-facing parameters that
|
||||
* someone might want to save into a preferences pack.
|
||||
*
|
||||
*
|
||||
* These files are themselves valid user.cfg files, that if loaded and applied will result
|
||||
* in the default values of their contained variables being set. For this to work, these
|
||||
* files should be kept up-to-date with the default values set in the code. They are not
|
||||
* in the default values of their contained variables being set. For this to work, these
|
||||
* files should be kept up-to-date with the default values set in the code. They are not
|
||||
* required to contain an exhaustive listing of all possible parameters: in most cases it
|
||||
* is enough that they list the variables that a user would expect for a given name. For
|
||||
* example, "Sketcher Colors.cfg" should list out all of the default colors used in
|
||||
* Sketcher that a user can set in Preferences, but it is not necessary that it contain any
|
||||
* color that is only used internally, and it should not include things like fonts, or
|
||||
* color that is only used internally, and it should not include things like fonts, or
|
||||
* behavior information.
|
||||
*
|
||||
*
|
||||
* The base FreeCAD installation includes default templates in:
|
||||
* $INSTALL_DIR/data/Gui/PreferencePackTemplates/
|
||||
*
|
||||
*
|
||||
* External add-ons are also searched for any directory called PreferencePackTemplates or
|
||||
* preference_pack_templates -- either of which is expected to contain appearance and/or
|
||||
* behavior subdirectories. In this way external add-ons can allow a user to easily save
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<FCUInt Name="colorError" Value="4287006463"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
<FCUInt Name="Current line highlight" Value="774778368"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
<FCText Name="Font">Courier</FCText>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
<FCUInt Name="CreateLineColor" Value="3435973887"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
<FCText Name="StyleSheet"></FCText>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
ExpressionLabel(QWidget * parent) : QLabel(parent) { }
|
||||
|
||||
void setExpressionText(const QString& text) {
|
||||
if (text.isEmpty())
|
||||
if (text.isEmpty())
|
||||
this->setToolTip(genericFormulaEditorTooltip);
|
||||
else
|
||||
else
|
||||
this->setToolTip(formulaEditorTooltipPrefix + text);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ If you would like to change the overall look/style of the theme, just find and r
|
||||
! If you find not matching or unreadable sections in FreeCAD please tell Chrismettal or open up a PR yourself !
|
||||
|
||||
BACKGROUND (darker to lighter)
|
||||
#65A2E5
|
||||
#65A2E5
|
||||
#1e1e1e
|
||||
#3c3c3c
|
||||
#434D5B
|
||||
#232932 = top menu background etc
|
||||
#646464
|
||||
#232932 = main background color
|
||||
#232932 = main background color
|
||||
#787878
|
||||
#8c8c8c
|
||||
#a0a0a0
|
||||
@@ -45,7 +45,7 @@ If you would like to change the overall look/style of the theme, just find and r
|
||||
#232932 = console color
|
||||
#d2d2d2
|
||||
#588AC1 = top menu item
|
||||
#588AC2
|
||||
#588AC2
|
||||
white
|
||||
|
||||
SELECTION (darker to lighter)
|
||||
@@ -138,8 +138,8 @@ Sub windows
|
||||
==================================================================================================*/
|
||||
QMdiSubWindow {
|
||||
border:1px solid #121512;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
margin-bottom:4px;
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ Sub windows
|
||||
==================================================================================================*/
|
||||
QMdiSubWindow {
|
||||
border:1px solid #333333;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
margin-bottom:4px;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ based on the stock theme from FreeCAD by Pablo Gil Fernández
|
||||
|
||||
KNOWN BUGS and TO DO
|
||||
============================================================================================================
|
||||
Please, follow the link to get updated information:
|
||||
Please, follow the link to get updated information:
|
||||
https://forum.freecadweb.org/viewtopic.php?f=34&t=55134&sid=0466734fc3349eccd8921eb356f70ad7
|
||||
|
||||
LICENSE
|
||||
@@ -24,9 +24,9 @@ INSTALLATION
|
||||
WINDOWS = C:/[INSTALLATION_PATH]/FreeCAD/data/Gui/Stylesheets/
|
||||
LINUX = /home/[YOUR_USER_NAME]/.FreeCAD/Gui/Stylesheets/
|
||||
|
||||
============================================================================================================
|
||||
============================================================================================================
|
||||
THESE COLOURS WERE USED AS TEMP SCRATCHPAD FOR DESIGNING. PLEASE DISREGARD!
|
||||
|
||||
|
||||
BACKGROUND (darker to lighter)
|
||||
black
|
||||
#1e1e1e
|
||||
@@ -112,8 +112,8 @@ Sub windows
|
||||
==================================================================================================*/
|
||||
QMdiSubWindow {
|
||||
border:1px solid #333333;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-top: 30px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
margin-bottom:4px;
|
||||
}
|
||||
@@ -575,7 +575,7 @@ QTabWidget::tab-bar:right {
|
||||
|
||||
QTabBar {
|
||||
qproperty-drawBase: 0; /* important */
|
||||
background-color: transparent; /* Hack for Undocked white background - was transparent*/
|
||||
background-color: transparent; /* Hack for Undocked white background - was transparent*/
|
||||
}
|
||||
|
||||
/* Workaround for QTabBars created from docked QDockWidgets which don't draw the border if not set and reset as follows: */
|
||||
@@ -1214,7 +1214,7 @@ QSint--ActionGroup QFrame[class="content"] > QWidget > QPushButton {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/* Fix for lists inside task panels */ /* sketcher constraints list */
|
||||
/* Fix for lists inside task panels */ /* sketcher constraints list */
|
||||
QSint--ActionGroup QFrame[class="content"] QTreeView,
|
||||
QSint--ActionGroup QFrame[class="content"] QListView,
|
||||
QSint--ActionGroup QFrame[class="content"] QTableView {
|
||||
@@ -1770,8 +1770,8 @@ QDialog QToolButton:focus {
|
||||
QDialog QToolButton:disabled,
|
||||
QDialog QToolButton:disabled:checked {
|
||||
color: #f5f5f5;
|
||||
background-color: #2a2a2a;
|
||||
border: 1px solid #2a2a2a;
|
||||
background-color: #2a2a2a;
|
||||
border: 1px solid #2a2a2a;
|
||||
}
|
||||
|
||||
QDialog QToolButton:pressed {
|
||||
|
||||
@@ -2114,7 +2114,7 @@ std::vector<App::DocumentObject*> ViewProviderLink::claimChildren() const {
|
||||
}
|
||||
} else if(hasElements(ext) || isGroup(ext)) {
|
||||
ret = ext->getElementListValue();
|
||||
if (ext->_getElementCountValue()
|
||||
if (ext->_getElementCountValue()
|
||||
&& ext->getLinkClaimChildValue()
|
||||
&& ext->getLinkedObjectValue())
|
||||
ret.insert(ret.begin(), ext->getLinkedObjectValue());
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="ViewProviderDocumentObjectPy"
|
||||
Name="ViewProviderLinkPy"
|
||||
Twin="ViewProviderLink"
|
||||
TwinPointer="ViewProviderLink"
|
||||
Include="Gui/ViewProviderLink.h"
|
||||
Namespace="Gui"
|
||||
<PythonExport
|
||||
Father="ViewProviderDocumentObjectPy"
|
||||
Name="ViewProviderLinkPy"
|
||||
Twin="ViewProviderLink"
|
||||
TwinPointer="ViewProviderLink"
|
||||
Include="Gui/ViewProviderLink.h"
|
||||
Namespace="Gui"
|
||||
FatherInclude="Gui/ViewProviderDocumentObjectPy.h"
|
||||
FatherNamespace="Gui">
|
||||
<Documentation>
|
||||
|
||||
@@ -116,7 +116,7 @@ QIcon ViewProviderPart::getIcon() const
|
||||
const char* pixmap = sPixmap;
|
||||
// if it's flagged as an Assembly in its Type, it gets another icon
|
||||
if (part->Type.getStrValue() == "Assembly") { pixmap = aPixmap; }
|
||||
|
||||
|
||||
return mergeGreyableOverlayIcons (Gui::BitmapFactory().pixmap(pixmap));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
bool doubleClicked() override;
|
||||
void setupContextMenu(QMenu* menu, QObject* receiver, const char* member) override;
|
||||
|
||||
|
||||
/// deliver the icon shown in the tree view
|
||||
/// override from ViewProvider.h
|
||||
QIcon getIcon() const override;
|
||||
|
||||
Reference in New Issue
Block a user