Merge branch 'refs/heads/master' into jriegel/Rift

This commit is contained in:
jriegel 2014-09-12 12:27:55 +02:00
commit 6c170bce18
359 changed files with 62888 additions and 9059 deletions

View File

@ -12,6 +12,7 @@ cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
# include local modules # include local modules
include(AddFileDependencies) include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
@ -117,7 +118,7 @@ OPTION(BUILD_GUI "Build FreeCAD Gui. Otherwise you have only the command line an
OPTION(FREECAD_MAINTAINERS_BUILD "Build FreeCAD for Maintainers, with Docu and 3rd party libs. On Windows the Installer is build." OFF) OPTION(FREECAD_MAINTAINERS_BUILD "Build FreeCAD for Maintainers, with Docu and 3rd party libs. On Windows the Installer is build." OFF)
OPTION(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF) OPTION(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." OFF) OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." OFF)
OPTION(BUILD_DEBIAN "Prepare for a build of a Debian package" OFF) OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
OPTION(BUILD_CAM "Build the FreeCAD CAM module and the needed libs, be aware, unfinished code!" OFF) OPTION(BUILD_CAM "Build the FreeCAD CAM module and the needed libs, be aware, unfinished code!" OFF)
OPTION(BUILD_FEM "Build the FreeCAD FEM module, be aware, unfinished code!" ON) OPTION(BUILD_FEM "Build the FreeCAD FEM module, be aware, unfinished code!" ON)
@ -162,10 +163,10 @@ OPTION(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OF
endif(MSVC) endif(MSVC)
# if this is set override some options # if this is set override some options
if (BUILD_DEBIAN) if (FREECAD_BUILD_DEBIAN)
set(FREECAD_USE_EXTERNAL_ZIPIOS ON) set(FREECAD_USE_EXTERNAL_ZIPIOS ON)
set(FREECAD_USE_EXTERNAL_PIVY ON) set(FREECAD_USE_EXTERNAL_PIVY ON)
endif (BUILD_DEBIAN) endif (FREECAD_BUILD_DEBIAN)
# ============================================================================== # ==============================================================================
#inter-module dependencies #inter-module dependencies
@ -368,7 +369,6 @@ if(FREECAD_LIBPACK_USE)
else(FREECAD_LIBPACK_USE) else(FREECAD_LIBPACK_USE)
# ================================================================================ # ================================================================================
# == for other OSes search the packages ========================================== # == for other OSes search the packages ==========================================
@ -461,8 +461,14 @@ else(FREECAD_LIBPACK_USE)
TKXDESTEP TKXDESTEP
TKXDEIGES TKXDEIGES
TKMeshVS TKMeshVS
)
CHECK_MINIMUM_OCC_VERSION_HEX(0x060703)
if (NOT OCC_MIN_VERSION)
set(OCC_OCAF_LIBRARIES
${OCC_OCAF_LIBRARIES}
TKAdvTools TKAdvTools
) )
endif()
set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS}) set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
set(OCC_FOUND ${OCE_FOUND}) set(OCC_FOUND ${OCE_FOUND})
else() #look for OpenCASCADE else() #look for OpenCASCADE
@ -523,7 +529,10 @@ else(FREECAD_LIBPACK_USE)
# -------------------------------- pcl ---------------------------------- # -------------------------------- pcl ----------------------------------
find_package(PCL COMPONENTS common kdtree features surface) find_package(PCL QUIET COMPONENTS common kdtree features surface io)
if (NOT PCL_FOUND)
MESSAGE("-- pcl not found")
endif(NOT PCL_FOUND)
# -------------------------------- ODE ---------------------------------- # -------------------------------- ODE ----------------------------------
@ -627,7 +636,7 @@ else(FREECAD_LIBPACK_USE)
IF(MATPLOTLIB_FOUND) IF(MATPLOTLIB_FOUND)
message("-- matplotlib-${MATPLOTLIB_VERSION} has been found.") message("-- matplotlib-${MATPLOTLIB_VERSION} has been found.")
ELSE(MATPLOTLIB_FOUND) ELSE(MATPLOTLIB_FOUND)
message("matplotlib not found, Plot module will not available until matplotlib is installed!") message("-- matplotlib not found, Plot module won't be available!")
ENDIF(MATPLOTLIB_FOUND) ENDIF(MATPLOTLIB_FOUND)
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
@ -649,7 +658,6 @@ if(WIN32)
endif(WIN32) endif(WIN32)
include(cMake/FreeCadMacros.cmake)
# ================================================================================ # ================================================================================
@ -696,8 +704,13 @@ ELSE(MSVC)
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}") MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
ENDIF(MSVC) ENDIF(MSVC)
IF(MINGW) IF(MINGW)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads") # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads") # Actually '-Wno-inline-dllimport' should work to suppress warnings of the form:
# inline function 'foo' is declared as dllimport: attribute ignored
# But it doesn't work with MinGW gcc 4.5.0 while using '-Wno-attributes' seems to
# do the trick.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads -Wno-attributes")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads -Wno-attributes")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
# http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie # http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie

View File

@ -89,7 +89,14 @@ IF(OCC_LIBRARY)
TKXDESTEP TKXDESTEP
TKXDEIGES TKXDEIGES
TKMeshVS TKMeshVS
)
CHECK_MINIMUM_OCC_VERSION_HEX(0x060703)
if (NOT OCC_MIN_VERSION)
set(OCC_OCAF_LIBRARIES
${OCC_OCAF_LIBRARIES}
TKAdvTools TKAdvTools
) )
endif()
ENDIF(OCC_LIBRARY) ENDIF(OCC_LIBRARY)

View File

@ -1,3 +1,5 @@
include (CheckCXXSourceRuns)
# ================================================================================ # ================================================================================
# == Macros, mostly for special targets ========================================== # == Macros, mostly for special targets ==========================================
@ -251,3 +253,61 @@ MACRO(SET_PYTHON_PREFIX_SUFFIX ProjectName)
set_target_properties(${ProjectName} PROPERTIES SUFFIX ".pyd") set_target_properties(${ProjectName} PROPERTIES SUFFIX ".pyd")
endif(WIN32) endif(WIN32)
ENDMACRO(SET_PYTHON_PREFIX_SUFFIX) ENDMACRO(SET_PYTHON_PREFIX_SUFFIX)
MACRO(CHECK_MINIMUM_OCC_VERSION_HEX MinVersionHex)
message(STATUS "Check for OCC version >= ${MinVersionHex}")
set(CMAKE_REQUIRED_INCLUDES ${OCC_INCLUDE_DIR})
unset(OCC_MIN_VERSION CACHE)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_HEX >= ${MinVersionHex} ? 0 : -1;
}
"
OCC_MIN_VERSION)
ENDMACRO(CHECK_MINIMUM_OCC_VERSION_HEX)
MACRO(GET_OCC_VERSION_HEX)
# clear them to run the tests for each configure step
unset(OCC_MAJOR CACHE)
unset(OCC_MAJOR_COMPILED CACHE)
unset(OCC_MAJOR_EXITCODE CACHE)
unset(OCC_MINOR CACHE)
unset(OCC_MINOR_COMPILED CACHE)
unset(OCC_MINOR_EXITCODE CACHE)
unset(OCC_MICRO CACHE)
unset(OCC_MICRO_COMPILED CACHE)
unset(OCC_MICRO_EXITCODE CACHE)
set(CMAKE_REQUIRED_INCLUDES ${OCC_INCLUDE_DIR})
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MAJOR;
}
"
OCC_MAJOR)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MINOR;
}
"
OCC_MINOR)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MAINTENANCE;
}
"
OCC_MICRO)
unset(OCC_VERSION_HEX CACHE)
if (OCC_MAJOR_COMPILED AND OCC_MINOR_COMPILED AND OCC_MICRO_COMPILED)
set (OCC_VERSION_HEX "0x0${OCC_MAJOR_EXITCODE}0${OCC_MINOR_EXITCODE}0${OCC_MICRO_EXITCODE}")
endif()
ENDMACRO(GET_OCC_VERSION_HEX)

View File

@ -353,43 +353,63 @@ set(NGLIB_DEBUG_LIBRARIES
# Pointscloud library # Pointscloud library
set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.7) set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.7)
set(PCL_LIBRARY_DIRS ${FREECAD_LIBPACK_DIR}/lib)
set(PCL_COMMON_LIBRARIES optimized pcl_common_release debug pcl_common_debug)
set(PCL_FEATURES_LIBRARIES optimized pcl_features_release debug pcl_features_debug)
set(PCL_FILTERS_LIBRARIES optimized pcl_filters_release debug pcl_filters_debug)
set(PCL_IO_LIBRARIES optimized pcl_io_release debug pcl_io_debug)
set(PCL_IO_PLY_LIBRARIES optimized pcl_io_ply_release debug pcl_io_ply_debug)
set(PCL_KDTREE_LIBRARIES optimized pcl_kdtree_release debug pcl_kdtree_debug)
set(PCL_KEYPOINTS_LIBRARIES optimized pcl_keypoints_release debug pcl_keypoints_debug)
set(PCL_ML_LIBRARIES optimized pcl_ml_release debug pcl_ml_debug)
set(PCL_OCTREE_LIBRARIES optimized pcl_octree_release debug pcl_octree_debug)
set(PCL_RECOGNITION_LIBRARIES optimized pcl_recognition_release debug pcl_recognition_debug)
set(PCL_REGISTRATION_LIBRARIES optimized pcl_registration_release debug pcl_registration_debug)
set(PCL_SAMPLE_CONSENSUS_LIBRARIES optimized pcl_sample_consensus_release debug pcl_sample_consensus_debug)
set(PCL_SEARCH_LIBRARIES optimized pcl_search_release debug pcl_search_debug)
set(PCL_SEGMENTATION_LIBRARIES optimized pcl_segmentation_release debug pcl_segmentation_debug)
set(PCL_STEREO_LIBRARIES optimized pcl_stereo_release debug pcl_stereo_debug)
set(PCL_SURFACE_LIBRARIES optimized pcl_surface_release debug pcl_surface_debug)
set(PCL_TRACKING_LIBRARIES optimized pcl_tracking_release debug pcl_tracking_debug)
set(PCL_LIBRARIES set(PCL_LIBRARIES
debug pcl_common_debug.lib ${PCL_COMMON_LIBRARIES}
optimized pcl_common_release.lib ${PCL_FEATURES_LIBRARIES}
debug pcl_features_debug.lib ${PCL_FILTERS_LIBRARIES}
optimized pcl_features_release.lib ${PCL_IO_LIBRARIES}
debug pcl_filters_debug.lib ${PCL_IO_PLY_LIBRARIES}
optimized pcl_filters_release.lib ${PCL_KDTREE_LIBRARIES}
debug pcl_io_debug.lib ${PCL_KEYPOINTS_LIBRARIES}
debug pcl_io_ply_debug.lib ${PCL_ML_LIBRARIES}
optimized pcl_io_ply_release.lib ${PCL_OCTREE_LIBRARIES}
optimized pcl_io_release.lib ${PCL_RECOGNITION_LIBRARIES}
debug pcl_kdtree_debug.lib ${PCL_REGISTRATION_LIBRARIES}
optimized pcl_kdtree_release.lib ${PCL_SAMPLE_CONSENSUS_LIBRARIES}
debug pcl_keypoints_debug.lib ${PCL_SEARCH_LIBRARIES}
optimized pcl_keypoints_release.lib ${PCL_SEGMENTATION_LIBRARIES}
debug pcl_ml_debug.lib ${PCL_STEREO_LIBRARIES}
optimized pcl_ml_release.lib ${PCL_SURFACE_LIBRARIES}
debug pcl_octree_debug.lib ${PCL_TRACKING_LIBRARIES}
optimized pcl_octree_release.lib
debug pcl_recognition_debug.lib
optimized pcl_recognition_release.lib
debug pcl_registration_debug.lib
optimized pcl_registration_release.lib
debug pcl_sample_consensus_debug.lib
optimized pcl_sample_consensus_release.lib
debug pcl_search_debug.lib
optimized pcl_search_release.lib
debug pcl_segmentation_debug.lib
optimized pcl_segmentation_release.lib
debug pcl_stereo_debug.lib
optimized pcl_stereo_release.lib
debug pcl_surface_debug.lib
optimized pcl_surface_release.lib
debug pcl_tracking_debug.lib
optimized pcl_tracking_release.lib
) )
set(PCL_FOUND TRUE) set(PCL_FOUND TRUE)
set(PCL_COMMON_FOUND TRUE)
set(PCL_FEATURES_FOUND TRUE)
set(PCL_FILTERS_FOUND TRUE)
set(PCL_IO_FOUND TRUE)
set(PCL_IO_PLY_FOUND TRUE)
set(PCL_KDTREE_FOUND TRUE)
set(PCL_KEYPOINTS_FOUND TRUE)
set(PCL_ML_FOUND TRUE)
set(PCL_OCTREE_FOUND TRUE)
set(PCL_RECOGNITION_FOUND TRUE)
set(PCL_REGISTRATION_FOUND TRUE)
set(PCL_SAMPLE_CONSENSUS_FOUND TRUE)
set(PCL_SEARCH_FOUND TRUE)
set(PCL_SEGMENTATION_FOUND TRUE)
set(PCL_STEREO_FOUND TRUE)
set(PCL_SURFACE_FOUND TRUE)
set(PCL_TRACKING_FOUND TRUE)
set(FLANN_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/flann-1.8) set(FLANN_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/flann-1.8)

View File

@ -471,3 +471,57 @@ SET(PYSIDE_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/PySide-1.2.1)
SET(PYSIDE_LIBRARY optimized ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7.lib debug ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7_d.lib) SET(PYSIDE_LIBRARY optimized ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7.lib debug ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7_d.lib)
SET(PYSIDE_PYTHONPATH ${FREECAD_LIBPACK_DIR}/pyside/Lib/site-packages) SET(PYSIDE_PYTHONPATH ${FREECAD_LIBPACK_DIR}/pyside/Lib/site-packages)
SET(PYSIDE_TYPESYSTEMS ${FREECAD_LIBPACK_DIR}/pyside/share/PySide/typesystems) SET(PYSIDE_TYPESYSTEMS ${FREECAD_LIBPACK_DIR}/pyside/share/PySide/typesystems)
# Pointscloud library
set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.6)
set(PCL_LIBRARY_DIRS ${FREECAD_LIBPACK_DIR}/lib)
set(PCL_COMMON_LIBRARIES optimized pcl_common_release debug pcl_common_debug)
set(PCL_FEATURES_LIBRARIES optimized pcl_features_release debug pcl_features_debug)
set(PCL_FILTERS_LIBRARIES optimized pcl_filters_release debug pcl_filters_debug)
set(PCL_IO_LIBRARIES optimized pcl_io_release debug pcl_io_debug)
set(PCL_IO_PLY_LIBRARIES optimized pcl_io_ply_release debug pcl_io_ply_debug)
set(PCL_KDTREE_LIBRARIES optimized pcl_kdtree_release debug pcl_kdtree_debug)
set(PCL_KEYPOINTS_LIBRARIES optimized pcl_keypoints_release debug pcl_keypoints_debug)
set(PCL_OCTREE_LIBRARIES optimized pcl_octree_release debug pcl_octree_debug)
set(PCL_REGISTRATION_LIBRARIES optimized pcl_registration_release debug pcl_registration_debug)
set(PCL_SAMPLE_CONSENSUS_LIBRARIES optimized pcl_sample_consensus_release debug pcl_sample_consensus_debug)
set(PCL_SEARCH_LIBRARIES optimized pcl_search_release debug pcl_search_debug)
set(PCL_SEGMENTATION_LIBRARIES optimized pcl_segmentation_release debug pcl_segmentation_debug)
set(PCL_SURFACE_LIBRARIES optimized pcl_surface_release debug pcl_surface_debug)
set(PCL_TRACKING_LIBRARIES optimized pcl_tracking_release debug pcl_tracking_debug)
set(PCL_LIBRARIES
${PCL_COMMON_LIBRARIES}
${PCL_FEATURES_LIBRARIES}
${PCL_FILTERS_LIBRARIES}
${PCL_IO_LIBRARIES}
${PCL_IO_PLY_LIBRARIES}
${PCL_KDTREE_LIBRARIES}
${PCL_KEYPOINTS_LIBRARIES}
${PCL_OCTREE_LIBRARIES}
${PCL_REGISTRATION_LIBRARIES}
${PCL_SAMPLE_CONSENSUS_LIBRARIES}
${PCL_SEARCH_LIBRARIES}
${PCL_SEGMENTATION_LIBRARIES}
${PCL_SURFACE_LIBRARIES}
${PCL_TRACKING_LIBRARIES}
)
set(PCL_FOUND TRUE)
set(PCL_COMMON_FOUND TRUE)
set(PCL_FEATURES_FOUND TRUE)
set(PCL_FILTERS_FOUND TRUE)
set(PCL_IO_FOUND TRUE)
set(PCL_IO_PLY_FOUND TRUE)
set(PCL_KDTREE_FOUND TRUE)
set(PCL_KEYPOINTS_FOUND TRUE)
set(PCL_OCTREE_FOUND TRUE)
set(PCL_REGISTRATION_FOUND TRUE)
set(PCL_SAMPLE_CONSENSUS_FOUND TRUE)
set(PCL_SEARCH_FOUND TRUE)
set(PCL_SEGMENTATION_FOUND TRUE)
set(PCL_SURFACE_FOUND TRUE)
set(PCL_TRACKING_FOUND TRUE)
set(FLANN_LIBRARIES optimized flann debug flann)
set(FLANN_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/flann-1.7.1)

13
src/3rdParty/CxImage/README vendored Normal file
View File

@ -0,0 +1,13 @@
Yanked from FreeCAD forum posts by wmayer 17 July and 22 August 2014
http://forum.freecadweb.org/viewtopic.php?f=10&t=7054
http://forum.freecadweb.org/viewtopic.php?f=17&t=7432
The CxImage is only used for a Windows thumbnailer. The utility
"ThumbnailProvider" is a DLL which can be registered to Windows as a so called
shell extension. This utility is able to create a preview image of an FCStd
project file and CxImage is needed to convert the data into a format that
Windows expects.
The format Windows accepts is a BITMAP handle for which Qt could also be used.
But this requires a dependency of two rather heavy DLLs (QtCore, QtGui) and
with a statically linked CxImage we don't have this problem.

View File

@ -127,7 +127,7 @@ ELSE(UNIX)
######### Windows ########### ######### Windows ###########
#MESSAGE("-- Windows system detected") #MESSAGE("-- Windows system detected")
IF(MSVC) IF(MSVC)
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275) ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275 /wd4005 /wd4099 /wd4101 /wd4267 /wd4390)
ELSE(MSVC) ELSE(MSVC)
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB) ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB)
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -21,7 +21,7 @@ endif
#AM_LDFLAGS = -version-info 1:0:0 -Wl,--no-undefined -L$(OCC_LIB) #AM_LDFLAGS = -version-info 1:0:0 -Wl,--no-undefined -L$(OCC_LIB)
AM_LDFLAGS = -version-info 1:0:0 -L$(OCC_LIB) \ AM_LDFLAGS = -version-info 1:0:0 -L$(OCC_LIB) \
-lTKernel -lTKService -lTKMath -lTKBRep -lTKTopAlgo -lTKGeomAlgo \ -lTKernel -lTKService -lTKMath -lTKBRep -lTKTopAlgo -lTKGeomAlgo \
-lTKGeomBase -lTKG3d -lTKG2d -lTKMeshVS -lTKShHealing -lTKPrim -lTKAdvTools -lTKGeomBase -lTKG3d -lTKG2d -lTKMeshVS -lTKShHealing -lTKPrim
#uninstall-local: #uninstall-local:
# -rm -rf $(DESTDIR)$(libdir) # -rm -rf $(DESTDIR)$(libdir)

View File

@ -26,12 +26,17 @@
#ifndef SMESH_IndexedMapOfShape_HeaderFile #ifndef SMESH_IndexedMapOfShape_HeaderFile
#define SMESH_IndexedMapOfShape_HeaderFile #define SMESH_IndexedMapOfShape_HeaderFile
#include "Standard_Version.hxx"
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#include "SMESHDS_DataMapOfShape.hxx" #include "SMESHDS_DataMapOfShape.hxx"
#ifndef __BORLANDC__ #ifndef __BORLANDC__
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_IndexedMap.hxx>
#else
#include <NCollection_DefineIndexedMap.hxx> #include <NCollection_DefineIndexedMap.hxx>
#endif
#else #else
#include <SMESH_DefineIndexedMap.hxx> #include <SMESH_DefineIndexedMap.hxx>
#endif #endif
@ -40,13 +45,17 @@
/// Class SMESH_IndexedMapOfShape /// Class SMESH_IndexedMapOfShape
DEFINE_BASECOLLECTION (SMESH_BaseCollectionShape, TopoDS_Shape)
#if OCC_VERSION_HEX >= 0x060703
#ifndef __BORLANDC__ #ifndef __BORLANDC__
DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape) typedef NCollection_IndexedMap<TopoDS_Shape> SMESH_IndexedMapOfShape;
#else #else
DEFINE_BASECOLLECTION (SMESH_BaseCollectionShape, TopoDS_Shape)
SMESH_DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape) SMESH_DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape)
#endif #endif
#else
DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape)
#endif
@ -55,12 +64,23 @@ SMESH_DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, Top
#ifndef SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile #ifndef SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#define SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile #define SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_IndexedDataMap.hxx>
#else
#include <NCollection_DefineIndexedDataMap.hxx> #include <NCollection_DefineIndexedDataMap.hxx>
#endif
/// Class SMESH_IndexedDataMapOfShapeIndexedMapOfShape /// Class SMESH_IndexedDataMapOfShapeIndexedMapOfShape
#if OCC_VERSION_HEX >= 0x060703
typedef NCollection_IndexedDataMap<SMESH_IndexedMapOfShape,TopoDS_Shape> SMESH_IndexedDataMapOfShapeIndexedMapOfShape;
#else
#include <NCollection_DefineIndexedDataMap.hxx>
/// Class SMESH_IndexedDataMapOfShapeIndexedMapOfShape
DEFINE_BASECOLLECTION (SMESH_BaseCollectionIndexedMapOfShape, SMESH_IndexedMapOfShape) DEFINE_BASECOLLECTION (SMESH_BaseCollectionIndexedMapOfShape, SMESH_IndexedMapOfShape)
DEFINE_INDEXEDDATAMAP (SMESH_IndexedDataMapOfShapeIndexedMapOfShape, DEFINE_INDEXEDDATAMAP (SMESH_IndexedDataMapOfShapeIndexedMapOfShape,
SMESH_BaseCollectionIndexedMapOfShape, TopoDS_Shape, SMESH_BaseCollectionIndexedMapOfShape, TopoDS_Shape,
SMESH_IndexedMapOfShape) SMESH_IndexedMapOfShape)
#endif #endif
#endif

View File

@ -28,6 +28,8 @@
#ifndef SMESH_MeshEditor_HeaderFile #ifndef SMESH_MeshEditor_HeaderFile
#define SMESH_MeshEditor_HeaderFile #define SMESH_MeshEditor_HeaderFile
#include "Standard_Version.hxx"
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"

View File

@ -28,13 +28,21 @@
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_Sequence.hxx>
#else
#include <NCollection_DefineSequence.hxx> #include <NCollection_DefineSequence.hxx>
#endif
#include <SMDS_MeshElement.hxx> #include <SMDS_MeshElement.hxx>
typedef const SMDS_MeshElement* SMDS_MeshElementPtr; typedef const SMDS_MeshElement* SMDS_MeshElementPtr;
#if OCC_VERSION_HEX >= 0x060703
typedef NCollection_Sequence<SMDS_MeshElementPtr> SMESH_SequenceOfElemPtr;
#else
DEFINE_BASECOLLECTION (SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr) DEFINE_BASECOLLECTION (SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)
DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr) DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)
#endif
#endif #endif

View File

@ -29,12 +29,19 @@
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#include <NCollection_DefineSequence.hxx> #include <NCollection_DefineSequence.hxx>
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Sequence.hxx>
#endif
typedef const SMDS_MeshNode* SMDS_MeshNodePtr; typedef const SMDS_MeshNode* SMDS_MeshNodePtr;
#if OCC_VERSION_HEX >= 0x060703
typedef NCollection_Sequence<SMDS_MeshNodePtr> SMESH_SequenceOfNode;
#else
DEFINE_BASECOLLECTION (SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr) DEFINE_BASECOLLECTION (SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr)
DEFINE_SEQUENCE(SMESH_SequenceOfNode, DEFINE_SEQUENCE(SMESH_SequenceOfNode,
SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr) SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr)
#endif
#endif #endif

View File

@ -66,12 +66,17 @@
#ifndef StdMeshers_Array2OfNode_HeaderFile #ifndef StdMeshers_Array2OfNode_HeaderFile
#define StdMeshers_Array2OfNode_HeaderFile #define StdMeshers_Array2OfNode_HeaderFile
typedef const SMDS_MeshNode* SMDS_MeshNodePtr; typedef const SMDS_MeshNode* SMDS_MeshNodePtr;
DEFINE_BASECOLLECTION (StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr)
#ifndef __BORLANDC__ #ifndef __BORLANDC__
#if OCC_VERSION_HEX >= 0x060703
typedef NCollection_Array2<SMDS_MeshNodePtr> StdMeshers_Array2OfNode;
#else
DEFINE_BASECOLLECTION (StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr)
DEFINE_ARRAY2(StdMeshers_Array2OfNode, DEFINE_ARRAY2(StdMeshers_Array2OfNode,
StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr) StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr)
#endif
#else #else
DEFINE_BASECOLLECTION (StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr)
SMESH_DEFINE_ARRAY2(StdMeshers_Array2OfNode, SMESH_DEFINE_ARRAY2(StdMeshers_Array2OfNode,
StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr) StdMeshers_BaseCollectionNodePtr, SMDS_MeshNodePtr)
#endif #endif

View File

@ -34,6 +34,9 @@
# include <unistd.h> # include <unistd.h>
# include <pwd.h> # include <pwd.h>
# include <sys/types.h> # include <sys/types.h>
# elif defined(__MINGW32__)
# define WINVER 0x502 // needed for SetDllDirectory
# include <Windows.h>
# endif # endif
# include <ctime> # include <ctime>
# include <csignal> # include <csignal>
@ -1208,6 +1211,10 @@ void Application::initApplication(void)
("User parameter:BaseApp/Preferences/Units"); ("User parameter:BaseApp/Preferences/Units");
UnitsApi::setSchema((UnitSystem)hGrp->GetInt("UserSchema",0)); UnitsApi::setSchema((UnitSystem)hGrp->GetInt("UserSchema",0));
#if defined (_DEBUG)
Console().Log("Application is built with debug information\n");
#endif
// starting the init script // starting the init script
Console().Log("Run App init script\n"); Console().Log("Run App init script\n");
Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADInit")); Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADInit"));
@ -1365,7 +1372,7 @@ void Application::LoadParameters(void)
catch (const Base::Exception& e) { catch (const Base::Exception& e) {
// try to proceed with an empty XML document // try to proceed with an empty XML document
Base::Console().Error("%s in file %s.\n" Base::Console().Error("%s in file %s.\n"
"Continue with an empty configuration.", "Continue with an empty configuration.\n",
e.what(), mConfig["SystemParameter"].c_str()); e.what(), mConfig["SystemParameter"].c_str());
_pcSysParamMngr->CreateDocument(); _pcSysParamMngr->CreateDocument();
} }
@ -1384,7 +1391,7 @@ void Application::LoadParameters(void)
catch (const Base::Exception& e) { catch (const Base::Exception& e) {
// try to proceed with an empty XML document // try to proceed with an empty XML document
Base::Console().Error("%s in file %s.\n" Base::Console().Error("%s in file %s.\n"
"Continue with an empty configuration.", "Continue with an empty configuration.\n",
e.what(), mConfig["UserParameter"].c_str()); e.what(), mConfig["UserParameter"].c_str());
_pcUserParamMngr->CreateDocument(); _pcUserParamMngr->CreateDocument();
} }
@ -2005,6 +2012,10 @@ std::string Application::FindHomePath(const char* sCall)
*i = '/'; *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; return TempHomePath;
} }

View File

@ -48,6 +48,7 @@ class AppExport Segment: public Base::BaseClass
TYPESYSTEM_HEADER(); TYPESYSTEM_HEADER();
public: public:
virtual ~Segment(){}
virtual std::string getName() const=0; virtual std::string getName() const=0;
}; };

