Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: separate quarter as a separate library #13761

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/3rdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ if (BUILD_ASSEMBLY AND NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER)
git submodule update --init" )
endif()
add_subdirectory(OndselSolver)
endif()
endif()
35 changes: 6 additions & 29 deletions src/Gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
add_subdirectory(Stylesheets)
add_subdirectory(PreferencePacks)
add_subdirectory(PreferencePackTemplates)
add_subdirectory(Quarter)

if(WIN32)
add_definitions(-DFCGui -DQSINT_MAKEDLL -DOVR_OS_WIN32 -DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL)
Expand Down Expand Up @@ -39,14 +40,12 @@ endif(BUILD_ADDONMGR)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Quarter
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/Language
${CMAKE_CURRENT_BINARY_DIR}/propertyeditor
${CMAKE_CURRENT_BINARY_DIR}/TaskView
${CMAKE_CURRENT_BINARY_DIR}/Quarter
${CMAKE_CURRENT_BINARY_DIR}/DAGView
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
Expand All @@ -55,6 +54,7 @@ include_directories(
${XercesC_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${3DCONNEXION_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src/3rdParty/Quarter/
)

if(MSVC)
Expand All @@ -67,6 +67,7 @@ if(MSVC)
set(FreeCADGui_LIBS
FreeCADApp
${COIN3D_LIBRARIES}
Quarter
${OPENGL_gl_LIBRARY}
)

Expand All @@ -80,6 +81,7 @@ else(MSVC)
set(FreeCADGui_LIBS
FreeCADApp
${COIN3D_LIBRARIES}
Quarter
${Boost_LIBRARIES}
${OPENGL_gl_LIBRARY}
${3DCONNEXION_LINKFLAGS}
Expand Down Expand Up @@ -882,30 +884,6 @@ SET(View3D_SRCS
)
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)

SET(Quarter_MOC_HDR
Quarter/SignalThread.h
Quarter/InteractionMode.h
Quarter/SensorManager.h
Quarter/ContextMenu.h
Quarter/eventhandlers/FocusHandler.h
Quarter/eventhandlers/DragDropHandler.h
Quarter/eventhandlers/EventFilter.h
Quarter/QuarterWidget.h
)

qt_wrap_cpp(Quarter_MOC_SRCS ${Quarter_MOC_HDR})

SET(Quarter_SRCS
${Quarter_CPP_SRC}
${Quarter_H_SRC}
${Quarter_MOC_SRCS}
)
SOURCE_GROUP("Quarter" FILES ${Quarter_SRCS})

# The view provider sources
SET(Viewprovider_CPP_SRCS
ViewProvider.cpp
Expand Down Expand Up @@ -1008,8 +986,8 @@ SET(Inventor_CPP_SRCS
SoAxisCrossKit.cpp
SoTextLabel.cpp
SoDatumLabel.cpp
SoQTQuarterAdaptor.cpp
SoTouchEvents.cpp
SoMouseWheelEvent.cpp
SoFCCSysDragger.cpp
ArcEngine.cpp
)
Expand Down Expand Up @@ -1037,8 +1015,8 @@ SET(Inventor_SRCS
SoAxisCrossKit.h
SoTextLabel.h
SoDatumLabel.h
SoQTQuarterAdaptor.h
SoTouchEvents.h
SoMouseWheelEvent.h
SoFCCSysDragger.h
ArcEngine.h
)
Expand Down Expand Up @@ -1277,7 +1255,6 @@ SET(FreeCADGui_SRCS
${Task_View_SRCS}
${qsintActionPanel_SRCS}
${Resource_SRCS}
${Quarter_SRCS}
${View3D_SRCS}
${Viewprovider_SRCS}
${Widget_SRCS}
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/InventorNavigationStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

#include "NavigationStyle.h"
#include "SoMouseWheelEvent.h"
#include "Inventor/events/SoMouseWheelEvent.h"
#include "View3DInventorViewer.h"


Expand All @@ -38,7 +38,7 @@

/* TRANSLATOR Gui::InventorNavigationStyle */

TYPESYSTEM_SOURCE(Gui::InventorNavigationStyle, Gui::UserNavigationStyle)

Check warning on line 41 in src/Gui/InventorNavigationStyle.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable 'classTypeId' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

InventorNavigationStyle::InventorNavigationStyle() = default;

Expand Down Expand Up @@ -66,7 +66,7 @@
return "OpenInventor";
}

SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)

Check warning on line 69 in src/Gui/InventorNavigationStyle.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

function 'processSoEvent' has cognitive complexity of 94 (threshold 25) [readability-function-cognitive-complexity]
{
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/NavigationStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "MouseSelection.h"
#include "NavigationAnimator.h"
#include "NavigationAnimation.h"
#include "SoMouseWheelEvent.h"
#include "Inventor/events/SoMouseWheelEvent.h"
#include "View3DInventorViewer.h"

using namespace Gui;
Expand All @@ -62,7 +62,7 @@
FreeTurntable
};

FCSphereSheetProjector(const SbSphere & sph, const SbBool orienttoeye = true)

Check warning on line 65 in src/Gui/NavigationStyle.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Constructors callable with one argument should be marked explicit. [runtime/explicit] [5]
: SbSphereSheetProjector(sph, orienttoeye)
{
}
Expand Down
118 changes: 52 additions & 66 deletions src/Gui/Quarter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,78 +1,64 @@
INCLUDE(SimQtMacros)

SET(Library Quarter)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

# We R internal
ADD_DEFINITIONS(-DQUARTER_INTERNAL)

FILE(GLOB CMakeCache RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt)

# Generate list of sources and headers for compilation
FILE(GLOB_RECURSE Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
FILE(GLOB_RECURSE PublicHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
FILE(GLOB_RECURSE PrivateHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/*.h)


# Some convenient variables. The inclusion of the headers in the source variable is to force CMake to include the headers in VS project generation.
SET(AllSources ${Sources} ${PublicHeaders} ${PrivateHeaders} ${CMakeCache})

#quarter sources
FILE(GLOB_RECURSE Quarter_CPP_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
FILE(GLOB_RECURSE Quarter_H_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)

SET(Quarter_MOC_HDR
src/Quarter/SignalThread.h
src/Quarter/InteractionMode.h
src/Quarter/SensorManager.h
src/Quarter/ContextMenu.h
include/Quarter/eventhandlers/FocusHandler.h
include/Quarter/eventhandlers/DragDropHandler.h
include/Quarter/eventhandlers/EventFilter.h
include/Quarter/QuarterWidget.h
)

IF (Spacenav_FOUND)
SET(Extra_libraries ${Spacenav_LIBRARIES} ${Spacenav_LIBRARY})
ENDIF(Spacenav_FOUND)
qt_wrap_cpp(Quarter_MOC_SRCS ${Quarter_MOC_HDR})

SET(Quarter_SRCS
${Quarter_CPP_SRC}
${Quarter_H_SRC}
${Quarter_MOC_SRCS}
)
SOURCE_GROUP("Quarter" FILES ${Quarter_SRCS})

SET(AllLibs ${Coin_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Extra_libraries})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

if(Spacenav_FOUND)
add_definitions(-DHAVE_SPACENAV_LIB)
include_directories(${Spacenav_INCLUDE_DIR})
set(Extra_libraries ${Spacenav_LIBRARIES} ${Spacenav_LIBRARY})
endif()

if( UNIX )
set( Quarter_BUILD_SHARED ON )
ELSEIF ( APPLE )
set( Quarter_BUILD_SHARED ON )
ELSE()
set( Quarter_BUILD_SHARED OFF )
ENDIF ()

# Ensure export of DLL definitions on Windows
IF(WIN32 AND NOT Quarter_BUILD_STATIC_LIBRARY)
ADD_DEFINITIONS(-DQUARTER_MAKE_DLL)
ENDIF(WIN32 AND NOT Quarter_BUILD_STATIC_LIBRARY)
if ( Quarter_BUILD_SHARED )
message( STATUS "[Quarter] Building shared library" )
add_library(Quarter SHARED)
else()
message( STATUS "[Quarter] Building static library" )
add_library(Quarter STATIC)
endif()

# Add some files and filters to make the VS project more hierarchical and practical to work with
IF(MSVC_IDE)
FILE(GLOB DeviceSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} devices/*.cpp)
FILE(GLOB DeviceHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} devices/*.h)
FILE(GLOB PrivateDeviceHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/devices/*.h)
target_sources(Quarter PRIVATE ${Quarter_SRCS})

FILE(GLOB EventHandlerSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} eventhandlers/*.cpp)
FILE(GLOB EventHandlerHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} eventhandlers/*.h)
FILE(GLOB PrivateEventHandlerHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/eventhandlers/*.h)
set_target_properties(Quarter PROPERTIES PUBLIC_HEADER "${Quarter_H_SRC}")

SIM_VS_GENERATE_BASIC_TREE()
SOURCE_GROUP("Source\\Devices" FILES ${DeviceSources})
SOURCE_GROUP("Source\\EventHandlers" FILES ${EventHandlerSources})
SOURCE_GROUP("Headers\\Devices" FILES ${DeviceHeaders})
SOURCE_GROUP("Headers\\Devices" FILES ${PrivateDeviceHeaders})
SOURCE_GROUP("Headers\\EventHandlers" FILES ${EventHandlerHeaders})
SOURCE_GROUP("Headers\\EventHandlers" FILES ${PrivateEventHandlerHeaders})
ENDIF(MSVC_IDE)
target_include_directories(Quarter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${COIN3D_INCLUDE_DIRS} ${QtCore_INCLUDE_DIRS} ${QtWidgets_INCLUDE_DIRS})
target_link_libraries(Quarter ${COIN3D_LIBRARIES} ${OPENGL_LIBRARIES} ${QtCore_LIBRARIES} ${QtWidgets_LIBRARIES} ${Extra_libraries})

# Create the library
# FIXME: Support building as a framework on Mac OS X. kintel 20080707.
IF(Quarter_BUILD_STATIC_LIBRARY)
ADD_LIBRARY(${Library} STATIC ${AllSources})
ELSE(Quarter_BUILD_STATIC_LIBRARY)
ADD_LIBRARY(${Library} SHARED ${AllSources})
TARGET_LINK_LIBRARIES(${Library} ${AllLibs})
ENDIF(Quarter_BUILD_STATIC_LIBRARY)
SET_BIN_DIR(Quarter Quarter)

# Install configuration
#
# Quarter will be installed into the directory configured by CMAKE_INSTALL_PREFIX. This
# defaults to /usr/local/ on UNIX and c:/Program Files/Quarter on Windows.
#
# On Windows, the namimg convention is as follows (ripped from the "Coin" way of doing stuff):
# Dynamic Release: Quarter.dll and Quarter.lib
# Dynamic Debug: Quarterd.dll and Quarterd.lib
# Static Release: Quarters.lib
# Static Debug: Quartersd.lib
if(WIN32)
add_definitions(-DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL)
endif(WIN32)

INSTALL(TARGETS ${Library}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(TARGETS Quarter DESTINATION ${CMAKE_INSTALL_LIBDIR})
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@

#include <Inventor/events/SoEvent.h>
#include <Inventor/events/SoSubEvent.h>
#include <FCGlobal.h>
#include "Quarter/Basic.h"

/**
* @brief The SoMouseWheelEvent class is a temporary replacement for
* SoMouseWheelEvent from Coin, for until freecad stops using Coin version that
* doesn't have one (coin v 4.0.0a doesn't have SoMouseWheelEvent).
*/
class GuiExport SoMouseWheelEvent : public SoEvent {
class QUARTER_DLL_API SoMouseWheelEvent : public SoEvent {
SO_EVENT_HEADER();
public: //methods
static void initClass(){
SO_EVENT_INIT_CLASS(SoMouseWheelEvent, SoEvent);
}
SoMouseWheelEvent () : delta(0) {}
SoMouseWheelEvent (int delta) : delta(delta) {}

Check warning on line 43 in src/Gui/Quarter/include/Inventor/events/SoMouseWheelEvent.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
///returns wheel position change. One click is usually 120 units,
/// smaller values come from high-resolution devices like touchpads
int getDelta() const {return delta;}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
/**************************************************************************\
* Copyright (c) Kongsberg Oil & Gas Technologies AS
* All rights reserved.
*

Check warning on line 7 in src/Gui/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

* <-- trailing whitespace
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*

Check warning on line 11 in src/Gui/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

* <-- trailing whitespace
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*

Check warning on line 14 in src/Gui/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

* <-- trailing whitespace
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*

Check warning on line 18 in src/Gui/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

* <-- trailing whitespace
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*

Check warning on line 22 in src/Gui/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

* <-- trailing whitespace
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Expand All @@ -36,7 +36,7 @@
class QImage;
class SbImage;

#include "Basic.h"
#include <Quarter/Basic.h>


namespace SIM { namespace Coin3D { namespace Quarter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include "Basic.h"
#include <Quarter/Basic.h>

namespace SIM { namespace Coin3D { namespace Quarter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
#include <Inventor/actions/SoGLRenderAction.h>

#include <QColor>
#include <QGraphicsView>
#include <QUrl>
#include <QGraphicsView>
#include <QtOpenGL.h>

#include "Basic.h"
#include <Quarter/Basic.h>


class QMenu;
Expand All @@ -56,7 +56,7 @@
namespace SIM { namespace Coin3D { namespace Quarter {

class EventFilter;
const char DEFAULT_NAVIGATIONFILE [] = "coin:///scxml/navigation/examiner.xml";

Check warning on line 59 in src/Gui/Quarter/include/Quarter/QuarterWidget.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable 'DEFAULT_NAVIGATIONFILE' is not needed and will not be emitted [-Wunneeded-internal-declaration]

class QUARTER_DLL_API QuarterWidget : public QGraphicsView {
typedef QGraphicsView inherited;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <QtCore/QObject>
#include <QObject>
#include <Quarter/Basic.h>

class QEvent;
Expand All @@ -46,7 +46,7 @@
class QUARTER_DLL_API DragDropHandler : public QObject {
Q_OBJECT
public:
DragDropHandler(QuarterWidget * parent);

Check warning on line 49 in src/Gui/Quarter/include/Quarter/eventhandlers/DragDropHandler.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
~DragDropHandler() override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
\**************************************************************************/

#include <Quarter/Basic.h>
#include <QtCore/QObject>
#include <QObject>

class QEvent;
class QPoint;
Expand All @@ -47,7 +47,7 @@
Q_OBJECT

public:
EventFilter(QObject * parent);

Check warning on line 50 in src/Gui/Quarter/include/Quarter/eventhandlers/EventFilter.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
~EventFilter() override;

void registerInputDevice(InputDevice * device);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
* *
***************************************************************************/

#include "PreCompiled.h"

#include "SoMouseWheelEvent.h"
#include "Inventor/events/SoMouseWheelEvent.h"

SO_EVENT_SOURCE(SoMouseWheelEvent);

Check warning on line 25 in src/Gui/Quarter/src/Inventor/SoMouseWheelEvent.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Could not find a newline character at the end of the file. [whitespace/ending_newline] [5]
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include "ContextMenu.h"

#include <QActionGroup>
#include <QMenu>

#include "ContextMenu.h"
#include "QuarterWidget.h"
#include <Quarter/QuarterWidget.h>


using namespace SIM::Coin3D::Quarter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#ifndef QUARTER_CONTEXTMENUHANDLERP_H
#define QUARTER_CONTEXTMENUHANDLERP_H

#include <QtCore/QObject>
#include <QObject>

class QMenu;
class QAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
functionality to the QuarterWidget.
*/

#include <Quarter/eventhandlers/DragDropHandler.h>

#include <QUrl>
#include <QFileInfo>
#include <QStringList>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QFileInfo>
#include <QMimeData>
#include <QStringList>
#include <QUrl>

#include <Inventor/SoInput.h>
#include <Inventor/nodes/SoSeparator.h>

#include "QuarterWidget.h"
#include "eventhandlers/DragDropHandler.h"

#include <Quarter/QuarterWidget.h>

namespace SIM { namespace Coin3D { namespace Quarter {

Expand Down