Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b23b48b9a7 |
@@ -1,31 +0,0 @@
|
||||
|
||||
# Custom attribute to mark source files using KiCad C++ formatting
|
||||
[attr]kicad-cpp-source whitepace=tab-in-indent format.clang-format-kicad
|
||||
|
||||
# Custom attribute to mark KiCad's own CMake files
|
||||
[attr]kicad-cmake-source whitespace=tab-in-indent
|
||||
|
||||
# Custom attribute for auto-generated sources:
|
||||
# * Do not perform whitespace checking
|
||||
# * Do not format
|
||||
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format-kicad
|
||||
|
||||
# By default, all C and C++ files conform to KiCad formatting,
|
||||
# unless overridden
|
||||
*.c kicad-cpp-source
|
||||
*.cpp kicad-cpp-source
|
||||
*.h kicad-cpp-source
|
||||
|
||||
*.cmake kicad-cmake-source
|
||||
*.txt kicad-cmake-source
|
||||
|
||||
# Compiled bitmap sources
|
||||
bitmaps_png/cpp_*/*.cpp generated
|
||||
|
||||
# wxFormBuilder-generated files
|
||||
**/dialog*/*_base.cpp generated
|
||||
**/dialog*/*_base.h generated
|
||||
|
||||
# Lemon grammars
|
||||
common/libeval/grammar.c generated
|
||||
common/libeval/grammar.h generated
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Git "hook chain", used to execute multiple scripts per hook.
|
||||
# To use:
|
||||
# * create a directory called <hookname>.d
|
||||
# * add scripts to this directory (executable)
|
||||
# * ln -s hook-chain <hookname>
|
||||
#
|
||||
# Now the scripts in that directory should be called in order.
|
||||
#
|
||||
# Set $HOOKCHAIN_DEBUG to see the names of invoked scripts.
|
||||
#
|
||||
# Based on script by Oliver Reflalo:
|
||||
# https://stackoverflow.com/questions/8730514/chaining-git-hooks
|
||||
#
|
||||
|
||||
hookname=`basename $0`
|
||||
|
||||
# Temp file for stdin, cleared at exit
|
||||
FILE=`mktemp`
|
||||
trap 'rm -f $FILE' EXIT
|
||||
cat - > $FILE
|
||||
|
||||
# Git hooks directory (this dir)
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
# Execute hooks in the directory one by one
|
||||
for hook in $DIR/$hookname.d/*;
|
||||
do
|
||||
if [ -x "$hook" ]; then
|
||||
|
||||
if [ "$HOOKCHAIN_DEBUG" ]; then
|
||||
echo "Running hook $hook"
|
||||
fi
|
||||
|
||||
cat $FILE | $hook "$@"
|
||||
status=$?
|
||||
|
||||
if [ $status -ne 0 ]; then
|
||||
echo "Hook $hook failed with error code $status"
|
||||
echo "To commit anyway, use --no-verify"
|
||||
exit $status
|
||||
else
|
||||
if [ "$HOOKCHAIN_DEBUG" ]; then
|
||||
echo "Hook passed: $hook"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -1 +0,0 @@
|
||||
hook-chain
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Runs clang-format on changed regions before commit.
|
||||
#
|
||||
# Remaining installation checks/instructions will be printed when you commit.
|
||||
#
|
||||
# Based on clang-format pre-commit hook by Alex Eagle
|
||||
# https://gist.github.com/alexeagle/c8ed91b14a407342d9a8e112b5ac7dab
|
||||
|
||||
# Set kicad.check-format to allow this hook to run
|
||||
# If not set, the hook always succeeds.
|
||||
|
||||
do_format=false
|
||||
|
||||
# Check if formatting is configured
|
||||
if [ "$(git config --get kicad.check-format)" = true ]; then
|
||||
do_format=true
|
||||
fi
|
||||
|
||||
# Older env variable method
|
||||
if [ ! -z "$KICAD_CHECK_FORMAT" ]; then
|
||||
do_format=true
|
||||
fi
|
||||
|
||||
if [ ! ${do_format} = true ]; then
|
||||
# No formatting required
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
check_clang_format() {
|
||||
if hash git-clang-format 2>/dev/null; then
|
||||
return
|
||||
else
|
||||
echo "SETUP ERROR: no git-clang-format executable found, or it is not executable"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_git_config() {
|
||||
if [[ "$(git config --get clangFormat.style)" != "file" ]]; then
|
||||
echo "SETUP ERROR: git config clangFormat.style is wrong (should be 'file'). Fix this with:"
|
||||
echo "git config clangFormat.style file"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_filtered_filenames()
|
||||
{
|
||||
format_attr='clang-format-kicad'
|
||||
|
||||
# command to get list of candidate files
|
||||
git_list_files='git diff --cached --name-only --diff-filter=ACM'
|
||||
|
||||
files=$(${git_list_files} |
|
||||
|
||||
# Filter for format-controlled files
|
||||
git check-attr --stdin format.${format_attr} |
|
||||
|
||||
# output only the file names
|
||||
grep ": set$" |
|
||||
cut -d: -f1)
|
||||
|
||||
echo ${files}
|
||||
}
|
||||
|
||||
check_clang_format
|
||||
check_git_config
|
||||
|
||||
files_to_check=$(get_filtered_filenames)
|
||||
|
||||
if [ -z "${files_to_check}" ]; then
|
||||
# No controlled files to check
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
git_clang_format_cmd="git clang-format -v --diff -- ${files_to_check}"
|
||||
|
||||
readonly out=$(${git_clang_format_cmd})
|
||||
|
||||
# In these cases, there is no formatting issues, so we succeed
|
||||
if [[ "$out" == *"no modified files to format"* ]]; then exit 0; fi
|
||||
if [[ "$out" == *"clang-format did not modify any files"* ]]; then exit 0; fi
|
||||
|
||||
# Any other case implies formatting results
|
||||
echo "ERROR: you need to run clang-format (e.g. using tools/check_coding.sh) on your commit"
|
||||
|
||||
# print the errors to show what's the issue
|
||||
${git_clang_format_cmd}
|
||||
|
||||
# fail the pre-commit
|
||||
exit 1
|
||||
+2
-3
@@ -20,6 +20,7 @@ eeschema/dialogs/dialog_bom_cfg_lexer.h
|
||||
eeschema/dialogs/dialog_bom_help_html.h
|
||||
eeschema/template_fieldnames_keywords.*
|
||||
eeschema/template_fieldnames_lexer.h
|
||||
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
pcb_calculator/attenuators/bridget_tee_formula.h
|
||||
@@ -52,12 +53,10 @@ bitmaps_png/png*
|
||||
bitmaps_png/tmp
|
||||
common/pcb_keywords.cpp
|
||||
include/pcb_lexer.h
|
||||
fp-info-cache
|
||||
|
||||
# demo project auxillary files
|
||||
demos/**/*-bak
|
||||
demos/**/_autosave-*
|
||||
demos/**/fp-info-cache
|
||||
|
||||
# editor/OS fluff
|
||||
.*.swp
|
||||
@@ -75,4 +74,4 @@ demos/**/fp-info-cache
|
||||
*.old
|
||||
*.gch
|
||||
*.orig
|
||||
*.patch
|
||||
*.patch
|
||||
+123
-62
@@ -2,7 +2,6 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -35,13 +34,7 @@
|
||||
#include <wx/log.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 106800
|
||||
#include <boost/uuid/detail/sha1.hpp>
|
||||
#else
|
||||
#include <boost/uuid/sha1.hpp>
|
||||
#endif
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
@@ -50,7 +43,7 @@
|
||||
#include "3d_cache.h"
|
||||
#include "3d_info.h"
|
||||
#include "sg/scenegraph.h"
|
||||
#include "filename_resolver.h"
|
||||
#include "3d_filename_resolver.h"
|
||||
#include "3d_plugin_manager.h"
|
||||
#include "plugins/3dapi/ifsg_api.h"
|
||||
|
||||
@@ -59,7 +52,6 @@
|
||||
|
||||
static wxCriticalSection lock3D_cache;
|
||||
|
||||
|
||||
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
|
||||
{
|
||||
for( int i = 0; i < 20; ++i )
|
||||
@@ -69,7 +61,6 @@ static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool checkTag( const char* aTag, void* aPluginMgrPtr )
|
||||
{
|
||||
if( NULL == aTag || NULL == aPluginMgrPtr )
|
||||
@@ -80,7 +71,6 @@ static bool checkTag( const char* aTag, void* aPluginMgrPtr )
|
||||
return pp->CheckTag( aTag );
|
||||
}
|
||||
|
||||
|
||||
static const wxString sha1ToWXString( const unsigned char* aSHA1Sum )
|
||||
{
|
||||
unsigned char uc;
|
||||
@@ -161,8 +151,14 @@ void S3D_CACHE_ENTRY::SetSHA1( const unsigned char* aSHA1Sum )
|
||||
{
|
||||
if( NULL == aSHA1Sum )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] NULL passed for aSHA1Sum",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] NULL passed for aSHA1Sum";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -184,13 +180,12 @@ const wxString S3D_CACHE_ENTRY::GetCacheBaseName( void )
|
||||
S3D_CACHE::S3D_CACHE()
|
||||
{
|
||||
m_DirtyCache = false;
|
||||
m_FNResolver = new FILENAME_RESOLVER;
|
||||
m_FNResolver = new S3D_FILENAME_RESOLVER;
|
||||
m_Plugins = new S3D_PLUGIN_MANAGER;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
S3D_CACHE::~S3D_CACHE()
|
||||
{
|
||||
FlushCache();
|
||||
@@ -215,14 +210,14 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, S3D_CACHE_ENTRY** aCach
|
||||
if( full3Dpath.empty() )
|
||||
{
|
||||
// the model cannot be found; we cannot proceed
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [3D model] could not find model '%s'\n",
|
||||
__FILE__, __FUNCTION__, __LINE__, aModelFile );
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] could not find model '%s'\n",
|
||||
aModelFile.GetData() );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check cache if file is already loaded
|
||||
wxCriticalSectionLocker lock( lock3D_cache );
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, rsort_wxString >::iterator mi;
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, S3D::rsort_wxString >::iterator mi;
|
||||
mi = m_CacheMap.find( full3Dpath );
|
||||
|
||||
if( mi != m_CacheMap.end() )
|
||||
@@ -299,8 +294,15 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
|
||||
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
|
||||
( aFileName, ep ) ).second == false )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, aFileName );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] duplicate entry in map file; key = '";
|
||||
ostr << aFileName.ToUTF8() << "'";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
m_CacheList.pop_back();
|
||||
delete ep;
|
||||
@@ -323,8 +325,15 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
|
||||
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
|
||||
( aFileName, ep ) ).second == false )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, aFileName );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] duplicate entry in map file; key = '";
|
||||
ostr << aFileName.ToUTF8() << "'";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
m_CacheList.pop_back();
|
||||
delete ep;
|
||||
@@ -355,21 +364,33 @@ bool S3D_CACHE::getSHA1( const wxString& aFileName, unsigned char* aSHA1Sum )
|
||||
{
|
||||
if( aFileName.empty() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] empty filename",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] empty filename";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( NULL == aSHA1Sum )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n * [BUG] NULL pointer passed for aMD5Sum",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] NULL pointer passed for aMD5Sum";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WIN32
|
||||
FILE* fp = _wfopen( aFileName.wc_str(), L"rb" );
|
||||
#else
|
||||
FILE* fp = fopen( aFileName.ToUTF8(), "rb" );
|
||||
@@ -413,16 +434,17 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
|
||||
|
||||
if( bname.empty() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
" * [3D model] cannot load cached model; no file hash available" );
|
||||
#ifdef DEBUG
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_CacheDir.empty() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
" * [3D model] cannot load cached model; config directory unknown" );
|
||||
wxString errmsg = "cannot load cached model; config directory unknown";
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -432,7 +454,8 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
{
|
||||
wxString errmsg = "cannot open file";
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'", errmsg.GetData(), fname.GetData() );
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n",
|
||||
errmsg.GetData(), fname.GetData() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -452,16 +475,28 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
|
||||
{
|
||||
if( NULL == aCacheItem )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * NULL passed for aCacheItem",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * NULL passed for aCacheItem";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( NULL == aCacheItem->sceneData )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * aCacheItem has no valid scene data",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * aCacheItem has no valid scene data";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -470,16 +505,17 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
|
||||
|
||||
if( bname.empty() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
" * [3D model] cannot load cached model; no file hash available" );
|
||||
#ifdef DEBUG
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_CacheDir.empty() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
" * [3D model] cannot load cached model; config directory unknown" );
|
||||
wxString errmsg = "cannot load cached model; config directory unknown";
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -490,8 +526,9 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
|
||||
{
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] path exists but is not a regular file '%s'",
|
||||
fname );
|
||||
wxString errmsg = _( "path exists but is not a regular file" );
|
||||
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n", errmsg.GetData(),
|
||||
fname.ToUTF8() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -522,9 +559,14 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
|
||||
|
||||
if( !cfgdir.DirExists() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
"%s:%s:%d\n * failed to create 3D configuration directory '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
wxString errmsg = _( "failed to create 3D configuration directory" );
|
||||
ostr << " * " << errmsg.ToUTF8() << "\n";
|
||||
errmsg = _( "config directory" );
|
||||
ostr << " * " << errmsg.ToUTF8() << " '";
|
||||
ostr << cfgdir.GetPath().ToUTF8() << "'";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -535,10 +577,15 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
|
||||
// inform the file resolver of the config directory
|
||||
if( !m_FNResolver->Set3DConfigDir( m_ConfigDir ) )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
"%s:%s:%d\n * could not set 3D Config Directory on filename resolver\n"
|
||||
" * config directory: '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, m_ConfigDir );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * could not set 3D Config Directory on filename resolver\n";
|
||||
ostr << " * config directory: '" << m_ConfigDir.ToUTF8() << "'";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
// 3D cache data must go to a user's cache directory;
|
||||
@@ -550,20 +597,20 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
|
||||
// 3. MSWin: AppData\Local\kicad\3d
|
||||
wxString cacheDir;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
wxStandardPaths::Get().UseAppInfo( wxStandardPaths::AppInfo_None );
|
||||
cacheDir = wxStandardPaths::Get().GetUserLocalDataDir();
|
||||
cacheDir.append( "\\kicad\\3d" );
|
||||
#elif defined(__APPLE)
|
||||
#elif defined(__APPLE)
|
||||
cacheDir = "${HOME}/Library/Caches/kicad/3d";
|
||||
#else // assume Linux
|
||||
#else // assume Linux
|
||||
cacheDir = ExpandEnvVarSubstitutions( "${XDG_CACHE_HOME}" );
|
||||
|
||||
if( cacheDir.empty() || cacheDir == "${XDG_CACHE_HOME}" )
|
||||
cacheDir = "${HOME}/.cache";
|
||||
|
||||
cacheDir.append( "/kicad/3d" );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
cacheDir = ExpandEnvVarSubstitutions( cacheDir );
|
||||
cfgdir.Assign( cacheDir, "" );
|
||||
@@ -574,8 +621,14 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
|
||||
|
||||
if( !cfgdir.DirExists() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D cache directory '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
wxString errmsg = "failed to create 3D cache directory";
|
||||
ostr << " * " << errmsg.ToUTF8() << "\n";
|
||||
errmsg = "cache directory";
|
||||
ostr << " * " << errmsg.ToUTF8() << " '";
|
||||
ostr << cfgdir.GetPath().ToUTF8() << "'";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -628,8 +681,11 @@ wxString S3D_CACHE::Get3DConfigDir( bool createDefault )
|
||||
|
||||
if( !cfgpath.DirExists() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D configuration directory '%s'",
|
||||
__FILE__, __FUNCTION__, __LINE__, cfgpath.GetPath() );
|
||||
std::ostringstream ostr;
|
||||
wxString errmsg = "failed to create 3D configuration directory";
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * " << errmsg.ToUTF8();
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
|
||||
return wxT( "" );
|
||||
}
|
||||
@@ -680,7 +736,7 @@ wxString S3D_CACHE::GetProjectDir( void )
|
||||
}
|
||||
|
||||
|
||||
FILENAME_RESOLVER* S3D_CACHE::GetResolver( void )
|
||||
S3D_FILENAME_RESOLVER* S3D_CACHE::GetResolver( void )
|
||||
{
|
||||
return m_FNResolver;
|
||||
}
|
||||
@@ -732,9 +788,14 @@ S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName )
|
||||
|
||||
if( !cp )
|
||||
{
|
||||
wxLogTrace( MASK_3D_CACHE,
|
||||
"%s:%s:%d\n * [BUG] model loaded with no associated S3D_CACHE_ENTRY",
|
||||
__FILE__, __FUNCTION__, __LINE__ );
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] model loaded with no associated S3D_CACHE_ENTRY";
|
||||
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -757,7 +818,7 @@ wxString S3D_CACHE::GetModelHash( const wxString& aModelFileName )
|
||||
return wxEmptyString;
|
||||
|
||||
// check cache if file is already loaded
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, rsort_wxString >::iterator mi;
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, S3D::rsort_wxString >::iterator mi;
|
||||
mi = m_CacheMap.find( full3Dpath );
|
||||
|
||||
if( mi != m_CacheMap.end() )
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <wx/string.h>
|
||||
#include "kicad_string.h"
|
||||
#include "filename_resolver.h"
|
||||
#include "str_rsort.h"
|
||||
#include "3d_filename_resolver.h"
|
||||
#include "3d_info.h"
|
||||
#include "plugins/3dapi/c3dmodel.h"
|
||||
|
||||
@@ -42,7 +42,7 @@ class PGM_BASE;
|
||||
class S3D_CACHE;
|
||||
class S3D_CACHE_ENTRY;
|
||||
class SCENEGRAPH;
|
||||
class FILENAME_RESOLVER;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
class S3D_PLUGIN_MANAGER;
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ private:
|
||||
std::list< S3D_CACHE_ENTRY* > m_CacheList;
|
||||
|
||||
/// mapping of file names to cache names and data
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, rsort_wxString > m_CacheMap;
|
||||
std::map< wxString, S3D_CACHE_ENTRY*, S3D::rsort_wxString > m_CacheMap;
|
||||
|
||||
/// object to resolve file names
|
||||
FILENAME_RESOLVER* m_FNResolver;
|
||||
S3D_FILENAME_RESOLVER* m_FNResolver;
|
||||
|
||||
/// plugin manager
|
||||
S3D_PLUGIN_MANAGER* m_Plugins;
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
*/
|
||||
SCENEGRAPH* Load( const wxString& aModelFile );
|
||||
|
||||
FILENAME_RESOLVER* GetResolver( void );
|
||||
S3D_FILENAME_RESOLVER* GetResolver( void );
|
||||
|
||||
/**
|
||||
* Function GetFileFilters
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
class CACHE_WRAPPER : public S3D_CACHE, public PROJECT::_ELEM
|
||||
{
|
||||
public:
|
||||
KICAD_T Type() override { return CACHE_WRAPPER_T; }
|
||||
|
||||
CACHE_WRAPPER();
|
||||
virtual ~CACHE_WRAPPER();
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <wx/filename.h>
|
||||
@@ -31,11 +32,11 @@
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "filename_resolver.h"
|
||||
#include "3d_filename_resolver.h"
|
||||
|
||||
// configuration file version
|
||||
#define CFGFILE_VERSION 1
|
||||
#define RESOLVER_CONFIG wxT( "3Dresolver.cfg" )
|
||||
#define S3D_RESOLVER_CONFIG wxT( "3Dresolver.cfg" )
|
||||
|
||||
// flag bits used to track different one-off messages to users
|
||||
#define ERRFLG_ALIAS (1)
|
||||
@@ -44,19 +45,19 @@
|
||||
|
||||
#define MASK_3D_RESOLVER "3D_RESOLVER"
|
||||
|
||||
static wxCriticalSection lock_resolver;
|
||||
static wxCriticalSection lock3D_resolver;
|
||||
|
||||
static bool getHollerith( const std::string& aString, size_t& aIndex, wxString& aResult );
|
||||
|
||||
|
||||
FILENAME_RESOLVER::FILENAME_RESOLVER()
|
||||
S3D_FILENAME_RESOLVER::S3D_FILENAME_RESOLVER()
|
||||
{
|
||||
m_errflags = 0;
|
||||
m_pgm = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
|
||||
bool S3D_FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
|
||||
{
|
||||
if( aConfigDir.empty() )
|
||||
return false;
|
||||
@@ -70,7 +71,7 @@ bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
|
||||
|
||||
cfgdir.Normalize();
|
||||
|
||||
if( !cfgdir.DirExists() )
|
||||
if( false == cfgdir.DirExists() )
|
||||
return false;
|
||||
|
||||
m_ConfigDir = cfgdir.GetPath();
|
||||
@@ -80,7 +81,7 @@ bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChanged )
|
||||
bool S3D_FILENAME_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChanged )
|
||||
{
|
||||
if( aProjDir.empty() )
|
||||
return false;
|
||||
@@ -94,7 +95,7 @@ bool FILENAME_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChange
|
||||
|
||||
projdir.Normalize();
|
||||
|
||||
if( !projdir.DirExists() )
|
||||
if( false == projdir.DirExists() )
|
||||
return false;
|
||||
|
||||
m_curProjDir = projdir.GetPath();
|
||||
@@ -104,7 +105,7 @@ bool FILENAME_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChange
|
||||
|
||||
if( m_Paths.empty() )
|
||||
{
|
||||
SEARCH_PATH al;
|
||||
S3D_ALIAS al;
|
||||
al.m_alias = "${KIPRJMOD}";
|
||||
al.m_pathvar = "${KIPRJMOD}";
|
||||
al.m_pathexp = m_curProjDir;
|
||||
@@ -144,26 +145,28 @@ bool FILENAME_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChange
|
||||
}
|
||||
|
||||
|
||||
wxString FILENAME_RESOLVER::GetProjectDir()
|
||||
wxString S3D_FILENAME_RESOLVER::GetProjectDir( void )
|
||||
{
|
||||
return m_curProjDir;
|
||||
}
|
||||
|
||||
|
||||
void FILENAME_RESOLVER::SetProgramBase( PGM_BASE* aBase )
|
||||
void S3D_FILENAME_RESOLVER::SetProgramBase( PGM_BASE* aBase )
|
||||
{
|
||||
m_pgm = aBase;
|
||||
|
||||
if( !m_pgm || m_Paths.empty() )
|
||||
if( NULL == m_pgm || m_Paths.empty() )
|
||||
return;
|
||||
|
||||
// recreate the path list
|
||||
m_Paths.clear();
|
||||
createPathList();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::createPathList()
|
||||
bool S3D_FILENAME_RESOLVER::createPathList( void )
|
||||
{
|
||||
if( !m_Paths.empty() )
|
||||
return true;
|
||||
@@ -174,7 +177,7 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
// we cannot set a sensible default so we use an empty string.
|
||||
// the user may change this later with a call to SetProjectDir()
|
||||
|
||||
SEARCH_PATH lpath;
|
||||
S3D_ALIAS lpath;
|
||||
lpath.m_alias = "${KIPRJMOD}";
|
||||
lpath.m_pathvar = "${KIPRJMOD}";
|
||||
lpath.m_pathexp = m_curProjDir;
|
||||
@@ -218,8 +221,8 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
|
||||
#ifdef DEBUG
|
||||
wxLogTrace( MASK_3D_RESOLVER, " * [3D model] search paths:\n" );
|
||||
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
|
||||
std::list< S3D_ALIAS >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< S3D_ALIAS >::const_iterator ePL = m_Paths.end();
|
||||
|
||||
while( sPL != ePL )
|
||||
{
|
||||
@@ -233,7 +236,7 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::UpdatePathList( std::vector< SEARCH_PATH >& aPathList )
|
||||
bool S3D_FILENAME_RESOLVER::UpdatePathList( std::vector< S3D_ALIAS >& aPathList )
|
||||
{
|
||||
wxUniChar envMarker( '$' );
|
||||
|
||||
@@ -249,9 +252,9 @@ bool FILENAME_RESOLVER::UpdatePathList( std::vector< SEARCH_PATH >& aPathList )
|
||||
}
|
||||
|
||||
|
||||
wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
||||
wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
||||
{
|
||||
wxCriticalSectionLocker lock( lock_resolver );
|
||||
wxCriticalSectionLocker lock( lock3D_resolver );
|
||||
|
||||
if( aFileName.empty() )
|
||||
return wxEmptyString;
|
||||
@@ -326,8 +329,8 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
||||
// a. an aliased shortened name or
|
||||
// b. cannot be determined
|
||||
|
||||
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
|
||||
std::list< S3D_ALIAS >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< S3D_ALIAS >::const_iterator ePL = m_Paths.end();
|
||||
|
||||
// check the path relative to the current project directory;
|
||||
// note: this is not necessarily the same as the current working
|
||||
@@ -435,14 +438,14 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
bool S3D_FILENAME_RESOLVER::addPath( const S3D_ALIAS& aPath )
|
||||
{
|
||||
if( aPath.m_alias.empty() || aPath.m_pathvar.empty() )
|
||||
return false;
|
||||
|
||||
wxCriticalSectionLocker lock( lock_resolver );
|
||||
wxCriticalSectionLocker lock( lock3D_resolver );
|
||||
|
||||
SEARCH_PATH tpath = aPath;
|
||||
S3D_ALIAS tpath = aPath;
|
||||
|
||||
#ifdef _WIN32
|
||||
while( tpath.m_pathvar.EndsWith( wxT( "\\" ) ) )
|
||||
@@ -489,8 +492,8 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
}
|
||||
|
||||
wxString pname = path.GetPath();
|
||||
std::list< SEARCH_PATH >::iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::iterator ePL = m_Paths.end();
|
||||
std::list< S3D_ALIAS >::iterator sPL = m_Paths.begin();
|
||||
std::list< S3D_ALIAS >::iterator ePL = m_Paths.end();
|
||||
|
||||
while( sPL != ePL )
|
||||
{
|
||||
@@ -517,7 +520,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::readPathList()
|
||||
bool S3D_FILENAME_RESOLVER::readPathList( void )
|
||||
{
|
||||
if( m_ConfigDir.empty() )
|
||||
{
|
||||
@@ -529,7 +532,7 @@ bool FILENAME_RESOLVER::readPathList()
|
||||
return false;
|
||||
}
|
||||
|
||||
wxFileName cfgpath( m_ConfigDir, RESOLVER_CONFIG );
|
||||
wxFileName cfgpath( m_ConfigDir, S3D_RESOLVER_CONFIG );
|
||||
cfgpath.Normalize();
|
||||
wxString cfgname = cfgpath.GetFullPath();
|
||||
|
||||
@@ -562,7 +565,7 @@ bool FILENAME_RESOLVER::readPathList()
|
||||
}
|
||||
|
||||
int lineno = 0;
|
||||
SEARCH_PATH al;
|
||||
S3D_ALIAS al;
|
||||
size_t idx;
|
||||
int vnum = 0; // version number
|
||||
|
||||
@@ -616,11 +619,14 @@ bool FILENAME_RESOLVER::readPathList()
|
||||
if( vnum < CFGFILE_VERSION )
|
||||
writePathList();
|
||||
|
||||
return( m_Paths.size() != nitems );
|
||||
if( m_Paths.size() != nitems )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::writePathList()
|
||||
bool S3D_FILENAME_RESOLVER::writePathList( void )
|
||||
{
|
||||
if( m_ConfigDir.empty() )
|
||||
{
|
||||
@@ -635,13 +641,13 @@ bool FILENAME_RESOLVER::writePathList()
|
||||
}
|
||||
|
||||
// skip all ${ENV_VAR} alias names
|
||||
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
|
||||
std::list< S3D_ALIAS >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< S3D_ALIAS >::const_iterator ePL = m_Paths.end();
|
||||
|
||||
while( sPL != ePL && ( sPL->m_alias.StartsWith( "${" ) || sPL->m_alias.StartsWith( "$(" ) ) )
|
||||
++sPL;
|
||||
|
||||
wxFileName cfgpath( m_ConfigDir, RESOLVER_CONFIG );
|
||||
wxFileName cfgpath( m_ConfigDir, S3D_RESOLVER_CONFIG );
|
||||
wxString cfgname = cfgpath.GetFullPath();
|
||||
std::ofstream cfgFile;
|
||||
|
||||
@@ -688,7 +694,7 @@ bool FILENAME_RESOLVER::writePathList()
|
||||
}
|
||||
|
||||
|
||||
void FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
|
||||
void S3D_FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
|
||||
{
|
||||
bool useParen = false;
|
||||
|
||||
@@ -725,7 +731,7 @@ void FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
|
||||
++sPL;
|
||||
}
|
||||
|
||||
SEARCH_PATH lpath;
|
||||
S3D_ALIAS lpath;
|
||||
lpath.m_alias = envar;
|
||||
lpath.m_pathvar = lpath.m_alias;
|
||||
wxFileName tmpFN;
|
||||
@@ -750,19 +756,20 @@ void FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
|
||||
return;
|
||||
|
||||
m_Paths.insert( sPL, lpath );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
wxString S3D_FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
{
|
||||
wxString fname = aFullPathName;
|
||||
|
||||
if( m_Paths.empty() )
|
||||
createPathList();
|
||||
|
||||
wxCriticalSectionLocker lock( lock_resolver );
|
||||
std::list< SEARCH_PATH >::const_iterator sL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator eL = m_Paths.end();
|
||||
wxCriticalSectionLocker lock( lock3D_resolver );
|
||||
std::list< S3D_ALIAS >::const_iterator sL = m_Paths.begin();
|
||||
std::list< S3D_ALIAS >::const_iterator eL = m_Paths.end();
|
||||
size_t idx;
|
||||
|
||||
while( sL != eL )
|
||||
@@ -800,7 +807,7 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
|
||||
idx = fname.find( fps );
|
||||
|
||||
if( idx == 0 )
|
||||
if( std::string::npos != idx && 0 == idx )
|
||||
{
|
||||
fname = fname.substr( fps.size() );
|
||||
|
||||
@@ -844,13 +851,13 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
|
||||
|
||||
|
||||
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths()
|
||||
const std::list< S3D_ALIAS >* S3D_FILENAME_RESOLVER::GetPaths( void )
|
||||
{
|
||||
return &m_Paths;
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
|
||||
bool S3D_FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
|
||||
wxString& anAlias, wxString& aRelPath )
|
||||
{
|
||||
anAlias.clear();
|
||||
@@ -969,7 +976,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString&
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
||||
bool S3D_FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
||||
{
|
||||
// Rules:
|
||||
// 1. The generic form of an aliased 3D relative path is:
|
||||
@@ -1027,7 +1034,7 @@ bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAl
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
|
||||
bool S3D_FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
|
||||
{
|
||||
paths.clear();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file filename_resolver.h
|
||||
* @file 3d_filename_resolver.h
|
||||
* provides an extensible class to resolve 3D model paths. Initially
|
||||
* the legacy behavior will be implemented and an incomplete path
|
||||
* would be checked against the project directory or the KISYS3DMOD
|
||||
@@ -30,17 +30,18 @@
|
||||
* paths may be specified.
|
||||
*/
|
||||
|
||||
#ifndef FILENAME_RESOLVER_H
|
||||
#define FILENAME_RESOLVER_H
|
||||
#ifndef FILENAME_RESOLVER_3D_H
|
||||
#define FILENAME_RESOLVER_3D_H
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include "str_rsort.h"
|
||||
|
||||
class PGM_BASE;
|
||||
|
||||
struct SEARCH_PATH
|
||||
struct S3D_ALIAS
|
||||
{
|
||||
wxString m_alias; // alias to the base path
|
||||
wxString m_pathvar; // base path as stored in the config file
|
||||
@@ -48,11 +49,11 @@ struct SEARCH_PATH
|
||||
wxString m_description; // description of the aliased path
|
||||
};
|
||||
|
||||
class FILENAME_RESOLVER
|
||||
class S3D_FILENAME_RESOLVER
|
||||
{
|
||||
private:
|
||||
wxString m_ConfigDir; // 3D configuration directory
|
||||
std::list< SEARCH_PATH > m_Paths; // list of base paths to search from
|
||||
std::list< S3D_ALIAS > m_Paths; // list of base paths to search from
|
||||
int m_errflags;
|
||||
PGM_BASE* m_pgm;
|
||||
wxString m_curProjDir;
|
||||
@@ -75,7 +76,7 @@ private:
|
||||
* @param aPath is the alias set to be checked and added
|
||||
* @return true if aPath is valid
|
||||
*/
|
||||
bool addPath( const SEARCH_PATH& aPath );
|
||||
bool addPath( const S3D_ALIAS& aPath );
|
||||
|
||||
/**
|
||||
* Function readPathList
|
||||
@@ -104,7 +105,7 @@ private:
|
||||
void checkEnvVarPath( const wxString& aPath );
|
||||
|
||||
public:
|
||||
FILENAME_RESOLVER();
|
||||
S3D_FILENAME_RESOLVER();
|
||||
|
||||
/**
|
||||
* Function Set3DConfigDir
|
||||
@@ -142,7 +143,7 @@ public:
|
||||
* clears the current path list and substitutes the given path
|
||||
* list, updating the path configuration file on success.
|
||||
*/
|
||||
bool UpdatePathList( std::vector< SEARCH_PATH >& aPathList );
|
||||
bool UpdatePathList( std::vector< S3D_ALIAS >& aPathList );
|
||||
|
||||
/**
|
||||
* Function ResolvePath
|
||||
@@ -174,7 +175,7 @@ public:
|
||||
*
|
||||
* @return pointer to the internal path list
|
||||
*/
|
||||
const std::list< SEARCH_PATH >* GetPaths( void );
|
||||
const std::list< S3D_ALIAS >* GetPaths( void );
|
||||
|
||||
/**
|
||||
* Function SplitAlias
|
||||
@@ -200,4 +201,4 @@ public:
|
||||
bool GetKicadPaths( std::list< wxString >& paths );
|
||||
};
|
||||
|
||||
#endif // FILENAME_RESOLVER_H
|
||||
#endif // FILENAME_RESOLVER_3D_H
|
||||
@@ -149,10 +149,14 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
// PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path
|
||||
// corresponding to the install path used for constructing KICAD_USER_PLUGIN
|
||||
// multiarch friendly determination of the plugin directory: the executable dir
|
||||
// is first determined via wxStandardPaths::Get().GetExecutablePath() and then
|
||||
// the CMAKE_INSTALL_LIBDIR path is appended relative to the executable dir.
|
||||
|
||||
wxString tfname = wxString::FromUTF8Unchecked( PLUGINDIR );
|
||||
fn.Assign( wxStandardPaths::Get().GetExecutablePath() );
|
||||
fn.RemoveLastDir();
|
||||
wxString tfname = fn.GetPathWithSep();
|
||||
tfname.Append( wxString::FromUTF8Unchecked( PLUGINDIR ) );
|
||||
fn.Assign( tfname, "");
|
||||
fn.AppendDir( "kicad" );
|
||||
#else
|
||||
@@ -486,7 +490,7 @@ SCENEGRAPH* S3D_PLUGIN_MANAGER::Load3DModel( const wxString& aFileName, std::str
|
||||
wxFileName raw( aFileName );
|
||||
wxString ext = raw.GetExt();
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WIN32
|
||||
// note: plugins only have a lowercase filter within Windows; including an uppercase
|
||||
// filter will result in duplicate file entries and should be avoided.
|
||||
ext.LowerCase();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "3d_cache.h"
|
||||
#include "plugins/3dapi/ifsg_api.h"
|
||||
#include "3d_cache_dialogs.h"
|
||||
#include "dialog_configure_paths.h"
|
||||
#include "dlg_3d_pathconfig.h"
|
||||
#include "dlg_select_3dmodel.h"
|
||||
|
||||
|
||||
@@ -51,9 +51,16 @@ bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache,
|
||||
}
|
||||
|
||||
|
||||
bool S3D::Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver )
|
||||
bool S3D::Configure3DPaths( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver )
|
||||
{
|
||||
DIALOG_CONFIGURE_PATHS dlg( aParent, aResolver );
|
||||
DLG_3D_PATH_CONFIG* dp = new DLG_3D_PATH_CONFIG( aParent, aResolver );
|
||||
|
||||
return( dlg.ShowModal() == wxID_OK );
|
||||
if( wxID_OK == dp->ShowModal() )
|
||||
{
|
||||
delete dp;
|
||||
return true;
|
||||
}
|
||||
|
||||
delete dp;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
#include <wx/window.h>
|
||||
|
||||
class S3D_CACHE;
|
||||
class FILENAME_RESOLVER;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
|
||||
namespace S3D
|
||||
{
|
||||
bool Select3DModel( wxWindow* aParent, S3D_CACHE* aCache,
|
||||
wxString& prevModelSelectDir, int& prevModelWildcard, MODULE_3D_SETTINGS* aModel );
|
||||
|
||||
bool Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver );
|
||||
bool Configure3DPaths( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver );
|
||||
}
|
||||
|
||||
#endif // CACHE_DIALOGS_3D_H
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
#include <pgm_base.h>
|
||||
#include <html_messagebox.h>
|
||||
#include "3d_cache/dialogs/dlg_3d_pathconfig.h"
|
||||
#include "3d_cache/3d_filename_resolver.h"
|
||||
|
||||
DLG_3D_PATH_CONFIG::DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver ) :
|
||||
DLG_3D_PATH_CONFIG_BASE( aParent ), m_resolver( aResolver )
|
||||
{
|
||||
initDialog();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::initDialog()
|
||||
{
|
||||
m_Aliases->EnableEditing( true );
|
||||
|
||||
// Gives a min width to each column, when the user drags a column
|
||||
m_Aliases->SetColMinimalWidth( 0, 80 );
|
||||
m_Aliases->SetColMinimalWidth( 1, 300 );
|
||||
m_Aliases->SetColMinimalWidth( 2, 120 );
|
||||
m_Aliases->SetColMinimalAcceptableWidth( 80 );
|
||||
|
||||
// Set column sizes to this min value
|
||||
m_Aliases->SetColSize( 0, 80 );
|
||||
m_Aliases->SetColSize( 1, 300 );
|
||||
m_Aliases->SetColSize( 2, 120 );
|
||||
|
||||
m_EnvVars->SetColMinimalWidth( 0, 80 );
|
||||
m_EnvVars->SetColMinimalWidth( 1, 300 );
|
||||
m_EnvVars->SetColMinimalAcceptableWidth( 80 );
|
||||
m_EnvVars->SetColSize( 0, 80 );
|
||||
m_EnvVars->SetColSize( 1, 300 );
|
||||
|
||||
if( m_resolver )
|
||||
{
|
||||
updateEnvVars();
|
||||
|
||||
// prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
|
||||
m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
|
||||
m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
|
||||
|
||||
const std::list< S3D_ALIAS >* rpaths = m_resolver->GetPaths();
|
||||
std::list< S3D_ALIAS >::const_iterator rI = rpaths->begin();
|
||||
std::list< S3D_ALIAS >::const_iterator rE = rpaths->end();
|
||||
size_t listsize = rpaths->size();
|
||||
size_t listidx = 0;
|
||||
|
||||
while( rI != rE && ( (*rI).m_alias.StartsWith( "${" ) || (*rI).m_alias.StartsWith( "$(" ) ) )
|
||||
{
|
||||
++listidx;
|
||||
++rI;
|
||||
}
|
||||
|
||||
if( listidx < listsize )
|
||||
m_curdir = (*rI).m_pathexp;
|
||||
else
|
||||
return;
|
||||
|
||||
listsize = listsize - listidx - m_Aliases->GetNumberRows();
|
||||
|
||||
// note: if the list allocation fails we have bigger problems
|
||||
// and there is no point in trying to notify the user here
|
||||
if( listsize > 0 && !m_Aliases->InsertRows( 0, listsize ) )
|
||||
return;
|
||||
|
||||
int nitems = 0;
|
||||
wxGridCellTextEditor* pEdAlias;
|
||||
|
||||
while( rI != rE )
|
||||
{
|
||||
m_Aliases->SetCellValue( nitems, 0, rI->m_alias );
|
||||
|
||||
if( 0 == nitems )
|
||||
{
|
||||
m_Aliases->SetCellEditor( nitems, 0, new wxGridCellTextEditor );
|
||||
pEdAlias = (wxGridCellTextEditor*) m_Aliases->GetCellEditor( nitems, 0 );
|
||||
pEdAlias->SetValidator( m_aliasValidator );
|
||||
pEdAlias->DecRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
pEdAlias->IncRef();
|
||||
m_Aliases->SetCellEditor( nitems, 0, pEdAlias );
|
||||
}
|
||||
|
||||
m_Aliases->SetCellValue( nitems, 1, rI->m_pathvar );
|
||||
m_Aliases->SetCellValue( nitems++, 2, rI->m_description );
|
||||
|
||||
// TODO: implement a wxGridCellEditor which invokes a wxDirDialog
|
||||
|
||||
++rI;
|
||||
}
|
||||
|
||||
m_Aliases->AutoSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DLG_3D_PATH_CONFIG::TransferDataFromWindow()
|
||||
{
|
||||
if( NULL == m_resolver )
|
||||
{
|
||||
wxMessageBox( _( "[BUG] No valid resolver; data will not be updated" ),
|
||||
_( "Update 3D search path list" ) );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<S3D_ALIAS> alist;
|
||||
S3D_ALIAS alias;
|
||||
|
||||
int ni = m_Aliases->GetNumberRows();
|
||||
|
||||
if( ni <= 0 )
|
||||
{
|
||||
// note: UI usability: we should ask a user if they're sure they
|
||||
// want to clear the entire path list
|
||||
m_resolver->UpdatePathList( alist );
|
||||
return true;
|
||||
}
|
||||
|
||||
for( int i = 0; i < ni; ++i )
|
||||
{
|
||||
alias.m_alias = m_Aliases->GetCellValue( i, 0 );
|
||||
alias.m_pathvar = m_Aliases->GetCellValue( i, 1 );
|
||||
alias.m_description = m_Aliases->GetCellValue( i, 2 );
|
||||
|
||||
if( !alias.m_alias.empty() && !alias.m_pathvar.empty() )
|
||||
alist.push_back( alias );
|
||||
|
||||
}
|
||||
|
||||
return m_resolver->UpdatePathList( alist );
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnAddAlias( wxCommandEvent& event )
|
||||
{
|
||||
int ni = m_Aliases->GetNumberRows();
|
||||
|
||||
if( m_Aliases->InsertRows( ni, 1 ) )
|
||||
{
|
||||
wxGridCellTextEditor* pEdAlias;
|
||||
pEdAlias = (wxGridCellTextEditor*) m_Aliases->GetCellEditor( 0, 0 );
|
||||
m_Aliases->SetCellEditor( ni, 0, pEdAlias );
|
||||
m_Aliases->SelectRow( ni, false );
|
||||
m_Aliases->AutoSize();
|
||||
Fit();
|
||||
|
||||
// TODO: set the editors on any newly created rows
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnDelAlias( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayInt sel = m_Aliases->GetSelectedRows();
|
||||
|
||||
if( sel.empty() )
|
||||
{
|
||||
wxMessageBox( _( "No entry selected" ), _( "Delete alias entry" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( sel.size() > 1 )
|
||||
{
|
||||
wxMessageBox( _( "Multiple entries selected; please\nselect only one entry" ),
|
||||
_( "Delete alias entry" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_Aliases->GetNumberRows() > 1 )
|
||||
{
|
||||
int ni = sel.front();
|
||||
m_Aliases->DeleteRows( ni, 1 );
|
||||
|
||||
if( ni >= m_Aliases->GetNumberRows() )
|
||||
ni = m_Aliases->GetNumberRows() - 1;
|
||||
|
||||
m_Aliases->SelectRow( ni, false );
|
||||
m_Aliases->AutoSize();
|
||||
Fit();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Aliases->SetCellValue( 0, 0, wxEmptyString );
|
||||
m_Aliases->SetCellValue( 0, 1, wxEmptyString );
|
||||
m_Aliases->SetCellValue( 0, 2, wxEmptyString );
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnAliasMoveUp( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayInt sel = m_Aliases->GetSelectedRows();
|
||||
|
||||
if( sel.empty() )
|
||||
{
|
||||
wxMessageBox( _( "No entry selected" ), _( "Move alias up" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( sel.size() > 1 )
|
||||
{
|
||||
wxMessageBox( _( "Multiple entries selected; please\nselect only one entry" ),
|
||||
_( "Move alias up" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int ci = sel.front();
|
||||
|
||||
if( ci > 0 )
|
||||
{
|
||||
S3D_ALIAS al0;
|
||||
al0.m_alias = m_Aliases->GetCellValue( ci, 0 );
|
||||
al0.m_pathvar = m_Aliases->GetCellValue( ci, 1 );
|
||||
al0.m_description = m_Aliases->GetCellValue( ci, 2 );
|
||||
|
||||
int ni = ci - 1;
|
||||
m_Aliases->SetCellValue( ci, 0, m_Aliases->GetCellValue( ni, 0 ) );
|
||||
m_Aliases->SetCellValue( ci, 1, m_Aliases->GetCellValue( ni, 1 ) );
|
||||
m_Aliases->SetCellValue( ci, 2, m_Aliases->GetCellValue( ni, 2 ) );
|
||||
|
||||
m_Aliases->SetCellValue( ni, 0, al0.m_alias );
|
||||
m_Aliases->SetCellValue( ni, 1, al0.m_pathvar );
|
||||
m_Aliases->SetCellValue( ni, 2, al0.m_description );
|
||||
m_Aliases->SelectRow( ni, false );
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnAliasMoveDown( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayInt sel = m_Aliases->GetSelectedRows();
|
||||
|
||||
if( sel.empty() )
|
||||
{
|
||||
wxMessageBox( _( "No entry selected" ), _( "Move alias down" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( sel.size() > 1 )
|
||||
{
|
||||
wxMessageBox( _( "Multiple entries selected; please\nselect only one entry" ),
|
||||
_( "Move alias down" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int ni = m_Aliases->GetNumberRows() - 1;
|
||||
int ci = sel.front();
|
||||
|
||||
if( ci < ni )
|
||||
{
|
||||
S3D_ALIAS al0;
|
||||
al0.m_alias = m_Aliases->GetCellValue( ci, 0 );
|
||||
al0.m_pathvar = m_Aliases->GetCellValue( ci, 1 );
|
||||
al0.m_description = m_Aliases->GetCellValue( ci, 2 );
|
||||
|
||||
ni = ci + 1;
|
||||
m_Aliases->SetCellValue( ci, 0, m_Aliases->GetCellValue( ni, 0 ) );
|
||||
m_Aliases->SetCellValue( ci, 1, m_Aliases->GetCellValue( ni, 1 ) );
|
||||
m_Aliases->SetCellValue( ci, 2, m_Aliases->GetCellValue( ni, 2 ) );
|
||||
|
||||
m_Aliases->SetCellValue( ni, 0, al0.m_alias );
|
||||
m_Aliases->SetCellValue( ni, 1, al0.m_pathvar );
|
||||
m_Aliases->SetCellValue( ni, 2, al0.m_description );
|
||||
m_Aliases->SelectRow( ni, false );
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnConfigEnvVar( wxCommandEvent& event )
|
||||
{
|
||||
Pgm().ConfigurePaths( this );
|
||||
updateEnvVars();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::updateEnvVars( void )
|
||||
{
|
||||
if( !m_resolver )
|
||||
return;
|
||||
|
||||
std::list< wxString > epaths;
|
||||
|
||||
m_resolver->GetKicadPaths( epaths );
|
||||
size_t nitems = epaths.size();
|
||||
size_t nrows = m_EnvVars->GetNumberRows();
|
||||
bool resize = nrows != nitems; // true after adding/removing env vars
|
||||
|
||||
if( nrows > nitems )
|
||||
{
|
||||
size_t ni = nrows - nitems;
|
||||
m_EnvVars->DeleteRows( 0, ni );
|
||||
}
|
||||
else if( nrows < nitems )
|
||||
{
|
||||
size_t ni = nitems - nrows;
|
||||
m_EnvVars->InsertRows( 0, ni );
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
|
||||
for( const auto& i : epaths )
|
||||
{
|
||||
wxString val = ExpandEnvVarSubstitutions( i );
|
||||
m_EnvVars->SetCellValue( j, 0, i );
|
||||
m_EnvVars->SetCellValue( j, 1, val );
|
||||
m_EnvVars->SetReadOnly( j, 0, true );
|
||||
m_EnvVars->SetReadOnly( j, 1, true );
|
||||
wxGridCellAttr* ap = m_EnvVars->GetOrCreateCellAttr( j, 0 );
|
||||
ap->SetReadOnly( true );
|
||||
ap->SetBackgroundColour( *wxLIGHT_GREY );
|
||||
m_EnvVars->SetRowAttr( j, ap );
|
||||
++j;
|
||||
}
|
||||
|
||||
m_EnvVars->AutoSize();
|
||||
|
||||
// Resizing the full dialog is sometimes needed for a clean display
|
||||
// i.e. when adding/removing Kicad environment variables
|
||||
if( resize )
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void DLG_3D_PATH_CONFIG::OnHelp( wxCommandEvent& event )
|
||||
{
|
||||
wxString msg = _( "Enter the name and path for each 3D alias variable.<br>KiCad "
|
||||
"environment variables and their values are shown for "
|
||||
"reference only and cannot be edited." );
|
||||
msg << "<br><br><b>";
|
||||
msg << _( "Alias names may not contain any of the characters " );
|
||||
msg << "{}[]()%~<>\"='`;:.,&?/\\|$";
|
||||
msg << "</b>";
|
||||
|
||||
HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
|
||||
dlg.AddHTML_Text( msg );
|
||||
dlg.ShowModal();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
+23
-15
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -21,29 +21,37 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H
|
||||
#define DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H
|
||||
|
||||
#include <dialog_fp_browser_display_options_base.h>
|
||||
#ifndef DLG_3D_PATHCONFIG_H
|
||||
#define DLG_3D_PATHCONFIG_H
|
||||
|
||||
#include <wx/valtext.h>
|
||||
#include "dlg_3d_pathconfig_base.h"
|
||||
|
||||
class FOOTPRINT_VIEWER_FRAME;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
|
||||
|
||||
class DIALOG_FP_BROWSER_DISPLAY_OPTIONS : public DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE
|
||||
class DLG_3D_PATH_CONFIG : public DLG_3D_PATH_CONFIG_BASE
|
||||
{
|
||||
private:
|
||||
FOOTPRINT_VIEWER_FRAME* m_frame;
|
||||
S3D_FILENAME_RESOLVER* m_resolver;
|
||||
wxString m_curdir;
|
||||
wxTextValidator m_aliasValidator;
|
||||
|
||||
void initDialog();
|
||||
|
||||
void OnAddAlias( wxCommandEvent& event ) override;
|
||||
void OnDelAlias( wxCommandEvent& event ) override;
|
||||
void OnAliasMoveUp( wxCommandEvent& event ) override;
|
||||
void OnAliasMoveDown( wxCommandEvent& event ) override;
|
||||
void OnConfigEnvVar( wxCommandEvent& event ) override;
|
||||
void OnHelp( wxCommandEvent& event ) override;
|
||||
|
||||
public:
|
||||
DIALOG_FP_BROWSER_DISPLAY_OPTIONS( FOOTPRINT_VIEWER_FRAME* aParent );
|
||||
~DIALOG_FP_BROWSER_DISPLAY_OPTIONS();
|
||||
DLG_3D_PATH_CONFIG( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver );
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
private:
|
||||
void initDialog();
|
||||
void UpdateObjectSettings();
|
||||
void OnApplyClick( wxCommandEvent& event ) override;
|
||||
bool TransferDataFromWindow() override;
|
||||
void updateEnvVars( void );
|
||||
};
|
||||
|
||||
#endif // DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H
|
||||
#endif // DLG_3D_PATHCONFIG_H
|
||||
@@ -0,0 +1,162 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Nov 22 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dlg_3d_pathconfig_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DLG_3D_PATH_CONFIG_BASE::DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer5;
|
||||
bSizer5 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_EnvVars = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_EnvVars->CreateGrid( 1, 2 );
|
||||
m_EnvVars->EnableEditing( true );
|
||||
m_EnvVars->EnableGridLines( true );
|
||||
m_EnvVars->EnableDragGridSize( false );
|
||||
m_EnvVars->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_EnvVars->SetColSize( 0, 150 );
|
||||
m_EnvVars->SetColSize( 1, 300 );
|
||||
m_EnvVars->EnableDragColMove( false );
|
||||
m_EnvVars->EnableDragColSize( true );
|
||||
m_EnvVars->SetColLabelSize( 30 );
|
||||
m_EnvVars->SetColLabelValue( 0, _("Name") );
|
||||
m_EnvVars->SetColLabelValue( 1, _("Path") );
|
||||
m_EnvVars->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
|
||||
// Rows
|
||||
m_EnvVars->EnableDragRowSize( true );
|
||||
m_EnvVars->SetRowLabelSize( 80 );
|
||||
m_EnvVars->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_EnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_EnvVars->SetMinSize( wxSize( 250,100 ) );
|
||||
|
||||
bSizer5->Add( m_EnvVars, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_btnEnvCfg = new wxButton( this, wxID_ANY, _("Configure Environment Variables"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer5->Add( m_btnEnvCfg, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer5, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerGrid;
|
||||
bSizerGrid = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_Aliases = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_Aliases->CreateGrid( 1, 3 );
|
||||
m_Aliases->EnableEditing( true );
|
||||
m_Aliases->EnableGridLines( true );
|
||||
m_Aliases->EnableDragGridSize( false );
|
||||
m_Aliases->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_Aliases->SetColSize( 0, 80 );
|
||||
m_Aliases->SetColSize( 1, 300 );
|
||||
m_Aliases->SetColSize( 2, 120 );
|
||||
m_Aliases->EnableDragColMove( false );
|
||||
m_Aliases->EnableDragColSize( true );
|
||||
m_Aliases->SetColLabelSize( 30 );
|
||||
m_Aliases->SetColLabelValue( 0, _("Alias") );
|
||||
m_Aliases->SetColLabelValue( 1, _("Path") );
|
||||
m_Aliases->SetColLabelValue( 2, _("Description") );
|
||||
m_Aliases->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
|
||||
// Rows
|
||||
m_Aliases->AutoSizeRows();
|
||||
m_Aliases->EnableDragRowSize( false );
|
||||
m_Aliases->SetRowLabelSize( 80 );
|
||||
m_Aliases->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_Aliases->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_Aliases->SetMinSize( wxSize( -1,150 ) );
|
||||
|
||||
bSizerGrid->Add( m_Aliases, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerGrid, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerButtons;
|
||||
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_btnAddAlias = new wxButton( this, wxID_ANY, _("Add Alias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_btnAddAlias, 0, wxALL, 5 );
|
||||
|
||||
m_btnDelAlias = new wxButton( this, wxID_ANY, _("Remove Alias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_btnDelAlias, 0, wxALL, 5 );
|
||||
|
||||
m_btnMoveUp = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_btnMoveUp, 0, wxALL, 5 );
|
||||
|
||||
m_btnMoveDown = new wxButton( this, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_btnMoveDown, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbSizer2 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer2OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer2->AddButton( m_sdbSizer2OK );
|
||||
m_sdbSizer2Cancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer2->AddButton( m_sdbSizer2Cancel );
|
||||
m_sdbSizer2Help = new wxButton( this, wxID_HELP );
|
||||
m_sdbSizer2->AddButton( m_sdbSizer2Help );
|
||||
m_sdbSizer2->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_btnEnvCfg->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this );
|
||||
m_btnAddAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAddAlias ), NULL, this );
|
||||
m_btnDelAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnDelAlias ), NULL, this );
|
||||
m_btnMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveUp ), NULL, this );
|
||||
m_btnMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveDown ), NULL, this );
|
||||
m_sdbSizer2Help->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnHelp ), NULL, this );
|
||||
}
|
||||
|
||||
DLG_3D_PATH_CONFIG_BASE::~DLG_3D_PATH_CONFIG_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_btnEnvCfg->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnConfigEnvVar ), NULL, this );
|
||||
m_btnAddAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAddAlias ), NULL, this );
|
||||
m_btnDelAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnDelAlias ), NULL, this );
|
||||
m_btnMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveUp ), NULL, this );
|
||||
m_btnMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnAliasMoveDown ), NULL, this );
|
||||
m_sdbSizer2Help->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DLG_3D_PATH_CONFIG_BASE::OnHelp ), NULL, this );
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Nov 22 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DLG_3D_PATHCONFIG_BASE_H__
|
||||
#define __DLG_3D_PATHCONFIG_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DLG_3D_PATH_CONFIG_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DLG_3D_PATH_CONFIG_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxGrid* m_EnvVars;
|
||||
wxButton* m_btnEnvCfg;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxGrid* m_Aliases;
|
||||
wxButton* m_btnAddAlias;
|
||||
wxButton* m_btnDelAlias;
|
||||
wxButton* m_btnMoveUp;
|
||||
wxButton* m_btnMoveDown;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
||||
wxButton* m_sdbSizer2OK;
|
||||
wxButton* m_sdbSizer2Cancel;
|
||||
wxButton* m_sdbSizer2Help;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnConfigEnvVar( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddAlias( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDelAlias( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAliasMoveUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAliasMoveDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DLG_3D_PATH_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Search Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DLG_3D_PATH_CONFIG_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DLG_3D_PATHCONFIG_BASE_H__
|
||||
@@ -75,7 +75,7 @@ DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheMana
|
||||
|
||||
m_FileTree = new wxGenericDirCtrl( this, ID_FILE_TREE, prevModelSelectDir, wxDefaultPosition,
|
||||
wxSize( 300,100 ), wxDIRCTRL_3D_INTERNAL | wxDIRCTRL_EDIT_LABELS
|
||||
| wxDIRCTRL_SELECT_FIRST | wxDIRCTRL_SHOW_FILTERS | wxBORDER_SIMPLE, wxEmptyString, 0 );
|
||||
| wxDIRCTRL_SELECT_FIRST | wxDIRCTRL_SHOW_FILTERS|wxSUNKEN_BORDER, wxEmptyString, 0 );
|
||||
|
||||
|
||||
m_FileTree->ShowHidden( false );
|
||||
@@ -111,7 +111,7 @@ DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheMana
|
||||
if( !filter.empty() )
|
||||
m_FileTree->SetFilter( filter );
|
||||
else
|
||||
m_FileTree->SetFilter( wxFileSelectorDefaultWildcardStr );
|
||||
m_FileTree->SetFilter( wxT( "*.*" ) );
|
||||
|
||||
if( prevModelWildcard >= 0 && prevModelWildcard < (int)fl->size() )
|
||||
m_FileTree->SetFilterIndex( prevModelWildcard );
|
||||
@@ -123,7 +123,7 @@ DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheMana
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FileTree->SetFilter( wxFileSelectorDefaultWildcardStr );
|
||||
m_FileTree->SetFilter( wxT( "*.*" ) );
|
||||
prevModelWildcard = 0;
|
||||
m_FileTree->SetFilterIndex( 0 );
|
||||
}
|
||||
@@ -240,9 +240,9 @@ void DLG_SELECT_3DMODEL::updateDirChoiceList( void )
|
||||
if( NULL == m_FileTree || NULL == m_resolver || NULL == dirChoices )
|
||||
return;
|
||||
|
||||
std::list< SEARCH_PATH > const* md = m_resolver->GetPaths();
|
||||
std::list< SEARCH_PATH >::const_iterator sL = md->begin();
|
||||
std::list< SEARCH_PATH >::const_iterator eL = md->end();
|
||||
std::list< S3D_ALIAS > const* md = m_resolver->GetPaths();
|
||||
std::list< S3D_ALIAS >::const_iterator sL = md->begin();
|
||||
std::list< S3D_ALIAS >::const_iterator eL = md->end();
|
||||
std::set< wxString > cl;
|
||||
wxString prjDir;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
class MODULE_3D_SETTINGS;
|
||||
class S3D_CACHE;
|
||||
class FILENAME_RESOLVER;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
class C3D_MODEL_VIEWER;
|
||||
|
||||
class DLG_SELECT_3DMODEL : public DIALOG_SHIM
|
||||
@@ -51,7 +51,7 @@ class DLG_SELECT_3DMODEL : public DIALOG_SHIM
|
||||
private:
|
||||
MODULE_3D_SETTINGS* m_model; // data for the selected model
|
||||
S3D_CACHE* m_cache; // cache manager
|
||||
FILENAME_RESOLVER* m_resolver; // 3D filename resolver
|
||||
S3D_FILENAME_RESOLVER* m_resolver; // 3D filename resolver
|
||||
|
||||
wxString& m_previousDir;
|
||||
int& m_previousFilterIndex;
|
||||
|
||||
@@ -1,310 +1,353 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_prev_3d_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxBoxSizer* bSizermain;
|
||||
bSizermain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerLeft;
|
||||
bSizerLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerScale;
|
||||
sbSizerScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerScale;
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerScale->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText1 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( xscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinXscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText2 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( yscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinYscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinYscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText3 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
zscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( zscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_spinZscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinZscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
sbSizerScale->Add( fgSizerScale, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerScale, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerRotation;
|
||||
sbSizerRotation = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerRotate;
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerRotate->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText11 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerRotate->Add( xrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinXrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText21 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText21->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerRotate->Add( yrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinYrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinYrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText31 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
zrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerRotate->Add( zrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_spinZrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinZrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
sbSizerRotation->Add( fgSizerRotate, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerRotation, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerOffset;
|
||||
sbSizerOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerOffset;
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerOffset->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText12 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText12->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( xoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinXoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText22 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText22->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( yoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinYoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinYoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
zoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( zoff, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_spinZoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinZoffset, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
sbSizerOffset->Add( fgSizerOffset, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerOffset, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerLeft, 0, 0, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRight;
|
||||
bSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticText* staticPreviewLabel;
|
||||
staticPreviewLabel = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
staticPreviewLabel->Wrap( -1 );
|
||||
staticPreviewLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||
|
||||
bSizerRight->Add( staticPreviewLabel, 0, wxLEFT, 15 );
|
||||
|
||||
m_SizerPanelView = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND|wxBOTTOM, 8 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerRight, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
wxBoxSizer* bSizer3DButtons;
|
||||
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 0, wxEXPAND|wxTOP, 4 );
|
||||
|
||||
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
m_bpvISO->SetToolTip( _("Change to isometric perspective") );
|
||||
|
||||
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvLeft, 0, 0, 5 );
|
||||
|
||||
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvRight, 0, 0, 5 );
|
||||
|
||||
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvFront, 0, 0, 5 );
|
||||
|
||||
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvBack, 0, 0, 5 );
|
||||
|
||||
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvTop, 0, 0, 5 );
|
||||
|
||||
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
bSizer3DButtons->Add( m_bpvBottom, 0, 0, 5 );
|
||||
|
||||
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
|
||||
m_bpUpdate->SetToolTip( _("Reload board and 3D models") );
|
||||
|
||||
bSizer3DButtons->Add( m_bpUpdate, 0, wxTOP, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizer3DButtons, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizermain );
|
||||
this->Layout();
|
||||
bSizermain->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
xscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
xscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinXscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
yscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
yscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinYscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
zscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
zscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinZscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
xrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
xrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinXrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
yrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
yrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinYrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
zrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
zrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinZrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
xoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
xoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinXoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
yoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
yoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinYoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
zoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
zoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvBack->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpvBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
m_bpUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_PREV_3D_BASE::~PANEL_PREV_3D_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
xscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
xscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinXscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
yscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
yscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinYscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
zscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
zscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinZscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
xrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
xrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinXrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
yrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
yrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinYrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
zrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
zrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinZrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
xoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
xoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
yoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
yoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
zoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
zoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvBack->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpvBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
m_bpUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jan 12 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_prev_3d_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxBoxSizer* bSizermain;
|
||||
bSizermain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerLeft;
|
||||
bSizerLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerScale;
|
||||
bSizerScale = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Scale"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextScale->Wrap( -1 );
|
||||
bSizerScale->Add( m_staticTextScale, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizerScale;
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerScale->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xscale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( xscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXscale = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinXscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yscale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( yscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 );
|
||||
|
||||
m_spinYscale = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinYscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zscale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( zscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_spinZscale = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerScale->Add( m_spinZscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerScale->Add( fgSizerScale, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( bSizerScale, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRotation;
|
||||
bSizerRotation = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextRot = new wxStaticText( this, wxID_ANY, _("Rotation (degrees)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRot->Wrap( -1 );
|
||||
bSizerRotation->Add( m_staticTextRot, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizerRotate;
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerRotate->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText11 = new wxStaticText( this, wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xrot = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !xrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
xrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
xrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( xrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXrot = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinXrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText21 = new wxStaticText( this, wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText21->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yrot = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !yrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
yrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
yrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( yrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 );
|
||||
|
||||
m_spinYrot = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinYrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText31 = new wxStaticText( this, wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zrot = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !zrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
zrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
zrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( zrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_spinZrot = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerRotate->Add( m_spinZrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerRotation->Add( fgSizerRotate, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( bSizerRotation, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerOffset;
|
||||
bSizerOffset = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextOffset = new wxStaticText( this, wxID_ANY, _("Offset"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOffset->Wrap( -1 );
|
||||
bSizerOffset->Add( m_staticTextOffset, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizerOffset;
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerOffset->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText12 = new wxStaticText( this, wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText12->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xoff = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( xoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinXoffset = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinXoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText22 = new wxStaticText( this, wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText22->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yoff = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( yoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 );
|
||||
|
||||
m_spinYoffset = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinYoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( this, wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zoff = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( zoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_spinZoffset = new wxSpinButton( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
|
||||
fgSizerOffset->Add( m_spinZoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizerOffset->Add( fgSizerOffset, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
|
||||
|
||||
|
||||
bSizerLeft->Add( bSizerOffset, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerLeft, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRight;
|
||||
bSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_SizerPanelView = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer3DButtons;
|
||||
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_fgSizerButtons = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
m_fgSizerButtons->AddGrowableCol( 0 );
|
||||
m_fgSizerButtons->AddGrowableCol( 1 );
|
||||
m_fgSizerButtons->AddGrowableCol( 2 );
|
||||
m_fgSizerButtons->AddGrowableCol( 3 );
|
||||
m_fgSizerButtons->SetFlexibleDirection( wxBOTH );
|
||||
m_fgSizerButtons->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_bpvISO->SetToolTip( _("Change to isometric perspective") );
|
||||
|
||||
m_fgSizerButtons->Add( m_bpvISO, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvLeft, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvFront, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvTop, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_bpUpdate->SetToolTip( _("Reload board and 3D models") );
|
||||
|
||||
m_fgSizerButtons->Add( m_bpUpdate, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvRight, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvBack, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvBottom, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( m_fgSizerButtons, 6, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizer3DButtons, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerRight, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizermain );
|
||||
this->Layout();
|
||||
bSizermain->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
xscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
xscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinXscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
yscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
yscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinYscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
zscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
zscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinZscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
xrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
xrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinXrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
yrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
yrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinYrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
zrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
zrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinZrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
xoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
xoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinXoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
yoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
yoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinYoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
zoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
zoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvBack->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_PREV_3D_BASE::~PANEL_PREV_3D_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
xscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
xscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinXscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
yscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
yscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinYscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
zscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
|
||||
zscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this );
|
||||
m_spinZscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this );
|
||||
xrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
xrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinXrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
yrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
yrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinYrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
zrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this );
|
||||
zrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this );
|
||||
m_spinZrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this );
|
||||
xoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
xoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
yoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
yoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
zoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this );
|
||||
zoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this );
|
||||
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvBack->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,107 +1,110 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEL_PREV_3D_BASE_H__
|
||||
#define __PANEL_PREV_3D_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/spinbutt.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_PREV_3D_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_PREV_3D_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* xscale;
|
||||
wxSpinButton* m_spinXscale;
|
||||
wxStaticText* m_staticText2;
|
||||
wxTextCtrl* yscale;
|
||||
wxSpinButton* m_spinYscale;
|
||||
wxStaticText* m_staticText3;
|
||||
wxTextCtrl* zscale;
|
||||
wxSpinButton* m_spinZscale;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* xrot;
|
||||
wxSpinButton* m_spinXrot;
|
||||
wxStaticText* m_staticText21;
|
||||
wxTextCtrl* yrot;
|
||||
wxSpinButton* m_spinYrot;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* zrot;
|
||||
wxSpinButton* m_spinZrot;
|
||||
wxStaticText* m_staticText12;
|
||||
wxTextCtrl* xoff;
|
||||
wxSpinButton* m_spinXoffset;
|
||||
wxStaticText* m_staticText22;
|
||||
wxSpinButton* m_spinYoffset;
|
||||
wxStaticText* m_staticText32;
|
||||
wxTextCtrl* zoff;
|
||||
wxSpinButton* m_spinZoffset;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
wxBitmapButton* m_bpvLeft;
|
||||
wxBitmapButton* m_bpvRight;
|
||||
wxBitmapButton* m_bpvFront;
|
||||
wxBitmapButton* m_bpvBack;
|
||||
wxBitmapButton* m_bpvTop;
|
||||
wxBitmapButton* m_bpvBottom;
|
||||
wxBitmapButton* m_bpUpdate;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void updateOrientation( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementScale( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementScale( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onMouseWheelRot( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementRot( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementRot( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onMouseWheelOffset( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBack( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DTop( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBottom( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DUpdate( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxTextCtrl* yoff;
|
||||
|
||||
PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_PREV_3D_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__PANEL_PREV_3D_BASE_H__
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jan 12 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEL_PREV_3D_BASE_H__
|
||||
#define __PANEL_PREV_3D_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/spinbutt.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_PREV_3D_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_PREV_3D_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextScale;
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* xscale;
|
||||
wxSpinButton* m_spinXscale;
|
||||
wxStaticText* m_staticText2;
|
||||
wxTextCtrl* yscale;
|
||||
wxSpinButton* m_spinYscale;
|
||||
wxStaticText* m_staticText3;
|
||||
wxTextCtrl* zscale;
|
||||
wxSpinButton* m_spinZscale;
|
||||
wxStaticText* m_staticTextRot;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* xrot;
|
||||
wxSpinButton* m_spinXrot;
|
||||
wxStaticText* m_staticText21;
|
||||
wxTextCtrl* yrot;
|
||||
wxSpinButton* m_spinYrot;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* zrot;
|
||||
wxSpinButton* m_spinZrot;
|
||||
wxStaticText* m_staticTextOffset;
|
||||
wxStaticText* m_staticText12;
|
||||
wxTextCtrl* xoff;
|
||||
wxSpinButton* m_spinXoffset;
|
||||
wxStaticText* m_staticText22;
|
||||
wxSpinButton* m_spinYoffset;
|
||||
wxStaticText* m_staticText32;
|
||||
wxTextCtrl* zoff;
|
||||
wxSpinButton* m_spinZoffset;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
wxFlexGridSizer* m_fgSizerButtons;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
wxBitmapButton* m_bpvLeft;
|
||||
wxBitmapButton* m_bpvFront;
|
||||
wxBitmapButton* m_bpvTop;
|
||||
wxBitmapButton* m_bpUpdate;
|
||||
wxBitmapButton* m_bpvRight;
|
||||
wxBitmapButton* m_bpvBack;
|
||||
wxBitmapButton* m_bpvBottom;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void updateOrientation( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementScale( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementScale( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onMouseWheelRot( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementRot( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementRot( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onMouseWheelOffset( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onDecrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DTop( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DUpdate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBack( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBottom( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxTextCtrl* yoff;
|
||||
|
||||
PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_PREV_3D_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__PANEL_PREV_3D_BASE_H__
|
||||
|
||||
@@ -28,53 +28,69 @@
|
||||
* @file panel_prev_model.cpp
|
||||
*/
|
||||
|
||||
#include "panel_prev_model.h"
|
||||
|
||||
#include <3d_canvas/eda_3d_canvas.h>
|
||||
#include <common_ogl/cogl_att_list.h>
|
||||
#include <cstdlib>
|
||||
#include <limits.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <wx/valnum.h>
|
||||
#include <wx/tglbtn.h>
|
||||
|
||||
#include "project.h"
|
||||
#include "panel_prev_model.h"
|
||||
#include <class_board.h>
|
||||
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <dpi_scaling.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
|
||||
|
||||
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule,
|
||||
std::vector<MODULE_3D_SETTINGS> *aParentModelList ) :
|
||||
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
COLORS_DESIGN_SETTINGS *aColors,
|
||||
std::vector<MODULE_3D_SETTINGS> *aParentInfoList ) :
|
||||
PANEL_PREV_3D_BASE( aParent, wxID_ANY )
|
||||
{
|
||||
m_userUnits = aFrame->GetUserUnits();
|
||||
|
||||
initPanel();
|
||||
|
||||
// Initialize the color settings to draw the board and the footprint
|
||||
m_dummyBoard->SetColorsSettings( &aFrame->Settings().Colors() );
|
||||
if( aColors )
|
||||
m_dummyBoard->SetColorsSettings( aColors );
|
||||
else
|
||||
{
|
||||
static COLORS_DESIGN_SETTINGS defaultColors( FRAME_PCB_DISPLAY3D );
|
||||
m_dummyBoard->SetColorsSettings( &defaultColors );
|
||||
}
|
||||
|
||||
m_parentModelList = aParentModelList;
|
||||
if( NULL != aCacheManager )
|
||||
m_resolver = aCacheManager->GetResolver();
|
||||
|
||||
m_dummyModule = new MODULE( *aModule );
|
||||
m_dummyBoard->Add( m_dummyModule );
|
||||
m_parentInfoList = aParentInfoList;
|
||||
|
||||
m_dummyBoard->Add( (MODULE*)aModuleCopy );
|
||||
m_copyModule = aModuleCopy;
|
||||
|
||||
// Set 3d viewer configuration for preview
|
||||
m_settings3Dviewer = new CINFO3D_VISU();
|
||||
|
||||
// Create the 3D canvas
|
||||
m_previewPane = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ),
|
||||
m_dummyBoard, *m_settings3Dviewer,
|
||||
aFrame->Prj().Get3DCacheManager() );
|
||||
m_previewPane = new EDA_3D_CANVAS( this,
|
||||
COGL_ATT_LIST::GetAttributesList( true ),
|
||||
m_dummyBoard,
|
||||
*m_settings3Dviewer,
|
||||
aCacheManager );
|
||||
|
||||
loadCommonSettings();
|
||||
m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND );
|
||||
|
||||
m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
|
||||
m_previewPane->Connect( wxEVT_ENTER_WINDOW,
|
||||
wxMouseEventHandler( PANEL_PREV_3D::onEnterPreviewCanvas ),
|
||||
NULL, this );
|
||||
}
|
||||
|
||||
|
||||
PANEL_PREV_3D::~PANEL_PREV_3D()
|
||||
{
|
||||
m_previewPane->Disconnect( wxEVT_ENTER_WINDOW,
|
||||
wxMouseEventHandler( PANEL_PREV_3D::onEnterPreviewCanvas ),
|
||||
NULL, this );
|
||||
|
||||
delete m_settings3Dviewer;
|
||||
delete m_dummyBoard;
|
||||
delete m_previewPane;
|
||||
@@ -83,8 +99,10 @@ PANEL_PREV_3D::~PANEL_PREV_3D()
|
||||
|
||||
void PANEL_PREV_3D::initPanel()
|
||||
{
|
||||
m_resolver = NULL;
|
||||
currentModelFile.clear();
|
||||
m_dummyBoard = new BOARD();
|
||||
m_selected = -1;
|
||||
m_currentSelectedIdx = -1;
|
||||
|
||||
// Set the bitmap of 3D view buttons:
|
||||
m_bpvTop->SetBitmap( KiBitmap( axis3d_top_xpm ) );
|
||||
@@ -109,142 +127,323 @@ void PANEL_PREV_3D::initPanel()
|
||||
};
|
||||
|
||||
for( int ii = 0; ii < 9; ii++ )
|
||||
{
|
||||
spinButtonList[ii]->SetRange( INT_MIN, INT_MAX );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::loadCommonSettings()
|
||||
{
|
||||
wxCHECK_RET( m_previewPane, "Cannot load settings to null canvas" );
|
||||
|
||||
wxConfigBase& cmnCfg = *Pgm().CommonSettings();
|
||||
|
||||
{
|
||||
const DPI_SCALING dpi{ &cmnCfg, this };
|
||||
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
wxString units;
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
bool option;
|
||||
cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
|
||||
m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, option );
|
||||
case INCHES:
|
||||
units = _( "inches" );
|
||||
break;
|
||||
case MILLIMETRES:
|
||||
units = _( "mm" );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( !units.IsEmpty() )
|
||||
{
|
||||
units = wxString::Format( _( "Offset (%s)" ), units );
|
||||
m_staticTextOffset->SetLabel( units );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief rotationFromString
|
||||
* @brief checkRotation
|
||||
* Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION
|
||||
* aRotation will be normalized between -MAX_ROTATION and MAX_ROTATION
|
||||
* @param aRotation: in out parameter
|
||||
*/
|
||||
static double rotationFromString( const wxString& aValue )
|
||||
static void checkRotation( double& aRotation )
|
||||
{
|
||||
double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0;
|
||||
|
||||
if( rotation > MAX_ROTATION )
|
||||
if( aRotation > MAX_ROTATION )
|
||||
{
|
||||
int n = rotation / MAX_ROTATION;
|
||||
rotation -= MAX_ROTATION * n;
|
||||
int n = aRotation / MAX_ROTATION;
|
||||
aRotation -= MAX_ROTATION * n;
|
||||
}
|
||||
else if( rotation < -MAX_ROTATION )
|
||||
else if( aRotation < -MAX_ROTATION )
|
||||
{
|
||||
int n = -rotation / MAX_ROTATION;
|
||||
rotation += MAX_ROTATION * n;
|
||||
int n = -aRotation / MAX_ROTATION;
|
||||
aRotation += MAX_ROTATION * n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool validateFloatTextCtrl( wxTextCtrl* aTextCtrl )
|
||||
{
|
||||
if( aTextCtrl == NULL )
|
||||
return false;
|
||||
|
||||
if( aTextCtrl->GetLineLength(0) == 0 ) // This will skip the got and event with empty field
|
||||
return false;
|
||||
|
||||
if( aTextCtrl->GetLineLength(0) == 1 )
|
||||
{
|
||||
if( (aTextCtrl->GetLineText(0).compare( "." ) == 0) ||
|
||||
(aTextCtrl->GetLineText(0).compare( "," ) == 0) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return rotation;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
wxString PANEL_PREV_3D::formatScaleValue( double aValue )
|
||||
static void incrementTextCtrl( wxTextCtrl* aTextCtrl, double aInc, double aMinval, double aMaxval )
|
||||
{
|
||||
return wxString::Format( "%.4f", aValue );
|
||||
if( !validateFloatTextCtrl( aTextCtrl ) )
|
||||
return;
|
||||
|
||||
double curr_value = 0;
|
||||
|
||||
aTextCtrl->GetValue().ToDouble( &curr_value );
|
||||
curr_value += aInc;
|
||||
|
||||
if( curr_value > aMaxval )
|
||||
curr_value = aMaxval;
|
||||
|
||||
if( curr_value < aMinval )
|
||||
curr_value = aMinval;
|
||||
|
||||
aTextCtrl->SetValue( wxString::Format( "%.4f", curr_value ) );
|
||||
}
|
||||
|
||||
|
||||
wxString PANEL_PREV_3D::formatRotationValue( double aValue )
|
||||
void PANEL_PREV_3D::SetModelDataIdx( int idx, bool aReloadPreviewModule )
|
||||
{
|
||||
return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( DEGREES ) );
|
||||
}
|
||||
wxASSERT( m_parentInfoList != NULL );
|
||||
|
||||
|
||||
wxString PANEL_PREV_3D::formatOffsetValue( double aValue )
|
||||
{
|
||||
// Convert from internal units (mm) to user units
|
||||
if( m_userUnits == INCHES )
|
||||
aValue /= 25.4f;
|
||||
|
||||
return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::SetSelectedModel( int idx )
|
||||
{
|
||||
if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
|
||||
if( m_parentInfoList && (idx >= 0) )
|
||||
{
|
||||
m_selected = idx;
|
||||
const MODULE_3D_SETTINGS& modelInfo = m_parentModelList->at( (unsigned) m_selected );
|
||||
wxASSERT( (unsigned int)idx < (*m_parentInfoList).size() );
|
||||
|
||||
// Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
|
||||
// don't want to generate wxEVT_GRID_CELL_CHANGED events.
|
||||
if( (unsigned int)idx < (*m_parentInfoList).size() )
|
||||
{
|
||||
m_currentSelectedIdx = -1; // In case that we receive events on the
|
||||
// next updates, it will set first an
|
||||
// invalid selection
|
||||
|
||||
xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
|
||||
yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
|
||||
zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
|
||||
const MODULE_3D_SETTINGS *aModel = (const MODULE_3D_SETTINGS *)&((*m_parentInfoList)[idx]);
|
||||
|
||||
xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
|
||||
yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
|
||||
zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
|
||||
xscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.x ) );
|
||||
yscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.y ) );
|
||||
zscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.z ) );
|
||||
|
||||
xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
|
||||
yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
|
||||
zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
|
||||
xrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.x ) );
|
||||
yrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.y ) );
|
||||
zrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.z ) );
|
||||
|
||||
// Convert from internal units (mm) to user units
|
||||
|
||||
double scaler = 1;
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
scaler = 1.0f;
|
||||
break;
|
||||
case INCHES:
|
||||
scaler = 25.4f;
|
||||
break;
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
}
|
||||
|
||||
xoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.x / scaler ) );
|
||||
yoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.y / scaler ) );
|
||||
zoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.z / scaler ) );
|
||||
|
||||
UpdateModelName( aModel->m_Filename );
|
||||
|
||||
if( aReloadPreviewModule && m_previewPane )
|
||||
{
|
||||
updateListOnModelCopy();
|
||||
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Request_refresh();
|
||||
}
|
||||
|
||||
m_currentSelectedIdx = idx;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::ResetModelData( bool aReloadPreviewModule )
|
||||
{
|
||||
m_currentSelectedIdx = -1;
|
||||
|
||||
xscale->SetValue( wxString::FromDouble( 1.0 ) );
|
||||
yscale->SetValue( wxString::FromDouble( 1.0 ) );
|
||||
zscale->SetValue( wxString::FromDouble( 1.0 ) );
|
||||
|
||||
xrot->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
yrot->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
zrot->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
|
||||
xoff->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
yoff->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
zoff->SetValue( wxString::FromDouble( 0.0 ) );
|
||||
|
||||
// This will update the model on the preview board with the current list of 3d shapes
|
||||
if( aReloadPreviewModule )
|
||||
{
|
||||
updateListOnModelCopy();
|
||||
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Request_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if( m_previewPane )
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
|
||||
{
|
||||
bool newModel = false;
|
||||
|
||||
m_modelInfo.m_Filename = aModelName;
|
||||
|
||||
// if the model name is a directory simply clear the current model
|
||||
if( aModelName.empty() || wxFileName::DirExists( aModelName ) )
|
||||
{
|
||||
currentModelFile.clear();
|
||||
m_modelInfo.m_Filename.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selected = -1;
|
||||
wxString newModelFile;
|
||||
|
||||
xscale->ChangeValue( wxEmptyString );
|
||||
yscale->ChangeValue( wxEmptyString );
|
||||
zscale->ChangeValue( wxEmptyString );
|
||||
if( m_resolver )
|
||||
newModelFile = m_resolver->ResolvePath( aModelName );
|
||||
|
||||
xrot->ChangeValue( wxEmptyString );
|
||||
yrot->ChangeValue( wxEmptyString );
|
||||
zrot->ChangeValue( wxEmptyString );
|
||||
if( !newModelFile.empty() && newModelFile.Cmp( currentModelFile ) )
|
||||
newModel = true;
|
||||
|
||||
xoff->ChangeValue( wxEmptyString );
|
||||
yoff->ChangeValue( wxEmptyString );
|
||||
zoff->ChangeValue( wxEmptyString );
|
||||
currentModelFile = newModelFile;
|
||||
}
|
||||
|
||||
if( currentModelFile.empty() || newModel )
|
||||
{
|
||||
updateListOnModelCopy();
|
||||
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
if( currentModelFile.empty() )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_previewPane )
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
if( m_previewPane )
|
||||
m_previewPane->SetFocus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
|
||||
{
|
||||
if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
|
||||
wxTextCtrl *textCtrl = (wxTextCtrl *)event.GetEventObject();
|
||||
|
||||
if( textCtrl == NULL )
|
||||
return;
|
||||
|
||||
if( textCtrl->GetLineLength(0) == 0 ) // This will skip the got and event with empty field
|
||||
return;
|
||||
|
||||
if( textCtrl->GetLineLength(0) == 1 )
|
||||
if( (textCtrl->GetLineText(0).compare( "." ) == 0) ||
|
||||
(textCtrl->GetLineText(0).compare( "," ) == 0) )
|
||||
return;
|
||||
|
||||
SGPOINT scale;
|
||||
SGPOINT rotation;
|
||||
SGPOINT offset;
|
||||
|
||||
getOrientationVars( scale, rotation, offset );
|
||||
|
||||
m_modelInfo.m_Scale.x = scale.x;
|
||||
m_modelInfo.m_Scale.y = scale.y;
|
||||
m_modelInfo.m_Scale.z = scale.z;
|
||||
m_modelInfo.m_Offset.x = offset.x;
|
||||
m_modelInfo.m_Offset.y = offset.y;
|
||||
m_modelInfo.m_Offset.z = offset.z;
|
||||
m_modelInfo.m_Rotation.x = rotation.x;
|
||||
m_modelInfo.m_Rotation.y = rotation.y;
|
||||
m_modelInfo.m_Rotation.z = rotation.z;
|
||||
|
||||
if( m_currentSelectedIdx >= 0 )
|
||||
{
|
||||
// Write settings back to the parent
|
||||
MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
|
||||
// This will update the parent list with the new data
|
||||
(*m_parentInfoList)[m_currentSelectedIdx] = m_modelInfo;
|
||||
|
||||
modelInfo->m_Scale.x = DoubleValueFromString( UNSCALED_UNITS, xscale->GetValue() );
|
||||
modelInfo->m_Scale.y = DoubleValueFromString( UNSCALED_UNITS, yscale->GetValue() );
|
||||
modelInfo->m_Scale.z = DoubleValueFromString( UNSCALED_UNITS, zscale->GetValue() );
|
||||
// It will update the copy model in the preview board
|
||||
updateListOnModelCopy();
|
||||
|
||||
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
||||
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
||||
modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
|
||||
|
||||
modelInfo->m_Offset.x = DoubleValueFromString( m_userUnits, xoff->GetValue() ) / IU_PER_MM;
|
||||
modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
|
||||
modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
|
||||
|
||||
// Update the dummy module for the preview
|
||||
UpdateDummyModule( false );
|
||||
// Since the OpenGL render does not need to be reloaded to update the
|
||||
// shapes position, we just request to redraw again the canvas
|
||||
if( m_previewPane )
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::doIncrementScale( wxSpinEvent& event, double aSign )
|
||||
void PANEL_PREV_3D::onIncrementRot( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
wxTextCtrl * textCtrl = xrot;
|
||||
|
||||
if( spinCtrl == m_spinYrot )
|
||||
textCtrl = yrot;
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
incrementTextCtrl( textCtrl, ROTATION_INCREMENT, -MAX_ROTATION, MAX_ROTATION );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::onDecrementRot( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
wxTextCtrl * textCtrl = xrot;
|
||||
|
||||
if( spinCtrl == m_spinYrot )
|
||||
textCtrl = yrot;
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
incrementTextCtrl( textCtrl, -ROTATION_INCREMENT, -MAX_ROTATION, MAX_ROTATION );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::onIncrementScale( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
@@ -255,37 +454,26 @@ void PANEL_PREV_3D::doIncrementScale( wxSpinEvent& event, double aSign )
|
||||
else if( spinCtrl == m_spinZscale )
|
||||
textCtrl = zscale;
|
||||
|
||||
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( SCALE_INCREMENT * aSign );
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_SCALE );
|
||||
|
||||
textCtrl->SetValue( formatScaleValue( curr_value ) );
|
||||
incrementTextCtrl( textCtrl, SCALE_INCREMENT, 1/MAX_SCALE, MAX_SCALE );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
|
||||
void PANEL_PREV_3D::onDecrementScale( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
|
||||
wxTextCtrl* textCtrl = xrot;
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
if( spinCtrl == m_spinYrot )
|
||||
textCtrl = yrot;
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
wxTextCtrl * textCtrl = xscale;
|
||||
|
||||
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
if( spinCtrl == m_spinYscale )
|
||||
textCtrl = yscale;
|
||||
else if( spinCtrl == m_spinZscale )
|
||||
textCtrl = zscale;
|
||||
|
||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_ROTATION );
|
||||
|
||||
textCtrl->SetValue( formatRotationValue( curr_value ) );
|
||||
incrementTextCtrl( textCtrl, -SCALE_INCREMENT, 1/MAX_SCALE, MAX_SCALE );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::doIncrementOffset( wxSpinEvent& event, double aSign )
|
||||
void PANEL_PREV_3D::onIncrementOffset( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
@@ -298,16 +486,30 @@ void PANEL_PREV_3D::doIncrementOffset( wxSpinEvent& event, double aSign )
|
||||
|
||||
double step = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( m_userUnits == INCHES )
|
||||
if( g_UserUnit == INCHES )
|
||||
step = OFFSET_INCREMENT_MIL/1000.0;
|
||||
|
||||
double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
|
||||
incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET );
|
||||
}
|
||||
|
||||
curr_value += ( step * aSign );
|
||||
curr_value = std::max( -MAX_OFFSET, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_OFFSET );
|
||||
|
||||
textCtrl->SetValue( formatOffsetValue( curr_value ) );
|
||||
void PANEL_PREV_3D::onDecrementOffset( wxSpinEvent& event )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
wxTextCtrl * textCtrl = xoff;
|
||||
|
||||
if( spinCtrl == m_spinYoffset )
|
||||
textCtrl = yoff;
|
||||
else if( spinCtrl == m_spinZoffset )
|
||||
textCtrl = zoff;
|
||||
|
||||
double step = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( g_UserUnit == INCHES )
|
||||
step = OFFSET_INCREMENT_MIL/1000.0;
|
||||
|
||||
incrementTextCtrl( textCtrl, -step, -MAX_OFFSET, MAX_OFFSET );
|
||||
}
|
||||
|
||||
|
||||
@@ -323,13 +525,7 @@ void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event )
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() );
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_SCALE );
|
||||
|
||||
textCtrl->SetValue( formatScaleValue( curr_value ) );
|
||||
incrementTextCtrl( textCtrl, step, 1/MAX_SCALE, MAX_SCALE );
|
||||
}
|
||||
|
||||
|
||||
@@ -337,6 +533,8 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
wxKeyboardState kbdState;
|
||||
|
||||
double step = ROTATION_INCREMENT_WHEEL;
|
||||
|
||||
if( event.ShiftDown( ) )
|
||||
@@ -345,13 +543,7 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event )
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_ROTATION );
|
||||
|
||||
textCtrl->SetValue( formatRotationValue( curr_value ) );
|
||||
incrementTextCtrl( textCtrl, step, -MAX_ROTATION, MAX_ROTATION );
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +556,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
|
||||
if( event.ShiftDown( ) )
|
||||
step = OFFSET_INCREMENT_MM_FINE;
|
||||
|
||||
if( m_userUnits == INCHES )
|
||||
if( g_UserUnit == INCHES )
|
||||
{
|
||||
step = OFFSET_INCREMENT_MIL/1000.0;
|
||||
if( event.ShiftDown( ) )
|
||||
@@ -374,31 +566,128 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( -MAX_OFFSET, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_OFFSET );
|
||||
|
||||
textCtrl->SetValue( formatOffsetValue( curr_value ) );
|
||||
incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::UpdateDummyModule( bool aReloadRequired )
|
||||
void PANEL_PREV_3D::getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset )
|
||||
{
|
||||
m_dummyModule->Models().clear();
|
||||
|
||||
for( size_t i = 0; i < m_parentModelList->size(); ++i )
|
||||
if( NULL == xscale || NULL == yscale || NULL == zscale
|
||||
|| NULL == xrot || NULL == yrot || NULL == zrot
|
||||
|| NULL == xoff || NULL == yoff || NULL == zoff )
|
||||
{
|
||||
if( m_parentModelList->at( i ).m_Preview )
|
||||
return;
|
||||
}
|
||||
|
||||
xscale->GetValue().ToDouble( &aScale.x );
|
||||
yscale->GetValue().ToDouble( &aScale.y );
|
||||
zscale->GetValue().ToDouble( &aScale.z );
|
||||
|
||||
xrot->GetValue().ToDouble( &aRotation.x );
|
||||
yrot->GetValue().ToDouble( &aRotation.y );
|
||||
zrot->GetValue().ToDouble( &aRotation.z );
|
||||
|
||||
checkRotation( aRotation.x );
|
||||
checkRotation( aRotation.y );
|
||||
checkRotation( aRotation.z );
|
||||
|
||||
xoff->GetValue().ToDouble( &aOffset.x );
|
||||
yoff->GetValue().ToDouble( &aOffset.y );
|
||||
zoff->GetValue().ToDouble( &aOffset.z );
|
||||
|
||||
// Convert from user units to internal units (mm)
|
||||
|
||||
double scaler = 1.0f;
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
scaler = 1.0f;
|
||||
break;
|
||||
case INCHES:
|
||||
scaler = 25.4f;
|
||||
break;
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
}
|
||||
|
||||
aOffset.x *= scaler;
|
||||
aOffset.y *= scaler;
|
||||
aOffset.z *= scaler;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_PREV_3D::ValidateWithMessage( wxString& aErrorMessage )
|
||||
{
|
||||
bool invalidScale = false;
|
||||
|
||||
for( unsigned int idx = 0; idx < m_parentInfoList->size(); ++idx )
|
||||
{
|
||||
wxString msg;
|
||||
bool addError = false;
|
||||
MODULE_3D_SETTINGS& s3dshape = (*m_parentInfoList)[idx];
|
||||
|
||||
SGPOINT scale;
|
||||
scale.x = s3dshape.m_Scale.x;
|
||||
scale.y = s3dshape.m_Scale.y;
|
||||
scale.z = s3dshape.m_Scale.z;
|
||||
|
||||
if( 1/MAX_SCALE > scale.x || MAX_SCALE < scale.x )
|
||||
{
|
||||
m_dummyModule->Models().insert( m_dummyModule->Models().end(),
|
||||
m_parentModelList->at( i ) );
|
||||
invalidScale = true;
|
||||
addError = true;
|
||||
msg += _( "Invalid X scale" );
|
||||
}
|
||||
|
||||
if( 1/MAX_SCALE > scale.y || MAX_SCALE < scale.y )
|
||||
{
|
||||
invalidScale = true;
|
||||
addError = true;
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
msg += "\n";
|
||||
|
||||
msg += _( "Invalid Y scale" );
|
||||
}
|
||||
|
||||
if( 1/MAX_SCALE > scale.z || MAX_SCALE < scale.z )
|
||||
{
|
||||
invalidScale = true;
|
||||
addError = true;
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
msg += "\n";
|
||||
|
||||
msg += _( "Invalid Z scale" );
|
||||
}
|
||||
|
||||
if( addError )
|
||||
{
|
||||
msg.Prepend( s3dshape.m_Filename + "\n" );
|
||||
|
||||
if( !aErrorMessage.IsEmpty() )
|
||||
aErrorMessage += "\n\n";
|
||||
|
||||
aErrorMessage += msg;
|
||||
}
|
||||
}
|
||||
|
||||
if( aReloadRequired )
|
||||
m_previewPane->ReloadRequest();
|
||||
if( !aErrorMessage.IsEmpty() )
|
||||
{
|
||||
aErrorMessage += "\n\n";
|
||||
aErrorMessage += wxString::Format( "Min value = %.4f and max value = %.4f",
|
||||
1/MAX_SCALE, MAX_SCALE );
|
||||
}
|
||||
|
||||
m_previewPane->Request_refresh();
|
||||
return invalidScale == false;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::updateListOnModelCopy()
|
||||
{
|
||||
auto draw3D = &m_copyModule->Models();
|
||||
draw3D->clear();
|
||||
draw3D->insert( draw3D->end(), m_parentInfoList->begin(), m_parentInfoList->end() );
|
||||
}
|
||||
|
||||
@@ -47,23 +47,23 @@
|
||||
#define MAX_ROTATION 180.0
|
||||
#define MAX_OFFSET 1000.0
|
||||
|
||||
#define SCALE_INCREMENT_FINE 0.02
|
||||
#define SCALE_INCREMENT 0.1
|
||||
#define SCALE_INCREMENT_FINE 0.02
|
||||
#define SCALE_INCREMENT 0.1
|
||||
|
||||
#define ROTATION_INCREMENT 5 // in degrees, for spin button command
|
||||
#define ROTATION_INCREMENT_WHEEL 15 // in degrees, for mouse wheel command
|
||||
#define ROTATION_INCREMENT_WHEEL_FINE 1 // in degrees, for mouse wheel command
|
||||
|
||||
#define OFFSET_INCREMENT_MM 0.5
|
||||
#define OFFSET_INCREMENT_MM_FINE 0.1
|
||||
#define OFFSET_INCREMENT_MM 0.5
|
||||
#define OFFSET_INCREMENT_MM_FINE 0.1
|
||||
|
||||
#define OFFSET_INCREMENT_MIL 25.0
|
||||
#define OFFSET_INCREMENT_MIL_FINE 5.0
|
||||
#define OFFSET_INCREMENT_MIL 25.0
|
||||
#define OFFSET_INCREMENT_MIL_FINE 5.0
|
||||
|
||||
|
||||
// Declared classes to create pointers
|
||||
class S3D_CACHE;
|
||||
class FILENAME_RESOLVER;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
class BOARD;
|
||||
class CINFO3D_VISU;
|
||||
class MODULE;
|
||||
@@ -72,32 +72,42 @@ class COLORS_DESIGN_SETTINGS;
|
||||
class PANEL_PREV_3D: public PANEL_PREV_3D_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule,
|
||||
std::vector<MODULE_3D_SETTINGS> *aParentModelList );
|
||||
PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
COLORS_DESIGN_SETTINGS *aColors,
|
||||
std::vector<MODULE_3D_SETTINGS> *aParentInfoList = NULL );
|
||||
|
||||
~PANEL_PREV_3D();
|
||||
|
||||
private:
|
||||
EDA_3D_CANVAS* m_previewPane;
|
||||
CINFO3D_VISU* m_settings3Dviewer;
|
||||
wxString currentModelFile; ///< Used to check if the model file was changed
|
||||
S3D_FILENAME_RESOLVER *m_resolver; ///< Used to get the full path name
|
||||
|
||||
BOARD* m_dummyBoard;
|
||||
MODULE* m_dummyModule;
|
||||
/// The 3D canvas
|
||||
EDA_3D_CANVAS *m_previewPane;
|
||||
|
||||
std::vector<MODULE_3D_SETTINGS>* m_parentModelList;
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
/// A dummy board used to store the copy moduled
|
||||
BOARD *m_dummyBoard;
|
||||
|
||||
EDA_UNITS_T m_userUnits;
|
||||
/// The settings that will be used for this 3D viewer canvas
|
||||
CINFO3D_VISU *m_settings3Dviewer;
|
||||
|
||||
/// A pointer to a new copy of the original module
|
||||
MODULE *m_copyModule;
|
||||
|
||||
/// A pointer to the parent MODULE_3D_SETTINGS list that we will use to copy to the preview module
|
||||
std::vector<MODULE_3D_SETTINGS> *m_parentInfoList;
|
||||
|
||||
/// The current selected index of the MODULE_3D_SETTINGS list
|
||||
int m_currentSelectedIdx;
|
||||
|
||||
/// Current MODULE_3D_SETTINGS that is being edited
|
||||
MODULE_3D_SETTINGS m_modelInfo;
|
||||
|
||||
// Methods of the class
|
||||
private:
|
||||
void initPanel();
|
||||
|
||||
/**
|
||||
* Load 3D relevant settings from the user configuration
|
||||
*/
|
||||
void loadCommonSettings();
|
||||
|
||||
/**
|
||||
* @brief updateOrientation - it will receive the events from editing the fields
|
||||
* @param event
|
||||
@@ -108,38 +118,32 @@ private:
|
||||
void onMouseWheelRot( wxMouseEvent& event ) override;
|
||||
void onMouseWheelOffset( wxMouseEvent& event ) override;
|
||||
|
||||
void onIncrementRot( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementRotation( event, 1.0 );
|
||||
}
|
||||
void onDecrementRot( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementRotation( event, -1.0 );
|
||||
}
|
||||
void onIncrementScale( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementScale( event, 1.0 );
|
||||
}
|
||||
void onDecrementScale( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementScale( event, -1.0 );
|
||||
}
|
||||
void onIncrementOffset( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementOffset( event, 1.0 );
|
||||
}
|
||||
void onDecrementOffset( wxSpinEvent& event ) override
|
||||
{
|
||||
doIncrementOffset( event, -1.0 );
|
||||
}
|
||||
void onIncrementRot( wxSpinEvent& event ) override;
|
||||
void onDecrementRot( wxSpinEvent& event ) override;
|
||||
void onIncrementScale( wxSpinEvent& event ) override;
|
||||
void onDecrementScale( wxSpinEvent& event ) override;
|
||||
void onIncrementOffset( wxSpinEvent& event ) override;
|
||||
void onDecrementOffset( wxSpinEvent& event ) override;
|
||||
|
||||
void doIncrementScale( wxSpinEvent& aEvent, double aSign );
|
||||
void doIncrementRotation( wxSpinEvent& aEvent, double aSign );
|
||||
void doIncrementOffset( wxSpinEvent& aEvent, double aSign );
|
||||
/**
|
||||
* @brief getOrientationVars - gets the transformation from entries and validate it
|
||||
* @param aScale: output scale var
|
||||
* @param aRotation: output rotation var
|
||||
* @param aOffset: output offset var
|
||||
*/
|
||||
void getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset );
|
||||
|
||||
wxString formatScaleValue( double aValue );
|
||||
wxString formatRotationValue( double aValue );
|
||||
wxString formatOffsetValue( double aValue );
|
||||
/**
|
||||
* @brief updateListOnModelCopy - copy the current shape list to the copy of module that is on
|
||||
* the preview dummy board
|
||||
*/
|
||||
void updateListOnModelCopy();
|
||||
|
||||
|
||||
void onEnterPreviewCanvas( wxMouseEvent& event )
|
||||
{
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
|
||||
void View3DISO( wxCommandEvent& event ) override
|
||||
{
|
||||
@@ -185,16 +189,33 @@ private:
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief SetModelDataIdx - Sets the currently selected index in the model list so that
|
||||
* the scale/rotation/offset controls can be updated.
|
||||
* @brief SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
|
||||
* So we will update our values to edit based on the index on that list.
|
||||
* @param idx - The index that was selected
|
||||
* @param aReloadPreviewModule: if need to update the preview module
|
||||
*/
|
||||
void SetSelectedModel( int idx );
|
||||
void SetModelDataIdx( int idx, bool aReloadPreviewModule = false );
|
||||
|
||||
/**
|
||||
* @brief UpdateModelInfoList - copy shapes from the current shape list which are flagged
|
||||
* for preview to the copy of module that is on the preview dummy board
|
||||
* @brief ResetModelData - Clear the values and reload the preview board
|
||||
* @param aReloadPreviewModule: if need to update the preview module
|
||||
*/
|
||||
void UpdateDummyModule( bool aRelaodRequired = true );
|
||||
void ResetModelData( bool aReloadPreviewModule = false );
|
||||
|
||||
void UpdateModelName( wxString const& aModel );
|
||||
|
||||
/**
|
||||
* @brief verify X,Y and Z scale factors are acceptable (> 0.001 and < 1000.0)
|
||||
* @return false if one (or more) value is not acceptable.
|
||||
* @param aErrorMessage is a wxString to store error messages, if any
|
||||
*/
|
||||
bool ValidateWithMessage( wxString& aErrorMessage );
|
||||
|
||||
bool Validate() override
|
||||
{
|
||||
wxString temp;
|
||||
return ValidateWithMessage(temp);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PANEL_PREV_MODEL_H
|
||||
|
||||
@@ -358,19 +358,22 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex )
|
||||
|
||||
void S3D::INIT_SMATERIAL( SMATERIAL& aMaterial )
|
||||
{
|
||||
aMaterial = {};
|
||||
memset( &aMaterial, 0, sizeof( aMaterial ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void S3D::INIT_SMESH( SMESH& aMesh )
|
||||
{
|
||||
aMesh = {};
|
||||
memset( &aMesh, 0, sizeof( aMesh ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void S3D::INIT_S3DMODEL( S3DMODEL& aModel )
|
||||
{
|
||||
aModel = {};
|
||||
memset( &aModel, 0, sizeof( aModel ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file str_rsort.h
|
||||
* provides a wxString sorting functino which works from the
|
||||
* end of the string towards the beginning
|
||||
*/
|
||||
|
||||
#ifndef STR_RSORT_H
|
||||
#define STR_RSORT_H
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
namespace S3D
|
||||
{
|
||||
|
||||
struct rsort_wxString
|
||||
{
|
||||
bool operator() (const wxString& strA, const wxString& strB ) const
|
||||
{
|
||||
// sort a wxString using the reverse character order; for 3d model
|
||||
// filenames this will typically be a much faster operation than
|
||||
// a normal alphabetic sort
|
||||
wxString::const_reverse_iterator sA = strA.rbegin();
|
||||
wxString::const_reverse_iterator eA = strA.rend();
|
||||
|
||||
wxString::const_reverse_iterator sB = strB.rbegin();
|
||||
wxString::const_reverse_iterator eB = strB.rend();
|
||||
|
||||
if( strA.empty() )
|
||||
{
|
||||
if( strB.empty() )
|
||||
return false;
|
||||
|
||||
// note: this rule implies that a null string is first in the sort order
|
||||
return true;
|
||||
}
|
||||
|
||||
if( strB.empty() )
|
||||
return false;
|
||||
|
||||
while( sA != eA && sB != eB )
|
||||
{
|
||||
if( (*sA) == (*sB) )
|
||||
{
|
||||
++sA;
|
||||
++sB;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( (*sA) < (*sB) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if( sB == eB )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // end NAMESPACE
|
||||
|
||||
#endif // STR_RSORT_H
|
||||
@@ -256,8 +256,7 @@ unsigned int CINFO3D_VISU::GetNrSegmentsCircle( int aDiameterBIU ) const
|
||||
{
|
||||
wxASSERT( aDiameterBIU > 0 );
|
||||
|
||||
// Require at least 3 segments for a circle
|
||||
return std::max( GetArcToSegmentCount( aDiameterBIU / 2, ARC_HIGH_DEF, 360.0 ), 3 );
|
||||
return GetArcToSegmentCount( aDiameterBIU / 2, ARC_HIGH_DEF, 360.0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -463,6 +462,9 @@ void CINFO3D_VISU::createBoardPolygon()
|
||||
wxLogMessage( errmsg );
|
||||
}
|
||||
|
||||
// Be sure the polygon is strictly simple to avoid issues.
|
||||
m_board_poly.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits );
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
|
||||
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
|
||||
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
|
||||
|
||||
#include <openmp_mutex.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_pad.h>
|
||||
@@ -418,24 +418,27 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||
*aPad ) );
|
||||
|
||||
// Add the PAD contours
|
||||
// Round segments cannot have 0-length elements, so we approximate them
|
||||
// as a small circle
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||
{
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||
aClearanceValue.x * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||
corners3DU[i & 3],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
}
|
||||
// !TODO: check the corners because it cannot add
|
||||
// roundsegments that are in the same start and end position
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
|
||||
corners3DU[1],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
|
||||
corners3DU[2],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
|
||||
corners3DU[3],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
|
||||
corners3DU[0],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -470,24 +473,27 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||
*aPad ) );
|
||||
|
||||
// Add the PAD contours
|
||||
// Round segments cannot have 0-length elements, so we approximate them
|
||||
// as a small circle
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||
{
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||
rounding_radius * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||
corners3DU[i & 3],
|
||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
}
|
||||
// !TODO: check the corners because it cannot add
|
||||
// roundsegments that are in the same start and end position
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
|
||||
corners3DU[1],
|
||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
|
||||
corners3DU[2],
|
||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
|
||||
corners3DU[3],
|
||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
|
||||
corners3DU[0],
|
||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -500,6 +506,10 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||
if( aClearanceValue.x )
|
||||
polyList.Inflate( aClearanceValue.x, 32 );
|
||||
|
||||
// This convert the poly in outline and holes
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
// Add the PAD polygon
|
||||
Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aPad );
|
||||
|
||||
@@ -752,9 +762,8 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
|
||||
PCB_LAYER_ID aLayerId,
|
||||
int aClearanceValue )
|
||||
{
|
||||
// The full width of the lines to create
|
||||
// The extra 1 protects the inner/outer radius values from degeneracy
|
||||
const int linewidth = aDrawSegment->GetWidth() + (2 * aClearanceValue) + 1;
|
||||
// The full width of the lines to create:
|
||||
const int linewidth = aDrawSegment->GetWidth() + (2 * aClearanceValue);
|
||||
|
||||
switch( aDrawSegment->GetShape() )
|
||||
{
|
||||
@@ -763,8 +772,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
|
||||
const SFVEC2F center3DU( aDrawSegment->GetCenter().x * m_biuTo3Dunits,
|
||||
-aDrawSegment->GetCenter().y * m_biuTo3Dunits );
|
||||
|
||||
const float inner_radius =
|
||||
std::max<float>( (aDrawSegment->GetRadius() - linewidth / 2) * m_biuTo3Dunits, 0.0 );
|
||||
const float inner_radius = (aDrawSegment->GetRadius() - linewidth / 2) * m_biuTo3Dunits;
|
||||
const float outter_radius = (aDrawSegment->GetRadius() + linewidth / 2) * m_biuTo3Dunits;
|
||||
|
||||
aDstContainer->Add( new CRING2D( center3DU,
|
||||
@@ -813,17 +821,19 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
|
||||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case S_POLYGON:
|
||||
{
|
||||
const int segcountforcircle = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
const int segcountforcircle = 16;
|
||||
const double correctionFactor = GetCircleCorrectionFactor( segcountforcircle );
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aDrawSegment->TransformShapeWithClearanceToPolygon( polyList, aClearanceValue,
|
||||
segcountforcircle, correctionFactor );
|
||||
|
||||
// This convert the poly in outline and holes
|
||||
// Note: This two sequencial calls are need in order to get
|
||||
// the triangulation function to work properly.
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
if( polyList.IsEmpty() ) // Just for caution
|
||||
break;
|
||||
@@ -833,6 +843,9 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
|
||||
}
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier curve (not yet in use in KiCad)
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -847,14 +860,24 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
// Copy the polys list because we have to simplify it
|
||||
SHAPE_POLY_SET polyList = SHAPE_POLY_SET( aZoneContainer->GetFilledPolysList(), true );
|
||||
SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList());
|
||||
|
||||
// This convert the poly in outline and holes
|
||||
|
||||
// Note: This two sequencial calls are need in order to get
|
||||
// the triangulation function to work properly.
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
if( polyList.IsEmpty() )
|
||||
return;
|
||||
|
||||
Convert_shape_line_polygon_to_triangles( polyList,
|
||||
*aDstContainer,
|
||||
m_biuTo3Dunits,
|
||||
*aZoneContainer );
|
||||
|
||||
|
||||
// add filled areas outlines, which are drawn with thick lines segments
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
for( int i = 0; i < polyList.OutlineCount(); ++i )
|
||||
@@ -872,11 +895,10 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo
|
||||
|
||||
if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
{
|
||||
float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits;
|
||||
|
||||
if( radius > 0.0 ) // degenerated circles crash 3D viewer
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, radius ,
|
||||
*aZoneContainer ) );
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU,
|
||||
(aZoneContainer->GetMinThickness() / 2) *
|
||||
m_biuTo3Dunits,
|
||||
*aZoneContainer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -902,12 +924,11 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo
|
||||
|
||||
if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
{
|
||||
float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits;
|
||||
|
||||
if( radius > 0.0 ) // degenerated circles crash 3D viewer
|
||||
aDstContainer->Add(
|
||||
new CFILLEDCIRCLE2D( start3DU, radius,
|
||||
*aZoneContainer ) );
|
||||
aDstContainer->Add(
|
||||
new CFILLEDCIRCLE2D( start3DU,
|
||||
(aZoneContainer->GetMinThickness() / 2) *
|
||||
m_biuTo3Dunits,
|
||||
*aZoneContainer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
|
||||
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
|
||||
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
|
||||
|
||||
#include <openmp_mutex.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_pad.h>
|
||||
@@ -52,9 +52,6 @@
|
||||
#include <trigo.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
|
||||
#include <profile.h>
|
||||
|
||||
@@ -219,10 +216,10 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
layer_id.clear();
|
||||
layer_id.reserve( m_copperLayersCount );
|
||||
|
||||
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
|
||||
for( unsigned i = 0; i < DIM( cu_seq ); ++i )
|
||||
cu_seq[i] = ToLAYER_ID( B_Cu - i );
|
||||
|
||||
for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
|
||||
for( LSEQ cu = cu_set.Seq( cu_seq, DIM( cu_seq ) ); cu; ++cu )
|
||||
{
|
||||
const PCB_LAYER_ID curr_layer_id = *cu;
|
||||
|
||||
@@ -748,7 +745,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
case PCB_LINE_T: // should not exist on copper layers
|
||||
{
|
||||
const int nrSegments =
|
||||
GetNrSegmentsCircle( item->GetBoundingBox().GetSizeMax() );
|
||||
@@ -791,43 +788,36 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
|
||||
// Add zones objects
|
||||
// /////////////////////////////////////////////////////////////////////
|
||||
std::atomic<size_t> nextZone( 0 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
|
||||
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
|
||||
{
|
||||
std::thread t = std::thread( [&]()
|
||||
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
|
||||
|
||||
if( aStatusTextReporter )
|
||||
aStatusTextReporter->Report( wxString::Format( _( "Create zones of layer %s" ),
|
||||
LSET::Name( curr_layer_id ) ) );
|
||||
|
||||
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
|
||||
|
||||
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
|
||||
|
||||
// ADD COPPER ZONES
|
||||
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
|
||||
{
|
||||
for( size_t areaId = nextZone.fetch_add( 1 );
|
||||
areaId < static_cast<size_t>( m_board->GetAreaCount() );
|
||||
areaId = nextZone.fetch_add( 1 ) )
|
||||
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
|
||||
const PCB_LAYER_ID zonelayer = zone->GetLayer();
|
||||
|
||||
if( zonelayer == curr_layer_id )
|
||||
{
|
||||
const ZONE_CONTAINER* zone = m_board->GetArea( areaId );
|
||||
|
||||
if( zone == nullptr )
|
||||
break;
|
||||
|
||||
auto layerContainer = m_layers_container2D.find( zone->GetLayer() );
|
||||
|
||||
if( layerContainer != m_layers_container2D.end() )
|
||||
AddSolidAreasShapesToContainer( zone, layerContainer->second,
|
||||
zone->GetLayer() );
|
||||
AddSolidAreasShapesToContainer( zone,
|
||||
layerContainer,
|
||||
curr_layer_id );
|
||||
}
|
||||
|
||||
threadsFinished++;
|
||||
} );
|
||||
|
||||
t.detach();
|
||||
}
|
||||
}
|
||||
|
||||
while( threadsFinished < parallelThreadCount )
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
|
||||
}
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
printf( "fill zones T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
|
||||
printf( "T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
|
||||
start_Time = GetRunningMicroSecs();
|
||||
#endif
|
||||
|
||||
@@ -835,18 +825,29 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
|
||||
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
|
||||
{
|
||||
// ADD COPPER ZONES
|
||||
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
|
||||
// Add zones poly contourns
|
||||
// /////////////////////////////////////////////////////////////////////
|
||||
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
|
||||
{
|
||||
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
|
||||
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
|
||||
|
||||
if( zone == nullptr )
|
||||
break;
|
||||
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
|
||||
|
||||
auto layerContainer = m_layers_poly.find( zone->GetLayer() );
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
|
||||
|
||||
if( layerContainer != m_layers_poly.end() )
|
||||
zone->TransformSolidAreasShapesToPolygonSet( *layerContainer->second, segcountforcircle, correctionFactor );
|
||||
// ADD COPPER ZONES
|
||||
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
|
||||
{
|
||||
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
|
||||
const LAYER_NUM zonelayer = zone->GetLayer();
|
||||
|
||||
if( zonelayer == curr_layer_id )
|
||||
{
|
||||
zone->TransformSolidAreasShapesToPolygonSet( *layerPoly,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,35 +865,22 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
|
||||
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
|
||||
{
|
||||
std::atomic<size_t> nextItem( 0 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
const int nLayers = layer_id.size();
|
||||
|
||||
size_t parallelThreadCount = std::min<size_t>(
|
||||
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
|
||||
layer_id.size() );
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
#pragma omp parallel for
|
||||
for( signed int lIdx = 0; lIdx < nLayers; ++lIdx )
|
||||
{
|
||||
std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id, this]()
|
||||
{
|
||||
for( size_t i = nextItem.fetch_add( 1 );
|
||||
i < layer_id.size();
|
||||
i = nextItem.fetch_add( 1 ) )
|
||||
{
|
||||
auto layerPoly = m_layers_poly.find( layer_id[i] );
|
||||
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
|
||||
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
// This will make a union of all added contours
|
||||
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
|
||||
|
||||
threadsFinished++;
|
||||
} );
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
|
||||
|
||||
t.detach();
|
||||
wxASSERT( layerPoly != NULL );
|
||||
|
||||
// This will make a union of all added contourns
|
||||
layerPoly->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
while( threadsFinished < parallelThreadCount )
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
}
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
@@ -973,7 +961,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||
|
||||
// User layers are not drawn here, only technical layers
|
||||
|
||||
for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, arrayDim( teckLayerList ) );
|
||||
for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, DIM( teckLayerList ) );
|
||||
seq;
|
||||
++seq )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -28,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <GL/glew.h> // Must be included first
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include "../common_ogl/openGL_includes.h"
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
@@ -45,13 +44,14 @@
|
||||
#include <hotkeys_basic.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
extern struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[];
|
||||
|
||||
|
||||
/**
|
||||
* Flag to enable 3D canvas debug tracing.
|
||||
*
|
||||
* Use "KI_TRACE_EDA_3D_CANVAS" to enable.
|
||||
*
|
||||
* @ingroup trace_env_vars
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
* "KI_TRACE_EDA_3D_CANVAS". See the wxWidgets documentation on wxLogTrace for
|
||||
* more information.
|
||||
*/
|
||||
const wxChar * EDA_3D_CANVAS::m_logTrace = wxT( "KI_TRACE_EDA_3D_CANVAS" );
|
||||
|
||||
@@ -64,16 +64,16 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
|
||||
EVT_CHAR_HOOK( EDA_3D_CANVAS::OnCharHook )
|
||||
|
||||
// mouse events
|
||||
EVT_LEFT_DOWN( EDA_3D_CANVAS::OnLeftDown )
|
||||
EVT_LEFT_UP( EDA_3D_CANVAS::OnLeftUp )
|
||||
EVT_MIDDLE_UP( EDA_3D_CANVAS::OnMiddleUp )
|
||||
EVT_LEFT_DOWN( EDA_3D_CANVAS::OnLeftDown )
|
||||
EVT_LEFT_UP( EDA_3D_CANVAS::OnLeftUp )
|
||||
EVT_MIDDLE_UP( EDA_3D_CANVAS::OnMiddleUp )
|
||||
EVT_MIDDLE_DOWN( EDA_3D_CANVAS::OnMiddleDown)
|
||||
EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick )
|
||||
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
|
||||
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
|
||||
EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick )
|
||||
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
|
||||
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
|
||||
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
|
||||
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
|
||||
#endif
|
||||
|
||||
// other events
|
||||
@@ -90,6 +90,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
|
||||
const int *aAttribList,
|
||||
BOARD *aBoard,
|
||||
CINFO3D_VISU &aSettings , S3D_CACHE *a3DCachePointer ) :
|
||||
|
||||
HIDPI_GL_CANVAS( aParent,
|
||||
wxID_ANY,
|
||||
aAttribList,
|
||||
@@ -100,8 +101,9 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
|
||||
m_settings( aSettings )
|
||||
{
|
||||
// Run test cases in debug mode, once.
|
||||
//DBG( Run_3d_viewer_test_cases() );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::EDA_3D_CANVAS" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::EDA_3D_CANVAS" ) );
|
||||
|
||||
m_editing_timeout_timer.SetOwner( this );
|
||||
Connect( m_editing_timeout_timer.GetId(),
|
||||
@@ -128,7 +130,6 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
|
||||
m_is_opengl_initialized = false;
|
||||
|
||||
m_render_raytracing_was_requested = false;
|
||||
m_opengl_supports_raytracing = false;
|
||||
|
||||
m_parentStatusBar = NULL;
|
||||
m_glRC = NULL;
|
||||
@@ -153,7 +154,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
|
||||
|
||||
EDA_3D_CANVAS::~EDA_3D_CANVAS()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::~EDA_3D_CANVAS" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::~EDA_3D_CANVAS" ) );
|
||||
|
||||
releaseOpenGL();
|
||||
}
|
||||
@@ -171,7 +172,7 @@ void EDA_3D_CANVAS::releaseOpenGL()
|
||||
delete m_3d_render_ogl_legacy;
|
||||
m_3d_render_ogl_legacy = NULL;
|
||||
|
||||
// This is just a copy of a pointer, can safely be set to NULL
|
||||
// This is just a copy of a pointer, can safelly be set to NULL
|
||||
m_3d_render = NULL;
|
||||
|
||||
GL_CONTEXT_MANAGER::Get().UnlockCtx( m_glRC );
|
||||
@@ -188,16 +189,14 @@ void EDA_3D_CANVAS::OnCloseWindow( wxCloseEvent &event )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnResize( wxSizeEvent &event )
|
||||
{
|
||||
this->Request_refresh();
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL" ) );
|
||||
|
||||
const GLenum err = glewInit();
|
||||
|
||||
@@ -211,53 +210,11 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s",
|
||||
wxLogTrace( m_logTrace,
|
||||
wxString( wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW " ) ) +
|
||||
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL version string %s.",
|
||||
__WXFUNCTION__, version );
|
||||
|
||||
// Extract OpenGL version from string. This method is used because prior to OpenGL 2,
|
||||
// getting the OpenGL major and minor version as integers didn't exist.
|
||||
wxString tmp;
|
||||
|
||||
wxStringTokenizer tokenizer( version );
|
||||
|
||||
m_opengl_supports_raytracing = true;
|
||||
|
||||
if( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
long major = 0;
|
||||
long minor = 0;
|
||||
|
||||
tmp = tokenizer.GetNextToken();
|
||||
|
||||
tokenizer.SetString( tmp, wxString( "." ) );
|
||||
|
||||
if( tokenizer.HasMoreTokens() )
|
||||
tokenizer.GetNextToken().ToLong( &major );
|
||||
|
||||
if( tokenizer.HasMoreTokens() )
|
||||
tokenizer.GetNextToken().ToLong( &minor );
|
||||
|
||||
if( major < 2 || ( (major == 2 ) && (minor < 1) ) )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL ray tracing not supported.",
|
||||
__WXFUNCTION__ );
|
||||
|
||||
if( GetParent() )
|
||||
{
|
||||
wxCommandEvent evt( wxEVT_MENU, ID_DISABLE_RAY_TRACING );
|
||||
GetParent()->ProcessWindowEvent( evt );
|
||||
}
|
||||
|
||||
m_opengl_supports_raytracing = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_is_opengl_initialized = true;
|
||||
|
||||
return true;
|
||||
@@ -303,11 +260,14 @@ void EDA_3D_CANVAS::DisplayStatus()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( "dx %3.2f", m_settings.CameraGet().GetCameraPos().x );
|
||||
msg.Printf( wxT( "dx %3.2f" ), m_settings.CameraGet().GetCameraPos().x );
|
||||
m_parentStatusBar->SetStatusText( msg, 1 );
|
||||
|
||||
msg.Printf( "dy %3.2f", m_settings.CameraGet().GetCameraPos().y );
|
||||
msg.Printf( wxT( "dy %3.2f" ), m_settings.CameraGet().GetCameraPos().y );
|
||||
m_parentStatusBar->SetStatusText( msg, 2 );
|
||||
|
||||
//msg.Printf( _( "Zoom: %3.1f" ), 50 * m_settings.CameraGet().ZoomGet() );
|
||||
//m_parentStatusBar->SetStatusText( msg, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +282,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
// SwapBuffer requires the window to be shown before calling
|
||||
if( !IsShownOnScreen() )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPaint !IsShown" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnPaint !IsShown" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,7 +290,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
// ensure this parent is still alive. When it is closed before the viewer
|
||||
// frame, a paint event can be generated after the parent is closed,
|
||||
// therefore with invalid board.
|
||||
// This is dependent of the platform.
|
||||
// This is dependant of the platform.
|
||||
// Especially on OSX, but also on Windows, it frequently happens
|
||||
if( !GetParent()->GetParent()->IsShown() )
|
||||
return; // The parent board editor frame is no more alive
|
||||
@@ -341,6 +301,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
//WX_STRING_REPORTER errorReporter( &err_messages );
|
||||
STATUS_TEXT_REPORTER activityReporter( m_parentStatusBar, 0 );
|
||||
|
||||
|
||||
unsigned strtime = GetRunningMicroSecs();
|
||||
|
||||
// "Makes the OpenGL state that is represented by the OpenGL rendering
|
||||
@@ -359,10 +320,11 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
// multiple canvases: If we updated the viewport in the wxSizeEvent
|
||||
// handler, changing the size of one canvas causes a viewport setting that
|
||||
// is wrong when next another canvas is repainted.
|
||||
wxSize clientSize = GetNativePixelSize();
|
||||
wxSize clientSize = GetClientSize();
|
||||
|
||||
const bool windows_size_changed = m_settings.CameraGet().SetCurWindowSize( clientSize );
|
||||
|
||||
|
||||
// Initialize openGL if need
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
if( !m_is_opengl_initialized )
|
||||
@@ -375,15 +337,8 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
}
|
||||
}
|
||||
|
||||
// Don't attend to ray trace if OpenGL doesn't support it.
|
||||
if( !m_opengl_supports_raytracing )
|
||||
{
|
||||
m_3d_render = m_3d_render_ogl_legacy;
|
||||
m_render_raytracing_was_requested = false;
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_OPENGL_LEGACY );
|
||||
}
|
||||
|
||||
// Check if a raytacing was requested and need to switch to raytracing mode
|
||||
// Check if a raytacing was requented and need to switch to raytracing mode
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
{
|
||||
const bool was_camera_changed = m_settings.CameraGet().ParametersChanged();
|
||||
@@ -401,6 +356,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float curtime_delta_s = 0.0f;
|
||||
|
||||
if( m_camera_is_moving )
|
||||
@@ -424,6 +380,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// It will return true if the render request a new redraw
|
||||
bool requested_redraw = false;
|
||||
|
||||
@@ -452,7 +409,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
{
|
||||
if( m_mouse_was_moved || m_camera_is_moving )
|
||||
{
|
||||
// Calculation time in milliseconds
|
||||
// Calculation time in miliseconds
|
||||
const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
|
||||
|
||||
activityReporter.Report( wxString::Format( _( "Render time %.0f ms ( %.1f fps)" ),
|
||||
@@ -476,7 +433,7 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
|
||||
|
||||
void EDA_3D_CANVAS::OnEraseBackground( wxEraseEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnEraseBackground" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnEraseBackground" ) );
|
||||
// Do nothing, to avoid flashing.
|
||||
}
|
||||
|
||||
@@ -485,7 +442,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
|
||||
{
|
||||
bool mouseActivity = false;
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnMouseWheel" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnMouseWheel" ) );
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
@@ -551,8 +508,6 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
@@ -576,7 +531,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
m_settings.CameraGet().SetCurWindowSize( GetNativePixelSize() );
|
||||
m_settings.CameraGet().SetCurWindowSize( GetClientSize() );
|
||||
|
||||
if( event.Dragging() )
|
||||
{
|
||||
@@ -600,7 +555,6 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
|
||||
|
||||
void EDA_3D_CANVAS::OnLeftDown( wxMouseEvent &event )
|
||||
{
|
||||
SetFocus();
|
||||
stop_editingTimeOut_Timer();
|
||||
}
|
||||
|
||||
@@ -620,7 +574,6 @@ void EDA_3D_CANVAS::OnLeftUp( wxMouseEvent &event )
|
||||
|
||||
void EDA_3D_CANVAS::OnMiddleDown( wxMouseEvent &event )
|
||||
{
|
||||
SetFocus();
|
||||
stop_editingTimeOut_Timer();
|
||||
}
|
||||
|
||||
@@ -644,9 +597,7 @@ void EDA_3D_CANVAS::OnMiddleUp( wxMouseEvent &event )
|
||||
|
||||
void EDA_3D_CANVAS::OnRightClick( wxMouseEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnRightClick" );
|
||||
|
||||
SetFocus();
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnRightClick" ) );
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
@@ -658,71 +609,71 @@ void EDA_3D_CANVAS::OnRightClick( wxMouseEvent &event )
|
||||
pos.x = event.GetX();
|
||||
pos.y = event.GetY();
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom +" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Zoom +" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_ZOOMIN );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
|
||||
msg, KiBitmap( zoom_in_xpm ) );
|
||||
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom -" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Zoom -" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_ZOOMOUT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
|
||||
msg, KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Top View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Top View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_ZPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
|
||||
msg, KiBitmap( axis3d_top_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Bottom View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Bottom View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_ZNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
|
||||
msg, KiBitmap( axis3d_bottom_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Right View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Right View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_XPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
|
||||
msg, KiBitmap( axis3d_right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Left View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Left View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_XNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
|
||||
msg, KiBitmap( axis3d_left_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Front View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Front View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_YPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
|
||||
msg, KiBitmap( axis3d_front_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Back View" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Back View" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_VIEW_YNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
|
||||
msg, KiBitmap( axis3d_back_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Move Left <-" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Move Left <-" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_MOVE3D_LEFT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
|
||||
msg, KiBitmap( left_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Right ->" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Move Right ->" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_MOVE3D_RIGHT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
|
||||
msg, KiBitmap( right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Up ^" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Move Up ^" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_MOVE3D_UP );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
|
||||
msg, KiBitmap( up_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Down" ), GetHotkeyConfig(),
|
||||
msg = AddHotkeyName( _( "Move Down" ), g_3DViewer_Hokeys_Descr,
|
||||
ID_POPUP_MOVE3D_DOWN );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
|
||||
msg, KiBitmap( down_xpm ) );
|
||||
@@ -735,7 +686,7 @@ void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPopUpMenu id:%d", id );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnPopUpMenu id:%d" ), id );
|
||||
|
||||
int key = 0;
|
||||
|
||||
@@ -799,14 +750,14 @@ void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
|
||||
|
||||
void EDA_3D_CANVAS::OnCharHook( wxKeyEvent &event )
|
||||
{
|
||||
//wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnCharHook" );
|
||||
//wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnCharHook" ) );
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnKeyEvent( wxKeyEvent& event )
|
||||
{
|
||||
//wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnKeyEvent" );
|
||||
//wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnKeyEvent" ) );
|
||||
int localkey = event.GetKeyCode();
|
||||
|
||||
// Use only upper char values in comparisons
|
||||
@@ -1101,7 +1052,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
|
||||
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
|
||||
m_settings.CameraGet().SetT0_and_T1_current_T();
|
||||
m_settings.CameraGet().Reset_T1();
|
||||
m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
|
||||
m_settings.CameraGet().RotateX_T1( glm::radians( -180.0f ) );
|
||||
request_start_moving_camera(
|
||||
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* Class EDA_3D_CANVAS
|
||||
* Implement a canvas based on a wxGLCanvas
|
||||
*/
|
||||
class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
|
||||
@@ -124,16 +125,7 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
|
||||
|
||||
void OnKeyEvent( wxKeyEvent& event );
|
||||
|
||||
bool SupportsRayTracing() const { return m_opengl_supports_raytracing; }
|
||||
|
||||
bool IsOpenGLInitialized() const { return m_is_opengl_initialized; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
|
||||
@@ -278,8 +270,6 @@ private:
|
||||
/// Flags that the user requested the current view to be render with raytracing
|
||||
bool m_render_raytracing_was_requested;
|
||||
|
||||
bool m_opengl_supports_raytracing;
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define PLUGINDIR "@CMAKE_INSTALL_FULL_LIBDIR@"
|
||||
#define PLUGINDIR "@CMAKE_INSTALL_LIBDIR@"
|
||||
|
||||
@@ -369,8 +369,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCONTAINER2D boardContainer;
|
||||
SHAPE_POLY_SET tmpBoard = m_settings.GetBoardPoly();
|
||||
Convert_shape_line_polygon_to_triangles( tmpBoard,
|
||||
Convert_shape_line_polygon_to_triangles( m_settings.GetBoardPoly(),
|
||||
boardContainer,
|
||||
m_settings.BiuTo3Dunits(),
|
||||
(const BOARD_ITEM &)*m_settings.GetBoard() );
|
||||
@@ -501,7 +500,11 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
get_layer_z_pos( layer_id, layer_z_top, layer_z_bot );
|
||||
|
||||
m_ogl_disp_lists_layers_holes_outer[layer_id] = generate_holes_display_list(
|
||||
container->GetList(), *poly, layer_z_top, layer_z_bot, false );
|
||||
container->GetList(),
|
||||
*poly,
|
||||
layer_z_top,
|
||||
layer_z_bot,
|
||||
false );
|
||||
}
|
||||
|
||||
for( MAP_POLY::const_iterator ii = innerMapHoles.begin();
|
||||
@@ -515,7 +518,11 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
get_layer_z_pos( layer_id, layer_z_top, layer_z_bot );
|
||||
|
||||
m_ogl_disp_lists_layers_holes_inner[layer_id] = generate_holes_display_list(
|
||||
container->GetList(), *poly, layer_z_top, layer_z_bot, false );
|
||||
container->GetList(),
|
||||
*poly,
|
||||
layer_z_top,
|
||||
layer_z_bot,
|
||||
false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,6 +530,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
generate_3D_Vias_and_Pads();
|
||||
|
||||
// Add layers maps
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if( aStatusTextReporter )
|
||||
aStatusTextReporter->Report( _( "Load OpenGL: layers" ) );
|
||||
@@ -563,33 +571,38 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
|
||||
switch( object2d_A->GetObjectType() )
|
||||
{
|
||||
case OBJ2D_FILLED_CIRCLE:
|
||||
add_object_to_triangle_layer( (const CFILLEDCIRCLE2D *)object2d_A,
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
case OBJ2D_FILLED_CIRCLE:
|
||||
add_object_to_triangle_layer( (const CFILLEDCIRCLE2D *)object2d_A,
|
||||
layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJ2D_POLYGON4PT:
|
||||
add_object_to_triangle_layer( (const CPOLYGON4PTS2D *)object2d_A,
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
case OBJ2D_POLYGON4PT:
|
||||
add_object_to_triangle_layer( (const CPOLYGON4PTS2D *)object2d_A,
|
||||
layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJ2D_RING:
|
||||
add_object_to_triangle_layer( (const CRING2D *)object2d_A,
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
case OBJ2D_RING:
|
||||
add_object_to_triangle_layer( (const CRING2D *)object2d_A,
|
||||
layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJ2D_TRIANGLE:
|
||||
add_object_to_triangle_layer( (const CTRIANGLE2D *)object2d_A,
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
case OBJ2D_TRIANGLE:
|
||||
add_object_to_triangle_layer( (const CTRIANGLE2D *)object2d_A,
|
||||
layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJ2D_ROUNDSEG:
|
||||
add_object_to_triangle_layer( (const CROUNDSEGMENT2D *) object2d_A,
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
case OBJ2D_ROUNDSEG:
|
||||
add_object_to_triangle_layer( (const CROUNDSEGMENT2D *) object2d_A,
|
||||
layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("C3D_RENDER_OGL_LEGACY: Object type is not implemented");
|
||||
default:
|
||||
wxFAIL_MSG("C3D_RENDER_OGL_LEGACY: Object type is not implemented");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -601,9 +614,11 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
|
||||
{
|
||||
const SHAPE_POLY_SET *polyList = map_poly.at( layer_id );
|
||||
|
||||
if( polyList->OutlineCount() > 0 )
|
||||
layerTriangles->AddToMiddleContourns( *polyList, layer_z_bot, layer_z_top,
|
||||
m_settings.BiuTo3Dunits(), false );
|
||||
layerTriangles->AddToMiddleContourns( *polyList,
|
||||
layer_z_bot,
|
||||
layer_z_top,
|
||||
m_settings.BiuTo3Dunits(),
|
||||
false );
|
||||
}
|
||||
|
||||
// Create display list
|
||||
@@ -871,8 +886,12 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
|
||||
const SFVEC2F &v2 = tri->GetP2();
|
||||
const SFVEC2F &v3 = tri->GetP3();
|
||||
|
||||
add_triangle_top_bot( layerTriangles, v1, v2, v3,
|
||||
layer_z_top, layer_z_bot );
|
||||
add_triangle_top_bot( layerTriangles,
|
||||
v1,
|
||||
v2,
|
||||
v3,
|
||||
layer_z_top,
|
||||
layer_z_bot );
|
||||
}
|
||||
|
||||
wxASSERT( tht_outer_holes_poly.OutlineCount() > 0 );
|
||||
@@ -880,14 +899,16 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
|
||||
if( tht_outer_holes_poly.OutlineCount() > 0 )
|
||||
{
|
||||
layerTriangles->AddToMiddleContourns( tht_outer_holes_poly,
|
||||
layer_z_bot, layer_z_top,
|
||||
layer_z_bot,
|
||||
layer_z_top,
|
||||
m_settings.BiuTo3Dunits(),
|
||||
false );
|
||||
|
||||
m_ogl_disp_list_pads_holes = new CLAYERS_OGL_DISP_LISTS(
|
||||
*layerTriangles,
|
||||
m_ogl_circle_texture, // not need
|
||||
layer_z_top, layer_z_top );
|
||||
layer_z_top,
|
||||
layer_z_top );
|
||||
}
|
||||
|
||||
delete layerTriangles;
|
||||
@@ -911,7 +932,8 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER *aStatusTextReporter )
|
||||
|
||||
// Go for all modules
|
||||
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
|
||||
module; module = module->Next() )
|
||||
module;
|
||||
module = module->Next() )
|
||||
{
|
||||
if( !module->Models().empty() )
|
||||
{
|
||||
|
||||
@@ -175,7 +175,8 @@ void C3D_RENDER_OGL_LEGACY::render_3D_arrows()
|
||||
|
||||
void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
{
|
||||
m_materials = {};
|
||||
|
||||
memset( &m_materials, 0, sizeof( m_materials ) );
|
||||
|
||||
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
{
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
|
||||
#include "clayer_triangles.h"
|
||||
#include <wx/debug.h> // For the wxASSERT
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
|
||||
|
||||
CLAYER_TRIANGLE_CONTAINER::CLAYER_TRIANGLE_CONTAINER( unsigned int aNrReservedTriangles,
|
||||
@@ -150,7 +147,7 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
|
||||
float zTop,
|
||||
bool aInvertFaceDirection )
|
||||
{
|
||||
if( aContournPoints.size() >= 4 )
|
||||
if( aContournPoints.size() > 4 )
|
||||
{
|
||||
// Calculate normals of each segment of the contourn
|
||||
std::vector< SFVEC2F > contournNormals;
|
||||
@@ -164,6 +161,7 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
|
||||
{
|
||||
const SFVEC2F &v0 = aContournPoints[i + 0];
|
||||
const SFVEC2F &v1 = aContournPoints[i + 1];
|
||||
|
||||
const SFVEC2F n = glm::normalize( v1 - v0 );
|
||||
|
||||
contournNormals[i] = SFVEC2F( n.y,-n.x );
|
||||
@@ -175,6 +173,7 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
|
||||
{
|
||||
const SFVEC2F &v0 = aContournPoints[i + 0];
|
||||
const SFVEC2F &v1 = aContournPoints[i + 1];
|
||||
|
||||
const SFVEC2F n = glm::normalize( v1 - v0 );
|
||||
|
||||
contournNormals[i] = SFVEC2F( -n.y, n.x );
|
||||
@@ -220,8 +219,8 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
|
||||
const SFVEC2F &v0 = aContournPoints[i + 0];
|
||||
const SFVEC2F &v1 = aContournPoints[i + 1];
|
||||
|
||||
#pragma omp critical
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( m_middle_layer_lock );
|
||||
m_layer_middle_contourns_quads->AddQuad( SFVEC3F( v0.x, v0.y, zTop ),
|
||||
SFVEC3F( v1.x, v1.y, zTop ),
|
||||
SFVEC3F( v1.x, v1.y, zBot ),
|
||||
@@ -280,6 +279,8 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
|
||||
double aBiuTo3Du,
|
||||
bool aInvertFaceDirection )
|
||||
{
|
||||
wxASSERT( aPolySet.OutlineCount() > 0 );
|
||||
|
||||
if( aPolySet.OutlineCount() == 0 )
|
||||
return;
|
||||
|
||||
@@ -304,7 +305,8 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
|
||||
m_layer_middle_contourns_quads->Reserve_More( nrContournPointsToReserve * 2,
|
||||
true );
|
||||
|
||||
for( int i = 0; i < aPolySet.OutlineCount(); i++ )
|
||||
#pragma omp parallel for
|
||||
for( signed int i = 0; i < aPolySet.OutlineCount(); ++i )
|
||||
{
|
||||
// Add outline
|
||||
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
typedef std::vector< SFVEC3F > SFVEC3F_VECTOR;
|
||||
@@ -175,8 +174,6 @@ public:
|
||||
float zTop,
|
||||
bool aInvertFaceDirection );
|
||||
|
||||
std::mutex m_middle_layer_lock;
|
||||
|
||||
CLAYER_TRIANGLE_CONTAINER *m_layer_top_segment_ends;
|
||||
CLAYER_TRIANGLE_CONTAINER *m_layer_top_triangles;
|
||||
CLAYER_TRIANGLE_CONTAINER *m_layer_middle_contourns_quads;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "ccontainer2d.h"
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <boost/range/algorithm/partition.hpp>
|
||||
#include <boost/range/algorithm/nth_element.hpp>
|
||||
#include <wx/debug.h>
|
||||
@@ -47,7 +46,6 @@ CGENERICCONTAINER2D::CGENERICCONTAINER2D( OBJECT2D_TYPE aObjType )
|
||||
|
||||
void CGENERICCONTAINER2D::Clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( m_lock );
|
||||
m_bbox.Reset();
|
||||
|
||||
for( LIST_OBJECT2D::iterator ii = m_objects.begin();
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "../shapes2D/cobject2d.h"
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
typedef std::list<COBJECT2D *> LIST_OBJECT2D;
|
||||
typedef std::list<const COBJECT2D *> CONST_LIST_OBJECT2D;
|
||||
@@ -53,7 +52,6 @@ public:
|
||||
{
|
||||
if( aObject ) // Only add if it is a valid pointer
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( m_lock );
|
||||
m_objects.push_back( aObject );
|
||||
m_bbox.Union( aObject->GetBBox() );
|
||||
}
|
||||
@@ -72,7 +70,6 @@ public:
|
||||
CONST_LIST_OBJECT2D &aOutList ) const = 0;
|
||||
|
||||
private:
|
||||
std::mutex m_lock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -918,6 +918,7 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
|
||||
}
|
||||
m_accelerator = 0;
|
||||
|
||||
//m_accelerator = new CGRID( m_object_container );
|
||||
m_accelerator = new CBVH_PBRT( m_object_container );
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -131,7 +131,7 @@ private:
|
||||
unsigned long int m_stats_start_rendering_time;
|
||||
|
||||
/// Save the number of blocks progress of the render
|
||||
size_t m_nrBlocksRenderProgress;
|
||||
long m_nrBlocksRenderProgress;
|
||||
|
||||
CPOSTSHADER_SSAO m_postshader_ssao;
|
||||
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
std::vector< SFVEC2UI > m_blockPositions;
|
||||
|
||||
/// this flags if a position was already processed (cleared each new render)
|
||||
std::vector< int > m_blockPositionsWasProcessed;
|
||||
std::vector< bool > m_blockPositionsWasProcessed;
|
||||
|
||||
/// this encodes the Morton code positions (on fast preview mode)
|
||||
std::vector< SFVEC2UI > m_blockPositionsFast;
|
||||
|
||||
@@ -50,9 +50,9 @@ void RAY::Init( const SFVEC3F& o, const SFVEC3F& d )
|
||||
// Amy Williams Steve Barrus R. Keith Morley Peter Shirley
|
||||
// University of Utah
|
||||
// http://people.csail.mit.edu/amy/papers/box-jgt.pdf
|
||||
m_dirIsNeg[0] = m_Dir.x < 0.0f;
|
||||
m_dirIsNeg[1] = m_Dir.y < 0.0f;
|
||||
m_dirIsNeg[2] = m_Dir.z < 0.0f;
|
||||
m_dirIsNeg[0] = m_Dir.x <= 0.0f;
|
||||
m_dirIsNeg[1] = m_Dir.y <= 0.0f;
|
||||
m_dirIsNeg[2] = m_Dir.z <= 0.0f;
|
||||
|
||||
|
||||
// ray slope
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -740,6 +740,31 @@ void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
|
||||
}
|
||||
|
||||
|
||||
void Polygon_Convert( const KI_POLYGON &aPolygon,
|
||||
ClipperLib::Path &aOutPath,
|
||||
CBBOX2D &aOutBBox,
|
||||
float aBiuTo3DunitsScale )
|
||||
{
|
||||
aOutPath.resize( aPolygon.size() );
|
||||
aOutBBox.Reset();
|
||||
|
||||
for( unsigned i = 0; i < aPolygon.size(); i++ )
|
||||
{
|
||||
const KI_POLY_POINT point = *(aPolygon.begin() + i);
|
||||
|
||||
aOutPath[i] = ClipperLib::IntPoint( (ClipperLib::cInt)point.x(),
|
||||
(ClipperLib::cInt)point.y() );
|
||||
|
||||
aOutBBox.Union( SFVEC2F( (float) point.x() * aBiuTo3DunitsScale,
|
||||
(float)-point.y() * aBiuTo3DunitsScale ) );
|
||||
}
|
||||
|
||||
aOutBBox.ScaleNextUp();
|
||||
|
||||
ClipperLib::CleanPolygon( aOutPath );
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
static void polygon_Convert( const ClipperLib::Path &aPath,
|
||||
SEGMENTS &aOutSegment,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "cobject2d.h"
|
||||
#include "../accelerators/ccontainer2d.h"
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <polygons_defs.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -154,6 +155,11 @@ void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
|
||||
CBBOX2D &aOutBBox,
|
||||
float aBiuTo3DunitsScale );
|
||||
|
||||
void Polygon_Convert( const KI_POLYGON &aPolygon,
|
||||
ClipperLib::Path &aOutPath,
|
||||
CBBOX2D &aOutBBox,
|
||||
float aBiuTo3DunitsScale );
|
||||
|
||||
void Polygon2d_TestModule();
|
||||
|
||||
#endif // _CPOLYGON2D_H_
|
||||
|
||||
@@ -76,7 +76,7 @@ bool CROUNDSEGMENT2D::Intersects( const CBBOX2D &aBBox ) const
|
||||
return false;
|
||||
|
||||
if( (aBBox.Max().x > m_bbox.Max().x) &&
|
||||
(aBBox.Max().y > m_bbox.Max().y) &&
|
||||
(aBBox.Max().y > m_bbox.Max().x) &&
|
||||
(aBBox.Min().x < m_bbox.Min().x) &&
|
||||
(aBBox.Min().y < m_bbox.Min().y)
|
||||
)
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
#include <wx/glcanvas.h> // CALLBACK definition, needed on Windows
|
||||
// alse needed on OSX to define __DARWIN__
|
||||
#include <geometry/polygon_triangulation.h>
|
||||
#include "../../../3d_fastmath.h"
|
||||
|
||||
#include "../../../3d_fastmath.h"
|
||||
#include <poly2tri/poly2tri.h>
|
||||
|
||||
|
||||
CTRIANGLE2D::CTRIANGLE2D ( const SFVEC2F &aV1,
|
||||
@@ -126,28 +126,172 @@ bool CTRIANGLE2D::IsPointInside( const SFVEC2F &aPoint ) const
|
||||
const float c = 1.0f - a - b;
|
||||
|
||||
return 0.0f <= c && c <= 1.0f;
|
||||
/*
|
||||
return 0.0f <= a && a <= 1.0f &&
|
||||
0.0f <= b && b <= 1.0f &&
|
||||
0.0f <= c && c <= 1.0f;*/
|
||||
}
|
||||
|
||||
|
||||
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
|
||||
template <class C> void FreeClear( C & cntr )
|
||||
{
|
||||
for( typename C::iterator it = cntr.begin();
|
||||
it != cntr.end();
|
||||
++it )
|
||||
{
|
||||
delete * it;
|
||||
}
|
||||
|
||||
cntr.clear();
|
||||
}
|
||||
|
||||
// Note: Please check edgeshrink.cpp in order to learn the EdgeShrink propose
|
||||
|
||||
#define APPLY_EDGE_SHRINK
|
||||
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
extern void EdgeShrink( std::vector<SFVEC2I64> &aPath );
|
||||
|
||||
#define POLY_SCALE_FACT 256
|
||||
#define POLY_SCALE_FACT_INVERSE (1.0 / (double)(POLY_SCALE_FACT))
|
||||
#endif
|
||||
|
||||
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
|
||||
CGENERICCONTAINER2D &aDstContainer,
|
||||
float aBiuTo3DunitsScale ,
|
||||
const BOARD_ITEM &aBoardItem )
|
||||
{
|
||||
unsigned int nOutlines = aPolyList.OutlineCount();
|
||||
|
||||
aPolyList.CacheTriangulation();
|
||||
const double conver_d = (double)aBiuTo3DunitsScale;
|
||||
|
||||
for( unsigned int j = 0; j < aPolyList.TriangulatedPolyCount(); j++ )
|
||||
for( unsigned int idx = 0; idx < nOutlines; ++idx )
|
||||
{
|
||||
auto triPoly = aPolyList.TriangulatedPolygon( j );
|
||||
const SHAPE_LINE_CHAIN &outlinePath = aPolyList.COutline( idx );
|
||||
|
||||
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
|
||||
wxASSERT( outlinePath.PointCount() >= 3 );
|
||||
|
||||
std::vector<SFVEC2I64> scaledOutline;
|
||||
scaledOutline.resize( outlinePath.PointCount() );
|
||||
|
||||
// printf("\nidx: %u\n", idx);
|
||||
|
||||
// Apply a scale to the points
|
||||
for( unsigned int i = 0;
|
||||
i < (unsigned int)outlinePath.PointCount();
|
||||
++i )
|
||||
{
|
||||
VECTOR2I a;
|
||||
VECTOR2I b;
|
||||
VECTOR2I c;
|
||||
triPoly->GetTriangle( i, a, b, c );
|
||||
const VECTOR2I& a = outlinePath.CPoint( i );
|
||||
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x * POLY_SCALE_FACT,
|
||||
(glm::int64)a.y * POLY_SCALE_FACT );
|
||||
#else
|
||||
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x,
|
||||
(glm::int64)a.y );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
// Apply a modification to the points
|
||||
EdgeShrink( scaledOutline );
|
||||
#endif
|
||||
// Copy to a array of pointers
|
||||
std::vector<p2t::Point*> polyline;
|
||||
polyline.resize( outlinePath.PointCount() );
|
||||
|
||||
for( unsigned int i = 0;
|
||||
i < (unsigned int)scaledOutline.size();
|
||||
++i )
|
||||
{
|
||||
const SFVEC2I64 &a = scaledOutline[i];
|
||||
|
||||
//printf("%lu %lu\n", a.x, a.y);
|
||||
|
||||
polyline[i] = new p2t::Point( (double)a.x,
|
||||
(double)a.y );
|
||||
}
|
||||
|
||||
// Start creating the structured to be triangulated
|
||||
p2t::CDT* cdt = new p2t::CDT( polyline );
|
||||
|
||||
// Add holes for this outline
|
||||
unsigned int nHoles = aPolyList.HoleCount( idx );
|
||||
|
||||
std::vector< std::vector<p2t::Point*> > polylineHoles;
|
||||
|
||||
polylineHoles.resize( nHoles );
|
||||
|
||||
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN &outlineHoles = aPolyList.CHole( idx,
|
||||
idxHole );
|
||||
|
||||
wxASSERT( outlineHoles.PointCount() >= 3 );
|
||||
|
||||
std::vector<SFVEC2I64> scaledHole;
|
||||
scaledHole.resize( outlineHoles.PointCount() );
|
||||
|
||||
// Apply a scale to the points
|
||||
for( unsigned int i = 0;
|
||||
i < (unsigned int)outlineHoles.PointCount();
|
||||
++i )
|
||||
{
|
||||
const VECTOR2I &h = outlineHoles.CPoint( i );
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
scaledHole[i] = SFVEC2I64( (glm::int64)h.x * POLY_SCALE_FACT,
|
||||
(glm::int64)h.y * POLY_SCALE_FACT );
|
||||
#else
|
||||
scaledHole[i] = SFVEC2I64( (glm::int64)h.x,
|
||||
(glm::int64)h.y );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
// Apply a modification to the points
|
||||
EdgeShrink( scaledHole );
|
||||
#endif
|
||||
|
||||
// Resize and reserve space
|
||||
polylineHoles[idxHole].resize( outlineHoles.PointCount() );
|
||||
|
||||
for( unsigned int i = 0;
|
||||
i < (unsigned int)outlineHoles.PointCount();
|
||||
++i )
|
||||
{
|
||||
const SFVEC2I64 &h = scaledHole[i];
|
||||
|
||||
polylineHoles[idxHole][i] = new p2t::Point( h.x, h.y );
|
||||
}
|
||||
|
||||
cdt->AddHole( polylineHoles[idxHole] );
|
||||
}
|
||||
|
||||
// Triangulate
|
||||
cdt->Triangulate();
|
||||
|
||||
// Hint: if you find any crashes on the triangulation poly2tri library,
|
||||
// you can use the following site to debug the points and it will mark
|
||||
// the errors in the polygon:
|
||||
// http://r3mi.github.io/poly2tri.js/
|
||||
|
||||
|
||||
// Get and add triangles
|
||||
std::vector<p2t::Triangle*> triangles;
|
||||
triangles = cdt->GetTriangles();
|
||||
|
||||
#ifdef APPLY_EDGE_SHRINK
|
||||
const double conver_d = (double)aBiuTo3DunitsScale *
|
||||
POLY_SCALE_FACT_INVERSE;
|
||||
#else
|
||||
const double conver_d = (double)aBiuTo3DunitsScale;
|
||||
#endif
|
||||
for( unsigned int i = 0; i < triangles.size(); ++i )
|
||||
{
|
||||
p2t::Triangle& t = *triangles[i];
|
||||
|
||||
p2t::Point& a = *t.GetPoint( 0 );
|
||||
p2t::Point& b = *t.GetPoint( 1 );
|
||||
p2t::Point& c = *t.GetPoint( 2 );
|
||||
|
||||
aDstContainer.Add( new CTRIANGLE2D( SFVEC2F( a.x * conver_d,
|
||||
-a.y * conver_d ),
|
||||
@@ -158,5 +302,15 @@ void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
|
||||
aBoardItem ) );
|
||||
}
|
||||
|
||||
// Delete created data
|
||||
delete cdt;
|
||||
|
||||
// Free points
|
||||
FreeClear(polyline);
|
||||
|
||||
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
|
||||
{
|
||||
FreeClear( polylineHoles[idxHole] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
|
||||
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
|
||||
CGENERICCONTAINER2D &aDstContainer,
|
||||
float aBiuTo3DunitsScale,
|
||||
const BOARD_ITEM &aBoardItem );
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file edgeshrink.cpp
|
||||
* @brief The edgeShrink function was found in the project clip2tri by the:
|
||||
* Bitfighter project (http://bitfighter.org)
|
||||
* https://github.com/raptor/clip2tri
|
||||
* https://github.com/raptor/clip2tri/blob/f62a734d22733814b8a970ed8a68a4d94c24fa5f/clip2tri/clip2tri.cpp#L150
|
||||
*/
|
||||
|
||||
#include <plugins/3dapi/xv3d_types.h>
|
||||
#include <vector>
|
||||
|
||||
// clip2tri is Licenced under:
|
||||
|
||||
// The MIT License (MIT)
|
||||
|
||||
// Copyright (c) 2014 Bitfighter developers
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
|
||||
// Shrink large polygons by reducing each coordinate by 1 in the
|
||||
// general direction of the last point as we wind around
|
||||
//
|
||||
// This normally wouldn't work in every case, but our upscaled-by-1000 polygons
|
||||
// have little chance to create new duplicate points with this method.
|
||||
//
|
||||
// For information on why this was needed, see:
|
||||
//
|
||||
// https://github.com/greenm01/poly2tri/issues/90
|
||||
//
|
||||
|
||||
#define S_INC 1
|
||||
|
||||
void EdgeShrink( std::vector<SFVEC2I64> &aPath )
|
||||
{
|
||||
unsigned int prev = aPath.size() - 1;
|
||||
|
||||
for( unsigned int i = 0; i < aPath.size(); i++ )
|
||||
{
|
||||
// Adjust coordinate by 1 depending on the direction
|
||||
(aPath[i].x - aPath[prev].x) > 0 ? aPath[i].x -= S_INC :
|
||||
aPath[i].x += S_INC;
|
||||
|
||||
(aPath[i].y - aPath[prev].y) > 0 ? aPath[i].y -= S_INC :
|
||||
aPath[i].y += S_INC;
|
||||
|
||||
prev = i;
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ SFVEC3F CBBOX::Offset( const SFVEC3F &p ) const
|
||||
// https://github.com/mmp/pbrt-v2/blob/master/src/core/geometry.cpp#L68
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
#if 0
|
||||
bool CBBOX::Intersect( const RAY &aRay, float *aOutHitt0, float *aOutHitt1 ) const
|
||||
bool CBBOX::Intersect( const RAY &aRay, float *aOutHitt0, float *aOutHitt1 )
|
||||
{
|
||||
float t0 = 0.0f;
|
||||
float t1 = FLT_MAX;
|
||||
|
||||
@@ -31,10 +31,6 @@
|
||||
#include "buffers_debug.h"
|
||||
#include <string.h> // For memcpy
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(n, min, max) {if( n < min ) n=min; else if( n > max ) n = max;}
|
||||
#endif
|
||||
@@ -473,51 +469,34 @@ void CIMAGE::EfxFilter( CIMAGE *aInImg, E_FILTER aFilterType )
|
||||
aInImg->m_wraping = WRAP_CLAMP;
|
||||
m_wraping = WRAP_CLAMP;
|
||||
|
||||
std::atomic<size_t> nextRow( 0 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
|
||||
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
|
||||
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
#pragma omp parallel for
|
||||
for( int iy = 0; iy < (int)m_height; iy++)
|
||||
{
|
||||
std::thread t = std::thread( [&]()
|
||||
for( int ix = 0; ix < (int)m_width; ix++ )
|
||||
{
|
||||
for( size_t iy = nextRow.fetch_add( 1 );
|
||||
iy < m_height;
|
||||
iy = nextRow.fetch_add( 1 ) )
|
||||
int v = 0;
|
||||
|
||||
for( int sy = 0; sy < 5; sy++ )
|
||||
{
|
||||
for( size_t ix = 0; ix < m_width; ix++ )
|
||||
for( int sx = 0; sx < 5; sx++ )
|
||||
{
|
||||
int v = 0;
|
||||
int factor = filter.kernel[sx][sy];
|
||||
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
|
||||
iy + sy - 2 );
|
||||
|
||||
for( size_t sy = 0; sy < 5; sy++ )
|
||||
{
|
||||
for( size_t sx = 0; sx < 5; sx++ )
|
||||
{
|
||||
int factor = filter.kernel[sx][sy];
|
||||
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
|
||||
iy + sy - 2 );
|
||||
|
||||
v += pixelv * factor;
|
||||
}
|
||||
}
|
||||
|
||||
v /= filter.div;
|
||||
v += filter.offset;
|
||||
CLAMP(v, 0, 255);
|
||||
//TODO: This needs to write to a separate buffer
|
||||
m_pixels[ix + iy * m_width] = v;
|
||||
v += pixelv * factor;
|
||||
}
|
||||
}
|
||||
|
||||
threadsFinished++;
|
||||
} );
|
||||
v /= filter.div;
|
||||
|
||||
t.detach();
|
||||
v += filter.offset;
|
||||
|
||||
CLAMP(v, 0, 255);
|
||||
|
||||
m_pixels[ix + iy * m_width] = v;
|
||||
}
|
||||
}
|
||||
|
||||
while( threadsFinished < parallelThreadCount )
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -36,9 +36,11 @@
|
||||
#include <3d_viewer_id.h>
|
||||
#include "help_common_strings.h"
|
||||
|
||||
extern struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[];
|
||||
|
||||
void EDA_3D_VIEWER::CreateMenuBar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CreateMenuBar" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::CreateMenuBar" ) );
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar;
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
@@ -136,13 +138,33 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
||||
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING,
|
||||
_( "Use Touchpad to Pan" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_CHECK );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
AddMenuItem( prefsMenu, ID_TOOL_SET_VISIBLE_ITEMS,
|
||||
_( "Display Options" ),
|
||||
KiBitmap( read_setup_xpm ) );
|
||||
|
||||
prefsMenu->AppendCheckItem( ID_RENDER_CURRENT_VIEW, _( "Raytracing" ) );
|
||||
prefsMenu->Check( ID_RENDER_CURRENT_VIEW,
|
||||
m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY );
|
||||
wxMenu * renderEngineList = new wxMenu;
|
||||
AddMenuItem( prefsMenu, renderEngineList, ID_MENU3D_ENGINE,
|
||||
_( "Render Engine" ), KiBitmap( render_mode_xpm ) );
|
||||
|
||||
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_OPENGL_LEGACY,
|
||||
_( "OpenGL" ),
|
||||
wxEmptyString );
|
||||
|
||||
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_RAYTRACING,
|
||||
_( "Raytracing" ),
|
||||
wxEmptyString );
|
||||
|
||||
renderEngineList->Check( ID_MENU3D_ENGINE_OPENGL_LEGACY,
|
||||
m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
|
||||
|
||||
renderEngineList->Check( ID_MENU3D_ENGINE_RAYTRACING,
|
||||
m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
|
||||
|
||||
wxMenu * renderOptionsMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_FL,
|
||||
@@ -158,7 +180,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
||||
|
||||
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY,
|
||||
_( "Use Diffuse Only" ),
|
||||
_( "Use only the diffuse color property from model 3D model file" ) );
|
||||
_( "Use only the diffuse color property from model 3D model file " ) );
|
||||
|
||||
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
|
||||
_( "CAD Color Style" ),
|
||||
@@ -306,7 +328,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
||||
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
|
||||
KiBitmap( help_xpm ) );
|
||||
|
||||
wxString text = AddHotkeyName( _( "&List Hotkeys..." ), GetHotkeyConfig(), HK_HELP );
|
||||
wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_3DViewer_Hokeys_Descr, HK_HELP );
|
||||
AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
|
||||
text,
|
||||
_( "Displays the current hotkeys list and corresponding commands" ),
|
||||
@@ -327,4 +349,75 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
||||
KiBitmap( about_xpm ) );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
SetMenuBarOptionsState();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::SetMenuBarOptionsState()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState" ) );
|
||||
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
|
||||
if( menuBar == NULL )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState menuBar == NULL" ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
wxMenuItem* item;
|
||||
// Set the state of toggle menus according to the current display options
|
||||
item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING );
|
||||
item->Check( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
|
||||
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_ENGINE_OPENGL_LEGACY );
|
||||
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_ENGINE_RAYTRACING );
|
||||
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL );
|
||||
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY );
|
||||
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE );
|
||||
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
|
||||
|
||||
// OpenGL
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
|
||||
// Raytracing
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_BACKFLOOR );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFRACTIONS );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFLECTIONS );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_POST_PROCESSING );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES );
|
||||
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
|
||||
item->Check( m_settings.GetFlag( FL_AXIS ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -38,113 +38,103 @@
|
||||
|
||||
void EDA_3D_VIEWER::ReCreateMainToolbar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ReCreateMainToolbar" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::ReCreateMainToolbar" ) );
|
||||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
if( m_mainToolBar != NULL )
|
||||
{
|
||||
// Simple update to the list of old files.
|
||||
SetToolbars();
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_mainToolBar )
|
||||
{
|
||||
m_mainToolBar->Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
||||
}
|
||||
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiScaledBitmap( import3d_xpm, this ), _( "Reload board" ) );
|
||||
KiBitmap( import3d_xpm ), _( "Reload board" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiScaledBitmap( copy_xpm, this ),
|
||||
KiBitmap( copy_xpm ),
|
||||
_( "Copy 3D image to clipboard" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
|
||||
KiScaledBitmap( read_setup_xpm, this ),
|
||||
KiBitmap( read_setup_xpm ),
|
||||
_( "Set display options, and some layers visibility" ) );
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
|
||||
KiScaledBitmap( render_mode_xpm, this ),
|
||||
_( "Render current view using Raytracing" ), wxITEM_CHECK );
|
||||
KiBitmap( render_mode_xpm ),
|
||||
_( "Render current view using Raytracing" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
||||
KiScaledBitmap( zoom_in_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
||||
_( "Zoom in" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
||||
KiScaledBitmap( zoom_out_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
||||
_( "Zoom out" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
KiScaledBitmap( zoom_redraw_xpm, this ),
|
||||
KiBitmap( zoom_redraw_xpm ),
|
||||
_( "Redraw view" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
KiScaledBitmap( zoom_fit_in_page_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
||||
_( "Zoom to fit 3D model" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
|
||||
KiScaledBitmap( rotate_neg_x_xpm, this ),
|
||||
KiBitmap( rotate_neg_x_xpm ),
|
||||
_( "Rotate X Clockwise" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
|
||||
KiScaledBitmap( rotate_pos_x_xpm, this ),
|
||||
KiBitmap( rotate_pos_x_xpm ),
|
||||
_( "Rotate X Counterclockwise" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
|
||||
KiScaledBitmap( rotate_neg_y_xpm, this ),
|
||||
KiBitmap( rotate_neg_y_xpm ),
|
||||
_( "Rotate Y Clockwise" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
|
||||
KiScaledBitmap( rotate_pos_y_xpm, this ),
|
||||
KiBitmap( rotate_pos_y_xpm ),
|
||||
_( "Rotate Y Counterclockwise" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
|
||||
KiScaledBitmap( rotate_neg_z_xpm, this ),
|
||||
KiBitmap( rotate_neg_z_xpm ),
|
||||
_( "Rotate Z Clockwise" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
|
||||
KiScaledBitmap( rotate_pos_z_xpm, this ),
|
||||
KiBitmap( rotate_pos_z_xpm ),
|
||||
_( "Rotate Z Counterclockwise" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString,
|
||||
KiScaledBitmap( left_xpm, this ),
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
|
||||
_( "Move left" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString,
|
||||
KiScaledBitmap( right_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
|
||||
_( "Move right" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString,
|
||||
KiScaledBitmap( up_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
|
||||
_( "Move up" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString,
|
||||
KiScaledBitmap( down_xpm, this ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
|
||||
_( "Move down" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString,
|
||||
KiScaledBitmap( ortho_xpm, this ),
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
|
||||
_( "Enable/Disable orthographic projection" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_mainToolBar->Realize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::SetToolbars()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -52,6 +52,8 @@ void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
SetMenuBarOptionsState();
|
||||
|
||||
NewDisplay( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// C++ code generated with wxFormBuilder (version Jul 2 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_3D_view_option_base.h"
|
||||
@@ -134,7 +134,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
|
||||
bSizeLeft->Add( fgSizer3DVisibility, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerUpper->Add( bSizeLeft, 1, wxEXPAND, 5 );
|
||||
bSizerUpper->Add( bSizeLeft, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_staticlineVertical = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
||||
bSizerUpper->Add( m_staticlineVertical, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="14" />
|
||||
<FileVersion major="1" minor="13" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
@@ -14,7 +14,6 @@
|
||||
<property name="file">dialog_3D_view_option_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_3D_view_option_base</property>
|
||||
<property name="namespace"></property>
|
||||
@@ -55,20 +54,13 @@
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiPaneActivated"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -83,23 +75,17 @@
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMaximize"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnMove"></event>
|
||||
<event name="OnMoveEnd"></event>
|
||||
<event name="OnMoveStart"></event>
|
||||
<event name="OnMoving"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnShow"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
@@ -118,7 +104,7 @@
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
@@ -158,7 +144,6 @@
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Render options:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -184,14 +169,7 @@
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -298,14 +276,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -392,14 +363,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox">OnCheckRealisticMode</event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -491,14 +455,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -585,14 +542,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -684,14 +634,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -778,14 +721,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -877,14 +813,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -971,14 +900,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1070,14 +992,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -1164,14 +1079,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1260,7 +1168,6 @@
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">3D model visibility:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -1286,14 +1193,7 @@
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -1400,14 +1300,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -1494,14 +1387,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1593,14 +1479,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -1687,14 +1566,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1786,14 +1658,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -1880,14 +1745,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1973,14 +1831,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2056,7 +1907,6 @@
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Board layers:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -2082,14 +1932,7 @@
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2196,14 +2039,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2290,14 +2126,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -2389,14 +2218,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2483,14 +2305,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -2582,14 +2397,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2676,14 +2484,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -2775,14 +2576,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -2869,14 +2663,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -2947,7 +2734,6 @@
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">User layers (not shown in realistic mode):</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -2973,14 +2759,7 @@
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -3087,14 +2866,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -3181,14 +2953,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -3280,14 +3045,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
@@ -3374,14 +3132,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -3471,14 +3222,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// C++ code generated with wxFormBuilder (version Jul 2 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_3D_VIEW_OPTION_BASE_H__
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class DIALOG_SHIM;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -28,30 +28,22 @@
|
||||
*/
|
||||
|
||||
#include "eda_3d_viewer.h"
|
||||
|
||||
#include "../3d_viewer_id.h"
|
||||
#include "../common_ogl/cogl_att_list.h"
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dpi_scaling.h>
|
||||
#include <gestfich.h>
|
||||
#include <lru_cache.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <hotkeys_basic.h>
|
||||
#include <gestfich.h>
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/colourdata.h>
|
||||
#include <lru_cache.h>
|
||||
#include "../common_ogl/cogl_att_list.h"
|
||||
#include <hotkeys_basic.h>
|
||||
#include <wx/toolbar.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
|
||||
/**
|
||||
* Flag to enable 3D viewer main frame window debug tracing.
|
||||
*
|
||||
* Use "KI_TRACE_EDA_3D_VIEWER" to enable.
|
||||
*
|
||||
* @ingroup trace_env_vars
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
* "KI_TRACE_EDA_3D_VIEWER". See the wxWidgets documentation on wxLogTrace for
|
||||
* more information.
|
||||
*/
|
||||
const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
|
||||
|
||||
@@ -124,48 +116,42 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
|
||||
EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
|
||||
EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
|
||||
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_3D_VIEWER::ProcessZoom )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW,
|
||||
EDA_3D_VIEWER::ProcessZoom )
|
||||
|
||||
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
|
||||
EDA_3D_VIEWER::Process_Special_Functions )
|
||||
|
||||
EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
|
||||
|
||||
EVT_MENU( wxID_EXIT, EDA_3D_VIEWER::Exit3DFrame )
|
||||
EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnRenderEngineSelection )
|
||||
EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing )
|
||||
EVT_MENU( wxID_EXIT,
|
||||
EDA_3D_VIEWER::Exit3DFrame )
|
||||
|
||||
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END, EDA_3D_VIEWER::On3DGridSelection )
|
||||
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
|
||||
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END,
|
||||
EDA_3D_VIEWER::On3DGridSelection )
|
||||
|
||||
EVT_MENU_RANGE( ID_MENU3D_ENGINE, ID_MENU3D_ENGINE_END,
|
||||
EDA_3D_VIEWER::OnRenderEngineSelection )
|
||||
|
||||
EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
|
||||
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
|
||||
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
|
||||
EDA_3D_VIEWER::OnUpdateUIMaterial )
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
|
||||
ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
|
||||
EDA_3D_VIEWER::OnUpdateUIOpenGL )
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
|
||||
ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
EDA_3D_VIEWER::OnUpdateUIRayTracing )
|
||||
EVT_UPDATE_UI_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
|
||||
EDA_3D_VIEWER::OnUpdateMenus )
|
||||
|
||||
EVT_UPDATE_UI( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnUpdateUIEngine )
|
||||
EVT_UPDATE_UI( ID_MENU3D_AXIS_ONOFF, EDA_3D_VIEWER::OnUpdateUIAxis )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
||||
const wxString &aTitle, long style ) :
|
||||
|
||||
KIWAY_PLAYER( aKiway, aParent,
|
||||
FRAME_PCB_DISPLAY3D, aTitle,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style, VIEWER3D_FRAMENAME )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::EDA_3D_VIEWER %s" ), aTitle );
|
||||
|
||||
m_canvas = NULL;
|
||||
m_disable_ray_tracing = false;
|
||||
|
||||
// Give it an icon
|
||||
wxIcon icon;
|
||||
@@ -178,8 +164,11 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
||||
// Create the status line
|
||||
static const int status_dims[4] = { -1, 130, 130, 170 };
|
||||
|
||||
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
|
||||
SetStatusWidths( arrayDim( status_dims ), status_dims );
|
||||
wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) );
|
||||
SetStatusWidths( DIM( status_dims ), status_dims );
|
||||
|
||||
CreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
m_canvas = new EDA_3D_CANVAS( this,
|
||||
COGL_ATT_LIST::GetAttributesList( true ),
|
||||
@@ -190,21 +179,24 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
||||
if( m_canvas )
|
||||
m_canvas->SetStatusBar( status_bar );
|
||||
|
||||
// Some settings need the canvas
|
||||
loadCommonSettings();
|
||||
|
||||
CreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||
EDA_PANEINFO horiztb;
|
||||
horiztb.HorizontalToolbarPane();
|
||||
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );
|
||||
|
||||
if( m_canvas )
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
|
||||
NULL, this );
|
||||
m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
|
||||
(m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );
|
||||
|
||||
m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
|
||||
|
||||
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
|
||||
// in order to receive mouse events. Otherwise, the user has to click somewhere on
|
||||
@@ -216,8 +208,7 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
||||
|
||||
EDA_3D_VIEWER::~EDA_3D_VIEWER()
|
||||
{
|
||||
m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
|
||||
NULL, this );
|
||||
m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
|
||||
|
||||
m_auimgr.UnInit();
|
||||
|
||||
@@ -248,7 +239,7 @@ void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
|
||||
|
||||
void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::Exit3DFrame" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::Exit3DFrame" ) );
|
||||
|
||||
Close( true );
|
||||
}
|
||||
@@ -256,7 +247,7 @@ void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
|
||||
|
||||
void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnCloseWindow" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnCloseWindow" ) );
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->Close();
|
||||
@@ -277,7 +268,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
bool isChecked = event.IsChecked();
|
||||
|
||||
wxLogTrace( m_logTrace,
|
||||
"EDA_3D_VIEWER::Process_Special_Functions id %d isChecked %d",
|
||||
wxT( "EDA_3D_VIEWER::Process_Special_Functions id:%d isChecked:%d" ),
|
||||
id, isChecked );
|
||||
|
||||
if( m_canvas == NULL )
|
||||
@@ -285,68 +276,42 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_RENDER_CURRENT_VIEW:
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
break;
|
||||
|
||||
case ID_RELOAD3D_BOARD:
|
||||
NewDisplay( true );
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_POS:
|
||||
m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_NEG:
|
||||
m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Y_POS:
|
||||
m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Y_NEG:
|
||||
m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Z_POS:
|
||||
m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Z_NEG:
|
||||
m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
case ID_MOVE3D_LEFT:
|
||||
@@ -377,8 +342,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_BOTTOM_SELECTION:
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ),
|
||||
nullptr ) )
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ) ) )
|
||||
{
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
@@ -388,7 +352,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_TOP_SELECTION:
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ) ) )
|
||||
{
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
@@ -417,8 +381,13 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
Set3DBoardBodyColorFromUser();
|
||||
break;
|
||||
|
||||
case ID_MENU3D_MOUSEWHEEL_PANNING:
|
||||
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, isChecked );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_REALISTIC_MODE:
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
|
||||
SetMenuBarOptionsState();
|
||||
NewDisplay( true );
|
||||
return;
|
||||
|
||||
@@ -545,10 +514,13 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
case ID_MENU3D_RESET_DEFAULTS:
|
||||
{
|
||||
// Reload settings with a dummy config, so it will load the defaults
|
||||
wxConfig *fooconfig = new wxConfig( "FooBarApp" );
|
||||
wxConfig *fooconfig = new wxConfig("FooBarApp");
|
||||
LoadSettings( fooconfig );
|
||||
delete fooconfig;
|
||||
|
||||
// Refresh menu option state
|
||||
SetMenuBarOptionsState();
|
||||
|
||||
// Tell canvas that we (may have) changed the render engine
|
||||
RenderEngineChanged();
|
||||
|
||||
@@ -563,7 +535,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
return;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::Process_Special_Functions()" );
|
||||
wxLogMessage( wxT( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d" ), id );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -576,7 +548,7 @@ void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
|
||||
wxASSERT( id < ID_MENU3D_GRID_END );
|
||||
wxASSERT( id > ID_MENU3D_GRID );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::On3DGridSelection id %d", id );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::On3DGridSelection id:%d" ), id );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
@@ -601,7 +573,7 @@ void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
|
||||
wxLogMessage( wxT( "EDA_3D_VIEWER::On3DGridSelection() error: unknown command %d" ), id );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,16 +584,31 @@ void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
|
||||
|
||||
void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
wxASSERT( id < ID_MENU3D_ENGINE_END );
|
||||
wxASSERT( id > ID_MENU3D_ENGINE );
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRenderEngineSelection id:%d" ), id );
|
||||
|
||||
const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
|
||||
|
||||
if( old_engine == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_RAYTRACING );
|
||||
else
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_OPENGL_LEGACY );
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU3D_ENGINE_OPENGL_LEGACY:
|
||||
if( old_engine != RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_OPENGL_LEGACY );
|
||||
break;
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRenderEngineSelection type %s ",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ?
|
||||
"Ray Trace" : "OpenGL Legacy" );
|
||||
case ID_MENU3D_ENGINE_RAYTRACING:
|
||||
if( old_engine != RENDER_ENGINE_RAYTRACING )
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_RAYTRACING );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogMessage( wxT( "EDA_3D_VIEWER::OnRenderEngineSelection() error: unknown command %d" ), id );
|
||||
return;
|
||||
}
|
||||
|
||||
if( old_engine != m_settings.RenderEngineGet() )
|
||||
{
|
||||
@@ -630,11 +617,19 @@ void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateMenus(wxUpdateUIEvent &event)
|
||||
{
|
||||
//!TODO: verify how many times this event is called and check if that is OK
|
||||
// to have it working this way
|
||||
SetMenuBarOptionsState();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ProcessZoom id:%d", id );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::ProcessZoom id:%d" ), id );
|
||||
|
||||
if( m_canvas == NULL )
|
||||
return;
|
||||
@@ -658,7 +653,7 @@ void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::ProcessZoom()" );
|
||||
wxLogMessage( wxT( "EDA_3D_VIEWER::ProcessZoom() error: unknown command %d" ), id );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -666,18 +661,9 @@ void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::%s disabling ray tracing.", __WXFUNCTION__ );
|
||||
|
||||
m_disable_ray_tracing = true;
|
||||
m_settings.RenderEngineSet( RENDER_ENGINE_OPENGL_LEGACY );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnActivate" ) );
|
||||
|
||||
if( m_canvas )
|
||||
{
|
||||
@@ -708,7 +694,7 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::LoadSettings" ) );
|
||||
|
||||
aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
|
||||
aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
|
||||
@@ -736,7 +722,7 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
// m_CopperColor default value = gold
|
||||
aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
|
||||
aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 /255.0 );
|
||||
|
||||
// m_BoardBodyColor default value = FR4, in realistic mode
|
||||
aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
|
||||
@@ -745,6 +731,9 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
|
||||
|
||||
bool tmp;
|
||||
aCfg->Read( keyMousewheelPanning, &tmp, false );
|
||||
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, tmp );
|
||||
|
||||
aCfg->Read( keyShowRealisticMode, &tmp, true );
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
|
||||
@@ -818,8 +807,6 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
m_settings.GridSet( (GRID3D_TYPE)tmpi );
|
||||
|
||||
aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings render setting %s",
|
||||
( (RENDER_ENGINE)tmpi == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
|
||||
m_settings.RenderEngineSet( (RENDER_ENGINE)tmpi );
|
||||
|
||||
aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
|
||||
@@ -831,7 +818,7 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SaveSettings" ) );
|
||||
|
||||
aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
|
||||
aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
|
||||
@@ -863,17 +850,15 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
||||
|
||||
aCfg->Write( keyShowRealisticMode, m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
|
||||
aCfg->Write( keyMousewheelPanning, m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
|
||||
|
||||
aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
|
||||
|
||||
aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
|
||||
|
||||
// OpenGL options
|
||||
aCfg->Write( keyRenderOGL_ShowCopperTck,
|
||||
m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
aCfg->Write( keyRenderOGL_ShowModelBBox,
|
||||
m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
aCfg->Write( keyRenderOGL_ShowCopperTck,m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
aCfg->Write( keyRenderOGL_ShowModelBBox,m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
|
||||
// Raytracing options
|
||||
aCfg->Write( keyRenderRAY_Shadows, m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
|
||||
@@ -902,32 +887,16 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::CommonSettingsChanged()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
|
||||
|
||||
// Regen menu bars, etc
|
||||
EDA_BASE_FRAME::CommonSettingsChanged();
|
||||
|
||||
// There is no base class that handles toolbars for this frame
|
||||
ReCreateMainToolbar();
|
||||
|
||||
loadCommonSettings();
|
||||
|
||||
NewDisplay( true );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnLeftClick( wxDC *DC, const wxPoint &MousePos )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnLeftClick" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnLeftClick" ) );
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnRightClick( const wxPoint &MousePos, wxMenu *PopMenu )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRightClick" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRightClick" ) );
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@@ -943,7 +912,7 @@ void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
|
||||
|
||||
void EDA_3D_VIEWER::RedrawActiveWindow( wxDC *DC, bool EraseBg )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RedrawActiveWindow" );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::RedrawActiveWindow" ) );
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@@ -959,29 +928,24 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
|
||||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
// Remember path between saves during this session only.
|
||||
const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
|
||||
const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
|
||||
static wxFileName fn;
|
||||
const wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
|
||||
const wxString mask = wxT( "*." ) + file_ext;
|
||||
|
||||
// First time path is set to the project path.
|
||||
if( !m_defaultSaveScreenshotFileName.IsOk() )
|
||||
m_defaultSaveScreenshotFileName = Parent()->Prj().GetProjectFullName();
|
||||
if( !fn.IsOk() )
|
||||
fn = Parent()->Prj().GetProjectFullName();
|
||||
|
||||
m_defaultSaveScreenshotFileName.SetExt( ext );
|
||||
fn.SetExt( file_ext );
|
||||
|
||||
wxFileDialog dlg( this, _( "3D Image File Name" ),
|
||||
m_defaultSaveScreenshotFileName.GetPath(),
|
||||
m_defaultSaveScreenshotFileName.GetFullName(), wildcard,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
fullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
|
||||
m_defaultSaveScreenshotFileName, file_ext, mask, this,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
if( fullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
m_defaultSaveScreenshotFileName = dlg.GetPath();
|
||||
|
||||
if( m_defaultSaveScreenshotFileName.GetExt().IsEmpty() )
|
||||
m_defaultSaveScreenshotFileName.SetExt( ext );
|
||||
|
||||
fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
|
||||
fn = fullFileName;
|
||||
|
||||
// Be sure the screen area destroyed by the file dialog is redrawn
|
||||
// before making a screen copy.
|
||||
@@ -990,7 +954,7 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
// Be sure we have the latest 3D view (remember 3D view is buffered)
|
||||
m_canvas->Request_refresh( true );
|
||||
Refresh();
|
||||
wxYield();
|
||||
|
||||
// Build image from the 3D buffer
|
||||
@@ -1031,32 +995,43 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
|
||||
|
||||
void EDA_3D_VIEWER::RenderEngineChanged()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RenderEngineChanged()" );
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->RenderEngineChanged();
|
||||
|
||||
m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
|
||||
(m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );
|
||||
|
||||
m_mainToolBar->Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors )
|
||||
wxColourData* aPredefinedColors )
|
||||
{
|
||||
KIGFX::COLOR4D newcolor;
|
||||
KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
|
||||
wxColour newcolor, oldcolor;
|
||||
|
||||
DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
|
||||
oldcolor.Set( KiROUND( aColor.r * 255 ),
|
||||
KiROUND( aColor.g * 255 ),
|
||||
KiROUND( aColor.b * 255 ) );
|
||||
|
||||
if( picker.ShowModal() != wxID_OK )
|
||||
wxColourData emptyColorSet; // Provides a empty predefined set of colors
|
||||
// if no color set available to avoid use of an
|
||||
// old color set
|
||||
|
||||
if( aPredefinedColors == NULL )
|
||||
aPredefinedColors = &emptyColorSet;
|
||||
|
||||
newcolor = wxGetColourFromUser( this, oldcolor, aTitle, aPredefinedColors );
|
||||
|
||||
if( !newcolor.IsOk() ) // Cancel command
|
||||
return false;
|
||||
|
||||
newcolor = picker.GetColor();
|
||||
|
||||
if( newcolor == oldcolor )
|
||||
return false;
|
||||
|
||||
aColor.r = newcolor.r;
|
||||
aColor.g = newcolor.g;
|
||||
aColor.b = newcolor.b;
|
||||
if( newcolor != oldcolor )
|
||||
{
|
||||
aColor.r = (double) newcolor.Red() / 255.0;
|
||||
aColor.g = (double) newcolor.Green() / 255.0;
|
||||
aColor.b = (double) newcolor.Blue() / 255.0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1064,12 +1039,20 @@ bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
|
||||
wxColourData definedColors;
|
||||
unsigned int i = 0;
|
||||
|
||||
definedColors.SetCustomColour( i++, wxColour( 241, 241, 241 ) ); // White
|
||||
definedColors.SetCustomColour( i++, wxColour( 4, 18, 21 ) ); // Dark
|
||||
|
||||
for(; i < wxColourData::NUM_CUSTOM;)
|
||||
{
|
||||
definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SilkScreenColor,
|
||||
_( "Solder Mask Color" ), &definedColors );
|
||||
_( "Silk Screen Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( true );
|
||||
@@ -1080,25 +1063,28 @@ bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
wxColourData definedColors;
|
||||
unsigned int i = 0;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0,
|
||||
"Saturated Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0,
|
||||
"Red Light Orange" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0,
|
||||
"Green blue (dark)" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
|
||||
definedColors.SetCustomColour( i++, wxColour( 20, 51, 36 ) ); // Green
|
||||
definedColors.SetCustomColour( i++, wxColour( 91, 168, 12 ) ); // Light Green
|
||||
definedColors.SetCustomColour( i++, wxColour( 13, 104, 11 ) ); // Saturated Green
|
||||
definedColors.SetCustomColour( i++, wxColour(181, 19, 21 ) ); // Red
|
||||
definedColors.SetCustomColour( i++, wxColour(239, 53, 41 ) ); // Red Light Orange
|
||||
definedColors.SetCustomColour( i++, wxColour(210, 40, 14 ) ); // Red 2
|
||||
definedColors.SetCustomColour( i++, wxColour( 2, 59, 162 ) ); // Blue
|
||||
definedColors.SetCustomColour( i++, wxColour( 54, 79, 116 ) ); // Light blue 1
|
||||
definedColors.SetCustomColour( i++, wxColour( 61, 85, 130 ) ); // Light blue 2
|
||||
definedColors.SetCustomColour( i++, wxColour( 21, 70, 80 ) ); // Green blue (dark)
|
||||
definedColors.SetCustomColour( i++, wxColour( 11, 11, 11 ) ); // Black
|
||||
definedColors.SetCustomColour( i++, wxColour( 245, 245,245 ) ); // White
|
||||
definedColors.SetCustomColour( i++, wxColour(119, 31, 91 ) ); // Purple
|
||||
definedColors.SetCustomColour( i++, wxColour( 32, 2, 53 ) ); // Purple Dark
|
||||
|
||||
for(; i < wxColourData::NUM_CUSTOM;)
|
||||
{
|
||||
definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SolderMaskColor,
|
||||
_( "Solder Mask Color" ),
|
||||
@@ -1113,14 +1099,21 @@ bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DCopperColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
wxColourData definedColors;
|
||||
unsigned int i = 0;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
|
||||
definedColors.SetCustomColour( i++, wxColour( 184, 115, 50) ); // Copper
|
||||
definedColors.SetCustomColour( i++, wxColour( 191, 155, 58) ); // Gold
|
||||
definedColors.SetCustomColour( i++, wxColour( 213, 213, 213) ); // Silver
|
||||
definedColors.SetCustomColour( i++, wxColour( 160, 160, 160) ); // tin
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ),
|
||||
for(; i < wxColourData::NUM_CUSTOM;)
|
||||
{
|
||||
definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_CopperColor,
|
||||
_( "Copper Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
@@ -1132,20 +1125,27 @@ bool EDA_3D_VIEWER::Set3DCopperColorFromUser()
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
wxColourData definedColors;
|
||||
unsigned int i = 0;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0,
|
||||
"FR4 natural, dark" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
|
||||
definedColors.SetCustomColour( i++, wxColour( 51, 43, 22 ) ); // FR4 natural, dark
|
||||
definedColors.SetCustomColour( i++, wxColour( 109, 116, 75 ) ); // FR4 natural
|
||||
definedColors.SetCustomColour( i++, wxColour( 78, 14, 5 ) ); // brown/red
|
||||
definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 1
|
||||
definedColors.SetCustomColour( i++, wxColour( 160, 123, 54 ) ); // brown 2
|
||||
definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 3
|
||||
definedColors.SetCustomColour( i++, wxColour( 63, 126, 71 ) ); // green 1
|
||||
definedColors.SetCustomColour( i++, wxColour( 117, 122, 90 ) ); // green 2
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ),
|
||||
for(; i < wxColourData::NUM_CUSTOM;)
|
||||
{
|
||||
definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor,
|
||||
_( "Board Body Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( true );
|
||||
|
||||
@@ -1155,141 +1155,24 @@ bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser()
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
wxColourData definedColors;
|
||||
unsigned int i = 0;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
|
||||
definedColors.SetCustomColour( i++, wxColour( 128, 128, 128 ) ); // grey
|
||||
definedColors.SetCustomColour( i++, wxColour( 213, 213, 213 ) ); // Silver
|
||||
definedColors.SetCustomColour( i++, wxColour( 90, 90, 90 ) ); // grey 2
|
||||
|
||||
for(; i < wxColourData::NUM_CUSTOM;)
|
||||
{
|
||||
definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SolderPasteColor,
|
||||
_( "Solder Paste Color" ), &definedColors );
|
||||
_( "Solder Paste Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( true );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIEngine( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIEngine %s %s",
|
||||
( !m_disable_ray_tracing ) ? "enable" : "disable",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ?
|
||||
"Ray Trace" : "OpenGL Legacy" );
|
||||
|
||||
aEvent.Enable( !m_disable_ray_tracing );
|
||||
aEvent.Check( m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIMaterial( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIMaterial() id %d", aEvent.GetId() );
|
||||
|
||||
// Set the state of toggle menus according to the current display options
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIOpenGL( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIOpenGL() id %d", aEvent.GetId() );
|
||||
|
||||
// OpenGL
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIOpenGL()" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIRayTracing( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIRayTracing() id %d", aEvent.GetId() );
|
||||
|
||||
// Raytracing
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_BACKFLOOR:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_REFRACTIONS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_REFLECTIONS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIAxis( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( m_settings.GetFlag( FL_AXIS ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::loadCommonSettings()
|
||||
{
|
||||
wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );
|
||||
|
||||
wxConfigBase& cmnCfg = *Pgm().CommonSettings();
|
||||
|
||||
{
|
||||
const DPI_SCALING dpi{ &cmnCfg, this };
|
||||
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
{
|
||||
bool option;
|
||||
cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
|
||||
m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, option );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -32,11 +32,11 @@
|
||||
#ifndef EDA_3D_VIEWER_H
|
||||
#define EDA_3D_VIEWER_H
|
||||
|
||||
|
||||
#include "../3d_canvas/cinfo3d_visu.h"
|
||||
#include "../3d_canvas/eda_3d_canvas.h"
|
||||
#include <kiway_player.h>
|
||||
#include <wx/colourdata.h>
|
||||
#include <../common/dialogs/dialog_color_picker.h> // for CUSTOM_COLORS_LIST definition
|
||||
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||
@@ -44,6 +44,7 @@
|
||||
#define VIEWER3D_FRAMENAME wxT( "Viewer3DFrameName" )
|
||||
|
||||
/**
|
||||
* Class EDA_3D_VIEWER
|
||||
* Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard
|
||||
*/
|
||||
class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
@@ -84,42 +85,44 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
void NewDisplay( bool aForceImmediateRedraw = false );
|
||||
|
||||
/**
|
||||
* Function SetDefaultFileName
|
||||
* Set the default file name (eg: to be suggested to a screenshot)
|
||||
* @param aFn = file name to assign
|
||||
*/
|
||||
void SetDefaultFileName( const wxString& aFn )
|
||||
void SetDefaultFileName( const wxString &aFn )
|
||||
{
|
||||
m_defaultSaveScreenshotFileName = aFn;
|
||||
wxFileName fn( aFn );
|
||||
m_defaultSaveScreenshotFileName = fn.GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetDefaultFileName
|
||||
* @return the default suggested file name
|
||||
*/
|
||||
const wxFileName& GetDefaultFileName() const { return m_defaultSaveScreenshotFileName; }
|
||||
const wxString &GetDefaultFileName() const { return m_defaultSaveScreenshotFileName; }
|
||||
|
||||
/**
|
||||
* Function GetSettings
|
||||
* @return current settings
|
||||
*/
|
||||
CINFO3D_VISU &GetSettings() { return m_settings; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
/**
|
||||
* Function Set3DColorFromUser
|
||||
* Get a SFVEC3D from a wx colour dialog
|
||||
* @param aColor is the SFVEC3D to change
|
||||
* @param aTitle is the title displayed in the colordialog selector
|
||||
* @param aPredefinedColors is a reference to a CUSTOM_COLOR_ITEM list
|
||||
* @param aPredefinedColors is a reference to a wxColourData
|
||||
* which contains a few predefined colors
|
||||
* if empty, no predefined colors are used.
|
||||
* no change if aborted by user
|
||||
* if it is NULL, no predefined colors are used
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors );
|
||||
wxColourData* aPredefinedColors = NULL );
|
||||
|
||||
/**
|
||||
* Function Set3DSolderMaskColorFromUser
|
||||
* Set the solder mask color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
@@ -127,6 +130,7 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
bool Set3DSolderMaskColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DSolderPasteColorFromUser
|
||||
* Set the solder mask color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
@@ -134,6 +138,7 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
bool Set3DSolderPasteColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DCopperColorFromUser
|
||||
* Set the copper color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
@@ -141,6 +146,7 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
bool Set3DCopperColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DBoardBodyBodyColorFromUser
|
||||
* Set the copper color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
@@ -148,21 +154,13 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
bool Set3DBoardBodyColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DSilkScreenColorFromUser
|
||||
* Set the silkscreen color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DSilkScreenColorFromUser();
|
||||
|
||||
/**
|
||||
* Notification that common settings are updated.
|
||||
*
|
||||
* This would be private (and only called by the Kiway), but we
|
||||
* need to do this manually from the PCB frame because the 3D viewer isn't
|
||||
* updated via the #KIWAY.
|
||||
*/
|
||||
void CommonSettingsChanged() override;
|
||||
|
||||
private:
|
||||
/// Called when user press the File->Exit
|
||||
void Exit3DFrame( wxCommandEvent &event );
|
||||
@@ -174,13 +172,8 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
void On3DGridSelection( wxCommandEvent &event );
|
||||
|
||||
void OnRenderEngineSelection( wxCommandEvent &event );
|
||||
void OnDisableRayTracing( wxCommandEvent& aEvent );
|
||||
|
||||
void OnUpdateUIEngine( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIMaterial( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIOpenGL( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIRayTracing( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIAxis( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateMenus(wxUpdateUIEvent& event);
|
||||
|
||||
void ProcessZoom( wxCommandEvent &event );
|
||||
|
||||
@@ -192,14 +185,13 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
|
||||
void CreateMenuBar();
|
||||
|
||||
void DisplayHotKeys()
|
||||
{
|
||||
DisplayHotkeyList( this, GetHotkeyConfig() );
|
||||
}
|
||||
void DisplayHotKeys();
|
||||
|
||||
/**
|
||||
* Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar
|
||||
* Set the state of toggle menus according to the current display options
|
||||
*/
|
||||
void SetMenuBarOptionsState();
|
||||
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
void SetToolbars();
|
||||
@@ -215,6 +207,7 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
void RedrawActiveWindow( wxDC *DC, bool EraseBg );
|
||||
|
||||
/**
|
||||
* Function TakeScreenshot
|
||||
* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
@@ -229,15 +222,10 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Load configuration from common settings.
|
||||
*/
|
||||
void loadCommonSettings();
|
||||
|
||||
/**
|
||||
* Filename to propose for save a screenshot
|
||||
*/
|
||||
wxFileName m_defaultSaveScreenshotFileName;
|
||||
wxString m_defaultSaveScreenshotFileName;
|
||||
|
||||
/**
|
||||
* The canvas where the openGL context will be rendered
|
||||
@@ -249,8 +237,6 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
||||
*/
|
||||
CINFO3D_VISU m_settings;
|
||||
|
||||
bool m_disable_ray_tracing;
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "../3d_viewer_id.h"
|
||||
|
||||
// Define 3D Viewer Hotkeys
|
||||
static EDA_HOTKEY HkHotkeysHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
|
||||
static EDA_HOTKEY HkHotkeysHelp( _HKI( "Help (this window)" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
|
||||
static EDA_HOTKEY Hk3D_PivotCenter( _HKI( "Center pivot rotation (Middle mouse click)" ), 0, WXK_SPACE );
|
||||
static EDA_HOTKEY Hk3D_MoveLeft( _HKI( "Move board Left" ), ID_POPUP_MOVE3D_LEFT, WXK_LEFT );
|
||||
static EDA_HOTKEY Hk3D_MoveRight( _HKI( "Move board Right" ), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT );
|
||||
@@ -86,20 +86,14 @@ static EDA_HOTKEY* viewer3d_Hotkey_List[] =
|
||||
|
||||
// list of sections and corresponding hotkey list for the 3D Viewer
|
||||
// (used to list current hotkeys)
|
||||
static struct EDA_HOTKEY_CONFIG s_3DViewer_Hotkeys_Descr[] =
|
||||
struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[] =
|
||||
{
|
||||
{ &g_CommonSectionTag, viewer3d_Hotkey_List, &viewer3DSectionTitle },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_VIEWER::GetHotkeyConfig() const
|
||||
void EDA_3D_VIEWER::DisplayHotKeys()
|
||||
{
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
}
|
||||
|
||||
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_CANVAS::GetHotkeyConfig() const
|
||||
{
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
DisplayHotkeyList( this, g_3DViewer_Hokeys_Descr );
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ enum id_3dview_frm
|
||||
ID_MENU3D_COMMENTS_ONOFF,
|
||||
ID_MENU3D_ECO_ONOFF,
|
||||
ID_MENU3D_SHOW_BOARD_BODY,
|
||||
ID_MENU3D_MOUSEWHEEL_PANNING,
|
||||
ID_MENU3D_REALISTIC_MODE,
|
||||
|
||||
ID_MENU3D_FL,
|
||||
@@ -78,6 +79,8 @@ enum id_3dview_frm
|
||||
ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
|
||||
ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
ID_MENU_SCREENCOPY_JPEG,
|
||||
ID_MENU_SCREENCOPY_TOCLIBBOARD,
|
||||
@@ -89,8 +92,6 @@ enum id_3dview_frm
|
||||
|
||||
ID_MENU_COMMAND_END,
|
||||
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
|
||||
ID_TOOL_SET_VISIBLE_ITEMS,
|
||||
|
||||
ID_MENU3D_GRID,
|
||||
@@ -101,7 +102,10 @@ enum id_3dview_frm
|
||||
ID_MENU3D_GRID_1_MM,
|
||||
ID_MENU3D_GRID_END,
|
||||
|
||||
ID_DISABLE_RAY_TRACING,
|
||||
ID_MENU3D_ENGINE,
|
||||
ID_MENU3D_ENGINE_OPENGL_LEGACY,
|
||||
ID_MENU3D_ENGINE_RAYTRACING,
|
||||
ID_MENU3D_ENGINE_END,
|
||||
|
||||
ID_POPUP_3D_VIEW_START,
|
||||
ID_POPUP_ZOOMIN,
|
||||
|
||||
@@ -6,8 +6,8 @@ configure_file( 3d_plugin_dir.h.in 3d_plugin_dir.h @ONLY )
|
||||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
../include/legacy_wx
|
||||
../pcbnew
|
||||
../polygon
|
||||
3d_canvas
|
||||
3d_cache
|
||||
3d_rendering
|
||||
@@ -33,10 +33,18 @@ set(3D-VIEWER_SRCS
|
||||
3d_cache/3d_cache_wrapper.cpp
|
||||
3d_cache/3d_cache.cpp
|
||||
3d_cache/3d_plugin_manager.cpp
|
||||
3d_cache/3d_filename_resolver.cpp
|
||||
${DIR_DLG}/3d_cache_dialogs.cpp
|
||||
${DIR_DLG}/dlg_3d_pathconfig_base.cpp
|
||||
${DIR_DLG}/dlg_3d_pathconfig.cpp
|
||||
${DIR_DLG}/dlg_select_3dmodel.cpp
|
||||
${DIR_DLG}/panel_prev_3d_base.cpp
|
||||
${DIR_DLG}/panel_prev_model.cpp
|
||||
../polygon/poly2tri/common/shapes.cc
|
||||
../polygon/poly2tri/sweep/advancing_front.cc
|
||||
../polygon/poly2tri/sweep/cdt.cc
|
||||
../polygon/poly2tri/sweep/sweep.cc
|
||||
../polygon/poly2tri/sweep/sweep_context.cc
|
||||
3d_canvas/cinfo3d_visu.cpp
|
||||
3d_canvas/create_layer_items.cpp
|
||||
3d_canvas/create_3Dgraphic_brd_items.cpp
|
||||
@@ -71,6 +79,7 @@ set(3D-VIEWER_SRCS
|
||||
${DIR_RAY_2D}/cring2d.cpp
|
||||
${DIR_RAY_2D}/croundsegment2d.cpp
|
||||
${DIR_RAY_2D}/ctriangle2d.cpp
|
||||
${DIR_RAY_2D}/edgeshrink.cpp
|
||||
${DIR_RAY_3D}/cbbox.cpp
|
||||
${DIR_RAY_3D}/cbbox_ray.cpp
|
||||
${DIR_RAY_3D}/ccylinder.cpp
|
||||
@@ -107,7 +116,6 @@ add_dependencies( 3d-viewer pcbcommon )
|
||||
|
||||
target_link_libraries( 3d-viewer
|
||||
gal
|
||||
polygon
|
||||
${Boost_}
|
||||
${wxWidgets_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
|
||||
@@ -75,7 +75,7 @@ const int COGL_ATT_LIST::m_openGL_attributes_list[] = {
|
||||
#define ATT_WX_GL_SAMPLE_BUFFERS_DATA 11
|
||||
|
||||
int COGL_ATT_LIST::m_openGL_attributes_list_to_use[
|
||||
arrayDim( COGL_ATT_LIST::m_openGL_attributes_list ) ] = { 0 };
|
||||
DIM( COGL_ATT_LIST::m_openGL_attributes_list ) ] = { 0 };
|
||||
|
||||
|
||||
const int *COGL_ATT_LIST::GetAttributesList( bool aUseAntiAliasing )
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file openmp_mutex.h
|
||||
* @brief a mutex for openmp got from the website:
|
||||
* http://bisqwit.iki.fi/story/howto/openmp/
|
||||
* by Joel Yliluoma <bisqwit@iki.fi>
|
||||
*/
|
||||
|
||||
#ifndef _OPENMP_MUTEX_H
|
||||
#define _OPENMP_MUTEX_H
|
||||
|
||||
#ifdef _OPENMP
|
||||
|
||||
# include <omp.h>
|
||||
|
||||
struct MutexType
|
||||
{
|
||||
MutexType() { omp_init_lock( &lock ); }
|
||||
~MutexType() { omp_destroy_lock( &lock ); }
|
||||
void Lock() { omp_set_lock( &lock ); }
|
||||
void Unlock() { omp_unset_lock( &lock ); }
|
||||
|
||||
MutexType( const MutexType& ) { omp_init_lock( &lock ); }
|
||||
MutexType& operator= ( const MutexType& ) { return *this; }
|
||||
public:
|
||||
omp_lock_t lock;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/// A dummy mutex that doesn't actually exclude anything,
|
||||
/// but as there is no parallelism either, no worries.
|
||||
struct MutexType
|
||||
{
|
||||
void Lock() {}
|
||||
void Unlock() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
/// An exception-safe scoped lock-keeper.
|
||||
struct ScopedLock
|
||||
{
|
||||
explicit ScopedLock( MutexType& m ) : mut( m ), locked( true ) { mut.Lock(); }
|
||||
~ScopedLock() { Unlock(); }
|
||||
void Unlock() { if( !locked ) return; locked = false; mut.Unlock(); }
|
||||
void LockAgain() { if( locked ) return; mut.Lock(); locked = true; }
|
||||
|
||||
private:
|
||||
MutexType& mut;
|
||||
bool locked;
|
||||
|
||||
private: // prevent copying the scoped lock.
|
||||
void operator=(const ScopedLock&);
|
||||
ScopedLock(const ScopedLock&);
|
||||
};
|
||||
|
||||
#endif // _OPENMP_MUTEX_H
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
* Copyright (C) 1992-2015 Jean-Pierre Charras
|
||||
* Copyright (C) 1992-2019 Kicad Developers Team
|
||||
* Copyright (C) 1992-2017 Kicad Developers Team
|
||||
* under GNU General Public License (see copyright.txt)
|
||||
|
||||
== Main Authors
|
||||
@@ -55,7 +55,7 @@ https://code.launchpad.net/~kicad-product-committers/kicad/+git/product-git/+ref
|
||||
Jean-Pierre Charras <jean-pierre.charras[at]gipsa-lab.inpg-dot-fr>
|
||||
Igor Plyatov <plyatov[at]gmail-dot-com>
|
||||
Fabrizio Tappero <fabrizio-dot-tappero[at]gmail-dot-com>
|
||||
Marco Ciampa <ciampix[at]posteo-dot-net>
|
||||
Marco Ciampa <ciampix[at]libero-dot-it>
|
||||
Wayne Stambaugh <stambaughw[at]gmail-dot-com
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ Czech (CZ) Martin Kratoška <martin[at]ok1rr-dot-com>
|
||||
Dutch (NL) Jerry Jacobs <xor.gate.engineering[at]gmail-dot-com>
|
||||
Finnish (FI) Vesa Solonen <vesa.solonen[at]hut-dot-fi>
|
||||
French (FR) Jean-Pierre Charras <jean-pierre.charras[at]inpg-dot-fr>
|
||||
Italian (IT) Marco Ciampa <ciampix[at]posteo-dot-net>
|
||||
Polish (PL) Mateusz Skowro¿ski <skowri[at]gmail-dot-com>
|
||||
Polish (PL) Kerusey Karyu <keruseykaryu[at]o2.pl>
|
||||
Portuguese (PT) Renie Marquet <reniemarquet[at]uol-dot-com-dot-br>"
|
||||
|
||||
+173
-176
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2007-2018 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2007-2016 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -30,6 +30,8 @@ if(POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW) # CMake 3.0
|
||||
endif()
|
||||
|
||||
project( kicad )
|
||||
|
||||
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
|
||||
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
|
||||
if( DEFINED CMAKE_BUILD_TYPE )
|
||||
@@ -38,20 +40,11 @@ else()
|
||||
set( CMAKE_BUILD_TYPE Release CACHE STRING "Set to either \"Release\" or \"Debug\"" )
|
||||
endif()
|
||||
|
||||
project( kicad )
|
||||
|
||||
include( GNUInstallDirs )
|
||||
|
||||
# Path to local CMake modules.
|
||||
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
||||
|
||||
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
|
||||
# and more than 3Gb for the full kicad suite)
|
||||
# This option create binaries using link option -g1 that create much smaller files, but
|
||||
# there are less info in debug (but the file names and line numbers are available)
|
||||
option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF )
|
||||
|
||||
|
||||
#
|
||||
# KiCad build options should be added below.
|
||||
#
|
||||
@@ -64,31 +57,23 @@ option( USE_WX_GRAPHICS_CONTEXT
|
||||
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
|
||||
|
||||
option( USE_WX_OVERLAY
|
||||
"Use wxOverlay: Always ON for MAC and GTK3 (default OFF)." )
|
||||
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental" )
|
||||
|
||||
option( KICAD_SCRIPTING
|
||||
"Build the Python scripting support inside KiCad binaries (default ON)."
|
||||
"Build the Python scripting support inside KiCad binaries (default OFF)."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_MODULES
|
||||
"Build native portion of the pcbnew Python module: _pcbnew.{pyd,so} for OS command line use of Python."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_PYTHON3
|
||||
"Build for Python 3 instead of 2 (default OFF)."
|
||||
OFF )
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default OFF)."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON_PHOENIX
|
||||
"Use new wxPython binding (default OFF)."
|
||||
OFF )
|
||||
|
||||
option( KICAD_SCRIPTING_ACTION_MENU
|
||||
"Build a tools menu with registered python plugins: actions plugins (default ON)."
|
||||
ON )
|
||||
"Build a tools menu with registred python plugins: actions plugins (default OFF)."
|
||||
)
|
||||
|
||||
option( KICAD_USE_OCE
|
||||
"Build tools and plugins related to OpenCascade Community Edition (default ON)"
|
||||
@@ -99,14 +84,14 @@ option( KICAD_USE_OCC
|
||||
OFF )
|
||||
|
||||
option( KICAD_INSTALL_DEMOS
|
||||
"Install KiCad demos and examples (default ON)"
|
||||
"Install kicad demos and examples (default ON)"
|
||||
ON )
|
||||
|
||||
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
||||
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
||||
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
||||
# when not defined by user, the default is python.exe under Windows and python2 for others
|
||||
# python binary file should be in exec path.
|
||||
# python binary file should be is exec path.
|
||||
|
||||
# KICAD_SCRIPTING_MODULES requires KICAD_SCRIPTING enable it here if KICAD_SCRIPTING_MODULES is ON
|
||||
if ( KICAD_SCRIPTING_MODULES AND NOT KICAD_SCRIPTING )
|
||||
@@ -122,7 +107,7 @@ endif()
|
||||
|
||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
||||
|
||||
option( KICAD_SPICE "Build KiCad with internal Spice simulator." ON )
|
||||
option( KICAD_SPICE "Build Kicad with internal Spice simulator." ON )
|
||||
|
||||
# Global setting: exports are explicit
|
||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||
@@ -178,7 +163,7 @@ if( NOT DEFAULT_INSTALL_PATH )
|
||||
"Location of KiCad data files." )
|
||||
endif()
|
||||
|
||||
message( STATUS "KiCad install dir: <${DEFAULT_INSTALL_PATH}>" )
|
||||
message( STATUS "Kicad install dir: <${DEFAULT_INSTALL_PATH}>" )
|
||||
|
||||
# Generate build system specific header file.
|
||||
include( PerformFeatureChecks )
|
||||
@@ -212,13 +197,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wvla" COMPILER_SUPPORTS_WVLA)
|
||||
|
||||
if(COMPILER_SUPPORTS_WVLA)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=vla")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
@@ -226,7 +204,7 @@ endif()
|
||||
# Unfortunately, the swig autogenerated files have a lot of shadowed variables
|
||||
# and -Wno-shadow does not exist.
|
||||
# Adding -Wshadow can be made only for .cpp files
|
||||
# and will be added later in CMakeLists.txt
|
||||
#and will be added later in CMakeLists.txt
|
||||
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
@@ -237,12 +215,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( WIN32 )
|
||||
# define UNICODE and_UNICODE definition on Windows. KiCad uses unicode.
|
||||
# Both definitions are required
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
endif()
|
||||
|
||||
|
||||
#================================================
|
||||
# Provide access to CCACHE
|
||||
@@ -266,7 +238,7 @@ endif(USE_CCACHE)
|
||||
|
||||
|
||||
#================================================
|
||||
# Provide access to DISTCC
|
||||
# Provide access to CCACHE
|
||||
#================================================
|
||||
if (USE_DISTCC)
|
||||
find_program(DISTCC_FOUND distcc)
|
||||
@@ -287,9 +259,14 @@ endif(USE_DISTCC)
|
||||
|
||||
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
|
||||
# Set 32-bit flag for GCC to prevent excess precision
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
||||
set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )
|
||||
execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( TO_LINKER -XLinker )
|
||||
else()
|
||||
set( TO_LINKER -Wl )
|
||||
endif()
|
||||
|
||||
# Establish -Wall early, so specialized relaxations of this may come
|
||||
@@ -297,22 +274,19 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
|
||||
set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}" )
|
||||
|
||||
# Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
|
||||
# Level 1 produces minimal information, enough for making basic backtraces.
|
||||
# This includes descriptions of functions and external variables, and line number tables,
|
||||
# but no information about local variables.
|
||||
# Level 3 includes full information, but binaries are much larger.
|
||||
if( BUILD_SMALL_DEBUG_FILES )
|
||||
set( CMAKE_C_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG" )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG -Wno-deprecated-declarations" )
|
||||
else()
|
||||
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
|
||||
endif()
|
||||
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
|
||||
|
||||
if( MINGW )
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
|
||||
# _UNICODE definition seems needed under mingw/gcc 4.8
|
||||
# (Kicad uses unicode, and on Windows, wxWidgets >= 2.9.4 is mandatory
|
||||
# and uses unicode)
|
||||
if( GCC_VERSION VERSION_EQUAL 4.8.0 OR GCC_VERSION VERSION_GREATER 4.8.0 )
|
||||
add_definitions(-D_UNICODE)
|
||||
endif()
|
||||
|
||||
# Since version 2.8.5, Cmake uses a response file (.rsp) to
|
||||
# pass the list of include paths to gcc
|
||||
# unfortunately, under mingw32+msys, at least with gcc 4.8 and previous,
|
||||
@@ -338,21 +312,29 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
# snprintf
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
|
||||
elseif( NOT APPLE )
|
||||
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
|
||||
else()
|
||||
if( NOT APPLE )
|
||||
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
|
||||
# Defeat ELF's ability to use the GOT to replace locally implemented functions
|
||||
# with ones from another module.
|
||||
# https://bugs.launchpad.net/kicad/+bug/1322354
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-Bsymbolic" )
|
||||
# Defeat ELF's ability to use the GOT to replace locally implemented functions
|
||||
# with ones from another module.
|
||||
# https://bugs.launchpad.net/kicad/+bug/1322354
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# quiet GCC while in boost
|
||||
if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
|
||||
endif()
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" )
|
||||
|
||||
if( APPLE )
|
||||
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names") # needed by fixbundle
|
||||
endif()
|
||||
@@ -371,18 +353,10 @@ if( KICAD_SCRIPTING_MODULES )
|
||||
add_definitions( -DKICAD_SCRIPTING_MODULES )
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_PYTHON3 )
|
||||
add_definitions( -DKICAD_SCRIPTING_PYTHON3 )
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||
add_definitions( -DKICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_ACTION_MENU )
|
||||
add_definitions( -DKICAD_SCRIPTING_ACTION_MENU )
|
||||
endif()
|
||||
@@ -552,10 +526,60 @@ include( ExternalProject )
|
||||
#================================================
|
||||
include( CheckFindPackageResult )
|
||||
|
||||
#
|
||||
# Find OpenMP support, optional
|
||||
#
|
||||
|
||||
find_package( OpenMP )
|
||||
|
||||
if( OPENMP_FOUND )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||
add_definitions( -DUSE_OPENMP )
|
||||
|
||||
# MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
|
||||
# set it either. Not sure this is the most elegant solution but it works.
|
||||
if( MINGW )
|
||||
set( OPENMP_LIBRARIES gomp )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find wxWidgets library, required
|
||||
#
|
||||
|
||||
# Here you can define what libraries of wxWidgets you need for your
|
||||
# application. You can figure out what libraries you need here;
|
||||
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
|
||||
|
||||
# Turn on wxWidgets compatibility mode for some classes
|
||||
add_definitions( -DWX_COMPATIBILITY )
|
||||
|
||||
# See line 41 of CMakeModules/FindwxWidgets.cmake
|
||||
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
|
||||
|
||||
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
|
||||
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
|
||||
# Check the toolkit used to build wxWidgets
|
||||
execute_process( COMMAND sh -c "${wxWidgets_CONFIG_EXECUTABLE} --query-toolkit"
|
||||
RESULT_VARIABLE wxWidgets_TOOLKIT_RESULT
|
||||
OUTPUT_VARIABLE wxWidgets_TOOLKIT_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if( wxWidgets_TOOLKIT_FOUND STREQUAL "gtk3" )
|
||||
message( WARNING "\nwxWidgets library has been built against GTK3, it causes a lot of problems in KiCad" )
|
||||
add_definitions( -DUSE_WX_GRAPHICS_CONTEXT )
|
||||
add_definitions( -DWXGTK3 )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
set( OpenGL_GL_PREFERENCE "GLVND" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
|
||||
#
|
||||
@@ -570,10 +594,6 @@ endif()
|
||||
# Find GLM library, required
|
||||
#
|
||||
find_package( GLM 0.9.5.1 REQUIRED )
|
||||
if( GLM_VERSION MATCHES "0.9.9.3" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
MESSAGE( FATAL_ERROR "\nGLM version ${GLM_VERSION} is incompatible with KiCad using GCC.\n"
|
||||
"Please downgrade to GLM version 0.9.9.2 or older or use clang instead" )
|
||||
endif()
|
||||
|
||||
add_definitions( -DGLM_FORCE_CTOR_INIT )
|
||||
|
||||
@@ -587,7 +607,7 @@ endif()
|
||||
#
|
||||
# Find Cairo library, required
|
||||
#
|
||||
find_package( Cairo 1.12 REQUIRED )
|
||||
find_package( Cairo 1.8.8 REQUIRED )
|
||||
find_package( Pixman 0.30 REQUIRED )
|
||||
|
||||
#
|
||||
@@ -597,16 +617,10 @@ find_package( Boost 1.54.0 REQUIRED )
|
||||
# Include MinGW resource compiler.
|
||||
include( MinGWResourceCompiler )
|
||||
|
||||
# Find GDI+ on windows if wxGraphicsContext is available, and only link gdiplus library
|
||||
# if wxGraphicsContext not used, because the cairo printing system uses this library
|
||||
if( WIN32 )
|
||||
if( USE_WX_GRAPHICS_CONTEXT )
|
||||
find_package( GdiPlus )
|
||||
check_find_package_result( GDI_PLUS_FOUND "GDI+" )
|
||||
else()
|
||||
# if WX_GRAPHICS_CONTEXT is not used we just need the gdiplus library for cairo printing
|
||||
set( GDI_PLUS_LIBRARIES gdiplus )
|
||||
endif()
|
||||
# Find GDI+ on windows if wxGraphicsContext is available.
|
||||
if( MINGW AND USE_WX_GRAPHICS_CONTEXT )
|
||||
find_package( GdiPlus )
|
||||
check_find_package_result( GDI_PLUS_FOUND "GDI+" )
|
||||
endif()
|
||||
|
||||
# Find ngspice library, required for integrated circuit simulator
|
||||
@@ -663,27 +677,22 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||
find_package( SWIG 3.0 REQUIRED )
|
||||
include( ${SWIG_USE_FILE} )
|
||||
|
||||
if( KICAD_SCRIPTING_PYTHON3 )
|
||||
set( PythonInterp_FIND_VERSION 3.3 )
|
||||
set( PythonLibs_FIND_VERSION 3.3 )
|
||||
else()
|
||||
# force a python version < 3.0
|
||||
set( PythonInterp_FIND_VERSION 2.6 )
|
||||
set( PythonLibs_FIND_VERSION 2.6 )
|
||||
endif()
|
||||
# force a python version < 3.0
|
||||
set( PythonInterp_FIND_VERSION 2.6 )
|
||||
set( PythonLibs_FIND_VERSION 2.6 )
|
||||
|
||||
find_package( PythonInterp )
|
||||
|
||||
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||
|
||||
if( NOT KICAD_SCRIPTING_PYTHON3 AND NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
||||
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
||||
message( FATAL_ERROR "Python 2.x is required." )
|
||||
endif()
|
||||
|
||||
# Get the correct Python site package install path from the Python interpreter found by
|
||||
# FindPythonInterp unless the user specifically defined a custom path.
|
||||
if( NOT PYTHON_SITE_PACKAGE_PATH )
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix=''))"
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
|
||||
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
@@ -708,87 +717,78 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||
mark_as_advanced( PYTHON_DEST )
|
||||
message( STATUS "Python module install path: ${PYTHON_DEST}" )
|
||||
|
||||
if( KICAD_SCRIPTING_PYTHON3 )
|
||||
find_package( PythonLibs 3.3 REQUIRED )
|
||||
else()
|
||||
find_package( PythonLibs 2.6 REQUIRED )
|
||||
endif()
|
||||
find_package( PythonLibs 2.6 )
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
find_package( wxPython REQUIRED )
|
||||
message( STATUS "Found ${WXPYTHON_FLAVOR} "
|
||||
"${WXPYTHON_VERSION}/${WXPYTHON_TOOLKIT} "
|
||||
"(wxWidgets ${WXPYTHON_WXVERSION})" )
|
||||
# Check to see if the correct version of wxPython is installed based on the version of
|
||||
# wxWidgets found. At least the major an minor version should match.
|
||||
set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" )
|
||||
set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
|
||||
|
||||
# Add user specified Python site package path.
|
||||
if( PYTHON_SITE_PACKAGE_PATH )
|
||||
set( _py_cmd
|
||||
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
|
||||
RESULT_VARIABLE WXPYTHON_VERSION_RESULT
|
||||
OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# message( STATUS "WXPYTHON_VERSION_FOUND: ${WXPYTHON_VERSION_FOUND}" )
|
||||
# message( STATUS "WXPYTHON_VERSION_RESULT: ${WXPYTHON_VERSION_RESULT}" )
|
||||
|
||||
# Check to see if any version of wxPython is installed on the system.
|
||||
if( WXPYTHON_VERSION_RESULT GREATER 0 )
|
||||
message( FATAL_ERROR "wxPython does not appear to be installed on the system." )
|
||||
endif()
|
||||
|
||||
if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" )
|
||||
message( FATAL_ERROR
|
||||
"wxPython version ${_wxpy_version} does not appear to be installed on the system." )
|
||||
endif()
|
||||
|
||||
set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." )
|
||||
message( STATUS "wxPython version ${_wxpy_version} found." )
|
||||
|
||||
|
||||
# Compare wxPython and wxWidgets toolkits
|
||||
set( _py_cmd "import wx; print(wx.version().split(' ')[1])" )
|
||||
|
||||
# Add user specified Python site package path.
|
||||
if( PYTHON_SITE_PACKAGE_PATH )
|
||||
set( _py_cmd
|
||||
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
|
||||
RESULT_VARIABLE WXPYTHON_TOOLKIT_RESULT
|
||||
OUTPUT_VARIABLE WXPYTHON_TOOLKIT_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Check if wxWidgets toolkits match, it is a Linux-only issue
|
||||
if( UNIX AND NOT APPLE AND NOT wxWidgets_TOOLKIT_FOUND STREQUAL WXPYTHON_TOOLKIT_FOUND )
|
||||
message( FATAL_ERROR "\nwxWidgets and wxPython use different toolkits "
|
||||
"(${wxWidgets_TOOLKIT_FOUND} vs ${WXPYTHON_TOOLKIT_FOUND}). "
|
||||
"It will result in a broken build. Please either install wxPython built using "
|
||||
"${wxWidgets_TOOLKIT_FOUND} or add '-DKICAD_SCRIPTING_WXPYTHON=OFF' to cmake "
|
||||
"parameters to disable wxPython support." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
|
||||
|
||||
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
|
||||
# although is used for all components, should be a harmless hit for something like eeschema
|
||||
# so long as unused search paths are at the end like this.
|
||||
set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )
|
||||
|
||||
#message( STATUS "/ INC_AFTER:${INC_AFTER}" )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find wxWidgets library, required
|
||||
#
|
||||
|
||||
# Turn on wxWidgets compatibility mode for some classes
|
||||
add_definitions( -DWX_COMPATIBILITY )
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
# Check if '--toolkit=xxx' option has been passed
|
||||
string( REGEX MATCH "--toolkit=([a-zA-Z0-9]+)"
|
||||
WXWIDGETS_REQUESTED_TOOLKIT "${wxWidgets_CONFIG_OPTIONS}" )
|
||||
|
||||
if( WXWIDGETS_REQUESTED_TOOLKIT
|
||||
AND NOT WXWIDGETS_REQUESTED_TOOLKIT STREQUAL "--toolkit=${WXPYTHON_TOOLKIT}" )
|
||||
message( WARNING "wxWidgets and wxPython must be based on the same toolkit.\n"
|
||||
"It will be fixed automatically if you skip the '--toolkit=xxx' "
|
||||
"wxWidgets_CONFIG_OPTIONS parameter.")
|
||||
else()
|
||||
# Use the same toolkit as wxPython otherwise there will be a symbol conflict
|
||||
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} "--toolkit=${WXPYTHON_TOOLKIT}" )
|
||||
endif()
|
||||
|
||||
# Require the same wxWidgets version as is used by wxPython
|
||||
set( wxWidgets_REQ_VERSION ${WXPYTHON_WXVERSION} )
|
||||
else()
|
||||
# Require wxWidgets 3.0.0 as the minimum when wxPython is disabled
|
||||
set( wxWidgets_REQ_VERSION 3.0.0 )
|
||||
endif()
|
||||
|
||||
# See line 49 of CMakeModules/FindwxWidgets.cmake
|
||||
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
|
||||
|
||||
find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core net base xml stc REQUIRED )
|
||||
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
|
||||
# Check for GTK3 libraries - These do not have XOR, so we need overlay (Page layout editor)
|
||||
if( wxWidgets_LIBRARIES MATCHES "gtk3" )
|
||||
add_definitions( -DUSE_WX_OVERLAY )
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON AND NOT KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||
# wxPython appears to be installed and valid so make sure the headers are available.
|
||||
foreach( path ${wxWidgets_INCLUDE_DIRS} )
|
||||
#message( STATUS "Searching for wx/wxPython/wxPython.h in ${path}" )
|
||||
|
||||
find_path( wxPYTHON_INCLUDE_DIRS wx/wxPython/wxPython.h
|
||||
PATHS "${path}" )
|
||||
|
||||
if( wxPYTHON_INCLUDE_DIRS )
|
||||
message( STATUS "Found wxPython.h in ${path}/wx/wxPython" )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if( NOT wxPYTHON_INCLUDE_DIRS )
|
||||
message( FATAL_ERROR "Cannot find wxPython.h" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if( APPLE )
|
||||
# Remove app bundles in ${KICAD_BIN} before installing anything new.
|
||||
# Must be defined before all includes so that it is executed first.
|
||||
@@ -827,8 +827,6 @@ if( DOXYGEN_FOUND )
|
||||
DEPENDS Doxyfile
|
||||
COMMENT "building developer's resource docs into directory Documentation/development/doxygen/html"
|
||||
)
|
||||
|
||||
add_subdirectory(Documentation/docset)
|
||||
else()
|
||||
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
|
||||
endif()
|
||||
@@ -914,7 +912,6 @@ if( UNIX AND NOT APPLE )
|
||||
endif()
|
||||
|
||||
#include( CTest )
|
||||
enable_testing()
|
||||
|
||||
if( UNIX AND NOT APPLE )
|
||||
|
||||
@@ -944,7 +941,7 @@ add_subdirectory( 3d-viewer )
|
||||
add_subdirectory( cvpcb )
|
||||
add_subdirectory( eeschema )
|
||||
add_subdirectory( gerbview )
|
||||
add_subdirectory( dxflib_qcad )
|
||||
add_subdirectory( lib_dxf )
|
||||
add_subdirectory( pcbnew )
|
||||
add_subdirectory( polygon )
|
||||
add_subdirectory( pagelayout_editor )
|
||||
|
||||
@@ -39,6 +39,7 @@ macro( create_git_version_header _git_src_path )
|
||||
ERROR_VARIABLE _git_log_error
|
||||
RESULT_VARIABLE _git_log_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
|
||||
endif( GIT_FOUND )
|
||||
|
||||
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonInterp_FIND_VERSION)
|
||||
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
|
||||
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
|
||||
@@ -1,24 +1,6 @@
|
||||
# CMake script for finding libngspice
|
||||
|
||||
# Copyright (C) 2016 CERN
|
||||
# (C) CERN 2016
|
||||
# Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h
|
||||
PATHS ${NGSPICE_ROOT_DIR} $ENV{NGSPICE_ROOT_DIR} ${NGSPICE_INCLUDE_PATH}
|
||||
@@ -30,15 +12,6 @@ find_library( NGSPICE_LIBRARY ngspice
|
||||
PATH_SUFFIXES src/.libs lib
|
||||
)
|
||||
|
||||
if( WIN32 AND MSYS )
|
||||
# NGSPICE_LIBRARY points to libngspice.dll.a on Windows,
|
||||
# but the goal is to find out the DLL name.
|
||||
find_library( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll )
|
||||
else()
|
||||
set( NGSPICE_DLL "${NGSPICE_LIBRARY}" )
|
||||
endif()
|
||||
|
||||
|
||||
include( FindPackageHandleStandardArgs )
|
||||
|
||||
if( ${NGSPICE_INCLUDE_DIR} STREQUAL "NGSPICE_INCLUDE_DIR-NOTFOUND" OR ${NGSPICE_LIBRARY} STREQUAL "NGSPICE_LIBRARY-NOTFOUND" )
|
||||
@@ -47,7 +20,7 @@ if( ${NGSPICE_INCLUDE_DIR} STREQUAL "NGSPICE_INCLUDE_DIR-NOTFOUND" OR ${NGSPICE_
|
||||
message( "Most of ngspice packages do not provide the required libngspice library." )
|
||||
message( "You can either compile ngspice configured with --with-ngshared parameter" )
|
||||
message( "or run a script that does the job for you:" )
|
||||
message( " cd ./scripting/build_tools" )
|
||||
message( " cd ./scripts" )
|
||||
message( " chmod +x get_libngspice_so.sh" )
|
||||
message( " ./get_libngspice_so.sh" )
|
||||
message( " sudo ./get_libngspice_so.sh install" )
|
||||
@@ -55,10 +28,12 @@ if( ${NGSPICE_INCLUDE_DIR} STREQUAL "NGSPICE_INCLUDE_DIR-NOTFOUND" OR ${NGSPICE_
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args( ngspice
|
||||
REQUIRED_VARS NGSPICE_INCLUDE_DIR NGSPICE_LIBRARY NGSPICE_DLL )
|
||||
REQUIRED_VARS
|
||||
NGSPICE_INCLUDE_DIR
|
||||
NGSPICE_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
NGSPICE_INCLUDE_DIR
|
||||
NGSPICE_LIBRARY
|
||||
NGSPICE_DLL
|
||||
)
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# CMake script for finding wxPython/Phoenix library
|
||||
|
||||
# Copyright (C) 2018 CERN
|
||||
# Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
# Exported variables:
|
||||
# WXPYTHON_VERSION: wxPython/Phoenix version,
|
||||
# normally 3.x.x for wxPython, 4.x.x for Phoenix
|
||||
# WXPYTHON_FLAVOR: 'Phoenix' or 'wxPython'
|
||||
# WXPYTHON_TOOLKIT: base library toolkit (e.g. gtk2, gtk3, msw, osx_cocoa)
|
||||
# WXPYTHON_WXVERSION: wxWidgets version used by wxPython/Phoenix
|
||||
|
||||
# Create a CMake list containing wxPython version
|
||||
set( _py_cmd "import wx;print(wx.version())" )
|
||||
|
||||
# Add user specified Python site package path
|
||||
if( PYTHON_SITE_PACKAGE_PATH )
|
||||
set( _py_site_path
|
||||
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");" )
|
||||
|
||||
if( APPLE ) # extra path for macOS, so that 'wx' module is accessible
|
||||
set( _py_site_path
|
||||
"${_py_site_path}sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}/wx-3.0-osx_cocoa\");" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_site_path}${_py_cmd}"
|
||||
RESULT_VARIABLE _WXPYTHON_VERSION_RESULT
|
||||
OUTPUT_VARIABLE _WXPYTHON_VERSION_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Check to see if any version of wxPython is installed on the system.
|
||||
if( _WXPYTHON_VERSION_RESULT GREATER 0 )
|
||||
message( FATAL_ERROR "wxPython/Phoenix does not appear to be installed on the system" )
|
||||
endif()
|
||||
|
||||
|
||||
# Turn the version string to a list for easier processing
|
||||
set( _WXPYTHON_VERSION_LIST ${_WXPYTHON_VERSION_FOUND})
|
||||
separate_arguments( _WXPYTHON_VERSION_LIST )
|
||||
list( LENGTH _WXPYTHON_VERSION_LIST _VERSION_LIST_LEN )
|
||||
|
||||
if( _VERSION_LIST_LEN LESS 3 )
|
||||
message( FATAL_ERROR "Unknown wxPython/Phoenix version string: ${_WXPYTHON_VERSION_FOUND}" )
|
||||
endif()
|
||||
|
||||
# wxPython style, e.g. '3.0.2.0;gtk3;(classic) or Pheonix style: e.g. 4.0.1;gtk3;(phoenix)
|
||||
list( GET _WXPYTHON_VERSION_LIST 0 WXPYTHON_VERSION )
|
||||
list( GET _WXPYTHON_VERSION_LIST 1 WXPYTHON_TOOLKIT )
|
||||
list( GET _WXPYTHON_VERSION_LIST 2 WXPYTHON_FLAVOR )
|
||||
|
||||
# Determine wxWidgets version used by wxPython/Phoenix
|
||||
if( WXPYTHON_FLAVOR MATCHES "phoenix" )
|
||||
# 4.0.1;gtk3;(phoenix) does not contain wxWidgets version, request it explicitly
|
||||
set( _py_cmd "import wx;print(wx.wxWidgets_version.split(' ')[1])")
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_site_path}${_py_cmd}"
|
||||
RESULT_VARIABLE WXPYTHON_WXVERSION_RESULT
|
||||
OUTPUT_VARIABLE WXPYTHON_WXVERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if( NOT WXPYTHON_WXVERSION_RESULT EQUAL 0 )
|
||||
set( WXPYTHON_WXVERSION "3.0.2" )
|
||||
message( WARNING "Could not determine wxWidgets version used by Phoenix, "
|
||||
"requesting ${WXPYTHON_WXVERSION}" )
|
||||
endif()
|
||||
|
||||
set( WXPYTHON_FLAVOR "Phoenix" )
|
||||
|
||||
elseif( WXPYTHON_FLAVOR MATCHES "classic" )
|
||||
# 3.0.2.0;gtk3;(classic) has the wxWidgets version in the first part
|
||||
set( WXPYTHON_WXVERSION ${WXPYTHON_VERSION} )
|
||||
set( WXPYTHON_FLAVOR "wxPython" )
|
||||
|
||||
else()
|
||||
message( FATAL_ERROR "Unknown wxPython/Phoenix type: ${WXPYTHON_FLAVOR}")
|
||||
endif()
|
||||
|
||||
|
||||
# Fix an incosistency between the toolkit names reported by wx.version() and wx-config for cocoa
|
||||
if( WXPYTHON_TOOLKIT STREQUAL "osx-cocoa" )
|
||||
set( WXPYTHON_TOOLKIT "osx_cocoa" )
|
||||
endif()
|
||||
@@ -1,38 +1,38 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
# Copyright (C) 2016 - 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
# Note: unless you are the person responsible for creating releases,
|
||||
# do *not* change these variables. This way the KiCad project
|
||||
# can maintain control over what is an official KiCad build and
|
||||
# what is not. Setting these variable that conflict with KiCad
|
||||
# releases is a shooting offense.
|
||||
#
|
||||
# This file gets included in the WriteVersionHeader.cmake file to set
|
||||
# Copyright (C) 2016 - 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
# Note: unless you are the person responsible for creating releases,
|
||||
# do *not* change these variables. This way the KiCad project
|
||||
# can maintain control over what is an official KiCad build and
|
||||
# what is not. Setting these variable that conflict with KiCad
|
||||
# releases is a shooting offense.
|
||||
#
|
||||
# This file gets included in the WriteVersionHeader.cmake file to set
|
||||
# the default KiCad version when the source is provided in an archive
|
||||
# file or git is not available on the build system. When KiCad is
|
||||
# cloned using git, the git version is used. This version string should
|
||||
# be set after each version tag is added to the git repo. This will
|
||||
# give developers a reasonable idea where which branch was used to build
|
||||
# KiCad.
|
||||
set( KICAD_VERSION "5.1.2" )
|
||||
set( KICAD_VERSION "5.0.1-dev-unknown" )
|
||||
|
||||
@@ -47,7 +47,7 @@ set( output_begin "
|
||||
* PNG2cpp CMake script, using a *.png file as input.
|
||||
*/
|
||||
|
||||
#include <bitmaps_png/bitmaps_list.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
static const unsigned char png[] = {"
|
||||
)
|
||||
|
||||
@@ -72,7 +72,4 @@
|
||||
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
|
||||
#define KIFACE_PREFIX "@KIFACE_PREFIX@"
|
||||
|
||||
/// Allows scripts install directory to be referenced by the program code.
|
||||
#define PYTHON_DEST "@PYTHON_DEST@"
|
||||
|
||||
#endif // CONFIG_H_
|
||||
|
||||
+902
-1568
File diff suppressed because it is too large
Load Diff
@@ -50,51 +50,6 @@ developers. The other KiCad developers will appreciate your effort.
|
||||
**Do not modify this document without the consent of the project
|
||||
leader. All changes to this document require approval.**
|
||||
|
||||
## 1.3 Tools
|
||||
|
||||
There are some tools that can help you format your code easily.
|
||||
|
||||
[`clang-format`][clang-format] is a formatting tool that can both be used to
|
||||
provide code-style automation to your editor of choice, as well as allow git to
|
||||
check formatting when committing (using a "Git hook"). You should install this
|
||||
program to be able to use the Git hooks.
|
||||
|
||||
The style config file is `_clang-format`, and should be picked up automatically
|
||||
by `clang-format` when the `--style=file` option is set.
|
||||
|
||||
To enable the Git hooks (only needs to be done once per Git repo):
|
||||
|
||||
git config core.hooksPath .githooks
|
||||
|
||||
Set the `git clang-format` tool to use the provided `_clang-format` file:
|
||||
|
||||
git config clangFormat.style file
|
||||
|
||||
Then, to enable the format checker, set the `kicad.check-format` Git config
|
||||
to "true" for the KiCad repo:
|
||||
|
||||
git config kicad.check-format true
|
||||
|
||||
Without this config, the format checker will not run on commit, but you can
|
||||
still check files staged for commit manually:
|
||||
|
||||
tools/check_coding.sh --diff
|
||||
|
||||
If the hook is enabled, when you commit a change, you will be told if you
|
||||
have caused any style violations (only in your changed code). You can fix your
|
||||
staged changes automatically with this tool:
|
||||
|
||||
tools/check_coding.sh
|
||||
|
||||
Or you can proceed anyway, if you are sure your style is correct:
|
||||
|
||||
git commit --no-verify
|
||||
|
||||
The `check_coding.sh` tool has other modes:
|
||||
|
||||
* Make (or see only) changes to files modified in the previous commit:
|
||||
* `check_coding.sh --amend [--diff]`
|
||||
|
||||
|
||||
# 2. Naming Conventions # {#naming_conventions}
|
||||
Before delving into anything as esoteric as indentation and formatting,
|
||||
@@ -246,8 +201,8 @@ good practice to actually generate the Doxygen \*.html files by
|
||||
building target doxygen-docs, and then to review the quality of your
|
||||
Doxygen comments with a web browser before submitting a patch.
|
||||
|
||||
[doccode]: http://www.doxygen.nl/manual/docblocks.html
|
||||
[manual]: http://www.doxygen.nl/manual
|
||||
[doccode]: http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html
|
||||
[manual]: http://www.stack.nl/~dimitri/doxygen/manual.html
|
||||
|
||||
### 3.2.1 Function Comments ### {#function_comments}
|
||||
These go into a header file, unless the function is a private (i.e.
|
||||
@@ -833,7 +788,6 @@ learn something new.
|
||||
- [C++ Operator Overloading Guidelines][overloading]
|
||||
- [Wikipedia's Programming Style Page][style]
|
||||
|
||||
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
|
||||
[cppstandard]:http://www.possibility.com/Cpp/CppCodingStandard.html
|
||||
[kernel]:http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/CodingStyle
|
||||
[overloading]:http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html
|
||||
|
||||
@@ -113,16 +113,12 @@ The [Curl Multi-Protocol File Transfer Library][libcurl] is used to provide secu
|
||||
file transfer access for the [GitHub][] plug in. This library needs to be installed unless
|
||||
the GitHub plug build option is disabled.
|
||||
|
||||
## OpenCascade Library ## {#oce}
|
||||
## OpenCascade Community Edition (OCE) ## {#oce}
|
||||
|
||||
The [OpenCascade Community Edition (OCE)][liboce] is used to provide support for loading and saving
|
||||
The [OpenCascade Community Edition][liboce] is used to provide support for loading and saving
|
||||
3D model file formats such as STEP. This library needs to be installed unless the OCE build
|
||||
option is disabled.
|
||||
|
||||
[Open CASCSADE Technology (OCC)][libocc] should also work as an alternative to OCE. Selection of
|
||||
library Cascade library can be specified at build time. See the [STEP/IGES support](#oce_opt)
|
||||
section.
|
||||
|
||||
## Ngspice Library ## {#ngspice}
|
||||
|
||||
The [Ngspice Library][libngsice] is used to provide Spice simulation support in the schematic
|
||||
@@ -156,21 +152,11 @@ This options is enabled by default.
|
||||
The KICAD_SCRIPTING_MODULES option is used to enable building and installing the Python modules
|
||||
supplied by KiCad. This option is enabled by default.
|
||||
|
||||
## Python 3 Scripting Support ## {#python3}
|
||||
|
||||
The KICAD_SCRIPTING_PYTHON3 option is used to enable building of the Python 3 interface instead
|
||||
of Python 2. This option is disabled by default.
|
||||
|
||||
## wxPython Scripting Support ## {#wxpython_opt}
|
||||
|
||||
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
|
||||
Pcbnew including the wxPython console. This option is enabled by default.
|
||||
|
||||
## wxPython Phoenix Scripting Support ## {#wxpython_phoenix}
|
||||
|
||||
The KICAD_SCRIPTING_WXPYTHON_PHOENIX option is used to enable building the wxPython interface with
|
||||
the new Phoenix binding instead of the legacy one. This option is disabled by default.
|
||||
|
||||
## GitHub Plugin ## {#github_opt}
|
||||
|
||||
The BUILD_GITHUB_PLUGIN option is used to control if the GitHub plug in is built. This option is
|
||||
@@ -186,12 +172,9 @@ library. This option is enabled by default.
|
||||
|
||||
The KICAD_USE_OCE is used for the 3D viewer plugin to support STEP and IGES 3D models. Build tools
|
||||
and plugins related to OpenCascade Community Edition (OCE) are enabled with this option. When
|
||||
enabled it requires [liboce][] to be available, and the location of the installed OCE library to be
|
||||
enabled it requires [OCE][] to be available, and the location of the installed OCE library to be
|
||||
passed via the OCE_DIR flag. This option is enabled by default.
|
||||
|
||||
Alternatively KICAD_USE_OCC can be used instead of OCE. Both options are not supposed to be enabled
|
||||
at the same time.
|
||||
|
||||
## Demos and Examples ## {#demo_install_opt}
|
||||
|
||||
The KiCad source code includes some demos and examples to showcase the program. You can choose
|
||||
@@ -229,7 +212,7 @@ can down load the source archive from the [KiCad Launchpad][] developers page.
|
||||
other archive program to extract the source on your system. If you are using tar, use the
|
||||
following command:
|
||||
|
||||
tar -xaf kicad_src_archive.tar.xz
|
||||
tar -xzf kicad_src_archive.tar.gz
|
||||
|
||||
If you are contributing directly to the KiCad project on Launchpad, you can create a local
|
||||
copy on your machine by using the following command:
|
||||
@@ -238,7 +221,7 @@ copy on your machine by using the following command:
|
||||
|
||||
Here is a list of source links:
|
||||
|
||||
Stable release archive: https://launchpad.net/kicad/5.0/5.0.2/+download/kicad-5.0.2.tar.xz
|
||||
Stable release archive: https://launchpad.net/kicad/4.0/4.0.7/+download/kicad-4.0.7.tar.xz
|
||||
|
||||
Development branch: https://code.launchpad.net/~kicad-product-committers/kicad/+git/product-git/+ref/master
|
||||
|
||||
@@ -353,16 +336,11 @@ compilation errors about missing files, it is probably because your path is too
|
||||
|
||||
# Building KiCad on macOS # {#build_osx}
|
||||
|
||||
As of V5, building and packaging for macOS can be done using [kicad-mac-builder][],
|
||||
which downloads, patches, builds, and packages for macOS. It is used to create the official
|
||||
releases and nightlies, and it reduces the complexity of setting up a build environment to a command
|
||||
or two. Usage of kicad-mac-builder is detailed at on its website.
|
||||
Building on macOS is challenging at best. It typically requires building dependency libraries
|
||||
that require patching in order to work correctly. For more information on the complexities of
|
||||
building and packaging KiCad on macOS, see the [macOS bundle build scripts][].
|
||||
|
||||
If you wish to build without kicad-mac-builder, please use the following and its source code
|
||||
as reference. Building on macOS requires building dependency libraries that require patching
|
||||
in order to work correctly.
|
||||
|
||||
In the following set of commands, replace the macOS version number (i.e. 10.11) with the desired
|
||||
In the following set of commands, replace the macOS version number (i.e. 10.9) with the desired
|
||||
minimum version. It may be easiest to build for the same version you are running.
|
||||
|
||||
KiCad currently won't work with a stock version of wxWidgets that can be downloaded or
|
||||
@@ -390,7 +368,7 @@ To perform a wxWidgets build, execute the following commands:
|
||||
--with-zlib=builtin \
|
||||
--with-expat=builtin \
|
||||
--without-liblzma \
|
||||
--with-macosx-version-min=10.11 \
|
||||
--with-macosx-version-min=10.9 \
|
||||
--enable-universal-binary=i386,x86_64 \
|
||||
CC=clang \
|
||||
CXX=clang++
|
||||
@@ -406,7 +384,7 @@ Now, build a basic KiCad without Python scripting using the following commands:
|
||||
cd build/release
|
||||
cmake -DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
|
||||
-DwxWidgets_CONFIG_EXECUTABLE=<your wxWidgets build folder>/wx-bin/bin/wx-config \
|
||||
-DKICAD_SCRIPTING=OFF \
|
||||
-DKICAD_SCRIPTING_MODULES=OFF \
|
||||
@@ -462,7 +440,7 @@ you will have to apply the Boost patches in the KiCad source [patches folder][].
|
||||
[GIT]: https://git-scm.com/
|
||||
[GitHub]: https://github.com/KiCad/kicad-source-mirror
|
||||
[ngspice]: http://ngspice.sourceforge.net/
|
||||
[Doxygen]: http://www.doxygen.nl
|
||||
[Doxygen]: http://www.stack.nl/~dimitri/doxygen/
|
||||
[mailing list]: https://launchpad.net/~kicad-developers
|
||||
[SWIG]: http://www.swig.org/
|
||||
[wxWidgets]: http://wxwidgets.org/
|
||||
@@ -477,7 +455,7 @@ you will have to apply the Boost patches in the KiCad source [patches folder][].
|
||||
[MSYS2 32-bit Installer]: http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe
|
||||
[MSYS2 64-bit Installer]: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe
|
||||
[PKGBUILD]: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-kicad-git/PKGBUILD
|
||||
[kicad-mac-builder]:https://github.com/KiCad/kicad-mac-builder
|
||||
[macOS bundle build scripts]:http://bazaar.launchpad.net/~adamwolf/+junk/kicad-mac-packaging/files
|
||||
[KiCad fork of wxWidgets]:https://github.com/KiCad/wxWidgets
|
||||
[MinGW]: http://mingw.org/
|
||||
[build Boost]: http://www.boost.org/doc/libs/1_59_0/more/getting_started/index.html
|
||||
@@ -485,6 +463,6 @@ you will have to apply the Boost patches in the KiCad source [patches folder][].
|
||||
[libcurl]: http://curl.haxx.se/libcurl/
|
||||
[GLM]: http://glm.g-truc.net/
|
||||
[git]: https://git-scm.com/
|
||||
[OCE]: https://github.com/tpaviot/oce
|
||||
[liboce]: https://github.com/tpaviot/oce
|
||||
[libocc]: https://www.opencascade.com/content/overview
|
||||
[libngspice]: https://sourceforge.net/projects/ngspice/
|
||||
|
||||
@@ -31,7 +31,7 @@ additional support regarding online manipulation of board projects is available
|
||||
for Pcbnew. Plugins using this feature are called `Action Plugins` and they are
|
||||
accessible using a Pcbnew menu entry that can be found under `Tools->External
|
||||
Plugins`. KiCad plugins that follow the `Action Plugin` conventions can be made
|
||||
to show up as external plugins in that menu and optionally as top toolbar button.
|
||||
to show up as external plugins in that menu.
|
||||
The user can run the plugin resulting in calling a defined entry function in the
|
||||
Python plugin's code.
|
||||
This function can then be used to access and manipulate the currently loaded
|
||||
@@ -43,26 +43,9 @@ packages and Python script files in specific directories on startup.
|
||||
In order for the discovery process to work, the following requirements must be met.
|
||||
|
||||
* The plugin must be installed in the KiCad plugins search paths as documented
|
||||
in `scripting/kicadplugins.i`. You can always discover the search path for your
|
||||
setup by opening the Scripting console and entering the command: `import pcbnew;
|
||||
print pcbnew.PLUGIN_DIRECTORIES_SEARCH`.
|
||||
|
||||
Currently on a Linux Installation the plugins search path is
|
||||
|
||||
* /usr/share/kicad/scripting/plugins/
|
||||
* ~/.kicad/scripting/plugins
|
||||
* ~/.kicad_plugins/
|
||||
|
||||
On Windows
|
||||
|
||||
* \{KICAD_INSTALL_PATH\}/share/kicad/scripting/plugins
|
||||
* %APPDATA%/Roaming/kicad/scripting/plugins
|
||||
|
||||
On macOS, there is a security feature that makes it easier to add scripting plugins to the ~/Library... path than to kicad.app, but the search path is
|
||||
|
||||
* /Applications/kicad/Kicad/Contents/SharedSupport/scripting/plugins
|
||||
* ~/Library/Application Support/kicad/scripting/plugins
|
||||
|
||||
in `scripting/kicadplugins.i`.
|
||||
(Currently on a Linux Mint Installation this is
|
||||
/usr/share/kicad/scripting/plugins/ and ~/.kicad_plugins/)
|
||||
* Alternatively a symbolic link can be created in the KiCad plugin path link to
|
||||
the plugin file/folder in another location of the file system. This can be
|
||||
useful for development.
|
||||
@@ -86,20 +69,16 @@ KiCad plugin path.
|
||||
|
||||
+ ~/.kicad_plugins/ # A folder in the KiCad plugin path
|
||||
- simple_plugin.py
|
||||
- simple_plugin.png (optional)
|
||||
|
||||
The file `simple_plugin.py` contains the following.
|
||||
|
||||
import pcbnew
|
||||
import os
|
||||
|
||||
class SimplePlugin(pcbnew.ActionPlugin):
|
||||
def defaults(self):
|
||||
self.name = "Plugin Name as shown in Pcbnew: Tools->External Plugins"
|
||||
self.category = "A descriptive category name"
|
||||
self.description = "A description of the plugin and what it does"
|
||||
self.show_toolbar_button = False # Optional, defaults to False
|
||||
self.icon_file_name = os.path.join(os.path.dirname(__file__), 'simple_plugin.png') # Optional, defaults to ""
|
||||
|
||||
def Run(self):
|
||||
# The entry function of the plugin that is executed on user action
|
||||
@@ -107,13 +86,6 @@ The file `simple_plugin.py` contains the following.
|
||||
|
||||
SimplePlugin().register() # Instantiate and register to Pcbnew
|
||||
|
||||
Note that if specified `icon_file_name` must contain absolute path to the plugin icon.
|
||||
It must be png file, recommended size is 26x26 pixels. Alpha channel for opacity is supported.
|
||||
If icon is not specified a generic tool icon will be used.
|
||||
|
||||
`show_toolbar_button` only defines a default state for plugin toolbar button. Users can override
|
||||
it in pcbnew preferences.
|
||||
|
||||
## Complex Plugin Example ## {#ppi_complex_example}
|
||||
The complex plugin example represents a single Python package that is imported
|
||||
on Pcbnew startup. When the Python package is imported, the `__init__.py` file
|
||||
@@ -131,7 +103,6 @@ The following folder structure shows how complex plugins are implemented:
|
||||
- __main__.py # This file is optional. See below
|
||||
- complex_plugin_action.py # The ActionPlugin derived class lives here
|
||||
- complex_plugin_utils.py # Other Python parts of the plugin
|
||||
- icon.png
|
||||
+ otherstuff/
|
||||
- otherfile.png
|
||||
- misc.txt
|
||||
@@ -142,15 +113,12 @@ In this case the file is named `complex_plugin_action.py` with the following
|
||||
contents:
|
||||
|
||||
import pcbnew
|
||||
import os
|
||||
|
||||
class ComplexPluginAction(pcbnew.ActionPlugin)
|
||||
def defaults(self):
|
||||
self.name = "A complex action plugin"
|
||||
self.category = "A descriptive category name"
|
||||
self.description "A description of the plugin"
|
||||
self.show_toolbar_button = True # Optional, defaults to False
|
||||
self.icon_file_name = os.path.join(os.path.dirname(__file__), 'icon.png') # Optional
|
||||
|
||||
def Run(self):
|
||||
# The entry function of the plugin that is executed on user action
|
||||
|
||||
@@ -453,7 +453,7 @@ involved with the project.
|
||||
|
||||
**Status:**
|
||||
- In progress. Most of the developer documentation has been converted to
|
||||
[Doxygen markdown](http://www.doxygen.nl/manual/markdown.html)
|
||||
[Doxygen markdown](http://www.stack.nl/~dimitri/doxygen/manual/markdown.html)
|
||||
and the [output][kicad-docs] is rebuilt automatically when a commit is
|
||||
made to the KiCad repo.
|
||||
|
||||
|
||||
@@ -1,127 +1,18 @@
|
||||
# Testing KiCad #
|
||||
|
||||
[TOC]
|
||||
|
||||
# Unit tests {#unit-tests}
|
||||
# Unit tests #
|
||||
|
||||
KiCad has a limited number of unit tests, which can be used to
|
||||
check that certain functionality works.
|
||||
|
||||
Tests are registered using [CTest][], part of CMake. CTest gathers all the
|
||||
disparate test programs and runs them. Most C++ unit
|
||||
tests are written using the [Boost Unit Test framework][], but this is not
|
||||
required to add a test to the testing suite.
|
||||
|
||||
The test CMake targets generally start with `qa_`, the names of the tests
|
||||
within CTest are the same but without the `qa_` prefix.
|
||||
|
||||
## Running tests {#running-tests}
|
||||
|
||||
You can run all tests after building with `make test` or `ctest`. The latter
|
||||
option allows many CTest options which can be useful, especially in automated
|
||||
or CI environments.
|
||||
|
||||
### Running specific tests {#running-specific-tests}
|
||||
|
||||
To run a specific test executable, you can just run with `ctest` or run
|
||||
the executable directly. Running directly is often the simplest way when
|
||||
working on a specific test and you want access to the test executable's
|
||||
arguments. For example:
|
||||
|
||||
# run the libcommon tests
|
||||
cd /path/to/kicad/build
|
||||
qa/common/qa_common [parameters]
|
||||
|
||||
For Boost unit tests, you can see the options for the test with `<test> --help`.
|
||||
Common useful patterns:
|
||||
|
||||
* `<test> -t "Utf8/*"` runs all tests in the `Utf8` test suite.
|
||||
* `<test> -t "Utf8/UniIterNull"` runs only a single test in a specific suite.
|
||||
* `<test> -l all` adds more verbose debugging to the output.
|
||||
* `<test> --list_content` lists the test suites and test cases within the
|
||||
test program. You can use these for arguments to `-t`.
|
||||
|
||||
You can rebuild just a specific test with CMake to avoid rebuilding
|
||||
everything when working on a small area, e.g. `make qa_common`.
|
||||
|
||||
## Writing Boost tests {#writing-boost-tests}
|
||||
|
||||
Boost unit tests are straightforward to write. Individual test cases can be
|
||||
registered with:
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SomeTest )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( 1, 1 );
|
||||
}
|
||||
|
||||
There is a range of functions like `BOOST_CHECK`, which are documented
|
||||
[here][boost-test-functions]. Using the most specific function is preferred, as that
|
||||
allows Boost to provide more detailed failures: `BOOST_CHECK( foo == bar )` only
|
||||
reports a mismatch, `BOOST_CHECK_EQUAL( foo, bar )` will show the values of
|
||||
each.
|
||||
|
||||
To output debug messages, you can use `BOOST_TEST_MESSAGE` in the unit tests,
|
||||
which will be visible only if you set the `-l` parameter to `message` or higher.
|
||||
This colours the text differently to make it stand out from other testing
|
||||
messages and standard output.
|
||||
|
||||
You can also use `std::cout`, `printf`, `wxLogDebug` and so on for debug
|
||||
messages inside tested functions (i.e. where you don't have access to the Boost
|
||||
unit test headers). These will always be printed, so take care
|
||||
to remove them before committing, or they'll show up when KiCad runs normally!
|
||||
|
||||
### Expected failures {#expected-failures}
|
||||
|
||||
Sometimes, it is helpful to check in tests that do not pass. However, it is bad
|
||||
practise to intentionally check in commits that break builds (which is what
|
||||
happens if you cause `make test` to fail).
|
||||
|
||||
Boost provides a method of declaring that some specific tests are allowed to fail.
|
||||
This syntax is not consistently available in all supported Boost versions, so you
|
||||
should use the following construct:
|
||||
|
||||
```
|
||||
#include <unit_test_utils/unit_test_utils.h>
|
||||
|
||||
// On platforms with older boosts, the test will be excluded entirely
|
||||
#ifdef HAVE_EXPECTED_FAILURES
|
||||
|
||||
// Declare a test case with 1 "allowed" failure (out of 2, in this case)
|
||||
BOOST_AUTO_TEST_CASE( SomeTest, *boost::unit_test::expected_failures( 1 ) )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( 1, 1 );
|
||||
|
||||
// This check fails, but does not cause a test suite failure
|
||||
BOOST_CHECK_EQUAL( 1, 2 );
|
||||
|
||||
// Further failures *would* be a test suit failure
|
||||
}
|
||||
|
||||
#endif
|
||||
```
|
||||
|
||||
When run, this produces output somewhat like this:
|
||||
|
||||
```
|
||||
qa/common/test_mytest.cpp(123): error: in "MyTests/SomeTest": check 1 == 2 has failed [1 != 2
|
||||
*** No errors detected
|
||||
```
|
||||
|
||||
And the unit test executable returns `0` (success).
|
||||
|
||||
Checking in a failing test is a strictly temporary situation, used to illustrate
|
||||
the triggering of a bug prior to fixing it. This is advantageous, not only from
|
||||
a "project history" perspective, but also to ensure that the test you write to
|
||||
catch the bug in question does, in fact, catch the bug in the first place.
|
||||
|
||||
## Python modules {#python-tests}
|
||||
## Python modules ##
|
||||
|
||||
The Pcbnew Python modules have some test programs in the `qa` directory.
|
||||
You must have the `KICAD_SCRIPTING_MODULES` option on in CMake to
|
||||
build the modules and enable this target.
|
||||
|
||||
The main test script is `qa/test.py` and the test units are in
|
||||
`qa/testcases`. All the test units can by run using `ctest python`, which
|
||||
`qa/testcases`. All the test units can by run using `make qa`, which
|
||||
runs `test.py`.
|
||||
|
||||
You can also run an individual case manually, by making sure the
|
||||
@@ -133,7 +24,7 @@ from the source tree:
|
||||
cd /path/to/kicad/source/qa
|
||||
python2 testcase/test_001_pcb_load.py
|
||||
|
||||
### Diagnosing segfaults {#python-segfaults}
|
||||
### Diagnosing segfaults ###
|
||||
|
||||
Although the module is Python, it links against a C++ library
|
||||
(the same one used by KiCad Pcbnew), so it can segfault if the library
|
||||
@@ -148,162 +39,3 @@ You can run the tests in GDB to trace this:
|
||||
|
||||
If the test segfaults, you will get a familiar backtrace, just like
|
||||
if you were running pcbnew under GDB.
|
||||
|
||||
# Utility programs {#utility-programs}
|
||||
|
||||
KiCad includes some utility programs that can be used for debugging, profiling,
|
||||
analysing or developing certain parts of the code without having to invoke the full
|
||||
GUI program.
|
||||
|
||||
Generally, they are part of the `qa_*_tools` QA executables, each one containing
|
||||
the relevant tools for that library. To list the tools in a given program, pass
|
||||
the `-l` parameter. Most tools provide help with the `-h` argument.
|
||||
To invoke a program:
|
||||
|
||||
qa_<lib>_tools <tool name> [-h] [tool arguments]
|
||||
|
||||
Below is a brief outline of some available tools. For full information and command-line
|
||||
parameters, refer to the tools' usage test (`-h`).
|
||||
|
||||
* `common_tools` (the common library and core functions):
|
||||
* `coroutine`: A simple coroutine example
|
||||
* `io_benchmark`: Show relative speeds of reading files using various IO techniques.
|
||||
* `qa_pcbnew_tools` (pcbnew-related functions):
|
||||
* `drc`: Run and benchmark certain DRC functions on a user-provided `.kicad_pcb` files
|
||||
* `pcb_parser`: Parse user-provided `.kicad_pcb` files
|
||||
* `polygon_generator`: Dump polygons found on a PCB to the console
|
||||
* `polygon_triangulation`: Perform triangulation of zone polygons on PCBs
|
||||
|
||||
# Fuzz testing {#fuzz-testing}
|
||||
|
||||
It is possible to run fuzz testing on some parts of KiCad. To do this for a
|
||||
generic function, you need to be able to pass some kind of input from the fuzz
|
||||
testing tool to the function under test.
|
||||
|
||||
For example, to use the [AFL fuzzing tool][], you will need:
|
||||
|
||||
* A test executable that can:
|
||||
* Receive input from `stdin` to be run by `afl-fuzz`.
|
||||
* Optional: process input from a filename to allow `afl-tmin` to minimise the
|
||||
input files.
|
||||
* To compile this executable with an AFL compiler, to enable the instrumentation
|
||||
that allows the fuzzer to detect the fuzzing state.
|
||||
|
||||
For example, the `qa_pcbnew_tools` executable (which contains `pcb_parser`,
|
||||
a fuzz testing tool for `.kicad_pcb` file parsing) can be compiled like this:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_CXX_COMPILER=/usr/bin/afl-clang-fast++ -DCMAKE_C_COMPILER=/usr/bin/afl-clang-fast ../kicad_src
|
||||
make qa_pcbnew_tools
|
||||
|
||||
You may need to disable core dumps and CPU frequency scaling on your system (AFL
|
||||
will warn you if you should do this). For example, as root:
|
||||
|
||||
# echo core >/proc/sys/kernel/core_pattern
|
||||
# echo performance | tee cpu*/cpufreq/scaling_governor
|
||||
|
||||
To fuzz, run the executable via `afl-fuzz`:
|
||||
|
||||
afl-fuzz -i fuzzin -o fuzzout -m500 qa/pcbnew_tools/qa_pcbnew_tools pcb_parser
|
||||
|
||||
where:
|
||||
|
||||
* `-i` is a directory of files to use as fuzz input "seeds"
|
||||
* `-o` is a directory to write the results (including inputs that provoke crashes
|
||||
or hangs)
|
||||
* `-t` is the maximum time that a run is allowed to take before being declared a "hang"
|
||||
* `-m` is the memory allowed to use (this often needs to be bumped, as KiCad code
|
||||
tends to use a lot of memory to initialise)
|
||||
|
||||
The AFL TUI will then display the fuzzing progress, and you can use the hang- or
|
||||
crash-provoking inputs to debug code as needed.
|
||||
|
||||
# Run-time debugging {#run-time}
|
||||
|
||||
KiCad can be debugged at run-time, either under a full debugger
|
||||
such as GDB, or using simple methods like logging debug to the
|
||||
console.
|
||||
|
||||
## Printing debug {#print-debug}
|
||||
|
||||
If you are compiling KiCad yourself, you can simply add debugging statements to
|
||||
relevant places in the code, for example:
|
||||
|
||||
wxLogDebug( "Value of variable: %d", my_int );
|
||||
|
||||
This produces debug output that can only be seen when compiling
|
||||
in Debug mode.
|
||||
|
||||
You can also use `std::cout` and `printf`.
|
||||
|
||||
Ensure you do not leave this kind of debugging in place when
|
||||
submitting code.
|
||||
|
||||
## Printing trace {#trace-debug}
|
||||
|
||||
Some parts of the code have "trace" that can be enabled selectively according to
|
||||
a "mask", for example:
|
||||
|
||||
wxLogTrace( "TRACEMASK", "My trace, value: %d", my_int );
|
||||
|
||||
This will not be printed by default. To show it, set the `WXTRACE` environment
|
||||
variable when you run KiCad to include the masks you wish to enable:
|
||||
|
||||
$ WXTRACE="TRACEMASK,OTHERMASK" kicad
|
||||
|
||||
When printed, the debug will be prefixed with a timestamp and the trace mask:
|
||||
|
||||
11:22:33: Trace: (TRACEMASK) My trace, value: 42
|
||||
|
||||
If you add a trace mask, define and document the mask as a variable in
|
||||
`include/trace_helpers.h`. This will add it to the [trace mask documentation][].
|
||||
|
||||
Some available masks:
|
||||
|
||||
* Core KiCad functions:
|
||||
* `KICAD_KEY_EVENTS`
|
||||
* `KicadScrollSettings`
|
||||
* `KICAD_FIND_ITEM`
|
||||
* `KICAD_FIND_REPLACE`
|
||||
* `KICAD_NGSPICE`
|
||||
* `KICAD_PLUGINLOADER`
|
||||
* `GAL_PROFILE`
|
||||
* `GAL_CACHED_CONTAINER`
|
||||
* `PNS`
|
||||
* `CN`
|
||||
* `SCROLL_ZOOM` - for the scroll-wheel zooming logic in GAL
|
||||
* Plugin-specific (including "standard" KiCad formats):
|
||||
* `3D_CACHE`
|
||||
* `3D_SG`
|
||||
* `3D_RESOLVER`
|
||||
* `3D_PLUGIN_MANAGER`
|
||||
* `KI_TRACE_CCAMERA`
|
||||
* `PLUGIN_IDF`
|
||||
* `PLUGIN_VRML`
|
||||
* `KICAD_SCH_LEGACY_PLUGIN`
|
||||
* `KICAD_GEDA_PLUGIN`
|
||||
* `KICAD_PCB_PLUGIN`
|
||||
|
||||
# Advanced configuration {#advanced-configuration}
|
||||
|
||||
There are some advance configuration options, which are mostly used for
|
||||
development or testing purposes.
|
||||
|
||||
To set these options, you can create the file `kicad_advanced` and set the keys
|
||||
as desired (the [advanced config documentation][] for a current list. You should
|
||||
never need to set these keys for normal usage - if you do, that's a bug.
|
||||
|
||||
Any features enabled though the advanced configuration system are
|
||||
considered experimental and therefore unsuitable for production use. These
|
||||
features are explicitly not supported or considered fully tested.
|
||||
Issues are still welcome for defects discovered.
|
||||
|
||||
|
||||
[CTest]: https://cmake.org/cmake/help/latest/module/CTest.html
|
||||
[Boost Unit Test framework]: https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/index.html
|
||||
[boost-test-functions]: https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html
|
||||
[AFL fuzzing tool]: http://lcamtuf.coredump.cx/afl/
|
||||
[trace mask documentation]: http://docs.kicad-pcb.org/doxygen/group__trace__env__vars.html
|
||||
[trace mask documentation]: http://docs.kicad-pcb.org/doxygen/group__trace__env__vars.html
|
||||
[advanced config documentation]: http://docs.kicad-pcb.org/doxygen/namespaceAC__KEYS.html
|
||||
|
||||
@@ -30,7 +30,7 @@ Some examples of tools in the Pcbnew GAL are:
|
||||
* The drawing tool - this tool controls the process of drawing graphics
|
||||
elements such as line segments and circles.
|
||||
(pcbnew/tools/drawing_tool.cpp,pcbnew/tools/drawing_tool.h)
|
||||
* The zoom tool - allows the user to zoom in and out.
|
||||
* The zoom tool - allows the user to zoom in and out
|
||||
|
||||
# Major parts of a tool # {#major-parts}
|
||||
|
||||
@@ -60,10 +60,7 @@ or not, has a `TOOL_ACTION` instance. This provides:
|
||||
tooltip and provides a more detailed description if needed.
|
||||
* An "icon", which is shown in menus and on buttons for the action
|
||||
* "Flags" which include:
|
||||
* `AF_ACTIVATE` which indicates that the tool enters an active state. When
|
||||
a tool is active it will keep receiving UI events, such as mouse clicks
|
||||
or key presses, which are normally handled in an event loop (see
|
||||
TOOL_INTERACTIVE::Wait()).
|
||||
* `AF_ACTIVATE` which indicates that the tool enters an active state
|
||||
* A parameter, which allows different actions to call the same function
|
||||
with different effects, for example "step left" and "step right".
|
||||
|
||||
|
||||
@@ -71,12 +71,12 @@ Webpage titles and navigational elements | Header
|
||||
|
||||
This section defines how dialog boxes should be designed. The KiCad project
|
||||
uses the [GNOME User Interface Guidelines][gnome-ui-guidelines] for laying out
|
||||
dialogs. When designing dialogs, follow the [visual layout section of the GNOME
|
||||
User Interface Guidelines][gnome-ui-layout]. KiCad's dialogs may either be
|
||||
designed with [wxFormBuilder][wxformbuilder] or created by hand. However,
|
||||
existing dialogs must be maintained in the same way as they have been
|
||||
implemented. Please use [wxFormBuilder v3.8.0 or later][wxformbuilder-releases]
|
||||
to avoid version mismatch between developers.
|
||||
dialogs. KiCad's dialogs must be designed with [wxFormBuilder][wxformbuilder].
|
||||
As wxFormBuilder available in packages is likely to be a different version than
|
||||
what other developers have installed, it has been decided to use the version
|
||||
kept in a Github repository, branch [wxFB3.5RC-1][wxformbuilder-github] to avoid
|
||||
version mismatch. When designing dialogs, follow the [visual layout section of
|
||||
the GNOME User Interface Guidelines][gnome-ui-layout].
|
||||
|
||||
## Escape Key Termination ## {#dialogs-esc-key}
|
||||
Please note that the escape key termination only works properly if there is a
|
||||
@@ -168,8 +168,8 @@ controls so text should be quoted with single quotes ''. e.g.:
|
||||
[gnome-ui-guidelines]:https://developer.gnome.org/hig/stable/
|
||||
[gnome-ui-layout]:https://developer.gnome.org/hig/stable/visual-layout.html.en
|
||||
[gnome-ui-style]:https://developer.gnome.org/hig/stable/writing-style.html.en
|
||||
[wxformbuilder]:https://github.com/wxFormBuilder/wxFormBuilder
|
||||
[wxformbuilder-releases]:https://github.com/wxFormBuilder/wxFormBuilder/releases
|
||||
[wxformbuilder]:https://sourceforge.net/projects/wxformbuilder/
|
||||
[wxformbuilder-github]:https://github.com/marekr/wxFormBuilder/tree/wxFB3.5-RC1
|
||||
[wxwidgets-doc]:http://docs.wxwidgets.org/3.0/
|
||||
[wxdialog-setescapeid]:http://docs.wxwidgets.org/3.0/classwx_dialog.html#a585869988e308f549128a6a065f387c6
|
||||
[wxwidgets-sizers]:http://docs.wxwidgets.org/3.0/overview_sizer.html
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
# Build file for docset generation.
|
||||
#
|
||||
# Docsets are generated from the Doxygen docs by this process:
|
||||
# * Modify the existing doxygen file for a docset-friendly output
|
||||
# * Run doxygen to generate normal docygen output
|
||||
# * Run a makefile made by doxygen to start the docset
|
||||
# * Run doxytag2zealdb to generate the docset index
|
||||
# * Make a couple of changes to the Plist file and add icons
|
||||
|
||||
find_program(DOXYTAG2ZEALDB doxytag2zealdb)
|
||||
find_program(SED sed)
|
||||
|
||||
if(DOXYGEN_FOUND AND DOXYTAG2ZEALDB AND SED)
|
||||
|
||||
function(get_kicad_doc_version RESULT_NAME)
|
||||
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header(${CMAKE_SOURCE_DIR})
|
||||
|
||||
# Now we have KICAD_VERSION, but it's got () around it
|
||||
string(REPLACE "(" "" KICAD_VERSION ${KICAD_VERSION})
|
||||
string(REPLACE ")" "" KICAD_VERSION ${KICAD_VERSION})
|
||||
|
||||
set (${RESULT_NAME} ${KICAD_VERSION} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
# The DocSet's bundle ID, which is used for most of the ID's
|
||||
set(BUNDLE_ID KiCad)
|
||||
|
||||
# The source for the doxygen config
|
||||
set(SRC_DOXYFILE ${CMAKE_SOURCE_DIR}/Doxyfile)
|
||||
|
||||
# A new doxyfile with the original, plus some extra config
|
||||
set(DOCSET_DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
|
||||
# Various pieces of the docset
|
||||
set(DOCSET_LOC ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html/${BUNDLE_ID}.docset)
|
||||
set(DOXY_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html/Makefile)
|
||||
set(DOXY_TAG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_ID}.tag)
|
||||
set(DOCSET_PLIST ${DOCSET_LOC}/Contents/Info.plist)
|
||||
set(DOCSET_DSIDX ${DOCSET_LOC}/Contents/Resources/docSet.dsidx)
|
||||
|
||||
#icon files
|
||||
set(DOCSET_SRC_ICON16 ${CMAKE_CURRENT_SOURCE_DIR}/icon-16.png)
|
||||
set(DOCSET_ICON16 ${DOCSET_LOC}/icon.png)
|
||||
|
||||
get_kicad_doc_version(KICAD_DOC_VERSION)
|
||||
|
||||
# copy and modify the "normal" Doxyfile
|
||||
file(COPY ${SRC_DOXYFILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(APPEND ${DOCSET_DOXYFILE} "
|
||||
|
||||
# Added for DocSet generation
|
||||
OUTPUT_DIRECTORY = ${CMAKE_CURRENT_BINARY_DIR}/doxygen
|
||||
PROJECT_NAME = ${BUNDLE_ID}
|
||||
PROJECT_NUMBER = ${KICAD_DOC_VERSION}
|
||||
GENERATE_DOCSET = YES
|
||||
DOCSET_FEEDNAME = ${BUNDLE_ID}
|
||||
DOCSET_BUNDLE_ID = ${BUNDLE_ID}
|
||||
DISABLE_INDEX = YES
|
||||
GENERATE_TREEVIEW = NO
|
||||
SEARCHENGINE = NO
|
||||
GENERATE_TAGFILE = ${DOXY_TAG_FILE}"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOCSET_DOXYFILE}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT ${DOXY_TAG_FILE} ${DOXY_MAKEFILE}
|
||||
DEPENDS ${DOCSET_DOXYFILE}
|
||||
COMMENT "Generating Doxygen for DocSet"
|
||||
)
|
||||
|
||||
# Generate the skeleton of the docset
|
||||
# And modify the plist: DocSetPlatformFamily is used for the prefix in Zeal,
|
||||
add_custom_command(
|
||||
COMMAND make || true
|
||||
COMMAND ${SED} -i "/<key>DocSetPlatformFamily<\\/key>/!b;n;s/doxygen/${BUNDLE_ID}/" ${DOCSET_PLIST}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html
|
||||
DEPENDS ${DOXY_MAKEFILE}
|
||||
OUTPUT ${DOCSET_PLIST}
|
||||
COMMENT "Running doxygen-generated makefile"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND ${DOXYTAG2ZEALDB} --tag ${DOXY_TAG_FILE}
|
||||
--db ${DOCSET_DSIDX}
|
||||
--include-parent-scopes
|
||||
--include-function-signatures
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html
|
||||
DEPENDS ${DOCSET_PLIST} ${DOXY_TAG_FILE}
|
||||
OUTPUT ${DOCSET_DSIDX}
|
||||
COMMENT "Generating docset index"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${DOCSET_SRC_ICON16} ${DOCSET_ICON16}
|
||||
DEPENDS ${DOCSET_DSIDX} ${DOCSET_SRC_ICON16}
|
||||
OUTPUT ${DOCSET_ICON16}
|
||||
COMMENT "Copying docset icons"
|
||||
)
|
||||
|
||||
add_custom_target(docset
|
||||
DEPENDS ${DOCSET_ICON16}
|
||||
)
|
||||
|
||||
endif()
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 271 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 8.7 KiB |
+1
-1
@@ -114,7 +114,7 @@ GLM >= 9.5.4 http://glm.g-truc.net/
|
||||
|
||||
pkg-config http://pkgconfig.freedesktop.org/
|
||||
|
||||
Doxygen (optional) http://www.doxygen.nl
|
||||
Doxygen (optional) http://www.stack.nl/~dimitri/doxygen/index.html
|
||||
|
||||
python >= 2.6 (optional) http://python.org/
|
||||
|
||||
|
||||
-661
@@ -1,661 +0,0 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
@@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,255 +0,0 @@
|
||||
Creative Commons Attribution-ShareAlike 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to
|
||||
be bound by the terms and conditions of this Creative Commons
|
||||
Attribution-ShareAlike 4.0 International Public License ("Public License").
|
||||
To the extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of these
|
||||
terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the Licensed
|
||||
Material available under these terms and conditions.
|
||||
|
||||
Section 1 – Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar Rights
|
||||
that is derived from or based upon the Licensed Material and in which the
|
||||
Licensed Material is translated, altered, arranged, transformed, or
|
||||
otherwise modified in a manner requiring permission under the Copyright
|
||||
and Similar Rights held by the Licensor. For purposes of this Public
|
||||
License, where the Licensed Material is a musical work, performance, or
|
||||
sound recording, Adapted Material is always produced where the Licensed
|
||||
Material is synched in timed relation with a moving image.
|
||||
b. Adapter's License means the license You apply to Your Copyright and
|
||||
Similar Rights in Your contributions to Adapted Material in accordance
|
||||
with the terms and conditions of this Public License.
|
||||
c. BY-SA Compatible License means a license listed at
|
||||
creativecommons.org/compatiblelicenses, approved by Creative Commons as
|
||||
essentially the equivalent of this Public License.
|
||||
d. Copyright and Similar Rights means copyright and/or similar rights closely
|
||||
related to copyright including, without limitation, performance,
|
||||
broadcast, sound recording, and Sui Generis Database Rights, without
|
||||
regard to how the rights are labeled or categorized. For purposes of this
|
||||
Public License, the rights specified in Section 2(b)(1)-(2) are not
|
||||
Copyright and Similar Rights.
|
||||
e. Effective Technological Measures means those measures that, in the absence
|
||||
of proper authority, may not be circumvented under laws fulfilling
|
||||
obligations under Article 11 of the WIPO Copyright Treaty adopted on
|
||||
December 20, 1996, and/or similar international agreements.
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or any other
|
||||
exception or limitation to Copyright and Similar Rights that applies to
|
||||
Your use of the Licensed Material.
|
||||
g. License Elements means the license attributes listed in the name of a
|
||||
Creative Commons Public License. The License Elements of this Public
|
||||
License are Attribution and ShareAlike.
|
||||
h. Licensed Material means the artistic or literary work, database, or other
|
||||
material to which the Licensor applied this Public License.
|
||||
i. Licensed Rights means the rights granted to You subject to the terms and
|
||||
conditions of this Public License, which are limited to all Copyright and
|
||||
Similar Rights that apply to Your use of the Licensed Material and that
|
||||
the Licensor has authority to license.
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights under this
|
||||
Public License.
|
||||
k. Share means to provide material to the public by any means or process thati
|
||||
requires permission under the Licensed Rights, such as reproduction,
|
||||
public display, public performance, distribution, dissemination,
|
||||
communication, or importation, and to make material available to the
|
||||
public including in ways that members of the public may access the
|
||||
material from a place and at a time individually chosen by them.
|
||||
l. Sui Generis Database Rights means rights other than copyright resulting
|
||||
from Directive 96/9/EC of the European Parliament and of the Council of 11
|
||||
March 1996 on the legal protection of databases, as amended and/or
|
||||
succeeded, as well as other essentially equivalent rights anywhere in the
|
||||
world.
|
||||
m. You means the individual or entity exercising the Licensed Rights under
|
||||
this Public License. Your has a corresponding meaning.
|
||||
|
||||
Section 2 – Scope.
|
||||
|
||||
a. License grant.
|
||||
1. Subject to the terms and conditions of this Public License, the
|
||||
Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to exercise the
|
||||
Licensed Rights in the Licensed Material to:
|
||||
A. reproduce and Share the Licensed Material, in whole or in part; and
|
||||
B. produce, reproduce, and Share Adapted Material.
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
|
||||
and Limitations apply to Your use, this Public License does not apply,
|
||||
and you do not need to comply with its terms and conditions.
|
||||
3. Term. The term of this Public License is specified in Section 6(a).
|
||||
4. Media and formats; technical modifications allowed. The Licensor
|
||||
authorizes You to exercise the Licensed Rights in all media and formats
|
||||
whether now known or hereafter created, and to make technical
|
||||
modifications necessary to do so. The Licensor waives and/or agrees not
|
||||
to assert any right or authority to forbid You from making technical
|
||||
modifications necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective Technological
|
||||
Measures. For purposes of this Public License, simply making
|
||||
modifications authorized by this Section 2(a)(4) never produces Adapted
|
||||
Material.
|
||||
5. Downstream recipients.
|
||||
A. Offer from the Licensor – Licensed Material. Every recipient of the
|
||||
Licensed Material automatically receives an offer from the Licensor
|
||||
to exercise the Licensed Rights under the terms and conditions of
|
||||
this Public License.
|
||||
B. Additional offer from the Licensor – Adapted Material. Every
|
||||
recipient of Adapted Material from You automatically receives an
|
||||
offer from the Licensor to exercise the Licensed Rights in the
|
||||
Adapted Material under the conditions of the Adapter’s License You
|
||||
apply.
|
||||
C. No downstream restrictions. You may not offer or impose any
|
||||
additional or different terms or conditions on, or apply any
|
||||
Effective Technological Measures to, the Licensed Material if doing
|
||||
so restricts exercise of the Licensed Rights by any recipient of
|
||||
the Licensed Material.
|
||||
6. No endorsement. Nothing in this Public License constitutes or may be
|
||||
construed as permission to assert or imply that You are, or that Your
|
||||
use of the Licensed Material is, connected with, or sponsored,
|
||||
endorsed, or granted official status by, the Licensor or others
|
||||
designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
1. Moral rights, such as the right of integrity, are not licensed under
|
||||
this Public License, nor are publicity, privacy, and/or other similar
|
||||
personality rights; however, to the extent possible, the Licensor
|
||||
waives and/or agrees not to assert any such rights held by the Licensor
|
||||
to the limited extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
2. Patent and trademark rights are not licensed under this Public License.
|
||||
3. To the extent possible, the Licensor waives any right to collect
|
||||
royalties from You for the exercise of the Licensed Rights, whether
|
||||
directly or through a collecting society under any voluntary or
|
||||
waivable statutory or compulsory licensing scheme. In all other cases
|
||||
the Licensor expressly reserves any right to collect such royalties.
|
||||
|
||||
Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
1. If You Share the Licensed Material (including in modified form), You
|
||||
must:
|
||||
A. retain the following if it is supplied by the Licensor with the
|
||||
Licensed Material:
|
||||
i. identification of the creator(s) of the Licensed Material and any
|
||||
others designated to receive attribution, in any reasonable manner
|
||||
requested by the Licensor (including by pseudonym if designated);
|
||||
ii. a copyright notice;
|
||||
iii. a notice that refers to this Public License;
|
||||
iv. a notice that refers to the disclaimer of warranties;
|
||||
v. a URI or hyperlink to the Licensed Material to the extent
|
||||
reasonably practicable;
|
||||
B. indicate if You modified the Licensed Material and retain an
|
||||
indication of any previous modifications; and
|
||||
C. indicate the Licensed Material is licensed under this Public
|
||||
License, and include the text of, or the URI or hyperlink to, this
|
||||
Public License.
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable
|
||||
manner based on the medium, means, and context in which You Share the
|
||||
Licensed Material. For example, it may be reasonable to satisfy the
|
||||
conditions by providing a URI or hyperlink to a resource that includes
|
||||
the required information.
|
||||
3. If requested by the Licensor, You must remove any of the information
|
||||
required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||
|
||||
b. ShareAlike.
|
||||
In addition to the conditions in Section 3(a), if You Share Adapted
|
||||
Material You produce, the following conditions also apply.
|
||||
1. The Adapter’s License You apply must be a Creative Commons license with
|
||||
the same License Elements, this version or later, or a BY-SA Compatible
|
||||
License.
|
||||
2. You must include the text of, or the URI or hyperlink to, the Adapter's
|
||||
License You apply. You may satisfy this condition in any reasonable
|
||||
manner based on the medium, means, and context in which You Share
|
||||
Adapted Material.
|
||||
3. You may not offer or impose any additional or different terms or
|
||||
conditions on, or apply any Effective Technological Measures to,
|
||||
Adapted Material that restrict exercise of the rights granted under the
|
||||
Adapter's License You apply.
|
||||
|
||||
Section 4 – Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to
|
||||
Your use of the Licensed Material:
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to
|
||||
extract, reuse, reproduce, and Share all or a substantial portion of the
|
||||
contents of the database;
|
||||
b. if You include all or a substantial portion of the database contents in a
|
||||
database in which You have Sui Generis Database Rights, then the database
|
||||
in which You have Sui Generis Database Rights (but not its individual
|
||||
contents) is Adapted Material, including for purposes of Section 3(b); and
|
||||
c. You must comply with the conditions in Section 3(a) if You Share all or a
|
||||
substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace
|
||||
Your obligations under this Public License where the Licensed Rights include
|
||||
other Copyright and Similar Rights.
|
||||
|
||||
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. Unless otherwise separately undertaken by the Licensor, to the extent
|
||||
possible, the Licensor offers the Licensed Material as-is and as-available,
|
||||
and makes no representations or warranties of any kind concerning the
|
||||
Licensed Material, whether express, implied, statutory, or other. This
|
||||
includes, without limitation, warranties of title, merchantability, fitness
|
||||
for a particular purpose, non-infringement, absence of latent or other
|
||||
defects, accuracy, or the presence or absence of errors, whether or not
|
||||
known or discoverable. Where disclaimers of warranties are not allowed in
|
||||
full or in part, this disclaimer may not apply to You.
|
||||
b. To the extent possible, in no event will the Licensor be liable to You on
|
||||
any legal theory (including, without limitation, negligence) or otherwise
|
||||
for any direct, special, indirect, incidental, consequential, punitive,
|
||||
exemplary, or other losses, costs, expenses, or damages arising out of
|
||||
this Public License or use of the Licensed Material, even if the Licensor
|
||||
has been advised of the possibility of such losses, costs, expenses, or
|
||||
damages. Where a limitation of liability is not allowed in full or in
|
||||
part, this limitation may not apply to You.
|
||||
c. The disclaimer of warranties and limitation of liability provided above
|
||||
shall be interpreted in a manner that, to the extent possible, most
|
||||
closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
Section 6 – Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and Similar
|
||||
Rights licensed here. However, if You fail to comply with this Public
|
||||
License, then Your rights under this Public License terminate
|
||||
automatically.
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
1. automatically as of the date the violation is cured, provided it is
|
||||
cured within 30 days of Your discovery of the violation; or
|
||||
2. upon express reinstatement by the Licensor.
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any right
|
||||
the Licensor may have to seek remedies for Your violations of this Public
|
||||
License.
|
||||
c. For the avoidance of doubt, the Licensor may also offer the Licensed
|
||||
Material under separate terms or conditions or stop distributing the
|
||||
Licensed Material at any time; however, doing so will not terminate this
|
||||
Public License.
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
Section 7 – Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different terms or
|
||||
conditions communicated by You unless expressly agreed.
|
||||
b. Any arrangements, understandings, or agreements regarding the Licensed
|
||||
Material not stated herein are separate from and independent of the terms
|
||||
and conditions of this Public License.
|
||||
|
||||
Section 8 – Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and shall not
|
||||
be interpreted to, reduce, limit, restrict, or impose conditions on any use
|
||||
of the Licensed Material that could lawfully be made without permission
|
||||
under this Public License.
|
||||
b. To the extent possible, if any provision of this Public License is deemed
|
||||
unenforceable, it shall be automatically reformed to the minimum extent
|
||||
necessary to make it enforceable. If the provision cannot be reformed, it
|
||||
shall be severed from this Public License without affecting the
|
||||
enforceability of the remaining terms and conditions.
|
||||
c. No term or condition of this Public License will be waived and no failure
|
||||
to comply consented to unless expressly agreed to by the Licensor.
|
||||
d. Nothing in this Public License constitutes or may be interpreted as a
|
||||
limitation upon, or waiver of, any privileges and immunities that apply to
|
||||
the Licensor or You, including from the legal processes of any jurisdiction
|
||||
or authority.
|
||||
-674
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
|
||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
||||
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -1,21 +0,0 @@
|
||||
The majority of KiCad's source code is developed and distributed under the terms
|
||||
of the GPLv3 or later. However, It does include some third-party code licensed
|
||||
under AGPLv3 or later as well as sections licensed under the BOOST license v1.0
|
||||
and portions licensed under the ISC license.
|
||||
|
||||
These licenses are compatible, but a combined works as is will be governed under
|
||||
the terms of the AGPLv3 (or later). This includes any binary distribution of the
|
||||
KiCad EDA suite by the KiCad project or any third party, e.g. Linux distributor.
|
||||
|
||||
You are free to use the *sources* under the terms of their respective licenses.
|
||||
|
||||
Licensed under AGPLv3 (or later):
|
||||
- TTL [https://www.sintef.no/projectweb/geometry-toolkits/ttl/], sources in include/ttl/*
|
||||
Licensed under BOOSTv1:
|
||||
- libcontext [https://github.com/boostorg/context], sources in common/system/libcontext.cpp
|
||||
Licensed under ISC:
|
||||
- portions of code in include/geometry/polygon_triangulation.h
|
||||
Licensed under CC-BY-SA-4.0:
|
||||
- All the demo files provided in demos/*
|
||||
Licensed under GPLv3 (or later):
|
||||
- All remaining code not listed above
|
||||
+2
-2
@@ -40,8 +40,8 @@ polygon - Sourcecode of the polygon library
|
||||
potrace - Sourcecode of the potrace library, used in bitmap2component
|
||||
qa - Testcases using the python interface
|
||||
resources - Resources for freedesktop mime-types for linux
|
||||
scripting - SWIG Python scripting definitions and build scripts
|
||||
scripts - Example scripts for distribution with KiCad
|
||||
scripting - SWIG Python scripting definitions
|
||||
scripts - Helper scripts for various things
|
||||
template - Project and pagelayout templates
|
||||
tools - Other miscellaneous helpers for testing
|
||||
utils - Small utils for kicad, e.g. IDF tools
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
|
||||
@@ -6,6 +6,7 @@ endif()
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
../potrace
|
||||
../polygon
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
@@ -48,6 +49,8 @@ add_executable( bitmap2component WIN32 MACOSX_BUNDLE
|
||||
|
||||
target_link_libraries( bitmap2component
|
||||
common
|
||||
polygon
|
||||
bitmaps
|
||||
gal
|
||||
${wxWidgets_LIBRARIES}
|
||||
potrace
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* Copyright (C) 1992-2019 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2017 Kicad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <kiway.h>
|
||||
#include <kiface_i.h>
|
||||
|
||||
#include <wx/rawbmp.h>
|
||||
#include <potracelib.h>
|
||||
|
||||
#include "bitmap2component.h"
|
||||
@@ -80,7 +79,7 @@ private:
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_frameSize;
|
||||
wxPoint m_framePos;
|
||||
std::unique_ptr<wxConfigBase> m_config;
|
||||
wxConfigBase* m_config;
|
||||
|
||||
public:
|
||||
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
@@ -92,9 +91,7 @@ public:
|
||||
private:
|
||||
|
||||
// Event handlers
|
||||
void OnPaintInit( wxPaintEvent& event ) override;
|
||||
void OnPaintGreyscale( wxPaintEvent& event ) override;
|
||||
void OnPaintBW( wxPaintEvent& event ) override;
|
||||
void OnPaint( wxPaintEvent& event ) override;
|
||||
void OnLoadFile( wxCommandEvent& event ) override;
|
||||
void OnExport( wxCommandEvent& event ) override;
|
||||
|
||||
@@ -128,7 +125,7 @@ private:
|
||||
// called when texts controls which handle the image resolution
|
||||
// lose the focus, to ensure the right values are displayed
|
||||
// because the m_imageDPI are clipped to acceptable values, and
|
||||
// the text displayed could be differ during text editing
|
||||
// the text displayed could be differ during text edition
|
||||
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||
void UpdateDPITextValueX( wxMouseEvent& event )
|
||||
{
|
||||
@@ -226,6 +223,8 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_MODLAYER, m_radio_PCBLayer->GetSelection() );
|
||||
|
||||
delete m_config;
|
||||
|
||||
/* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
*/
|
||||
@@ -233,59 +232,30 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event )
|
||||
void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC pict_dc( m_InitialPicturePanel );
|
||||
#else
|
||||
wxPaintDC pict_dc( m_InitialPicturePanel );
|
||||
#endif
|
||||
|
||||
m_InitialPicturePanel->PrepareDC( pict_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Pict_Bitmap.IsOk() )
|
||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#else
|
||||
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#endif
|
||||
|
||||
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Greyscale_Bitmap.IsOk() )
|
||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC nb_dc( m_BNPicturePanel );
|
||||
#else
|
||||
wxPaintDC pict_dc( m_InitialPicturePanel );
|
||||
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
wxPaintDC nb_dc( m_BNPicturePanel );
|
||||
#endif
|
||||
|
||||
m_InitialPicturePanel->PrepareDC( pict_dc );
|
||||
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
|
||||
m_BNPicturePanel->PrepareDC( nb_dc );
|
||||
|
||||
if( m_BN_Bitmap.IsOk() )
|
||||
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Pict_Bitmap.IsOk() && m_Greyscale_Bitmap.IsOk() && m_BN_Bitmap.IsOk() )
|
||||
{
|
||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, false );
|
||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, false );
|
||||
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +290,8 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
|
||||
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_Pict_Image.Destroy();
|
||||
// Prj().MaybeLoadProjectSettings();
|
||||
|
||||
m_BitmapFileName = aFileSet[0];
|
||||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
@@ -367,26 +338,11 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
||||
m_Greyscale_Image.Destroy();
|
||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||
|
||||
if( m_Pict_Bitmap.GetMask() )
|
||||
{
|
||||
for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ )
|
||||
{
|
||||
for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ )
|
||||
{
|
||||
if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() &&
|
||||
m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() &&
|
||||
m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() )
|
||||
{
|
||||
m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_Negative )
|
||||
NegateGreyscaleImage( );
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
|
||||
m_NB_Image = m_Greyscale_Image;
|
||||
Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
|
||||
@@ -437,30 +393,26 @@ void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
||||
|
||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
{
|
||||
unsigned int pixin;
|
||||
unsigned char pixout;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
unsigned char threshold = aThreshold * 255;
|
||||
unsigned char alpha_thresh = 0.7 * threshold;
|
||||
unsigned int threshold = (int)(aThreshold * 256);
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
unsigned char pixout;
|
||||
auto pixin = m_Greyscale_Image.GetGreen( x, y );
|
||||
auto alpha = m_Greyscale_Image.HasAlpha() ?
|
||||
m_Greyscale_Image.GetAlpha( x, y ) : wxALPHA_OPAQUE;
|
||||
pixin = m_Greyscale_Image.GetGreen( x, y );
|
||||
|
||||
if( pixin < threshold || alpha < alpha_thresh )
|
||||
if( pixin < threshold )
|
||||
pixout = 0;
|
||||
else
|
||||
pixout = 255;
|
||||
|
||||
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
|
||||
|
||||
}
|
||||
|
||||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -485,7 +437,6 @@ void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& )
|
||||
if( m_checkNegative->GetValue() != m_Negative )
|
||||
{
|
||||
NegateGreyscaleImage();
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
m_Negative = m_checkNegative->GetValue();
|
||||
@@ -698,8 +649,8 @@ void BM2CMP_FRAME::ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
auto pix = m_NB_Image.GetGreen( x, y );
|
||||
BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 );
|
||||
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
||||
BM_PUT( potrace_bitmap, x, y, pix ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jan 17 2019)
|
||||
// C++ code generated with wxFormBuilder (version Apr 19 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -12,167 +12,167 @@
|
||||
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_InitialPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
|
||||
m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true );
|
||||
m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
|
||||
m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
|
||||
m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
|
||||
m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_BNPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false );
|
||||
|
||||
|
||||
bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* brightSizer;
|
||||
brightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxStaticBoxSizer* sbSizerInfo;
|
||||
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
|
||||
|
||||
|
||||
wxFlexGridSizer* fgSizerInfo;
|
||||
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
fgSizerInfo->AddGrowableCol( 1 );
|
||||
fgSizerInfo->AddGrowableCol( 2 );
|
||||
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
|
||||
m_staticTextSize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextSize->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextSize, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeXValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeYValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizePixUnits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_staticTextSize1 = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextSize1->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextSize1, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
m_SizeXValue_mm = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeXValue_mm->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue_mm, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_SizeYValue_mm = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeYValue_mm->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYValue_mm, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_Size_mmxUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Size_mmxUnits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_Size_mmxUnits, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextBPP->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPunits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
fgSizerInfo->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_staticTextBPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Resolution:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextBPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextBPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_DPIValueX = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPIValueX->SetMinSize( wxSize( 40,-1 ) );
|
||||
|
||||
|
||||
fgSizerInfo->Add( m_DPIValueX, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_DPIValueY = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPIValueY->SetMinSize( wxSize( 40,-1 ) );
|
||||
|
||||
|
||||
fgSizerInfo->Add( m_DPIValueY, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_DPI_Units = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("DPI"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPI_Units->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_DPI_Units, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonExport = new wxButton( m_panelRight, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonExport->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
|
||||
|
||||
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
|
||||
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
||||
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radioBoxFormat->SetSelection( 1 );
|
||||
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
wxStaticBoxSizer* sbSizer2;
|
||||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL );
|
||||
|
||||
|
||||
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ThresholdText->Wrap( -1 );
|
||||
sbSizer2->Add( m_ThresholdText, 0, 0, 5 );
|
||||
|
||||
|
||||
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
||||
|
||||
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer2->Add( m_checkNegative, 0, wxBOTTOM|wxTOP, 10 );
|
||||
|
||||
|
||||
|
||||
|
||||
brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
|
||||
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
|
||||
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radio_PCBLayer->SetSelection( 3 );
|
||||
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
|
||||
|
||||
|
||||
brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_panelRight->SetSizer( brightSizer );
|
||||
m_panelRight->Layout();
|
||||
brightSizer->Fit( m_panelRight );
|
||||
bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_DPIValueX->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueX ), NULL, this );
|
||||
m_DPIValueX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||
m_DPIValueY->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueY ), NULL, this );
|
||||
@@ -187,9 +187,9 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||
m_DPIValueX->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueX ), NULL, this );
|
||||
m_DPIValueX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||
m_DPIValueY->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueY ), NULL, this );
|
||||
@@ -199,5 +199,5 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
m_radioBoxFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user