View File

@ -98,6 +98,10 @@ Py::Object DocumentObjectPy::getViewObject(void) const
{ {
try { try {
Py::Module module(PyImport_ImportModule("FreeCADGui"),true); Py::Module module(PyImport_ImportModule("FreeCADGui"),true);
if (!module.hasAttr("getDocument")) {
// in v0.14+, the GUI module can be loaded in console mode (but doesn't have all its document methods)
return Py::None();
}
Py::Callable method(module.getAttr("getDocument")); Py::Callable method(module.getAttr("getDocument"));
Py::Tuple arg(1); Py::Tuple arg(1);
arg.setItem(0, Py::String(getDocumentObjectPtr()->getDocument()->getName())); arg.setItem(0, Py::String(getDocumentObjectPtr()->getDocument()->getName()));

View File

@ -199,7 +199,7 @@ void DocumentObserverPython::slotChangedObject(const App::DocumentObject& Obj,
Py::Callable method(this->inst.getAttr(std::string("slotChangedObject"))); Py::Callable method(this->inst.getAttr(std::string("slotChangedObject")));
Py::Tuple args(2); Py::Tuple args(2);
args.setItem(0, Py::Object(const_cast<App::DocumentObject&>(Obj).getPyObject(), true)); args.setItem(0, Py::Object(const_cast<App::DocumentObject&>(Obj).getPyObject(), true));
std::string prop_name = Obj.getName(&Prop); std::string prop_name = Obj.getPropertyName(&Prop);
args.setItem(1, Py::String(prop_name)); args.setItem(1, Py::String(prop_name));
method.apply(args); method.apply(args);
} }

View File

@ -106,13 +106,13 @@ void DynamicProperty::addDynamicProperties(const PropertyContainer* cont)
} }
} }
const char* DynamicProperty::getName(const Property* prop) const const char* DynamicProperty::getPropertyName(const Property* prop) const
{ {
for (std::map<std::string,PropData>::const_iterator it = props.begin(); it != props.end(); ++it) { for (std::map<std::string,PropData>::const_iterator it = props.begin(); it != props.end(); ++it) {
if (it->second.property == prop) if (it->second.property == prop)
return it->first.c_str(); return it->first.c_str();
} }
return this->pc->PropertyContainer::getName(prop); return this->pc->PropertyContainer::getPropertyName(prop);
} }
unsigned int DynamicProperty::getMemSize (void) const unsigned int DynamicProperty::getMemSize (void) const

View File

@ -74,7 +74,7 @@ public:
std::vector<std::string> getDynamicPropertyNames() const; std::vector<std::string> getDynamicPropertyNames() const;
void addDynamicProperties(const PropertyContainer*); void addDynamicProperties(const PropertyContainer*);
/// get the name of a property /// get the name of a property
const char* getName(const Property* prop) const; const char* getPropertyName(const Property* prop) const;
//@} //@}
/** @name Property attributes */ /** @name Property attributes */

View File

@ -88,7 +88,7 @@ void FeaturePythonImp::onChanged(const Property* prop)
if (feature.hasAttr("__object__")) { if (feature.hasAttr("__object__")) {
Py::Callable method(feature.getAttr(std::string("onChanged"))); Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(1); Py::Tuple args(1);
std::string prop_name = object->getName(prop); std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name)); args.setItem(0, Py::String(prop_name));
method.apply(args); method.apply(args);
} }
@ -96,7 +96,7 @@ void FeaturePythonImp::onChanged(const Property* prop)
Py::Callable method(feature.getAttr(std::string("onChanged"))); Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(2); Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true)); args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getName(prop); std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name)); args.setItem(1, Py::String(prop_name));
method.apply(args); method.apply(args);
} }

View File

@ -124,8 +124,8 @@ public:
return props->getPropertyByName(name); return props->getPropertyByName(name);
} }
/// get the name of a property /// get the name of a property
virtual const char* getName(const Property* prop) const { virtual const char* getPropertyName(const Property* prop) const {
return props->getName(prop); return props->getPropertyName(prop);
} }
//@} //@}

View File

@ -119,7 +119,7 @@ FeatureTest::~FeatureTest()
DocumentObjectExecReturn *FeatureTest::execute(void) DocumentObjectExecReturn *FeatureTest::execute(void)
{ {
int *i,j; int *i=0,j;
float f; float f;
void *s; void *s;

View File

@ -58,7 +58,7 @@ Property::~Property()
const char* Property::getName(void) const const char* Property::getName(void) const
{ {
return father->getName(this); return father->getPropertyName(this);
} }
short Property::getType(void) const short Property::getType(void) const

View File

@ -143,7 +143,7 @@ bool PropertyContainer::isHidden(const char *name) const
return (getPropertyData().getType(this,name) & Prop_Hidden) == Prop_Hidden; return (getPropertyData().getType(this,name) & Prop_Hidden) == Prop_Hidden;
} }
const char* PropertyContainer::getName(const Property* prop)const const char* PropertyContainer::getPropertyName(const Property* prop)const
{ {
return getPropertyData().getName(this,prop); return getPropertyData().getName(this,prop);
} }

View File

@ -104,7 +104,7 @@ public:
/// find a property by its name /// find a property by its name
virtual Property *getPropertyByName(const char* name) const; virtual Property *getPropertyByName(const char* name) const;
/// get the name of a property /// get the name of a property
virtual const char* getName(const Property* prop) const; virtual const char* getPropertyName(const Property* prop) const;
/// get all properties of the class (including properties of the parent) /// get all properties of the class (including properties of the parent)
virtual void getPropertyMap(std::map<std::string,Property*> &Map) const; virtual void getPropertyMap(std::map<std::string,Property*> &Map) const;
/// get all properties of the class (including properties of the parent) /// get all properties of the class (including properties of the parent)

View File

@ -37,6 +37,15 @@
</UserDocu> </UserDocu>
</Documentation> </Documentation>
</Methode> </Methode>
<Methode Name="getEditorMode">
<Documentation>
<UserDocu>Get the behaviour of the property in the property editor.
It returns a list of strings with the current mode. If the list is empty there are no special restrictions.
If the list contains 'ReadOnly' then the item appears in the property editor but is disabled.
If the list contains 'Hidden' then the item even doesn't appear in the property editor.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGroupOfProperty"> <Methode Name="getGroupOfProperty">
<Documentation> <Documentation>
<UserDocu>Return the name of the group which the property belongs to in this class. The properties sorted in differnt named groups for convenience.</UserDocu> <UserDocu>Return the name of the group which the property belongs to in this class. The properties sorted in differnt named groups for convenience.</UserDocu>

View File

@ -103,15 +103,66 @@ PyObject* PropertyContainerPy::setEditorMode(PyObject *args)
{ {
char* name; char* name;
short type; short type;
if (!PyArg_ParseTuple(args, "sh", &name, &type)) // convert args: Python->C if (PyArg_ParseTuple(args, "sh", &name, &type)) {
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
if (!prop) {
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name);
return 0;
}
prop->StatusBits.set(2,(type & 1) > 0);
prop->StatusBits.set(3,(type & 2) > 0);
Py_Return;
}
PyErr_Clear();
PyObject *iter;
if (PyArg_ParseTuple(args, "sO", &name, &iter)) {
if (PyTuple_Check(iter) || PyList_Check(iter)) {
Py::Sequence seq(iter);
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
if (!prop) {
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name);
return 0;
}
// reset all bits first
prop->StatusBits.reset(2);
prop->StatusBits.reset(3);
for (Py::Sequence::iterator it = seq.begin();it!=seq.end();++it) {
std::string str = (std::string)Py::String(*it);
if (str == "ReadOnly")
prop->StatusBits.set(2);
else if (str == "Hidden")
prop->StatusBits.set(3);
}
Py_Return;
}
}
PyErr_SetString(PyExc_TypeError, "First argument must be str, second can be int, list or tuple");
return 0;
}
PyObject* PropertyContainerPy::getEditorMode(PyObject *args)
{
char* name;
if (!PyArg_ParseTuple(args, "s", &name)) // convert args: Python->C
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name); App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
Py::List ret;
if (prop) { if (prop) {
prop->StatusBits.set(2,(type & 1) > 0); short Type = prop->getType();
prop->StatusBits.set(3,(type & 2) > 0); if ((prop->StatusBits.test(2)) || (Type & Prop_ReadOnly))
ret.append(Py::String("ReadOnly"));
if ((prop->StatusBits.test(3)) || (Type & Prop_Hidden))
ret.append(Py::String("Hidden"));
} }
Py_Return; return Py::new_reference_to(ret);
} }
PyObject* PropertyContainerPy::getGroupOfProperty(PyObject *args) PyObject* PropertyContainerPy::getGroupOfProperty(PyObject *args)

View File

@ -68,7 +68,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyVector(); virtual ~PropertyVector();
/** Sets the property /** Sets the property
*/ */
@ -115,7 +115,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyVectorList(); virtual ~PropertyVectorList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize(void) const;
@ -178,7 +178,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyMatrix(); virtual ~PropertyMatrix();
/** Sets the property /** Sets the property
*/ */
@ -226,7 +226,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyPlacement(); virtual ~PropertyPlacement();
/** Sets the property /** Sets the property
*/ */
@ -276,7 +276,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyPlacementLink(); virtual ~PropertyPlacementLink();
/** This method returns the linked DocumentObject /** This method returns the linked DocumentObject
*/ */
@ -295,7 +295,7 @@ class AppExport PropertyGeometry : public App::Property
public: public:
PropertyGeometry(); PropertyGeometry();
~PropertyGeometry(); virtual ~PropertyGeometry();
/** @name Modification */ /** @name Modification */
//@{ //@{
@ -315,7 +315,7 @@ class AppExport PropertyComplexGeoData : public App::PropertyGeometry
public: public:
PropertyComplexGeoData(); PropertyComplexGeoData();
~PropertyComplexGeoData(); virtual ~PropertyComplexGeoData();
/** @name Modification */ /** @name Modification */
//@{ //@{

View File

@ -131,7 +131,8 @@ void PropertyLink::Restore(Base::XMLReader &reader)
if (name != "") { if (name != "") {
DocumentObject* parent = static_cast<DocumentObject*>(getContainer()); DocumentObject* parent = static_cast<DocumentObject*>(getContainer());
DocumentObject* object = parent->getDocument()->getObject(name.c_str()); App::Document* document = parent->getDocument();
DocumentObject* object = document ? document->getObject(name.c_str()) : 0;
if (!object) { if (!object) {
Base::Console().Warning("Lost link to '%s' while loading, maybe " Base::Console().Warning("Lost link to '%s' while loading, maybe "
"an object was not loaded correctly\n",name.c_str()); "an object was not loaded correctly\n",name.c_str());
@ -316,8 +317,8 @@ void PropertyLinkSub::Restore(Base::XMLReader &reader)
DocumentObject *pcObject; DocumentObject *pcObject;
if (name != ""){ if (name != ""){
pcObject = static_cast<DocumentObject*>(getContainer())-> App::Document* document = static_cast<DocumentObject*>(getContainer())->getDocument();
getDocument()->getObject(name.c_str()); pcObject = document ? document->getObject(name.c_str()) : 0;
if (!pcObject) if (!pcObject)
Base::Console().Warning("Lost link to '%s' while loading, maybe " Base::Console().Warning("Lost link to '%s' while loading, maybe "
"an object was not loaded correctly\n",name.c_str()); "an object was not loaded correctly\n",name.c_str());
@ -466,7 +467,8 @@ void PropertyLinkList::Restore(Base::XMLReader &reader)
// document. Thus, we should silently ingore this. // document. Thus, we should silently ingore this.
// Property not in an object! // Property not in an object!
DocumentObject* father = static_cast<DocumentObject*>(getContainer()); DocumentObject* father = static_cast<DocumentObject*>(getContainer());
DocumentObject* child = father->getDocument()->getObject(name.c_str()); App::Document* document = father->getDocument();
DocumentObject* child = document ? document->getObject(name.c_str()) : 0;
if (child) if (child)
values.push_back(child); values.push_back(child);
else else
@ -657,7 +659,8 @@ void PropertyLinkSubList::Restore(Base::XMLReader &reader)
// document. Thus, we should silently ingore this. // document. Thus, we should silently ingore this.
// Property not in an object! // Property not in an object!
DocumentObject* father = static_cast<DocumentObject*>(getContainer()); DocumentObject* father = static_cast<DocumentObject*>(getContainer());
DocumentObject* child = father->getDocument()->getObject(name.c_str()); App::Document* document = father->getDocument();
DocumentObject* child = document ? document->getObject(name.c_str()) : 0;
if (child) if (child)
values.push_back(child); values.push_back(child);
else else

View File

@ -58,7 +58,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyLink(); virtual ~PropertyLink();
/** Sets the property /** Sets the property
*/ */
@ -120,7 +120,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyLinkSub(); virtual ~PropertyLinkSub();
/** Sets the property /** Sets the property
*/ */

View File

@ -54,7 +54,7 @@ class AppExport PropertyInteger: public Property
public: public:
PropertyInteger(); PropertyInteger();
~PropertyInteger(); virtual ~PropertyInteger();
/** Sets the property /** Sets the property
*/ */
@ -90,7 +90,7 @@ class AppExport PropertyPath: public Property
public: public:
PropertyPath(); PropertyPath();
~PropertyPath(); virtual ~PropertyPath();
/** Sets the property /** Sets the property
*/ */
@ -142,7 +142,7 @@ public:
PropertyEnumeration(); PropertyEnumeration();
/// destructor /// destructor
~PropertyEnumeration(); virtual ~PropertyEnumeration();
/// Enumeration methods /// Enumeration methods
//@{ //@{
@ -207,7 +207,7 @@ public:
PropertyIntegerConstraint(); PropertyIntegerConstraint();
/// destructor /// destructor
~PropertyIntegerConstraint(); virtual ~PropertyIntegerConstraint();
/// Constraint methods /// Constraint methods
//@{ //@{
@ -249,7 +249,7 @@ public:
PropertyPercent(); PropertyPercent();
/// destructor /// destructor
~PropertyPercent(); virtual ~PropertyPercent();
}; };
/** Integer list properties /** Integer list properties
@ -271,7 +271,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyIntegerList(); virtual ~PropertyIntegerList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize(void) const;
@ -321,7 +321,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyIntegerSet(); virtual ~PropertyIntegerSet();
/** Sets the property /** Sets the property
*/ */
@ -367,7 +367,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyMap(); virtual ~PropertyMap();
virtual int getSize(void) const; virtual int getSize(void) const;
@ -670,7 +670,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyStringList(); virtual ~PropertyStringList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize(void) const;
@ -756,7 +756,7 @@ class AppExport PropertyBoolList : public PropertyLists
public: public:
PropertyBoolList(); PropertyBoolList();
~PropertyBoolList(); virtual ~PropertyBoolList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize(void) const;
@ -804,7 +804,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyColor(); virtual ~PropertyColor();
/** Sets the property /** Sets the property
*/ */
@ -850,7 +850,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyColorList(); virtual ~PropertyColorList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize(void) const;
@ -903,7 +903,7 @@ public:
* A destructor. * A destructor.
* A more elaborate description of the destructor. * A more elaborate description of the destructor.
*/ */
~PropertyMaterial(); virtual ~PropertyMaterial();
/** Sets the property /** Sets the property
*/ */

View File

@ -33,6 +33,7 @@ if(MSVC)
optimized MSVCRT.LIB optimized MSVCRT.LIB
optimized MSVCPRT.LIB optimized MSVCPRT.LIB
Rpcrt4.lib Rpcrt4.lib
version.lib
) )
elseif(MINGW) elseif(MINGW)
set(FreeCADBase_LIBS set(FreeCADBase_LIBS
@ -182,6 +183,7 @@ SET(FreeCADBase_CPP_SRCS
BoundBoxPyImp.cpp BoundBoxPyImp.cpp
Builder3D.cpp Builder3D.cpp
Console.cpp Console.cpp
CoordinateSystem.cpp
Debugger.cpp Debugger.cpp
Exception.cpp Exception.cpp
Factory.cpp Factory.cpp
@ -235,6 +237,7 @@ SET(FreeCADBase_HPP_SRCS
BoundBox.h BoundBox.h
Builder3D.h Builder3D.h
Console.h Console.h
CoordinateSystem.h
Debugger.h Debugger.h
Exception.h Exception.h
Factory.h Factory.h
@ -289,6 +292,14 @@ SET(FreeCADBase_SRCS
PreCompiled.h PreCompiled.h
) )
IF (MSVC)
SET(FreeCADBase_SRCS
${FreeCADBase_SRCS}
StackWalker.cpp
StackWalker.h
)
ENDIF(MSVC)
# Use external zipios++ if specified. # Use external zipios++ if specified.
if(FREECAD_USE_EXTERNAL_ZIPIOS) if(FREECAD_USE_EXTERNAL_ZIPIOS)
find_library(ZIPIOS_LIBRARY zipios) find_library(ZIPIOS_LIBRARY zipios)

View File

@ -652,6 +652,7 @@ void ConsoleObserverStd::Warning(const char *sWarn)
::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE ); ::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
# elif defined(FC_OS_LINUX) # elif defined(FC_OS_LINUX)
printf("\033[0m"); printf("\033[0m");
fflush(stdout);
# endif # endif
} }
@ -667,6 +668,7 @@ void ConsoleObserverStd::Error (const char *sErr)
::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE ); ::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
# elif defined(FC_OS_LINUX) # elif defined(FC_OS_LINUX)
printf("\033[0m"); printf("\033[0m");
fflush(stdout);
# endif # endif
} }
@ -682,6 +684,7 @@ void ConsoleObserverStd::Log (const char *sErr)
::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE ); ::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
# elif defined(FC_OS_LINUX) # elif defined(FC_OS_LINUX)
printf("\033[0m"); printf("\033[0m");
fflush(stdout);
# endif # endif
} }

View File

@ -0,0 +1,147 @@
/***************************************************************************
* Copyright (c) 2014 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* 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., 51 Franklin Street, *
* Fifth Floor, Boston, MA 02110-1301, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cfloat>
#endif
#include "CoordinateSystem.h"
#include "Exception.h"
using namespace Base;
CoordinateSystem::CoordinateSystem()
: axis(Vector3d(), Vector3d(0,0,1)), xdir(1,0,0), ydir(0,1,0)
{
}
CoordinateSystem::~CoordinateSystem()
{
}
void CoordinateSystem::setAxes(const Axis& v, const Vector3d& xd)
{
if (xd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is null vector");
Vector3d yd = v.getDirection() % xd;
if (yd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is parallel to Z direction");
ydir = yd;
xdir = ydir % v.getDirection();
axis = v;
}
void CoordinateSystem::setAxes(const Vector3d& n, const Vector3d& xd)
{
if (xd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is null vector");
Vector3d yd = n % xd;
if (yd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is parallel to Z direction");
ydir = yd;
xdir = ydir % n;
axis.setDirection(n);
}
void CoordinateSystem::setAxis(const Axis& v)
{
setAxes(v, xdir);
}
void CoordinateSystem::setXDirection(const Vector3d& dir)
{
Vector3d yd = axis.getDirection() % dir;
if (yd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is parallel to Z direction");
ydir = yd;
xdir = ydir % axis.getDirection();
}
void CoordinateSystem::setYDirection(const Vector3d& dir)
{
Vector3d xd = dir & axis.getDirection();
if (xd.Sqr() < FLT_EPSILON)
throw Base::Exception("Direction is parallel to Z direction");
xdir = xd;
ydir = axis.getDirection() % xdir;
}
void CoordinateSystem::setZDirection(const Vector3d& dir)
{
setAxes(dir, xdir);
}
Placement CoordinateSystem::displacement(const CoordinateSystem& cs) const
{
// align the Z axes
Base::Rotation rotZ(getZDirection(), cs.getZDirection());
// align the X axes
Base::Vector3d xd = xdir;
rotZ.multVec(xd,xd);
Base::Rotation rotX(xd, cs.getXDirection());
// the transformed base point
Vector3d mov = axis.getBase();
rotZ.multVec(mov,mov);
rotX.multVec(mov,mov);
mov = cs.getPosition() - mov;
Base::Rotation rot;
rot = rotX * rotZ;
return Placement(mov, rot);
}
void CoordinateSystem::transformTo(Vector3d& p)
{
return p.TransformToCoordinateSystem(axis.getBase(), xdir, ydir);
}
void CoordinateSystem::transform(const Placement& p)
{
axis *= p;
p.getRotation().multVec(this->xdir, this->xdir);
p.getRotation().multVec(this->ydir, this->ydir);
}
void CoordinateSystem::transform(const Rotation& r)
{
Vector3d zdir = axis.getDirection();
r.multVec(zdir, zdir);
axis.setDirection(zdir);
r.multVec(this->xdir, this->xdir);
r.multVec(this->ydir, this->ydir);
}
void CoordinateSystem::setPlacement(const Placement& p)
{
Vector3d zdir(0,0,1);
p.getRotation().multVec(zdir, zdir);
axis.setBase(p.getPosition());
axis.setDirection(zdir);
p.getRotation().multVec(Vector3d(1,0,0), this->xdir);
p.getRotation().multVec(Vector3d(0,1,0), this->ydir);
}

104
src/Base/CoordinateSystem.h Normal file
View File

@ -0,0 +1,104 @@
/***************************************************************************
* Copyright (c) 2014 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* 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., 51 Franklin Street, *
* Fifth Floor, Boston, MA 02110-1301, USA *
* *
***************************************************************************/
#ifndef BASE_COORDINATESYSTEM_H
#define BASE_COORDINATESYSTEM_H
#include "Axis.h"
namespace Base {
/**
* Describes a right-handed coordinate system in 3D space.
\author Werner Mayer
*/
class BaseExport CoordinateSystem
{
public:
/** Construct a default coordinate system with position in (0,0,0),
* with X axis (1,0,0), with Y axis (0,1,0) and Z axis (0,0,1)
*/
CoordinateSystem();
~CoordinateSystem();
/** Sets the main axis. X and Y dir are adjusted accordingly.
* The main axis \a v must not be parallel to the X axis
*/
void setAxis(const Axis& v);
/** Sets the main axis. X and Y dir are adjusted accordingly.
* The main axis must not be parallel to \a xd
*/
void setAxes(const Axis&, const Vector3d& xd);
/** Sets the main axis. X and Y dir are adjusted accordingly.
* The main axis \a n must not be parallel to \a xd
*/
void setAxes(const Vector3d& n, const Vector3d& xd);
inline const Axis& getAxis() const
{ return axis; }
/** The passed vector must not be parallel to the main axis */
void setXDirection(const Vector3d&);
inline const Vector3d& getXDirection() const
{ return xdir; }
/** The passed vector must not be parallel to the main axis */
void setYDirection(const Vector3d&);
inline const Vector3d& getYDirection() const
{ return ydir; }
/** Sets the main axis. X and Y dir are adjusted accordingly.
* The main axis must not be parallel to the X axis
*/
void setZDirection(const Vector3d&);
inline const Vector3d& getZDirection() const
{ return axis.getDirection(); }
inline void setPosition(const Vector3d& p)
{ axis.setBase(p); }
inline const Vector3d& getPosition() const
{ return axis.getBase(); }
/** This computes the displacement from this coordinate system to the
* given coordinate system \a cs
*/
Placement displacement(const CoordinateSystem& cs) const;
/** Transform the point \a p to be in this coordinate system */
void transformTo(Vector3d& p);
/** Apply the placement \a p to the coordinate system. */
void transform(const Placement& p);
/** Apply the rotation \a r to the coordinate system. */
void transform(const Rotation& r);
/** Set the placement \a p to the coordinate system. */
void setPlacement(const Placement& p);
private:
Axis axis;
Vector3d xdir;
Vector3d ydir;
};
}
#endif // BASE_COORDINATESYSTEM_H

View File

@ -301,7 +301,6 @@ bool FileInfo::isWritable () const
bool FileInfo::setPermissions (Permissions perms) bool FileInfo::setPermissions (Permissions perms)
{ {
bool ret = false;
int mode = 0; int mode = 0;
if (perms & FileInfo::ReadOnly) if (perms & FileInfo::ReadOnly)
@ -523,7 +522,8 @@ std::vector<Base::FileInfo> FileInfo::getDirectoryContent(void) const
std::vector<Base::FileInfo> List; std::vector<Base::FileInfo> List;
#if defined (FC_OS_WIN32) #if defined (FC_OS_WIN32)
struct _wfinddata_t dentry; struct _wfinddata_t dentry;
long hFile;
intptr_t hFile;
// Find first directory entry // Find first directory entry
std::wstring wstr = toStdWString(); std::wstring wstr = toStdWString();

View File

@ -1090,9 +1090,13 @@ int ParameterManager::LoadDocument(const char* sFileName)
#endif #endif
return LoadDocument(inputSource); return LoadDocument(inputSource);
} }
catch (const Base::Exception& e) {
std::cerr << e.what() << std::endl;
throw;
}
catch (...) { catch (...) {
std::cerr << "An error occurred during parsing\n " << std::endl; std::cerr << "An error occurred during parsing\n " << std::endl;
return 0; throw;
} }
} }

View File

@ -102,13 +102,13 @@ Quantity Quantity::pow(const Quantity &p) const
Quantity Quantity::operator +(const Quantity &p) const Quantity Quantity::operator +(const Quantity &p) const
{ {
if(this->_Unit != p._Unit) if(this->_Unit != p._Unit)
throw Base::Exception("Quantity::operator +(): Unit missmatch in plus operation"); throw Base::Exception("Quantity::operator +(): Unit mismatch in plus operation");
return Quantity(this->_Value + p._Value,this->_Unit); return Quantity(this->_Value + p._Value,this->_Unit);
} }
Quantity Quantity::operator -(const Quantity &p) const Quantity Quantity::operator -(const Quantity &p) const
{ {
if(this->_Unit != p._Unit) if(this->_Unit != p._Unit)
throw Base::Exception("Quantity::operator +(): Unit missmatch in plus operation"); throw Base::Exception("Quantity::operator +(): Unit mismatch in minus operation");
return Quantity(this->_Value - p._Value,this->_Unit); return Quantity(this->_Value - p._Value,this->_Unit);
} }
@ -239,7 +239,28 @@ Quantity Quantity::Gon (360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); // g
Quantity QuantResult; Quantity QuantResult;
/* helper function for tuning number strings with groups in a locale agnostic way... */
double num_change(char* yytext,char dez_delim,char grp_delim)
{
double ret_val;
char temp[40];
int i = 0;
for(char* c=yytext;*c!='\0';c++){
// skipp group delimiter
if(*c==grp_delim) continue;
// check for a dez delimiter othere then dot
if(*c==dez_delim && dez_delim !='.')
temp[i++] = '.';
else
temp[i++] = *c;
// check buffor overflow
if (i>39) return 0.0;
}
temp[i] = '\0';
ret_val = atof( temp );
return ret_val;
};
// error func // error func
void Quantity_yyerror(char *errorinfo) void Quantity_yyerror(char *errorinfo)

File diff suppressed because it is too large Load Diff

View File

