diff --git a/src/Base/Writer.cpp b/src/Base/Writer.cpp index 514f020d9..74742f2a6 100644 --- a/src/Base/Writer.cpp +++ b/src/Base/Writer.cpp @@ -177,6 +177,8 @@ ZipWriter::ZipWriter(const char* FileName) //FIXME: Check whether this is correct ZipStream.imbue(std::locale::classic()); #endif + ZipStream.precision(12); + ZipStream.setf(ios::fixed,ios::floatfield); } ZipWriter::ZipWriter(std::ostream& os) @@ -188,6 +190,8 @@ ZipWriter::ZipWriter(std::ostream& os) //FIXME: Check whether this is correct ZipStream.imbue(std::locale::classic()); #endif + ZipStream.precision(12); + ZipStream.setf(ios::fixed,ios::floatfield); } void ZipWriter::writeFiles(void) diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 3028dafdb..67b61722f 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -502,6 +502,73 @@ bool StdCmdToggleClipPlane::isActive(void) } } +DEF_STD_CMD_ACL(StdCmdDrawStyle); + +StdCmdDrawStyle::StdCmdDrawStyle() + : Command("Std_DrawStyle") +{ + sGroup = QT_TR_NOOP("Standard-View"); + sMenuText = QT_TR_NOOP("Draw style"); + sToolTipText = QT_TR_NOOP("Draw style"); + sStatusTip = QT_TR_NOOP("Draw style"); + eType = Alter3DView; +} + +Gui::Action * StdCmdDrawStyle::createAction(void) +{ + Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow()); + pcAction->setDropDownMenu(true); + applyCommandData(pcAction); + + QAction* a0 = pcAction->addAction(QString()); + QAction* a1 = pcAction->addAction(QString()); + _pcAction = pcAction; + languageChange(); + return pcAction; +} + +void StdCmdDrawStyle::languageChange() +{ + Command::languageChange(); + + if (!_pcAction) + return; + Gui::ActionGroup* pcAction = qobject_cast(_pcAction); + QList a = pcAction->actions(); + + a[0]->setText(QCoreApplication::translate( + "Std_DrawStyle", "As is", 0, + QCoreApplication::CodecForTr)); + a[0]->setToolTip(QCoreApplication::translate( + "Std_DrawStyle", "Normal mode", 0, + QCoreApplication::CodecForTr)); + + a[1]->setText(QCoreApplication::translate( + "Std_DrawStyle", "Wireframe", 0, + QCoreApplication::CodecForTr)); + a[1]->setToolTip(QCoreApplication::translate( + "Std_DrawStyle", "Wireframe mode", 0, + QCoreApplication::CodecForTr)); +} + +void StdCmdDrawStyle::activated(int iMsg) +{ + View3DInventor* view = qobject_cast(getMainWindow()->activeWindow()); + if (view) { + SoQtViewer::DrawStyle style = SoQtViewer::VIEW_AS_IS; + if (iMsg == 0) + style = SoQtViewer::VIEW_AS_IS; + else if (iMsg == 1) + style = SoQtViewer::VIEW_LINE; + view->getViewer()->setDrawStyle(SoQtViewer::STILL, style); + } +} + +bool StdCmdDrawStyle::isActive(void) +{ + return Gui::Application::Instance->activeDocument(); +} + //=========================================================================== // Std_ToggleVisibility //=========================================================================== @@ -1991,6 +2058,7 @@ void CreateViewStdCommands(void) rcCmdMgr.addCommand(new StdOrthographicCamera()); rcCmdMgr.addCommand(new StdPerspectiveCamera()); rcCmdMgr.addCommand(new StdCmdToggleClipPlane()); + rcCmdMgr.addCommand(new StdCmdDrawStyle()); rcCmdMgr.addCommand(new StdCmdFreezeViews()); rcCmdMgr.addCommand(new StdViewZoomIn()); rcCmdMgr.addCommand(new StdViewZoomOut()); diff --git a/src/Mod/Complete/Gui/Workbench.cpp b/src/Mod/Complete/Gui/Workbench.cpp index 42d9ce183..e41837f3e 100644 --- a/src/Mod/Complete/Gui/Workbench.cpp +++ b/src/Mod/Complete/Gui/Workbench.cpp @@ -166,7 +166,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const Gui::MenuItem* view = new Gui::MenuItem( menuBar ); view->setCommand("&View"); *view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Separator" - << stdviews << "Std_FreezeViews" << "Separator" << view3d << zoom + << stdviews << "Std_FreezeViews" << "Separator" << view3d << "Std_DrawStyle" << zoom << "Std_ViewDockUndockFullscreen" << "Std_AxisCross" << "Std_ToggleClipPlane" << "Std_TextureMapping" << "Separator" << visu << "Std_ToggleVisibility" << "Std_ToggleNavigation" diff --git a/src/Mod/Part/Gui/SoBrepShape.cpp b/src/Mod/Part/Gui/SoBrepShape.cpp index 2579241cb..a8bea7a7e 100644 --- a/src/Mod/Part/Gui/SoBrepShape.cpp +++ b/src/Mod/Part/Gui/SoBrepShape.cpp @@ -424,13 +424,15 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist, materials->send(*matindices++, TRUE); } - if (nbind == PER_VERTEX || nbind == PER_FACE) { - currnormal = normals++; - glNormal3fv((const GLfloat*)currnormal); - } - else if (nbind == PER_VERTEX_INDEXED || nbind == PER_FACE_INDEXED) { - currnormal = &normals[*normalindices++]; - glNormal3fv((const GLfloat*)currnormal); + if (normals) { + if (nbind == PER_VERTEX || nbind == PER_FACE) { + currnormal = normals++; + glNormal3fv((const GLfloat*)currnormal); + } + else if (nbind == PER_VERTEX_INDEXED || nbind == PER_FACE_INDEXED) { + currnormal = &normals[*normalindices++]; + glNormal3fv((const GLfloat*)currnormal); + } } if (texture) { @@ -447,13 +449,15 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist, else if (mbind == PER_VERTEX_INDEXED) materials->send(*matindices++, TRUE); - if (nbind == PER_VERTEX) { - currnormal = normals++; - glNormal3fv((const GLfloat*)currnormal); - } - else if (nbind == PER_VERTEX_INDEXED) { - currnormal = &normals[*normalindices++]; - glNormal3fv((const GLfloat*)currnormal); + if (normals) { + if (nbind == PER_VERTEX) { + currnormal = normals++; + glNormal3fv((const GLfloat*)currnormal); + } + else if (nbind == PER_VERTEX_INDEXED) { + currnormal = &normals[*normalindices++]; + glNormal3fv((const GLfloat*)currnormal); + } } if (texture) { @@ -470,13 +474,15 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist, else if (mbind == PER_VERTEX_INDEXED) materials->send(*matindices++, TRUE); - if (nbind == PER_VERTEX) { - currnormal = normals++; - glNormal3fv((const GLfloat*)currnormal); - } - else if (nbind == PER_VERTEX_INDEXED) { - currnormal = &normals[*normalindices++]; - glNormal3fv((const GLfloat*)currnormal); + if (normals) { + if (nbind == PER_VERTEX) { + currnormal = normals++; + glNormal3fv((const GLfloat*)currnormal); + } + else if (nbind == PER_VERTEX_INDEXED) { + currnormal = &normals[*normalindices++]; + glNormal3fv((const GLfloat*)currnormal); + } } if (texture) {