diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 5e430e3fd..8cb9ba2ec 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2003,6 +2003,10 @@ std::string Application::FindHomePath(const char* sCall) *i = '/'; } + // fixes #0001638 to avoid to load DLLs from Windows' system directories before FreeCAD's bin folder + std::string binPath = TempHomePath; + binPath += "bin"; + SetDllDirectory(binPath.c_str()); return TempHomePath; } diff --git a/src/Base/QuantityPy.xml b/src/Base/QuantityPy.xml index d68ff8d0e..41dbb6287 100644 --- a/src/Base/QuantityPy.xml +++ b/src/Base/QuantityPy.xml @@ -27,14 +27,14 @@ Quantity(string) -- arbitrary mixture of numbers and chars defining a Quantity Quantity - + returns a quantity with the translation factor and a string with the prevered unit - + returns a floating point value as the provided unit diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 0fc346895..1f5777589 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1621,11 +1621,11 @@ void Application::runApplication(void) } #if QT_VERSION >= 0x040200 if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) { - Base::Console().Log("This system does not support framebuffer objects"); + Base::Console().Log("This system does not support framebuffer objects\n"); } #endif if (!QGLPixelBuffer::hasOpenGLPbuffers()) { - Base::Console().Log("This system does not support pbuffers"); + Base::Console().Log("This system does not support pbuffers\n"); } QGLFormat::OpenGLVersionFlags version = QGLFormat::openGLVersionFlags (); diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 003339739..154a30b5d 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -697,8 +697,12 @@ void Document::RestoreDocFile(Base::Reader &reader) sMsg += ppReturn; if (strcmp(ppReturn, "") != 0) { // non-empty attribute try { - if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera")) - d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str()); + const char** pReturnIgnore=0; + std::list mdi = getMDIViews(); + for (std::list::iterator it = mdi.begin(); it != mdi.end(); ++it) { + if ((*it)->onHasMsg("SetCamera")) + (*it)->onMsg(sMsg.c_str(), pReturnIgnore); + } } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); diff --git a/src/Gui/GuiApplicationNativeEventAware.cpp b/src/Gui/GuiApplicationNativeEventAware.cpp index 1e97f0abd..2ae0d3dd0 100644 --- a/src/Gui/GuiApplicationNativeEventAware.cpp +++ b/src/Gui/GuiApplicationNativeEventAware.cpp @@ -100,6 +100,9 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window) bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object, QEvent *event) { + if (!activeWindow()) + return true; + QApplication::notify(object, event); if (event->type() == Spaceball::MotionEvent::MotionEventType) { diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 41d6e6ce9..fde1937cd 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -483,6 +483,8 @@ void InputField::focusInEvent(QFocusEvent * event) if (!this->hasSelectedText()) selectNumber(); } + + QLineEdit::focusInEvent(event); } void InputField::keyPressEvent(QKeyEvent *event) diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index 655663ff4..055a34b35 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -28,6 +28,7 @@ # include # include # include +# include # include # include # include @@ -852,7 +853,9 @@ void RubberbandSelection::initialize() { d = new Private(_pcView3D); _pcView3D->addGraphicsItem(d); - _pcView3D->setRenderFramebuffer(true); + if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) { + _pcView3D->setRenderFramebuffer(true); + } _pcView3D->scheduleRedraw(); } @@ -860,7 +863,9 @@ void RubberbandSelection::terminate() { _pcView3D->removeGraphicsItem(d); delete d; d = 0; - _pcView3D->setRenderFramebuffer(false); + if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) { + _pcView3D->setRenderFramebuffer(false); + } _pcView3D->scheduleRedraw(); } diff --git a/src/Mod/Drawing/App/FeaturePage.cpp b/src/Mod/Drawing/App/FeaturePage.cpp index e8c78797f..e5b62f9e3 100644 --- a/src/Mod/Drawing/App/FeaturePage.cpp +++ b/src/Mod/Drawing/App/FeaturePage.cpp @@ -155,23 +155,31 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) // checking for freecad editable texts string outfragment(ofile.str()); - if (EditableTexts.getSize() > 0) { + const std::vector& editText = EditableTexts.getValues(); + if (!editText.empty()) { boost::regex e1 ("(.*?)"); string::const_iterator begin, end; begin = outfragment.begin(); end = outfragment.end(); boost::match_results what; - int count = 0; + std::size_t count = 0; + std::string newfragment; + newfragment.reserve(outfragment.size()); while (boost::regex_search(begin, end, what, e1)) { - if (count < EditableTexts.getSize()) { + if (count < editText.size()) { // change values of editable texts boost::regex e2 ("((.*?)()"); - outfragment = boost::regex_replace(outfragment, e2, "$1>"+EditableTexts.getValues()[count]+"$3"); + boost::re_detail::string_out_iterator out(newfragment); + boost::regex_replace(out, begin, what[0].second, e2, "$1>"+editText[count]+"$3"); } - count ++; + count++; begin = what[0].second; } + + // now copy the rest + newfragment.insert(newfragment.end(), begin, end); + outfragment = newfragment; } // restoring linebreaks and saving the file @@ -184,13 +192,6 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) PageResult.setValue(tempName.c_str()); - //const char* text = "lskdfjlsd"; - //const char* regex = "lskdflds"; - //boost::regex e(regex); - //boost::smatch what; - //if(boost::regex_match(string(text), what, e)) - //{ - //} return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 6e9923a51..bb3ce9e01 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -312,6 +313,20 @@ bool DrawingView::onMsg(const char* pMsg, const char** ppReturn) viewAll(); return true; } + else if (strcmp("Save",pMsg) == 0) { + Gui::Document *doc = getGuiDocument(); + if (doc) { + doc->save(); + return true; + } + } + else if (strcmp("SaveAs",pMsg) == 0) { + Gui::Document *doc = getGuiDocument(); + if (doc) { + doc->saveAs(); + return true; + } + } return false; } @@ -319,12 +334,16 @@ bool DrawingView::onHasMsg(const char* pMsg) const { if (strcmp("ViewFit",pMsg) == 0) return true; + else if (strcmp("Save",pMsg) == 0) + return getGuiDocument() != 0; + else if (strcmp("SaveAs",pMsg) == 0) + return getGuiDocument() != 0; else if (strcmp("Print",pMsg) == 0) - return true; + return true; else if (strcmp("PrintPreview",pMsg) == 0) - return true; + return true; else if (strcmp("PrintPdf",pMsg) == 0) - return true; + return true; return false; } diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index bdcdebb0d..df477375b 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -349,7 +349,7 @@ App::DocumentObjectExecReturn *Sweep::execute(void) } path = mkWire.Wire(); } - if (shape._Shape.ShapeType() == TopAbs_EDGE) { + else if (shape._Shape.ShapeType() == TopAbs_EDGE) { path = shape._Shape; } else if (shape._Shape.ShapeType() == TopAbs_WIRE) { diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index d9084d5d4..fcf641804 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -692,12 +692,10 @@ void TopoShape::write(const char *FileName) const void TopoShape::exportIges(const char *filename) const { - Interface_Static::SetCVal("write.iges.unit","IN"); try { // write iges file IGESControl_Controller::Init(); IGESControl_Writer aWriter; - //IGESControl_Writer aWriter(Interface_Static::CVal("write.iges.unit"), 1); aWriter.AddShape(this->_Shape); aWriter.ComputeModel(); QString fn = QString::fromUtf8(filename); diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 5b9100bff..dbaba1073 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -355,7 +355,18 @@ PyObject* SketchObjectPy::getPoint(PyObject *args) if (!PyArg_ParseTuple(args, "ii", &GeoId, &PointType)) return 0; - return new Base::VectorPy(new Base::Vector3d(this->getSketchObjectPtr()->getPoint(GeoId,(Sketcher::PointPos)PointType))); + if (PointType < 0 || PointType > 3) { + PyErr_SetString(PyExc_ValueError, "Invalid point type"); + return 0; + } + + SketchObject* obj = this->getSketchObjectPtr(); + if (GeoId > obj->getHighestCurveIndex() || -GeoId > obj->getExternalGeometryCount()) { + PyErr_SetString(PyExc_ValueError, "Invalid geometry Id"); + return 0; + } + + return new Base::VectorPy(new Base::Vector3d(obj->getPoint(GeoId,(Sketcher::PointPos)PointType))); } PyObject* SketchObjectPy::getAxis(PyObject *args)