@ -112,23 +112,24 @@ extern int yydebug;
enum yytokentype { enum yytokentype {
UNIT = 258, UNIT = 258,
NUM = 259, NUM = 259,
ACOS = 260, MINUSSIGN = 260,
ASIN = 261, ACOS = 261,
ATAN = 262, ASIN = 262,
ATAN2 = 263, ATAN = 263,
COS = 264, ATAN2 = 264,
EXP = 265, COS = 265,
ABS = 266, EXP = 266,
MOD = 267, ABS = 267,
LOG = 268, MOD = 268,
LOG10 = 269, LOG = 269,
POW = 270, LOG10 = 270,
SIN = 271, POW = 271,
SINH = 272, SIN = 272,
TAN = 273, SINH = 273,
TANH = 274, TAN = 274,
SQRT = 275, TANH = 275,
NEG = 276 SQRT = 276,
NEG = 277
}; };
#endif #endif
@ -161,7 +162,7 @@ int yyparse ();
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
/* Line 390 of yacc.c */ /* Line 390 of yacc.c */
#line 165 "QuantityParser.c" #line 166 "QuantityParser.c"
#ifdef short #ifdef short
# undef short # undef short
@ -388,22 +389,22 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */ #endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 45 #define YYFINAL 39
/* YYLAST -- Last index in YYTABLE. */ /* YYLAST -- Last index in YYTABLE. */
#define YYLAST 262 #define YYLAST 200
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 30 #define YYNTOKENS 29
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 5 #define YYNNTS 5
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 36 #define YYNRULES 33
/* YYNRULES -- Number of states. */ /* YYNRULES -- Number of states. */
#define YYNSTATES 106 #define YYNSTATES 88
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 276 #define YYMAXUTOK 277
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -415,7 +416,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
27, 28, 23, 22, 29, 21, 2, 24, 2, 2, 27, 28, 23, 22, 2, 2, 2, 24, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@ -438,7 +439,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 25 15, 16, 17, 18, 19, 20, 21, 25
}; };
#if YYDEBUG #if YYDEBUG
@ -447,29 +448,27 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] = static const yytype_uint8 yyprhs[] =
{ {
0, 0, 3, 4, 6, 8, 10, 13, 15, 19, 0, 0, 3, 4, 6, 8, 10, 13, 15, 19,
23, 27, 31, 34, 38, 42, 47, 52, 57, 64, 23, 27, 31, 34, 38, 42, 47, 52, 57, 62,
69, 74, 81, 86, 91, 98, 103, 108, 113, 118, 67, 72, 77, 82, 87, 92, 97, 102, 107, 109,
123, 128, 130, 134, 138, 142, 146 113, 117, 121, 125
}; };
/* YYRHS -- A `-1'-separated list of the rules' RHS. */ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] = static const yytype_int8 yyrhs[] =
{ {
31, 0, -1, -1, 32, -1, 33, -1, 34, -1, 30, 0, -1, -1, 31, -1, 32, -1, 33, -1,
34, 34, -1, 4, -1, 32, 22, 32, -1, 32, 33, 33, -1, 4, -1, 31, 22, 31, -1, 31,
21, 32, -1, 32, 23, 32, -1, 32, 24, 32, 5, 31, -1, 31, 23, 31, -1, 31, 24, 31,
-1, 21, 32, -1, 32, 26, 32, -1, 27, 32, -1, 5, 31, -1, 31, 26, 31, -1, 27, 31,
28, -1, 5, 27, 32, 28, -1, 6, 27, 32, 28, -1, 6, 27, 31, 28, -1, 7, 27, 31,
28, -1, 7, 27, 32, 28, -1, 8, 27, 32, 28, -1, 8, 27, 31, 28, -1, 12, 27, 31,
29, 32, 28, -1, 11, 27, 32, 28, -1, 10, 28, -1, 11, 27, 31, 28, -1, 14, 27, 31,
27, 32, 28, -1, 12, 27, 32, 29, 32, 28, 28, -1, 15, 27, 31, 28, -1, 17, 27, 31,
-1, 13, 27, 32, 28, -1, 14, 27, 32, 28, 28, -1, 18, 27, 31, 28, -1, 19, 27, 31,
-1, 15, 27, 32, 29, 32, 28, -1, 16, 27, 28, -1, 20, 27, 31, 28, -1, 21, 27, 31,
32, 28, -1, 17, 27, 32, 28, -1, 18, 27, 28, -1, 10, 27, 31, 28, -1, 3, -1, 32,
32, 28, -1, 19, 27, 32, 28, -1, 20, 27, 23, 32, -1, 32, 24, 32, -1, 32, 26, 31,
32, 28, -1, 9, 27, 32, 28, -1, 3, -1, -1, 27, 32, 28, -1, 31, 32, -1
33, 23, 33, -1, 33, 24, 33, -1, 33, 26,
32, -1, 27, 33, 28, -1, 32, 33, -1
}; };
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@ -477,8 +476,8 @@ static const yytype_uint8 yyrline[] =
{ {
0, 33, 33, 34, 35, 36, 37, 39, 40, 41, 0, 33, 33, 34, 35, 36, 37, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 52, 53, 54, 55, 56, 57, 58, 59, 62, 63,
62, 65, 66, 67, 68, 69, 71 64, 65, 66, 68
}; };
#endif #endif
@ -487,10 +486,10 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "UNIT", "NUM", "ACOS", "ASIN", "ATAN", "$end", "error", "$undefined", "UNIT", "NUM", "MINUSSIGN", "ACOS",
"ATAN2", "COS", "EXP", "ABS", "MOD", "LOG", "LOG10", "POW", "SIN", "ASIN", "ATAN", "ATAN2", "COS", "EXP", "ABS", "MOD", "LOG", "LOG10",
"SINH", "TAN", "TANH", "SQRT", "'-'", "'+'", "'*'", "'/'", "NEG", "'^'", "POW", "SIN", "SINH", "TAN", "TANH", "SQRT", "'+'", "'*'", "'/'", "NEG",
"'('", "')'", "','", "$accept", "input", "num", "unit", "quantity", YY_NULL "'^'", "'('", "')'", "$accept", "input", "num", "unit", "quantity", YY_NULL
}; };
#endif #endif
@ -501,26 +500,26 @@ static const yytype_uint16 yytoknum[] =
{ {
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 45, 43, 42, 47, 276, 94, 40, 41, 44 275, 276, 43, 42, 47, 277, 94, 40, 41
}; };
# endif # endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] = static const yytype_uint8 yyr1[] =
{ {
0, 30, 31, 31, 31, 31, 31, 32, 32, 32, 0, 29, 30, 30, 30, 30, 30, 31, 31, 31,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32,
32, 33, 33, 33, 33, 33, 34 32, 32, 32, 33
}; };
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] = static const yytype_uint8 yyr2[] =
{ {
0, 2, 0, 1, 1, 1, 2, 1, 3, 3, 0, 2, 0, 1, 1, 1, 2, 1, 3, 3,
3, 3, 2, 3, 3, 4, 4, 4, 6, 4, 3, 3, 2, 3, 3, 4, 4, 4, 4, 4,
4, 6, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 3,
4, 1, 3, 3, 3, 3, 2 3, 3, 3, 2
}; };
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@ -528,47 +527,43 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */ means the default is an error. */
static const yytype_uint8 yydefact[] = static const yytype_uint8 yydefact[] =
{ {
2, 31, 7, 0, 0, 0, 0, 0, 0, 0, 2, 28, 7, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
0, 0, 3, 4, 5, 0, 0, 0, 0, 0, 4, 5, 0, 12, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 12, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0,
0, 0, 36, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 32, 9, 8, 10,
0, 0, 0, 0, 14, 35, 9, 8, 10, 11, 11, 13, 29, 30, 31, 15, 16, 17, 27, 19,
13, 32, 33, 34, 15, 16, 17, 0, 30, 20, 18, 20, 21, 22, 23, 24, 25, 26
19, 0, 22, 23, 0, 25, 26, 27, 28, 29,
0, 0, 0, 18, 21, 24
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
-1, 21, 43, 44, 24 -1, 18, 37, 38, 21
}; };
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */ STATE-NUM. */
#define YYPACT_NINF -23 #define YYPACT_NINF -19
static const yytype_int16 yypact[] = static const yytype_int16 yypact[] =
{ {
92, -23, -23, -22, -19, -13, -10, -5, -4, 16, 49, -19, -19, 67, -15, -9, 13, 14, 22, 31,
17, 36, 39, 44, 54, 65, 89, 111, 124, 116, 35, 38, 56, 63, 64, 73, 78, 49, 10, -2,
92, 7, 38, 91, 116, 116, 116, 116, 116, 116, -10, 67, 67, 76, 67, 67, 67, 67, 67, 67,
116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 67, 67, 67, 67, 67, 67, 67, 75, -17, -19,
116, 116, 31, 30, 62, -23, 116, 116, 116, 116, 67, 67, 67, 67, 67, 12, -10, 12, 12, 67,
116, 18, 91, 18, 18, 116, 38, -23, 56, 118, -2, -19, 84, 91, 99, 106, 113, 121, 128, 135,
126, -20, 134, 142, 150, -11, 158, 166, 46, 174, 143, 150, 157, 165, 172, -19, -19, 69, 69, 76,
182, 190, 198, 206, -23, -23, 236, 236, 31, 31, 76, 76, 83, 83, -18, -19, -19, -19, -19, -19,
31, 57, 57, 67, -23, -23, -23, 116, -23, -23, -19, -19, -19, -19, -19, -19, -19, -19
-23, 116, -23, -23, 116, -23, -23, -23, -23, -23,
214, 222, 230, -23, -23, -23
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-23, -23, 0, 20, -8 -19, -19, 2, 0, -4
}; };
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@ -577,87 +572,73 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1 #define YYTABLE_NINF -1
static const yytype_uint8 yytable[] = static const yytype_uint8 yytable[] =
{ {
22, 46, 47, 48, 49, 25, 50, 45, 26, 87, 20, 1, 19, 40, 41, 23, 47, 48, 44, 49,
46, 47, 48, 49, 27, 50, 57, 28, 91, 42, 39, 66, 24, 47, 48, 1, 49, 51, 25, 46,
23, 1, 29, 30, 56, 58, 59, 60, 61, 62, 41, 42, 43, 50, 44, 45, 52, 53, 54, 55,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 56, 57, 58, 59, 60, 61, 62, 63, 64, 45,
73, 1, 52, 31, 32, 51, 76, 77, 78, 79, 26, 27, 67, 68, 69, 70, 71, 72, 73, 28,
80, 46, 47, 48, 49, 83, 50, 50, 74, 46, 46, 74, 1, 2, 3, 4, 5, 6, 29, 7,
47, 48, 49, 33, 50, 51, 34, 46, 47, 48, 8, 9, 30, 10, 11, 31, 12, 13, 14, 15,
49, 35, 50, 81, 82, 94, 52, 46, 47, 48, 16, 2, 3, 4, 5, 6, 17, 7, 8, 9,
49, 36, 50, 55, 84, 53, 54, 100, 55, 47, 40, 10, 11, 32, 12, 13, 14, 15, 16, 40,
75, 101, 37, 50, 102, 1, 2, 3, 4, 5, 33, 34, 42, 43, 22, 44, 40, 41, 42, 43,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 35, 44, 44, 65, 40, 36, 41, 42, 43, 49,
16, 17, 18, 19, 53, 54, 38, 55, 0, 20, 44, 40, 75, 41, 42, 43, 0, 44, 40, 76,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 41, 42, 43, 0, 44, 40, 77, 41, 42,
12, 13, 14, 15, 16, 17, 18, 19, 39, 46, 43, 0, 44, 40, 78, 41, 42, 43, 0, 44,
47, 48, 49, 41, 50, 0, 85, 46, 47, 48, 40, 79, 0, 41, 42, 43, 0, 44, 40, 80,
49, 40, 50, 0, 86, 46, 47, 48, 49, 0, 41, 42, 43, 0, 44, 40, 81, 41, 42, 43,
50, 0, 88, 46, 47, 48, 49, 0, 50, 0, 0, 44, 40, 82, 0, 41, 42, 43, 0, 44,
89, 46, 47, 48, 49, 0, 50, 0, 90, 46, 40, 83, 41, 42, 43, 0, 44, 40, 84, 41,
47, 48, 49, 0, 50, 0, 92, 46, 47, 48, 42, 43, 0, 44, 0, 85, 0, 41, 42, 43,
49, 0, 50, 0, 93, 46, 47, 48, 49, 0, 0, 44, 0, 86, 41, 42, 43, 0, 44, 0,
50, 0, 95, 46, 47, 48, 49, 0, 50, 0, 87
96, 46, 47, 48, 49, 0, 50, 0, 97, 46,
47, 48, 49, 0, 50, 0, 98, 46, 47, 48,
49, 0, 50, 0, 99, 46, 47, 48, 49, 0,
50, 0, 103, 46, 47, 48, 49, 0, 50, 0,
104, 46, 47, 48, 49, 0, 50, 0, 105, 48,
49, 0, 50
}; };
#define yypact_value_is_default(Yystate) \ #define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-23))) (!!((Yystate) == (-19)))
#define yytable_value_is_error(Yytable_value) \ #define yytable_value_is_error(Yytable_value) \
YYID (0) YYID (0)
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
0, 21, 22, 23, 24, 27, 26, 0, 27, 29, 0, 3, 0, 5, 22, 3, 23, 24, 26, 26,
21, 22, 23, 24, 27, 26, 24, 27, 29, 19, 0, 28, 27, 23, 24, 3, 26, 21, 27, 19,
0, 3, 27, 27, 24, 25, 26, 27, 28, 29, 22, 23, 24, 21, 26, 27, 24, 25, 26, 27,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 28, 29, 30, 31, 32, 33, 34, 35, 36, 27,
40, 3, 22, 27, 27, 27, 46, 47, 48, 49, 27, 27, 40, 41, 42, 43, 44, 47, 48, 27,
50, 21, 22, 23, 24, 55, 26, 26, 28, 21, 50, 49, 3, 4, 5, 6, 7, 8, 27, 10,
22, 23, 24, 27, 26, 27, 27, 21, 22, 23, 11, 12, 27, 14, 15, 27, 17, 18, 19, 20,
24, 27, 26, 53, 54, 29, 56, 21, 22, 23, 21, 4, 5, 6, 7, 8, 27, 10, 11, 12,
24, 27, 26, 26, 28, 23, 24, 87, 26, 22, 5, 14, 15, 27, 17, 18, 19, 20, 21, 5,
28, 91, 27, 26, 94, 3, 4, 5, 6, 7, 27, 27, 23, 24, 27, 26, 5, 22, 23, 24,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 27, 26, 26, 28, 5, 27, 22, 23, 24, 26,
18, 19, 20, 21, 23, 24, 27, 26, -1, 27, 26, 5, 28, 22, 23, 24, -1, 26, 5, 28,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, 22, 23, 24, -1, 26, 5, 28, 22, 23,
14, 15, 16, 17, 18, 19, 20, 21, 27, 21, 24, -1, 26, 5, 28, 22, 23, 24, -1, 26,
22, 23, 24, 27, 26, -1, 28, 21, 22, 23, 5, 28, -1, 22, 23, 24, -1, 26, 5, 28,
24, 27, 26, -1, 28, 21, 22, 23, 24, -1, 22, 23, 24, -1, 26, 5, 28, 22, 23, 24,
26, -1, 28, 21, 22, 23, 24, -1, 26, -1, -1, 26, 5, 28, -1, 22, 23, 24, -1, 26,
28, 21, 22, 23, 24, -1, 26, -1, 28, 21, 5, 28, 22, 23, 24, -1, 26, 5, 28, 22,
22, 23, 24, -1, 26, -1, 28, 21, 22, 23, 23, 24, -1, 26, -1, 28, -1, 22, 23, 24,
24, -1, 26, -1, 28, 21, 22, 23, 24, -1, -1, 26, -1, 28, 22, 23, 24, -1, 26, -1,
26, -1, 28, 21, 22, 23, 24, -1, 26, -1, 28
28, 21, 22, 23, 24, -1, 26, -1, 28, 21,
22, 23, 24, -1, 26, -1, 28, 21, 22, 23,
24, -1, 26, -1, 28, 21, 22, 23, 24, -1,
26, -1, 28, 21, 22, 23, 24, -1, 26, -1,
28, 21, 22, 23, 24, -1, 26, -1, 28, 23,
24, -1, 26
}; };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] = static const yytype_uint8 yystos[] =
{ {
0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 3, 4, 5, 6, 7, 8, 10, 11, 12,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 14, 15, 17, 18, 19, 20, 21, 27, 30, 31,
27, 31, 32, 33, 34, 27, 27, 27, 27, 27, 32, 33, 27, 31, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 31, 32, 0,
27, 27, 32, 32, 33, 0, 21, 22, 23, 24, 5, 22, 23, 24, 26, 27, 32, 23, 24, 26,
26, 27, 33, 23, 24, 26, 32, 34, 32, 32, 31, 33, 31, 31, 31, 31, 31, 31, 31, 31,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 28, 28, 31, 31, 31,
32, 32, 32, 32, 28, 28, 32, 32, 32, 32, 31, 31, 32, 32, 31, 28, 28, 28, 28, 28,
32, 33, 33, 32, 28, 28, 28, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28
28, 29, 28, 28, 29, 28, 28, 28, 28, 28,
32, 32, 32, 28, 28, 28
}; };
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
@ -1547,120 +1528,102 @@ yyreduce:
case 18: case 18:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 50 "QuantityParser.y" #line 50 "QuantityParser.y"
{ (yyval) = atan2((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue());} { (yyval) = fabs((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 19: case 19:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 51 "QuantityParser.y" #line 51 "QuantityParser.y"
{ (yyval) = fabs((yyvsp[(3) - (4)]).getValue()); } { (yyval) = exp((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 20: case 20:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 52 "QuantityParser.y" #line 52 "QuantityParser.y"
{ (yyval) = exp((yyvsp[(3) - (4)]).getValue()); } { (yyval) = log((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 21: case 21:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 53 "QuantityParser.y" #line 53 "QuantityParser.y"
{ (yyval) = fmod((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); } { (yyval) = log10((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 22: case 22:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 54 "QuantityParser.y" #line 54 "QuantityParser.y"
{ (yyval) = log((yyvsp[(3) - (4)]).getValue()); } { (yyval) = sin((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 23: case 23:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 55 "QuantityParser.y" #line 55 "QuantityParser.y"
{ (yyval) = log10((yyvsp[(3) - (4)]).getValue()); } { (yyval) = sinh((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 24: case 24:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 56 "QuantityParser.y" #line 56 "QuantityParser.y"
{ (yyval) = pow((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); } { (yyval) = tan((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 25: case 25:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 57 "QuantityParser.y" #line 57 "QuantityParser.y"
{ (yyval) = sin((yyvsp[(3) - (4)]).getValue()); } { (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 26: case 26:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 58 "QuantityParser.y" #line 58 "QuantityParser.y"
{ (yyval) = sinh((yyvsp[(3) - (4)]).getValue()); } { (yyval) = sqrt((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 27: case 27:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 59 "QuantityParser.y" #line 59 "QuantityParser.y"
{ (yyval) = tan((yyvsp[(3) - (4)]).getValue()); } { (yyval) = cos((yyvsp[(3) - (4)]).getValue()); }
break; break;
case 28: case 28:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 60 "QuantityParser.y" #line 62 "QuantityParser.y"
{ (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 29: case 29:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 61 "QuantityParser.y" #line 63 "QuantityParser.y"
{ (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); } { (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]); }
break; break;
case 30: case 30:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 62 "QuantityParser.y" #line 64 "QuantityParser.y"
{ (yyval) = cos((yyvsp[(3) - (4)]).getValue()); } { (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]); }
break; break;
case 31: case 31:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 65 "QuantityParser.y" #line 65 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (3)]).pow ((yyvsp[(3) - (3)])); }
break; break;
case 32: case 32:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 66 "QuantityParser.y" #line 66 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]); } { (yyval) = (yyvsp[(2) - (3)]); }
break; break;
case 33: case 33:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 67 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]); }
break;
case 34:
/* Line 1787 of yacc.c */
#line 68 "QuantityParser.y" #line 68 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (3)]).pow ((yyvsp[(3) - (3)])); }
break;
case 35:
/* Line 1787 of yacc.c */
#line 69 "QuantityParser.y"
{ (yyval) = (yyvsp[(2) - (3)]); }
break;
case 36:
/* Line 1787 of yacc.c */
#line 71 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); } { (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); }
break; break;
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 1664 "QuantityParser.c" #line 1627 "QuantityParser.c"
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires
@ -1892,5 +1855,5 @@ yyreturn:
/* Line 2050 of yacc.c */ /* Line 2050 of yacc.c */
#line 75 "QuantityParser.y" #line 72 "QuantityParser.y"

View File

@ -22,6 +22,9 @@
DIGIT [0-9] DIGIT [0-9]
ID [a-z][a-z0-9]* ID [a-z][a-z0-9]*
EXPO [eE][-+]?[0-9]+
DGRP '\.'[0-9][0-9][0-9]
CGRP '\,'[0-9][0-9][0-9]
%x C_COMMENT %x C_COMMENT
@ -35,98 +38,101 @@ ID [a-z][a-z0-9]*
[ \t] ; [ \t] ;
[\n]+ ; [\n]+ ;
[-+()=/*^] { return *yytext; } [+()=/*^] { return *yytext; }
"nm" yylval = Quantity::NanoMetre; return UNIT; // nano meter "-" return MINUSSIGN;
"um" yylval = Quantity::MicroMetre; return UNIT; // micro meter "\xe2\x88\x92" return MINUSSIGN;
"\xC2\xB5m" yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8)
"mm" yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length)
"cm" yylval = Quantity::CentiMetre; return UNIT; // centi meter
"dm" yylval = Quantity::DeciMetre; return UNIT; // deci meter
"m" yylval = Quantity::Metre; return UNIT; // metre
"km" yylval = Quantity::KiloMetre; return UNIT; // kilo meter
"l" yylval = Quantity::Liter; return UNIT; // Liter dm^3 "nm" yylval = Quantity::NanoMetre; return UNIT; // nano meter
"um" yylval = Quantity::MicroMetre; return UNIT; // micro meter
"\xC2\xB5m" yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8)
"mm" yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length)
"cm" yylval = Quantity::CentiMetre; return UNIT; // centi meter
"dm" yylval = Quantity::DeciMetre; return UNIT; // deci meter
"m" yylval = Quantity::Metre; return UNIT; // metre
"km" yylval = Quantity::KiloMetre; return UNIT; // kilo meter
"ug" yylval = Quantity::MicroGram; return UNIT; // micro gram "l" yylval = Quantity::Liter; return UNIT; // Liter dm^3
"\xC2\xB5g" yylval = Quantity::MicroGram; return UNIT; // micro gram
"mg" yylval = Quantity::MilliGram; return UNIT; // milli gram
"g" yylval = Quantity::Gram; return UNIT; // gram
"kg" yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
"t" yylval = Quantity::Ton; return UNIT; // Metric Tonne
"s" yylval = Quantity::Second; return UNIT; // second (internal standard time) "ug" yylval = Quantity::MicroGram; return UNIT; // micro gram
"min" yylval = Quantity::Minute; return UNIT; // minute "\xC2\xB5g" yylval = Quantity::MicroGram; return UNIT; // micro gram
"h" yylval = Quantity::Hour; return UNIT; // hour "mg" yylval = Quantity::MilliGram; return UNIT; // milli gram
"g" yylval = Quantity::Gram; return UNIT; // gram
"kg" yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
"t" yylval = Quantity::Ton; return UNIT; // Metric Tonne
"A" yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current) "s" yylval = Quantity::Second; return UNIT; // second (internal standard time)
"mA" yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere "min" yylval = Quantity::Minute; return UNIT; // minute
"kA" yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere "h" yylval = Quantity::Hour; return UNIT; // hour
"MA" yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere
"K" yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature) "A" yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current)
"mK" yylval = Quantity::MilliKelvin; return UNIT; // Kelvin "mA" yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere
"\xC2\xB5K" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin "kA" yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere
"uK" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin "MA" yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere
"mol" yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance) "K" yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature)
"mK" yylval = Quantity::MilliKelvin; return UNIT; // Kelvin
"\xC2\xB5K" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
"uK" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
"cd" yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity) "mol" yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance)
"in" yylval = Quantity::Inch; return UNIT; // inch "cd" yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity)
"\"" yylval = Quantity::Inch; return UNIT; // inch
"ft" yylval = Quantity::Foot; return UNIT; // foot "in" yylval = Quantity::Inch; return UNIT; // inch
"'" yylval = Quantity::Foot; return UNIT; // foot "\"" yylval = Quantity::Inch; return UNIT; // inch
"thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000) "ft" yylval = Quantity::Foot; return UNIT; // foot
"mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US) "'" yylval = Quantity::Foot; return UNIT; // foot
"yd" yylval = Quantity::Yard; return UNIT; // yard "thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000)
"mi" yylval = Quantity::Mile; return UNIT; // mile "mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
"yd" yylval = Quantity::Yard; return UNIT; // yard
"mi" yylval = Quantity::Mile; return UNIT; // mile
"lb" yylval = Quantity::Pound; return UNIT; // pound "lb" yylval = Quantity::Pound; return UNIT; // pound
"lbm" yylval = Quantity::Pound; return UNIT; // pound "lbm" yylval = Quantity::Pound; return UNIT; // pound
"oz" yylval = Quantity::Ounce; return UNIT; // ounce "oz" yylval = Quantity::Ounce; return UNIT; // ounce
"st" yylval = Quantity::Stone; return UNIT; // Stone "st" yylval = Quantity::Stone; return UNIT; // Stone
"cwt" yylval = Quantity::Hundredweights; return UNIT; // hundredweights "cwt" yylval = Quantity::Hundredweights; return UNIT; // hundredweights
"lbf" yylval = Quantity::PoundForce; return UNIT; // pound "lbf" yylval = Quantity::PoundForce; return UNIT; // pound
"N" yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2) "N" yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2)
"kN" yylval = Quantity::KiloNewton; return UNIT; // Newton "kN" yylval = Quantity::KiloNewton; return UNIT; // Newton
"MN" yylval = Quantity::MegaNewton; return UNIT; // Newton "MN" yylval = Quantity::MegaNewton; return UNIT; // Newton
"mN" yylval = Quantity::MilliNewton; return UNIT; // Newton "mN" yylval = Quantity::MilliNewton; return UNIT; // Newton
"Pa" yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m*s^2 or N/m^2) "Pa" yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m*s^2 or N/m^2)
"kPa" yylval = Quantity::KiloPascal; return UNIT; // Pascal "kPa" yylval = Quantity::KiloPascal; return UNIT; // Pascal
"MPa" yylval = Quantity::MegaPascal; return UNIT; // Pascal "MPa" yylval = Quantity::MegaPascal; return UNIT; // Pascal
"GPa" yylval = Quantity::GigaPascal; return UNIT; // Pascal "GPa" yylval = Quantity::GigaPascal; return UNIT; // Pascal
"Torr" yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 ) "Torr" yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 )
"mTorr" yylval = Quantity::mTorr; return UNIT; // "mTorr" yylval = Quantity::mTorr; return UNIT; //
"uTorr" yylval = Quantity::yTorr; return UNIT; // "uTorr" yylval = Quantity::yTorr; return UNIT; //
"\xC2\xB5Torr" yylval = Quantity::yTorr; return UNIT; // "\xC2\xB5Torr" yylval = Quantity::yTorr; return UNIT; //
"psi" yylval = Quantity::PSI; return UNIT; // pounds/in^2 "psi" yylval = Quantity::PSI; return UNIT; // pounds/in^2
"ksi" yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2 "ksi" yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2
"W" yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3) "W" yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3)
"VA" yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3) "VA" yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3)
"J" yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2) "J" yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
"Nm" yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule "Nm" yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
"VAs" yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule "VAs" yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
"CV" yylval = Quantity::WattSecond; return UNIT; // "CV" yylval = Quantity::WattSecond; return UNIT; //
"Ws" yylval = Quantity::WattSecond; return UNIT; // W*s = Joule "Ws" yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
"\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) "\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
"deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) "deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
"rad" yylval = Quantity::Radian; return UNIT; // radian "rad" yylval = Quantity::Radian; return UNIT; // radian
"gon" yylval = Quantity::Gon; return UNIT; // gon "gon" yylval = Quantity::Gon; return UNIT; // gon
{DIGIT}+"."?{DIGIT}*{EXPO}? { yylval = num_change(yytext,'.',',');return NUM; }
{DIGIT}+","?{DIGIT}*{EXPO}? { yylval = num_change(yytext,',','.');return NUM; }
{DIGIT}*["."","]{DIGIT}*[eE][-+]?[0-9]+ {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
{DIGIT}*["."","]{DIGIT}* {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
{DIGIT}+ {yylval = atof( yytext ); return NUM;}
"pi" {yylval = M_PI ; return NUM;} // constant pi "pi" {yylval = M_PI ; return NUM;} // constant pi
"e" {yylval = M_E ; return NUM;} // constant e "e" {yylval = M_E ; return NUM;} // constant e

View File

@ -17,9 +17,9 @@
%} %}
/* Bison declarations. */ /* Bison declarations. */
%token UNIT NUM %token UNIT NUM MINUSSIGN
%token ACOS ASIN ATAN ATAN2 COS EXP ABS MOD LOG LOG10 POW SIN SINH TAN TANH SQRT; %token ACOS ASIN ATAN ATAN2 COS EXP ABS MOD LOG LOG10 POW SIN SINH TAN TANH SQRT;
%left '-' '+' %left MINUSSIGN '+'
%left '*' '/' %left '*' '/'
%left NEG /* negation--unary minus */ %left NEG /* negation--unary minus */
%right '^' /* exponentiation */ %right '^' /* exponentiation */
@ -38,27 +38,24 @@
; ;
num: NUM { $$ = $1; } num: NUM { $$ = $1; }
| num '+' num { $$ = $1.getValue() + $3.getValue(); } | num '+' num { $$ = $1.getValue() + $3.getValue(); }
| num '-' num { $$ = $1.getValue() - $3.getValue(); } | num MINUSSIGN num { $$ = $1.getValue() - $3.getValue(); }
| num '*' num { $$ = $1.getValue() * $3.getValue(); } | num '*' num { $$ = $1.getValue() * $3.getValue(); }
| num '/' num { $$ = $1.getValue() / $3.getValue(); } | num '/' num { $$ = $1.getValue() / $3.getValue(); }
| '-' num %prec NEG { $$ = -$2.getValue(); } | MINUSSIGN num %prec NEG { $$ = -$2.getValue(); }
| num '^' num { $$ = pow ($1.getValue(), $3.getValue());} | num '^' num { $$ = pow ($1.getValue(), $3.getValue());}
| '(' num ')' { $$ = $2; } | '(' num ')' { $$ = $2; }
| ACOS '(' num ')' { $$ = acos($3.getValue()); } | ACOS '(' num ')' { $$ = acos($3.getValue()); }
| ASIN '(' num ')' { $$ = asin($3.getValue()); } | ASIN '(' num ')' { $$ = asin($3.getValue()); }
| ATAN '(' num ')' { $$ = atan($3.getValue()); } | ATAN '(' num ')' { $$ = atan($3.getValue()); }
| ATAN2 '(' num ',' num ')' { $$ = atan2($3.getValue(),$5.getValue());}
| ABS '(' num ')' { $$ = fabs($3.getValue()); } | ABS '(' num ')' { $$ = fabs($3.getValue()); }
| EXP '(' num ')' { $$ = exp($3.getValue()); } | EXP '(' num ')' { $$ = exp($3.getValue()); }
| MOD '(' num ',' num ')' { $$ = fmod($3.getValue(),$5.getValue()); }
| LOG '(' num ')' { $$ = log($3.getValue()); } | LOG '(' num ')' { $$ = log($3.getValue()); }
| LOG10 '(' num ')' { $$ = log10($3.getValue()); } | LOG10 '(' num ')' { $$ = log10($3.getValue()); }
| POW '(' num ',' num ')' { $$ = pow($3.getValue(),$5.getValue()); }
| SIN '(' num ')' { $$ = sin($3.getValue()); } | SIN '(' num ')' { $$ = sin($3.getValue()); }
| SINH '(' num ')' { $$ = sinh($3.getValue()); } | SINH '(' num ')' { $$ = sinh($3.getValue()); }
| TAN '(' num ')' { $$ = tan($3.getValue()); } | TAN '(' num ')' { $$ = tan($3.getValue()); }
| TANH '(' num ')' { $$ = tanh($3.getValue()); } | TANH '(' num ')' { $$ = tanh($3.getValue()); }
| SQRT '(' num ')' { $$ = tanh($3.getValue()); } | SQRT '(' num ')' { $$ = sqrt($3.getValue()); }
| COS '(' num ')' { $$ = cos($3.getValue()); } | COS '(' num ')' { $$ = cos($3.getValue()); }
; ;

View File

@ -27,14 +27,14 @@ Quantity(string) -- arbitrary mixture of numbers and chars defining a Quantity
</UserDocu> </UserDocu>
<DeveloperDocu>Quantity</DeveloperDocu> <DeveloperDocu>Quantity</DeveloperDocu>
</Documentation> </Documentation>
<Methode Name="getUserPreferred"> <Methode Name="getUserPreferred" Const="true">
<Documentation> <Documentation>
<UserDocu> <UserDocu>
returns a quantity with the translation factor and a string with the prevered unit returns a quantity with the translation factor and a string with the prevered unit
</UserDocu> </UserDocu>
</Documentation> </Documentation>
</Methode> </Methode>
<Methode Name="getValueAs"> <Methode Name="getValueAs" Const="true">
<Documentation> <Documentation>
<UserDocu> <UserDocu>
returns a floating point value as the provided unit returns a floating point value as the provided unit

View File

@ -258,45 +258,56 @@ PyObject * QuantityPy::number_absolute_handler (PyObject *self)
PyObject* QuantityPy::number_add_handler(PyObject *self, PyObject *other) PyObject* QuantityPy::number_add_handler(PyObject *self, PyObject *other)
{ {
if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type)) ||
PyErr_SetString(PyExc_TypeError, "First arg must be Quantity"); !PyObject_TypeCheck(other, &(QuantityPy::Type))) {
return 0; std::stringstream ret;
} ret << self->ob_type->tp_name << " and " << other->ob_type->tp_name
if (!PyObject_TypeCheck(other, &(QuantityPy::Type))) { << " cannot be mixed in Quantity.__add__.\n"
PyErr_SetString(PyExc_TypeError, "Second arg must be Quantity"); << "Make sure to use matching types.";
PyErr_SetString(PyExc_TypeError, ret.str().c_str());
return 0; return 0;
} }
try {
Base::Quantity *a = static_cast<QuantityPy*>(self)->getQuantityPtr(); Base::Quantity *a = static_cast<QuantityPy*>(self)->getQuantityPtr();
Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr(); Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr();
return new QuantityPy(new Quantity(*a+*b) ); return new QuantityPy(new Quantity(*a+*b) );
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_RuntimeError, e.what());
return 0;
}
} }
PyObject* QuantityPy::number_subtract_handler(PyObject *self, PyObject *other) PyObject* QuantityPy::number_subtract_handler(PyObject *self, PyObject *other)
{ {
if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type)) ||
PyErr_SetString(PyExc_TypeError, "First arg must be Quantity"); !PyObject_TypeCheck(other, &(QuantityPy::Type))) {
return 0; std::stringstream ret;
} ret << self->ob_type->tp_name << " and " << other->ob_type->tp_name
if (!PyObject_TypeCheck(other, &(QuantityPy::Type))) { << " cannot be mixed in Quantity.__sub__.\n"
PyErr_SetString(PyExc_TypeError, "Second arg must be Quantity"); << "Make sure to use matching types.";
PyErr_SetString(PyExc_TypeError, ret.str().c_str());
return 0; return 0;
} }
try {
Base::Quantity *a = static_cast<QuantityPy*>(self)->getQuantityPtr(); Base::Quantity *a = static_cast<QuantityPy*>(self)->getQuantityPtr();
Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr(); Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr();
return new QuantityPy(new Quantity(*a-*b) ); return new QuantityPy(new Quantity(*a-*b) );
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_RuntimeError, e.what());
return 0;
}
} }
PyObject* QuantityPy::number_multiply_handler(PyObject *self, PyObject *other) PyObject* QuantityPy::number_multiply_handler(PyObject *self, PyObject *other)
{ {
if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { if (PyObject_TypeCheck(self, &(QuantityPy::Type))) {
PyErr_SetString(PyExc_TypeError, "First arg must be Quantity");
return 0;
}
if (PyObject_TypeCheck(other, &(QuantityPy::Type))) { if (PyObject_TypeCheck(other, &(QuantityPy::Type))) {
Base::Quantity *a = static_cast<QuantityPy*>(self) ->getQuantityPtr(); Base::Quantity *a = static_cast<QuantityPy*>(self) ->getQuantityPtr();
Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr(); Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr();
return new QuantityPy(new Quantity(*a * *b) ); return new QuantityPy(new Quantity(*a * *b) );
} }
else if (PyFloat_Check(other)) { else if (PyFloat_Check(other)) {
@ -309,10 +320,22 @@ PyObject* QuantityPy::number_multiply_handler(PyObject *self, PyObject *other)
double b = (double)PyInt_AsLong(other); double b = (double)PyInt_AsLong(other);
return new QuantityPy(new Quantity(*a*b) ); return new QuantityPy(new Quantity(*a*b) );
} }
else { }
else if (PyObject_TypeCheck(other, &(QuantityPy::Type))) {
if (PyFloat_Check(self)) {
Base::Quantity *a = static_cast<QuantityPy*>(other) ->getQuantityPtr();
double b = PyFloat_AsDouble(self);
return new QuantityPy(new Quantity(*a*b) );
}
else if (PyInt_Check(self)) {
Base::Quantity *a = static_cast<QuantityPy*>(other) ->getQuantityPtr();
double b = (double)PyInt_AsLong(self);
return new QuantityPy(new Quantity(*a*b) );
}
}
PyErr_SetString(PyExc_TypeError, "A Quantity can only be multiplied by Quantity or number"); PyErr_SetString(PyExc_TypeError, "A Quantity can only be multiplied by Quantity or number");
return 0; return 0;
}
} }
PyObject * QuantityPy::number_divide_handler (PyObject *self, PyObject *other) PyObject * QuantityPy::number_divide_handler (PyObject *self, PyObject *other)

1355
src/Base/StackWalker.cpp Normal file

File diff suppressed because it is too large Load Diff

214
src/Base/StackWalker.h Normal file
View File

@ -0,0 +1,214 @@
/**********************************************************************
*
* StackWalker.h
*
*
*
* LICENSE (http://www.opensource.org/licenses/bsd-license.php)
*
* Copyright (c) 2005-2009, Jochen Kalmbach
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
* Neither the name of Jochen Kalmbach nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
* 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 A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* **********************************************************************/
// #pragma once is supported starting with _MCS_VER 1000,
// so we need not to check the version (because we only support _MSC_VER >= 1100)!
#pragma once
#include <windows.h>
// special defines for VC5/6 (if no actual PSDK is installed):
#if _MSC_VER < 1300
typedef unsigned __int64 DWORD64, *PDWORD64;
#if defined(_WIN64)
typedef unsigned __int64 SIZE_T, *PSIZE_T;
#else
typedef unsigned long SIZE_T, *PSIZE_T;
#endif
#endif // _MSC_VER < 1300
class StackWalkerInternal; // forward
class BaseExport StackWalker
{
public:
typedef enum StackWalkOptions
{
// No addition info will be retrived
// (only the address is available)
RetrieveNone = 0,
// Try to get the symbol-name
RetrieveSymbol = 1,
// Try to get the line for this symbol
RetrieveLine = 2,
// Try to retrieve the module-infos
RetrieveModuleInfo = 4,
// Also retrieve the version for the DLL/EXE
RetrieveFileVersion = 8,
// Contains all the abouve
RetrieveVerbose = 0xF,
// Generate a "good" symbol-search-path
SymBuildPath = 0x10,
// Also use the public Microsoft-Symbol-Server
SymUseSymSrv = 0x20,
// Contains all the abouve "Sym"-options
SymAll = 0x30,
// Contains all options (default)
OptionsAll = 0x3F
} StackWalkOptions;
StackWalker(
int options = OptionsAll, // 'int' is by design, to combine the enum-flags
LPCSTR szSymPath = NULL,
DWORD dwProcessId = GetCurrentProcessId(),
HANDLE hProcess = GetCurrentProcess()
);
StackWalker(DWORD dwProcessId, HANDLE hProcess);
virtual ~StackWalker();
typedef BOOL (__stdcall *PReadProcessMemoryRoutine)(
HANDLE hProcess,
DWORD64 qwBaseAddress,
PVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesRead,
LPVOID pUserData // optional data, which was passed in "ShowCallstack"
);
BOOL LoadModules();
BOOL ShowCallstack(
HANDLE hThread = GetCurrentThread(),
const CONTEXT *context = NULL,
PReadProcessMemoryRoutine readMemoryFunction = NULL,
LPVOID pUserData = NULL // optional to identify some data in the 'readMemoryFunction'-callback
);
#if _MSC_VER >= 1300
// due to some reasons, the "STACKWALK_MAX_NAMELEN" must be declared as "public"
// in older compilers in order to use it... starting with VC7 we can declare it as "protected"
protected:
#endif
enum { STACKWALK_MAX_NAMELEN = 1024 }; // max name length for found symbols
protected:
// Entry for each Callstack-Entry
typedef struct CallstackEntry
{
DWORD64 offset; // if 0, we have no valid entry
CHAR name[STACKWALK_MAX_NAMELEN];
CHAR undName[STACKWALK_MAX_NAMELEN];
CHAR undFullName[STACKWALK_MAX_NAMELEN];
DWORD64 offsetFromSmybol;
DWORD offsetFromLine;
DWORD lineNumber;
CHAR lineFileName[STACKWALK_MAX_NAMELEN];
DWORD symType;
LPCSTR symTypeString;
CHAR moduleName[STACKWALK_MAX_NAMELEN];
DWORD64 baseOfImage;
CHAR loadedImageName[STACKWALK_MAX_NAMELEN];
} CallstackEntry;
typedef enum CallstackEntryType {firstEntry, nextEntry, lastEntry};
virtual void OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName);
virtual void OnLoadModule(LPCSTR img, LPCSTR mod, DWORD64 baseAddr, DWORD size, DWORD result, LPCSTR symType, LPCSTR pdbName, ULONGLONG fileVersion);
virtual void OnCallstackEntry(CallstackEntryType eType, CallstackEntry &entry);
virtual void OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr);
virtual void OnOutput(LPCSTR szText);
StackWalkerInternal *m_sw;
HANDLE m_hProcess;
DWORD m_dwProcessId;
BOOL m_modulesLoaded;
LPSTR m_szSymPath;
int m_options;
int m_MaxRecursionCount;
static BOOL __stdcall myReadProcMem(HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead);
friend StackWalkerInternal;
}; // class StackWalker
// The "ugly" assembler-implementation is needed for systems before XP
// If you have a new PSDK and you only compile for XP and later, then you can use
// the "RtlCaptureContext"
// Currently there is no define which determines the PSDK-Version...
// So we just use the compiler-version (and assumes that the PSDK is
// the one which was installed by the VS-IDE)
// INFO: If you want, you can use the RtlCaptureContext if you only target XP and later...
// But I currently use it in x64/IA64 environments...
//#if defined(_M_IX86) && (_WIN32_WINNT <= 0x0500) && (_MSC_VER < 1400)
#if defined(_M_IX86)
#ifdef CURRENT_THREAD_VIA_EXCEPTION
// TODO: The following is not a "good" implementation,
// because the callstack is only valid in the "__except" block...
#define GET_CURRENT_CONTEXT(c, contextFlags) \
do { \
memset(&c, 0, sizeof(CONTEXT)); \
EXCEPTION_POINTERS *pExp = NULL; \
__try { \
throw 0; \
} __except( ( (pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER)) {} \
if (pExp != NULL) \
memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
c.ContextFlags = contextFlags; \
} while(0);
#else
// The following should be enough for walking the callstack...
#define GET_CURRENT_CONTEXT(c, contextFlags) \
do { \
memset(&c, 0, sizeof(CONTEXT)); \
c.ContextFlags = contextFlags; \
__asm call x \
__asm x: pop eax \
__asm mov c.Eip, eax \
__asm mov c.Ebp, ebp \
__asm mov c.Esp, esp \
} while(0);
#endif
#else
// The following is defined for x86 (XP and higher), x64 and IA64:
#define GET_CURRENT_CONTEXT(c, contextFlags) \
do { \
memset(&c, 0, sizeof(CONTEXT)); \
c.ContextFlags = contextFlags; \
RtlCaptureContext(&c); \
} while(0);
#endif

View File

@ -136,26 +136,48 @@ QString UnitsApi::schemaTranslate(Base::Quantity quant,double &factor,QString &u
// return PyFloat_FromDouble(Value * UserPrefFactor[t]); // return PyFloat_FromDouble(Value * UserPrefFactor[t]);
//} //}
// //
double UnitsApi::toDbl(PyObject *ArgObj,const Base::Unit &u)
{
if (PyString_Check(ArgObj))
QString str = QString::fromAscii(PyString_AsString(ArgObj));
else if (PyFloat_Check(ArgObj))
double d = PyFloat_AsDouble(ArgObj);
else if (PyInt_Check(ArgObj))
double d = (double)PyInt_AsLong(ArgObj);
else
throw Base::Exception("Wrong parameter type!");
return 0.0; double UnitsApi::toDbl(PyObject *ArgObj, const Base::Unit &u)
{
if (PyString_Check(ArgObj)) {
// Parse the string
QString str = QString::fromLatin1(PyString_AsString(ArgObj));
Quantity q = Quantity::parse(str);
if (q.getUnit() == u)
return q.getValue();
throw Base::Exception("Wrong unit type!");
}
else if (PyFloat_Check(ArgObj)) {
return PyFloat_AsDouble(ArgObj);
}
else if (PyInt_Check(ArgObj)) {
return static_cast<double>(PyInt_AsLong(ArgObj));
}
else {
throw Base::Exception("Wrong parameter type!");
}
} }
Quantity UnitsApi::toQuantity(PyObject *ArgObj,const Base::Unit &u) Quantity UnitsApi::toQuantity(PyObject *ArgObj, const Base::Unit &u)
{ {
double d;
if (PyString_Check(ArgObj)) {
// Parse the string
QString str = QString::fromLatin1(PyString_AsString(ArgObj));
Quantity q = Quantity::parse(str);
d = q.getValue();
}
else if (PyFloat_Check(ArgObj)) {
d = PyFloat_AsDouble(ArgObj);
}
else if (PyInt_Check(ArgObj)) {
d = static_cast<double>(PyInt_AsLong(ArgObj));
}
else {
throw Base::Exception("Wrong parameter type!");
}
return Quantity(d,u);
return Quantity();
} }
void UnitsApi::setDecimals(int prec) void UnitsApi::setDecimals(int prec)

View File

@ -65,15 +65,32 @@ QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QStr
factor = 1.0; factor = 1.0;
} }
}else if (unit == Unit::Area){ }else if (unit == Unit::Area){
// TODO Cascade for the Areas if(UnitValue < 100.0){// smaller than 1 square cm
// default action for all cases without special treatment: unitString = QString::fromLatin1("mm^2");
unitString = quant.getUnit().getString();
factor = 1.0; factor = 1.0;
}else if(UnitValue < 10000000000000.0 ){
unitString = QString::fromLatin1("m^2");
factor = 1000000.0;
}else{ // bigger then 1 square kilometer
unitString = QString::fromLatin1("km^2");
factor = 1000000000000.0;
}
}else if (unit == Unit::Mass){ }else if (unit == Unit::Mass){
// TODO Cascade for the wights // TODO Cascade for the wights
// default action for all cases without special treatment: // default action for all cases without special treatment:
unitString = quant.getUnit().getString(); unitString = quant.getUnit().getString();
factor = 1.0; factor = 1.0;
}else if (unit == Unit::Volume){
if(UnitValue < 1000000.0){// smaller than 10 cubic cm
unitString = QString::fromLatin1("mm^3");
factor = 1.0;
}else if(UnitValue < 1000000000000000000.0 ){
unitString = QString::fromLatin1("m^3");
factor = 1000000000.0;
}else{ // bigger then 1 cubic kilometer
unitString = QString::fromLatin1("km^3");
factor = 1000000000000000000.0;
}
}else if (unit == Unit::Pressure){ }else if (unit == Unit::Pressure){
if(UnitValue < 10.0){// Pa is the smallest if(UnitValue < 10.0){// Pa is the smallest
unitString = QString::fromLatin1("Pa"); unitString = QString::fromLatin1("Pa");

View File

@ -1130,7 +1130,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms // TMM: added this seqref ctor for use with STL algorithms
seqref (Object& obj) seqref (Object& obj)
: s(dynamic_cast< SeqBase<T>&>(obj)) : s(dynamic_cast< SeqBase<T>&>(obj))
, offset( NULL ) , offset( 0 )
, the_item(s.getItem(offset)) , the_item(s.getItem(offset))
{} {}
~seqref() ~seqref()

View File

@ -1559,7 +1559,7 @@ MSCGEN_PATH =
# inheritance and usage relations if the target is undocumented # inheritance and usage relations if the target is undocumented
# or is not a class. # or is not a class.
HIDE_UNDOC_RELATIONS = YES HIDE_UNDOC_RELATIONS = NO
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization # available from the path. This tool is part of Graphviz, a graph visualization

View File

@ -772,6 +772,17 @@ UndoAction::~UndoAction()
void UndoAction::addTo (QWidget * w) void UndoAction::addTo (QWidget * w)
{ {
if (w->inherits("QToolBar")) { if (w->inherits("QToolBar")) {
actionChanged();
connect(_action, SIGNAL(changed()), this, SLOT(actionChanged()));
w->addAction(_toolAction);
}
else {
w->addAction(_action);
}
}
void UndoAction::actionChanged()
{
// Do NOT set the shortcut again for _toolAction since this is already // Do NOT set the shortcut again for _toolAction since this is already
// reserved for _action. Otherwise we get an ambiguity of it with the // reserved for _action. Otherwise we get an ambiguity of it with the
// result that it doesn't work anymore. // result that it doesn't work anymore.
@ -780,11 +791,6 @@ void UndoAction::addTo (QWidget * w)
_toolAction->setStatusTip(_action->statusTip()); _toolAction->setStatusTip(_action->statusTip());
_toolAction->setWhatsThis(_action->whatsThis()); _toolAction->setWhatsThis(_action->whatsThis());
_toolAction->setIcon(_action->icon()); _toolAction->setIcon(_action->icon());
w->addAction(_toolAction);
}
else {
w->addAction(_action);
}
} }
void UndoAction::setEnabled(bool b) void UndoAction::setEnabled(bool b)
@ -819,6 +825,17 @@ RedoAction::~RedoAction()
void RedoAction::addTo ( QWidget * w ) void RedoAction::addTo ( QWidget * w )
{ {
if (w->inherits("QToolBar")) { if (w->inherits("QToolBar")) {
actionChanged();
connect(_action, SIGNAL(changed()), this, SLOT(actionChanged()));
w->addAction(_toolAction);
}
else {
w->addAction(_action);
}
}
void RedoAction::actionChanged()
{
// Do NOT set the shortcut again for _toolAction since this is already // Do NOT set the shortcut again for _toolAction since this is already
// reserved for _action. Otherwise we get an ambiguity of it with the // reserved for _action. Otherwise we get an ambiguity of it with the
// result that it doesn't work anymore. // result that it doesn't work anymore.
@ -827,11 +844,6 @@ void RedoAction::addTo ( QWidget * w )
_toolAction->setStatusTip(_action->statusTip()); _toolAction->setStatusTip(_action->statusTip());
_toolAction->setWhatsThis(_action->whatsThis()); _toolAction->setWhatsThis(_action->whatsThis());
_toolAction->setIcon(_action->icon()); _toolAction->setIcon(_action->icon());
w->addAction(_toolAction);
}
else {
w->addAction(_action);
}
} }
void RedoAction::setEnabled ( bool b ) void RedoAction::setEnabled ( bool b )

View File

@ -219,6 +219,9 @@ public:
void setEnabled(bool); void setEnabled(bool);
void setVisible(bool); void setVisible(bool);
private Q_SLOTS:
void actionChanged();
private: private:
QAction* _toolAction; QAction* _toolAction;
}; };
@ -241,6 +244,9 @@ public:
void setEnabled(bool); void setEnabled(bool);
void setVisible(bool); void setVisible(bool);
private Q_SLOTS:
void actionChanged();
private: private:
QAction* _toolAction; QAction* _toolAction;
}; };

View File

@ -214,11 +214,19 @@ void ObjectLabelObserver::slotRelabelObject(const App::DocumentObject& obj, cons
} }
// make sure that there is a name conflict otherwise we don't have to do anything // make sure that there is a name conflict otherwise we don't have to do anything
if (match) { if (match && !label.empty()) {
// remove number from end to avoid lengthy names // remove number from end to avoid lengthy names
size_t lastpos = label.length()-1; size_t lastpos = label.length()-1;
while (label[lastpos] >= 48 && label[lastpos] <= 57) while (label[lastpos] >= 48 && label[lastpos] <= 57) {
// if 'lastpos' becomes 0 then all characters are digits. In this case we use
// the complete label again
if (lastpos == 0) {
lastpos = label.length()-1;
break;
}
lastpos--; lastpos--;
}
label = label.substr(0, lastpos+1); label = label.substr(0, lastpos+1);
label = Base::Tools::getUniqueName(label, objectLabels, 3); label = Base::Tools::getUniqueName(label, objectLabels, 3);
this->current = &obj; this->current = &obj;
@ -350,12 +358,14 @@ Application::Application(bool GUIenabled)
throw Base::Exception("Invalid system settings"); throw Base::Exception("Invalid system settings");
} }
#endif #endif
#if 0 // QuantitySpinBox and InputField try to handle the group separator now
// http://forum.freecadweb.org/viewtopic.php?f=10&t=6910 // http://forum.freecadweb.org/viewtopic.php?f=10&t=6910
// A workaround is to disable the group separator for double-to-string conversion, i.e. // A workaround is to disable the group separator for double-to-string conversion, i.e.
// setting the flag 'OmitGroupSeparator'. // setting the flag 'OmitGroupSeparator'.
QLocale loc = QLocale::system(); QLocale loc = QLocale::system();
loc.setNumberOptions(QLocale::OmitGroupSeparator); loc.setNumberOptions(QLocale::OmitGroupSeparator);
QLocale::setDefault(loc); QLocale::setDefault(loc);
#endif
// setting up Python binding // setting up Python binding
Base::PyGILStateLocker lock; Base::PyGILStateLocker lock;
@ -1621,11 +1631,11 @@ void Application::runApplication(void)
} }
#if QT_VERSION >= 0x040200 #if QT_VERSION >= 0x040200
if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) { 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 #endif
if (!QGLPixelBuffer::hasOpenGLPbuffers()) { 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 (); QGLFormat::OpenGLVersionFlags version = QGLFormat::openGLVersionFlags ();

View File

@ -234,8 +234,11 @@ public:
PYFUNCDEF_S(sGetDocument); PYFUNCDEF_S(sGetDocument);
PYFUNCDEF_S(sDoCommand); PYFUNCDEF_S(sDoCommand);
PYFUNCDEF_S(sDoCommandGui);
PYFUNCDEF_S(sAddModule); PYFUNCDEF_S(sAddModule);
PYFUNCDEF_S(sShowDownloads);
static PyMethodDef Methods[]; static PyMethodDef Methods[];
private: private:

View File

@ -44,6 +44,7 @@
#include "Workbench.h" #include "Workbench.h"
#include "WorkbenchManager.h" #include "WorkbenchManager.h"
#include "Language/Translator.h" #include "Language/Translator.h"
#include "DownloadManager.h"
#include <App/DocumentObjectPy.h> #include <App/DocumentObjectPy.h>
#include <App/PropertyFile.h> #include <App/PropertyFile.h>
#include <Base/Interpreter.h> #include <Base/Interpreter.h>
@ -136,9 +137,15 @@ PyMethodDef Application::Methods[] = {
{"doCommand", (PyCFunction) Application::sDoCommand, 1, {"doCommand", (PyCFunction) Application::sDoCommand, 1,
"doCommand(string) -> None\n\n" "doCommand(string) -> None\n\n"
"Prints the given string in the python console and runs it"}, "Prints the given string in the python console and runs it"},
{"doCommandGui", (PyCFunction) Application::sDoCommandGui, 1,
"doCommandGui(string) -> None\n\n"
"Prints the given string in the python console and runs it but doesn't record it in macros"},
{"addModule", (PyCFunction) Application::sAddModule, 1, {"addModule", (PyCFunction) Application::sAddModule, 1,
"addModule(string) -> None\n\n" "addModule(string) -> None\n\n"
"Prints the given module import only once in the macro recording"}, "Prints the given module import only once in the macro recording"},
{"showDownloads", (PyCFunction) Application::sShowDownloads,1,
"showDownloads() -> None\n\n"
"Shows the downloads manager window"},
{NULL, NULL} /* Sentinel */ {NULL, NULL} /* Sentinel */
}; };
@ -534,12 +541,13 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *
catch (const XERCES_CPP_NAMESPACE_QUALIFIER TranscodingException& e) { catch (const XERCES_CPP_NAMESPACE_QUALIFIER TranscodingException& e) {
std::stringstream err; std::stringstream err;
char *pMsg = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(e.getMessage()); char *pMsg = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(e.getMessage());
err << "Transcoding exception raised in activateWorkbench.\n" err << "Transcoding exception in Xerces-c:\n\n"
<< "Transcoding exception raised in activateWorkbench.\n"
<< "Check if your user configuration file is valid.\n" << "Check if your user configuration file is valid.\n"
<< " Exception message:" << " Exception message:"
<< pMsg; << pMsg;
XERCES_CPP_NAMESPACE_QUALIFIER XMLString::release(&pMsg); XERCES_CPP_NAMESPACE_QUALIFIER XMLString::release(&pMsg);
PyErr_SetString(PyExc_RuntimeError, "Transcoding exception in Xerces-c: "); PyErr_SetString(PyExc_RuntimeError, err.str().c_str());
return 0; return 0;
} }
catch (...) { catch (...) {
@ -844,6 +852,15 @@ PyObject* Application::sDoCommand(PyObject * /*self*/, PyObject *args,PyObject *
return Py_None; return Py_None;
} }
PyObject* Application::sDoCommandGui(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *pstr=0;
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
return NULL; // NULL triggers exception
Command::runCommand(Command::Gui,pstr);
return Py_None;
}
PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/) PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{ {
char *pstr=0; char *pstr=0;
@ -852,3 +869,11 @@ PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject *
Command::addModule(Command::Doc,pstr); Command::addModule(Command::Doc,pstr);
return Py_None; return Py_None;
} }
PyObject* Application::sShowDownloads(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Gui::Dialog::DownloadManager::getInstance();
return Py_None;
}

View File

@ -257,6 +257,9 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const
break; break;
} }
} }
if (!icon.isNull())
break;
} }
} }
} }

