only 4 of these warnings are still relevant, CMake shall be used to disable them
Compiler definitions:
NOMINMAX:
* is already globally defined in SetGlobalCompilerAndLinkerSettings.cmake
WIN32_LEAN_AND_MEAN:
* use CMake target_compile_options on relevant targets
Warnings that still occur:
C4251, C4273, C4275: all related to dllimport / export
* use CMake target_compile_options on relevant targets
C4661: no suitable definition provied for explicit template instantiation request
* triggered in Mesh because of Vector3D in Base - not all functions are defined in header
* use CMake target_compile_options on relevant targets
Warnings that are Currently not triggered (fix code if they appear again):
C4005: macro redefinition
C4244: argument conversion, possible loss of data
C4267: conversion from size_t to type, possible loss of data
C4305: truncation from type1 to type2
* only occurrence disabled in Reader.cpp
C4522: multiple assignment operator specified
C5208: unnamed class in typedef name
Obsolete Compiler warnings:
C4181: not mentioned in Microsoft docs anymore
C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
* throw(optional_type_list) deprecated in C++17
C4482: nonstandard extension used: enum 'enumeration' used in qualified name
* not generated for compilers that support C++11
C4503: 'identifier': decorated name length exceeded, name was truncated
* obsolete since Visual Studio 2017
C4786: not mentioned in Microsoft docs anymore
140 lines
4.4 KiB
C++
140 lines
4.4 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2005 Jürgen Riegel <juergen.riegel@web.de> *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef GUI_SOFCSELECTION_H
|
|
#define GUI_SOFCSELECTION_H
|
|
|
|
# ifdef FC_OS_MACOSX
|
|
# include <OpenGL/gl.h>
|
|
# else
|
|
# ifdef FC_OS_WIN32
|
|
# include <windows.h>
|
|
# endif
|
|
# include <GL/gl.h>
|
|
# endif
|
|
|
|
#include <Inventor/elements/SoLazyElement.h>
|
|
#include <Inventor/fields/SoSFBool.h>
|
|
#include <Inventor/fields/SoSFColor.h>
|
|
#include <Inventor/fields/SoSFEnum.h>
|
|
#include <Inventor/fields/SoSFString.h>
|
|
#include <Inventor/nodes/SoGroup.h>
|
|
|
|
#include "SoFCSelectionContext.h"
|
|
|
|
|
|
class SoFullPath;
|
|
class SoPickedPoint;
|
|
|
|
|
|
namespace Gui {
|
|
|
|
|
|
/** Selection node
|
|
* This node does the complete highlighting and selection together with the viewer
|
|
* \author Jürgen Riegel
|
|
*/
|
|
class GuiExport SoFCSelection : public SoGroup {
|
|
using inherited = SoGroup;
|
|
|
|
SO_NODE_HEADER(Gui::SoFCSelection);
|
|
|
|
public:
|
|
static void initClass();
|
|
static void finish();
|
|
SoFCSelection();
|
|
|
|
/// Load highlight settings from the configuration
|
|
void applySettings ();
|
|
|
|
enum PreselectionModes {
|
|
AUTO, ON, OFF
|
|
};
|
|
|
|
enum SelectionModes {
|
|
SEL_ON, SEL_OFF
|
|
};
|
|
|
|
enum Selected {
|
|
NOTSELECTED, SELECTED
|
|
};
|
|
|
|
enum Styles {
|
|
EMISSIVE, EMISSIVE_DIFFUSE, BOX
|
|
};
|
|
|
|
SbBool isHighlighted() const {return highlighted;}
|
|
|
|
SoSFColor colorHighlight;
|
|
SoSFColor colorSelection;
|
|
SoSFEnum style;
|
|
SoSFEnum selected;
|
|
SoSFEnum preselectionMode;
|
|
SoSFEnum selectionMode;
|
|
|
|
SoSFString documentName;
|
|
SoSFString objectName;
|
|
SoSFString subElementName;
|
|
SoSFBool useNewSelection;
|
|
|
|
void doAction(SoAction *action) override;
|
|
void GLRender(SoGLRenderAction * action) override;
|
|
|
|
void handleEvent(SoHandleEventAction * action) override;
|
|
void GLRenderBelowPath(SoGLRenderAction * action) override;
|
|
void GLRenderInPath(SoGLRenderAction * action) override;
|
|
static void turnOffCurrentHighlight(SoGLRenderAction * action);
|
|
|
|
protected:
|
|
~SoFCSelection() override;
|
|
|
|
using SelContext = SoFCSelectionContext;
|
|
using SelContextPtr = std::shared_ptr<SelContext>;
|
|
SelContextPtr selContext;
|
|
SelContextPtr selContext2;
|
|
|
|
virtual void redrawHighlighted(SoAction * act, SbBool flag);
|
|
|
|
SbBool readInstance(SoInput * in, unsigned short flags) override;
|
|
|
|
private:
|
|
static int getPriority(const SoPickedPoint*);
|
|
static void turnoffcurrent(SoAction * action);
|
|
bool setOverride(SoGLRenderAction * action, SelContextPtr);
|
|
SbBool isHighlighted(SoAction *action);
|
|
SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
|
|
const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const;
|
|
|
|
static SoFullPath * currenthighlight;
|
|
|
|
SbBool highlighted;
|
|
SoColorPacker colorpacker;
|
|
|
|
SbBool bShift;
|
|
SbBool bCtrl;
|
|
};
|
|
|
|
|
|
} // namespace Gui
|
|
|
|
#endif // !GUI_SOFCSELECTION_H
|