+ fix more compiler warnings
This commit is contained in:
parent
cc775f9254
commit
346e5c6a77
|
@ -119,7 +119,7 @@ FeatureTest::~FeatureTest()
|
|||
DocumentObjectExecReturn *FeatureTest::execute(void)
|
||||
{
|
||||
|
||||
int *i,j;
|
||||
int *i=0,j;
|
||||
float f;
|
||||
void *s;
|
||||
|
||||
|
|
|
@ -301,7 +301,6 @@ bool FileInfo::isWritable () const
|
|||
|
||||
bool FileInfo::setPermissions (Permissions perms)
|
||||
{
|
||||
bool ret = false;
|
||||
int mode = 0;
|
||||
|
||||
if (perms & FileInfo::ReadOnly)
|
||||
|
|
|
@ -136,26 +136,48 @@ QString UnitsApi::schemaTranslate(Base::Quantity quant,double &factor,QString &u
|
|||
// return PyFloat_FromDouble(Value * UserPrefFactor[t]);
|
||||
//}
|
||||
//
|
||||
double UnitsApi::toDbl(PyObject *ArgObj,const Base::Unit &u)
|
||||
{
|
||||
if (PyString_Check(ArgObj))
|
||||
QString str = QString::fromAscii(PyString_AsString(ArgObj));
|
||||
else if (PyFloat_Check(ArgObj))
|
||||
double d = PyFloat_AsDouble(ArgObj);
|
||||
else if (PyInt_Check(ArgObj))
|
||||
double d = (double)PyInt_AsLong(ArgObj);
|
||||
else
|
||||
throw Base::Exception("Wrong parameter type!");
|
||||
|
||||
return 0.0;
|
||||
double UnitsApi::toDbl(PyObject *ArgObj, const Base::Unit &u)
|
||||
{
|
||||
if (PyString_Check(ArgObj)) {
|
||||
// Parse the string
|
||||
QString str = QString::fromLatin1(PyString_AsString(ArgObj));
|
||||
Quantity q = Quantity::parse(str);
|
||||
if (q.getUnit() == u)
|
||||
return q.getValue();
|
||||
throw Base::Exception("Wrong unit type!");
|
||||
}
|
||||
else if (PyFloat_Check(ArgObj)) {
|
||||
return PyFloat_AsDouble(ArgObj);
|
||||
}
|
||||
else if (PyInt_Check(ArgObj)) {
|
||||
return static_cast<double>(PyInt_AsLong(ArgObj));
|
||||
}
|
||||
else {
|
||||
throw Base::Exception("Wrong parameter type!");
|
||||
}
|
||||
}
|
||||
|
||||
Quantity UnitsApi::toQuantity(PyObject *ArgObj,const Base::Unit &u)
|
||||
Quantity UnitsApi::toQuantity(PyObject *ArgObj, const Base::Unit &u)
|
||||
{
|
||||
double d;
|
||||
if (PyString_Check(ArgObj)) {
|
||||
// Parse the string
|
||||
QString str = QString::fromLatin1(PyString_AsString(ArgObj));
|
||||
Quantity q = Quantity::parse(str);
|
||||
d = q.getValue();
|
||||
}
|
||||
else if (PyFloat_Check(ArgObj)) {
|
||||
d = PyFloat_AsDouble(ArgObj);
|
||||
}
|
||||
else if (PyInt_Check(ArgObj)) {
|
||||
d = static_cast<double>(PyInt_AsLong(ArgObj));
|
||||
}
|
||||
else {
|
||||
throw Base::Exception("Wrong parameter type!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Quantity();
|
||||
return Quantity(d,u);
|
||||
}
|
||||
|
||||
void UnitsApi::setDecimals(int prec)
|
||||
|
|
|
@ -65,11 +65,11 @@ public:
|
|||
static UnitSystem getSchema(void){return actSystem;}
|
||||
|
||||
static QString schemaTranslate(Base::Quantity quant,double &factor,QString &unitString);
|
||||
static QString schemaTranslate(Base::Quantity quant){ // to satisfy GCC
|
||||
double dummy1;
|
||||
QString dummy2;
|
||||
return UnitsApi::schemaTranslate(quant,dummy1,dummy2);
|
||||
}
|
||||
static QString schemaTranslate(Base::Quantity quant){ // to satisfy GCC
|
||||
double dummy1;
|
||||
QString dummy2;
|
||||
return UnitsApi::schemaTranslate(quant,dummy1,dummy2);
|
||||
}
|
||||
/// generate a value for a quantity with default user prefered system
|
||||
static double toDbl(PyObject *ArgObj,const Base::Unit &u=Base::Unit());
|
||||
/// generate a value for a quantity with default user prefered system
|
||||
|
|
|
@ -108,7 +108,7 @@ QVariant ButtonModel::data (const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
void ButtonModel::insertRows(int number)
|
||||
void ButtonModel::insertButtonRows(int number)
|
||||
{
|
||||
int buttonCount = spaceballButtonGroup()->GetGroups().size();
|
||||
beginInsertRows(QModelIndex(), buttonCount, number-buttonCount+1);
|
||||
|
@ -134,7 +134,7 @@ void ButtonModel::goButtonPress(int number)
|
|||
QString numberString;
|
||||
numberString.setNum(number);
|
||||
if (!spaceballButtonGroup()->HasGroup(numberString.toAscii()))
|
||||
insertRows(number);
|
||||
insertButtonRows(number);
|
||||
}
|
||||
|
||||
void ButtonModel::goMacroRemoved(const QByteArray& macroName)
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Gui
|
|||
ButtonModel(QObject *parent);
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
void insertRows(int number);
|
||||
void insertButtonRows(int number);
|
||||
void setCommand(int row, QString command);
|
||||
void goButtonPress(int number);
|
||||
void goMacroRemoved(const QByteArray& macroName);
|
||||
|
|
|
@ -122,8 +122,8 @@ protected:
|
|||
void changeEvent(QEvent *e);
|
||||
void showEvent(QShowEvent*);
|
||||
void resizeEvent(QResizeEvent*);
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
||||
protected Q_SLOTS:
|
||||
void changeGroup(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void on_buttonBox_clicked(QAbstractButton*);
|
||||
void resizeWindow(int w, int h);
|
||||
|
@ -138,9 +138,9 @@ private:
|
|||
private:
|
||||
typedef std::pair<std::string, std::list<std::string> > TGroupPages;
|
||||
static std::list<TGroupPages> _pages; /**< Name of all registered preference pages */
|
||||
Ui_DlgPreferences* ui;
|
||||
bool invalidParameter;
|
||||
bool canEmbedScrollArea;
|
||||
Ui_DlgPreferences* ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
|
|
@ -61,7 +61,12 @@ using namespace Gui;
|
|||
PROPERTY_SOURCE_ABSTRACT(Gui::ViewProvider, App::PropertyContainer)
|
||||
|
||||
ViewProvider::ViewProvider()
|
||||
: pcAnnotation(0), pyViewObject(0), _iActualMode(-1), _iEditMode(-1), _updateData(true), viewOverrideMode(-1)
|
||||
: pcAnnotation(0)
|
||||
, pyViewObject(0)
|
||||
, _iActualMode(-1)
|
||||
, _iEditMode(-1)
|
||||
, viewOverrideMode(-1)
|
||||
, _updateData(true)
|
||||
{
|
||||
pcRoot = new SoSeparator();
|
||||
pcRoot->ref();
|
||||
|
|
|
@ -1010,7 +1010,6 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant)
|
|||
q = Base::Quantity(value.y, Base::Unit::Length);
|
||||
unit + QString::fromLatin1("'%1 %2'").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
q = Base::Quantity(value.z, Base::Unit::Length);
|
||||
QString::fromLatin1("'%1 %2')").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
|
||||
setPropertyValue(unit);
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ void ViewProviderRuledSurface::updateData(const App::Property* prop)
|
|||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
//const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
// (prop)->getValues();
|
||||
}
|
||||
/* //The following hides the Children shapes. If the edges from which the Ruled Surface was created
|
||||
* were selected from the subshapes of another shape, it is likely that one would not want to hide the shape
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
# include <TopoDS_Wire.hxx>
|
||||
# include <TopoDS_Face.hxx>
|
||||
# include <TopoDS_Shape.hxx>
|
||||
# include <TopoDS_Shell.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
|
@ -111,7 +112,7 @@ void ViewProviderSpline::showControlPoints(bool show, const App::Property* prop)
|
|||
|
||||
for (TopExp_Explorer xp(shape, TopAbs_SHELL); xp.More(); xp.Next()) {
|
||||
const TopoDS_Shell& shell = TopoDS::Shell(xp.Current());
|
||||
for (TopExp_Explorer xp2(xp.Current(), TopAbs_FACE); xp2.More(); xp2.Next()) {
|
||||
for (TopExp_Explorer xp2(shell, TopAbs_FACE); xp2.More(); xp2.Next()) {
|
||||
const TopoDS_Face& face = TopoDS::Face(xp2.Current());
|
||||
showControlPointsOfFace(face);
|
||||
}
|
||||
|
@ -122,7 +123,7 @@ void ViewProviderSpline::showControlPoints(bool show, const App::Property* prop)
|
|||
}
|
||||
for (TopExp_Explorer xp(shape, TopAbs_WIRE, TopAbs_FACE); xp.More(); xp.Next()) {
|
||||
const TopoDS_Wire& wire = TopoDS::Wire(xp.Current());
|
||||
for (TopExp_Explorer xp2(xp.Current(), TopAbs_EDGE); xp2.More(); xp2.Next()) {
|
||||
for (TopExp_Explorer xp2(wire, TopAbs_EDGE); xp2.More(); xp2.Next()) {
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(xp2.Current());
|
||||
showControlPointsOfEdge(edge);
|
||||
}
|
||||
|
|
|
@ -88,9 +88,7 @@ void CmdSketcherToggleConstruction::activated(int iMsg)
|
|||
|
||||
// get the needed lists and objects
|
||||
const std::vector<std::string> &SubNames = selection[0].getSubNames();
|
||||
Sketcher::SketchObject* Obj = dynamic_cast<Sketcher::SketchObject*>(selection[0].getObject());
|
||||
const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues();
|
||||
|
||||
|
||||
// undo command open
|
||||
openCommand("toggle draft from/to draft");
|
||||
|
||||
|
|
|
@ -2925,9 +2925,6 @@ public:
|
|||
EditCurve[35] = EditCurve[0] ;
|
||||
//EditCurve[34] = EditCurve[0];
|
||||
|
||||
// Display radius for user
|
||||
float radius = (onSketchPos - EditCurve[0]).Length();
|
||||
|
||||
SbString text;
|
||||
text.sprintf(" (%.1fR %.1fL)", r,lx);
|
||||
setPositionText(onSketchPos, text);
|
||||
|
|
|
@ -341,6 +341,8 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>
|
|||
,geoId1, it->GeoId
|
||||
);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
@ -387,10 +389,14 @@ void DrawSketchHandler::renderSuggestConstraintsCursor(std::vector<AutoConstrain
|
|||
case Tangent:
|
||||
iconType = QString::fromAscii("Constraint_Tangent");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QPixmap icon = Gui::BitmapFactory().pixmap(iconType.toAscii()).scaledToWidth(iconSize);
|
||||
qp.drawPixmap(QPoint(baseIcon.width() + i * iconSize, baseIcon.height() - iconSize), icon);
|
||||
if (!iconType.isEmpty()) {
|
||||
QPixmap icon = Gui::BitmapFactory().pixmap(iconType.toAscii()).scaledToWidth(iconSize);
|
||||
qp.drawPixmap(QPoint(baseIcon.width() + i * iconSize, baseIcon.height() - iconSize), icon);
|
||||
}
|
||||
}
|
||||
|
||||
qp.end(); // Finish painting
|
||||
|
|
|
@ -291,7 +291,6 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
|
|||
float length = this->param1.getValue();
|
||||
float startangle = this->param2.getValue();
|
||||
float range = this->param3.getValue();
|
||||
float endangle = startangle + range;
|
||||
|
||||
float r = 2*length;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com *
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -56,38 +56,50 @@ using namespace Gui::TaskView;
|
|||
/// CMDSTR is the string registered in the commandManager
|
||||
/// FUNC is the name of the member function to be executed on selection of the menu item
|
||||
/// ACTSONSELECTION is a true/false value to activate the command only if a selection is made
|
||||
#define CONTEXT_ITEM(ICONSTR,NAMESTR,CMDSTR,FUNC,ACTSONSELECTION) \
|
||||
QIcon icon_ ## FUNC( Gui::BitmapFactory().pixmap(ICONSTR) ); \
|
||||
QAction* constr_ ## FUNC = menu.addAction(icon_ ## FUNC,tr(NAMESTR), this, SLOT(FUNC()), \
|
||||
QKeySequence(QString::fromUtf8(Gui::Application::Instance->commandManager().getCommandByName(CMDSTR)->getAccel()))); \
|
||||
#define CONTEXT_ITEM(ICONSTR,NAMESTR,CMDSTR,FUNC,ACTSONSELECTION) \
|
||||
QIcon icon_ ## FUNC( Gui::BitmapFactory().pixmap(ICONSTR) ); \
|
||||
QAction* constr_ ## FUNC = menu.addAction(icon_ ## FUNC,tr(NAMESTR), this, SLOT(FUNC()), \
|
||||
QKeySequence(QString::fromUtf8(Gui::Application::Instance->commandManager().getCommandByName(CMDSTR)->getAccel()))); \
|
||||
if(ACTSONSELECTION) constr_ ## FUNC->setEnabled(!items.isEmpty()); else constr_ ## FUNC->setEnabled(true);
|
||||
|
||||
/// Defines the member function corresponding to the CONTEXT_ITEM macro
|
||||
#define CONTEXT_MEMBER_DEF(CMDSTR,FUNC) \
|
||||
void ElementView::FUNC(){ \
|
||||
#define CONTEXT_MEMBER_DEF(CMDSTR,FUNC) \
|
||||
void ElementView::FUNC(){ \
|
||||
Gui::Application::Instance->commandManager().runCommandByName(CMDSTR);}
|
||||
|
||||
|
||||
// helper class to store additional information about the listWidget entry.
|
||||
class ElementItem : public QListWidgetItem
|
||||
{
|
||||
public:
|
||||
ElementItem( const QIcon & icon, const QString & text, int elementnr,
|
||||
int startingVertex, int midVertex, int endVertex,
|
||||
Base::Type geometryType)
|
||||
: QListWidgetItem(icon,text),ElementNbr(elementnr),
|
||||
StartingVertex(startingVertex), MidVertex(midVertex), EndVertex(endVertex),
|
||||
GeometryType(geometryType),isLineSelected(false),
|
||||
isStartingPointSelected(false),isEndPointSelected(false),isMidPointSelected(false)
|
||||
ElementItem(const QIcon & icon, const QString & text, int elementnr,
|
||||
int startingVertex, int midVertex, int endVertex,
|
||||
Base::Type geometryType)
|
||||
: QListWidgetItem(icon,text)
|
||||
, ElementNbr(elementnr)
|
||||
, StartingVertex(startingVertex)
|
||||
, MidVertex(midVertex)
|
||||
, EndVertex(endVertex)
|
||||
, isLineSelected(false)
|
||||
, isStartingPointSelected(false)
|
||||
, isEndPointSelected(false)
|
||||
, isMidPointSelected(false)
|
||||
, GeometryType(geometryType)
|
||||
{
|
||||
|
||||
}
|
||||
ElementItem( const QString & text,int elementnr,
|
||||
int startingVertex, int midVertex, int endVertex,
|
||||
Base::Type geometryType)
|
||||
: QListWidgetItem(text),ElementNbr(elementnr),
|
||||
StartingVertex(startingVertex), MidVertex(midVertex), EndVertex(endVertex),
|
||||
GeometryType(geometryType),isLineSelected(false),
|
||||
isStartingPointSelected(false),isEndPointSelected(false),isMidPointSelected(false)
|
||||
ElementItem(const QString & text,int elementnr,
|
||||
int startingVertex, int midVertex, int endVertex,
|
||||
Base::Type geometryType)
|
||||
: QListWidgetItem(text)
|
||||
, ElementNbr(elementnr)
|
||||
, StartingVertex(startingVertex)
|
||||
, MidVertex(midVertex)
|
||||
, EndVertex(endVertex)
|
||||
, isLineSelected(false)
|
||||
, isStartingPointSelected(false)
|
||||
, isEndPointSelected(false)
|
||||
, isMidPointSelected(false)
|
||||
, GeometryType(geometryType)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -118,7 +130,6 @@ ElementView::~ElementView()
|
|||
void ElementView::contextMenuEvent (QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QListWidgetItem* item = currentItem();
|
||||
QList<QListWidgetItem *> items = selectedItems();
|
||||
|
||||
// CONTEXT_ITEM(ICONSTR,NAMESTR,FUNC,KEY)
|
||||
|
@ -138,11 +149,11 @@ void ElementView::contextMenuEvent (QContextMenuEvent* event)
|
|||
CONTEXT_ITEM("Constraint_Radius","Radius Constraint","Sketcher_ConstrainRadius",doRadiusConstraint,true)
|
||||
CONTEXT_ITEM("Constraint_InternalAngle","Angle Constraint","Sketcher_ConstrainAngle",doAngleConstraint,true)
|
||||
|
||||
QAction* sep = menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
CONTEXT_ITEM("Sketcher_AlterConstruction","Toggle construction line","Sketcher_ToggleConstruction",doToggleConstruction,true)
|
||||
|
||||
QAction* sep1 = menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
CONTEXT_ITEM("Sketcher_CloseShape","Close Shape","Sketcher_CloseShape",doCloseShape,true)
|
||||
CONTEXT_ITEM("Sketcher_ConnectLines","Connect","Sketcher_ConnectLines",doConnect,true)
|
||||
|
@ -151,7 +162,7 @@ void ElementView::contextMenuEvent (QContextMenuEvent* event)
|
|||
CONTEXT_ITEM("Sketcher_SelectHorizontalAxis","Select Horizontal Axis","Sketcher_SelectHorizontalAxis",doSelectHAxis,false)
|
||||
CONTEXT_ITEM("Sketcher_SelectVerticalAxis","Select Vertical Axis","Sketcher_SelectVerticalAxis",doSelectVAxis,false)
|
||||
|
||||
QAction* sep2 = menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* remove = menu.addAction(tr("Delete"), this, SLOT(deleteSelectedItems()),
|
||||
QKeySequence(QKeySequence::Delete));
|
||||
|
@ -207,24 +218,29 @@ void ElementView::keyPressEvent(QKeyEvent * event)
|
|||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Z:
|
||||
// signal
|
||||
onFilterShortcutPressed();
|
||||
break;
|
||||
// signal
|
||||
onFilterShortcutPressed();
|
||||
break;
|
||||
default:
|
||||
QListWidget::keyPressEvent( event );
|
||||
break;
|
||||
QListWidget::keyPressEvent( event );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0),
|
||||
sketchView(sketchView), inhibitSelectionUpdate(false), focusItemIndex(-1),
|
||||
isNamingBoxChecked(false), isautoSwitchBoxChecked(false), previouslySelectedItemIndex(-1)
|
||||
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0)
|
||||
, sketchView(sketchView)
|
||||
, ui(new Ui_TaskSketcherElements())
|
||||
, focusItemIndex(-1)
|
||||
, previouslySelectedItemIndex(-1)
|
||||
, isNamingBoxChecked(false)
|
||||
, isautoSwitchBoxChecked(false)
|
||||
, inhibitSelectionUpdate(false)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskSketcherElements();
|
||||
ui->setupUi(proxy);
|
||||
ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers);
|
||||
|
@ -287,7 +303,7 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
{
|
||||
std::string temp;
|
||||
if (msg.Type == Gui::SelectionChanges::ClrSelection) {
|
||||
clearWidget();
|
||||
clearWidget();
|
||||
}
|
||||
else if (msg.Type == Gui::SelectionChanges::AddSelection ||
|
||||
msg.Type == Gui::SelectionChanges::RmvSelection) {
|
||||
|
@ -297,89 +313,91 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
strcmp(msg.pObjectName,sketchView->getSketchObject()->getNameInDocument())== 0) {
|
||||
if (msg.pSubName) {
|
||||
QString expr = QString::fromAscii(msg.pSubName);
|
||||
std::string shapetype(msg.pSubName);
|
||||
// if-else edge vertex
|
||||
if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge")
|
||||
{
|
||||
QRegExp rx(QString::fromAscii("^Edge(\\d+)$"));
|
||||
int pos = expr.indexOf(rx);
|
||||
if (pos > -1) {
|
||||
bool ok;
|
||||
int ElementId = rx.cap(1).toInt(&ok) - 1;
|
||||
if (ok) {
|
||||
int countItems = ui->listWidgetElements->count();
|
||||
for (int i=0; i < countItems; i++) {
|
||||
ElementItem* item = static_cast<ElementItem*>
|
||||
(ui->listWidgetElements->item(i));
|
||||
if (item->ElementNbr == ElementId) {
|
||||
item->isLineSelected=select;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex"){
|
||||
QRegExp rx(QString::fromAscii("^Vertex(\\d+)$"));
|
||||
int pos = expr.indexOf(rx);
|
||||
if (pos > -1) {
|
||||
bool ok;
|
||||
int ElementId = rx.cap(1).toInt(&ok) - 1;
|
||||
if (ok) {
|
||||
// Get the GeoID&Pos
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
sketchView->getSketchObject()->getGeoVertexIndex(ElementId,GeoId, PosId);
|
||||
|
||||
int countItems = ui->listWidgetElements->count();
|
||||
for (int i=0; i < countItems; i++) {
|
||||
ElementItem* item = static_cast<ElementItem*>
|
||||
(ui->listWidgetElements->item(i));
|
||||
if (item->ElementNbr == GeoId) {
|
||||
switch(PosId)
|
||||
{
|
||||
case Sketcher::start:
|
||||
item->isStartingPointSelected=select;
|
||||
break;
|
||||
case Sketcher::end:
|
||||
item->isEndPointSelected=select;
|
||||
break;
|
||||
case Sketcher::mid:
|
||||
item->isMidPointSelected=select;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// update the listwidget
|
||||
int element=ui->comboBoxElementFilter->currentIndex();
|
||||
std::string shapetype(msg.pSubName);
|
||||
// if-else edge vertex
|
||||
if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge")
|
||||
{
|
||||
QRegExp rx(QString::fromAscii("^Edge(\\d+)$"));
|
||||
int pos = expr.indexOf(rx);
|
||||
if (pos > -1) {
|
||||
bool ok;
|
||||
int ElementId = rx.cap(1).toInt(&ok) - 1;
|
||||
if (ok) {
|
||||
int countItems = ui->listWidgetElements->count();
|
||||
for (int i=0; i < countItems; i++) {
|
||||
ElementItem* item = static_cast<ElementItem*>
|
||||
(ui->listWidgetElements->item(i));
|
||||
if (item->ElementNbr == ElementId) {
|
||||
item->isLineSelected=select;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex"){
|
||||
QRegExp rx(QString::fromAscii("^Vertex(\\d+)$"));
|
||||
int pos = expr.indexOf(rx);
|
||||
if (pos > -1) {
|
||||
bool ok;
|
||||
int ElementId = rx.cap(1).toInt(&ok) - 1;
|
||||
if (ok) {
|
||||
// Get the GeoID&Pos
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
sketchView->getSketchObject()->getGeoVertexIndex(ElementId,GeoId, PosId);
|
||||
|
||||
ui->listWidgetElements->blockSignals(true);
|
||||
int countItems = ui->listWidgetElements->count();
|
||||
for (int i=0; i < countItems; i++) {
|
||||
ElementItem* item = static_cast<ElementItem*>
|
||||
(ui->listWidgetElements->item(i));
|
||||
if (item->ElementNbr == GeoId) {
|
||||
switch(PosId)
|
||||
{
|
||||
case Sketcher::start:
|
||||
item->isStartingPointSelected=select;
|
||||
break;
|
||||
case Sketcher::end:
|
||||
item->isEndPointSelected=select;
|
||||
break;
|
||||
case Sketcher::mid:
|
||||
item->isMidPointSelected=select;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// update the listwidget
|
||||
int element=ui->comboBoxElementFilter->currentIndex();
|
||||
|
||||
ui->listWidgetElements->blockSignals(true);
|
||||
|
||||
|
||||
for (int i=0;i<ui->listWidgetElements->count(); i++) {
|
||||
ElementItem * ite=static_cast<ElementItem*>(ui->listWidgetElements->item(i));
|
||||
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->setSelected(ite->isLineSelected);
|
||||
break;
|
||||
case 1:
|
||||
ite->setSelected(ite->isStartingPointSelected);
|
||||
break;
|
||||
case 2:
|
||||
ite->setSelected(ite->isEndPointSelected);
|
||||
break;
|
||||
case 3:
|
||||
ite->setSelected(ite->isMidPointSelected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<ui->listWidgetElements->count(); i++) {
|
||||
ElementItem * ite=static_cast<ElementItem*>(ui->listWidgetElements->item(i));
|
||||
|
||||
ui->listWidgetElements->blockSignals(false);
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->setSelected(ite->isLineSelected);
|
||||
break;
|
||||
case 1:
|
||||
ite->setSelected(ite->isStartingPointSelected);
|
||||
break;
|
||||
case 2:
|
||||
ite->setSelected(ite->isEndPointSelected);
|
||||
break;
|
||||
case 3:
|
||||
ite->setSelected(ite->isMidPointSelected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->listWidgetElements->blockSignals(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -409,37 +427,37 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
|
|||
bool multipleselection=true; // ctrl type of selection in listWidget
|
||||
bool multipleconsecutiveselection=false; // shift type of selection in listWidget
|
||||
|
||||
if(!inhibitSelectionUpdate){
|
||||
if(!inhibitSelectionUpdate){
|
||||
if(itf!=NULL) {
|
||||
switch(element){
|
||||
case 0:
|
||||
itf->isLineSelected=!itf->isLineSelected;
|
||||
break;
|
||||
case 1:
|
||||
itf->isStartingPointSelected=!itf->isStartingPointSelected;
|
||||
break;
|
||||
case 2:
|
||||
itf->isEndPointSelected=!itf->isEndPointSelected;
|
||||
break;
|
||||
case 3:
|
||||
itf->isMidPointSelected=!itf->isMidPointSelected;
|
||||
break;
|
||||
}
|
||||
switch(element){
|
||||
case 0:
|
||||
itf->isLineSelected=!itf->isLineSelected;
|
||||
break;
|
||||
case 1:
|
||||
itf->isStartingPointSelected=!itf->isStartingPointSelected;
|
||||
break;
|
||||
case 2:
|
||||
itf->isEndPointSelected=!itf->isEndPointSelected;
|
||||
break;
|
||||
case 3:
|
||||
itf->isMidPointSelected=!itf->isMidPointSelected;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(QApplication::keyboardModifiers()==Qt::ControlModifier)// multiple ctrl selection?
|
||||
multipleselection=true;
|
||||
multipleselection=true;
|
||||
else
|
||||
multipleselection=false;
|
||||
multipleselection=false;
|
||||
|
||||
if(QApplication::keyboardModifiers()==Qt::ShiftModifier)// multiple shift selection?
|
||||
multipleconsecutiveselection=true;
|
||||
multipleconsecutiveselection=true;
|
||||
else
|
||||
multipleconsecutiveselection=false;
|
||||
multipleconsecutiveselection=false;
|
||||
|
||||
if(multipleselection && multipleconsecutiveselection){ // ctrl takes priority over shift functionality
|
||||
multipleselection=true;
|
||||
multipleconsecutiveselection=false;
|
||||
multipleselection=true;
|
||||
multipleconsecutiveselection=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,92 +466,92 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
|
|||
|
||||
bool block = this->blockConnection(true); // avoid to be notified by itself
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
|
||||
for (int i=0;i<ui->listWidgetElements->count(); i++) {
|
||||
ElementItem * ite=static_cast<ElementItem*>(ui->listWidgetElements->item(i));
|
||||
|
||||
if(multipleselection==false && multipleconsecutiveselection==false && ite!=itf)
|
||||
{
|
||||
ite->isLineSelected=false;
|
||||
ite->isStartingPointSelected=false;
|
||||
ite->isEndPointSelected=false;
|
||||
ite->isMidPointSelected=false;
|
||||
}
|
||||
|
||||
if(multipleconsecutiveselection==true)
|
||||
{
|
||||
if( (( i>focusItemIndex && i<previouslySelectedItemIndex ) ||
|
||||
( i<focusItemIndex && i>previouslySelectedItemIndex )) &&
|
||||
previouslySelectedItemIndex>=0){
|
||||
// select the element of the Item
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->isLineSelected=true;
|
||||
break;
|
||||
case 1:
|
||||
ite->isStartingPointSelected=true;
|
||||
break;
|
||||
case 2:
|
||||
ite->isEndPointSelected=true;
|
||||
break;
|
||||
case 3:
|
||||
ite->isMidPointSelected=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// first update the listwidget
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->setSelected(ite->isLineSelected);
|
||||
break;
|
||||
case 1:
|
||||
ite->setSelected(ite->isStartingPointSelected);
|
||||
break;
|
||||
case 2:
|
||||
ite->setSelected(ite->isEndPointSelected);
|
||||
break;
|
||||
case 3:
|
||||
ite->setSelected(ite->isMidPointSelected);
|
||||
break;
|
||||
}
|
||||
|
||||
// now the scene
|
||||
std::stringstream ss;
|
||||
int vertex;
|
||||
|
||||
if(ite->isLineSelected){
|
||||
ss << "Edge" << ite->ElementNbr + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
|
||||
if(ite->isStartingPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->StartingVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(ite->isEndPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->EndVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(ite->isMidPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->MidVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
ElementItem * ite=static_cast<ElementItem*>(ui->listWidgetElements->item(i));
|
||||
|
||||
if(multipleselection==false && multipleconsecutiveselection==false && ite!=itf)
|
||||
{
|
||||
ite->isLineSelected=false;
|
||||
ite->isStartingPointSelected=false;
|
||||
ite->isEndPointSelected=false;
|
||||
ite->isMidPointSelected=false;
|
||||
}
|
||||
|
||||
if(multipleconsecutiveselection==true)
|
||||
{
|
||||
if( (( i>focusItemIndex && i<previouslySelectedItemIndex ) ||
|
||||
( i<focusItemIndex && i>previouslySelectedItemIndex )) &&
|
||||
previouslySelectedItemIndex>=0){
|
||||
// select the element of the Item
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->isLineSelected=true;
|
||||
break;
|
||||
case 1:
|
||||
ite->isStartingPointSelected=true;
|
||||
break;
|
||||
case 2:
|
||||
ite->isEndPointSelected=true;
|
||||
break;
|
||||
case 3:
|
||||
ite->isMidPointSelected=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// first update the listwidget
|
||||
switch(element){
|
||||
case 0:
|
||||
ite->setSelected(ite->isLineSelected);
|
||||
break;
|
||||
case 1:
|
||||
ite->setSelected(ite->isStartingPointSelected);
|
||||
break;
|
||||
case 2:
|
||||
ite->setSelected(ite->isEndPointSelected);
|
||||
break;
|
||||
case 3:
|
||||
ite->setSelected(ite->isMidPointSelected);
|
||||
break;
|
||||
}
|
||||
|
||||
// now the scene
|
||||
std::stringstream ss;
|
||||
int vertex;
|
||||
|
||||
if(ite->isLineSelected){
|
||||
ss << "Edge" << ite->ElementNbr + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
|
||||
if(ite->isStartingPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->StartingVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(ite->isEndPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->EndVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(ite->isMidPointSelected){
|
||||
ss.str(std::string());
|
||||
vertex= ite->MidVertex;
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
this->blockConnection(block);
|
||||
ui->listWidgetElements->blockSignals(false);
|
||||
|
@ -572,7 +590,7 @@ void TaskSketcherElements::on_listWidgetElements_itemEntered(QListWidgetItem *it
|
|||
}
|
||||
|
||||
int element=ui->comboBoxElementFilter->currentIndex();
|
||||
|
||||
|
||||
focusItemIndex=tempitemindex;
|
||||
|
||||
int vertex;
|
||||
|
@ -580,18 +598,18 @@ void TaskSketcherElements::on_listWidgetElements_itemEntered(QListWidgetItem *it
|
|||
switch(element)
|
||||
{
|
||||
case 0:
|
||||
ss << "Edge" << it->ElementNbr + 1;
|
||||
Gui::Selection().setPreselect(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
break;
|
||||
ss << "Edge" << it->ElementNbr + 1;
|
||||
Gui::Selection().setPreselect(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
vertex= sketchView->getSketchObject()->getVertexIndexGeoPos(it->ElementNbr,static_cast<Sketcher::PointPos>(element));
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().setPreselect(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
vertex= sketchView->getSketchObject()->getVertexIndexGeoPos(it->ElementNbr,static_cast<Sketcher::PointPos>(element));
|
||||
if(vertex!=-1){
|
||||
ss << "Vertex" << vertex + 1;
|
||||
Gui::Selection().setPreselect(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -631,37 +649,37 @@ void TaskSketcherElements::slotElementsChanged(void)
|
|||
Base::Type type = (*it)->getTypeId();
|
||||
|
||||
ui->listWidgetElements->addItem(new ElementItem(
|
||||
(type == Part::GeomPoint::getClassTypeId() && element==1) ? Sketcher_Element_Point_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==0) ? Sketcher_Element_Line_Edge :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==1) ? Sketcher_Element_Line_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==2) ? Sketcher_Element_Line_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==0) ? Sketcher_Element_Arc_Edge :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==1) ? Sketcher_Element_Arc_StartingPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==2) ? Sketcher_Element_Arc_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==3) ? Sketcher_Element_Arc_MidPoint :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==0) ? Sketcher_Element_Circle_Edge :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==3) ? Sketcher_Element_Circle_MidPoint :
|
||||
none,
|
||||
type == Part::GeomPoint::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Point") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Point"))) :
|
||||
type == Part::GeomLineSegment::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Line") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Line"))) :
|
||||
type == Part::GeomArcOfCircle::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Arc") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Arc"))) :
|
||||
type == Part::GeomCircle::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Circle") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Circle"))) :
|
||||
( isNamingBoxChecked ?
|
||||
(tr("Other") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Other"))),
|
||||
i-1,
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::end),
|
||||
type));
|
||||
(type == Part::GeomPoint::getClassTypeId() && element==1) ? Sketcher_Element_Point_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==0) ? Sketcher_Element_Line_Edge :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==1) ? Sketcher_Element_Line_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==2) ? Sketcher_Element_Line_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==0) ? Sketcher_Element_Arc_Edge :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==1) ? Sketcher_Element_Arc_StartingPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==2) ? Sketcher_Element_Arc_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==3) ? Sketcher_Element_Arc_MidPoint :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==0) ? Sketcher_Element_Circle_Edge :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==3) ? Sketcher_Element_Circle_MidPoint :
|
||||
none,
|
||||
type == Part::GeomPoint::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Point") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Point"))) :
|
||||
type == Part::GeomLineSegment::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Line") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Line"))) :
|
||||
type == Part::GeomArcOfCircle::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Arc") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Arc"))) :
|
||||
type == Part::GeomCircle::getClassTypeId() ? ( isNamingBoxChecked ?
|
||||
(tr("Circle") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Circle"))) :
|
||||
( isNamingBoxChecked ?
|
||||
(tr("Other") + QString::fromLatin1("(Edge%1)").arg(i)):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Other"))),
|
||||
i-1,
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::end),
|
||||
type));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,22 +702,22 @@ void TaskSketcherElements::on_listWidgetElements_filterShortcutPressed()
|
|||
|
||||
switch(element)
|
||||
{
|
||||
case 0: // Edge
|
||||
element = ( type == Part::GeomCircle::getClassTypeId() ) ? 3 : 1;
|
||||
break;
|
||||
case 1: // StartingPoint
|
||||
element = ( type == Part::GeomCircle::getClassTypeId() ) ? 3 :
|
||||
( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 2;
|
||||
break;
|
||||
case 2: // EndPoint
|
||||
element = ( type == Part::GeomLineSegment::getClassTypeId() ) ? 0 :
|
||||
( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 3;
|
||||
break;
|
||||
case 3: // MidPoint
|
||||
element = ( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
element = 0;
|
||||
case 0: // Edge
|
||||
element = ( type == Part::GeomCircle::getClassTypeId() ) ? 3 : 1;
|
||||
break;
|
||||
case 1: // StartingPoint
|
||||
element = ( type == Part::GeomCircle::getClassTypeId() ) ? 3 :
|
||||
( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 2;
|
||||
break;
|
||||
case 2: // EndPoint
|
||||
element = ( type == Part::GeomLineSegment::getClassTypeId() ) ? 0 :
|
||||
( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 3;
|
||||
break;
|
||||
case 3: // MidPoint
|
||||
element = ( type == Part::GeomPoint::getClassTypeId() ) ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
element = 0;
|
||||
}
|
||||
|
||||
ui->comboBoxElementFilter->setCurrentIndex(element);
|
||||
|
@ -710,8 +728,8 @@ void TaskSketcherElements::on_listWidgetElements_filterShortcutPressed()
|
|||
}
|
||||
else{
|
||||
element = (ui->comboBoxElementFilter->currentIndex()+1) %
|
||||
ui->comboBoxElementFilter->count();
|
||||
|
||||
ui->comboBoxElementFilter->count();
|
||||
|
||||
ui->comboBoxElementFilter->setCurrentIndex(element);
|
||||
|
||||
Gui::Selection().rmvPreselect();
|
||||
|
@ -769,7 +787,7 @@ void TaskSketcherElements::clearWidget()
|
|||
item->isLineSelected=false;
|
||||
item->isStartingPointSelected=false;
|
||||
item->isEndPointSelected=false;
|
||||
item->isMidPointSelected=false;
|
||||
item->isMidPointSelected=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -791,17 +809,17 @@ void TaskSketcherElements::updateIcons(int element)
|
|||
Base::Type type = static_cast<ElementItem *>(ui->listWidgetElements->item(i))->GeometryType;
|
||||
|
||||
ui->listWidgetElements->item(i)->setIcon(
|
||||
(type == Part::GeomPoint::getClassTypeId() && element==1) ? Sketcher_Element_Point_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==0) ? Sketcher_Element_Line_Edge :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==1) ? Sketcher_Element_Line_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==2) ? Sketcher_Element_Line_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==0) ? Sketcher_Element_Arc_Edge :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==1) ? Sketcher_Element_Arc_StartingPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==2) ? Sketcher_Element_Arc_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==3) ? Sketcher_Element_Arc_MidPoint :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==0) ? Sketcher_Element_Circle_Edge :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==3) ? Sketcher_Element_Circle_MidPoint :
|
||||
none);
|
||||
(type == Part::GeomPoint::getClassTypeId() && element==1) ? Sketcher_Element_Point_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==0) ? Sketcher_Element_Line_Edge :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==1) ? Sketcher_Element_Line_StartingPoint :
|
||||
(type == Part::GeomLineSegment::getClassTypeId() && element==2) ? Sketcher_Element_Line_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==0) ? Sketcher_Element_Arc_Edge :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==1) ? Sketcher_Element_Arc_StartingPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==2) ? Sketcher_Element_Arc_EndPoint :
|
||||
(type == Part::GeomArcOfCircle::getClassTypeId() && element==3) ? Sketcher_Element_Arc_MidPoint :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==0) ? Sketcher_Element_Circle_Edge :
|
||||
(type == Part::GeomCircle::getClassTypeId() && element==3) ? Sketcher_Element_Circle_MidPoint :
|
||||
none);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user