View File

@ -201,6 +201,7 @@ set(Gui_MOC_HDRS
PythonConsole.h PythonConsole.h
PythonDebugger.h PythonDebugger.h
PythonEditor.h PythonEditor.h
QuantitySpinBox.h
ReportView.h ReportView.h
SceneInspector.h SceneInspector.h
SelectionView.h SelectionView.h
@ -769,6 +770,7 @@ SET(Widget_CPP_SRCS
PrefWidgets.cpp PrefWidgets.cpp
InputField.cpp InputField.cpp
ProgressBar.cpp ProgressBar.cpp
QuantitySpinBox.cpp
SpinBox.cpp SpinBox.cpp
Splashscreen.cpp Splashscreen.cpp
WidgetFactory.cpp WidgetFactory.cpp
@ -781,6 +783,7 @@ SET(Widget_HPP_SRCS
PrefWidgets.h PrefWidgets.h
InputField.h InputField.h
ProgressBar.h ProgressBar.h
QuantitySpinBox.h
SpinBox.h SpinBox.h
Splashscreen.h Splashscreen.h
WidgetFactory.h WidgetFactory.h

View File

@ -309,7 +309,7 @@ void Command::invoke(int i)
} }
#ifndef FC_DEBUG #ifndef FC_DEBUG
catch (...) { catch (...) {
Base::Console().Error("Gui::Command::activated(%d): Unknown C++ exception thrown", i); Base::Console().Error("Gui::Command::activated(%d): Unknown C++ exception thrown\n", i);
} }
#endif #endif
} }
@ -557,35 +557,41 @@ const char * Command::endCmdHelp(void)
return "</body></html>\n\n"; return "</body></html>\n\n";
} }
void Command::applyCommandData(Action* action) void Command::applyCommandData(const char* context, Action* action)
{ {
action->setText(QCoreApplication::translate( action->setText(QCoreApplication::translate(
this->className(), sMenuText, 0, context, getMenuText(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
action->setToolTip(QCoreApplication::translate( action->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText, 0, context, getToolTipText(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
if (sStatusTip) if (sStatusTip)
action->setStatusTip(QCoreApplication::translate( action->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip, 0, context, getStatusTip(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
else else
action->setStatusTip(QCoreApplication::translate( action->setStatusTip(QCoreApplication::translate(
this->className(), sToolTipText, 0, context, getToolTipText(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
if (sWhatsThis) if (sWhatsThis)
action->setWhatsThis(QCoreApplication::translate( action->setWhatsThis(QCoreApplication::translate(
this->className(), sWhatsThis, 0, context, getWhatsThis(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
else else
action->setWhatsThis(QCoreApplication::translate( action->setWhatsThis(QCoreApplication::translate(
this->className(), sToolTipText, 0, context, getToolTipText(), 0,
QCoreApplication::UnicodeUTF8)); QCoreApplication::UnicodeUTF8));
QString accel = action->shortcut().toString(); QString accel = action->shortcut().toString(QKeySequence::NativeText);
if (!accel.isEmpty()) { if (!accel.isEmpty()) {
QString tip = QString::fromAscii("(%1)\t%2") // show shortcut inside tooltip
QString ttip = QString::fromLatin1("%1 (%2)")
.arg(action->toolTip()).arg(accel);
action->setToolTip(ttip);
// show shortcut inside status tip
QString stip = QString::fromLatin1("(%1)\t%2")
.arg(accel).arg(action->statusTip()); .arg(accel).arg(action->statusTip());
action->setStatusTip(tip); action->setStatusTip(stip);
} }
} }
@ -647,10 +653,10 @@ Action * Command::createAction(void)
Action *pcAction; Action *pcAction;
pcAction = new Action(this,getMainWindow()); pcAction = new Action(this,getMainWindow());
applyCommandData(pcAction); pcAction->setShortcut(QString::fromAscii(sAccel));
applyCommandData(this->className(), pcAction);
if (sPixmap) if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromAscii(sAccel));
return pcAction; return pcAction;
} }
@ -658,7 +664,7 @@ Action * Command::createAction(void)
void Command::languageChange() void Command::languageChange()
{ {
if (_pcAction) { if (_pcAction) {
applyCommandData(_pcAction); applyCommandData(this->className(), _pcAction);
} }
} }
@ -700,10 +706,26 @@ Action * MacroCommand::createAction(void)
pcAction->setText(QString::fromUtf8(sMenuText)); pcAction->setText(QString::fromUtf8(sMenuText));
pcAction->setToolTip(QString::fromUtf8(sToolTipText)); pcAction->setToolTip(QString::fromUtf8(sToolTipText));
pcAction->setStatusTip(QString::fromUtf8(sStatusTip)); pcAction->setStatusTip(QString::fromUtf8(sStatusTip));
if (pcAction->statusTip().isEmpty())
pcAction->setStatusTip(pcAction->toolTip());
pcAction->setWhatsThis(QString::fromUtf8(sWhatsThis)); pcAction->setWhatsThis(QString::fromUtf8(sWhatsThis));
if ( sPixmap ) if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromAscii(sAccel)); pcAction->setShortcut(QString::fromAscii(sAccel));
QString accel = pcAction->shortcut().toString(QKeySequence::NativeText);
if (!accel.isEmpty()) {
// show shortcut inside tooltip
QString ttip = QString::fromLatin1("%1 (%2)")
.arg(pcAction->toolTip()).arg(accel);
pcAction->setToolTip(ttip);
// show shortcut inside status tip
QString stip = QString::fromLatin1("(%1)\t%2")
.arg(accel).arg(pcAction->statusTip());
pcAction->setStatusTip(stip);
}
return pcAction; return pcAction;
} }
@ -854,16 +876,11 @@ bool PythonCommand::isActive(void)
void PythonCommand::languageChange() void PythonCommand::languageChange()
{ {
if (_pcAction) { if (_pcAction) {
_pcAction->setText (qApp->translate(getName(), getMenuText ())); applyCommandData(getName(), _pcAction);
_pcAction->setToolTip (qApp->translate(getName(), getToolTipText()));
_pcAction->setStatusTip (qApp->translate(getName(), getStatusTip ()));
_pcAction->setWhatsThis (qApp->translate(getName(), getWhatsThis ()));
if (_pcAction->statusTip().isEmpty())
_pcAction->setStatusTip(qApp->translate(getName(), getToolTipText()));
} }
} }
const char* PythonCommand::getHelpUrl(void) const char* PythonCommand::getHelpUrl(void) const
{ {
PyObject* pcTemp; PyObject* pcTemp;
pcTemp = Interpreter().runMethodObject(_pcPyCommand, "CmdHelpURL"); pcTemp = Interpreter().runMethodObject(_pcPyCommand, "CmdHelpURL");
@ -879,16 +896,10 @@ Action * PythonCommand::createAction(void)
Action *pcAction; Action *pcAction;
pcAction = new Action(this,getMainWindow()); pcAction = new Action(this,getMainWindow());
pcAction->setShortcut(QString::fromAscii(getAccel()));
pcAction->setText (qApp->translate(getName(), getMenuText ())); applyCommandData(this->getName(), pcAction);
pcAction->setToolTip (qApp->translate(getName(), getToolTipText()));
pcAction->setStatusTip (qApp->translate(getName(), getStatusTip ()));
pcAction->setWhatsThis (qApp->translate(getName(), getWhatsThis ()));
if (pcAction->statusTip().isEmpty())
pcAction->setStatusTip(qApp->translate(getName(), getToolTipText()));
if (strcmp(getResource("Pixmap"),"") != 0) if (strcmp(getResource("Pixmap"),"") != 0)
pcAction->setIcon(Gui::BitmapFactory().pixmap(getResource("Pixmap"))); pcAction->setIcon(Gui::BitmapFactory().pixmap(getResource("Pixmap")));
pcAction->setShortcut (QString::fromAscii(getAccel()));
return pcAction; return pcAction;
} }

View File

@ -160,7 +160,7 @@ protected:
/// Creates the used Action /// Creates the used Action
virtual Action * createAction(void); virtual Action * createAction(void);
/// Applies the menu text, tool and status tip to the passed action object /// Applies the menu text, tool and status tip to the passed action object
void applyCommandData(Action* ); void applyCommandData(const char* context, Action* );
const char* keySequenceToAccel(int) const; const char* keySequenceToAccel(int) const;
void adjustCameraPosition(); void adjustCameraPosition();
//@} //@}
@ -328,7 +328,7 @@ protected:
/// if the command is not always active /// if the command is not always active
virtual bool isActive(void); virtual bool isActive(void);
/// Get the help URL /// Get the help URL
const char* getHelpUrl(void); const char* getHelpUrl(void) const;
/// Creates the used Action /// Creates the used Action
virtual Action * createAction(void); virtual Action * createAction(void);
//@} //@}

View File

@ -724,10 +724,10 @@ Action * StdCmdUndo::createAction(void)
Action *pcAction; Action *pcAction;
pcAction = new UndoAction(this,getMainWindow()); pcAction = new UndoAction(this,getMainWindow());
applyCommandData(pcAction); pcAction->setShortcut(QString::fromAscii(sAccel));
applyCommandData(this->className(), pcAction);
if (sPixmap) if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromAscii(sAccel));
return pcAction; return pcAction;
} }
@ -767,10 +767,10 @@ Action * StdCmdRedo::createAction(void)
Action *pcAction; Action *pcAction;
pcAction = new RedoAction(this,getMainWindow()); pcAction = new RedoAction(this,getMainWindow());
applyCommandData(pcAction); pcAction->setShortcut(QString::fromAscii(sAccel));
applyCommandData(this->className(), pcAction);
if (sPixmap) if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromAscii(sAccel));
return pcAction; return pcAction;
} }

View File

@ -125,10 +125,10 @@ Action * StdCmdWorkbench::createAction(void)
Action *pcAction; Action *pcAction;
pcAction = new WorkbenchGroup(this,getMainWindow()); pcAction = new WorkbenchGroup(this,getMainWindow());
applyCommandData(pcAction); pcAction->setShortcut(QString::fromAscii(sAccel));
applyCommandData(this->className(), pcAction);
if (sPixmap) if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromAscii(sAccel));
return pcAction; return pcAction;
} }
@ -169,7 +169,7 @@ Action * StdCmdRecentFiles::createAction(void)
RecentFilesAction* pcAction = new RecentFilesAction(this, getMainWindow()); RecentFilesAction* pcAction = new RecentFilesAction(this, getMainWindow());
pcAction->setObjectName(QLatin1String("recentFiles")); pcAction->setObjectName(QLatin1String("recentFiles"));
pcAction->setDropDownMenu(true); pcAction->setDropDownMenu(true);
applyCommandData(pcAction); applyCommandData(this->className(), pcAction);
return pcAction; return pcAction;
} }

View File

@ -224,7 +224,7 @@ Action * StdCmdFreezeViews::createAction(void)
{ {
ActionGroup* pcAction = new ActionGroup(this, getMainWindow()); ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
pcAction->setDropDownMenu(true); pcAction->setDropDownMenu(true);
applyCommandData(pcAction); applyCommandData(this->className(), pcAction);
// add the action items // add the action items
saveView = pcAction->addAction(QObject::tr("Save views...")); saveView = pcAction->addAction(QObject::tr("Save views..."));
@ -559,7 +559,7 @@ Gui::Action * StdCmdDrawStyle::createAction(void)
{ {
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow()); Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
pcAction->setDropDownMenu(true); pcAction->setDropDownMenu(true);
applyCommandData(pcAction); applyCommandData(this->className(), pcAction);
QAction* a0 = pcAction->addAction(QString()); QAction* a0 = pcAction->addAction(QString());
a0->setCheckable(true); a0->setCheckable(true);
@ -2221,6 +2221,45 @@ StdCmdMeasureDistance::StdCmdMeasureDistance()
eType = Alter3DView; eType = Alter3DView;
} }
// Yay for cheezy drawings!
/* XPM */
static const char * cursor_ruler[] = {
"32 32 3 1",
" c None",
". c #FFFFFF",
"+ c #FF0000",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
"..... ..... ",
" ",
" . ",
" . ",
" . ++ ",
" . + + ",
" . + ++ ",
" + + + ",
" + + + ",
" + + ++ ",
" + + + ",
" + + ",
" + + + ",
" + + + ",
" + + ",
" + + + ",
" + + + ",
" + + ",
" + + + ",
" + + ++",
" + + + ",
" + + ",
" + + ",
" + + ",
" + + ",
" + "};
void StdCmdMeasureDistance::activated(int iMsg) void StdCmdMeasureDistance::activated(int iMsg)
{ {
Gui::Document* doc = Gui::Application::Instance->activeDocument(); Gui::Document* doc = Gui::Application::Instance->activeDocument();
@ -2228,6 +2267,10 @@ void StdCmdMeasureDistance::activated(int iMsg)
if (view) { if (view) {
Gui::View3DInventorViewer* viewer = view->getViewer(); Gui::View3DInventorViewer* viewer = view->getViewer();
viewer->setEditing(true); viewer->setEditing(true);
viewer->setEditingCursor(QCursor(QPixmap(cursor_ruler), 7, 7));
// Derives from QObject and we have a parent object, so we don't
// require a delete.
PointMarker* marker = new PointMarker(viewer); PointMarker* marker = new PointMarker(viewer);
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
ViewProviderMeasureDistance::measureDistanceCallback, marker); ViewProviderMeasureDistance::measureDistanceCallback, marker);

View File

@ -316,7 +316,7 @@ Action * StdCmdDockViewMenu::createAction(void)
{ {
Action *pcAction; Action *pcAction;
pcAction = new DockWidgetAction(this, getMainWindow()); pcAction = new DockWidgetAction(this, getMainWindow());
applyCommandData(pcAction); applyCommandData(this->className(), pcAction);
return pcAction; return pcAction;
} }
@ -351,7 +351,7 @@ Action * StdCmdToolBarMenu::createAction(void)
{ {
Action *pcAction; Action *pcAction;
pcAction = new ToolBarAction(this, getMainWindow()); pcAction = new ToolBarAction(this, getMainWindow());
applyCommandData(pcAction); applyCommandData(this->className(), pcAction);
return pcAction; return pcAction;
} }

View File

@ -28,6 +28,7 @@
# include <QFileInfo> # include <QFileInfo>
# include <QHeaderView> # include <QHeaderView>
# include <QImageReader> # include <QImageReader>
# include <QKeySequence>
# include <QMessageBox> # include <QMessageBox>
# include <QTextStream> # include <QTextStream>
#endif #endif
@ -329,9 +330,22 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
action->setToolTip(QString::fromUtf8(macro->getToolTipText())); action->setToolTip(QString::fromUtf8(macro->getToolTipText()));
action->setWhatsThis(QString::fromUtf8(macro->getWhatsThis())); action->setWhatsThis(QString::fromUtf8(macro->getWhatsThis()));
action->setStatusTip(QString::fromUtf8(macro->getStatusTip())); action->setStatusTip(QString::fromUtf8(macro->getStatusTip()));
if( macro->getPixmap() ) if (macro->getPixmap())
action->setIcon(Gui::BitmapFactory().pixmap(macro->getPixmap())); action->setIcon(Gui::BitmapFactory().pixmap(macro->getPixmap()));
action->setShortcut(QString::fromAscii(macro->getAccel())); action->setShortcut(QString::fromAscii(macro->getAccel()));
QString accel = action->shortcut().toString(QKeySequence::NativeText);
if (!accel.isEmpty()) {
// show shortcut inside tooltip
QString ttip = QString::fromLatin1("%1 (%2)")
.arg(action->toolTip()).arg(accel);
action->setToolTip(ttip);
// show shortcut inside status tip
QString stip = QString::fromLatin1("(%1)\t%2")
.arg(accel).arg(action->statusTip());
action->setStatusTip(stip);
}
} }
// emit signal to notify the container widget // emit signal to notify the container widget

View File

@ -108,7 +108,7 @@ QVariant ButtonModel::data (const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
void ButtonModel::insertRows(int number) void ButtonModel::insertButtonRows(int number)
{ {
int buttonCount = spaceballButtonGroup()->GetGroups().size(); int buttonCount = spaceballButtonGroup()->GetGroups().size();
beginInsertRows(QModelIndex(), buttonCount, number-buttonCount+1); beginInsertRows(QModelIndex(), buttonCount, number-buttonCount+1);
@ -134,7 +134,7 @@ void ButtonModel::goButtonPress(int number)
QString numberString; QString numberString;
numberString.setNum(number); numberString.setNum(number);
if (!spaceballButtonGroup()->HasGroup(numberString.toAscii())) if (!spaceballButtonGroup()->HasGroup(numberString.toAscii()))
insertRows(number); insertButtonRows(number);
} }
void ButtonModel::goMacroRemoved(const QByteArray& macroName) void ButtonModel::goMacroRemoved(const QByteArray& macroName)

View File

@ -57,7 +57,7 @@ namespace Gui
ButtonModel(QObject *parent); ButtonModel(QObject *parent);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void insertRows(int number); void insertButtonRows(int number);
void setCommand(int row, QString command); void setCommand(int row, QString command);
void goButtonPress(int number); void goButtonPress(int number);
void goMacroRemoved(const QByteArray& macroName); void goMacroRemoved(const QByteArray& macroName);

View File

@ -151,7 +151,7 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
std::bind2nd(std::equal_to<Gui::ViewProvider*>(), std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj))); const_cast<Gui::ViewProvider*>(&obj)));
if (vp != Provider.end()) { if (vp != Provider.end()) {
std::string prop_name = obj.getName(&prop); std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId() == App::PropertyColor::getClassTypeId()) { if (prop.getTypeId() == App::PropertyColor::getClassTypeId()) {
App::Color value = static_cast<const App::PropertyColor&>(prop).getValue(); App::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
if (prop_name == "ShapeColor") { if (prop_name == "ShapeColor") {

View File

@ -198,11 +198,43 @@ void DlgCustomKeyboardImp::on_buttonAssign_clicked()
CommandManager & cCmdMgr = Application::Instance->commandManager(); CommandManager & cCmdMgr = Application::Instance->commandManager();
Command* cmd = cCmdMgr.getCommandByName(name.constData()); Command* cmd = cCmdMgr.getCommandByName(name.constData());
if (cmd && cmd->getAction()) { if (cmd && cmd->getAction()) {
Action* action = cmd->getAction();
QKeySequence shortcut = editShortcut->text(); QKeySequence shortcut = editShortcut->text();
cmd->getAction()->setShortcut(shortcut); action->setShortcut(shortcut);
accelLineEditShortcut->setText(editShortcut->text()); accelLineEditShortcut->setText(editShortcut->text());
editShortcut->clear(); editShortcut->clear();
// update the tool tip
QString accel = shortcut.toString(QKeySequence::NativeText);
QString toolTip = QCoreApplication::translate(cmd->className(),
cmd->getToolTipText(), 0, QCoreApplication::UnicodeUTF8);
if (!accel.isEmpty()) {
if (!toolTip.isEmpty()) {
QString tip = QString::fromLatin1("%1 (%2)")
.arg(toolTip).arg(accel);
action->setToolTip(tip);
}
}
else {
action->setToolTip(toolTip);
}
// update the status tip
QString statusTip = QCoreApplication::translate(cmd->className(),
cmd->getStatusTip(), 0, QCoreApplication::UnicodeUTF8);
if (statusTip.isEmpty())
statusTip = toolTip;
if (!accel.isEmpty()) {
if (!statusTip.isEmpty()) {
QString tip = QString::fromLatin1("(%1)\t%2")
.arg(accel).arg(statusTip);
action->setStatusTip(tip);
}
}
else {
action->setStatusTip(statusTip);
}
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut"); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
hGrp->SetASCII(name.constData(), accelLineEditShortcut->text().toUtf8()); hGrp->SetASCII(name.constData(), accelLineEditShortcut->text().toUtf8());
buttonAssign->setEnabled(false); buttonAssign->setEnabled(false);

View File

@ -138,9 +138,9 @@ private:
private: private:
typedef std::pair<std::string, std::list<std::string> > TGroupPages; typedef std::pair<std::string, std::list<std::string> > TGroupPages;
static std::list<TGroupPages> _pages; /**< Name of all registered preference pages */ static std::list<TGroupPages> _pages; /**< Name of all registered preference pages */
Ui_DlgPreferences* ui;
bool invalidParameter; bool invalidParameter;
bool canEmbedScrollArea; bool canEmbedScrollArea;
Ui_DlgPreferences* ui;
}; };
} // namespace Dialog } // namespace Dialog

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2004 Jrgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
@ -394,7 +394,6 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
Base::Console().Error("App::Document::_RecomputeFeature(): Unknown exception in Feature \"%s\" thrown\n",Obj.getNameInDocument()); Base::Console().Error("App::Document::_RecomputeFeature(): Unknown exception in Feature \"%s\" thrown\n",Obj.getNameInDocument());
} }
#endif #endif
std::list<Gui::BaseView*>::iterator vIt; std::list<Gui::BaseView*>::iterator vIt;
// cycling to all views of the document // cycling to all views of the document
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
@ -697,8 +696,12 @@ void Document::RestoreDocFile(Base::Reader &reader)
sMsg += ppReturn; sMsg += ppReturn;
if (strcmp(ppReturn, "") != 0) { // non-empty attribute if (strcmp(ppReturn, "") != 0) { // non-empty attribute
try { try {
if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera")) const char** pReturnIgnore=0;
d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str()); std::list<MDIView*> mdi = getMDIViews();
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
if ((*it)->onHasMsg("SetCamera"))
(*it)->onMsg(sMsg.c_str(), pReturnIgnore);
}
} }
catch (const Base::Exception& e) { catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what()); Base::Console().Error("%s\n", e.what());
@ -1061,7 +1064,9 @@ bool Document::canClose ()
bool ok = true; bool ok = true;
switch(QMessageBox::question(getActiveView(), switch(QMessageBox::question(getActiveView(),
QObject::tr("Unsaved document"), QObject::tr("Unsaved document"),
QObject::tr("Save document before close?"), QObject::tr("The document '%1' has been modified.\n"
"Do you want to save your changes?")
.arg(QString::fromUtf8(getDocument()->Label.getValue())),
QMessageBox::Yes | QMessageBox::Default, QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No, QMessageBox::No,
QMessageBox::Cancel | QMessageBox::Escape)) QMessageBox::Cancel | QMessageBox::Escape))

View File

@ -100,6 +100,9 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object, QEvent *event) bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object, QEvent *event)
{ {
if (!activeWindow())
return true;
QApplication::notify(object, event); QApplication::notify(object, event);
if (event->type() == Spaceball::MotionEvent::MotionEventType) if (event->type() == Spaceball::MotionEvent::MotionEventType)
{ {

View File

@ -14,7 +14,7 @@
height="64" height="64"
id="svg1307" id="svg1307"
sodipodi:version="0.32" sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886" inkscape:version="0.48.5 r10040"
sodipodi:docname="Document.svg" sodipodi:docname="Document.svg"
inkscape:export-filename="/home/lapo/Desktop/Grafica/Icone/media-actions-outlines.png" inkscape:export-filename="/home/lapo/Desktop/Grafica/Icone/media-actions-outlines.png"
inkscape:export-xdpi="90" inkscape:export-xdpi="90"
@ -25,6 +25,13 @@
inkscape:output_extension="org.inkscape.output.svg.inkscape"> inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs <defs
id="defs1309"> id="defs1309">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective3261" />
<linearGradient <linearGradient
id="linearGradient5040"> id="linearGradient5040">
<stop <stop
@ -523,6 +530,384 @@
y2="16.873611" y2="16.873611"
gradientUnits="userSpaceOnUse" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.83621615,-0.79013626,0.80073297,0.82514986,-6.1843205,29.343172)" /> gradientTransform="matrix(0.83621615,-0.79013626,0.80073297,0.82514986,-6.1843205,29.343172)" />
<linearGradient
id="linearGradient12512">
<stop
id="stop12513"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
<stop
id="stop12517"
offset="0.50000000"
style="stop-color:#fff520;stop-opacity:0.89108908;" />
<stop
id="stop12514"
offset="1.0000000"
style="stop-color:#fff300;stop-opacity:0.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient259">
<stop
id="stop260"
offset="0.0000000"
style="stop-color:#fafafa;stop-opacity:1.0000000;" />
<stop
id="stop261"
offset="1.0000000"
style="stop-color:#bbbbbb;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient269">
<stop
id="stop270"
offset="0.0000000"
style="stop-color:#a3a3a3;stop-opacity:1.0000000;" />
<stop
id="stop271"
offset="1.0000000"
style="stop-color:#4c4c4c;stop-opacity:1.0000000;" />
</linearGradient>
<radialGradient
id="aigrd2"
cx="20.8921"
cy="114.5684"
r="5.256"
fx="20.8921"
fy="114.5684"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#F0F0F0"
id="stop15566" />
<stop
offset="1.0000000"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
id="stop15568" />
</radialGradient>
<radialGradient
id="aigrd3"
cx="20.8921"
cy="64.5679"
r="5.257"
fx="20.8921"
fy="64.5679"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#F0F0F0"
id="stop15573" />
<stop
offset="1.0000000"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
id="stop15575" />
</radialGradient>
<linearGradient
id="linearGradient15662">
<stop
id="stop15664"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
<stop
id="stop15666"
offset="1.0000000"
style="stop-color:#f8f8f8;stop-opacity:1.0000000;" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,-6.310056e-16,30.08928)"
r="15.821514"
fy="42.07798"
fx="24.306795"
cy="42.07798"
cx="24.306795"
id="radialGradient4548"
xlink:href="#linearGradient4542"
inkscape:collect="always" />
<linearGradient
id="linearGradient4542"
inkscape:collect="always">
<stop
id="stop4544"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop4546"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient5048">
<stop
id="stop5050"
offset="0"
style="stop-color:black;stop-opacity:0;" />
<stop
style="stop-color:black;stop-opacity:1;"
offset="0.5"
id="stop5056" />
<stop
id="stop5052"
offset="1"
style="stop-color:black;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient5060"
inkscape:collect="always">
<stop
id="stop5062"
offset="0"
style="stop-color:black;stop-opacity:1;" />
<stop
id="stop5064"
offset="1"
style="stop-color:black;stop-opacity:0;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient259"
id="radialGradient3245"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(0.960493,1.041132)"
cx="33.966679"
cy="35.736916"
fx="33.966679"
fy="35.736916"
r="86.708450" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient269"
id="radialGradient3247"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.968273,0,0,1.032767,3.353553,0.646447)"
cx="8.8244190"
cy="3.7561285"
fx="8.8244190"
fy="3.7561285"
r="37.751713" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient15662"
id="radialGradient3249"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.968273,0,0,1.032767,3.353553,0.646447)"
cx="8.1435566"
cy="7.2678967"
fx="8.1435566"
fy="7.2678967"
r="38.158695" />
<radialGradient
inkscape:collect="always"
xlink:href="#aigrd2"
id="radialGradient3251"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.8921"
cy="114.5684"
fx="20.8921"
fy="114.5684"
r="5.256" />
<radialGradient
inkscape:collect="always"
xlink:href="#aigrd3"
id="radialGradient3253"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.8921"
cy="64.5679"
fx="20.8921"
fy="64.5679"
r="5.257" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5048"
id="linearGradient3255"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient3257"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient3259"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<inkscape:perspective
id="perspective2988"
inkscape:persp3d-origin="32 : 21.333333 : 1"
inkscape:vp_z="64 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 32 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient3864">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3866" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3868" />
</linearGradient>
<inkscape:perspective
id="perspective2792"
inkscape:persp3d-origin="32 : 21.333333 : 1"
inkscape:vp_z="64 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 32 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient3377">
<stop
style="stop-color:#9dbcd2;stop-opacity:1;"
offset="0"
id="stop3379" />
<stop
style="stop-color:#3647c0;stop-opacity:1;"
offset="1"
id="stop3381" />
</linearGradient>
<inkscape:perspective
id="perspective2868"
inkscape:persp3d-origin="32 : 21.333333 : 1"
inkscape:vp_z="64 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 32 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient3377-9">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop3379-0" />
<stop
style="stop-color:#ffaa00;stop-opacity:1;"
offset="1"
id="stop3381-6" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#radialGradient1450"
id="radialGradient4129"
gradientUnits="userSpaceOnUse"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4129-5"
gradientUnits="userSpaceOnUse"
cx="7.1288233"
cy="21.885809"
fx="7.1288233"
fy="21.885809"
r="19.467436"
gradientTransform="matrix(1.4144052,0.56767834,-0.37247431,0.9280425,5.3833517,-4.4397783)" />
<linearGradient
id="linearGradient3377-7">
<stop
style="stop-color:#2ba6ff;stop-opacity:1;"
offset="0"
id="stop3379-1" />
<stop
style="stop-color:#001ef4;stop-opacity:1;"
offset="1"
id="stop3381-4" />
</linearGradient>
<radialGradient
r="19.467436"
fy="28.869568"
fx="45.883327"
cy="28.869568"
cx="45.883327"
gradientUnits="userSpaceOnUse"
id="radialGradient4164"
xlink:href="#linearGradient3377-7"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4129-0"
gradientUnits="userSpaceOnUse"
cx="27.404257"
cy="8.8382111"
fx="27.404257"
fy="8.8382111"
r="19.467436"
gradientTransform="matrix(0.29607897,0.47117302,-0.84670692,0.53205957,27.681405,-8.8582924)" />
<linearGradient
id="linearGradient3377-0">
<stop
style="stop-color:#2ba6ff;stop-opacity:1;"
offset="0"
id="stop3379-4" />
<stop
style="stop-color:#001ef4;stop-opacity:1;"
offset="1"
id="stop3381-0" />
</linearGradient>
<radialGradient
r="19.467436"
fy="28.869568"
fx="45.883327"
cy="28.869568"
cx="45.883327"
gradientUnits="userSpaceOnUse"
id="radialGradient4164-5"
xlink:href="#linearGradient3377-0"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-3"
id="radialGradient4129-8"
gradientUnits="userSpaceOnUse"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436" />
<linearGradient
id="linearGradient3377-3">
<stop
style="stop-color:#2ba6ff;stop-opacity:1;"
offset="0"
id="stop3379-8" />
<stop
style="stop-color:#001ef4;stop-opacity:1;"
offset="1"
id="stop3381-9" />
</linearGradient>
<radialGradient
r="19.467436"
fy="28.869568"
fx="45.883327"
cy="28.869568"
cx="45.883327"
gradientUnits="userSpaceOnUse"
id="radialGradient4164-3"
xlink:href="#linearGradient3377-3"
inkscape:collect="always" />
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
id="base" id="base"
@ -531,9 +916,9 @@
borderopacity="0.19607843" borderopacity="0.19607843"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="6.3984375" inkscape:zoom="2.2621893"
inkscape:cx="21.496455" inkscape:cx="-26.636321"
inkscape:cy="12.219282" inkscape:cy="30.659191"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
inkscape:grid-bbox="true" inkscape:grid-bbox="true"
@ -544,10 +929,10 @@
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
guidetolerance="1px" guidetolerance="1px"
stroke="#729fcf" stroke="#729fcf"
inkscape:window-width="1280" inkscape:window-width="1920"
inkscape:window-height="1004" inkscape:window-height="1053"
inkscape:window-x="1278" inkscape:window-x="0"
inkscape:window-y="-3" inkscape:window-y="0"
showborder="true" showborder="true"
inkscape:showpageshadow="false" inkscape:showpageshadow="false"
inkscape:window-maximized="1"> inkscape:window-maximized="1">
@ -695,50 +1080,174 @@
inkscape:r_cx="true" inkscape:r_cx="true"
inkscape:r_cy="true" inkscape:r_cy="true"
transform="translate(0,16)"> transform="translate(0,16)">
<g
inkscape:label="Shadow"
id="layer6"
transform="matrix(1.3448423,0,0,1.3448423,-0.48840274,-17.184161)">
<g
style="display:inline"
id="g5022"
transform="matrix(0.02165152,0,0,0.01485743,43.0076,42.68539)">
<rect
y="-150.69685"
x="-1559.2523"
height="478.35718"
width="1339.6335"
id="rect4173"
style="opacity:0.40206185;color:#000000;fill:url(#linearGradient3255);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path <path
style="fill:none;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 10.002442,2.4224664 0.156288,59.0769236 43.135531,0 0.156288,-50.168499 -10.94017,0 -0.156288,-8.9084246 z"
id="path3861"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" sodipodi:nodetypes="cccc"
sodipodi:nodetypes="ccccccc" /> id="path5058"
d="m -219.61876,-150.68038 c 0,0 0,478.33079 0,478.33079 142.874166,0.90045 345.40022,-107.16966 345.40014,-239.196175 0,-132.026537 -159.436816,-239.134595 -345.40014,-239.134615 z"
style="opacity:0.40206185;color:#000000;fill:url(#radialGradient3257);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path <path
style="fill:none;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 15.003663,8.6739927 18.754579,0"
id="path3863"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" /> style="opacity:0.40206185;color:#000000;fill:url(#radialGradient3259);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
d="m -1559.2523,-150.68038 c 0,0 0,478.33079 0,478.33079 -142.8742,0.90045 -345.4002,-107.16966 -345.4002,-239.196175 0,-132.026537 159.4368,-239.134595 345.4002,-239.134615 z"
id="path5018"
sodipodi:nodetypes="cccc" />
</g>
</g>
<g
id="layer1-4"
inkscape:label="Base"
style="display:inline"
transform="matrix(1.3448423,0,0,1.3448423,-0.48840274,-17.184161)">
<rect
ry="1.1490486"
y="3.6464462"
x="6.6035528"
height="40.920494"
width="34.875"
id="rect15391"
style="color:#000000;fill:url(#radialGradient3245);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient3247);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<rect
rx="0.14904857"
ry="0.14904857"
y="4.5839462"
x="7.6660538"
height="38.946384"
width="32.775887"
id="rect15660"
style="color:#000000;fill:none;stroke:url(#radialGradient3249);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<g
id="g2270"
transform="translate(0.646447,-0.03798933)">
<g
transform="matrix(0.229703,0,0,0.229703,4.967081,4.244972)"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4"
id="g1440">
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099"
id="radialGradient1442">
<stop
id="stop1444"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop1446"
style="stop-color:#474747"
offset="1" />
</radialGradient>
<path <path
style="fill:none;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 15.316239,17.113553 19.692308,0"
id="path3865"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" /> id="path1448"
d="m 23.428,113.07 c 0,1.973 -1.6,3.572 -3.573,3.572 -1.974,0 -3.573,-1.6 -3.573,-3.572 0,-1.974 1.6,-3.573 3.573,-3.573 1.973,0 3.573,1.6 3.573,3.573 z"
style="stroke:none" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099"
id="radialGradient1450">
<stop
id="stop1452"
style="stop-color:#e74435;stop-opacity:1;"
offset="0" />
<stop
id="stop1454"
style="stop-color:#9a0900;stop-opacity:1;"
offset="1" />
</radialGradient>
<path <path
style="fill:none;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 15.003663,24.927961 32.039072,0"
id="path3867"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" /> id="path1456"
d="m 23.428,63.07 c 0,1.973 -1.6,3.573 -3.573,3.573 -1.974,0 -3.573,-1.6 -3.573,-3.573 0,-1.974 1.6,-3.573 3.573,-3.573 1.973,0 3.573,1.6 3.573,3.573 z"
style="stroke:none" />
</g>
<path <path
style="fill:#16eae2;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 34.695971,51.340659 0.156288,3.907205 -4.532356,2.813186 -3.750916,0 -9.221002,-7.345544 -0.156288,-6.251525 9.533577,-7.65812 4.688645,0 0.312577,4.063492 z"
id="path3871"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" id="path15570"
sodipodi:nodetypes="cccccccccc" /> d="m 9.9950109,29.952326 c 0,0.453204 -0.3675248,0.820499 -0.8207288,0.820499 -0.4534338,0 -0.8207289,-0.367524 -0.8207289,-0.820499 0,-0.453434 0.3675248,-0.820729 0.8207289,-0.820729 0.453204,0 0.8207288,0.367525 0.8207288,0.820729 z"
style="fill:url(#radialGradient3251);fill-rule:nonzero;stroke:none" />
<path <path
style="fill:#cb39dd;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 49.543346,41.807082 0,9.064713 -17.973138,0 -0.156288,-9.064713 z"
id="path3869"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" id="path15577"
sodipodi:nodetypes="ccccc" /> d="m 9.9950109,18.467176 c 0,0.453204 -0.3675248,0.820729 -0.8207288,0.820729 -0.4534338,0 -0.8207289,-0.367525 -0.8207289,-0.820729 0,-0.453434 0.3675248,-0.820729 0.8207289,-0.820729 0.453204,0 0.8207288,0.367525 0.8207288,0.820729 z"
style="fill:url(#radialGradient3253);fill-rule:nonzero;stroke:none" />
</g>
<path <path
style="fill:none;stroke:#000000;stroke-width:2.50000000000000000;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2.50000000000000000, 2.50000000000000000;stroke-dashoffset:0"
d="M 42.979243,1.7973138 54.23199,10.393162"
id="path3881"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
transform="translate(0,-16)" /> sodipodi:nodetypes="cc"
id="path15672"
d="m 11.505723,5.4942766 0,37.9065924"
style="fill:none;stroke:#000000;stroke-width:0.98855311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.01754384" />
<path
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc"
id="path15674"
d="m 12.5,5.0205154 0,38.0177126"
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.20467834" />
</g>
<path
sodipodi:type="arc"
style="opacity:0.66523605;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3694"
sodipodi:cx="53.214287"
sodipodi:cy="34.571426"
sodipodi:rx="18.571428"
sodipodi:ry="18.571428"
d="m 71.785715,34.571426 a 18.571428,18.571428 0 1 1 -37.142856,0 18.571428,18.571428 0 1 1 37.142856,0 z"
transform="matrix(0.65504846,0,0,0.21626063,6.8764968,10.345655)" />
<path
sodipodi:type="arc"
style="fill:url(#radialGradient4129);fill-opacity:1;fill-rule:evenodd;stroke:#3e0500;stroke-width:1.79201268999999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3696"
sodipodi:cx="53.214287"
sodipodi:cy="34.571426"
sodipodi:rx="18.571428"
sodipodi:ry="18.571428"
d="m 71.785715,34.571426 a 18.571428,18.571428 0 1 1 -37.142856,0 18.571428,18.571428 0 1 1 37.142856,0 z"
transform="matrix(0.64423128,0,0,0.64423128,2.7664943,-13.087752)" />
<path
id="path3546"
d="m 34.717396,37.524909 12.691713,-3.167167 3.280324,-3.167155 -5.81867,-0.844577 -10.153367,7.178899 z"
style="opacity:0.66523605;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.07586193;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccccc"
id="rect3522"
d="M 28.005818,9.0262783 16.311506,13.263393 34.30975,15.712024 34.560865,36.825029 44.068721,30.574698 44.408595,10.281026 28.005818,9.0262783 z"
style="fill:url(#radialGradient4129-0);fill-opacity:1.0;fill-rule:evenodd;stroke:#000557;stroke-width:1.15447067999999997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;color:#000000"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccc"
id="rect3520"
d="m 16.470881,13.38544 18.124121,1.98636 0,21.528555 -18.369045,-2.989194 0.244924,-20.525721 z"
style="fill:url(#radialGradient4129-5);fill-opacity:1.0;fill-rule:evenodd;stroke:#000557;stroke-width:1.15447067999999997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;color:#000000"
inkscape:connector-curvature="0" />
<path
id="path3536"
d="M 34.456956,15.398337 44.3285,10.435528"
style="fill:url(#radialGradient4129-8);fill-opacity:1;fill-rule:evenodd;stroke:#000557;stroke-width:1.15447067999999997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;color:#000000"
inkscape:connector-curvature="0" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,898 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg4198"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="edit-copy.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs4200">
<linearGradient
id="linearGradient15218">
<stop
style="stop-color:#f0f0ef;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop15220" />
<stop
id="stop2269"
offset="0.59928656"
style="stop-color:#e8e8e8;stop-opacity:1;" />
<stop
id="stop2267"
offset="0.82758623"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
style="stop-color:#d8d8d3;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop15222" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient2259">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2261" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop2263" />
</linearGradient>
<linearGradient
id="linearGradient2224">
<stop
style="stop-color:#7c7c7c;stop-opacity:1;"
offset="0"
id="stop2226" />
<stop
style="stop-color:#b8b8b8;stop-opacity:1;"
offset="1"
id="stop2228" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2224"
id="linearGradient2230"
x1="35.996582"
y1="40.458221"
x2="33.664921"
y2="37.770721"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.161836,4.033411)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2251">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2253" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop2255" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2251"
id="linearGradient2257"
x1="33.396004"
y1="36.921333"
x2="34.170048"
y2="38.070381"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.161836,3.658411)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient15218"
id="linearGradient4258"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.065698,0.000000,0.000000,0.987595,-8.548320,-4.891713)"
x1="22.308331"
y1="18.992140"
x2="35.785294"
y2="39.498238" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2259"
id="linearGradient4260"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.998504,0.000000,0.000000,0.998246,-6.970391,-4.892901)"
x1="26.076092"
y1="26.696676"
x2="30.811172"
y2="42.007351" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2259"
id="linearGradient13651"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.999421,0.000000,0.000000,1.000000,5.991319,4.033411)"
x1="26.076092"
y1="26.696676"
x2="30.811172"
y2="42.007351" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient15218"
id="linearGradient13653"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.067236,0.000000,0.000000,0.989276,4.391684,4.035227)"
x1="22.308331"
y1="18.992140"
x2="35.785294"
y2="39.498238" />
<inkscape:perspective
id="perspective3148"
inkscape:persp3d-origin="32 : 21.333333 : 1"
inkscape:vp_z="64 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 32 : 1"
sodipodi:type="inkscape:persp3d" />
<radialGradient
r="19.571428"
fy="33.899986"
fx="270.58316"
cy="33.899986"
cx="270.58316"
gradientTransform="matrix(1.1149219,0.2722306,-0.7507171,3.0745639,-471.08629,-148.32863)"
gradientUnits="userSpaceOnUse"
id="radialGradient3817"
xlink:href="#linearGradient3682"
inkscape:collect="always" />
<linearGradient
id="linearGradient3682">
<stop
id="stop3684"
offset="0"
style="stop-color:#ff6d0f;stop-opacity:1;" />
<stop
id="stop3686"
offset="1"
style="stop-color:#ff1000;stop-opacity:1;" />
</linearGradient>
<radialGradient
r="19.571428"
fy="29.149046"
fx="282.64584"
cy="29.149046"
cx="282.64584"
gradientTransform="matrix(0.6186598,0.9666542,-1.0332462,0.6612786,-327.27568,-255.84136)"
gradientUnits="userSpaceOnUse"
id="radialGradient3661"
xlink:href="#linearGradient3864"
inkscape:collect="always" />
<linearGradient
id="linearGradient3864">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3866" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3868" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="24.842253"
x2="37.124462"
y1="30.748846"
x1="32.647972"
id="linearGradient2696"
xlink:href="#linearGradient2690"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="24.842253"
x2="37.124462"
y1="31.455952"
x1="36.713837"
id="linearGradient2688"
xlink:href="#linearGradient2682"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="26.649362"
x2="53.588622"
y1="23.667896"
x1="18.935766"
id="linearGradient2408"
xlink:href="#linearGradient2402"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="20.60858"
x2="15.984863"
y1="36.061237"
x1="62.513836"
id="linearGradient2386"
xlink:href="#linearGradient2380"
inkscape:collect="always" />
<radialGradient
r="15.644737"
fy="36.421127"
fx="24.837126"
cy="36.421127"
cx="24.837126"
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
gradientUnits="userSpaceOnUse"
id="radialGradient1503"
xlink:href="#linearGradient8662"
inkscape:collect="always" />
<linearGradient
y2="50.939667"
x2="45.380436"
y1="45.264122"
x1="46.834816"
gradientUnits="userSpaceOnUse"
id="linearGradient1501"
xlink:href="#linearGradient2871"
inkscape:collect="always" />
<linearGradient
y2="26.048164"
x2="52.854097"
y1="26.048164"
x1="5.9649176"
gradientUnits="userSpaceOnUse"
id="linearGradient1493"
xlink:href="#linearGradient2797"
inkscape:collect="always" />
<linearGradient
y2="26.048164"
x2="52.854097"
y1="26.048164"
x1="5.9649176"
gradientUnits="userSpaceOnUse"
id="linearGradient1491"
xlink:href="#linearGradient2797"
inkscape:collect="always" />
<linearGradient
y2="26.194071"
x2="37.065414"
y1="29.729605"
x1="37.128052"
gradientTransform="matrix(-1,0,0,-1,47.52791,45.84741)"
gradientUnits="userSpaceOnUse"
id="linearGradient1488"
xlink:href="#linearGradient2847"
inkscape:collect="always" />
<linearGradient
y2="19.115122"
x2="15.419417"
y1="10.612206"
x1="13.478554"
gradientTransform="translate(0.465413,-0.277593)"
gradientUnits="userSpaceOnUse"
id="linearGradient1486"
xlink:href="#linearGradient2831"
inkscape:collect="always" />
<linearGradient
id="linearGradient8662"
inkscape:collect="always">
<stop
id="stop8664"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop8666"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient2797"
inkscape:collect="always">
<stop
id="stop2799"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop2801"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient2831">
<stop
id="stop2833"
offset="0"
style="stop-color:#3465a4;stop-opacity:1;" />
<stop
style="stop-color:#5b86be;stop-opacity:1;"
offset="0.33333334"
id="stop2855" />
<stop
id="stop2835"
offset="1"
style="stop-color:#83a8d8;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient2847"
inkscape:collect="always">
<stop
id="stop2849"
offset="0"
style="stop-color:#3465a4;stop-opacity:1;" />
<stop
id="stop2851"
offset="1"
style="stop-color:#3465a4;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient2871"
inkscape:collect="always">
<stop
id="stop2873"
offset="0"
style="stop-color:#3465a4;stop-opacity:1;" />
<stop
id="stop2875"
offset="1"
style="stop-color:#3465a4;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient2380">
<stop
id="stop2382"
offset="0"
style="stop-color:#b9cfe7;stop-opacity:1" />
<stop
id="stop2384"
offset="1"
style="stop-color:#729fcf;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient2402">
<stop
id="stop2404"
offset="0"
style="stop-color:#729fcf;stop-opacity:1;" />
<stop
id="stop2406"
offset="1"
style="stop-color:#528ac5;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient2682">
<stop
id="stop2684"
offset="0"
style="stop-color:#3977c3;stop-opacity:1;" />
<stop
id="stop2686"
offset="1"
style="stop-color:#89aedc;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient2690"
inkscape:collect="always">
<stop
id="stop2692"
offset="0"
style="stop-color:#c4d7eb;stop-opacity:1;" />
<stop
id="stop2694"
offset="1"
style="stop-color:#c4d7eb;stop-opacity:0;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2380"
id="linearGradient3681"
gradientUnits="userSpaceOnUse"
x1="62.513836"
y1="36.061237"
x2="15.984863"
y2="20.60858" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient3683"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2402"
id="linearGradient3685"
gradientUnits="userSpaceOnUse"
x1="18.935766"
y1="23.667896"
x2="53.588622"
y2="26.649362" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient3687"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2690"
id="linearGradient3698"
gradientUnits="userSpaceOnUse"
x1="32.647972"
y1="30.748846"
x2="37.124462"
y2="24.842253"
gradientTransform="translate(-64.247811,5.5825138)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2682"
id="linearGradient3700"
gradientUnits="userSpaceOnUse"
x1="36.713837"
y1="31.455952"
x2="37.124462"
y2="24.842253"
gradientTransform="translate(-64.247811,5.5825138)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2831"
id="linearGradient3705"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-63.782398,5.3049208)"
x1="13.478554"
y1="10.612206"
x2="15.419417"
y2="19.115122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2847"
id="linearGradient3707"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,-16.719901,51.429924)"
x1="37.128052"
y1="29.729605"
x2="37.065414"
y2="26.194071" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2831"
id="linearGradient3745"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-63.782398,5.3049208)"
x1="13.478554"
y1="10.612206"
x2="15.419417"
y2="19.115122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2847"
id="linearGradient3747"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,-16.719901,51.429924)"
x1="37.128052"
y1="29.729605"
x2="37.065414"
y2="26.194071" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2380"
id="linearGradient3749"
gradientUnits="userSpaceOnUse"
x1="62.513836"
y1="36.061237"
x2="15.984863"
y2="20.60858" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient3751"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2380"
id="linearGradient3753"
gradientUnits="userSpaceOnUse"
x1="62.513836"
y1="36.061237"
x2="15.984863"
y2="20.60858" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient3755"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient8662"
id="radialGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
cx="24.837126"
cy="36.421127"
fx="24.837126"
fy="36.421127"
r="15.644737" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2690"
id="linearGradient3759"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-64.247811,5.5825138)"
x1="32.647972"
y1="30.748846"
x2="37.124462"
y2="24.842253" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2682"
id="linearGradient3761"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-64.247811,5.5825138)"
x1="36.713837"
y1="31.455952"
x2="37.124462"
y2="24.842253" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2402"
id="linearGradient3763"
gradientUnits="userSpaceOnUse"
x1="18.935766"
y1="23.667896"
x2="53.588622"
y2="26.649362" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient3765"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2402"
id="linearGradient3767"
gradientUnits="userSpaceOnUse"
x1="18.935766"
y1="23.667896"
x2="53.588622"
y2="26.649362" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient3769"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient3771"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#bebebe"
borderopacity="1.0000000"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568544"
inkscape:cx="-9.3924452"
inkscape:cy="21.181531"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1920"
inkscape:window-height="1053"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:showpageshadow="false"
inkscape:window-maximized="1" />
<metadata
id="metadata4203">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:date>2005-10-15</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Andreas Nilsson</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>edit</rdf:li>
<rdf:li>copy</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:contributor>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g4268"
style="opacity:0.49999997"
transform="matrix(1.001508,0.000000,0.000000,1.000616,-5.002205e-2,-6.304895e-2)">
<rect
y="34.033413"
x="20.161837"
height="2.0000000"
width="13.000000"
id="rect2279"
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
<rect
ry="0.56615961"
rx="0.56565511"
y="1.5629303"
x="1.5484408"
height="35.976688"
width="30.951559"
id="rect4238"
style="opacity:1.0000000;fill:url(#linearGradient4258);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#888a85;stroke-width:0.99893934;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000" />
<rect
ry="0.0000000"
rx="0.0000000"
y="2.5605955"
x="2.5325129"
height="33.981056"
width="28.970741"
id="rect4240"
style="opacity:1.0000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient4260);stroke-width:0.99893963;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000" />
<rect
y="10.033414"
x="7.0161190"
height="2.0000000"
width="21.000000"
id="rect4248"
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
<rect
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
id="rect4250"
width="20.000000"
height="2.0000000"
x="7.0161190"
y="14.033414" />
<rect
y="18.033415"
x="7.0161190"
height="2.0000000"
width="18.000000"
id="rect4252"
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
<rect
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
id="rect4254"
width="21.000000"
height="2.0000000"
x="7.0161190"
y="22.033415" />
<rect
y="26.033413"
x="7.0161190"
height="2.0000000"
width="13.000000"
id="rect4256"
style="opacity:0.17045452;color:#000000;fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
</g>
<g
id="g12863">
<path
style="fill:url(#linearGradient13653);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#888a85;stroke-width:1.0000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
d="M 15.072946,10.500852 L 44.929331,10.500852 C 45.245071,10.500852 45.499257,10.753945 45.499257,11.068324 L 45.499257,38.235686 C 45.499257,40.712138 38.619447,46.538773 36.231325,46.538773 L 15.072946,46.538773 C 14.757206,46.538773 14.50302,46.285681 14.50302,45.9713 L 14.50302,11.068324 C 14.50302,10.753945 14.757206,10.500852 15.072946,10.500852 z "
id="rect12413"
sodipodi:nodetypes="ccccccccc" />
<rect
ry="0.0000000"
rx="0.0000000"
y="11.500000"
x="15.502951"
height="34.040764"
width="28.997349"
id="rect15244"
style="opacity:1.0000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient13651);stroke-width:1.0000008;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cccc"
id="path2210"
d="M 36.220918,46.536966 C 38.251336,46.866864 45.809711,42.007037 45.505329,38.039122 C 43.942067,40.462219 40.746807,39.32586 36.638049,39.48487 C 36.638049,39.48487 37.033418,46.036966 36.220918,46.536966 z "
style="opacity:1.0000000;color:#000000;fill:url(#linearGradient2230);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#868a84;stroke-width:1.0000002;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
<path
style="opacity:0.36931817;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient2257);stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 37.671355,44.345464 C 39.041134,43.661635 42.099604,42.198999 43.398985,40.317995 C 41.802891,40.99805 40.451175,40.527491 37.696651,40.5084 C 37.696651,40.5084 37.858973,43.570494 37.671355,44.345464 z "
id="path2247"
sodipodi:nodetypes="cccc" />
</g>
<g
inkscape:label="Layer 1"
id="layer1-1"
transform="matrix(0.24447599,0,0,0.24447599,21.98865,17.408122)"
style="stroke-width:2.45422864;stroke-miterlimit:4;stroke-dasharray:none">
<g
transform="matrix(0.8506406,0,0,0.8506406,187.82699,-0.1960013)"
id="g3813"
style="stroke-width:2.88515353;stroke-miterlimit:4;stroke-dasharray:none">
<path
style="fill:url(#radialGradient3817);fill-opacity:1;fill-rule:evenodd;stroke:#370700;stroke-width:2.88515353;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m -216.13659,7.270763 0,55.5 12.375,0 0,-21.71875 8.75,0 0,-8.5625 -8.75,0 0,-9.241879 21.55514,0 0,-15.945621 -33.93014,-0.03125 z"
id="rect3663"
sodipodi:nodetypes="ccccccccccc"
inkscape:connector-curvature="0" />
<path
style="fill:url(#radialGradient3661);fill-opacity:1;fill-rule:evenodd;stroke:#000137;stroke-width:2.88515353;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m -161.05088,23.811562 -7.19826,4.129889 -3.17869,-1.103092 -3.03274,-7.750723 -4.77066,0.250699 -2.17602,8.014733 -3.04547,1.45841 -7.59591,-3.322815 -3.20831,3.565187 4.1299,7.198257 -1.12858,3.169376 -7.75073,3.032741 0.27618,4.779962 8.01474,2.176021 1.45841,3.045461 -3.34829,7.586615 3.56518,3.208306 7.19825,-4.129891 3.19487,1.137883 3.00726,7.741419 4.80544,-0.266883 2.15054,-8.024034 3.04547,-1.458412 7.61208,3.357607 3.20831,-3.565187 -4.12989,-7.198256 1.11239,-3.204168 7.74142,-3.00726 -0.24138,-4.796137 -8.02404,-2.150536 -1.45842,-3.045461 3.33212,-7.621406 -3.56517,-3.208305 z m -10.7808,11.804259 1.47765,0.857357 1.28022,1.160735 1.02494,1.385223 0.73729,1.540127 0.43349,1.660242 0.0718,1.701463 -0.24575,1.701021 -0.56084,1.61483 -0.89215,1.493834 -1.12594,1.264037 -1.38523,1.024933 -1.54013,0.737291 -1.66023,0.433483 -1.71077,0.09731 -1.70103,-0.245733 -1.61482,-0.560852 -1.49383,-0.892149 -1.25475,-1.151431 -1.03422,-1.359735 -0.73731,-1.540126 -0.42417,-1.685727 -0.0973,-1.710769 0.24573,-1.701025 0.56086,-1.614826 0.88284,-1.468351 1.13526,-1.28952 1.38522,-1.024934 1.54012,-0.737294 1.68572,-0.424174 1.70147,-0.07182 1.70102,0.245731 1.61483,0.560854 z"
id="path3659"
inkscape:connector-curvature="0" />
</g>
</g>
<g
id="g3736"
transform="matrix(0.570323,0,0,0.570323,43.928208,18.073018)"
style="stroke-width:1.3290714;stroke-miterlimit:4;stroke-dasharray:none">
<path
inkscape:r_cy="true"
inkscape:r_cx="true"
sodipodi:type="arc"
style="opacity:0.38333333;color:#000000;fill:url(#radialGradient3757);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.08823323;marker:none;visibility:visible;display:inline;overflow:visible"
id="path8660"
sodipodi:cx="24.837126"
sodipodi:cy="36.421127"
sodipodi:rx="15.644737"
sodipodi:ry="8.3968935"
d="m 40.481863,36.421127 c 0,4.637477 -7.004387,8.396894 -15.644737,8.396894 -8.64035,0 -15.6447375,-3.759417 -15.6447375,-8.396894 0,-4.637476 7.0043875,-8.396893 15.6447375,-8.396893 8.64035,0 15.644737,3.759417 15.644737,8.396893 z"
transform="matrix(-1.489736,0,0,-1.001252,-3.039161,80.864414)" />
<path
style="color:#000000;fill:url(#linearGradient3759);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3761);stroke-width:1.3290714;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
d="m -35.872811,39.020014 c 0,0 8.9375,0.625 6.1875,-9.875 l 7.775888,0 c 0,1.502602 -0.588388,11.875 -13.963388,9.875 z"
id="path2839"
inkscape:r_cx="true"
inkscape:r_cy="true"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0" />
<g
id="g2779"
transform="matrix(0.579051,0.489228,0.489228,-0.579051,-72.168834,36.118504)"
inkscape:r_cx="true"
inkscape:r_cy="true"
style="color:#000000;fill:url(#linearGradient3767);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3769);stroke-width:1.75327015;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible">
<path
sodipodi:nodetypes="ccccccc"
id="path2781"
d="M 44.306783,50.229694 C 62.821497,35.818859 49.664587,13.411704 22.462411,12.49765 L 22.399432,3.0690297 7.793943,20.424005 22.462411,33.006349 c 0,0 0,-9.66838 0,-9.66838 18.82976,0.998977 32.981627,14.071729 21.844372,26.891725 z"
style="color:#000000;fill:url(#linearGradient3763);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3765);stroke-width:1.75327015;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
</g>
<path
sodipodi:nodetypes="cccccccc"
inkscape:r_cy="true"
inkscape:r_cx="true"
id="path2791"
d="m -57.185311,43.770014 0.0625,-14.875 12.9375,-0.375 -4.388873,5.178817 3.867225,2.373199 c -3,2.25 -4.549548,2.422128 -5.549548,4.984628 l -2.816858,-2.110272 -4.111946,4.823628 z"
style="opacity:0.27222224;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.3290714;marker:none;visibility:visible;display:inline;overflow:visible"
inkscape:connector-curvature="0" />
<g
style="opacity:0.5;fill:none;stroke:#ffffff;stroke-width:1.99638414;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:r_cy="true"
inkscape:r_cx="true"
transform="matrix(0.508536,0.429651,0.429651,-0.508536,-68.220999,36.123704)"
id="g2793">
<path
inkscape:r_cy="true"
inkscape:r_cx="true"
style="color:#000000;fill:none;stroke:url(#linearGradient3771);stroke-width:1.99638414;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
d="M 51.090265,45.943705 C 60.210465,30.723955 46.631614,12.20113 19.485058,11.948579 L 19.513464,3.7032834 6.5341979,19.296639 19.367661,30.26876 c 0,0 0.05562,-9.006878 0.05562,-9.006878 17.527815,-0.223909 35.195185,10.103372 31.666984,24.681823 z"
id="path2795"
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0" />
</g>
</g>
<g
id="g3728"
transform="matrix(0.62501419,0,0,0.62501419,46.47679,-3.0233584)"
style="stroke-width:1.21277247;stroke-miterlimit:4;stroke-dasharray:none">
<path
sodipodi:nodetypes="cccc"
inkscape:r_cy="true"
inkscape:r_cx="true"
id="path2865"
d="m -44.094898,15.992418 c 0,0 -8.9375,-0.625 -6.1875,9.875 l -7.6875,0 c 0,0 0.5,-11.875 13.875,-9.875 z"
style="color:#000000;fill:url(#linearGradient3745);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3747);stroke-width:1.21277247;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
inkscape:connector-curvature="0" />
<g
style="fill:url(#linearGradient3753);fill-opacity:1;stroke:#3465a4;stroke-width:1.59985217;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:r_cy="true"
inkscape:r_cx="true"
transform="matrix(-0.579051,-0.489228,-0.489228,0.579051,-7.331961,18.953884)"
id="g1878">
<path
inkscape:r_cy="true"
inkscape:r_cx="true"
style="color:#000000;fill:url(#linearGradient3749);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3751);stroke-width:1.59985217;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
d="M 44.306783,50.229694 C 62.821497,35.818859 49.664587,13.411704 22.462411,12.49765 L 22.113843,3.1515478 7.6245439,20.496754 22.714328,33.219189 c 0,0 -0.251917,-9.88122 -0.251917,-9.88122 18.82976,0.998977 32.981627,14.071729 21.844372,26.891725 z"
id="path1880"
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0" />
</g>
<g
id="g2805"
transform="matrix(-0.508536,-0.429651,-0.429651,0.508536,-11.198811,18.947994)"
inkscape:r_cx="true"
inkscape:r_cy="true"
style="opacity:0.50000000000000000;fill:none;stroke:#ffffff;stroke-opacity:1;stroke-width:1.8216927;stroke-miterlimit:4;stroke-dasharray:none">
<path
sodipodi:nodetypes="ccccccc"
id="path2807"
d="M 51.389927,46.505946 C 60.510127,31.286196 47.050763,12.432359 19.628482,12.069755 L 19.342824,4.0507204 6.3413093,19.379475 19.809059,30.764589 c 0,0 -0.181765,-9.453243 -0.181765,-9.453243 18.244937,0.381972 34.783881,10.925246 31.762633,25.1946 z"
style="color:#000000;fill:none;stroke:url(#linearGradient3755);stroke-width:1.8216927;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
</g>
<path
sodipodi:nodetypes="cccc"
inkscape:r_cy="true"
inkscape:r_cx="true"
id="path2811"
d="m -57.435311,22.082514 c 3.593435,-10.441273 16.443782,-6.144607 20.1875,-4.5 4.175307,0.211475 5.674736,-2.835004 9,-3 -14.049736,-9.7899965 -28.8125,-6.5000002 -29.1875,7.5 z"
style="opacity:0.27222224000000000;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21277247;marker:none;visibility:visible;display:inline;overflow:visible;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -22,6 +22,7 @@
<file>macro-stop.svg</file> <file>macro-stop.svg</file>
<file>preferences-display.svg</file> <file>preferences-display.svg</file>
<file>preferences-general.svg</file> <file>preferences-general.svg</file>
<file>preferences-import-export.svg</file>
<file>utilities-terminal.svg</file> <file>utilities-terminal.svg</file>
<file>ClassBrowser/const_member.png</file> <file>ClassBrowser/const_member.png</file>
<file>ClassBrowser/member.png</file> <file>ClassBrowser/member.png</file>

