diff --git a/src/Gui/DlgUnitsCalculator.ui b/src/Gui/DlgUnitsCalculator.ui index 636eae6be9ce..2d74c12024d8 100644 --- a/src/Gui/DlgUnitsCalculator.ui +++ b/src/Gui/DlgUnitsCalculator.ui @@ -24,6 +24,9 @@ 0 + + Input the source value and unit + @@ -34,13 +37,19 @@ - + 100 0 + + Input here the unit for the result + + + + @@ -58,6 +67,9 @@ 0 + + Result + true @@ -67,6 +79,10 @@ + + List of last used calculations +To add a calculation press Return in the value input field + true @@ -82,7 +98,7 @@ - + 0 @@ -112,13 +128,6 @@ - - - - Help - - - @@ -134,6 +143,9 @@ + + Copy the result into the clipboard + Copy diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp index ded183021edf..c836723f9018 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -51,11 +51,10 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) this->setAttribute(Qt::WA_DeleteOnClose); connect(ui->ValueInput, SIGNAL(valueChanged(Base::Quantity)), this, SLOT(valueChanged(Base::Quantity))); - connect(ui->ValueInput, SIGNAL(returnPressed () ), this, SLOT(returnPressed())); - connect(ui->UnitInput, SIGNAL(valueChanged(Base::Quantity)), this, SLOT(unitValueChanged(Base::Quantity))); + connect(ui->ValueInput, SIGNAL(returnPressed()), this, SLOT(returnPressed())); + connect(ui->UnitInput, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); connect(ui->UnitInput, SIGNAL(returnPressed()), this, SLOT(returnPressed())); - connect(ui->pushButton_Help, SIGNAL(clicked()), this, SLOT(help())); connect(ui->pushButton_Close, SIGNAL(clicked()), this, SLOT(accept())); connect(ui->pushButton_Copy, SIGNAL(clicked()), this, SLOT(copy())); @@ -63,7 +62,9 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) connect(ui->UnitInput, SIGNAL(parseError(QString)), this, SLOT(parseError(QString))); ui->ValueInput->setParamGrpPath(QByteArray("User parameter:BaseApp/History/UnitsCalculator")); - actUnit.setInvalid(); + // set a default that also illustrates how the dialog works + ui->ValueInput->setText(QString::fromLatin1("1 cm")); + ui->UnitInput->setText(QString::fromLatin1("in")); units << Base::Unit::Length << Base::Unit::Mass << Base::Unit::Angle << Base::Unit::Density << Base::Unit::Area << Base::Unit::Volume << Base::Unit::TimeSpan << Base::Unit::Frequency @@ -72,7 +73,7 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) << Base::Unit::AmountOfSubstance << Base::Unit::LuminousIntensity << Base::Unit::Stress << Base::Unit::Pressure << Base::Unit::Force << Base::Unit::Work << Base::Unit::Power << Base::Unit::ThermalConductivity << Base::Unit::ThermalExpansionCoefficient - << Base::Unit::SpecificHeat << Base::Unit::ThermalTransferCoefficient <::iterator it = units.begin(); it != units.end(); ++it) { ui->unitsBox->addItem(it->getTypeString()); } @@ -95,31 +96,42 @@ void DlgUnitsCalculator::reject() QDialog::reject(); } -void DlgUnitsCalculator::unitValueChanged(const Base::Quantity& unit) +void DlgUnitsCalculator::textChanged(QString unit) { - actUnit = unit; valueChanged(actValue); } void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant) { - if (actUnit.isValid()) { - if (actUnit.getUnit() != quant.getUnit()) { - ui->ValueOutput->setText(tr("Unit mismatch")); + // first check the unit, if it is invalid, getTypeString() outputs an empty string + if (Base::Unit(ui->UnitInput->text()).getTypeString().isEmpty()) { + ui->ValueOutput->setText(tr("unknown unit: ") + ui->UnitInput->text()); + ui->pushButton_Copy->setEnabled(false); + } else { // the unit is valid + // we can only convert units of the same type, thus check + if (Base::Unit(ui->UnitInput->text()).getTypeString() != quant.getUnit().getTypeString()) { + ui->ValueOutput->setText(tr("unit mismatch")); ui->pushButton_Copy->setEnabled(false); - } else { - double value = quant.getValue()/actUnit.getValue(); - QString val = QLocale::system().toString(value, 'f', Base::UnitsApi::getDecimals()); + } else { // the unit is valid and has the same type + double convertValue = Base::Quantity::parse(QString::fromLatin1("1") + ui->UnitInput->text()).getValue(); + // we got now e.g. for "1 in" the value '25.4' because 1 in = 25.4 mm + // the result is now just quant / convertValue because the input is always in a base unit + // (an input of "1 cm" will immediately be converted to "10 mm" by Gui::InputField of the dialog) + double value = quant.getValue() / convertValue; + // determine how many decimals we will need to avoid an output like "0.00" + // at first use scientific notation, if there is no "e", we can round it to the user-defined decimals, + // but the user-defined decimals might be too low for cases like "10 um" in "in", + // thus only if value > 0.005 because FC's default are 2 decimals + QString val = QLocale::system().toString(value, 'g'); + if (!val.contains(QChar::fromLatin1('e')) && (value > 0.005)) + val = QLocale::system().toString(value, 'f', Base::UnitsApi::getDecimals()); + // create the output string QString out = QString::fromLatin1("%1 %2").arg(val, ui->UnitInput->text()); ui->ValueOutput->setText(out); ui->pushButton_Copy->setEnabled(true); } - } else { - //ui->ValueOutput->setValue(quant); - ui->ValueOutput->setText(quant.getUserString()); - ui->pushButton_Copy->setEnabled(true); } - + // store the input value actValue = quant; } @@ -135,11 +147,6 @@ void DlgUnitsCalculator::copy(void) cb->setText(ui->ValueOutput->text()); } -void DlgUnitsCalculator::help(void) -{ - //TODO: call help page Std_UnitsCalculator -} - void DlgUnitsCalculator::returnPressed(void) { if (ui->pushButton_Copy->isEnabled()) { diff --git a/src/Gui/DlgUnitsCalculatorImp.h b/src/Gui/DlgUnitsCalculatorImp.h index 9d7ef6aa11cc..745b0913992e 100644 --- a/src/Gui/DlgUnitsCalculatorImp.h +++ b/src/Gui/DlgUnitsCalculatorImp.h @@ -50,19 +50,17 @@ class DlgUnitsCalculator : public QDialog void reject(); protected Q_SLOTS: - void unitValueChanged(const Base::Quantity&); + void textChanged(const QString); void valueChanged(const Base::Quantity&); void on_unitsBox_activated(int); void copy(void); - void help(void); void returnPressed(void); void parseError(const QString& errorText); private: Base::Quantity actValue; - Base::Quantity actUnit; std::unique_ptr ui; QList units; }; diff --git a/src/Gui/Icons/edit-select-all.svg b/src/Gui/Icons/edit-select-all.svg old mode 100755 new mode 100644 diff --git a/src/Gui/Icons/edit-select-box.svg b/src/Gui/Icons/edit-select-box.svg old mode 100755 new mode 100644 diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 81d762e0a13a..f07174e5a65d 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1591,11 +1591,13 @@ QMimeData * MainWindow::createMimeDataFromSelection () const // if less than ~10 MB bool use_buffer=(memsize < 0xA00000); QByteArray res; - try { - res.reserve(memsize); - } - catch (const Base::MemoryException&) { - use_buffer = false; + if(use_buffer) { + try { + res.reserve(memsize); + } + catch (const std::bad_alloc &) { + use_buffer = false; + } } WaitCursor wc; @@ -1651,9 +1653,11 @@ void MainWindow::insertFromMimeData (const QMimeData * mimeData) else if(mimeData->hasFormat(_MimeDocObjX)) { format = _MimeDocObjX; hasXLink = true; - }else if(mimeData->hasFormat(_MimeDocObjFile)) + }else if(mimeData->hasFormat(_MimeDocObjFile)) { + format = _MimeDocObjFile; fromDoc = true; - else if(mimeData->hasFormat(_MimeDocObjXFile)) { + }else if(mimeData->hasFormat(_MimeDocObjXFile)) { + format = _MimeDocObjXFile; fromDoc = true; hasXLink = true; }else { diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index fb5b641e06dc..a71670a3a634 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -5717,6 +5717,12 @@ def linkSetup(self,obj): obj.setPropertyStatus('PlacementList','Immutable') else: obj.setPropertyStatus('PlacementList','-Immutable') + if not hasattr(obj,'LinkTransform'): + obj.addProperty('App::PropertyBool','LinkTransform',' Link') + if not hasattr(obj,'ColoredElements'): + obj.addProperty('App::PropertyLinkSubHidden','ColoredElements',' Link') + obj.setPropertyStatus('ColoredElements','Hidden') + obj.configLinkProperty('LinkTransform','ColoredElements') def getViewProviderName(self,_obj): if self.useLink: diff --git a/src/Mod/Draft/Resources/ui/preferences-dxf.ui b/src/Mod/Draft/Resources/ui/preferences-dxf.ui index c2496fc211b8..c42dd77b381a 100644 --- a/src/Mod/Draft/Resources/ui/preferences-dxf.ui +++ b/src/Mod/Draft/Resources/ui/preferences-dxf.ui @@ -60,7 +60,9 @@ Note: C++ importer is faster, but is not as featureful yet Python exporter is used, otherwise the newer C++ is used. -Note: C++ importer is faster, but is not as featureful yet +Note: C++ importer is faster, but is not as featureful yet + + Use legacy python exporter diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 18ab27f7e89c..d798d767a415 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -714,18 +714,17 @@ def startElement(self, name, attrs): if self.count == 1 and name == 'svg': if 'inkscape:version' in data: inks_doc_name = attrs.getValue('sodipodi:docname') - inks_full_ver = attrs.getValue('inkscape:version')[:4] - inks_full_ver_list = inks_full_ver.split('.') - _maj = int(inks_full_ver_list[0]) - _min = int(inks_full_ver_list[1]) - + inks_full_ver = attrs.getValue('inkscape:version') + inks_ver_pars = re.search("\d+\.\d+", inks_full_ver) + if inks_ver_pars != None: + inks_ver_f = float(inks_ver_pars.group(0)) + else: + inks_ver_f = 99.99 # Inkscape before 0.92 used 90 dpi as resolution # Newer versions use 96 dpi - if _maj == 0 and _min > 91: - self.svgdpi = 96.0 - elif _maj == 0 and _min < 92: + if inks_ver_f < 0.92: self.svgdpi = 90.0 - elif _maj > 0: + else: self.svgdpi = 96.0 if 'inkscape:version' not in data: _msg = ("This SVG file does not appear to have been produced " diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index aa0e0452d391..00983f96b405 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -94,7 +94,7 @@ CmdPartDesignBody::CmdPartDesignBody() sToolTipText = QT_TR_NOOP("Create a new body and make it active"); sWhatsThis = "PartDesign_Body"; sStatusTip = sToolTipText; - sPixmap = "PartDesign_Body_Create_New"; + sPixmap = "PartDesign_Body"; } void CmdPartDesignBody::activated(int iMsg) diff --git a/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc b/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc index 99255c7710b2..e8db9a825e2c 100644 --- a/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc +++ b/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc @@ -1,93 +1,93 @@ + icons/PartDesign_Additive_Box.svg + icons/PartDesign_Additive_Cone.svg + icons/PartDesign_Additive_Cylinder.svg + icons/PartDesign_Additive_Ellipsoid.svg + icons/PartDesign_Additive_Loft.svg + icons/PartDesign_Additive_Pipe.svg + icons/PartDesign_Additive_Prism.svg + icons/PartDesign_Additive_Sphere.svg + icons/PartDesign_Additive_Torus.svg + icons/PartDesign_Additive_Wedge.svg + icons/PartDesign_BaseFeature.svg + icons/PartDesign_Body.svg + icons/PartDesign_Body_old.svg + icons/PartDesign_Body_Tree.svg + icons/PartDesign_Boolean.svg icons/PartDesign_Chamfer.svg - icons/PartDesign_Fillet.svg + icons/PartDesign_Clone.svg + icons/PartDesign_CoordinateSystem.svg icons/PartDesign_Draft.svg - icons/PartDesign_Thickness.svg + icons/PartDesign_Fillet.svg icons/PartDesign_Groove.svg + icons/PartDesign_Hole.svg + icons/PartDesign_InternalExternalGear.svg + icons/PartDesign_InvoluteGear.svg + icons/PartDesign_Line.svg + icons/PartDesign_LinearPattern.svg + icons/PartDesign_Mirrored.svg + icons/PartDesign_MoveTip.svg + icons/PartDesign_MultiTransform.svg icons/PartDesign_Pad.svg + icons/PartDesign_Plane.svg icons/PartDesign_Pocket.svg - icons/PartDesign_Revolution.svg - icons/PartDesign_Mirrored.svg - icons/PartDesign_LinearPattern.svg + icons/PartDesign_Point.svg icons/PartDesign_PolarPattern.svg + icons/PartDesign_Revolution.svg icons/PartDesign_Scaled.svg - icons/PartDesign_MultiTransform.svg - icons/PartDesign_Hole.svg - icons/PartDesign_Body.svg - icons/PartDesign_Boolean.svg icons/PartDesign_ShapeBinder.svg icons/PartDesign_SubShapeBinder.svg - icons/PartDesign_Clone.svg - icons/PartDesign_Plane.svg - icons/PartDesign_Line.svg - icons/PartDesign_Point.svg - icons/PartDesign_CoordinateSystem.svg - icons/PartDesign_MoveTip.svg - icons/Tree_PartDesign_Pad.svg - icons/Tree_PartDesign_Revolution.svg - icons/PartDesign_InternalExternalGear.svg - icons/PartDesign_InvoluteGear.svg - icons/PartDesignWorkbench.svg - icons/PartDesign_Body_Create_New.svg - icons/PartDesign_Body_Tree.svg - icons/PartDesign_Additive_Pipe.svg - icons/PartDesign_Subtractive_Pipe.svg - icons/PartDesign_Additive_Loft.svg - icons/PartDesign_Subtractive_Loft.svg - icons/PartDesign_Additive_Box.svg - icons/PartDesign_Additive_Cylinder.svg - icons/PartDesign_Additive_Sphere.svg - icons/PartDesign_Additive_Cone.svg - icons/PartDesign_Additive_Torus.svg - icons/PartDesign_Additive_Ellipsoid.svg - icons/PartDesign_Additive_Prism.svg - icons/PartDesign_Additive_Wedge.svg - icons/PartDesign_Subtractive_Box.svg + icons/PartDesign_Subtractive_Box.svg + icons/PartDesign_Subtractive_Cone.svg icons/PartDesign_Subtractive_Cylinder.svg - icons/PartDesign_Subtractive_Sphere.svg - icons/PartDesign_Subtractive_Cone.svg - icons/PartDesign_Subtractive_Torus.svg icons/PartDesign_Subtractive_Ellipsoid.svg - icons/PartDesign_Subtractive_Prism.svg + icons/PartDesign_Subtractive_Loft.svg + icons/PartDesign_Subtractive_Pipe.svg + icons/PartDesign_Subtractive_Prism.svg + icons/PartDesign_Subtractive_Sphere.svg + icons/PartDesign_Subtractive_Torus.svg icons/PartDesign_Subtractive_Wedge.svg - icons/PartDesign_BaseFeature.svg + icons/PartDesign_Thickness.svg + icons/PartDesignWorkbench.svg + icons/Tree_PartDesign_Pad.svg + icons/Tree_PartDesign_Revolution.svg translations/PartDesign_af.qm + translations/PartDesign_ar.qm + translations/PartDesign_ca.qm + translations/PartDesign_cs.qm translations/PartDesign_de.qm + translations/PartDesign_el.qm + translations/PartDesign_es-ES.qm + translations/PartDesign_eu.qm translations/PartDesign_fi.qm + translations/PartDesign_fil.qm translations/PartDesign_fr.qm + translations/PartDesign_gl.qm translations/PartDesign_hr.qm + translations/PartDesign_hu.qm + translations/PartDesign_id.qm translations/PartDesign_it.qm + translations/PartDesign_ja.qm + translations/PartDesign_kab.qm + translations/PartDesign_ko.qm + translations/PartDesign_lt.qm translations/PartDesign_nl.qm translations/PartDesign_no.qm translations/PartDesign_pl.qm - translations/PartDesign_ru.qm - translations/PartDesign_uk.qm - translations/PartDesign_tr.qm - translations/PartDesign_sv-SE.qm - translations/PartDesign_zh-TW.qm translations/PartDesign_pt-BR.qm - translations/PartDesign_cs.qm - translations/PartDesign_sk.qm - translations/PartDesign_es-ES.qm - translations/PartDesign_zh-CN.qm - translations/PartDesign_ja.qm - translations/PartDesign_ro.qm - translations/PartDesign_hu.qm translations/PartDesign_pt-PT.qm - translations/PartDesign_sr.qm - translations/PartDesign_el.qm + translations/PartDesign_ro.qm + translations/PartDesign_ru.qm + translations/PartDesign_sk.qm translations/PartDesign_sl.qm - translations/PartDesign_eu.qm - translations/PartDesign_ca.qm - translations/PartDesign_gl.qm - translations/PartDesign_kab.qm - translations/PartDesign_ko.qm - translations/PartDesign_fil.qm - translations/PartDesign_id.qm - translations/PartDesign_lt.qm + translations/PartDesign_sr.qm + translations/PartDesign_sv-SE.qm + translations/PartDesign_tr.qm + translations/PartDesign_uk.qm translations/PartDesign_val-ES.qm - translations/PartDesign_ar.qm translations/PartDesign_vi.qm + translations/PartDesign_zh-CN.qm + translations/PartDesign_zh-TW.qm diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg index 0f2dd38b2b44..d0552efeba64 100644 --- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg +++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg @@ -1,134 +1,179 @@ - - - - - + + + + + + - - - + + + - - - + + + + + + - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - + image/svg+xml - - - - - [jrheinlaender] - - - PartDesign_Body - 2013-05-22 + + + Path-Stock + 2015-07-04 http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg + FreeCAD/src/Mod/Path/Gui/Resources/icons/Path-Stock.svg FreeCAD LGPL2+ @@ -143,13 +188,135 @@ - - - - - - - - + + + + + + + + + + + diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_Create_New.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_Create_New.svg deleted file mode 100644 index 4646c69ca728..000000000000 --- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_Create_New.svg +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path-Stock - 2015-07-04 - http://www.freecadweb.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path-Stock.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_old.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_old.svg new file mode 100644 index 000000000000..0f2dd38b2b44 --- /dev/null +++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body_old.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + [jrheinlaender] + + + PartDesign_Body + 2013-05-22 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + FreeCAD/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Body.svg + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + [agryson] Alexander Gryson + + + + + + + + + + + + + + + diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Groove.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Groove.svg old mode 100755 new mode 100644 diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_LinearPattern.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_LinearPattern.svg old mode 100755 new mode 100644 diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_MultiTransform.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_MultiTransform.svg old mode 100755 new mode 100644 diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Pocket.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Pocket.svg old mode 100755 new mode 100644 diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_PolarPattern.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_PolarPattern.svg old mode 100755 new mode 100644 diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Scaled.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Scaled.svg old mode 100755 new mode 100644