diff --git a/src/FCConfig.h b/src/FCConfig.h index 53b151efdfdd..330d87b26409 100644 --- a/src/FCConfig.h +++ b/src/FCConfig.h @@ -260,8 +260,10 @@ typedef unsigned __int64 uint64_t; //************************************************************************** // Coin3D #if defined (FC_OS_WIN32) || defined(FC_OS_CYGWIN) -# ifndef COIN_DLL -# define COIN_DLL +# ifndef FCGui //COIN_DLL is defined in the FreeCADGui target +# ifndef COIN_DLL +# define COIN_DLL +# endif # endif #endif @@ -273,6 +275,16 @@ typedef unsigned __int64 uint64_t; # endif #endif +//************************************************************************** +// Quarter +#if defined (FC_OS_WIN32) || defined(FC_OS_CYGWIN) +# ifndef QUARTER_INTERNAL +# ifndef QUARTER_DLL +# define QUARTER_DLL +# endif +# endif +#endif + // stops inclusion of the QT 3 header through the SoQT header... //#define __Qt3All__ diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index a3f334c4dcb6..0d4c23d78d6a 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -1,7 +1,7 @@ #add_subdirectory(Icons) if(WIN32) - add_definitions(-DFCGui -DQIIS_MAKEDLL -DOVR_OS_WIN32) +add_definitions(-DFCGui -DQIIS_MAKEDLL -DOVR_OS_WIN32 -DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL) endif(WIN32) if (FREECAD_USE_3DCONNEXION) @@ -684,7 +684,7 @@ SOURCE_GROUP("View3D" FILES ${View3D_SRCS}) #quarter sources FILE(GLOB_RECURSE Quarter_CPP_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Quarter/*.cpp) FILE(GLOB_RECURSE Quarter_H_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Quarter/*.h) -fc_wrap_cpp(Quarter_MOC_SRCS ${Quarter_H_SRC}) +qt4_wrap_cpp(Quarter_MOC_SRCS ${Quarter_H_SRC}) SET(Quarter_SRCS ${Quarter_CPP_SRC} ${Quarter_H_SRC} @@ -954,7 +954,6 @@ if(MSVC) ${Editor_CPP_SRCS} ${Help_CPP_SRCS} ${Inventor_CPP_SRCS} - ${Quarter_SRCS} ${View3D_CPP_SRCS} ${Viewprovider_CPP_SRCS} ${Widget_CPP_SRCS} diff --git a/src/Gui/InventorAll.h b/src/Gui/InventorAll.h index 4570d9fcb8a9..3ce0c7b0ce9a 100644 --- a/src/Gui/InventorAll.h +++ b/src/Gui/InventorAll.h @@ -151,9 +151,6 @@ #include #include -#include -#include -#include #endif diff --git a/src/Gui/PreCompiled.h b/src/Gui/PreCompiled.h index 1ae4180f68ef..35fb43f88ca3 100644 --- a/src/Gui/PreCompiled.h +++ b/src/Gui/PreCompiled.h @@ -51,6 +51,7 @@ #ifdef FC_OS_WIN32 #define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #include #include diff --git a/src/Gui/Quarter/QuarterP.h b/src/Gui/Quarter/QuarterP.h index d2a17bebc042..493dd45e6cc5 100644 --- a/src/Gui/Quarter/QuarterP.h +++ b/src/Gui/Quarter/QuarterP.h @@ -2,7 +2,9 @@ #define QUARTER_QUARTERP_H #include #include +#ifndef _MSC_VER #include +#endif template class QMap; diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index dd9b4886c8f7..a2caa793cc75 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -121,6 +121,10 @@ using namespace SIM::Coin3D::Quarter; #define PRIVATE(obj) obj->pimpl +#ifndef GL_MULTISAMPLE_BIT_EXT +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + /*! constructor */ QuarterWidget::QuarterWidget(const QGLFormat & format, QWidget * parent, const QGLWidget * sharewidget, Qt::WindowFlags f) : inherited(parent) @@ -1021,7 +1025,11 @@ QuarterWidget::setNavigationModeFile(const QUrl & url) QFile file(filenametmp); if (file.open(QIODevice::ReadOnly)){ QByteArray fileContents = file.readAll(); +#if COIN_MAJOR_VERSION >= 4 stateMachine = ScXML::readBuffer(SbByteBuffer(fileContents.size(), fileContents.constData())); +#else + stateMachine = ScXML::readBuffer(fileContents.constData()); +#endif file.close(); } } diff --git a/src/Gui/Quarter/SignalThread.h b/src/Gui/Quarter/SignalThread.h index fcaedca3359c..e96117ae0c6b 100644 --- a/src/Gui/Quarter/SignalThread.h +++ b/src/Gui/Quarter/SignalThread.h @@ -51,7 +51,7 @@ class SignalThread : public QThread { void trigger(void); void stopThread(void); -signals: +Q_SIGNALS: void triggerSignal(void); diff --git a/src/Gui/Quarter/SoQTQuarterAdaptor.cpp b/src/Gui/Quarter/SoQTQuarterAdaptor.cpp index 1ecd38af49e2..f373f041773a 100644 --- a/src/Gui/Quarter/SoQTQuarterAdaptor.cpp +++ b/src/Gui/Quarter/SoQTQuarterAdaptor.cpp @@ -18,10 +18,9 @@ * */ -#include "SoQTQuarterAdaptor.h" #include "PreCompiled.h" +#include "SoQTQuarterAdaptor.h" #include -#include #include #include #include diff --git a/src/Gui/Quarter/SoQTQuarterAdaptor.h b/src/Gui/Quarter/SoQTQuarterAdaptor.h index 8d6889b29566..641831d4650e 100644 --- a/src/Gui/Quarter/SoQTQuarterAdaptor.h +++ b/src/Gui/Quarter/SoQTQuarterAdaptor.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 45331c97614d..8d4a5db50f52 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -128,6 +128,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::W break; case View3DInventorViewer::None: default: + f.setSamples(1); break; }; diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 037c0031d8cb..a9f4d31a9579 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -126,6 +126,74 @@ using namespace Gui; +/*** zoom-style cursor ******/ + +#define ZOOM_WIDTH 16 +#define ZOOM_HEIGHT 16 +#define ZOOM_BYTES ((ZOOM_WIDTH + 7) / 8) * ZOOM_HEIGHT +#define ZOOM_HOT_X 5 +#define ZOOM_HOT_Y 7 + +static unsigned char zoom_bitmap[ZOOM_BYTES] = +{ + 0x00, 0x0f, 0x80, 0x1c, 0x40, 0x38, 0x20, 0x70, + 0x90, 0xe4, 0xc0, 0xcc, 0xf0, 0xfc, 0x00, 0x0c, + 0x00, 0x0c, 0xf0, 0xfc, 0xc0, 0xcc, 0x90, 0xe4, + 0x20, 0x70, 0x40, 0x38, 0x80, 0x1c, 0x00, 0x0f +}; + +static unsigned char zoom_mask_bitmap[ZOOM_BYTES] = +{ + 0x00,0x0f,0x80,0x1f,0xc0,0x3f,0xe0,0x7f,0xf0,0xff,0xf0,0xff,0xf0,0xff,0x00, + 0x0f,0x00,0x0f,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xe0,0x7f,0xc0,0x3f,0x80,0x1f, + 0x00,0x0f +}; + +/*** pan-style cursor *******/ + +#define PAN_WIDTH 16 +#define PAN_HEIGHT 16 +#define PAN_BYTES ((PAN_WIDTH + 7) / 8) * PAN_HEIGHT +#define PAN_HOT_X 7 +#define PAN_HOT_Y 7 + +static unsigned char pan_bitmap[PAN_BYTES] = +{ + 0xc0, 0x03, 0x60, 0x02, 0x20, 0x04, 0x10, 0x08, + 0x68, 0x16, 0x54, 0x2a, 0x73, 0xce, 0x01, 0x80, + 0x01, 0x80, 0x73, 0xce, 0x54, 0x2a, 0x68, 0x16, + 0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0xc0, 0x03 +}; + +static unsigned char pan_mask_bitmap[PAN_BYTES] = +{ + 0xc0,0x03,0xe0,0x03,0xe0,0x07,0xf0,0x0f,0xe8,0x17,0xdc,0x3b,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xdc,0x3b,0xe8,0x17,0xf0,0x0f,0xe0,0x07,0xc0,0x03, + 0xc0,0x03 +}; + +/*** rotate-style cursor ****/ + +#define ROTATE_WIDTH 16 +#define ROTATE_HEIGHT 16 +#define ROTATE_BYTES ((ROTATE_WIDTH + 7) / 8) * ROTATE_HEIGHT +#define ROTATE_HOT_X 6 +#define ROTATE_HOT_Y 8 + +static unsigned char rotate_bitmap[ROTATE_BYTES] = { + 0xf0, 0xef, 0x18, 0xb8, 0x0c, 0x90, 0xe4, 0x83, + 0x34, 0x86, 0x1c, 0x83, 0x00, 0x81, 0x00, 0xff, + 0xff, 0x00, 0x81, 0x00, 0xc1, 0x38, 0x61, 0x2c, + 0xc1, 0x27, 0x09, 0x30, 0x1d, 0x18, 0xf7, 0x0f +}; + +static unsigned char rotate_mask_bitmap[ROTATE_BYTES] = { + 0xf0,0xef,0xf8,0xff,0xfc,0xff,0xfc,0xff,0x3c,0xfe,0x1c,0xff,0x00,0xff,0x00, + 0xff,0xff,0x00,0xff,0x00,0xff,0x38,0x7f,0x3c,0xff,0x3f,0xff,0x3f,0xff,0x1f, + 0xf7,0x0f +}; + + /*! As ProgressBar has no chance to control the incoming Qt events of Quarter so we need to stop the event handling to prevent the scenegraph from being selected or deselected @@ -388,6 +456,19 @@ void View3DInventorViewer::init() viewerEventFilter = new ViewerEventFilter; installEventFilter(viewerEventFilter); getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); + + //create the cursors + QBitmap cursor = QBitmap::fromData(QSize(ROTATE_WIDTH, ROTATE_HEIGHT), rotate_bitmap); + QBitmap mask = QBitmap::fromData(QSize(ROTATE_WIDTH, ROTATE_HEIGHT), rotate_mask_bitmap); + spinCursor = QCursor(cursor, mask, ROTATE_HOT_X, ROTATE_HOT_Y); + + cursor = QBitmap::fromData(QSize(ZOOM_WIDTH, ZOOM_HEIGHT), zoom_bitmap); + mask = QBitmap::fromData(QSize(ZOOM_WIDTH, ZOOM_HEIGHT), zoom_mask_bitmap); + zoomCursor = QCursor(cursor, mask, ZOOM_HOT_X, ZOOM_HOT_Y); + + cursor = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_bitmap); + mask = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_mask_bitmap); + panCursor = QCursor(cursor, mask, PAN_HOT_X, PAN_HOT_Y); } View3DInventorViewer::~View3DInventorViewer() @@ -1393,7 +1474,7 @@ void View3DInventorViewer::selectAll() } -bool View3DInventorViewer::processSoEvent(const SoEvent* const ev) +bool View3DInventorViewer::processSoEvent(const SoEvent* ev) { if(isRedirectedToSceneGraph()) { SbBool processed = inherited::processSoEvent(ev); @@ -2365,14 +2446,12 @@ void View3DInventorViewer::setCursorRepresentation(int modearg) case NavigationStyle::DRAGGING: case NavigationStyle::SPINNING: - //TODO: add qcursor spinning cursor - //this->getWidget()->setCursor(getNativeCursor(SoQtCursor::getRotateCursor().getCustomCursor())); + this->getWidget()->setCursor(spinCursor); break; case NavigationStyle::ZOOMING: { - //TODO:add qcursor zoom cursor - //this->getWidget()->setCursor(getNativeCursor(SoQtCursor::getZoomCursor().getCustomCursor())); + this->getWidget()->setCursor(zoomCursor); } break; @@ -2385,8 +2464,7 @@ void View3DInventorViewer::setCursorRepresentation(int modearg) break; case NavigationStyle::PANNING: - //TODO: add qcursor pan cursor - //this->getWidget()->setCursor(getNativeCursor(SoQtCursor::getPanCursor().getCustomCursor())); + this->getWidget()->setCursor(panCursor); break; case NavigationStyle::SELECTION: @@ -2589,7 +2667,7 @@ void View3DInventorViewer::setAntiAliasingMode(View3DInventorViewer::AntiAliasin if(getSoRenderManager()->getGLRenderAction()->isSmoothing() != smoothing) getSoRenderManager()->getGLRenderAction()->setSmoothing(smoothing); - if(static_cast(this->viewport())->format().sampleBuffers() != buffers) + if(static_cast(this->viewport())->format().samples() != buffers) Base::Console().Message("To change multisampling settings please close and open the 3d view again"); } @@ -2599,7 +2677,7 @@ View3DInventorViewer::AntiAliasing View3DInventorViewer::getAntiAliasingMode() c if(getSoRenderManager()->getGLRenderAction()->isSmoothing()) return Smoothing; - int buffers = static_cast(this->viewport())->format().sampleBuffers(); + int buffers = static_cast(this->viewport())->format().samples(); switch(buffers) { case 1: diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 191870206811..38598162e6ac 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -354,7 +354,7 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi virtual void actualRedraw(void); virtual void setSeekMode(SbBool enable); virtual void afterRealizeHook(void); - virtual bool processSoEvent(const SoEvent * const ev); + virtual bool processSoEvent(const SoEvent * ev); SbBool processSoEventBase(const SoEvent * const ev); void printDimension(); void selectAll(); @@ -402,7 +402,7 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi SbBool editing; - QCursor editCursor; + QCursor editCursor, zoomCursor, panCursor, spinCursor; SbBool redirected; SbBool allowredir; diff --git a/src/Gui/View3DViewerPy.h b/src/Gui/View3DViewerPy.h index 48cf565f7b77..4c879322b41a 100644 --- a/src/Gui/View3DViewerPy.h +++ b/src/Gui/View3DViewerPy.h @@ -26,6 +26,7 @@ #include #include +#include namespace Gui { diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index af5388135c94..07a2b0b6119a 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -825,13 +825,13 @@ def setCursor(self,mode=None): if self.selectMode: mw = FreeCADGui.getMainWindow() for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget): - if w.metaObject().className() == "SoQtGLArea": + if w.metaObject().className() == "SIM::Coin3D::Quarter::QuarterWidget": w.unsetCursor() self.cursorMode = None elif not mode: mw = FreeCADGui.getMainWindow() for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget): - if w.metaObject().className() == "SoQtGLArea": + if w.metaObject().className() == "SIM::Coin3D::Quarter::QuarterWidget": w.unsetCursor() self.cursorMode = None else: @@ -849,7 +849,7 @@ def setCursor(self,mode=None): cur = QtGui.QCursor(newicon,8,8) mw = FreeCADGui.getMainWindow() for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget): - if w.metaObject().className() == "SoQtGLArea": + if w.metaObject().className() == "SIM::Coin3D::Quarter::QuarterWidget": w.setCursor(cur) self.cursorMode = mode diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index 837ea0118ad0..73eb308b8c6e 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -27,6 +27,8 @@ # include # include # include +# include +# include # include # include # include diff --git a/src/Mod/Mesh/Gui/PreCompiled.h b/src/Mod/Mesh/Gui/PreCompiled.h index 038a31d64f02..6fdcb809c742 100644 --- a/src/Mod/Mesh/Gui/PreCompiled.h +++ b/src/Mod/Mesh/Gui/PreCompiled.h @@ -83,6 +83,7 @@ #endif #elif defined(FC_OS_WIN32) +#define NOMINMAX #include #endif //_PreComp_ diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index c3e9ac30e86e..18d220af35cd 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -26,6 +26,8 @@ #ifndef _PreComp_ # include # include +# include +# include # include # include # include