View File

@ -60,8 +60,8 @@ private:
InputField::InputField(QWidget * parent) InputField::InputField(QWidget * parent)
: QLineEdit(parent), : QLineEdit(parent),
actUnitValue(0),
validInput(true), validInput(true),
actUnitValue(0),
Maximum(DOUBLE_MAX), Maximum(DOUBLE_MAX),
Minimum(-DOUBLE_MAX), Minimum(-DOUBLE_MAX),
StepSize(1.0), StepSize(1.0),
@ -180,7 +180,9 @@ void InputField::newInput(const QString & text)
{ {
Quantity res; Quantity res;
try { try {
res = Quantity::parse(text); QString input = text;
fixup(input);
res = Quantity::parse(input);
} }
catch(Base::Exception &e){ catch(Base::Exception &e){
ErrorText = e.what(); ErrorText = e.what();
@ -448,21 +450,27 @@ void InputField::setHistorySize(int i)
void InputField::selectNumber(void) void InputField::selectNumber(void)
{ {
QByteArray str = text().toLatin1(); QString str = text();
unsigned int i = 0; unsigned int i = 0;
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) { QChar d = locale().decimalPoint();
if (*it >= '0' && *it <= '9') QChar g = locale().groupSeparator();
QChar n = locale().negativeSign();
for (QString::iterator it = str.begin(); it != str.end(); ++it) {
if (it->isDigit())
i++; i++;
else if (*it == ',' || *it == '.') else if (*it == d)
i++; i++;
else if (*it == '-') else if (*it == g)
i++;
else if (*it == n)
i++; i++;
else // any non-number character else // any non-number character
break; break;
} }
setSelection(0,i); setSelection(0, i);
} }
void InputField::showEvent(QShowEvent * event) void InputField::showEvent(QShowEvent * event)
@ -483,6 +491,8 @@ void InputField::focusInEvent(QFocusEvent * event)
if (!this->hasSelectedText()) if (!this->hasSelectedText())
selectNumber(); selectNumber();
} }
QLineEdit::focusInEvent(event);
} }
void InputField::keyPressEvent(QKeyEvent *event) void InputField::keyPressEvent(QKeyEvent *event)
@ -524,13 +534,20 @@ void InputField::wheelEvent (QWheelEvent * event)
void InputField::fixup(QString& input) const void InputField::fixup(QString& input) const
{ {
input.remove(locale().groupSeparator());
if (locale().negativeSign() != QLatin1Char('-'))
input.replace(locale().negativeSign(), QLatin1Char('-'));
if (locale().positiveSign() != QLatin1Char('+'))
input.replace(locale().positiveSign(), QLatin1Char('+'));
} }
QValidator::State InputField::validate(QString& input, int& pos) const QValidator::State InputField::validate(QString& input, int& pos) const
{ {
try { try {
Quantity res; Quantity res;
res = Quantity::parse(input); QString text = input;
fixup(text);
res = Quantity::parse(text);
double factor; double factor;
QString unitStr; QString unitStr;

View File

@ -45,6 +45,7 @@
#include <Inventor/SbViewportRegion.h> #include <Inventor/SbViewportRegion.h>
#include <Inventor/actions/SoBoxHighlightRenderAction.h> #include <Inventor/actions/SoBoxHighlightRenderAction.h>
#include <Inventor/actions/SoGetBoundingBoxAction.h> #include <Inventor/actions/SoGetBoundingBoxAction.h>
#include <Inventor/actions/SoGetMatrixAction.h>
#include <Inventor/actions/SoGetPrimitiveCountAction.h> #include <Inventor/actions/SoGetPrimitiveCountAction.h>
#include <Inventor/actions/SoGLRenderAction.h> #include <Inventor/actions/SoGLRenderAction.h>
#include <Inventor/actions/SoHandleEventAction.h> #include <Inventor/actions/SoHandleEventAction.h>

View File

@ -412,7 +412,9 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f)
(QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Python console"))); (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Python console")));
pDockMgr->registerDockWindow("Std_PythonView", pcPython); pDockMgr->registerDockWindow("Std_PythonView", pcPython);
#if 0 //defined(Q_OS_WIN32) this porsion of code is not able to run with a vanilla Qtlib build on Windows. Since it is not build on Linux I pressume its not needed.... (JR 8.2014) #if 0 //defined(Q_OS_WIN32) this portion of code is not able to run with a vanilla Qtlib build on Windows.
// The MainWindowTabBar is used to show tabbed dock windows with icons
//
// add our own QTabBar-derived class to the main window layout // add our own QTabBar-derived class to the main window layout
// NOTE: This uses some private stuff from QMainWindow which doesn't // NOTE: This uses some private stuff from QMainWindow which doesn't
// seem to be accessible on all platforms. // seem to be accessible on all platforms.

View File

@ -1240,7 +1240,7 @@ bool ManualAlignment::applyPickedProbe(Gui::ViewProviderDocumentObject* prov, co
// add to the list for the non-aligned view in the left view // add to the list for the non-aligned view in the left view
if (myAlignModel.activeGroup().hasView(prov)) { if (myAlignModel.activeGroup().hasView(prov)) {
std::vector<Base::Vector3d> pts = prov->getPickedPoints(pnt); std::vector<Base::Vector3d> pts = prov->getModelPoints(pnt);
if (pts.empty()) if (pts.empty())
return false; return false;
myAlignModel.activeGroup().addPoint(pts.front()); myAlignModel.activeGroup().addPoint(pts.front());
@ -1249,7 +1249,7 @@ bool ManualAlignment::applyPickedProbe(Gui::ViewProviderDocumentObject* prov, co
return true; return true;
} }
else if (myFixedGroup.hasView(prov)) { else if (myFixedGroup.hasView(prov)) {
std::vector<Base::Vector3d> pts = prov->getPickedPoints(pnt); std::vector<Base::Vector3d> pts = prov->getModelPoints(pnt);
if (pts.empty()) if (pts.empty())
return false; return false;
myFixedGroup.addPoint(pts.front()); myFixedGroup.addPoint(pts.front());

View File

@ -28,6 +28,7 @@
# include <qevent.h> # include <qevent.h>
# include <qpainter.h> # include <qpainter.h>
# include <qpixmap.h> # include <qpixmap.h>
# include <QGLFramebufferObject>
# include <QMenu> # include <QMenu>
# include <Inventor/SbBox.h> # include <Inventor/SbBox.h>
# include <Inventor/events/SoEvent.h> # include <Inventor/events/SoEvent.h>
@ -852,7 +853,9 @@ void RubberbandSelection::initialize()
{ {
d = new Private(_pcView3D); d = new Private(_pcView3D);
_pcView3D->addGraphicsItem(d); _pcView3D->addGraphicsItem(d);
if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
_pcView3D->setRenderFramebuffer(true); _pcView3D->setRenderFramebuffer(true);
}
_pcView3D->scheduleRedraw(); _pcView3D->scheduleRedraw();
} }
@ -860,7 +863,9 @@ void RubberbandSelection::terminate()
{ {
_pcView3D->removeGraphicsItem(d); _pcView3D->removeGraphicsItem(d);
delete d; d = 0; delete d; d = 0;
if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
_pcView3D->setRenderFramebuffer(false); _pcView3D->setRenderFramebuffer(false);
}
_pcView3D->scheduleRedraw(); _pcView3D->scheduleRedraw();
} }

View File

@ -616,6 +616,11 @@ void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane
// Find projection points for the last and current mouse coordinates. // Find projection points for the last and current mouse coordinates.
SbViewVolume vv = cam->getViewVolume(aspectratio); SbViewVolume vv = cam->getViewVolume(aspectratio);
// See note in Coin docs for SoCamera::getViewVolume re:viewport mapping
if(aspectratio < 1.0)
vv.scale(1.0 / aspectratio);
SbLine line; SbLine line;
vv.projectPointToLine(currpos, line); vv.projectPointToLine(currpos, line);
SbVec3f current_planept; SbVec3f current_planept;
@ -639,7 +644,13 @@ void NavigationStyle::pan(SoCamera* camera)
} }
else { else {
const SbViewportRegion & vp = viewer->getViewportRegion(); const SbViewportRegion & vp = viewer->getViewportRegion();
SbViewVolume vv = camera->getViewVolume(vp.getViewportAspectRatio()); float aspectratio = vp.getViewportAspectRatio();
SbViewVolume vv = camera->getViewVolume(aspectratio);
// See note in Coin docs for SoCamera::getViewVolume re:viewport mapping
if(aspectratio < 1.0)
vv.scale(1.0 / aspectratio);
this->panningplane = vv.getPlane(camera->focalDistance.getValue()); this->panningplane = vv.getPlane(camera->focalDistance.getValue());
} }
} }

