Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
jriegel
2012-06-10 10:27:22 +02:00
572 changed files with 38725 additions and 8196 deletions
+40 -21
View File
@@ -52,6 +52,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wno-write-strings)
add_definitions(-Wno-deprecated)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# get linker errors as soon as possible and not at runtime e.g. for modules
if(UNIX)
# SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
endif(UNIX)
endif(CMAKE_COMPILER_IS_GNUCXX)
@@ -96,7 +100,16 @@ OPTION(FREECAD_MAINTAINERS_BUILD "Build FreeCAD for Maintainers, with Docu and 3
OPTION(FREECAD_BUILD_CAM "Build the FreeCAD CAM module and the needed libs, be aware, unfinished code!" OFF)
OPTION(FREECAD_BUILD_FEM "Build the FreeCAD FEM module, be aware, unfinished code!" ON)
OPTION(FREECAD_BUILD_SANDBOX "Build the FreeCAD Sandbox module which is only for testing purposes" OFF)
OPTION(FREECAD_BUILD_TEMPLATE "Build the FreeCAD template module which is only for testing purposes" OFF)
OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" 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)
# if this is set override some options
if (FREECAD_BUILD_DEBIAN)
set(FREECAD_USE_EXTERNAL_ZIPIOS ON)
set(FREECAD_USE_EXTERNAL_PIVY ON)
endif (FREECAD_BUILD_DEBIAN)
# ==============================================================================
@@ -256,21 +269,21 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X)
# -------------------------------- ODE ----------------------------------
find_package(ODE)
# -------------------------------- Qt --------------------------------
# sets ${QT_LIBRARIES}
SET(QT_MIN_VERSION 4.1.4)
SET(QT_MIN_VERSION 4.5.0)
set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTXML TRUE)
if(FREECAD_BUILD_GUI)
set(QT_USE_QTOPENGL TRUE)
set(QT_USE_QTSVG TRUE)
set(QT_USE_QTUITOOLS TRUE)
set(QT_USE_QTWEBKIT TRUE)
endif(FREECAD_BUILD_GUI)
find_package(Qt4)
if(FREECAD_BUILD_GUI)
set(QT_USE_QTOPENGL TRUE)
set(QT_USE_QTSVG TRUE)
set(QT_USE_QTUITOOLS TRUE)
set(QT_USE_QTWEBKIT TRUE)
endif(FREECAD_BUILD_GUI)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
@@ -279,7 +292,7 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X)
ENDIF(NOT QT4_FOUND)
IF(NOT QT_QTWEBKIT_FOUND)
MESSAGE("QT Webkit not found, will not build browser integration!")
MESSAGE("Qt Webkit not found, will not build browser integration!")
ENDIF(NOT QT_QTWEBKIT_FOUND)
@@ -290,22 +303,24 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X)
# There is probably a cleaner solution than this
macro(fc_wrap_cpp outfiles )
# get include dirs
QT4_GET_MOC_FLAGS(moc_includes)
QT4_GET_MOC_FLAGS(moc_flags)
QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
# fixes bug 0000585: bug with boost 1.48
SET(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
foreach(it ${moc_files})
get_filename_component(it ${it} ABSOLUTE)
QT4_MAKE_OUTPUT_FILE(${it} moc_ cpp outfile)
QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_includes}" "${moc_options}")
QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
set(${outfiles} ${${outfiles}} ${outfile})
add_file_dependencies(${it} ${outfile})
endforeach(it)
endmacro(fc_wrap_cpp)
if(FREECAD_BUILD_GUI)
# -------------------------------- OpenGL --------------------------------
find_package(OpenGL)
find_package(OpenGL)
include(FindPackageMessage)
if(OPENGL_GLU_FOUND)
find_package_message(OPENGL_GLU
@@ -317,16 +332,16 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X)
# -------------------------------- Coin3D --------------------------------
find_package(Coin3D REQUIRED)
find_package(SoQt REQUIRED)
find_package(Coin3D REQUIRED)
find_package(SoQt REQUIRED)
# ------------------------------ Spaceball -------------------------------
if (WIN32)
#future
else(WIN32)
find_package(Spnav)
endif(WIN32)
if (WIN32)
#future
else(WIN32)
find_package(Spnav)
endif(WIN32)
# ------------------------------------------------------------------------
@@ -391,6 +406,10 @@ IF(MINGW)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
LINK_LIBRARIES(-lgdi32)
ENDIF(MINGW)
# 0000661: cmake build on Mac OS: dealing with dylib versus so
IF(APPLE)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
ENDIF(APPLE)
add_subdirectory(src)
add_subdirectory(data)
+31 -1
View File
@@ -795,6 +795,26 @@ AC_ARG_ENABLE([sandbox],
AM_CONDITIONAL(BUILD_SANDBOX, test x"$fc_set_sandbox" = xtrue)
AC_ARG_ENABLE([assembly],
AC_HELP_STRING([--enable-assembly], [Enable the build of the Assembly module (disabled by default)]),
[case $enableval in
no | false) fc_set_assembly=false ;;
*) fc_set_assembly=true ;;
esac],
[fc_set_assembly=false])
AM_CONDITIONAL(BUILD_ASSEMBLY, test x"$fc_set_assembly" = xtrue)
AC_ARG_ENABLE([cam],
AC_HELP_STRING([--enable-cam], [Enable the build of the Cam module (disabled by default)]),
[case $enableval in
no | false) fc_set_cam=false ;;
*) fc_set_cam=true ;;
esac],
[fc_set_cam=false])
AM_CONDITIONAL(BUILD_CAM, test x"$fc_set_cam" = xtrue)
dnl Check if you want debug information enabled, or not
dnl **************************************************************************
@@ -952,6 +972,13 @@ src/Main/Makefile
src/Doc/Makefile
src/Doc/BuildDevDoc.cfg
src/Mod/Makefile
src/Mod/Assembly/App/Makefile
src/Mod/Assembly/Gui/Resources/Makefile
src/Mod/Assembly/Gui/Makefile
src/Mod/Assembly/Makefile
src/Mod/Cam/App/Makefile
src/Mod/Cam/Gui/Makefile
src/Mod/Cam/Makefile
src/Mod/Part/Makefile
src/Mod/Part/App/Makefile
src/Mod/Part/Gui/Makefile
@@ -1055,7 +1082,10 @@ AC_MSG_NOTICE([
RTTI enabled (forced): true
Compiler warnings enabled: $fc_set_warn
installation prefix: $prefix
eneble-assembly: $fc_set_assembly
eneble-cam: $fc_set_cam
enable-sandbox: $fc_set_sandbox
eneble-template: $fc_set_template
Now, run 'make' to build FreeCAD.
**************************************************************************
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -20,7 +20,7 @@ elseif(FREECAD_BUILD_GUI AND FREECAD_LIBPACK_CHECKFILE7X)
#endif(MINGW)
# applies for Unix, MinGW and Windows with custom LibPack
elseif(FREECAD_BUILD_GUI)
if (NOT FREECAD_BUILD_DEBIAN)
if (NOT FREECAD_USE_EXTERNAL_PIVY)
find_path(COIN_VERSION3 Inventor/scxml/ScXML.h ${COIN3D_INCLUDE_DIR})
if (COIN_VERSION3)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Pivy-0.5)
@@ -31,7 +31,7 @@ elseif(FREECAD_BUILD_GUI)
add_subdirectory(Pivy)
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Pivy)
endif(COIN_VERSION3)
endif (NOT FREECAD_BUILD_DEBIAN)
endif (NOT FREECAD_USE_EXTERNAL_PIVY)
endif(FREECAD_BUILD_GUI AND FREECAD_LIBPACK_CHECKFILE6X)
# For Windows we have all stuff in the LibPack
+1 -1
View File
@@ -88,7 +88,7 @@ if(MSVC)
debug ${PYTHON_DEBUG_LIBRARY}
optimized ${PYTHON_LIBRARY})
else(MSVC)
set(CoinPy_LIBS
set(SoQtPy_LIBS
${SOQT_LIBRARIES}
${COIN3D_LIBRARY}
${PYTHON_LIBRARY})
+71 -6
View File
@@ -1220,6 +1220,32 @@ void Application::processCmdLineFiles(void)
Console().Error("Unknown exception while processing file: %s \n", File.filePath().c_str());
}
}
const std::map<std::string,std::string>& cfg = Application::Config();
std::map<std::string,std::string>::const_iterator it = cfg.find("SaveFile");
if (it != cfg.end()) {
std::string output = it->second;
Base::FileInfo fi(output);
std::string ext = fi.extension();
try {
std::vector<std::string> mods = App::GetApplication().getExportModules(ext.c_str());
if (!mods.empty()) {
Base::Interpreter().loadModule(mods.front().c_str());
Base::Interpreter().runStringArg("import %s",mods.front().c_str());
Base::Interpreter().runStringArg("%s.export(App.ActiveDocument.Objects, '%s')"
,mods.front().c_str(),output.c_str());
}
else {
Console().Warning("File format not supported: %s \n", output.c_str());
}
}
catch (const Base::Exception& e) {
Console().Error("Exception while saving to file: %s [%s]\n", output.c_str(), e.what());
}
catch (...) {
Console().Error("Unknown exception while saving to file: %s \n", output.c_str());
}
}
}
void Application::runApplication()
@@ -1419,9 +1445,14 @@ void Application::ParseOptions(int ac, char ** av)
// in config file, but will not be shown to the user.
boost::program_options::options_description hidden("Hidden options");
hidden.add_options()
("input-file", boost::program_options::value< vector<string> >(), "input file")
("input-file", boost::program_options::value< vector<string> >(), "input file")
("output", boost::program_options::value<string>(),"output file")
("hidden", "don't show the main window")
// this are to ignore for the window system (QApplication)
("style", boost::program_options::value< string >(), "set the application GUI style")
("stylesheet", boost::program_options::value< string >(), "set the application stylesheet")
("session", boost::program_options::value< string >(), "restore the application from an earlier session")
("reverse", "set the application's layout direction from right to left")
("display", boost::program_options::value< string >(), "set the X-Server")
("geometry ", boost::program_options::value< string >(), "set the X-Window geometry")
("font", boost::program_options::value< string >(), "set the X-Window font")
@@ -1444,11 +1475,35 @@ void Application::ParseOptions(int ac, char ** av)
//x11.add_options()
// ("display", boost::program_options::value< string >(), "set the X-Server")
// ;
//0000723: improper handling of qt specific comand line arguments
std::vector<std::string> args;
bool merge=false;
for (int i=1; i<ac; i++) {
if (merge) {
merge = false;
args.back() += "=";
args.back() += av[i];
}
else {
args.push_back(av[i]);
}
if (strcmp(av[i],"-style") == 0) {
merge = true;
}
else if (strcmp(av[i],"-stylesheet") == 0) {
merge = true;
}
else if (strcmp(av[i],"-session") == 0) {
merge = true;
}
}
options_description cmdline_options;
// 0000659: SIGABRT on startup in boost::program_options (Boost 1.49)
// Add some text to the constructor
options_description cmdline_options("Command-line options");
cmdline_options.add(generic).add(config).add(hidden);
boost::program_options::options_description config_file_options;
boost::program_options::options_description config_file_options("Config");
config_file_options.add(config).add(hidden);
boost::program_options::options_description visible("Allowed options");
@@ -1459,11 +1514,12 @@ void Application::ParseOptions(int ac, char ** av)
variables_map vm;
try {
store( boost::program_options::command_line_parser(ac, av).
store( boost::program_options::command_line_parser(args).
options(cmdline_options).positional(p).extra_parser(customSyntax).run(), vm);
std::ifstream ifs("FreeCAD.cfg");
store(parse_config_file(ifs, config_file_options), vm);
if (ifs)
store(parse_config_file(ifs, config_file_options), vm);
notify(vm);
}
catch (const std::exception& e) {
@@ -1501,7 +1557,7 @@ void Application::ParseOptions(int ac, char ** av)
vector<string> args;
copy(tok.begin(), tok.end(), back_inserter(args));
// Parse the file and store the options
store( boost::program_options::command_line_parser(ac, av).
store( boost::program_options::command_line_parser(args).
options(cmdline_options).positional(p).extra_parser(customSyntax).run(), vm);
}
@@ -1548,6 +1604,15 @@ void Application::ParseOptions(int ac, char ** av)
mConfig["OpenFileCount"] = buffer.str();
}
if (vm.count("output")) {
string file = vm["output"].as<string>();
mConfig["SaveFile"] = file;
}
if (vm.count("hidden")) {
mConfig["StartHidden"] = "1";
}
if (vm.count("write-log")) {
mConfig["LoggingFile"] = "1";
//mConfig["LoggingFileName"] = vm["write-log"].as<string>();
+27 -14
View File
@@ -383,23 +383,36 @@ PyObject* Application::sGetVersion(PyObject * /*self*/, PyObject *args,PyObject
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
PyObject* pList = PyList_New(5);
PyObject *pItem;
pItem = PyString_FromString(Application::Config()["BuildVersionMajor"].c_str());
PyList_SetItem(pList, 0, pItem);
pItem = PyString_FromString(Application::Config()["BuildVersionMinor"].c_str());
PyList_SetItem(pList, 1, pItem);
pItem = PyString_FromString(Application::Config()["BuildRevision"].c_str());
PyList_SetItem(pList, 2, pItem);
pItem = PyString_FromString(Application::Config()["BuildRepositoryURL"].c_str());
PyList_SetItem(pList, 4, pItem);
pItem = PyString_FromString(Application::Config()["BuildCurrentDate"].c_str());
PyList_SetItem(pList, 6, pItem);
Py::List list;
const std::map<std::string, std::string>& cfg = Application::Config();
std::map<std::string, std::string>::const_iterator it;
return pList;
it = cfg.find("BuildVersionMajor");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildVersionMinor");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevision");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRepositoryURL");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevisionDate");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevisionBranch");
if (it != cfg.end())
list.append(Py::String(it->second));
it = cfg.find("BuildRevisionHash");
if (it != cfg.end())
list.append(Py::String(it->second));
return Py::new_reference_to(list);
}
PyObject* Application::sAddImportType(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *psKey,*psMod;
+49 -5
View File
@@ -52,6 +52,7 @@ recompute path. Also enables more complicated dependencies beyond trees.
#include "PreCompiled.h"
#ifndef _PreComp_
# include <algorithm>
# include <sstream>
# include <climits>
#endif
@@ -62,6 +63,7 @@ recompute path. Also enables more complicated dependencies beyond trees.
#include <boost/graph/visitors.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/bind.hpp>
#include <boost/regex.hpp>
#include "Document.h"
@@ -1452,20 +1454,48 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear)
}
}
}
else if (pt->second->getTypeId().isDerivedFrom(PropertyLinkSubList::getClassTypeId())) {
PropertyLinkSubList* link = static_cast<PropertyLinkSubList*>(pt->second);
if (link->getContainer() == pcObject && clear) {
link->setValues(std::vector<DocumentObject*>(), std::vector<std::string>());
}
else {
const std::vector<DocumentObject*>& links = link->getValues();
const std::vector<std::string>& sub = link->getSubValues();
std::vector<DocumentObject*> newLinks;
std::vector<std::string> newSub;
if (std::find(links.begin(), links.end(), pcObject) != links.end()) {
std::vector<DocumentObject*>::const_iterator jt;
std::vector<std::string>::const_iterator kt;
for (jt = links.begin(),kt = sub.begin(); jt != links.end() && kt != sub.end(); ++jt, ++kt) {
if (*jt != pcObject) {
newLinks.push_back(*jt);
newSub.push_back(*kt);
}
}
link->setValues(newLinks, newSub);
}
}
}
}
}
}
DocumentObject* Document::_copyObject(DocumentObject* obj, std::map<DocumentObject*,
DocumentObject*>& copy_map, bool recursive)
DocumentObject*>& copy_map, bool recursive,
bool keepdigitsatend)
{
if (!obj) return 0;
// remove number from end to avoid lengthy names
std::string objname = obj->getNameInDocument();
if (!keepdigitsatend) {
size_t lastpos = objname.length()-1;
while (objname[lastpos] >= 48 && objname[lastpos] <= 57)
lastpos--;
objname = objname.substr(0, lastpos+1);
}
DocumentObject* copy = addObject(obj->getTypeId().getName(),objname.c_str());
if (!copy) return 0;
copy->addDynamicProperties(obj);
@@ -1485,7 +1515,7 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::map<DocumentObje
static_cast<PropertyLink*>(it->second)->setValue(pt->second);
}
else if (recursive) {
DocumentObject* link_copy = _copyObject(link, copy_map, recursive);
DocumentObject* link_copy = _copyObject(link, copy_map, recursive, keepdigitsatend);
copy_map[link] = link_copy;
static_cast<PropertyLink*>(it->second)->setValue(link_copy);
}
@@ -1504,7 +1534,7 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::map<DocumentObje
links_copy.push_back(pt->second);
}
else {
links_copy.push_back(_copyObject(*jt, copy_map, recursive));
links_copy.push_back(_copyObject(*jt, copy_map, recursive, keepdigitsatend));
copy_map[*jt] = links_copy.back();
}
}
@@ -1534,10 +1564,10 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::map<DocumentObje
return copy;
}
DocumentObject* Document::copyObject(DocumentObject* obj, bool recursive)
DocumentObject* Document::copyObject(DocumentObject* obj, bool recursive, bool keepdigitsatend)
{
std::map<DocumentObject*, DocumentObject*> copy_map;
DocumentObject* copy = _copyObject(obj, copy_map, recursive);
DocumentObject* copy = _copyObject(obj, copy_map, recursive, keepdigitsatend);
return copy;
}
@@ -1663,6 +1693,20 @@ std::vector<DocumentObject*> Document::getObjectsOfType(const Base::Type& typeId
return Objects;
}
std::vector<DocumentObject*> Document::findObjects(const Base::Type& typeId, const char* objname) const
{
boost::regex rx(objname);
boost::cmatch what;
std::vector<DocumentObject*> Objects;
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(typeId)) {
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
Objects.push_back(*it);
}
}
return Objects;
}
int Document::countObjectsOfType(const Base::Type& typeId) const
{
int ct=0;
+3 -2
View File
@@ -140,7 +140,7 @@ public:
* are copied as well. By default \a recursive is false.
* Returns the copy of the object or 0 if the creation failed.
*/
DocumentObject* copyObject(DocumentObject* obj, bool recursive=false);
DocumentObject* copyObject(DocumentObject* obj, bool recursive=false, bool keepdigitsatend=false);
/** Move an object from another document to this document
* If \a recursive is true then all objects this object depends on
* are moved as well. By default \a recursive is false.
@@ -161,6 +161,7 @@ public:
/// Returns a list of all Objects
std::vector<DocumentObject*> getObjects() const;
std::vector<DocumentObject*> getObjectsOfType(const Base::Type& typeId) const;
std::vector<DocumentObject*> findObjects(const Base::Type& typeId, const char* objname) const;
/// Returns an array with the correct types already.
template<typename T> inline std::vector<T*> getObjectsOfType() const;
int countObjectsOfType(const Base::Type& typeId) const;
@@ -260,7 +261,7 @@ protected:
void _remObject(DocumentObject* pcObject);
void _addObject(DocumentObject* pcObject, const char* pObjectName);
DocumentObject* _copyObject(DocumentObject* obj, std::map<DocumentObject*,
DocumentObject*>&, bool recursive=false);
DocumentObject*>&, bool recursive=false, bool keepdigitsatend=false);
/// checks if a valid transaction is open
void _checkTransaction(void);
void breakDependency(DocumentObject* pcObject, bool clear);
+3 -3
View File
@@ -37,7 +37,7 @@ PROPERTY_SOURCE(App::DocumentObjectGroup, App::DocumentObject)
DocumentObjectGroup::DocumentObjectGroup()
{
ADD_PROPERTY_TYPE(Group,(0),"Base",(App::PropertyType)(Prop_ReadOnly|Prop_Output),"List of referenced objects");
ADD_PROPERTY_TYPE(Group,(0),"Base",(App::PropertyType)(Prop_Output),"List of referenced objects");
}
DocumentObjectGroup::~DocumentObjectGroup()
@@ -179,13 +179,13 @@ PyObject *DocumentObjectGroup::getPyObject()
return Py::new_reference_to(PythonObject);
}
// Python Sketcher feature ---------------------------------------------------------
// Python feature ---------------------------------------------------------
namespace App {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(App::DocumentObjectGroupPython, App::DocumentObjectGroup)
template<> const char* App::DocumentObjectGroupPython::getViewProviderName(void) const {
return "Gui::ViewProviderDocumentObjectGroup";
return "Gui::ViewProviderDocumentObjectGroupPython";
}
/// @endcond
+33 -39
View File
@@ -163,12 +163,12 @@ PyObject* DocumentPy::removeObject(PyObject *args)
PyObject* DocumentPy::copyObject(PyObject *args)
{
PyObject *obj, *rec=0;
if (!PyArg_ParseTuple(args, "O!|O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec))
PyObject *obj, *rec=0, *keep=0;
if (!PyArg_ParseTuple(args, "O!|O!O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec,&PyBool_Type,&keep))
return NULL; // NULL triggers exception
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj);
DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(), rec==Py_True);
DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(), rec==Py_True, keep==Py_True);
if (copy) {
return copy->getPyObject();
}
@@ -290,42 +290,36 @@ PyObject* DocumentPy::findObjects(PyObject *args)
char *sType="App::DocumentObject", *sName=0;
if (!PyArg_ParseTuple(args, "|ss",&sType, &sName)) // convert args: Python->C
return NULL; // NULL triggers exception
Base::Type type = Base::Type::fromName(sType);
if (type == Base::Type::badType()) {
PyErr_Format(PyExc_Exception, "'%s' is not a valid type", sType);
return NULL;
}
if (!type.isDerivedFrom(App::DocumentObject::getClassTypeId())) {
PyErr_Format(PyExc_Exception, "Type '%s' does not inherit from 'App::DocumentObject'", sType);
return NULL;
}
std::vector<DocumentObject*> res;
std::vector<DocumentObject*> objs = getDocumentPtr()->getObjectsOfType(type);
if (sName) {
try {
boost::regex rx(sName);
boost::cmatch what;
for (std::vector<DocumentObject*>::const_iterator It = objs.begin();It != objs.end();++It) {
if (boost::regex_match((*It)->getNameInDocument(), what, rx))
res.push_back(*It);
}
}
catch (const boost::regex_error& e) {
PyErr_SetString(PyExc_RuntimeError, e.what());
return 0;
}
}
else {
res = objs;
}
Py_ssize_t index=0;
PyObject* list = PyList_New((Py_ssize_t)res.size());
for (std::vector<DocumentObject*>::const_iterator It = res.begin();It != res.end();++It, index++)
Base::Type type = Base::Type::fromName(sType);
if (type == Base::Type::badType()) {
PyErr_Format(PyExc_Exception, "'%s' is not a valid type", sType);
return NULL;
}
if (!type.isDerivedFrom(App::DocumentObject::getClassTypeId())) {
PyErr_Format(PyExc_Exception, "Type '%s' does not inherit from 'App::DocumentObject'", sType);
return NULL;
}
std::vector<DocumentObject*> res;
if (sName) {
try {
res = getDocumentPtr()->findObjects(type, sName);
}
catch (const boost::regex_error& e) {
PyErr_SetString(PyExc_RuntimeError, e.what());
return 0;
}
}
else {
res = getDocumentPtr()->getObjectsOfType(type);
}
Py_ssize_t index=0;
PyObject* list = PyList_New((Py_ssize_t)res.size());
for (std::vector<DocumentObject*>::const_iterator It = res.begin();It != res.end();++It, index++)
PyList_SetItem(list, index, (*It)->getPyObject());
return list;
}
+38 -20
View File
@@ -257,13 +257,18 @@ void PropertyFileIncluded::setPyObject(PyObject *value)
void PropertyFileIncluded::Save (Base::Writer &writer) const
{
if (writer.isForceXML()) {
writer.Stream() << writer.ind() << "<FileIncluded file=\"\">" << endl;
// write the file in the XML stream
if (!_cValue.empty())
if (!_cValue.empty()) {
Base::FileInfo file(_cValue.c_str());
writer.Stream() << writer.ind() << "<FileIncluded data=\"" <<
file.fileName() << "\">" << std::endl;
// write the file in the XML stream
writer.incInd();
writer.insertBinFile(_cValue.c_str());
writer.Stream() << writer.ind() <<"</FileIncluded>" << endl ;
writer.decInd();
writer.Stream() << writer.ind() <<"</FileIncluded>" << endl;
}
else
writer.Stream() << writer.ind() << "<FileIncluded data=\"\"/>" << std::endl;
}
else {
// instead initiate an extra file
@@ -280,23 +285,36 @@ void PropertyFileIncluded::Save (Base::Writer &writer) const
void PropertyFileIncluded::Restore(Base::XMLReader &reader)
{
reader.readElement("FileIncluded");
string file (reader.getAttribute("file") );
if (!file.empty()) {
// initate a file read
reader.addFile(file.c_str(),this);
// is in the document transient path
aboutToSetValue();
_cValue = getDocTransientPath() + "/" + file;
_BaseFileName = file;
hasSetValue();
if (reader.hasAttribute("file")) {
string file (reader.getAttribute("file") );
if (!file.empty()) {
// initate a file read
reader.addFile(file.c_str(),this);
// is in the document transient path
aboutToSetValue();
_cValue = getDocTransientPath() + "/" + file;
_BaseFileName = file;
hasSetValue();
}
}
// section is XML stream
else if (reader.hasAttribute("data")) {
string file (reader.getAttribute("data") );
if (!file.empty()) {
// is in the document transient path
aboutToSetValue();
_cValue = getDocTransientPath() + "/" + file;
reader.readBinFile(_cValue.c_str());
reader.readEndElement("FileIncluded");
_BaseFileName = file;
hasSetValue();
}
}
}
void PropertyFileIncluded::SaveDocFile (Base::Writer &writer) const
{
std::ifstream from(_cValue.c_str());
Base::ifstream from(Base::FileInfo(_cValue.c_str()));
if (!from)
throw Base::Exception("PropertyFileIncluded::SaveDocFile() "
"File in document transient dir deleted");
@@ -311,7 +329,7 @@ void PropertyFileIncluded::SaveDocFile (Base::Writer &writer) const
void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader)
{
std::ofstream to(_cValue.c_str());
Base::ofstream to(Base::FileInfo(_cValue.c_str()));
if (!to)
throw Base::Exception("PropertyFileIncluded::RestoreDocFile() "
"File in document transient dir deleted");
@@ -343,7 +361,7 @@ Property *PropertyFileIncluded::Copy(void) const
bool done = file.renameFile(NewName.filePath().c_str());
assert(done);
// remember the new name for the Undo
Base::Console().Log("Copy this=%p Befor=%s After=%s\n",p,p->_cValue.c_str(),NewName.filePath().c_str());
Base::Console().Log("Copy this=%p Before=%s After=%s\n",p,p->_cValue.c_str(),NewName.filePath().c_str());
p->_cValue = NewName.filePath().c_str();
}
+10 -4
View File
@@ -130,12 +130,18 @@ void PropertyLink::Restore(Base::XMLReader &reader)
assert(getContainer()->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId()) );
if (name != "") {
DocumentObject *pcObject = static_cast<DocumentObject*>(getContainer())->
getDocument()->getObject(name.c_str());
if (!pcObject)
DocumentObject* parent = static_cast<DocumentObject*>(getContainer());
DocumentObject* object = parent->getDocument()->getObject(name.c_str());
if (!object) {
Base::Console().Warning("Lost link to '%s' while loading, maybe "
"an object was not loaded correctly\n",name.c_str());
setValue(pcObject);
}
else if (parent == object) {
Base::Console().Warning("Object '%s' links to itself, nullify it\n",name.c_str());
object = 0;
}
setValue(object);
}
else {
setValue(0);
+2 -4
View File
@@ -394,9 +394,6 @@ protected:
const Constraints* _ConstStruct;
};
class AppExport PropertyFloatList: public PropertyLists
{
TYPESYSTEM_HEADER();
@@ -470,10 +467,11 @@ public:
*/
virtual ~PropertyString();
void setValue(const char* sString);
void setValue(const std::string &sString);
const char* getValue(void) const;
const std::string& getStrValue(void) const
{ return _cValue; }
bool isEmpty(void){return _cValue.empty();}
virtual const char* getEditorName(void) const { return "Gui::PropertyEditor::PropertyStringItem"; }
+23 -8
View File
@@ -68,7 +68,7 @@ if(SWIG_FOUND)
add_definitions(-DHAVE_SWIG=1)
endif(SWIG_FOUND)
if (EXISTS ${CMAKE_SOURCE_DIR}/src/zipios++ AND NOT FREECAD_BUILD_DEBIAN)
if (EXISTS ${CMAKE_SOURCE_DIR}/src/zipios++ AND NOT FREECAD_USE_EXTERNAL_ZIPIOS)
SET(zipios_SRCS
../zipios++/backbuffer.h
../zipios++/basicentry.cpp
@@ -122,12 +122,7 @@ SET(zipios_SRCS
../zipios++/zipoutputstream.h
)
SOURCE_GROUP("zipios" FILES ${zipios_SRCS})
else (EXISTS ${CMAKE_SOURCE_DIR}/src/zipios++ AND NOT FREECAD_BUILD_DEBIAN)
set(FreeCADBase_LIBS
${FreeCADBase_LIBS}
-lzipios
)
endif (EXISTS ${CMAKE_SOURCE_DIR}/src/zipios++ AND NOT FREECAD_BUILD_DEBIAN)
endif ()
SET(pycxx_SRCS
../CXX/Config.hxx
@@ -281,7 +276,6 @@ SET(FreeCADBase_HPP_SRCS
)
SET(FreeCADBase_SRCS
${zipios_SRCS}
${pycxx_SRCS}
${FreeCADBase_CPP_SRCS}
${FreeCADBase_HPP_SRCS}
@@ -293,6 +287,27 @@ SET(FreeCADBase_SRCS
PreCompiled.h
)
# Use external zipios++ if specified.
if(FREECAD_USE_EXTERNAL_ZIPIOS)
find_library(ZIPIOS_LIBRARY zipios)
find_path(ZIPIOS_INCLUDES zipios++/zipios-config.h)
if(ZIPIOS_LIBRARY)
message(STATUS "Found zipios++: ${ZIPIOS}")
endif()
if(ZIPIOS_INCLUDES)
message(STATUS "Found zipios++ headers.")
endif()
if(ZIPIOS_LIBRARY AND ZIPIOS_INCLUDES)
list(APPEND FreeCADBase_LIBS ${ZIPIOS_LIBRARY})
include_directories(${ZIPIOS_INCLUDES})
else()
message(FATAL_ERROR "Using external zipios++ was specified but was not found.")
endif()
else(FREECAD_USE_EXTERNAL_ZIPIOS)
list(APPEND FreeCADBase_SRCS ${zipios_SRCS})
endif(FREECAD_USE_EXTERNAL_ZIPIOS)
if(MSVC)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER("PreCompiled.h" "PreCompiled.cpp" FreeCADBase_CPP_SRCS)
+6 -6
View File
@@ -598,21 +598,21 @@ bool InterpreterSingleton::convertSWIGPointerObj(const char* Module, const char*
int result = 0;
PyGILStateLocker locker;
int version = getSWIGVersionFromModule(Module);
switch (version&0xff)
switch (version)
{
case 25:
case 66329:
result = Swig_1_3_25::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
break;
case 33:
case 66337:
result = Swig_1_3_33::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
break;
case 36:
case 66340:
result = Swig_1_3_36::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
break;
case 38:
case 66342:
result = Swig_1_3_38::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
break;
case 40:
case 66344:
result = Swig_1_3_40::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
break;
default:
+2 -1
View File
@@ -110,9 +110,10 @@ Compute the determinant of the matrix
<Methode Name="isOrthogonal">
<Documentation>
<UserDocu>
isOrthogonal() -> Float
isOrthogonal([Float]) -> Float
Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns
the multiple of the identity matrix. If it's not orthogonal 0 is returned.
As argument you can set a tolerance which by default is 1.0e-6.
</UserDocu>
</Documentation>
</Methode>
+15 -11
View File
@@ -24,6 +24,7 @@
#include "PreCompiled.h"
#include <climits>
#include <cmath>
#include "Base/Matrix.h"
// inclusion of the generated files (generated out of MatrixPy.xml)
@@ -158,8 +159,9 @@ PyObject* MatrixPy::richCompare(PyObject *v, PyObject *w, int op)
}
}
else {
PyErr_SetString(PyExc_TypeError, "Cannot compare Matrix with other type");
return 0;
// This always returns False
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
}
@@ -415,32 +417,34 @@ PyObject* MatrixPy::submatrix(PyObject * args)
PyObject* MatrixPy::isOrthogonal(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
double eps=1.0e-06;
if (!PyArg_ParseTuple(args, "|d",&eps))
return 0;
const Base::Matrix4D& mat = *getMatrixPtr();
Base::Matrix4D trp = mat;
trp.transpose();
trp = trp * mat;
bool ok = true;
double mult = trp[0][0];
for (int i=0; (i<4) && (mult!=0.0); i++) {
for (int j=0; (j<4) && (mult!=0.0); j++) {
for (int i=0; i<4 && ok; i++) {
for (int j=0; j<4 && ok; j++) {
if (i != j) {
if (trp[i][j] != 0.0) {
mult = 0.0;
if (fabs(trp[i][j]) > eps) {
ok = false;
break;
}
}
else { // the diagonal
if (trp[i][j] != mult) {
mult = 0.0;
else { // the main diagonal
if (fabs(trp[i][j]-mult) > eps) {
ok = false;
break;
}
}
}
}
return Py::new_reference_to(Py::Float(mult));
return Py::new_reference_to(Py::Float(ok ? mult : 0.0));
}
PyObject* MatrixPy::transposed(PyObject * args)
+8
View File
@@ -75,6 +75,14 @@ Placement(Base, Axis, Angle) -- define position and rotation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isNull">
<Documentation>
<UserDocu>
isNull() -> Bool
returns True if the placement has no displacement and no rotation
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Base" ReadOnly="false">
<Documentation>
<UserDocu>Vector to the Base Position of the Placement</UserDocu>
+23 -10
View File
@@ -83,9 +83,9 @@ int PlacementPy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyObject* d;
double angle;
if (PyArg_ParseTuple(args, "O!O!d", &(Base::VectorPy::Type), &o,
&(Base::VectorPy::Type), &d, &angle)) {
// NOTE: The first parameter defines the translation, the second the rotation axis
// and the last parameter defines the rotation angle in degree.
&(Base::VectorPy::Type), &d, &angle)) {
// NOTE: The first parameter defines the translation, the second the rotation axis
// and the last parameter defines the rotation angle in degree.
Base::Rotation rot(static_cast<Base::VectorPy*>(d)->value(), angle/180.0*D_PI);
*getPlacementPtr() = Base::Placement(static_cast<Base::VectorPy*>(o)->value(),rot);
return 0;
@@ -145,13 +145,13 @@ PyObject* PlacementPy::multVec(PyObject * args)
getPlacementPtr()->multVec(pnt, pnt);
return new VectorPy(new Vector3d(pnt));
}
PyObject* PlacementPy::copy(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
return new PlacementPy(new Placement(*getPlacementPtr()));
}
PyObject* PlacementPy::copy(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
return new PlacementPy(new Placement(*getPlacementPtr()));
}
PyObject* PlacementPy::toMatrix(PyObject * args)
{
@@ -169,6 +169,19 @@ PyObject* PlacementPy::inverse(PyObject * args)
return new PlacementPy(new Placement(p));
}
PyObject* PlacementPy::isNull(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Base::Vector3d pos = getPlacementPtr()->getPosition();
Base::Rotation rot = getPlacementPtr()->getRotation();
Base::Vector3d nullvec(0,0,0);
Base::Rotation nullrot(0,0,0,1);
Base::Rotation nullrotinv(0,0,0,-1);
bool null = (pos == nullvec) & ((rot == nullrot) | (rot == nullrotinv));
return Py_BuildValue("O", (null ? Py_True : Py_False));
}
Py::Object PlacementPy::getBase(void) const
{
return Py::Vector(getPlacementPtr()->getPosition());
+4 -2
View File
@@ -377,8 +377,10 @@ const char *PP_Init(const char *modname) {
//#ifdef FC_OS_LINUX /* cannot convert `const char *' to `char *' in assignment */
if (modname!=NULL) return modname;
{ /* we assume here that the caller frees allocated memory */
char* __main__=(char *)malloc(sizeof("__main__"));
return __main__="__main__";
// #0000716: strange assignment and a memory leak
return "__main__";
//char* __main__=(char *)malloc(sizeof("__main__"));
//return __main__="__main__";
}
//#else
// return modname == NULL ? "__main__" : modname; /* default to '__main__' */
+39 -4
View File
@@ -34,6 +34,7 @@
/// Here the FreeCAD includes sorted by Base,App,Gui......
#include "Reader.h"
#include "Base64.h"
#include "Exception.h"
#include "Persistence.h"
#include "InputSource.h"
@@ -79,6 +80,7 @@ Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
//parser->setFeature(XMLUni::fgXercesDynamic, true);
parser->setContentHandler(this);
parser->setLexicalHandler(this);
parser->setErrorHandler(this);
try {
@@ -127,7 +129,7 @@ long Base::XMLReader::getAttributeAsInteger(const char* AttrName) const
if (pos != AttrMap.end())
return atol(pos->second.c_str());
else
// wrong name, use hasAttribute if not shure!
// wrong name, use hasAttribute if not sure!
assert(0);
return 0;
@@ -140,7 +142,7 @@ unsigned long Base::XMLReader::getAttributeAsUnsigned(const char* AttrName) cons
if (pos != AttrMap.end())
return strtoul(pos->second.c_str(),0,10);
else
// wrong name, use hasAttribute if not shure!
// wrong name, use hasAttribute if not sure!
assert(0);
return 0;
@@ -153,7 +155,7 @@ double Base::XMLReader::getAttributeAsFloat (const char* AttrName) const
if (pos != AttrMap.end())
return atof(pos->second.c_str());
else
// wrong name, use hasAttribute if not shure!
// wrong name, use hasAttribute if not sure!
assert(0);
return 0.0;
@@ -166,7 +168,7 @@ const char* Base::XMLReader::getAttribute (const char* AttrName) const
if (pos != AttrMap.end())
return pos->second.c_str();
else
// wrong name, use hasAttribute if not shure!
// wrong name, use hasAttribute if not sure!
assert(0);
return "";
@@ -255,6 +257,22 @@ void Base::XMLReader::readCharacters(void)
{
}
void Base::XMLReader::readBinFile(const char* filename)
{
Base::FileInfo fi(filename);
Base::ofstream to(fi, std::ios::out | std::ios::binary);
if (!to)
throw Base::Exception("XMLReader::readBinFile() Could not open file!");
bool ok;
do {
ok = read(); if (!ok) break;
} while (ReadType != EndCDATA);
to << Base::base64_decode(Characters);
to.close();
}
void Base::XMLReader::readFiles(zipios::ZipInputStream &zipstream) const
{
// It's possible that not all objects inside the document could be created, e.g. if a module
@@ -370,15 +388,32 @@ void Base::XMLReader::endElement (const XMLCh* const /*uri*/, const XMLCh *cons
ReadType = EndElement;
}
void Base::XMLReader::startCDATA ()
{
ReadType = StartCDATA;
}
void Base::XMLReader::endCDATA ()
{
ReadType = EndCDATA;
}
#if (XERCES_VERSION_MAJOR == 2)
void Base::XMLReader::characters(const XMLCh* const chars, const unsigned int length)
#else
void Base::XMLReader::characters(const XMLCh* const chars, const XMLSize_t length)
#endif
{
Characters = StrX(chars).c_str();
ReadType = Chars;
CharacterCount += length;
}
#if (XERCES_VERSION_MAJOR == 2)
void Base::XMLReader::ignorableWhitespace( const XMLCh* const /*chars*/, const unsigned int /*length*/)
#else
void Base::XMLReader::ignorableWhitespace( const XMLCh* const /*chars*/, const XMLSize_t /*length*/)
#endif
{
//fSpaceCount += length;
}
+13 -2
View File
@@ -131,6 +131,8 @@ public:
void readEndElement(const char* ElementName=0);
/// read until characters are found
void readCharacters(void);
/// read binary file
void readBinFile(const char*);
//@}
/** @name Attribute handling */
@@ -171,8 +173,15 @@ protected:
// -----------------------------------------------------------------------
virtual void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const XERCES_CPP_NAMESPACE_QUALIFIER Attributes& attrs);
virtual void endElement (const XMLCh* const uri, const XMLCh *const localname, const XMLCh *const qname);
virtual void characters (const XMLCh* const chars, const unsigned int length);
virtual void startCDATA ();
virtual void endCDATA ();
#if (XERCES_VERSION_MAJOR == 2)
virtual void characters (const XMLCh* const chars, const unsigned int length);
virtual void ignorableWhitespace(const XMLCh* const chars, const unsigned int length);
#else
virtual void characters (const XMLCh* const chars, const XMLSize_t length);
virtual void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length);
#endif
virtual void resetDocument();
@@ -198,7 +207,9 @@ protected:
Chars,
StartElement,
StartEndElement,
EndElement
EndElement,
StartCDATA,
EndCDATA
} ReadType;
+8
View File
@@ -48,6 +48,14 @@
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isNull">
<Documentation>
<UserDocu>
isNull() -> Bool
returns True if the rotation equals the unity matrix
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Q" ReadOnly="false">
<Documentation>
<UserDocu>The rotation elements (as quaternion)</UserDocu>
+11
View File
@@ -144,6 +144,17 @@ PyObject* RotationPy::toEuler(PyObject * args)
return Py::new_reference_to(tuple);
}
PyObject* RotationPy::isNull(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Base::Rotation rot = * getRotationPtr();
Base::Rotation nullrot(0,0,0,1);
Base::Rotation nullrotinv(0,0,0,-1);
bool null = (rot == nullrot) | (rot == nullrotinv);
return Py_BuildValue("O", (null ? Py_True : Py_False));
}
Py::Tuple RotationPy::getQ(void) const
{
double q0, q1, q2, q3;
+11
View File
@@ -85,6 +85,7 @@ UnitsSchema *UnitsApi::UserPrefSystem = new UnitsSchemaInternal();
double UnitsApi::UserPrefFactor [50];
QString UnitsApi::UserPrefUnit [50];
int UnitsApi::UserPrefDecimals = 2;
UnitsApi::UnitsApi(const char* filter)
{
@@ -196,6 +197,16 @@ const double UnitsApi::getPrefFactorOf(QuantityType t)
return UserPrefFactor[t];
}
void UnitsApi::setDecimals(int prec)
{
UserPrefDecimals = prec;
}
int UnitsApi::getDecimals()
{
return UserPrefDecimals;
}
void UnitsApi::setDefaults(void)
{
setPrefOf( Length ,"mm" );
+6
View File
@@ -101,6 +101,10 @@ public:
static const QString getQuantityName(QuantityType t);
/// get the translation factor for the default unit of a quantity
static const double getPrefFactorOf(QuantityType t);
// set the number of decimals
static void setDecimals(int);
// fet the number of decimals
static int getDecimals();
/// set the application defaults
static void setDefaults(void);
//@}
@@ -119,6 +123,8 @@ protected:
static double UserPrefFactor [50] ;
/// name of the unit the user wants to use as quantities
static QString UserPrefUnit [50] ;
/// number of decimals for floats
static int UserPrefDecimals;
// do the real work
static double parse(const char*,bool &UsedUnit);
+55 -18
View File
@@ -20,90 +20,127 @@
</Documentation>
<Methode Name="add" Const="true">
<Documentation>
<UserDocu>add(Vector) - return the sum of the two vectors</UserDocu>
<UserDocu>add(Vector)
returns the sum of this and another vector
</UserDocu>
</Documentation>
</Methode>
<Methode Name="sub" Const="true">
<Documentation>
<UserDocu>sub(Vector) - return the difference of the two vectors</UserDocu>
<UserDocu>sub(Vector)
returns the difference of this and another vector
</UserDocu>
</Documentation>
</Methode>
<Methode Name="scale">
<Documentation>
<UserDocu>scale(Float,Float,Float) - scale (multiplies) this vector by a factor</UserDocu>
<UserDocu>scale(Float,Float,Float)
scales (multiplies) this vector by a factor
</UserDocu>
</Documentation>
</Methode>
<Methode Name="multiply">
<Documentation>
<UserDocu>multiply(Float) - multiplies (scales) this vector by a single factor</UserDocu>
<UserDocu>multiply(Float)
multiplies (scales) this vector by a single factor
</UserDocu>
</Documentation>
</Methode>
<Methode Name="dot" Const="true">
<Documentation>
<UserDocu>dot(Vector) - return the dot product of the two vectors</UserDocu>
<UserDocu>dot(Vector)
returns the dot product of the this vector with another one
</UserDocu>
</Documentation>
</Methode>
<Methode Name="cross" Const="true">
<Documentation>
<UserDocu>cross(Vector) - return the cross product of the two vectors</UserDocu>
<UserDocu>cross(Vector)
returns the cross product between this and another vector
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getAngle" Const="true">
<Documentation>
<UserDocu>getAngle(Vector) - return the angle in radians between the two vectors</UserDocu>
<UserDocu>getAngle(Vector)
returns the angle in radians between this and another vector
</UserDocu>
</Documentation>
</Methode>
<Methode Name="normalize">
<Documentation>
<UserDocu>Normalize the vector to the length of 1.0</UserDocu>
<UserDocu>normalize()
normalizes the vector to the length of 1.0
</UserDocu>
</Documentation>
</Methode>
<Methode Name="projectToLine">
<Documentation>
<UserDocu>Deliver the projection point to a given line</UserDocu>
<UserDocu>projectToLine(Vector,Vector)
projects the vector on a line defined by a base point and a direction
</UserDocu>
</Documentation>
</Methode>
<Methode Name="projectToPlane">
<Documentation>
<UserDocu>Deliver the projection point to a given plane</UserDocu>
<UserDocu>projectToPlane(Vector,Vector)
projects the vector on a plane defined by a base point and a normal
</UserDocu>
</Documentation>
</Methode>
<Methode Name="distanceToLine" Const="true">
<Documentation>
<UserDocu>Deliver the distance of the point to a given line</UserDocu>
<UserDocu>distanceToLine(Vector,Vector)
returns the distance between this vector and a line defined by
a base point and a direction
</UserDocu>
</Documentation>
</Methode>
<Methode Name="distanceToLineSegment" Const="true">
<Documentation>
<UserDocu>Deliver the distance of the point to a given line segment</UserDocu>
<UserDocu>distanceToLineSegment(Vector,Vector)
returns the distance between this vector and a line segment defined by
a base point and a direction
</UserDocu>
</Documentation>
</Methode>
<Methode Name="distanceToPlane" Const="true">
<Documentation>
<UserDocu>Deliver the distance of the point to a given plane</UserDocu>
<UserDocu>distanceToPlane(Vector,Vector)
returns the distance between this vector and a plane defined by
a base point and a normal
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Length" ReadOnly="false">
<Documentation>
<UserDocu>To read or modifiy the length of the vector</UserDocu>
<UserDocu>Length([Float]) -> Float
gets or sets the length of this vector
</UserDocu>
</Documentation>
<Parameter Name="Type" Type="Float" />
</Attribute>
<Attribute Name="x" ReadOnly="false">
<Documentation>
<UserDocu>The X component of the vector</UserDocu>
<UserDocu>x([Float]) -> Float
gets or sets the X component of this vector
</UserDocu>
</Documentation>
<Parameter Name="x" Type="Float"/>
</Attribute>
<Attribute Name="y" ReadOnly="false">
<Documentation>
<UserDocu>The Y component of the vector</UserDocu>
<UserDocu>y([Float]) -> Float
gets or sets the Y component of this vector
</UserDocu>
</Documentation>
<Parameter Name="y" Type="Float"/>
</Attribute>
<Attribute Name="z" ReadOnly="false">
<Documentation>
<UserDocu>The Z component of the vector</UserDocu>
<UserDocu>z([Float]) -> Float
gets or sets the Z component of this vector
</UserDocu>
</Documentation>
<Parameter Name="z" Type="Float"/>
</Attribute>
@@ -128,4 +165,4 @@
{ return *(getVectorPtr()); }
</ClassDeclarations>
</PythonExport>
</GenerateModel>
</GenerateModel>
+3 -2
View File
@@ -237,8 +237,9 @@ PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op)
}
}
else {
PyErr_SetString(PyExc_TypeError, "Cannot compare Matrix with other type");
return 0;
// This always returns False
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
}
+19 -19
View File
@@ -32,6 +32,7 @@
#include "Exception.h"
#include "Base64.h"
#include "FileInfo.h"
#include "Stream.h"
#include "Tools.h"
#include <algorithm>
@@ -59,32 +60,31 @@ Writer::~Writer()
void Writer::insertAsciiFile(const char* FileName)
{
std::ifstream from(FileName);
if (!from) throw Base::Exception("Writer::insertAsciiFile() Could not open file!");
Base::FileInfo fi(FileName);
Base::ifstream from(fi);
if (!from)
throw Base::Exception("Writer::insertAsciiFile() Could not open file!");
Stream() << "<![CDATA[" << endl;
Stream() << "<![CDATA[";
char ch;
while (from.get(ch)) Stream().put(ch);
Stream() << endl << "]]>" << endl;
while (from.get(ch))
Stream().put(ch);
Stream() << "]]>" << endl;
}
void Writer::insertBinFile(const char* FileName)
{
std::ifstream from(FileName);
if (!from) throw Base::Exception("Writer::insertAsciiFile() Could not open file!");
Stream() << "<![CDATA[" << endl;
unsigned char buf[60];
std::string encoded;
unsigned int i;
while (from){
for(i=0 ; i<60 && from;i++)
buf[i] = from.get();
Stream() << Base::base64_encode(buf,i) << endl;
}
Base::FileInfo fi(FileName);
Base::ifstream from(fi, std::ios::in | std::ios::binary | std::ios::ate);
if (!from)
throw Base::Exception("Writer::insertAsciiFile() Could not open file!");
Stream() << "<![CDATA[";
std::ifstream::pos_type fileSize = from.tellg();
from.seekg(0, std::ios::beg);
std::vector<unsigned char> bytes(fileSize);
from.read((char*)&bytes[0], fileSize);
Stream() << Base::base64_encode(&bytes[0], fileSize);
Stream() << "]]>" << endl;
}
+4
View File
@@ -12,6 +12,10 @@ if(FREECAD_BUILD_GUI)
configure_file(Doc/freecad.qch ${CMAKE_BINARY_DIR}/doc/freecad.qch COPYONLY)
endif(FREECAD_BUILD_GUI)
if(FREECAD_BUILD_TEMPLATE)
add_subdirectory(Tools/_TEMPLATE_)
endif(FREECAD_BUILD_TEMPLATE)
if(FREECAD_MAINTAINERS_BUILD)
add_subdirectory(Doc)
endif(FREECAD_MAINTAINERS_BUILD)
+13 -10
View File
@@ -1,7 +1,7 @@
The Arch module
===============
The Arch module is a metamodule that imports useful methods from several of the Arch submodules.
The Arch module is a metamodule that imports useful methods from several of the Arch submodules. You can invoke the following methods either from their specific submodule (ArchWall.areSameWallTypes()) or from the Arch module itself (Arch.areSameWallTypes()).
.. toctree::
:maxdepth: 4
@@ -9,29 +9,32 @@ The Arch module is a metamodule that imports useful methods from several of the
.. automodule:: Arch
:members:
.. automodule:: Wall
.. automodule:: ArchWall
:members:
.. automodule:: Cell
.. automodule:: ArchCell
:members:
.. automodule:: Floor
.. automodule:: ArchFloor
:members:
.. automodule:: Site
.. automodule:: ArchSite
:members:
.. automodule:: Structure
.. automodule:: ArchStructure
:members:
.. automodule:: Window
.. automodule:: ArchWindow
:members:
.. automodule:: SectionPlane
.. automodule:: ArchSectionPlane
:members:
.. automodule:: Building
.. automodule:: ArchBuilding
:members:
.. automodule:: Commands
.. automodule:: ArchCommands
:members:
.. automodule:: ArchAxis
:members:
+17 -10
View File
@@ -1,19 +1,26 @@
The Draft module
================
The Draft module offer several convenient functions to work with simple 2D and 3D objects.
These functions can be used in scripts and macros or from the python interpreter, once the Draft module has been imported.
Example::
import FreeCAD
from Draft import *
myrect = makeRectangle(4,3)
mydistance = FreeCAD.Vector(2,2,0)
move(myrect,mydistance)
The Draft module offer several convenient functions to work with simple objects.
.. toctree::
:maxdepth: 4
.. automodule:: Draft
:members:
.. automodule:: DraftSnap
:members:
The Draft module also contains two submodules, widely used throughout the Draft and Arch modules: DraftVecUtils, which contains useful methods for dealing with vectors, and DraftGeomUtils, which offers many tools for working with OpenCascade geometry.
.. automodule:: DraftVecUtils
:members:
.. automodule:: DraftGeomUtils
:members:
The Draft module also features a module that contains trackers, special objects made to display 3D temporary geometry in the 3D scene, that have no real existence in the FreeCAD document.
.. automodule:: DraftTrackers
:members:
+3 -1
View File
@@ -6,7 +6,6 @@ The FreeCAD module
.. automodule:: FreeCAD
:members:
:show-inheritance:
.. autoclass:: Vector
:members:
@@ -16,3 +15,6 @@ The FreeCAD module
.. autoclass:: Placement
:members:
.. autoclass:: Console
:members:
+13
View File
@@ -28,6 +28,7 @@
# include <boost/bind.hpp>
# include <QActionEvent>
# include <QApplication>
# include <QDesktopWidget>
# include <QEvent>
# include <QMessageBox>
# include <QToolBar>
@@ -345,6 +346,18 @@ WorkbenchComboBox::~WorkbenchComboBox()
{
}
void WorkbenchComboBox::showPopup()
{
int rows = count();
if (rows > 0) {
int height = view()->sizeHintForRow(0);
int maxHeight = QApplication::desktop()->height();
view()->setMinimumHeight(qMin(height * rows, maxHeight/2));
}
QComboBox::showPopup();
}
void WorkbenchComboBox::actionEvent ( QActionEvent* e )
{
QAction *action = e->action();
+1
View File
@@ -124,6 +124,7 @@ class GuiExport WorkbenchComboBox : public QComboBox
public:
WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=0);
virtual ~WorkbenchComboBox();
void showPopup();
public Q_SLOTS:
void onActivated(int);
+44 -3
View File
@@ -52,6 +52,7 @@
#include <Base/Factory.h>
#include <Base/FileInfo.h>
#include <Base/Tools.h>
#include <Base/UnitsApi.h>
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
@@ -80,6 +81,7 @@
#include "DlgOnlineHelpImp.h"
#include "SpaceballEvent.h"
#include "SplitView3DInventor.h"
#include "View3DInventor.h"
#include "ViewProvider.h"
#include "ViewProviderExtern.h"
@@ -327,6 +329,10 @@ Application::Application(bool GUIenabled)
Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str());
GetWidgetFactorySupplier();
ParameterGrp::handle hUnits = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Units");
Base::UnitsApi::setDecimals(hUnits->GetInt("Decimals", Base::UnitsApi::getDecimals()));
// setting up Python binding
Base::PyGILStateLocker lock;
PyObject* module = Py_InitModule3("FreeCADGui", Application::Methods,
@@ -340,6 +346,10 @@ Application::Application(bool GUIenabled)
"workbenches.");
Py::Module(module).setAttr(std::string("ActiveDocument"),Py::None());
UiLoaderPy::init_type();
Base::Interpreter().addType(UiLoaderPy::type_object(),
module,"UiLoader");
//insert Selection module
PyObject* pSelectionModule = Py_InitModule3("Selection", SelectionSingleton::Methods,
"Selection module");
@@ -708,6 +718,14 @@ void Application::setActiveDocument(Gui::Document* pcDocument)
{
if (d->activeDocument == pcDocument)
return; // nothing needs to be done
if (pcDocument) {
// This happens if a document with more than one view is about being
// closed and a second view is activated. The document is still not
// removed from the map.
App::Document* doc = pcDocument->getDocument();
if (d->documents.find(doc) == d->documents.end())
return;
}
d->activeDocument = pcDocument;
std::string name;
@@ -851,8 +869,13 @@ void Application::tryClose(QCloseEvent * e)
// ask all documents if closable
std::map<const App::Document*, Gui::Document*>::iterator It;
for (It = d->documents.begin();It!=d->documents.end();It++) {
// a document may have several views attached, so ask it directly
#if 0
MDIView* active = It->second->getActiveView();
e->setAccepted(active->canClose());
#else
e->setAccepted(It->second->canClose());
#endif
if (!e->isAccepted())
return;
}
@@ -938,6 +961,13 @@ bool Application::activateWorkbench(const char* name)
// import the matching module first
Py::Callable activate(handler.getAttr(std::string("Initialize")));
activate.apply(args);
// Dependent on the implementation of a workbench handler the type
// can be defined after the call of Initialize()
if (type.empty()) {
Py::String result(method.apply(args));
type = result.as_std_string();
}
}
// does the Python workbench handler have changed the workbench?
@@ -1391,12 +1421,15 @@ void Application::initTypes(void)
Gui::BaseView ::init();
Gui::MDIView ::init();
Gui::View3DInventor ::init();
Gui::AbstractSplitView ::init();
Gui::SplitView3DInventor ::init();
// View Provider
Gui::ViewProvider ::init();
Gui::ViewProviderExtern ::init();
Gui::ViewProviderDocumentObject ::init();
Gui::ViewProviderFeature ::init();
Gui::ViewProviderDocumentObjectGroup ::init();
Gui::ViewProviderDocumentObjectGroupPython ::init();
Gui::ViewProviderGeometryObject ::init();
Gui::ViewProviderInventorObject ::init();
Gui::ViewProviderVRMLObject ::init();
@@ -1602,9 +1635,15 @@ void Application::runApplication(void)
logo->setFrameShape(QFrame::NoFrame);
}
}
bool hidden = false;
it = cfg.find("StartHidden");
if (it != cfg.end()) {
hidden = true;
}
// show splasher while initializing the GUI
mw.startSplasher();
if (!hidden)
mw.startSplasher();
// running the GUI init script
try {
@@ -1638,8 +1677,10 @@ void Application::runApplication(void)
app.activateWorkbench(start.c_str());
// show the main window
Base::Console().Log("Init: Showing main window\n");
mw.loadWindowSettings();
if (!hidden) {
Base::Console().Log("Init: Showing main window\n");
mw.loadWindowSettings();
}
//initialize spaceball.
mainApp.initSpaceball(&mw);
+2
View File
@@ -231,6 +231,8 @@ public:
PYFUNCDEF_S(sActiveDocument);
PYFUNCDEF_S(sGetDocument);
PYFUNCDEF_S(sDoCommand);
static PyMethodDef Methods[];
private:
+41 -4
View File
@@ -26,6 +26,7 @@
#ifndef _PreComp_
# include <qfileinfo.h>
# include <qdir.h>
# include <QPrinter>
#endif
@@ -36,6 +37,7 @@
#include "MainWindow.h"
#include "EditorView.h"
#include "PythonEditor.h"
#include "View3DInventor.h"
#include "WidgetFactory.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
@@ -126,6 +128,9 @@ PyMethodDef Application::Methods[] = {
{"getDocument", (PyCFunction) Application::sGetDocument, 1,
"getDocument(string) -> object\n\n"
"Get a document by its name"},
{"doCommand", (PyCFunction) Application::sDoCommand, 1,
"doCommand(string) -> None\n\n"
"Prints the given string in the python console and runs it"},
{NULL, NULL} /* Sentinel */
};
@@ -357,10 +362,33 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
if (ext == QLatin1String("iv") || ext == QLatin1String("wrl") ||
ext == QLatin1String("vrml") || ext == QLatin1String("wrz") ||
ext == QLatin1String("svg") || ext == QLatin1String("idtf")) {
QString cmd = QString::fromLatin1(
"Gui.getDocument(\"%1\").ActiveView.dump(\"%2\")"
).arg(QLatin1String(doc->getName())).arg(fi.absoluteFilePath());
Base::Interpreter().runString(cmd.toUtf8());
Gui::Document* gui_doc = Application::Instance->getDocument(doc);
std::list<MDIView*> view3d = gui_doc->getMDIViewsOfType(View3DInventor::getClassTypeId());
if (view3d.empty()) {
PyErr_SetString(PyExc_Exception, "Cannot export to SVG because document doesn't have a 3d view");
return 0;
}
else {
QString cmd = QString::fromLatin1(
"Gui.getDocument(\"%1\").mdiViewsOfType('Gui::View3DInventor')[0].dump(\"%2\")"
).arg(QLatin1String(doc->getName())).arg(fi.absoluteFilePath());
Base::Interpreter().runString(cmd.toUtf8());
}
}
else if (ext == QLatin1String("pdf")) {
Gui::Document* gui_doc = Application::Instance->getDocument(doc);
if (gui_doc) {
Gui::MDIView* view = gui_doc->getActiveView();
if (view) {
View3DInventor* view3d = qobject_cast<View3DInventor*>(view);
if (view3d)
view3d->viewAll();
QPrinter printer(QPrinter::ScreenResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
view->print(&printer);
}
}
}
}
} PY_CATCH;
@@ -748,3 +776,12 @@ PyObject* Application::sRunCommand(PyObject * /*self*/, PyObject *args,PyObject
return 0;
}
}
PyObject* Application::sDoCommand(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::doCommand(Command::Doc,pstr);
return Py_None;
}
+32 -15
View File
@@ -87,10 +87,10 @@ BitmapFactoryInst& BitmapFactoryInst::instance(void)
}
_pcSingleton->addPath(path);
}
_pcSingleton->addPath(QString::fromAscii("%1/icons").arg(QString::fromUtf8(App::GetApplication().GetHomePath())));
_pcSingleton->addPath(QString::fromAscii("%1/icons").arg(QString::fromUtf8(App::GetApplication().Config()["UserAppData"].c_str())));
_pcSingleton->addPath(QLatin1String(":/icons/"));
_pcSingleton->addPath(QLatin1String(":/Icons/"));
_pcSingleton->addPath(QString::fromUtf8(App::GetApplication().GetHomePath()));
_pcSingleton->addPath(QString::fromUtf8(App::GetApplication().Config()["UserAppData"].c_str()));
RegisterIcons();
}
@@ -189,6 +189,27 @@ bool BitmapFactoryInst::findPixmapInCache(const char* name, QPixmap& px) const
return false;
}
bool BitmapFactoryInst::loadPixmap(const QString& filename, QPixmap& icon) const
{
QFileInfo fi(filename);
if (fi.exists()) {
// first check if it's an SVG because Qt's qsvg4 module shouldn't be used therefore
if (fi.suffix().toLower() == QLatin1String("svg")) {
QFile svgFile(filename);
if (svgFile.open(QFile::ReadOnly | QFile::Text)) {
QByteArray content = svgFile.readAll();
icon = pixmapFromSvg(content, QSize(64,64));
}
}
else {
// try with Qt plugins
icon.load(filename);
}
}
return !icon.isNull();
}
QPixmap BitmapFactoryInst::pixmap(const char* name) const
{
if (!name || *name == '\0')
@@ -205,33 +226,29 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const
if (It != d->xpmMap.end())
icon = QPixmap(It.value());
// If an absolute path is given
// Try whether an absolute path is given
QString fn = QString::fromUtf8(name);
if (icon.isNull() && QFile(fn).exists())
icon.load(fn);
// first check if it's an SVG because Qt's qsvg4 module shouldn't be used therefore
if (icon.isNull()) {
icon = pixmapFromSvg(name, QSize(64,64));
}
if (icon.isNull())
loadPixmap(fn, icon);
// try to find it in the given directories
if (icon.isNull()) {
bool found = false;
QList<QByteArray> formats = QImageReader::supportedImageFormats();
formats.prepend("SVG"); // check first for SVG to use special import mechanism
for (QStringList::ConstIterator pt = d->paths.begin(); pt != d->paths.end() && !found; ++pt) {
QDir d(*pt);
QString fileName = d.filePath(fn);
if (QFile(fileName).exists()) {
icon.load(fileName);
if (loadPixmap(fileName, icon)) {
found = true;
break;
} else {
}
else {
// Go through supported file formats
for (QList<QByteArray>::iterator fm = formats.begin(); fm != formats.end(); ++fm) {
QString path = QString::fromAscii("%1.%2").arg(fileName).
arg(QString::fromAscii((*fm).toLower().constData()));
if (QFile(path).exists()) {
icon.load(path);
if (loadPixmap(path, icon)) {
found = true;
break;
}
+1
View File
@@ -124,6 +124,7 @@ public:
void convert(const SoSFImage& img, QImage& out) const;
private:
bool loadPixmap(const QString& path, QPixmap&) const;
void restoreCustomPaths();
static BitmapFactoryInst* _pcSingleton;
+7 -18
View File
@@ -79,10 +79,10 @@ const char* BlenderNavigationStyle::mouseButtons(ViewerMode mode)
SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
{
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
const SoType type(ev->getTypeId());
@@ -291,20 +291,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
// Spaceball & Joystick handling
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
SoMotion3Event * const event = (SoMotion3Event *) ev;
SoCamera * const camera = viewer->getCamera();
SbVec3f dir = event->getTranslation();
if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())){
static float zoomConstant(-.03f);
dir[2] = 0.0;//don't move the cam for z translation.
SoOrthographicCamera *oCam = static_cast<SoOrthographicCamera *>(camera);
oCam->scaleHeight(1.0-event->getTranslation()[2] * zoomConstant);
}
camera->orientation.getValue().multVec(dir,dir);
camera->position = camera->position.getValue() + dir;
camera->orientation = event->getRotation() * camera->orientation.getValue();
const SoMotion3Event * const event = static_cast<const SoMotion3Event * const>(ev);
if (event)
this->processMotionEvent(event);
processed = TRUE;
}
+3 -14
View File
@@ -320,20 +320,9 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
// Spaceball & Joystick handling
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
SoMotion3Event * const event = (SoMotion3Event *) ev;
SoCamera * const camera = viewer->getCamera();
SbVec3f dir = event->getTranslation();
if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())){
static float zoomConstant(-.03f);
dir[2] = 0.0;//don't move the cam for z translation.
SoOrthographicCamera *oCam = static_cast<SoOrthographicCamera *>(camera);
oCam->scaleHeight(1.0-event->getTranslation()[2] * zoomConstant);
}
camera->orientation.getValue().multVec(dir,dir);
camera->position = camera->position.getValue() + dir;
camera->orientation = event->getRotation() * camera->orientation.getValue();
const SoMotion3Event * const event = static_cast<const SoMotion3Event * const>(ev);
if (event)
this->processMotionEvent(event);
processed = TRUE;
}
+5 -2
View File
@@ -125,6 +125,7 @@ set(Gui_MOC_HDRS
HelpView.h
InputVector.h
MainWindow.h
ManualAlignment.h
MDIView.h
NetworkRetriever.h
OnlineDocumentation.h
@@ -627,7 +628,7 @@ SET(Inventor_CPP_SRCS
SoFCInteractiveElement.cpp
SoFCOffscreenRenderer.cpp
SoFCSelection.cpp
SoFCUnifiedSelection.cpp
SoFCUnifiedSelection.cpp
SoFCSelectionAction.cpp
SoFCVectorizeSVGAction.cpp
SoFCVectorizeU3DAction.cpp
@@ -647,7 +648,7 @@ SET(Inventor_SRCS
SoFCInteractiveElement.h
SoFCOffscreenRenderer.h
SoFCSelection.h
SoFCUnifiedSelection.h
SoFCUnifiedSelection.h
SoFCSelectionAction.h
SoFCVectorizeSVGAction.h
SoFCVectorizeU3DAction.h
@@ -743,6 +744,7 @@ SET(FreeCADGui_CPP_SRCS
Thumbnail.cpp
Utilities.cpp
WaitCursor.cpp
ManualAlignment.cpp
)
SET(FreeCADGui_SRCS
Application.h
@@ -763,6 +765,7 @@ SET(FreeCADGui_SRCS
Thumbnail.h
Utilities.h
WaitCursor.h
ManualAlignment.h
)
SET(FreeCADGui_SRCS
+2
View File
@@ -64,6 +64,8 @@ CombiView::CombiView(Gui::Document* pcDocument, QWidget *parent)
// tree widget
tree = new TreeWidget(this);
//tree->setRootIsDecorated(false);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView");
tree->setIndentation(hGrp->GetInt("Indentation", tree->indentation()));
splitter->addWidget(tree);
// property view
+62 -5
View File
@@ -50,11 +50,13 @@
#include "DlgProjectUtility.h"
#include "Transform.h"
#include "Placement.h"
#include "ManualAlignment.h"
#include "WaitCursor.h"
#include "ViewProvider.h"
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include "MergeDocuments.h"
#include "NavigationStyle.h"
using namespace Gui;
@@ -279,7 +281,7 @@ void StdCmdMergeProjects::activated(int iMsg)
{
QString exe = QString::fromUtf8(App::GetApplication().getExecutableName());
QString project = QFileDialog::getOpenFileName(Gui::getMainWindow(),
QString::fromUtf8(QT_TR_NOOP("Merge project")), QString(),
QString::fromUtf8(QT_TR_NOOP("Merge project")), QDir::homePath(),
QString::fromUtf8(QT_TR_NOOP("%1 document (*.fcstd)")).arg(exe));
if (!project.isEmpty()) {
App::Document* doc = App::GetApplication().getActiveDocument();
@@ -292,9 +294,6 @@ void StdCmdMergeProjects::activated(int iMsg)
return;
}
QString dir1 = proj.absoluteDir().filePath(proj.baseName());
QString dir2 = info.absoluteDir().filePath(info.baseName());
Base::FileInfo fi((const char*)project.toUtf8());
Base::ifstream str(fi, std::ios::in | std::ios::binary);
MergeDocuments md(doc);
@@ -1013,6 +1012,63 @@ bool StdCmdPlacement::isActive(void)
return (Gui::Control().activeDialog()==0);
}
//===========================================================================
// Std_Alignment
//===========================================================================
DEF_STD_CMD_A(StdCmdAlignment);
StdCmdAlignment::StdCmdAlignment()
: Command("Std_Alignment")
{
sGroup = QT_TR_NOOP("Edit");
sMenuText = QT_TR_NOOP("Alignment...");
sToolTipText = QT_TR_NOOP("Align the selected objects");
sStatusTip = QT_TR_NOOP("Align the selected objects");
sWhatsThis = "Std_Alignment";
}
void StdCmdAlignment::activated(int iMsg)
{
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType
(App::GeoFeature::getClassTypeId());
ManualAlignment* align = ManualAlignment::instance();
QObject::connect(align, SIGNAL(emitCanceled()), align, SLOT(deleteLater()));
QObject::connect(align, SIGNAL(emitFinished()), align, SLOT(deleteLater()));
// Get the fixed and moving meshes
FixedGroup fixedGroup;
std::map<int, MovableGroup> groupMap;
fixedGroup.addView(sel[0]);
groupMap[0].addView(sel[1]);
// add the fixed group
align->setFixedGroup(fixedGroup);
// create the model of movable groups
MovableGroupModel model;
model.addGroups(groupMap);
align->setModel(model);
Base::Type style = Base::Type::fromName("Gui::CADNavigationStyle");
Gui::Document* doc = Application::Instance->activeDocument();
if (doc) {
View3DInventor* mdi = qobject_cast<View3DInventor*>(doc->getActiveView());
if (mdi) {
style = mdi->getViewer()->navigationStyle()->getTypeId();
}
}
align->setMinPoints(1);
align->startAlignment(style);
Gui::Selection().clearSelection();
}
bool StdCmdAlignment::isActive(void)
{
if (ManualAlignment::hasInstance())
return false;
return Gui::Selection().countObjectsOfType(App::GeoFeature::getClassTypeId()) == 2;
}
//===========================================================================
// Std_Edit
//===========================================================================
@@ -1022,7 +1078,7 @@ StdCmdEdit::StdCmdEdit()
:Command("Std_Edit")
{
sGroup = QT_TR_NOOP("Edit");
sMenuText = QT_TR_NOOP("Toggle &Editmode");
sMenuText = QT_TR_NOOP("Toggle &Edit mode");
sToolTipText = QT_TR_NOOP("Toggles the selected object's edit mode");
sWhatsThis = "Std_Edit";
sStatusTip = QT_TR_NOOP("Enters or leaves the selected object's edit mode");
@@ -1085,6 +1141,7 @@ void CreateDocCommands(void)
rcCmdMgr.addCommand(new StdCmdRefresh());
rcCmdMgr.addCommand(new StdCmdTransform());
rcCmdMgr.addCommand(new StdCmdPlacement());
rcCmdMgr.addCommand(new StdCmdAlignment());
rcCmdMgr.addCommand(new StdCmdEdit());
}
+1 -1
View File
@@ -521,7 +521,7 @@ StdCmdMeasurementSimple::StdCmdMeasurementSimple()
:Command("Std_MeasurementSimple")
{
sGroup = QT_TR_NOOP("Tools");
sMenuText = QT_TR_NOOP("Mesure distance");
sMenuText = QT_TR_NOOP("Measure distance");
sToolTipText = QT_TR_NOOP("Measures distance between two selected objects");
sWhatsThis = QT_TR_NOOP("Measures distance between two selected objects");
sStatusTip = QT_TR_NOOP("Measures distance between two selected objects");
+83 -14
View File
@@ -58,6 +58,8 @@
#include "SceneInspector.h"
#include "DemoMode.h"
#include "TextureMapping.h"
#include "Utilities.h"
#include "NavigationStyle.h"
#include <Base/Console.h>
#include <Base/Exception.h>
@@ -1171,7 +1173,7 @@ StdViewDockUndockFullscreen::StdViewDockUndockFullscreen()
: Command("Std_ViewDockUndockFullscreen")
{
sGroup = QT_TR_NOOP("Standard-View");
sMenuText = QT_TR_NOOP("Display mode");
sMenuText = QT_TR_NOOP("Document window");
sToolTipText= QT_TR_NOOP("Display the active view either in fullscreen, in undocked or docked mode");
sWhatsThis = "Std_ViewDockUndockFullscreen";
sStatusTip = QT_TR_NOOP("Display the active view either in fullscreen, in undocked or docked mode");
@@ -1816,13 +1818,7 @@ void StdViewZoomIn::activated(int iMsg)
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if ( view ) {
View3DInventorViewer* viewer = view->getViewer();
// send an event to the GL widget to use the internal View3DInventorViewer::zoom() method
// do only one step to zoom in
SoMouseButtonEvent e;
e.setButton(SoMouseButtonEvent::BUTTON5);
e.setState(SoMouseButtonEvent::DOWN);
viewer->sendSoEvent(&e);
viewer->navigationStyle()->zoomIn();
}
}
@@ -1856,12 +1852,7 @@ void StdViewZoomOut::activated(int iMsg)
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if (view) {
View3DInventorViewer* viewer = view->getViewer();
// send an event to the GL widget to use the internal View3DInventorViewer::zoom() method
// do only one step to zoom out
SoMouseButtonEvent e;
e.setButton(SoMouseButtonEvent::BUTTON4);
e.setState(SoMouseButtonEvent::DOWN);
viewer->sendSoEvent(&e);
viewer->navigationStyle()->zoomOut();
}
}
@@ -1900,6 +1891,83 @@ void StdViewBoxZoom::activated(int iMsg)
}
}
//===========================================================================
// Std_BoxSelection
//===========================================================================
DEF_3DV_CMD(StdBoxSelection);
StdBoxSelection::StdBoxSelection()
: Command("Std_BoxSelection")
{
sGroup = QT_TR_NOOP("Standard-View");
sMenuText = QT_TR_NOOP("Box selection");
sToolTipText = QT_TR_NOOP("Box selection");
sWhatsThis = "Std_ViewBoxZoom";
sStatusTip = QT_TR_NOOP("Box selection");
#if QT_VERSION >= 0x040200
sPixmap = "edit-select-box";
#endif
sAccel = "Shift+B";
eType = AlterSelection;
}
static void selectionCallback(void * ud, SoEventCallback * cb)
{
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(cb->getUserData());
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, ud);
std::vector<SbVec2f> picked = view->getGLPolygon();
SoCamera* cam = view->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
Base::Polygon2D polygon;
if (picked.size() == 2) {
SbVec2f pt1 = picked[0];
SbVec2f pt2 = picked[1];
polygon.Add(Base::Vector2D(pt1[0], pt1[1]));
polygon.Add(Base::Vector2D(pt1[0], pt2[1]));
polygon.Add(Base::Vector2D(pt2[0], pt2[1]));
polygon.Add(Base::Vector2D(pt2[0], pt1[1]));
}
else {
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
polygon.Add(Base::Vector2D((*it)[0],(*it)[1]));
}
App::Document* doc = App::GetApplication().getActiveDocument();
if (doc) {
cb->setHandled();
std::vector<App::GeoFeature*> geom = doc->getObjectsOfType<App::GeoFeature>();
for (std::vector<App::GeoFeature*>::iterator it = geom.begin(); it != geom.end(); ++it) {
std::vector<App::Property*> props;
(*it)->getPropertyList(props);
for (std::vector<App::Property*>::iterator jt = props.begin(); jt != props.end(); ++jt) {
if ((*jt)->isDerivedFrom(App::PropertyGeometry::getClassTypeId())) {
App::PropertyGeometry* prop = static_cast<App::PropertyGeometry*>(*jt);
Base::BoundBox3d bbox = prop->getBoundingBox();
Base::Vector3d pt2d;
pt2d = proj(bbox.CalcCenter());
if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y))) {
Gui::Selection().addSelection(doc->getName(), (*it)->getNameInDocument());
}
break;
}
}
}
}
}
void StdBoxSelection::activated(int iMsg)
{
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if ( view ) {
View3DInventorViewer* viewer = view->getViewer();
if (!viewer->isSelecting()) {
viewer->startSelection(View3DInventorViewer::Rectangle);
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback);
}
}
}
//===========================================================================
// Std_TreeSelection
//===========================================================================
@@ -2113,6 +2181,7 @@ void CreateViewStdCommands(void)
rcCmdMgr.addCommand(new StdViewZoomIn());
rcCmdMgr.addCommand(new StdViewZoomOut());
rcCmdMgr.addCommand(new StdViewBoxZoom());
rcCmdMgr.addCommand(new StdBoxSelection());
rcCmdMgr.addCommand(new StdCmdTreeSelection());
rcCmdMgr.addCommand(new StdCmdMeasureDistance());
rcCmdMgr.addCommand(new StdCmdSceneInspector());
+1 -1
View File
@@ -34,7 +34,7 @@
<item>
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Display mode:</string>
<string>Document window:</string>
</property>
</widget>
</item>
+4
View File
@@ -115,6 +115,10 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
unsigned long lPyError = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
d->colormap.push_back(QPair<QString, unsigned long>
(QString::fromAscii(QT_TR_NOOP("Python error")), lPyError));
col.setRgb(224, 224, 224);
unsigned long lCLine = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
d->colormap.push_back(QPair<QString, unsigned long>
(QString::fromAscii(QT_TR_NOOP("Current line highlight")), lCLine));
QStringList labels; labels << tr("Items");
this->displayItems->setHeaderLabels(labels);
+15 -5
View File
@@ -175,12 +175,22 @@ void DlgGeneralImp::loadSettings()
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
QString lang = QLocale::languageToString(QLocale::system().language());
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str();
Languages->addItem(Gui::Translator::tr("English"), QByteArray("English"));
int index = 1;
TStringList list = Translator::instance()->supportedLanguages();
for (TStringList::iterator it = list.begin(); it != list.end(); ++it, index++) {
QByteArray lang = it->c_str();
Languages->addItem(Gui::Translator::tr(lang.constData()), lang);
Languages->addItem(QString::fromAscii("English"), QByteArray("English"));
TStringMap list = Translator::instance()->supportedLocales();
for (TStringMap::iterator it = list.begin(); it != list.end(); ++it, index++) {
QLocale locale(QString::fromAscii(it->second.c_str()));
QByteArray lang = it->first.c_str();
QString langname = QString::fromAscii(lang.constData());
#if QT_VERSION >= 0x040800
QString native = locale.nativeLanguageName();
if (!native.isEmpty()) {
if (native[0].isLetter())
native[0] = native[0].toUpper();
langname = native;
}
#endif
Languages->addItem(langname, lang);
if (language == lang) {
Languages->setCurrentIndex(index);
}
+2 -2
View File
@@ -406,7 +406,7 @@
<item row="2" column="1">
<widget class="Gui::PrefColorButton" name="ConstructionColor">
<property name="toolTip">
<string>The color of construction geometry in editmode</string>
<string>The color of construction geometry in edit mode</string>
</property>
<property name="color">
<color>
@@ -426,7 +426,7 @@
<item row="3" column="1">
<widget class="Gui::PrefColorButton" name="FullyConstrainedColor">
<property name="toolTip">
<string>The color of fully constrained geometry in editmode</string>
<string>The color of fully constrained geometry in edit mode</string>
</property>
<property name="color">
<color>
+34 -15
View File
@@ -55,7 +55,6 @@
#include "BitmapFactory.h"
#include "ViewProviderDocumentObject.h"
#include "Selection.h"
#include "SoFCSelection.h"
#include "WaitCursor.h"
#include "Thumbnail.h"
@@ -406,17 +405,18 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj)
// cycling to all views of the document
ViewProvider* viewProvider = getViewProvider(&Obj);
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
if (activeView && viewProvider) {
if (d->_pcInEdit == viewProvider)
resetEdit();
activeView->getViewer()->removeViewProvider(viewProvider);
if (viewProvider && viewProvider->getTypeId().isDerivedFrom
(ViewProviderDocumentObject::getClassTypeId())) {
// go through the views
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
if (activeView) {
if (d->_pcInEdit == viewProvider)
resetEdit();
activeView->getViewer()->removeViewProvider(viewProvider);
}
}
}
if (viewProvider && viewProvider->getTypeId().isDerivedFrom(
ViewProviderDocumentObject::getClassTypeId())) {
// removing from tree
signalDeletedObject(*(static_cast<ViewProviderDocumentObject*>(viewProvider)));
@@ -642,8 +642,13 @@ void Document::RestoreDocFile(Base::Reader &reader)
std::string sMsg = "SetCamera ";
sMsg += ppReturn;
if (strcmp(ppReturn, "") != 0) { // non-empty attribute
if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera"))
d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str());
try {
if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera"))
d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str());
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
}
}
}
@@ -743,7 +748,7 @@ void Document::exportObjects(const std::vector<App::DocumentObject*>& obj, Base:
<< views.size() <<"\">" << std::endl;
bool xml = writer.isForceXML();
writer.setForceXML(true);
//writer.setForceXML(true);
writer.incInd(); // indention for 'ViewProvider name'
std::map<const App::DocumentObject*,ViewProvider*>::const_iterator jt;
for (jt = views.begin(); jt != views.end(); ++jt) {
@@ -826,6 +831,7 @@ void Document::createView(const char* sType)
.arg(QString::fromUtf8(name)).arg(d->_iWinCount++);
view3D->setWindowTitle(title);
view3D->setWindowModified(this->isModified());
view3D->setWindowIcon(QApplication::windowIcon());
view3D->resize(400, 300);
getMainWindow()->addWindow(view3D);
@@ -967,6 +973,19 @@ std::list<MDIView*> Document::getMDIViews() const
return views;
}
std::list<MDIView*> Document::getMDIViewsOfType(const Base::Type& typeId) const
{
std::list<MDIView*> views;
for (std::list<BaseView*>::const_iterator it = d->baseViews.begin();
it != d->baseViews.end(); ++it) {
MDIView* view = dynamic_cast<MDIView*>(*it);
if (view && view->isDerivedFrom(typeId))
views.push_back(view);
}
return views;
}
/// send messages to the active view
bool Document::sendMsgToViews(const char* pMsg)
{
@@ -1006,9 +1025,9 @@ MDIView* Document::getActiveView(void) const
}
}
// the active view is not part of this document, just use the first view
// the active view is not part of this document, just use the last view
if (!ok && !mdis.empty())
active = mdis.front();
active = mdis.back();
return active;
}
+2
View File
@@ -140,6 +140,8 @@ public:
void onRelabel(void);
/// returns a list of all attached MDI views
std::list<MDIView*> getMDIViews() const;
/// returns a list of all MDI views of a certain type
std::list<MDIView*> getMDIViewsOfType(const Base::Type& typeId) const;
//@}
/** @name View provider handling */
+15
View File
@@ -68,6 +68,21 @@
<UserDocu>deprecated -- use ActiveView</UserDocu>
</Documentation>
</Methode>
<Methode Name="mdiViewsOfType" Const="true">
<Documentation>
<UserDocu>Return a list if mdi views of a given type</UserDocu>
</Documentation>
</Methode>
<Methode Name="sendMsgToViews">
<Documentation>
<UserDocu>Send a message to all views of the document</UserDocu>
</Documentation>
</Methode>
<Methode Name="mergeProject">
<Documentation>
<UserDocu>Merges this document with another project file</UserDocu>
</Documentation>
</Methode>
<Attribute Name="ActiveObject" ReadOnly="false">
<Documentation>
<UserDocu>The active object of the document</UserDocu>
+50
View File
@@ -32,6 +32,7 @@
#include <App/Document.h>
#include "Document.h"
#include "MergeDocuments.h"
#include "ViewProviderExtern.h"
// inclusion of the generated files (generated out of DocumentPy.xml)
@@ -201,6 +202,55 @@ PyObject* DocumentPy::activeView(PyObject *args)
} PY_CATCH;
}
PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
{
char* sType;
if (!PyArg_ParseTuple(args, "s", &sType)) // convert args: Python->C
return NULL; // NULL triggers exception
Base::Type type = Base::Type::fromName(sType);
if (type == Base::Type::badType()) {
PyErr_Format(PyExc_Exception, "'%s' is not a valid type", sType);
return NULL;
}
PY_TRY {
std::list<Gui::MDIView*> views = getDocumentPtr()->getMDIViewsOfType(type);
Py::List list;
for (std::list<Gui::MDIView*>::iterator it = views.begin(); it != views.end(); ++it)
list.append(Py::asObject((*it)->getPyObject()));
return Py::new_reference_to(list);
} PY_CATCH;
}
PyObject* DocumentPy::sendMsgToViews(PyObject *args)
{
char* msg;
if (!PyArg_ParseTuple(args, "s", &msg)) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
getDocumentPtr()->sendMsgToViews(msg);
Py_Return;
} PY_CATCH;
}
PyObject* DocumentPy::mergeProject(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename)) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
Base::FileInfo fi(filename);
Base::ifstream str(fi, std::ios::in | std::ios::binary);
App::Document* doc = getDocumentPtr()->getDocument();
MergeDocuments md(doc);
md.importObjects(str);
Py_Return;
} PY_CATCH;
}
Py::Object DocumentPy::getActiveObject(void) const
{
App::DocumentObject *object = getDocumentPtr()->getDocument()->getActiveObject();
+1 -1
View File
@@ -74,6 +74,7 @@ public:
void print ();
void printPdf();
void printPreview();
void print(QPrinter*);
//@}
QStringList undoActions() const;
@@ -88,7 +89,6 @@ private Q_SLOTS:
void contentsChange(int position, int charsRemoved, int charsAdded);
void undoAvailable(bool);
void redoAvailable(bool);
void print(QPrinter*);
private:
void setCurrentFileName(const QString &fileName);
+1
View File
@@ -169,6 +169,7 @@ FreeCAD.addExportType("Inventor V2.1 (*.iv)","FreeCADGui")
FreeCAD.addExportType("VRML V2.0 (*.wrl *.vrml *.wrz *.wrl.gz)","FreeCADGui")
#FreeCAD.addExportType("IDTF (for 3D PDF) (*.idtf)","FreeCADGui")
FreeCAD.addExportType("3D View (*.svg)","FreeCADGui")
FreeCAD.addExportType("Portable Document Format (*.pdf)","FreeCADGui")
del(InitApplications)
del(NoneWorkbench)
+1
View File
@@ -58,6 +58,7 @@ EXTRA_DIST = \
edit-delete.svg \
edit-paste.svg \
edit-select-all.svg \
edit-select-box.svg \
edit-redo.svg \
edit-undo.svg \
preferences-system.svg \
+207 -290
View File
@@ -1,347 +1,264 @@
<?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://web.resource.org/cc/"
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"
width="64px"
height="64px"
id="svg2980"
sodipodi:version="0.32"
inkscape:version="0.43+devel"
sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
sodipodi:docname="edit-select-all.svg">
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="edit-select-all.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs4200">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5031"
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" />
id="defs2982">
<linearGradient
inkscape:collect="always"
id="linearGradient5060">
id="linearGradient4590">
<stop
style="stop-color:black;stop-opacity:1;"
style="stop-color:#0073ff;stop-opacity:1;"
offset="0"
id="stop5062" />
id="stop4592" />
<stop
style="stop-color:black;stop-opacity:0;"
style="stop-color:#5cd4f5;stop-opacity:1;"
offset="1"
id="stop5064" />
id="stop4594" />
</linearGradient>
<linearGradient
id="linearGradient3811">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3813" />
<stop
style="stop-color:#bfbfbf;stop-opacity:1;"
offset="1"
id="stop3815" />
</linearGradient>
<linearGradient
id="linearGradient3864">
<stop
id="stop3866"
offset="0"
style="stop-color:#71b2f8;stop-opacity:1;" />
<stop
id="stop3868"
offset="1"
style="stop-color:#002795;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5029"
xlink:href="#linearGradient3864"
id="radialGradient3850"
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" />
<linearGradient
id="linearGradient5048">
<stop
style="stop-color:black;stop-opacity:0;"
offset="0"
id="stop5050" />
<stop
id="stop5056"
offset="0.5"
style="stop-color:black;stop-opacity:1;" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5052" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5048"
id="linearGradient5027"
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" />
<linearGradient
inkscape:collect="always"
id="linearGradient3558">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3560" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3562" />
</linearGradient>
gradientTransform="matrix(0.6028459,1.0471639,-1.9794021,1.1395295,127.9588,-74.456907)"
cx="51.328892"
cy="31.074146"
fx="51.328892"
fy="31.074146"
r="19.571428" />
<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="perspective2988" />
<inkscape:perspective
id="perspective2872"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3558"
id="radialGradient3564"
cx="22.571428"
cy="30.857143"
fx="22.571428"
fy="30.857143"
r="15.571428"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.651376,4.638648e-15,10.75754)"
gradientUnits="userSpaceOnUse" />
xlink:href="#linearGradient3864"
id="radialGradient2890"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.58019421,1.0078171,-1.9050269,1.0967121,-8.5316607,-197.0902)"
cx="51.328892"
cy="31.074146"
fx="51.328892"
fy="31.074146"
r="19.571428" />
<inkscape:perspective
id="perspective2902"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2902-9"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient15218">
inkscape:collect="always"
xlink:href="#linearGradient3811"
id="linearGradient3817"
x1="36.870125"
y1="30.196993"
x2="3.3695574"
y2="39.373768"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.27764843,-1.1190823,1.1190823,0.27764843,-10.424279,50.285999)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3811-9"
id="linearGradient3817-3"
x1="6.0684204"
y1="37.207146"
x2="39.480068"
y2="37.207146"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.27764843,-1.1190823,1.1190823,0.27764843,-9.674279,55.785999)" />
<linearGradient
id="linearGradient3811-9">
<stop
style="stop-color:#f8f8f7;stop-opacity:1;"
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop15220" />
id="stop3813-8" />
<stop
id="stop2269"
offset="0.59928656"
style="stop-color:#e8e8e8;stop-opacity:1;" />
<stop
style="stop-color:#e2e2de;stop-opacity:1;"
style="stop-color:#bfbfbf;stop-opacity:1;"
offset="1"
id="stop15222" />
id="stop3815-7" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient15218"
id="linearGradient2240"
xlink:href="#linearGradient4590"
id="linearGradient4596"
x1="34.54903"
y1="1.8738226"
x2="28.02536"
y2="43.593124"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.342704,0,0,1.235378,-8.219611,-7.549457)"
x1="20.794008"
y1="18.378813"
x2="35.596001"
y2="39.60046" />
gradientTransform="translate(0,8)" />
<linearGradient
id="linearGradient4590-3">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4592-5" />
<stop
style="stop-color:#5cd4f5;stop-opacity:1;"
offset="1"
id="stop4594-6" />
</linearGradient>
<linearGradient
y2="43.593124"
x2="28.02536"
y1="1.8738226"
x1="34.54903"
gradientTransform="translate(-1.4917871,-0.74277437)"
gradientUnits="userSpaceOnUse"
id="linearGradient4621"
xlink:href="#linearGradient4590-3"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4590-8"
id="linearGradient4596-5"
x1="34.54903"
y1="1.8738226"
x2="28.02536"
y2="43.593124"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,8)" />
<linearGradient
id="linearGradient4590-8">
<stop
style="stop-color:#0073ff;stop-opacity:1;"
offset="0"
id="stop4592-3" />
<stop
style="stop-color:#5cd4f5;stop-opacity:1;"
offset="1"
id="stop4594-1" />
</linearGradient>
<linearGradient
y2="43.593124"
x2="28.02536"
y1="1.8738226"
x1="34.54903"
gradientTransform="translate(-0.9673922,-0.2183795)"
gradientUnits="userSpaceOnUse"
id="linearGradient3795"
xlink:href="#linearGradient4590-8"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#bebebe"
borderopacity="1.0000000"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="90.3276"
inkscape:cy="8.4634153"
inkscape:zoom="2"
inkscape:cx="17.364725"
inkscape:cy="3.8561862"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="949"
inkscape:window-x="26"
inkscape:window-y="69"
inkscape:showpageshadow="false"
fill="#729fcf" />
inkscape:window-height="758"
inkscape:window-x="0"
inkscape:window-y="19"
inkscape:window-maximized="0" />
<metadata
id="metadata4203">
id="metadata2985">
<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>Select All</dc:title>
<dc:date />
<dc:creator>
<cc:Agent>
<dc:title>Andreas Nilsson</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>select</rdf:li>
<rdf:li>all</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:title />
</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
style="display:inline"
id="g5022"
transform="matrix(2.382811e-2,0,0,1.448788e-2,44.94353,43.77878)">
<rect
y="-150.69685"
x="-1559.2523"
height="478.35718"
width="1339.6335"
id="rect4173"
style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;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" />
<path
sodipodi:nodetypes="cccc"
id="path5058"
d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;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" />
<path
style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;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 -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
id="path5018"
sodipodi:nodetypes="cccc" />
</g>
<rect
style="opacity:1;fill:url(#linearGradient2240);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4238"
width="38.996792"
height="45.003101"
x="4.5016017"
y="0.52462721"
rx="0.56650788"
ry="0.56650823" />
<rect
style="opacity:1;color:black;fill:#999;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;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"
id="rect4248"
width="14"
height="2"
x="22"
y="9.0277271" />
<rect
y="15.027727"
x="22"
height="2"
width="12"
id="rect4250"
style="opacity:1;color:black;fill:#999;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;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" />
<rect
style="opacity:1;color:black;fill:#999;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;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"
id="rect4252"
width="22.971531"
height="2"
x="9"
y="21.027727" />
<rect
y="27.027727"
x="9"
height="2"
width="27"
id="rect4254"
style="opacity:1;color:black;fill:#999;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;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" />
<rect
style="opacity:1;color:black;fill:#999;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;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"
id="rect4256"
width="17"
height="2"
x="9"
y="33.027748" />
<rect
style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2245"
width="37.000019"
height="43.022316"
x="5.4997153"
y="1.5274456"
rx="0"
ry="0" />
<rect
style="opacity:1;fill:#999;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4837"
width="11"
height="10"
x="9"
y="9.0277271" />
<rect
style="opacity:0.5;color:black;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect1323"
width="29"
height="6"
x="8"
y="13.027727" />
<rect
style="opacity:0.5;color:black;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2198"
width="31"
height="6"
x="8"
y="7.0277271" />
<rect
style="opacity:0.5;color:black;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2200"
width="25"
height="6"
x="8"
y="19.027727" />
<rect
style="opacity:0.5;color:black;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2202"
width="29"
height="6"
x="8"
y="25.027727" />
<rect
style="opacity:0.5;color:black;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2204"
width="19"
height="6"
x="8"
y="31.027727" />
<rect
style="opacity:1;color:black;fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2206"
width="1"
height="7"
x="28"
y="31.027727" />
<rect
style="opacity:1;color:black;fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2208"
width="1"
height="1"
x="27"
y="30.027727" />
<rect
style="opacity:1;color:black;fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2210"
width="1"
height="1"
x="29"
y="30.027727" />
<rect
style="opacity:1;color:black;fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2212"
width="1"
height="1"
x="29"
y="38.027748" />
<rect
style="opacity:1;color:black;fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;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"
id="rect2214"
width="1"
height="1"
x="27"
y="38.027748" />
<path
style="opacity:0.54166667;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.95121026;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 5.6060431,13.580595 0,41.676631 45.3656379,0 11.036532,-8.201181 0,-33.475449 -56.4021699,0 z"
id="rect3005-1"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:url(#linearGradient4596);fill-opacity:1;fill-rule:evenodd;stroke:#00429a;stroke-width:3;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"
d="m 2.4673922,9.7183795 0,41.6766315 45.3656378,0 11.036532,-8.201181 0,-33.4754505 -56.4021698,0 z"
id="rect3005"
inkscape:connector-curvature="0" />
<path
style="opacity:0.54166667;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.95121026;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 26.976451,51.516804 7.134956,-6.038369 15.610921,17.475008 8.5659,-7.652164 -15.610923,-17.475007 7.696597,-6.49637 -30.16213,-11.283345 6.764679,31.470247 z"
id="rect2925-8"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:url(#linearGradient4596-5);fill-opacity:1;fill-rule:evenodd;stroke:#00429a;stroke-width:3;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"
d="m 58.694952,43.504249 c 0.160894,-1.443027 -0.62697,-3.448369 -4.966718,-4.52326 0,0 -1.330371,7.361384 -5.232791,11.884645 z"
id="path3778"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="color:#000000;fill:url(#linearGradient3817);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.30602169000000012;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"
d="m 26.405839,44.367917 7.134956,-6.038369 15.610921,17.475008 8.5659,-7.652164 L 42.106693,30.677385 49.80329,24.181015 19.64116,12.89767 26.405839,44.367917 z"
id="rect2925"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

+221
View File
@@ -0,0 +1,221 @@
<?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="64px"
height="64px"
id="svg2980"
sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Select_all.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2982">
<linearGradient
id="linearGradient4590">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4592" />
<stop
style="stop-color:#5cd4f5;stop-opacity:1;"
offset="1"
id="stop4594" />
</linearGradient>
<linearGradient
id="linearGradient3811">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3813" />
<stop
style="stop-color:#bfbfbf;stop-opacity:1;"
offset="1"
id="stop3815" />
</linearGradient>
<linearGradient
id="linearGradient3864">
<stop
id="stop3866"
offset="0"
style="stop-color:#71b2f8;stop-opacity:1;" />
<stop
id="stop3868"
offset="1"
style="stop-color:#002795;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient3850"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.6028459,1.0471639,-1.9794021,1.1395295,127.9588,-74.456907)"
cx="51.328892"
cy="31.074146"
fx="51.328892"
fy="31.074146"
r="19.571428" />
<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="perspective2988" />
<inkscape:perspective
id="perspective2872"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3864"
id="radialGradient2890"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.58019421,1.0078171,-1.9050269,1.0967121,-8.5316607,-197.0902)"
cx="51.328892"
cy="31.074146"
fx="51.328892"
fy="31.074146"
r="19.571428" />
<inkscape:perspective
id="perspective2902"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2902-9"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3811"
id="linearGradient3817"
x1="36.870125"
y1="30.196993"
x2="3.3695574"
y2="39.373768"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.27764843,-1.1190823,1.1190823,0.27764843,-10.424279,50.285999)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3811-9"
id="linearGradient3817-3"
x1="6.0684204"
y1="37.207146"
x2="39.480068"
y2="37.207146"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.27764843,-1.1190823,1.1190823,0.27764843,-9.674279,55.785999)" />
<linearGradient
id="linearGradient3811-9">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3813-8" />
<stop
style="stop-color:#bfbfbf;stop-opacity:1;"
offset="1"
id="stop3815-7" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4590"
id="linearGradient4596"
x1="34.54903"
y1="1.8738226"
x2="28.02536"
y2="43.593124"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,8)" />
<linearGradient
id="linearGradient4590-3">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4592-5" />
<stop
style="stop-color:#5cd4f5;stop-opacity:1;"
offset="1"
id="stop4594-6" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="4"
inkscape:cx="42.774418"
inkscape:cy="24.13006"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="758"
inkscape:window-x="0"
inkscape:window-y="19"
inkscape:window-maximized="0" />
<metadata
id="metadata2985">
<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>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="opacity:0.60250005;color:#000000;fill:none;stroke:#000000;stroke-width:7;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:14, 7;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect4714-0"
width="47"
height="44.75"
x="9"
y="7.375" />
<rect
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#0095d6;stroke-width:7;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:14,7;stroke-dashoffset:0"
id="rect4714"
width="47"
height="44.75"
x="5.5"
y="4.5" />
<path
style="opacity:0.54166667;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.95121026;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 26.976451,51.516804 7.134956,-6.038369 15.610921,17.475008 8.5659,-7.652164 -15.610923,-17.475007 7.696597,-6.49637 -30.16213,-11.283345 6.764679,31.470247 z"
id="rect2925-8"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:url(#linearGradient3817);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.30602169000000012;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"
d="m 26.405839,44.367917 7.134956,-6.038369 15.610921,17.475008 8.5659,-7.652164 L 42.106693,30.677385 49.80329,24.181015 19.64116,12.89767 26.405839,44.367917 z"
id="rect2925"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.7 KiB

+1
View File
@@ -43,6 +43,7 @@
<file>edit-delete.svg</file>
<file>edit-paste.svg</file>
<file>edit-select-all.svg</file>
<file>edit-select-box.svg</file>
<file>edit-redo.svg</file>
<file>edit-undo.svg</file>
<file>edit-edit.svg</file>
+7
View File
@@ -275,6 +275,13 @@ public:
}
}
void setPosition(const Base::Vector3f& v)
{
this->xPos->setValue(v.x);
this->yPos->setValue(v.y);
this->zPos->setValue(v.z);
}
Base::Vector3f getPosition() const
{
return Base::Vector3f((float)this->xPos->value(),
+4 -10
View File
@@ -285,16 +285,10 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
// Spaceball & Joystick handling
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
SoMotion3Event * const event = (SoMotion3Event *) ev;
SoCamera * const camera = viewer->getCamera();
if (camera) {
SbVec3f dir = event->getTranslation();
camera->orientation.getValue().multVec(dir,dir);
camera->position = camera->position.getValue() + dir;
camera->orientation =
event->getRotation() * camera->orientation.getValue();
processed = TRUE;
}
const SoMotion3Event * const event = static_cast<const SoMotion3Event * const>(ev);
if (event)
this->processMotionEvent(event);
processed = TRUE;
}
enum {
+1 -1
View File
@@ -5302,7 +5302,7 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display mode</source>
<source>Document window</source>
<translation type="unfinished"></translation>
</message>
<message>
+2 -2
View File
@@ -5317,8 +5317,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Standaardaansig</translation>
</message>
<message>
<source>Display mode</source>
<translation>Vertoningsmodus</translation>
<source>Document window</source>
<translation>Dokument venster</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5325,8 +5325,8 @@ Sie müssen entweder den Bearbeitungsvorgang fertigstellen oder mittels des Aufg
<translation>Standardansicht</translation>
</message>
<message>
<source>Display mode</source>
<translation>Anzeige-Modus</translation>
<source>Document window</source>
<translation>Dokumentfenster</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5323,8 +5323,8 @@ Tienes que finzalizar o cancelar la edición en el panel de tareas.</translation
<translation>Vista estándar</translation>
</message>
<message>
<source>Display mode</source>
<translation>Modo de visualización</translation>
<source>Document window</source>
<translation>Ventana de documento</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5314,8 +5314,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Standardi-Näkymä</translation>
</message>
<message>
<source>Display mode</source>
<translation>Näyttötila</translation>
<source>Document window</source>
<translation>Asiakirjan ikkuna</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5319,8 +5319,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Vue standard</translation>
</message>
<message>
<source>Display mode</source>
<translation>Mode d'affichage</translation>
<source>Document window</source>
<translation>Fenêtre de document</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5311,8 +5311,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Standardni pogled</translation>
</message>
<message>
<source>Display mode</source>
<translation>Način prikaza</translation>
<source>Document window</source>
<translation>Dokument prozor</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5318,8 +5318,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Standard-nézet</translation>
</message>
<message>
<source>Display mode</source>
<translation>Megjelenítési mód</translation>
<source>Document window</source>
<translation>Dokumentum ablak</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5325,8 +5325,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Vista standard</translation>
</message>
<message>
<source>Display mode</source>
<translation>Modalità di visualizzazione</translation>
<source>Document window</source>
<translation>Finestra del documento</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5319,8 +5319,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation></translation>
</message>
<message>
<source>Display mode</source>
<translation></translation>
<source>Document window</source>
<translation></translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5314,8 +5314,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Standaard-aanzicht</translation>
</message>
<message>
<source>Display mode</source>
<translation>Weergavemodus</translation>
<source>Document window</source>
<translation>Documentvenster</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5315,8 +5315,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Standardvisning</translation>
</message>
<message>
<source>Display mode</source>
<translation>Visningsmodus</translation>
<source>Document window</source>
<translation>Dokument-vinduet</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5305,8 +5305,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Normalny widok</translation>
</message>
<message>
<source>Display mode</source>
<translation>Tryb wyświetlania</translation>
<source>Document window</source>
<translation>Okno dokumentu</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5307,8 +5307,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Vista padrão</translation>
</message>
<message>
<source>Display mode</source>
<translation>Modo de exibição</translation>
<source>Document window</source>
<translation>Janela do documento</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5310,8 +5310,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Стандартный вид</translation>
</message>
<message>
<source>Display mode</source>
<translation>Режим отображения</translation>
<source>Document window</source>
<translation>окно документа</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5324,8 +5324,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation>Standardvy</translation>
</message>
<message>
<source>Display mode</source>
<translation>Visningsläge</translation>
<source>Document window</source>
<translation>Dokumentfönstret</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5325,8 +5325,8 @@ You either have to finish or cancel the editing in the task panel.</translation>
<translation>Стандартні вигляди</translation>
</message>
<message>
<source>Display mode</source>
<translation>Режим показу</translation>
<source>Document window</source>
<translation>вікно документа</translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2 -2
View File
@@ -5313,8 +5313,8 @@ You either have to finish or cancel the editing in the task panel.</source>
<translation></translation>
</message>
<message>
<source>Display mode</source>
<translation></translation>
<source>Document window</source>
<translation></translation>
</message>
<message>
<source>Display the active view either in fullscreen, in undocked or docked mode</source>
+2
View File
@@ -23,6 +23,7 @@ EXTRA_DIST = \
FreeCAD_it.qm \
FreeCAD_nl.qm \
FreeCAD_no.qm \
FreeCAD_pl.qm \
FreeCAD_pt.qm \
FreeCAD_ru.qm \
FreeCAD_se.qm \
@@ -37,6 +38,7 @@ EXTRA_DIST = \
FreeCAD_it.ts \
FreeCAD_nl.ts \
FreeCAD_no.ts \
FreeCAD_pl.ts \
FreeCAD_pt.ts \
FreeCAD_ru.ts \
FreeCAD_se.ts \
+17
View File
@@ -146,6 +146,7 @@ Translator::Translator()
d->mapLanguageTopLevelDomain[QT_TR_NOOP("Ukrainian" )] = "uk";
d->mapLanguageTopLevelDomain[QT_TR_NOOP("Finnish" )] = "fi";
d->mapLanguageTopLevelDomain[QT_TR_NOOP("Croatian" )] = "hr";
d->mapLanguageTopLevelDomain[QT_TR_NOOP("Polish" )] = "pl";
d->activatedLanguage = "English";
d->paths = directories();
@@ -173,6 +174,22 @@ TStringList Translator::supportedLanguages() const
return languages;
}
TStringMap Translator::supportedLocales() const
{
// List all .qm files
TStringMap languages;
QDir dir(QLatin1String(":/translations"));
for (std::map<std::string,std::string>::const_iterator it = d->mapLanguageTopLevelDomain.begin();
it != d->mapLanguageTopLevelDomain.end(); ++it) {
QString filter = QString::fromAscii("*_%1.qm").arg(QLatin1String(it->second.c_str()));
QStringList fileNames = dir.entryList(QStringList(filter), QDir::Files, QDir::Name);
if (!fileNames.isEmpty())
languages[it->first] = it->second;
}
return languages;
}
void Translator::activateLanguage (const char* lang)
{
removeTranslators(); // remove the currently installed translators
+3
View File
@@ -34,6 +34,7 @@ class QDir;
namespace Gui {
typedef std::list<std::string> TStringList;
typedef std::map<std::string, std::string> TStringMap;
/**
* The Translator class uses Qt's QTranslator objects to change the language of the application
@@ -65,6 +66,8 @@ public:
std::string activeLanguage() const;
/** Returns a list of supported languages. */
TStringList supportedLanguages() const;
/** Returns a map of supported languages/locales. */
TStringMap supportedLocales() const;
/** Adds a path where localization files can be found */
void addPath(const QString& path);
+1
View File
@@ -9,6 +9,7 @@
<file>FreeCAD_it.qm</file>
<file>FreeCAD_nl.qm</file>
<file>FreeCAD_no.qm</file>
<file>FreeCAD_pl.qm</file>
<file>FreeCAD_pt.qm</file>
<file>FreeCAD_ru.qm</file>
<file>FreeCAD_se.qm</file>
+19 -14
View File
@@ -29,6 +29,7 @@
# include <QEvent>
# include <QCloseEvent>
# include <QMdiSubWindow>
#include <iostream>
#endif
@@ -56,15 +57,17 @@ MDIView::~MDIView()
//the application crashes when accessing this deleted view.
//This effect only occurs if this widget is not in Child mode, because otherwise
//the focus stuff is done correctly.
QWidget* foc = getMainWindow()->focusWidget();
if (foc) {
QWidget* par = foc;
while (par) {
if (par == this) {
getMainWindow()->setFocus();
break;
if (getMainWindow()) {
QWidget* foc = getMainWindow()->focusWidget();
if (foc) {
QWidget* par = foc;
while (par) {
if (par == this) {
getMainWindow()->setFocus();
break;
}
par = par->parentWidget();
}
par = par->parentWidget();
}
}
}
@@ -166,22 +169,24 @@ void MDIView::windowStateChanged( MDIView* )
{
}
void MDIView::print(QPrinter* printer)
{
std::cerr << "Printing not implemented for " << this->metaObject()->className() << std::endl;
}
void MDIView::print()
{
// print command specified but print method not overriden!
assert(0);
std::cerr << "Printing not implemented for " << this->metaObject()->className() << std::endl;
}
void MDIView::printPdf()
{
// print command specified but print method not overriden!
assert(0);
std::cerr << "Printing PDF not implemented for " << this->metaObject()->className() << std::endl;
}
void MDIView::printPreview()
{
// print command specified but print method not overriden!
assert(0);
std::cerr << "Printing preview not implemented for " << this->metaObject()->className() << std::endl;
}
QSize MDIView::minimumSizeHint () const
+9 -1
View File
@@ -74,10 +74,18 @@ public:
virtual bool canClose(void);
/// delete itself
virtual void deleteSelf();
/// print function of the view
/** @name Printing */
//@{
public Q_SLOTS:
virtual void print(QPrinter* printer);
public:
/** Print content of view */
virtual void print();
/** Print to PDF file */
virtual void printPdf();
/** Show a preview dialog */
virtual void printPreview();
//@}
QSize minimumSizeHint () const;
+11 -1
View File
@@ -272,9 +272,12 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f)
d->mdiArea->setTabPosition(QTabWidget::South);
d->mdiArea->setViewMode(QMdiArea::TabbedView);
QTabBar* tab = d->mdiArea->findChild<QTabBar*>();
if (tab) {
if (tab) {
// 0000636: Two documents close
#if QT_VERSION < 0x040800
connect(tab, SIGNAL(tabCloseRequested(int)),
this, SLOT(tabCloseRequested(int)));
#endif
tab->setTabsClosable(true);
// The tabs might be very wide
tab->setExpanding(false);
@@ -1151,6 +1154,13 @@ void MainWindow::delayedStartup()
// processing all command line files
App::Application::processCmdLineFiles();
const std::map<std::string,std::string>& cfg = App::Application::Config();
std::map<std::string,std::string>::const_iterator it = cfg.find("StartHidden");
if (it != cfg.end()) {
QApplication::quit();
return;
}
// Create new document?
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Document");
if (hGrp->GetBool("CreateNewDoc", false)) {
+3
View File
@@ -48,6 +48,7 @@ BUILT_SOURCES=\
moc_HelpView.cpp \
moc_InputVector.cpp \
moc_MainWindow.cpp \
moc_ManualAlignment.cpp \
moc_NetworkRetriever.cpp \
moc_OnlineDocumentation.cpp \
moc_Placement.cpp \
@@ -282,6 +283,8 @@ libFreeCADGui_la_SOURCES=\
Placement.h \
Macro.cpp \
MainWindow.cpp \
ManualAlignment.cpp \
ManualAlignment.h \
MDIView.cpp \
MenuManager.cpp \
MergeDocuments.cpp \
File diff suppressed because it is too large Load Diff
+257
View File
@@ -0,0 +1,257 @@
/***************************************************************************
* Copyright (c) 2012 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_MANUALALIGNMENT_H
#define GUI_MANUALALIGNMENT_H
#include <Base/Placement.h>
#include <Base/Vector3D.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/ViewProviderDocumentObject.h>
#include <boost/signals.hpp>
class SbVec3f;
class SoPickedPoint;
class SoEventCallback;
namespace Gui {
class Document;
class AlignmentView;
class View3DInventorViewer;
/**
* The AlignemntGroup class is the base for fixed and movable groups.
* @author Werner Mayer
*/
class GuiExport AlignmentGroup
{
protected:
AlignmentGroup();
~AlignmentGroup();
public:
/**
* Add a mesh to the group.
*/
void addView(App::DocumentObject*);
std::vector<App::DocumentObject*> getViews() const;
/**
* Checks for the view provider of one of the added views.
*/
bool hasView(Gui::ViewProviderDocumentObject*) const;
/**
* Remove a previously added view by its view provider.
*/
void removeView(Gui::ViewProviderDocumentObject*);
/**
* Add the group and therefore all its added view providers to the Inventor tree.
*/
void addToViewer(Gui::View3DInventorViewer*) const;
/**
* Remove all the view providers from the Inventor tree.
*/
void removeFromViewer(Gui::View3DInventorViewer*) const;
void setRandomColor();
/**
* Returns the document of the added views.
*/
Gui::Document* getDocument() const;
/**
* Add a point to an array of picked points.
*/
void addPoint(const Base::Vector3d&);
/**
* Remove last point from array of picked points.
*/
void removeLastPoint();
/**
* Count the number of picked points.
*/
int countPoints() const;
/**
* Return an array of picked points.
*/
const std::vector<Base::Vector3d>& getPoints() const;
/**
* Clear all picked points.
*/
void clearPoints();
/**
* Set or unset the alignable mode for the added views. If a view is not alignable it also not pickable.
*/
void setAlignable(bool);
void moveTo(AlignmentGroup&);
/**
* Clear the list of added views.
*/
void clear();
/**
* Checks whether the list of added views is empty or not.
*/
bool isEmpty() const;
/**
* Return the number of added views.
*/
int count() const;
protected:
std::vector<Base::Vector3d> _pickedPoints;
std::vector<Gui::ViewProviderDocumentObject*> _views;
};
/**
* The FixedGroup class can be used for a fixed group of views.
* @author Werner Mayer
*/
class GuiExport MovableGroup : public AlignmentGroup
{
public:
MovableGroup();
~MovableGroup();
};
/**
* The FixedGroup class can be used for a fixed group of views.
* @author Werner Mayer
*/
class GuiExport FixedGroup : public AlignmentGroup
{
public:
FixedGroup();
~FixedGroup();
};
/**
* The MovableGroupModel class keeps an array of movable groups.
* @author Werner Mayer
*/
class GuiExport MovableGroupModel
{
public:
MovableGroupModel();
~MovableGroupModel();
void addGroup(const MovableGroup&);
void addGroups(const std::map<int, MovableGroup>&);
MovableGroup& activeGroup();
const MovableGroup& activeGroup() const;
void continueAlignment();
void clear();
bool isEmpty() const;
int count() const;
protected:
void removeActiveGroup();
private:
std::vector<MovableGroup> _groups;
};
/**
* @author Werner Mayer
*/
class GuiExport ManualAlignment : public QObject
{
Q_OBJECT
protected:
ManualAlignment();
~ManualAlignment();
public:
static ManualAlignment* instance();
static void destruct();
static bool hasInstance();
void setMinPoints(int minPoints);
void setFixedGroup(const FixedGroup&);
void setModel(const MovableGroupModel&);
void clearAll();
void setViewingDirections(const Base::Vector3d& view1, const Base::Vector3d& up1,
const Base::Vector3d& view2, const Base::Vector3d& up2);
void startAlignment(Base::Type mousemodel);
void finish();
void align();
bool canAlign() const;
void cancel();
const Base::Placement & getTransform() const
{ return myTransform; }
void alignObject(App::DocumentObject*);
// Observer stuff
/// Checks if the given object is about to be removed
void slotDeletedDocument(const Gui::Document& Doc);
/// Checks if the given document is about to be closed
void slotDeletedObject(const Gui::ViewProvider& Obj);
protected:
bool computeAlignment(const std::vector<Base::Vector3d>& unnavPts, const std::vector<Base::Vector3d>& navigPts);
void continueAlignment();
void showInstructions();
/** @name Probe picking */
//@{
static void probePickedCallback(void * ud, SoEventCallback * n);
void applyPickedProbe(Gui::ViewProviderDocumentObject*, const SoPickedPoint* pnt);
//@}
protected Q_SLOTS:
void reset();
void onAlign();
void onRemoveLastPointMoveable();
void onRemoveLastPointFixed();
void onClear();
void onCancel();
Q_SIGNALS:
void emitCanceled();
void emitFinished();
private:
SoNode* pickedPointsSubGraph(const SbVec3f& p, const SbVec3f& n, int id);
void closeViewer();
static ManualAlignment* _instance;
typedef boost::BOOST_SIGNALS_NAMESPACE::connection Connection;
Connection connectApplicationDeletedDocument;
Connection connectDocumentDeletedObject;
FixedGroup myFixedGroup;
MovableGroupModel myAlignModel;
QPointer<Gui::AlignmentView> myViewer;
Gui::Document* myDocument;
int myPickPoints;
Base::Placement myTransform;
class Private;
Private* d;
};
} // namespace Gui
#endif // GUI_MANUALALIGNMENT_H
+9 -8
View File
@@ -122,16 +122,13 @@ MergeDocuments::importObjects(std::istream& input)
reader.readElement("Object");
std::string type = reader.getAttribute("type");
std::string name = reader.getAttribute("name");
std::string docn = name;
// remove number from end to avoid lengthy names
size_t lastpos = docn.length()-1;
while (docn[lastpos] >= 48 && docn[lastpos] <= 57)
lastpos--;
docn = docn.substr(0, lastpos+1);
try {
App::DocumentObject* o = appdoc->addObject(type.c_str(),docn.c_str());
// Use name from XML as is and do NOT remove trailing digits because
// otherwise we may cause a dependency to itself
// Example: Object 'Cut001' references object 'Cut' and removing the
// digits we make an object 'Cut' referencing itself.
App::DocumentObject* o = appdoc->addObject(type.c_str(),name.c_str());
objs.push_back(o);
// use this name for the later access because an object with
// the given name may already exist
@@ -235,4 +232,8 @@ void MergeDocuments::RestoreDocFile(Base::Reader & reader)
}
xmlReader.readEndElement("Document");
// In the file GuiDocument.xml new data files might be added
if (!xmlReader.getFilenames().empty())
xmlReader.readFiles(static_cast<zipios::ZipInputStream&>(reader));
}
+1
View File
@@ -495,6 +495,7 @@ int RectangleSelection::mouseButtonEvent( const SoMouseButtonEvent * const e, co
{
releaseMouseModel();
m_bWorking = false;
_clPoly.push_back(e->getPosition());
ret = Finish;
} break;
default:
-2
View File
@@ -88,8 +88,6 @@ protected:
int m_iXnew, m_iYnew;
SbBool m_bInner;
SbBool mustRedraw;
private:
std::vector<SbVec2s> _clPoly;
};
+41
View File
@@ -721,6 +721,16 @@ void NavigationStyle::zoomByCursor(const SbVec2f & thispos, const SbVec2f & prev
zoom(viewer->getCamera(), (thispos[1] - prevpos[1]) * 10.0f/*20.0f*/);
}
void NavigationStyle::zoomIn()
{
zoom(viewer->getCamera(), -this->zoomStep);
}
void NavigationStyle::zoomOut()
{
zoom(viewer->getCamera(), this->zoomStep);
}
void NavigationStyle::doZoom(SoCamera* camera, SbBool forward, const SbVec2f& pos)
{
SbBool zoomAtCur = this->zoomAtCursor;
@@ -1140,6 +1150,37 @@ SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
return viewer->processSoEventBase(ev);
}
SbBool NavigationStyle::processMotionEvent(const SoMotion3Event * const ev)
{
SoCamera * const camera = viewer->getCamera();
if (!camera)
return FALSE;
SbViewVolume volume(camera->getViewVolume());
SbVec3f center(volume.getSightPoint(camera->focalDistance.getValue()));
float scale(volume.getWorldToScreenScale(center, 1.0));
float translationFactor = scale * .0001;
SbVec3f dir = ev->getTranslation();
if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())){
SoOrthographicCamera *oCam = static_cast<SoOrthographicCamera *>(camera);
oCam->scaleHeight(1.0 + (dir[2] * 0.0001));
dir[2] = 0.0;//don't move the cam for z translation.
}
SbRotation newRotation(ev->getRotation() * camera->orientation.getValue());
SbVec3f newPosition, newDirection;
newRotation.multVec(SbVec3f(0.0, 0.0, -1.0), newDirection);
newPosition = center - (newDirection * camera->focalDistance.getValue());
camera->orientation.setValue(newRotation);
camera->orientation.getValue().multVec(dir,dir);
camera->position = newPosition + (dir * translationFactor);
return TRUE;
}
void NavigationStyle::setPopupMenuEnabled(const SbBool on)
{
this->menuenabled = on;
+8 -4
View File
@@ -38,6 +38,7 @@
// forward declarations
class SoEvent;
class SoMotion3Event;
class SoQtViewer;
class SoCamera;
class SoSensor;
@@ -90,10 +91,10 @@ public:
Clip = 3, /**< Clip objects using a lasso. */
};
enum OrbitStyle {
Turntable,
Trackball
};
enum OrbitStyle {
Turntable,
Trackball
};
public:
NavigationStyle();
@@ -114,6 +115,8 @@ public:
void setZoomStep(float);
void setZoomAtCursor(SbBool);
SbBool isZoomAtCursor() const;
void zoomIn();
void zoomOut();
void updateAnimation();
void redraw();
@@ -126,6 +129,7 @@ public:
void setViewingMode(const ViewerMode newmode);
int getViewingMode() const;
virtual SbBool processEvent(const SoEvent * const ev);
virtual SbBool processMotionEvent(const SoMotion3Event * const ev);
void setPopupMenuEnabled(const SbBool on);
SbBool isPopupMenuEnabled(void) const;
+10 -4
View File
@@ -232,9 +232,10 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const
" return self.bigsection(dir, '#ffffff', '#ee77aa', contents)\n"
"\n"
"pydoc.html=FreeCADDoc()\n"
"title='FreeCAD Python Modules Index'\n"
"\n"
"heading = pydoc.html.heading(\n"
"'<big><big><strong>Python: Index of Modules</strong></big></big>',\n"
"heading = pydoc.html.heading("
"'<big><big><strong>Python: Index of Modules</strong></big></big>',"
"'#ffffff', '#7799ee')\n"
"def bltinlink(name):\n"
" return '<a href=\"%s.html\">%s</a>' % (name, name)\n"
@@ -257,13 +258,16 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const
" indices.append(ret)\n"
"contents = heading + string.join(indices) + '''<p align=right>\n"
"<font color=\"#909090\" face=\"helvetica, arial\"><strong>\n"
"pydoc</strong> by Ka-Ping Yee &lt;[email protected]&gt;</font>'''\n";
"pydoc</strong> by Ka-Ping Yee &lt;[email protected]&gt;</font>'''\n"
"htmldocument=pydoc.html.page(title,contents)\n";
PyObject* result = PyRun_String(cmd.constData(), Py_file_input, dict, dict);
if (result) {
Py_DECREF(result);
result = PyDict_GetItemString(dict, "contents");
result = PyDict_GetItemString(dict, "htmldocument");
const char* contents = PyString_AsString(result);
res.append("HTTP/1.0 200 OK\n");
res.append("Content-type: text/html\n");
res.append(contents);
return res;
}
@@ -293,6 +297,8 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const
Py_DECREF(result);
result = PyDict_GetItemString(dict, "page");
const char* page = PyString_AsString(result);
res.append("HTTP/1.0 200 OK\n");
res.append("Content-type: text/html\n");
res.append(page);
}
else {

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