View File

@ -100,8 +100,8 @@ Placement::Placement(QWidget* parent, Qt::WFlags fl)
signalMapper->setMapping(this, 0); signalMapper->setMapping(this, 0);
int id = 1; int id = 1;
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
connect(*it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map())); connect(*it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map()));
signalMapper->setMapping(*it, id++); signalMapper->setMapping(*it, id++);
} }
@ -132,14 +132,14 @@ void Placement::slotActiveDocument(const Gui::Document& doc)
documents.insert(doc.getDocument()->getName()); documents.insert(doc.getDocument()->getName());
} }
bool Placement::hasValidInputs() const QWidget* Placement::getInvalidInput() const
{ {
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
if (!(*it)->hasValidInput()) if (!(*it)->hasValidInput())
return false; return (*it);
} }
return true; return 0;
} }
void Placement::revertTransformation() void Placement::revertTransformation()
@ -302,8 +302,11 @@ void Placement::on_applyButton_clicked()
bool Placement::onApply() bool Placement::onApply()
{ {
//only process things when we have valid inputs! //only process things when we have valid inputs!
if (!hasValidInputs()) { QWidget* input = getInvalidInput();
QMessageBox msg; if (input) {
input->setFocus();
QMessageBox msg(this);
msg.setWindowTitle(tr("Incorrect quantity"));
msg.setIcon(QMessageBox::Critical); msg.setIcon(QMessageBox::Critical);
msg.setText(tr("There are input fields with incorrect input, please ensure valid placement values!")); msg.setText(tr("There are input fields with incorrect input, please ensure valid placement values!"));
msg.exec(); msg.exec();
@ -322,8 +325,8 @@ bool Placement::onApply()
/*emit*/ placementChanged(data, incr, true); /*emit*/ placementChanged(data, incr, true);
if (ui->applyIncrementalPlacement->isChecked()) { if (ui->applyIncrementalPlacement->isChecked()) {
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
(*it)->blockSignals(true); (*it)->blockSignals(true);
(*it)->setValue(0); (*it)->setValue(0);
(*it)->blockSignals(false); (*it)->blockSignals(false);
@ -335,8 +338,8 @@ bool Placement::onApply()
void Placement::on_resetButton_clicked() void Placement::on_resetButton_clicked()
{ {
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
(*it)->blockSignals(true); (*it)->blockSignals(true);
(*it)->setValue(0); (*it)->setValue(0);
(*it)->blockSignals(false); (*it)->blockSignals(false);
@ -420,18 +423,18 @@ Base::Placement Placement::getPlacementData() const
Base::Vector3d pos; Base::Vector3d pos;
Base::Vector3d cnt; Base::Vector3d cnt;
pos = Base::Vector3d(ui->xPos->getQuantity().getValue(),ui->yPos->getQuantity().getValue(),ui->zPos->getQuantity().getValue()); pos = Base::Vector3d(ui->xPos->value().getValue(),ui->yPos->value().getValue(),ui->zPos->value().getValue());
cnt = Base::Vector3d(ui->xCnt->getQuantity().getValue(),ui->yCnt->getQuantity().getValue(),ui->zCnt->getQuantity().getValue()); cnt = Base::Vector3d(ui->xCnt->value().getValue(),ui->yCnt->value().getValue(),ui->zCnt->value().getValue());
if (index == 0) { if (index == 0) {
Base::Vector3d dir = getDirection(); Base::Vector3d dir = getDirection();
rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),Base::toRadians(ui->angle->getQuantity().getValue())); rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),Base::toRadians(ui->angle->value().getValue()));
} }
else if (index == 1) { else if (index == 1) {
rot.setYawPitchRoll( rot.setYawPitchRoll(
ui->yawAngle->getQuantity().getValue(), ui->yawAngle->value().getValue(),
ui->pitchAngle->getQuantity().getValue(), ui->pitchAngle->value().getValue(),
ui->rollAngle->getQuantity().getValue()); ui->rollAngle->value().getValue());
} }
Base::Placement p(pos, rot, cnt); Base::Placement p(pos, rot, cnt);
@ -447,29 +450,29 @@ QString Placement::getPlacementString() const
Base::Vector3d dir = getDirection(); Base::Vector3d dir = getDirection();
cmd = QString::fromAscii( cmd = QString::fromAscii(
"App.Placement(App.Vector(%1,%2,%3), App.Rotation(App.Vector(%4,%5,%6),%7), App.Vector(%8,%9,%10))") "App.Placement(App.Vector(%1,%2,%3), App.Rotation(App.Vector(%4,%5,%6),%7), App.Vector(%8,%9,%10))")
.arg(ui->xPos->getQuantity().getValue()) .arg(ui->xPos->value().getValue())
.arg(ui->yPos->getQuantity().getValue()) .arg(ui->yPos->value().getValue())
.arg(ui->zPos->getQuantity().getValue()) .arg(ui->zPos->value().getValue())
.arg(dir.x) .arg(dir.x)
.arg(dir.y) .arg(dir.y)
.arg(dir.z) .arg(dir.z)
.arg(ui->angle->getQuantity().getValue()) .arg(ui->angle->value().getValue())
.arg(ui->xCnt->getQuantity().getValue()) .arg(ui->xCnt->value().getValue())
.arg(ui->yCnt->getQuantity().getValue()) .arg(ui->yCnt->value().getValue())
.arg(ui->zCnt->getQuantity().getValue()); .arg(ui->zCnt->value().getValue());
} }
else if (index == 1) { else if (index == 1) {
cmd = QString::fromAscii( cmd = QString::fromAscii(
"App.Placement(App.Vector(%1,%2,%3), App.Rotation(%4,%5,%6), App.Vector(%7,%8,%9))") "App.Placement(App.Vector(%1,%2,%3), App.Rotation(%4,%5,%6), App.Vector(%7,%8,%9))")
.arg(ui->xPos->getQuantity().getValue()) .arg(ui->xPos->value().getValue())
.arg(ui->yPos->getQuantity().getValue()) .arg(ui->yPos->value().getValue())
.arg(ui->zPos->getQuantity().getValue()) .arg(ui->zPos->value().getValue())
.arg(ui->yawAngle->getQuantity().getValue()) .arg(ui->yawAngle->value().getValue())
.arg(ui->pitchAngle->getQuantity().getValue()) .arg(ui->pitchAngle->value().getValue())
.arg(ui->rollAngle->getQuantity().getValue()) .arg(ui->rollAngle->value().getValue())
.arg(ui->xCnt->getQuantity().getValue()) .arg(ui->xCnt->value().getValue())
.arg(ui->yCnt->getQuantity().getValue()) .arg(ui->yCnt->value().getValue())
.arg(ui->zCnt->getQuantity().getValue()); .arg(ui->zCnt->value().getValue());
} }
return cmd; return cmd;

View File

@ -74,7 +74,7 @@ private:
void applyPlacement(const QString& p, bool incremental); void applyPlacement(const QString& p, bool incremental);
void revertTransformation(); void revertTransformation();
void slotActiveDocument(const Gui::Document&); void slotActiveDocument(const Gui::Document&);
bool hasValidInputs() const; QWidget* getInvalidInput() const;
Q_SIGNALS: Q_SIGNALS:
void placementChanged(const QVariant &, bool, bool); void placementChanged(const QVariant &, bool, bool);

View File

@ -85,13 +85,13 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="Gui::InputField" name="xPos"/> <widget class="Gui::QuantitySpinBox" name="xPos"/>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="Gui::InputField" name="yPos"/> <widget class="Gui::QuantitySpinBox" name="yPos"/>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="Gui::InputField" name="zPos"/> <widget class="Gui::QuantitySpinBox" name="zPos"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -161,13 +161,13 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="Gui::InputField" name="xCnt"/> <widget class="Gui::QuantitySpinBox" name="xCnt"/>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="Gui::InputField" name="yCnt"/> <widget class="Gui::QuantitySpinBox" name="yCnt"/>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="Gui::InputField" name="zCnt"/> <widget class="Gui::QuantitySpinBox" name="zCnt"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -239,7 +239,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="Gui::InputField" name="angle"/> <widget class="Gui::QuantitySpinBox" name="angle"/>
</item> </item>
</layout> </layout>
</item> </item>
@ -301,13 +301,13 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="Gui::InputField" name="yawAngle"/> <widget class="Gui::QuantitySpinBox" name="yawAngle"/>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="Gui::InputField" name="pitchAngle"/> <widget class="Gui::QuantitySpinBox" name="pitchAngle"/>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="Gui::InputField" name="rollAngle"/> <widget class="Gui::QuantitySpinBox" name="rollAngle"/>
</item> </item>
</layout> </layout>
</item> </item>
@ -439,9 +439,9 @@
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>Gui::InputField</class> <class>Gui::QuantitySpinBox</class>
<extends>QLineEdit</extends> <extends>QWidget</extends>
<header location="global">Gui/InputField.h</header> <header location="global">Gui/QuantitySpinBox.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Juergen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
@ -52,6 +52,11 @@ using namespace Gui::PropertyEditor;
/* TRANSLATOR Gui::PropertyView */ /* TRANSLATOR Gui::PropertyView */
/*! Property Editor Widget
*
* Provides two Gui::PropertyEditor::PropertyEditor widgets, for "View" and "Data",
* in two tabs.
*/
PropertyView::PropertyView(QWidget *parent) PropertyView::PropertyView(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
@ -129,7 +134,7 @@ void PropertyView::onSelectionChanged(const SelectionChanges& msg)
if (ob) { if (ob) {
for (pt = dataList.begin(); pt != dataList.end(); ++pt) { for (pt = dataList.begin(); pt != dataList.end(); ++pt) {
PropInfo nameType; PropInfo nameType;
nameType.propName = ob->getName(*pt); nameType.propName = ob->getPropertyName(*pt);
nameType.propId = (*pt)->getTypeId().getKey(); nameType.propId = (*pt)->getTypeId().getKey();
if (!ob->isHidden(*pt) && !(*pt)->StatusBits.test(3)) { if (!ob->isHidden(*pt) && !(*pt)->StatusBits.test(3)) {

395
src/Gui/QuantitySpinBox.cpp Normal file
View File

@ -0,0 +1,395 @@
/***************************************************************************
* Copyright (c) 2014 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* 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., 51 Franklin Street, *
* Fifth Floor, Boston, MA 02110-1301, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QLineEdit>
# include <QFocusEvent>
#endif
#include "QuantitySpinBox.h"
#include <Base/Exception.h>
using namespace Gui;
namespace Gui {
class QuantitySpinBoxPrivate
{
public:
QuantitySpinBoxPrivate() :
validInput(true),
unitValue(0),
maximum(DOUBLE_MAX),
minimum(-DOUBLE_MAX),
singleStep(1.0)
{
}
~QuantitySpinBoxPrivate()
{
}
Base::Quantity validateAndInterpret(QString& input, int& pos, QValidator::State& state) const
{
Base::Quantity res;
try {
res = Base::Quantity::parse(input);
double factor;
QString unitStr;
res.getUserString(factor, unitStr);
double value = res.getValue()/factor;
// disallow to enter numbers out of range
if (value > this->maximum || value < this->minimum)
state = QValidator::Invalid;
else
state = QValidator::Acceptable;
}
catch (Base::Exception&) {
// Actually invalid input but the newInput slot gives
// some feedback
state = QValidator::Intermediate;
}
return res;
}
bool validInput;
QString errorText;
Base::Quantity quantity;
Base::Unit unit;
double unitValue;
QString unitStr;
double maximum;
double minimum;
double singleStep;
};
}
QuantitySpinBox::QuantitySpinBox(QWidget *parent)
: QAbstractSpinBox(parent), d_ptr(new QuantitySpinBoxPrivate())
{
this->setContextMenuPolicy(Qt::DefaultContextMenu);
QObject::connect(lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(userInput(QString)));
}
QuantitySpinBox::~QuantitySpinBox()
{
}
void QuantitySpinBox::updateText(const Base::Quantity& quant)
{
Q_D(QuantitySpinBox);
double dFactor;
QString txt = quant.getUserString(dFactor,d->unitStr);
d->unitValue = quant.getValue()/dFactor;
lineEdit()->setText(txt);
}
Base::Quantity QuantitySpinBox::value() const
{
Q_D(const QuantitySpinBox);
return d->quantity;
}
void QuantitySpinBox::setValue(const Base::Quantity& value)
{
Q_D(QuantitySpinBox);
d->quantity = value;
// check limits
if (d->quantity.getValue() > d->maximum)
d->quantity.setValue(d->maximum);
if (d->quantity.getValue() < d->minimum)
d->quantity.setValue(d->minimum);
d->unit = value.getUnit();
updateText(value);
}
void QuantitySpinBox::setValue(double value)
{
Q_D(QuantitySpinBox);
setValue(Base::Quantity(value, d->unit));
}
bool QuantitySpinBox::hasValidInput() const
{
Q_D(const QuantitySpinBox);
return d->validInput;
}
void QuantitySpinBox::userInput(const QString & text)
{
Q_D(QuantitySpinBox);
Base::Quantity res;
try {
QString input = text;
fixup(input);
res = Base::Quantity::parse(input);
}
catch (Base::Exception &e) {
d->errorText = QString::fromAscii(e.what());
parseError(d->errorText);
d->validInput = false;
return;
}
if (res.getUnit().isEmpty())
res.setUnit(d->unit);
// check if unit fits!
if (!d->unit.isEmpty() && !res.getUnit().isEmpty() && d->unit != res.getUnit()){
parseError(QString::fromAscii("Wrong unit"));
d->validInput = false;
return;
}
d->errorText.clear();
d->validInput = true;
if (res.getValue() > d->maximum){
res.setValue(d->maximum);
d->errorText = tr("Maximum reached");
}
if (res.getValue() < d->minimum){
res.setValue(d->minimum);
d->errorText = tr("Minimum reached");
}
double dFactor;
res.getUserString(dFactor,d->unitStr);
d->unitValue = res.getValue()/dFactor;
d->quantity = res;
// signaling
valueChanged(res);
valueChanged(res.getValue());
}
Base::Unit QuantitySpinBox::unit() const
{
Q_D(const QuantitySpinBox);
return d->unit;
}
void QuantitySpinBox::setUnit(const Base::Unit &unit)
{
Q_D(QuantitySpinBox);
d->unit = unit;
d->quantity.setUnit(unit);
updateText(d->quantity);
}
void QuantitySpinBox::setUnitText(const QString& str)
{
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
}
QString QuantitySpinBox::unitText(void)
{
Q_D(QuantitySpinBox);
return d->unitStr;
}
double QuantitySpinBox::singleStep() const
{
Q_D(const QuantitySpinBox);
return d->singleStep;
}
void QuantitySpinBox::setSingleStep(double value)
{
Q_D(QuantitySpinBox);
if (value >= 0) {
d->singleStep = value;
}
}
double QuantitySpinBox::minimum() const
{
Q_D(const QuantitySpinBox);
return d->minimum;
}
void QuantitySpinBox::setMinimum(double minimum)
{
Q_D(QuantitySpinBox);
d->minimum = minimum;
}
double QuantitySpinBox::maximum() const
{
Q_D(const QuantitySpinBox);
return d->maximum;
}
void QuantitySpinBox::setMaximum(double maximum)
{
Q_D(QuantitySpinBox);
d->maximum = maximum;
}
void QuantitySpinBox::setRange(double minimum, double maximum)
{
Q_D(QuantitySpinBox);
d->minimum = minimum;
d->maximum = maximum;
}
QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const
{
Q_D(const QuantitySpinBox);
if (isReadOnly() || !d->validInput)
return StepNone;
if (wrapping())
return StepEnabled(StepUpEnabled | StepDownEnabled);
StepEnabled ret = StepNone;
if (d->quantity.getValue() < d->maximum) {
ret |= StepUpEnabled;
}
if (d->quantity.getValue() > d->minimum) {
ret |= StepDownEnabled;
}
return ret;
}
void QuantitySpinBox::stepBy(int steps)
{
Q_D(QuantitySpinBox);
double step = d->singleStep * steps;
double val = d->unitValue + step;
if (val > d->maximum)
val = d->maximum;
else if (val < d->minimum)
val = d->minimum;
lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(d->unitStr));
update();
selectNumber();
}
void QuantitySpinBox::showEvent(QShowEvent * event)
{
Q_D(QuantitySpinBox);
QAbstractSpinBox::showEvent(event);
bool selected = lineEdit()->hasSelectedText();
updateText(d->quantity);
if (selected)
selectNumber();
}
void QuantitySpinBox::focusInEvent(QFocusEvent * event)
{
bool hasSel = lineEdit()->hasSelectedText();
QAbstractSpinBox::focusInEvent(event);
if (event->reason() == Qt::TabFocusReason ||
event->reason() == Qt::BacktabFocusReason ||
event->reason() == Qt::ShortcutFocusReason) {
if (!hasSel)
selectNumber();
}
}
void QuantitySpinBox::clear()
{
QAbstractSpinBox::clear();
}
void QuantitySpinBox::selectNumber()
{
QString str = lineEdit()->text();
unsigned int i = 0;
QChar d = locale().decimalPoint();
QChar g = locale().groupSeparator();
QChar n = locale().negativeSign();
for (QString::iterator it = str.begin(); it != str.end(); ++it) {
if (it->isDigit())
i++;
else if (*it == d)
i++;
else if (*it == g)
i++;
else if (*it == n)
i++;
else // any non-number character
break;
}
lineEdit()->setSelection(0, i);
}
QString QuantitySpinBox::textFromValue(const Base::Quantity& value) const
{
double factor;
QString unitStr;
QString str = value.getUserString(factor, unitStr);
if (qAbs(value.getValue()) >= 1000.0) {
str.remove(locale().groupSeparator());
}
return str;
}
Base::Quantity QuantitySpinBox::valueFromText(const QString &text) const
{
Q_D(const QuantitySpinBox);
QString copy = text;
fixup( copy );
int pos = lineEdit()->cursorPosition();
QValidator::State state = QValidator::Acceptable;
return d->validateAndInterpret(copy, pos, state);
}
QValidator::State QuantitySpinBox::validate(QString &text, int &pos) const
{
Q_D(const QuantitySpinBox);
QValidator::State state;
QString copy = text;
fixup(copy);
d->validateAndInterpret(copy, pos, state);
return state;
}
void QuantitySpinBox::fixup(QString &input) const
{
input.remove(locale().groupSeparator());
if (locale().negativeSign() != QLatin1Char('-'))
input.replace(locale().negativeSign(), QLatin1Char('-'));
if (locale().positiveSign() != QLatin1Char('+'))
input.replace(locale().positiveSign(), QLatin1Char('+'));
}
#include "moc_QuantitySpinBox.cpp"

138
src/Gui/QuantitySpinBox.h Normal file
View File

@ -0,0 +1,138 @@
/***************************************************************************
* Copyright (c) 2014 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* 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_QUANTITYSPINBOX_H
#define GUI_QUANTITYSPINBOX_H
#include <QAbstractSpinBox>
#include <Base/Quantity.h>
#ifdef Q_MOC_RUN
Q_DECLARE_METATYPE(Base::Quantity)
#endif
namespace Gui {
class QuantitySpinBoxPrivate;
class GuiExport QuantitySpinBox : public QAbstractSpinBox
{
Q_OBJECT
Q_PROPERTY(QString unit READ unitText WRITE setUnitText)
Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
Q_PROPERTY(Base::Quantity value READ value WRITE setValue NOTIFY valueChanged USER true)
public:
explicit QuantitySpinBox(QWidget *parent = 0);
virtual ~QuantitySpinBox();
/// Get the current quantity
Base::Quantity value() const;
/// Gives the current state of the user input, gives true if it is a valid input with correct quantity
/// or returns false if the input is a unparsable string or has a wrong unit.
bool hasValidInput() const;
/** Sets the Unit this widget is working with.
* After setting the Unit the widget will only accept
* user input with this unit type. Or if the user input
* a value without unit, this one will be added to the resulting
* Quantity.
*/
Base::Unit unit() const;
void setUnit(const Base::Unit &unit);
/// Set the unit property
void setUnitText(const QString&);
/// Get the unit property
QString unitText(void);
/// Get the value of the singleStep property
double singleStep() const;
/// Set the value of the singleStep property
void setSingleStep(double val);
/// Gets the value of the minimum property
double minimum() const;
/// Sets the value of the minimum property
void setMinimum(double min);
/// Gets the value of the maximum property
double maximum() const;
/// Sets the value of the maximum property
void setMaximum(double max);
/// Set the number portion selected
void selectNumber();
void setRange(double min, double max);
Base::Quantity valueFromText(const QString &text) const;
QString textFromValue(const Base::Quantity& val) const;
virtual void stepBy(int steps);
virtual void clear();
virtual QValidator::State validate(QString &input, int &pos) const;
virtual void fixup(QString &str) const;
public Q_SLOTS:
/// Sets the field with a quantity
void setValue(const Base::Quantity& val);
/// Set a numerical value which gets converted to a quantity with the currently set unit type
void setValue(double);
protected Q_SLOTS:
void userInput(const QString & text);
protected:
virtual StepEnabled stepEnabled() const;
virtual void showEvent(QShowEvent * event);
virtual void focusInEvent(QFocusEvent * event);
private:
void updateText(const Base::Quantity&);
Q_SIGNALS:
/** Gets emitted if the user has entered a VALID input
* Valid means the user inputted string obeys all restrictions
* like: minimum, maximum and/or the right Unit (if specified).
*/
void valueChanged(const Base::Quantity&);
/** Gets emitted if the user has entered a VALID input
* Valid means the user inputted string obeys all restrictions
* like: minimum, maximum and/or the right Unit (if specified).
*/
void valueChanged(double);
/// Signal for an invalid user input
void parseError(const QString& errorText);
private:
QuantitySpinBoxPrivate * const d_ptr;
Q_DISABLE_COPY(QuantitySpinBox)
Q_DECLARE_PRIVATE(QuantitySpinBox)
};
} // namespace Gui
#endif // GUI_QUANTITYSPINBOX_H

View File

@ -126,9 +126,8 @@ void SelectionView::onUpdate(void)
{ {
} }
bool SelectionView::onMsg(const char* pMsg) bool SelectionView::onMsg(const char* pMsg,const char** ppReturn)
{ {
// no messages yet
return false; return false;
} }
/// @endcond /// @endcond

View File

@ -75,7 +75,7 @@ public:
Gui::SelectionSingleton::MessageType Reason); Gui::SelectionSingleton::MessageType Reason);
bool onMsg(const char* pMsg); bool onMsg(const char* pMsg,const char** ppReturn);
virtual const char *getName(void) const {return "SelectionView";} virtual const char *getName(void) const {return "SelectionView";}

View File

@ -138,6 +138,7 @@ void Gui::SoFCDB::init()
qRegisterMetaType<Base::Vector3f>("Base::Vector3f"); qRegisterMetaType<Base::Vector3f>("Base::Vector3f");
qRegisterMetaType<Base::Vector3d>("Base::Vector3d"); qRegisterMetaType<Base::Vector3d>("Base::Vector3d");
qRegisterMetaType<Base::Quantity>("Base::Quantity"); qRegisterMetaType<Base::Quantity>("Base::Quantity");
qRegisterMetaType<QList<Base::Quantity> >("Base::QuantityList");
init_done = TRUE; init_done = TRUE;
} }

View File

@ -235,6 +235,8 @@ AboutDialog::~AboutDialog()
delete ui; delete ui;
} }
class SystemInfo {
public:
static QString getOperatingSystem() static QString getOperatingSystem()
{ {
#if defined (Q_OS_WIN32) #if defined (Q_OS_WIN32)
@ -278,6 +280,80 @@ static QString getOperatingSystem()
#endif #endif
} }
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
#endif
static int getWordSizeOfOS()
{
#if defined(Q_OS_WIN64)
return 64; // 64-bit process running on 64-bit windows
#elif defined(Q_OS_WIN32)
// determine if 32-bit process running on 64-bit windows in WOW64 emulation
// or 32-bit process running on 32-bit windows
// default bIsWow64 to FALSE for 32-bit process on 32-bit windows
BOOL bIsWow64 = FALSE; // must default to FALSE
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
GetModuleHandle("kernel32"), "IsWow64Process");
if (NULL != fnIsWow64Process) {
if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
assert(false); // something went majorly wrong
}
}
return bIsWow64 ? 64 : 32;
#elif defined (Q_OS_LINUX)
// http://stackoverflow.com/questions/246007/how-to-determine-whether-a-given-linux-is-32-bit-or-64-bit
QString exe(QLatin1String("getconf"));
QStringList args;
args << QLatin1String("LONG_BIT");
QProcess proc;
proc.setEnvironment(QProcess::systemEnvironment());
proc.start(exe, args);
if (proc.waitForStarted() && proc.waitForFinished()) {
QByteArray info = proc.readAll();
info.replace('\n',"");
return info.toInt();
}
return 0; // failed
#elif defined (Q_OS_UNIX) || defined (Q_OS_MAC)
QString exe(QLatin1String("uname"));
QStringList args;
args << QLatin1String("-m");
QProcess proc;
proc.setEnvironment(QProcess::systemEnvironment());
proc.start(exe, args);
if (proc.waitForStarted() && proc.waitForFinished()) {
QByteArray info = proc.readAll();
info.replace('\n',"");
if (info.indexOf("x86_64") >= 0)
return 64;
else if (info.indexOf("amd64") >= 0)
return 64;
else if (info.indexOf("ia64") >= 0)
return 64;
else if (info.indexOf("ppc64") >= 0)
return 64;
else if (info.indexOf("i386") >= 0)
return 32;
else if (info.indexOf("i686") >= 0)
return 32;
else if (info.indexOf("x86") >= 0)
return 32;
}
return 0; // failed
#else
return 0; // unknown
#endif
}
};
void AboutDialog::setupLabels() void AboutDialog::setupLabels()
{ {
//fonts are rendered smaller on Mac so point size can't be the same for all platforms //fonts are rendered smaller on Mac so point size can't be the same for all platforms
@ -320,7 +396,7 @@ void AboutDialog::setupLabels()
ui->labelBuildDate->setText(date); ui->labelBuildDate->setText(date);
QString os = ui->labelBuildOS->text(); QString os = ui->labelBuildOS->text();
os.replace(QString::fromAscii("Unknown"), getOperatingSystem()); os.replace(QString::fromAscii("Unknown"), SystemInfo::getOperatingSystem());
ui->labelBuildOS->setText(os); ui->labelBuildOS->setText(os);
QString platform = ui->labelBuildPlatform->text(); QString platform = ui->labelBuildPlatform->text();
@ -409,12 +485,17 @@ void AboutDialog::on_copyButton_clicked()
QTextStream str(&data); QTextStream str(&data);
std::map<std::string, std::string>& config = App::Application::Config(); std::map<std::string, std::string>& config = App::Application::Config();
std::map<std::string,std::string>::iterator it; std::map<std::string,std::string>::iterator it;
QString exe = QString::fromAscii(App::GetApplication().getExecutableName());
QString major = QString::fromAscii(config["BuildVersionMajor"].c_str()); QString major = QString::fromAscii(config["BuildVersionMajor"].c_str());
QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str()); QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str());
QString build = QString::fromAscii(config["BuildRevision"].c_str()); QString build = QString::fromAscii(config["BuildRevision"].c_str());
str << "OS: " << getOperatingSystem() << endl; str << "OS: " << SystemInfo::getOperatingSystem() << endl;
str << "Word size: " << QSysInfo::WordSize << "-bit" << endl; int wordSize = SystemInfo::getWordSizeOfOS();
if (wordSize > 0) {
str << "Word size of OS: " << wordSize << "-bit" << endl;
}
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit" << endl;
str << "Version: " << major << "." << minor << "." << build << endl; str << "Version: " << major << "." << minor << "." << build << endl;
it = config.find("BuildRevisionBranch"); it = config.find("BuildRevisionBranch");
if (it != config.end()) if (it != config.end())

View File

@ -58,6 +58,14 @@ AbstractSplitView::~AbstractSplitView()
} }
} }
void AbstractSplitView::deleteSelf()
{
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it) {
(*it)->setSceneGraph(0);
}
MDIView::deleteSelf();
}
void AbstractSplitView::setupSettings() void AbstractSplitView::setupSettings()
{ {
// attach Parameter Observer // attach Parameter Observer

View File

@ -51,6 +51,7 @@ public:
virtual bool onHasMsg(const char* pMsg) const; virtual bool onHasMsg(const char* pMsg) const;
virtual void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason); virtual void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason);
virtual void onUpdate(void); virtual void onUpdate(void);
virtual void deleteSelf();
View3DInventorViewer *getViewer(unsigned int) const; View3DInventorViewer *getViewer(unsigned int) const;

View File

@ -169,9 +169,8 @@ void TaskPanelView::onUpdate(void)
{ {
} }
bool TaskPanelView::onMsg(const char* pMsg) bool TaskPanelView::onMsg(const char* pMsg,const char** ppReturn)
{ {
// no messages yet
return false; return false;
} }
/// @endcond /// @endcond

View File

@ -55,8 +55,7 @@ public:
Gui::SelectionSingleton::MessageType Reason); Gui::SelectionSingleton::MessageType Reason);
bool onMsg(const char* pMsg); virtual bool onMsg(const char* pMsg,const char** ppReturn);
virtual const char *getName(void) const {return "TaskPanelView";} virtual const char *getName(void) const {return "TaskPanelView";}
/// get called when the document is changed or updated /// get called when the document is changed or updated

View File

@ -103,7 +103,7 @@ void TaskAppearance::slotChangedObject(const Gui::ViewProvider& obj,
std::bind2nd(std::equal_to<Gui::ViewProvider*>(), std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj))); const_cast<Gui::ViewProvider*>(&obj)));
if (vp != Provider.end()) { if (vp != Provider.end()) {
std::string prop_name = obj.getName(&prop); std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
long value = static_cast<const App::PropertyInteger&>(prop).getValue(); long value = static_cast<const App::PropertyInteger&>(prop).getValue();
if (prop_name == "Transparency") { if (prop_name == "Transparency") {

View File

@ -61,7 +61,7 @@ public:
(Base::Type::fromName("App::PropertyGeometry")); (Base::Type::fromName("App::PropertyGeometry"));
} }
}; };
class find_placement class find_transform
{ {
public: public:
bool operator () (const std::pair<std::string, App::Property*>& elem) const bool operator () (const std::pair<std::string, App::Property*>& elem) const
@ -138,7 +138,7 @@ void TransformStrategy::acceptDataTransform(const Base::Matrix4D& mat, App::Docu
obj->getPropertyMap(props); obj->getPropertyMap(props);
// search for the placement property // search for the placement property
std::map<std::string,App::Property*>::iterator jt; std::map<std::string,App::Property*>::iterator jt;
jt = std::find_if(props.begin(), props.end(), find_placement()); jt = std::find_if(props.begin(), props.end(), find_transform());
if (jt != props.end()) { if (jt != props.end()) {
Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue(); Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue();
Gui::ViewProvider* vp = doc->getViewProvider(obj); Gui::ViewProvider* vp = doc->getViewProvider(obj);
@ -180,7 +180,7 @@ void TransformStrategy::applyViewTransform(const Base::Placement& plm, App::Docu
obj->getPropertyMap(props); obj->getPropertyMap(props);
// search for the placement property // search for the placement property
std::map<std::string,App::Property*>::iterator jt; std::map<std::string,App::Property*>::iterator jt;
jt = std::find_if(props.begin(), props.end(), find_placement()); jt = std::find_if(props.begin(), props.end(), find_transform());
if (jt != props.end()) { if (jt != props.end()) {
Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue(); Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue();
local *= plm; // in case a placement is already set local *= plm; // in case a placement is already set
@ -201,7 +201,7 @@ void TransformStrategy::resetViewTransform(App::DocumentObject* obj)
obj->getPropertyMap(props); obj->getPropertyMap(props);
// search for the placement property // search for the placement property
std::map<std::string,App::Property*>::iterator jt; std::map<std::string,App::Property*>::iterator jt;
jt = std::find_if(props.begin(), props.end(), find_placement()); jt = std::find_if(props.begin(), props.end(), find_transform());
if (jt != props.end()) { if (jt != props.end()) {
Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue(); Base::Placement local = static_cast<App::PropertyPlacement*>(jt->second)->getValue();
Gui::ViewProvider* vp = doc->getViewProvider(obj); Gui::ViewProvider* vp = doc->getViewProvider(obj);
@ -318,8 +318,8 @@ Transform::Transform(QWidget* parent, Qt::WFlags fl)
signalMapper->setMapping(this, 0); signalMapper->setMapping(this, 0);
int id = 1; int id = 1;
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
connect(*it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map())); connect(*it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map()));
signalMapper->setMapping(*it, id++); signalMapper->setMapping(*it, id++);
} }
@ -383,8 +383,8 @@ void Transform::on_applyButton_clicked()
strategy->commitTransform(mat); strategy->commitTransform(mat);
// nullify the values // nullify the values
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>(); QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) { for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
(*it)->blockSignals(true); (*it)->blockSignals(true);
(*it)->setValue(0.0); (*it)->setValue(0.0);
(*it)->blockSignals(false); (*it)->blockSignals(false);
@ -415,18 +415,18 @@ Base::Placement Transform::getPlacementData() const
Base::Vector3d pos; Base::Vector3d pos;
Base::Vector3d cnt; Base::Vector3d cnt;
pos = Base::Vector3d(ui->xPos->getQuantity().getValue(),ui->yPos->getQuantity().getValue(),ui->zPos->getQuantity().getValue()); pos = Base::Vector3d(ui->xPos->value().getValue(),ui->yPos->value().getValue(),ui->zPos->value().getValue());
cnt = Base::Vector3d(ui->xCnt->getQuantity().getValue(),ui->yCnt->getQuantity().getValue(),ui->zCnt->getQuantity().getValue()); cnt = Base::Vector3d(ui->xCnt->value().getValue(),ui->yCnt->value().getValue(),ui->zCnt->value().getValue());
if (index == 0) { if (index == 0) {
Base::Vector3d dir = getDirection(); Base::Vector3d dir = getDirection();
rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),ui->angle->getQuantity().getValue()*D_PI/180.0); rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),ui->angle->value().getValue()*D_PI/180.0);
} }
else if (index == 1) { else if (index == 1) {
rot.setYawPitchRoll( rot.setYawPitchRoll(
ui->yawAngle->getQuantity().getValue(), ui->yawAngle->value().getValue(),
ui->pitchAngle->getQuantity().getValue(), ui->pitchAngle->value().getValue(),
ui->rollAngle->getQuantity().getValue()); ui->rollAngle->value().getValue());
} }
Base::Placement p(pos, rot, cnt); Base::Placement p(pos, rot, cnt);

View File

@ -171,7 +171,7 @@ View3DInventor::~View3DInventor()
hGrp->Detach(this); hGrp->Detach(this);
//If we destroy this viewer by calling 'delete' directly the focus proxy widget which is defined //If we destroy this viewer by calling 'delete' directly the focus proxy widget which is defined
//by a widget in SoQtViewer isn't resetted. This widget becomes to a dangling pointer and makes //by a widget in SoQtViewer isn't reset. This widget becomes a dangling pointer and makes
//the application crash. (Probably it's better to destroy this viewer by calling close().) //the application crash. (Probably it's better to destroy this viewer by calling close().)
//See also Gui::Document::~Document(). //See also Gui::Document::~Document().
QWidget* foc = qApp->focusWidget(); QWidget* foc = qApp->focusWidget();

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2004 Juergen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
@ -58,7 +58,7 @@ protected:
/** The 3D view window /** The 3D view window
* It consists out of the 3D view * It consists out of the 3D view
* \author Jürgen Riegel * \author Juergen Riegel
*/ */
class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverType class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverType
{ {
@ -70,7 +70,7 @@ public:
View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0);
~View3DInventor(); ~View3DInventor();
/// Mesage handler /// Message handler
virtual bool onMsg(const char* pMsg, const char** ppReturn); virtual bool onMsg(const char* pMsg, const char** ppReturn);
virtual bool onHasMsg(const char* pMsg) const; virtual bool onHasMsg(const char* pMsg) const;
virtual void deleteSelf(); virtual void deleteSelf();

View File

@ -35,6 +35,7 @@
# endif # endif
# include <Inventor/SbBox.h> # include <Inventor/SbBox.h>
# include <Inventor/actions/SoGetBoundingBoxAction.h> # include <Inventor/actions/SoGetBoundingBoxAction.h>
# include <Inventor/actions/SoGetMatrixAction.h>
# include <Inventor/actions/SoHandleEventAction.h> # include <Inventor/actions/SoHandleEventAction.h>
# include <Inventor/actions/SoToVRML2Action.h> # include <Inventor/actions/SoToVRML2Action.h>
# include <Inventor/actions/SoWriteAction.h> # include <Inventor/actions/SoWriteAction.h>
@ -738,6 +739,50 @@ const std::vector<SbVec2s>& View3DInventorViewer::getPolygon(SbBool* clip_inner)
return navigation->getPolygon(clip_inner); return navigation->getPolygon(clip_inner);
} }
SbVec2f View3DInventorViewer::screenCoordsOfPath(SoPath *path) const
{
// Generate a matrix (well, a SoGetMatrixAction) that
// moves us to the picked object's coordinate space.
SoGetMatrixAction gma(getViewportRegion());
gma.apply(path);
// Use that matrix to translate the origin in the picked
// object's coordinate space into object space
SbVec3f imageCoords(0, 0, 0);
SbMatrix m = gma.getMatrix().transpose();
m.multMatrixVec(imageCoords, imageCoords);
// Now, project the object space coordinates of the object
// into "normalized" screen coordinates.
SbViewVolume vol = getCamera()->getViewVolume();
vol.projectToScreen(imageCoords, imageCoords);
// Translate "normalized" screen coordinates to pixel coords.
//
// Note: for some reason, projectToScreen() doesn't seem to
// handle non-square viewports properly. The X and Y are
// scaled such that [0,1] fits within the smaller of the window
// width or height. For instance, in a window that's 400px
// tall and 800px wide, the Y will be within [0,1], but X can
// vary within [-0.5,1.5]...
int width = getGLWidget()->width(),
height = getGLWidget()->height();
if(width >= height) {
// "Landscape" orientation, to square
imageCoords[0] *= height;
imageCoords[0] += (width-height) / 2.0;
imageCoords[1] *= height;
} else {
// "Portrait" orientation
imageCoords[0] *= width;
imageCoords[1] *= width;
imageCoords[1] += (height-width) / 2.0;
}
return SbVec2f(imageCoords[0], imageCoords[1]);
}
std::vector<SbVec2f> View3DInventorViewer::getGLPolygon(const std::vector<SbVec2s>& pnts) const std::vector<SbVec2f> View3DInventorViewer::getGLPolygon(const std::vector<SbVec2s>& pnts) const
{ {
const SbViewportRegion& vp = this->getViewportRegion(); const SbViewportRegion& vp = this->getViewportRegion();

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2004 Juergen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
@ -61,7 +61,7 @@ class SoFCUnifiedSelection;
class GLGraphicsItem; class GLGraphicsItem;
class SoShapeScale; class SoShapeScale;
/** The Inventor viewer /** GUI view into a 3D scene provided by View3DInventor
* *
*/ */
class GuiExport View3DInventorViewer : public SoQtViewer, public Gui::SelectionSingleton::ObserverType class GuiExport View3DInventorViewer : public SoQtViewer, public Gui::SelectionSingleton::ObserverType
@ -100,10 +100,9 @@ public:
//@} //@}
/** @name Anti-Aliasing modes of the rendered 3D scene /** @name Anti-Aliasing modes of the rendered 3D scene
* Here you can switch between different methods for anti aliasing wich provide quite different results * Specifies Anti-Aliasing (AA) method
* at different runtime impact. * - Smoothing enables OpenGL line and vertex smoothing (basicly depreciated)
* - Smoothing enables openGL line and vertex smoothing which is basicly deprecadet * - MSAA is hardware multi sampling (with 2, 4 or 8 passes), a quite commom and efficient AA technique
* - MSAA is hardeware multi sampling (with 2, 4 or 8 passes), a quite commom and efficient AA technique
*/ */
//@{ //@{
enum AntiAliasing { enum AntiAliasing {
@ -205,6 +204,10 @@ public:
const std::vector<SbVec2s>& getPolygon(SbBool* clip_inner=0) const; const std::vector<SbVec2s>& getPolygon(SbBool* clip_inner=0) const;
//@} //@}
/// Returns the screen coordinates of the origin of the path's tail object
/*! Return value is in floating-point pixels, origin at bottom-left. */
SbVec2f screenCoordsOfPath(SoPath *path) const;
/** @name Edit methods */ /** @name Edit methods */
//@{ //@{
void setEditing(SbBool edit); void setEditing(SbBool edit);

Some files were not shown because too many files have changed in this diff Show More